mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Added byte registers to the x86-64 disassembler
TEST=CI Bug: 48656 Change-Id: I099e25d66e62094d471bebed88b8b4bad1df6c2c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247463 Reviewed-by: Siva Annamalai <asiva@google.com> Commit-Queue: Michael Richards <msrichards@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
7b001746fd
commit
d635322b3d
|
@ -4625,7 +4625,7 @@ ASSEMBLER_TEST_RUN(TestSetCC, test) {
|
|||
EXPECT_DISASSEMBLY(
|
||||
"mov eax,0xffffffff\n"
|
||||
"cmp eax,eax\n"
|
||||
"setnz eax\n"
|
||||
"setnz al\n"
|
||||
"ret\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -675,7 +675,7 @@ ASSEMBLER_TEST_RUN(Testb3, test) {
|
|||
EXPECT_DISASSEMBLY_NOT_WINDOWS(
|
||||
"push rdi\n"
|
||||
"movl rdx,0x10\n"
|
||||
"testb rdx,[rsp]\n"
|
||||
"testb dl,[rsp]\n"
|
||||
"jz +13\n"
|
||||
"movl rax,1\n"
|
||||
"pop rcx\n"
|
||||
|
@ -5508,7 +5508,7 @@ ASSEMBLER_TEST_RUN(TestSetCC, test) {
|
|||
EXPECT_DISASSEMBLY(
|
||||
"movl rax,0xffffffff\n"
|
||||
"cmpq rax,rax\n"
|
||||
"setnzl rax\n"
|
||||
"setnz al\n"
|
||||
"ret\n");
|
||||
}
|
||||
|
||||
|
@ -5530,7 +5530,7 @@ ASSEMBLER_TEST_RUN(TestSetCC2, test) {
|
|||
"push rbx\n"
|
||||
"movl rbx,0xffffffff\n"
|
||||
"cmpq rbx,rbx\n"
|
||||
"setzl rdi\n"
|
||||
"setz bh\n"
|
||||
"movq rax,rbx\n"
|
||||
"pop rbx\n"
|
||||
"ret\n");
|
||||
|
@ -5554,7 +5554,7 @@ ASSEMBLER_TEST_RUN(TestSetCC3, test) {
|
|||
"push r10\n"
|
||||
"movl r10,0xffffffff\n"
|
||||
"cmpq r10,r10\n"
|
||||
"setnzl r10\n"
|
||||
"setnz r10b\n"
|
||||
"movq rax,r10\n"
|
||||
"pop r10\n"
|
||||
"ret\n");
|
||||
|
@ -5578,7 +5578,7 @@ ASSEMBLER_TEST_RUN(TestSetCC4, test) {
|
|||
"push rsi\n"
|
||||
"movl rsi,0xffffffff\n"
|
||||
"cmpq rsi,rsi\n"
|
||||
"setzl rsi\n"
|
||||
"setz dh\n"
|
||||
"movq rax,rsi\n"
|
||||
"pop rsi\n"
|
||||
"ret\n");
|
||||
|
|
|
@ -314,7 +314,7 @@ class DisassemblerX64 : public ValueObject {
|
|||
}
|
||||
|
||||
const char* NameOfByteCPURegister(int reg) const {
|
||||
return NameOfCPURegister(reg);
|
||||
return RegisterNames::RegisterByteName(static_cast<ByteRegister>(reg));
|
||||
}
|
||||
|
||||
// A way to get rax or eax's name.
|
||||
|
@ -842,7 +842,7 @@ int DisassemblerX64::SetCC(uint8_t* data) {
|
|||
ASSERT(0x0F == *data);
|
||||
uint8_t cond = *(data + 1) & 0x0F;
|
||||
const char* mnem = conditional_code_suffix[cond];
|
||||
Print("set%s%s ", mnem, operand_size_code());
|
||||
Print("set%s ", mnem);
|
||||
PrintRightByteOperand(data + 2);
|
||||
return 3; // includes 0x0F
|
||||
}
|
||||
|
|
|
@ -60,6 +60,13 @@ class RegisterNames {
|
|||
return fpu_d_reg_names[reg];
|
||||
}
|
||||
#endif // defined(TARGET_ARCH_ARM)
|
||||
|
||||
#if defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_IA32)
|
||||
static const char* RegisterByteName(ByteRegister reg) {
|
||||
ASSERT((0 <= reg) && (reg < kNumberOfByteRegisters));
|
||||
return cpu_reg_byte_names[reg];
|
||||
}
|
||||
#endif // defined(TARGET_ARCH_X64) || defined(TARGET_ARCH_IA32)
|
||||
};
|
||||
|
||||
static constexpr bool IsArgumentRegister(Register reg) {
|
||||
|
|
|
@ -13,6 +13,9 @@ namespace dart {
|
|||
const char* const cpu_reg_names[kNumberOfCpuRegisters] = {
|
||||
"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"};
|
||||
|
||||
const char* const cpu_reg_byte_names[kNumberOfCpuRegisters] = {
|
||||
"al", "cl", "dl", "bl", "ah", "ch", "dh", "bh"};
|
||||
|
||||
const char* const cpu_reg_abi_names[kNumberOfCpuRegisters] = {
|
||||
"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"};
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ enum ByteRegister {
|
|||
CH = 5,
|
||||
DH = 6,
|
||||
BH = 7,
|
||||
kNumberOfByteRegisters = 8,
|
||||
kNoByteRegister = -1 // Signals an illegal register.
|
||||
};
|
||||
|
||||
|
@ -76,6 +77,7 @@ const FpuRegister kNoFpuRegister = kNoXmmRegister;
|
|||
|
||||
extern const char* const cpu_reg_names[kNumberOfCpuRegisters];
|
||||
extern const char* const cpu_reg_abi_names[kNumberOfCpuRegisters];
|
||||
extern const char* const cpu_reg_byte_names[kNumberOfByteRegisters];
|
||||
extern const char* const fpu_reg_names[kNumberOfXmmRegisters];
|
||||
|
||||
// Register aliases.
|
||||
|
|
|
@ -18,6 +18,10 @@ const char* const cpu_reg_abi_names[kNumberOfCpuRegisters] = {
|
|||
"rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
|
||||
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"};
|
||||
|
||||
const char* const cpu_reg_byte_names[kNumberOfByteRegisters] = {
|
||||
"al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
|
||||
"r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"};
|
||||
|
||||
const char* const fpu_reg_names[kNumberOfXmmRegisters] = {
|
||||
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
|
||||
"xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"};
|
||||
|
|
|
@ -60,6 +60,7 @@ enum ByteRegister {
|
|||
R13B = 13,
|
||||
R14B = 14,
|
||||
R15B = 15,
|
||||
kNumberOfByteRegisters = 16,
|
||||
kNoByteRegister = -1 // Signals an illegal register.
|
||||
};
|
||||
|
||||
|
@ -102,6 +103,7 @@ const FpuRegister kNoFpuRegister = kNoXmmRegister;
|
|||
|
||||
extern const char* const cpu_reg_names[kNumberOfCpuRegisters];
|
||||
extern const char* const cpu_reg_abi_names[kNumberOfCpuRegisters];
|
||||
extern const char* const cpu_reg_byte_names[kNumberOfByteRegisters];
|
||||
extern const char* const fpu_reg_names[kNumberOfXmmRegisters];
|
||||
|
||||
enum RexBits {
|
||||
|
|
Loading…
Reference in a new issue