Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#6662 regdeps ISA: virtual registers #6783

Merged
merged 22 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
bc51495
i#6662 regdeps ISA: virtual registers
edeiana Apr 18, 2024
8a39c9b
Merge branch 'master' into i6662-virtual-regs
edeiana Apr 18, 2024
6702851
Fixed build error for AARCH64.
Apr 18, 2024
20eb2a2
Fixed define. From X64 (always defined apparently?) to X86_64.
Apr 18, 2024
aba1fc3
Fixed formatting.
edeiana Apr 18, 2024
5b1f61d
Merge branch 'master' into i6662-virtual-regs
edeiana Apr 18, 2024
398900c
Addressed PR feedback.
edeiana Apr 19, 2024
009cf26
Updated API names in doc.
edeiana Apr 19, 2024
07efe1f
Removed unused headers.
edeiana Apr 19, 2024
acac875
Improved readability of d_r_reg_id_to_virtual[] for all arches.
edeiana Apr 20, 2024
b639a71
Improving readability following dr_reg_fixer[].
edeiana Apr 20, 2024
15aefbd
Making dr_reg_to_virtual() private (now called: d_r_reg_to_virtual()).
edeiana Apr 22, 2024
66d7cbd
Removed dr_get_virtual_register_name() API.
edeiana Apr 22, 2024
7464642
Improved explanation of why we need to set the size for virtual regs.
edeiana Apr 22, 2024
e75d683
Fixed grammar.
edeiana Apr 22, 2024
8717389
Added check that DR_REG_V enums are never equal to
edeiana Apr 23, 2024
c4d2b56
Fixed stale comment.
edeiana Apr 23, 2024
967afe6
Fixed comment, removed unnecessary header.
edeiana Apr 23, 2024
42af79e
Addressed code-review feedback on better comments.
edeiana Apr 24, 2024
4832ef1
Merge branch 'master' into i6662-virtual-regs
edeiana Apr 24, 2024
e04625e
We need a doxygen comment for DR_REG_V0 in order to
edeiana Apr 24, 2024
7e3fbea
Fixed return value bug in tests.
edeiana Apr 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion api/docs/release.dox
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ Further non-compatibility-affecting changes include:
purpose of preserving register dependencies.
- Added instr_convert_to_isa_regdeps() API that converts an #instr_t from a real ISA
(e.g., #DR_ISA_AMD64) to the #DR_ISA_REGDEPS synthetic ISA.

- Added dr_reg_to_virtual() which takes a regular DR_REG_ register and returns a DR_REG_V
edeiana marked this conversation as resolved.
Show resolved Hide resolved
virtual register for #DR_ISA_REGDEPS.
- Added dr_get_virtual_register_name() which takes a virtual DR_REG_V register (used by
edeiana marked this conversation as resolved.
Show resolved Hide resolved
#DR_ISA_REGDEPS) and returns its string name (as const char *).

edeiana marked this conversation as resolved.
Show resolved Hide resolved
**************************************************
<hr>
Expand Down
1 change: 1 addition & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ set(DECODER_SRCS
ir/${ARCH_NAME}/decode.c
ir/encode_shared.c
ir/${ARCH_NAME}/encode.c
ir/isa_regdeps/encoding_common.c
ir/isa_regdeps/encode.c
ir/isa_regdeps/decode.c
ir/disassemble_shared.c
Expand Down
171 changes: 171 additions & 0 deletions core/ir/aarch64/encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,177 @@ const reg_id_t dr_reg_fixer[] = { REG_NULL,

DR_REG_CNTVCT_EL0,
};

/* Maps real ISA registers to their corresponding virtual DR_ISA_REGDEPS register.
* Note that we map real sub-registers to their corresponding containing virtual register.
* Same size as dr_reg_fixer[], keep them synched.
*/
const reg_id_t d_r_reg_id_to_virtual[] = {
DR_REG_NULL, /* DR_REG_NULL */
DR_REG_NULL, /* DR_REG_NULL */

#define VIRTUAL_XREGS
DR_REG_V0, DR_REG_V1, DR_REG_V2, DR_REG_V3, DR_REG_V4, DR_REG_V5, DR_REG_V6, \
DR_REG_V7, DR_REG_V8, DR_REG_V9, DR_REG_V10, DR_REG_V11, DR_REG_V12, DR_REG_V13, \
DR_REG_V14, DR_REG_V15, DR_REG_V16, DR_REG_V17, DR_REG_V18, DR_REG_V19, \
DR_REG_V20, DR_REG_V21, DR_REG_V22, DR_REG_V23, DR_REG_V24, DR_REG_V25, \
DR_REG_V26, DR_REG_V27, DR_REG_V28, DR_REG_V29, DR_REG_V30, DR_REG_V31, \
DR_REG_V32,

VIRTUAL_XREGS /* from DR_REG_X0 to DR_REG_XZR */
VIRTUAL_XREGS /* from DR_REG_W0 to DR_REG_WZR */
#undef VIRTUAL_XREGS

#define VIRTUAL_ZREGS
DR_REG_V33, DR_REG_V34, DR_REG_V35, DR_REG_V36, DR_REG_V37, DR_REG_V38, DR_REG_V39, \
DR_REG_V40, DR_REG_V41, DR_REG_V42, DR_REG_V43, DR_REG_V44, DR_REG_V45, DR_REG_V46, \
DR_REG_V47, DR_REG_V48, DR_REG_V49, DR_REG_V50, DR_REG_V51, DR_REG_V52, \
DR_REG_V53, DR_REG_V54, DR_REG_V55, DR_REG_V56, DR_REG_V57, DR_REG_V58, \
DR_REG_V59, DR_REG_V60, DR_REG_V61, DR_REG_V62, DR_REG_V63, DR_REG_V64,

VIRTUAL_ZREGS /* from DR_REG_Z0 to DR_REG_Z31 */
VIRTUAL_ZREGS /* from DR_REG_Q0 to DR_REG_Q31 */
VIRTUAL_ZREGS /* from DR_REG_D0 to DR_REG_D31 */
VIRTUAL_ZREGS /* from DR_REG_S0 to DR_REG_S31 */
VIRTUAL_ZREGS /* from DR_REG_H0 to DR_REG_H31 */
VIRTUAL_ZREGS /* from DR_REG_B0 to DR_REG_B31 */
edeiana marked this conversation as resolved.
Show resolved Hide resolved
#undef VIRTUAL_ZREGS

DR_REG_V65, /* DR_REG_NZCV */
DR_REG_V66, /* DR_REG_FPCR */
DR_REG_V67, /* DR_REG_FPSR */
DR_REG_V68, /* DR_REG_MDCCSR_EL0 */
DR_REG_V69, /* DR_REG_DBGDTR_EL0 */
DR_REG_V70, /* DR_REG_DBGDTRRX_EL0 */
DR_REG_V71, /* DR_REG_SP_EL0 */
DR_REG_V72, /* DR_REG_SPSEL */
DR_REG_V73, /* DR_REG_DAIFSET */
DR_REG_V74, /* DR_REG_DAIFCLR */
DR_REG_V75, /* DR_REG_CURRENTEL */
DR_REG_V76, /* DR_REG_PAN */
DR_REG_V77, /* DR_REG_UAO */
DR_REG_V78, /* DR_REG_CTR_EL0 */
DR_REG_V79, /* DR_REG_DCZID_EL0 */
DR_REG_V80, /* DR_REG_RNDR */
DR_REG_V81, /* DR_REG_RNDRRS */
DR_REG_V82, /* DR_REG_DAIF */
DR_REG_V83, /* DR_REG_DIT */
DR_REG_V84, /* DR_REG_SSBS */
DR_REG_V85, /* DR_REG_TCO */
DR_REG_V86, /* DR_REG_DSPSR_EL0 */
DR_REG_V87, /* DR_REG_DLR_EL0 */
DR_REG_V88, /* DR_REG_PMCR_EL0 */
DR_REG_V89, /* DR_REG_PMCNTENSET_EL0 */
DR_REG_V90, /* DR_REG_PMCNTENCLR_EL0 */
DR_REG_V91, /* DR_REG_PMOVSCLR_EL0 */
DR_REG_V92, /* DR_REG_PMSWINC_EL0 */
DR_REG_V93, /* DR_REG_PMSELR_EL0 */
DR_REG_V94, /* DR_REG_PMCEID0_EL0 */
DR_REG_V95, /* DR_REG_PMCEID1_EL0 */
DR_REG_V96, /* DR_REG_PMCCNTR_EL0 */
DR_REG_V97, /* DR_REG_PMXEVTYPER_EL0 */
DR_REG_V98, /* DR_REG_PMXEVCNTR_EL0 */
DR_REG_V99, /* DR_REG_PMUSERENR_EL0 */
DR_REG_V100, /* DR_REG_PMOVSSET_EL0 */
DR_REG_V101, /* DR_REG_SCXTNUM_EL0 */
DR_REG_V102, /* DR_REG_CNTFRQ_EL0 */
DR_REG_V103, /* DR_REG_CNTPCT_EL0 */
DR_REG_V104, /* DR_REG_CNTP_TVAL_EL0 */
DR_REG_V105, /* DR_REG_CNTP_CTL_EL0 */
DR_REG_V106, /* DR_REG_CNTP_CVAL_EL0 */
DR_REG_V107, /* DR_REG_CNTV_TVAL_EL0 */
DR_REG_V108, /* DR_REG_CNTV_CTL_EL0 */
DR_REG_V109, /* DR_REG_CNTV_CVAL_EL0 */
DR_REG_V110, /* DR_REG_PMEVCNTR0_EL0 */
DR_REG_V111, /* DR_REG_PMEVCNTR1_EL0 */
DR_REG_V112, /* DR_REG_PMEVCNTR2_EL0 */
DR_REG_V113, /* DR_REG_PMEVCNTR3_EL0 */
DR_REG_V114, /* DR_REG_PMEVCNTR4_EL0 */
DR_REG_V115, /* DR_REG_PMEVCNTR5_EL0 */
DR_REG_V116, /* DR_REG_PMEVCNTR6_EL0 */
DR_REG_V117, /* DR_REG_PMEVCNTR7_EL0 */
DR_REG_V118, /* DR_REG_PMEVCNTR8_EL0 */
DR_REG_V119, /* DR_REG_PMEVCNTR9_EL0 */
DR_REG_V120, /* DR_REG_PMEVCNTR10_EL0 */
DR_REG_V121, /* DR_REG_PMEVCNTR11_EL0 */
DR_REG_V122, /* DR_REG_PMEVCNTR12_EL0 */
DR_REG_V123, /* DR_REG_PMEVCNTR13_EL0 */
DR_REG_V124, /* DR_REG_PMEVCNTR14_EL0 */
DR_REG_V125, /* DR_REG_PMEVCNTR15_EL0 */
DR_REG_V126, /* DR_REG_PMEVCNTR16_EL0 */
DR_REG_V127, /* DR_REG_PMEVCNTR17_EL0 */
DR_REG_V128, /* DR_REG_PMEVCNTR18_EL0 */
DR_REG_V129, /* DR_REG_PMEVCNTR19_EL0 */
DR_REG_V130, /* DR_REG_PMEVCNTR20_EL0 */
DR_REG_V131, /* DR_REG_PMEVCNTR21_EL0 */
DR_REG_V132, /* DR_REG_PMEVCNTR22_EL0 */
DR_REG_V133, /* DR_REG_PMEVCNTR23_EL0 */
DR_REG_V134, /* DR_REG_PMEVCNTR24_EL0 */
DR_REG_V135, /* DR_REG_PMEVCNTR25_EL0 */
DR_REG_V136, /* DR_REG_PMEVCNTR26_EL0 */
DR_REG_V137, /* DR_REG_PMEVCNTR27_EL0 */
DR_REG_V138, /* DR_REG_PMEVCNTR28_EL0 */
DR_REG_V139, /* DR_REG_PMEVCNTR29_EL0 */
DR_REG_V140, /* DR_REG_PMEVCNTR30_EL0 */
DR_REG_V141, /* DR_REG_PMEVTYPER0_EL0 */
DR_REG_V142, /* DR_REG_PMEVTYPER1_EL0 */
DR_REG_V143, /* DR_REG_PMEVTYPER2_EL0 */
DR_REG_V144, /* DR_REG_PMEVTYPER3_EL0 */
DR_REG_V145, /* DR_REG_PMEVTYPER4_EL0 */
DR_REG_V146, /* DR_REG_PMEVTYPER5_EL0 */
DR_REG_V147, /* DR_REG_PMEVTYPER6_EL0 */
DR_REG_V148, /* DR_REG_PMEVTYPER7_EL0 */
DR_REG_V149, /* DR_REG_PMEVTYPER8_EL0 */
DR_REG_V150, /* DR_REG_PMEVTYPER9_EL0 */
DR_REG_V151, /* DR_REG_PMEVTYPER10_EL0 */
DR_REG_V152, /* DR_REG_PMEVTYPER11_EL0 */
DR_REG_V153, /* DR_REG_PMEVTYPER12_EL0 */
DR_REG_V154, /* DR_REG_PMEVTYPER13_EL0 */
DR_REG_V155, /* DR_REG_PMEVTYPER14_EL0 */
DR_REG_V156, /* DR_REG_PMEVTYPER15_EL0 */
DR_REG_V157, /* DR_REG_PMEVTYPER16_EL0 */
DR_REG_V158, /* DR_REG_PMEVTYPER17_EL0 */
DR_REG_V159, /* DR_REG_PMEVTYPER18_EL0 */
DR_REG_V160, /* DR_REG_PMEVTYPER19_EL0 */
DR_REG_V161, /* DR_REG_PMEVTYPER20_EL0 */
DR_REG_V162, /* DR_REG_PMEVTYPER21_EL0 */
DR_REG_V163, /* DR_REG_PMEVTYPER22_EL0 */
DR_REG_V164, /* DR_REG_PMEVTYPER23_EL0 */
DR_REG_V165, /* DR_REG_PMEVTYPER24_EL0 */
DR_REG_V166, /* DR_REG_PMEVTYPER25_EL0 */
DR_REG_V167, /* DR_REG_PMEVTYPER26_EL0 */
DR_REG_V168, /* DR_REG_PMEVTYPER27_EL0 */
DR_REG_V169, /* DR_REG_PMEVTYPER28_EL0 */
DR_REG_V170, /* DR_REG_PMEVTYPER29_EL0 */
DR_REG_V171, /* DR_REG_PMEVTYPER30_EL0 */
DR_REG_V172, /* DR_REG_PMCCFILTR_EL0 */
DR_REG_V173, /* DR_REG_SPSR_IRQ */
DR_REG_V174, /* DR_REG_SPSR_ABT */
DR_REG_V175, /* DR_REG_SPSR_UND */
DR_REG_V176, /* DR_REG_SPSR_FIQ */
DR_REG_V177, /* DR_REG_TPIDR_EL0 */
DR_REG_V178, /* DR_REG_TPIDRRO_EL0 */

DR_REG_V179, /* DR_REG_P0 */
DR_REG_V180, /* DR_REG_P1 */
DR_REG_V181, /* DR_REG_P2 */
DR_REG_V182, /* DR_REG_P3 */
DR_REG_V183, /* DR_REG_P4 */
DR_REG_V184, /* DR_REG_P5 */
DR_REG_V185, /* DR_REG_P6 */
DR_REG_V186, /* DR_REG_P7 */
DR_REG_V187, /* DR_REG_P8 */
DR_REG_V188, /* DR_REG_P9 */
DR_REG_V189, /* DR_REG_P10 */
DR_REG_V190, /* DR_REG_P11 */
DR_REG_V191, /* DR_REG_P12 */
DR_REG_V192, /* DR_REG_P13 */
DR_REG_V193, /* DR_REG_P14 */
DR_REG_V194, /* DR_REG_P15 */
DR_REG_V195, /* DR_REG_FFR */

DR_REG_V196, /* DR_REG_CNTVCT_EL0 */
};
/* clang-format on */

#ifdef DEBUG
Expand Down
Loading
Loading