| Index: src/arm/disasm-arm.cc
|
| ===================================================================
|
| --- src/arm/disasm-arm.cc (revision 6414)
|
| +++ src/arm/disasm-arm.cc (working copy)
|
| @@ -100,42 +100,42 @@
|
| void PrintRegister(int reg);
|
| void PrintSRegister(int reg);
|
| void PrintDRegister(int reg);
|
| - int FormatVFPRegister(Instr* instr, const char* format);
|
| - void PrintMovwMovt(Instr* instr);
|
| - int FormatVFPinstruction(Instr* instr, const char* format);
|
| - void PrintCondition(Instr* instr);
|
| - void PrintShiftRm(Instr* instr);
|
| - void PrintShiftImm(Instr* instr);
|
| - void PrintShiftSat(Instr* instr);
|
| - void PrintPU(Instr* instr);
|
| + int FormatVFPRegister(Instruction* instr, const char* format);
|
| + void PrintMovwMovt(Instruction* instr);
|
| + int FormatVFPinstruction(Instruction* instr, const char* format);
|
| + void PrintCondition(Instruction* instr);
|
| + void PrintShiftRm(Instruction* instr);
|
| + void PrintShiftImm(Instruction* instr);
|
| + void PrintShiftSat(Instruction* instr);
|
| + void PrintPU(Instruction* instr);
|
| void PrintSoftwareInterrupt(SoftwareInterruptCodes svc);
|
|
|
| // Handle formatting of instructions and their options.
|
| - int FormatRegister(Instr* instr, const char* option);
|
| - int FormatOption(Instr* instr, const char* option);
|
| - void Format(Instr* instr, const char* format);
|
| - void Unknown(Instr* instr);
|
| + int FormatRegister(Instruction* instr, const char* option);
|
| + int FormatOption(Instruction* instr, const char* option);
|
| + void Format(Instruction* instr, const char* format);
|
| + void Unknown(Instruction* instr);
|
|
|
| // Each of these functions decodes one particular instruction type, a 3-bit
|
| // field in the instruction encoding.
|
| // Types 0 and 1 are combined as they are largely the same except for the way
|
| // they interpret the shifter operand.
|
| - void DecodeType01(Instr* instr);
|
| - void DecodeType2(Instr* instr);
|
| - void DecodeType3(Instr* instr);
|
| - void DecodeType4(Instr* instr);
|
| - void DecodeType5(Instr* instr);
|
| - void DecodeType6(Instr* instr);
|
| + void DecodeType01(Instruction* instr);
|
| + void DecodeType2(Instruction* instr);
|
| + void DecodeType3(Instruction* instr);
|
| + void DecodeType4(Instruction* instr);
|
| + void DecodeType5(Instruction* instr);
|
| + void DecodeType6(Instruction* instr);
|
| // Type 7 includes special Debugger instructions.
|
| - int DecodeType7(Instr* instr);
|
| + int DecodeType7(Instruction* instr);
|
| // For VFP support.
|
| - void DecodeTypeVFP(Instr* instr);
|
| - void DecodeType6CoprocessorIns(Instr* instr);
|
| + void DecodeTypeVFP(Instruction* instr);
|
| + void DecodeType6CoprocessorIns(Instruction* instr);
|
|
|
| - void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instr* instr);
|
| - void DecodeVCMP(Instr* instr);
|
| - void DecodeVCVTBetweenDoubleAndSingle(Instr* instr);
|
| - void DecodeVCVTBetweenFloatingPointAndInteger(Instr* instr);
|
| + void DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instruction* instr);
|
| + void DecodeVCMP(Instruction* instr);
|
| + void DecodeVCVTBetweenDoubleAndSingle(Instruction* instr);
|
| + void DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr);
|
|
|
| const disasm::NameConverter& converter_;
|
| v8::internal::Vector<char> out_buffer_;
|
| @@ -169,15 +169,15 @@
|
|
|
| // These condition names are defined in a way to match the native disassembler
|
| // formatting. See for example the command "objdump -d <binary file>".
|
| -static const char* cond_names[max_condition] = {
|
| +static const char* cond_names[number_of_conditions] = {
|
| "eq", "ne", "cs" , "cc" , "mi" , "pl" , "vs" , "vc" ,
|
| "hi", "ls", "ge", "lt", "gt", "le", "", "invalid",
|
| };
|
|
|
|
|
| // Print the condition guarding the instruction.
|
| -void Decoder::PrintCondition(Instr* instr) {
|
| - Print(cond_names[instr->ConditionField()]);
|
| +void Decoder::PrintCondition(Instruction* instr) {
|
| + Print(cond_names[instr->ConditionValue()]);
|
| }
|
|
|
|
|
| @@ -199,25 +199,26 @@
|
|
|
| // These shift names are defined in a way to match the native disassembler
|
| // formatting. See for example the command "objdump -d <binary file>".
|
| -static const char* shift_names[max_shift] = {
|
| +static const char* shift_names[number_of_shifts] = {
|
| "lsl", "lsr", "asr", "ror"
|
| };
|
|
|
|
|
| // Print the register shift operands for the instruction. Generally used for
|
| // data processing instructions.
|
| -void Decoder::PrintShiftRm(Instr* instr) {
|
| - Shift shift = instr->ShiftField();
|
| - int shift_amount = instr->ShiftAmountField();
|
| - int rm = instr->RmField();
|
| +void Decoder::PrintShiftRm(Instruction* instr) {
|
| + ShiftOp shift = instr->ShiftField();
|
| + int shift_index = instr->ShiftValue();
|
| + int shift_amount = instr->ShiftAmountValue();
|
| + int rm = instr->RmValue();
|
|
|
| PrintRegister(rm);
|
|
|
| - if ((instr->RegShiftField() == 0) && (shift == LSL) && (shift_amount == 0)) {
|
| + if ((instr->RegShiftValue() == 0) && (shift == LSL) && (shift_amount == 0)) {
|
| // Special case for using rm only.
|
| return;
|
| }
|
| - if (instr->RegShiftField() == 0) {
|
| + if (instr->RegShiftValue() == 0) {
|
| // by immediate
|
| if ((shift == ROR) && (shift_amount == 0)) {
|
| Print(", RRX");
|
| @@ -227,12 +228,13 @@
|
| }
|
| out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_,
|
| ", %s #%d",
|
| - shift_names[shift], shift_amount);
|
| + shift_names[shift_index],
|
| + shift_amount);
|
| } else {
|
| // by register
|
| - int rs = instr->RsField();
|
| + int rs = instr->RsValue();
|
| out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_,
|
| - ", %s ", shift_names[shift]);
|
| + ", %s ", shift_names[shift_index]);
|
| PrintRegister(rs);
|
| }
|
| }
|
| @@ -240,9 +242,9 @@
|
|
|
| // Print the immediate operand for the instruction. Generally used for data
|
| // processing instructions.
|
| -void Decoder::PrintShiftImm(Instr* instr) {
|
| - int rotate = instr->RotateField() * 2;
|
| - int immed8 = instr->Immed8Field();
|
| +void Decoder::PrintShiftImm(Instruction* instr) {
|
| + int rotate = instr->RotateValue() * 2;
|
| + int immed8 = instr->Immed8Value();
|
| int imm = (immed8 >> rotate) | (immed8 << (32 - rotate));
|
| out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_,
|
| "#%d", imm);
|
| @@ -250,7 +252,7 @@
|
|
|
|
|
| // Print the optional shift and immediate used by saturating instructions.
|
| -void Decoder::PrintShiftSat(Instr* instr) {
|
| +void Decoder::PrintShiftSat(Instruction* instr) {
|
| int shift = instr->Bits(11, 7);
|
| if (shift > 0) {
|
| out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_,
|
| @@ -262,21 +264,21 @@
|
|
|
|
|
| // Print PU formatting to reduce complexity of FormatOption.
|
| -void Decoder::PrintPU(Instr* instr) {
|
| +void Decoder::PrintPU(Instruction* instr) {
|
| switch (instr->PUField()) {
|
| - case 0: {
|
| + case da_x: {
|
| Print("da");
|
| break;
|
| }
|
| - case 1: {
|
| + case ia_x: {
|
| Print("ia");
|
| break;
|
| }
|
| - case 2: {
|
| + case db_x: {
|
| Print("db");
|
| break;
|
| }
|
| - case 3: {
|
| + case ib_x: {
|
| Print("ib");
|
| break;
|
| }
|
| @@ -299,7 +301,7 @@
|
| Print("break_point");
|
| return;
|
| default:
|
| - if (svc >= stop) {
|
| + if (svc >= stop_code) {
|
| out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_,
|
| "%d - 0x%x",
|
| svc & kStopCodeMask,
|
| @@ -316,32 +318,32 @@
|
|
|
| // Handle all register based formatting in this function to reduce the
|
| // complexity of FormatOption.
|
| -int Decoder::FormatRegister(Instr* instr, const char* format) {
|
| +int Decoder::FormatRegister(Instruction* instr, const char* format) {
|
| ASSERT(format[0] == 'r');
|
| if (format[1] == 'n') { // 'rn: Rn register
|
| - int reg = instr->RnField();
|
| + int reg = instr->RnValue();
|
| PrintRegister(reg);
|
| return 2;
|
| } else if (format[1] == 'd') { // 'rd: Rd register
|
| - int reg = instr->RdField();
|
| + int reg = instr->RdValue();
|
| PrintRegister(reg);
|
| return 2;
|
| } else if (format[1] == 's') { // 'rs: Rs register
|
| - int reg = instr->RsField();
|
| + int reg = instr->RsValue();
|
| PrintRegister(reg);
|
| return 2;
|
| } else if (format[1] == 'm') { // 'rm: Rm register
|
| - int reg = instr->RmField();
|
| + int reg = instr->RmValue();
|
| PrintRegister(reg);
|
| return 2;
|
| } else if (format[1] == 't') { // 'rt: Rt register
|
| - int reg = instr->RtField();
|
| + int reg = instr->RtValue();
|
| PrintRegister(reg);
|
| return 2;
|
| } else if (format[1] == 'l') {
|
| // 'rlist: register list for load and store multiple instructions
|
| ASSERT(STRING_STARTS_WITH(format, "rlist"));
|
| - int rlist = instr->RlistField();
|
| + int rlist = instr->RlistValue();
|
| int reg = 0;
|
| Print("{");
|
| // Print register list in ascending order, by scanning the bit mask.
|
| @@ -365,22 +367,22 @@
|
|
|
| // Handle all VFP register based formatting in this function to reduce the
|
| // complexity of FormatOption.
|
| -int Decoder::FormatVFPRegister(Instr* instr, const char* format) {
|
| +int Decoder::FormatVFPRegister(Instruction* instr, const char* format) {
|
| ASSERT((format[0] == 'S') || (format[0] == 'D'));
|
|
|
| if (format[1] == 'n') {
|
| - int reg = instr->VnField();
|
| - if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->NField()));
|
| + int reg = instr->VnValue();
|
| + if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->NValue()));
|
| if (format[0] == 'D') PrintDRegister(reg);
|
| return 2;
|
| } else if (format[1] == 'm') {
|
| - int reg = instr->VmField();
|
| - if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->MField()));
|
| + int reg = instr->VmValue();
|
| + if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->MValue()));
|
| if (format[0] == 'D') PrintDRegister(reg);
|
| return 2;
|
| } else if (format[1] == 'd') {
|
| - int reg = instr->VdField();
|
| - if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->DField()));
|
| + int reg = instr->VdValue();
|
| + if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->DValue()));
|
| if (format[0] == 'D') PrintDRegister(reg);
|
| return 2;
|
| }
|
| @@ -390,16 +392,16 @@
|
| }
|
|
|
|
|
| -int Decoder::FormatVFPinstruction(Instr* instr, const char* format) {
|
| +int Decoder::FormatVFPinstruction(Instruction* instr, const char* format) {
|
| Print(format);
|
| return 0;
|
| }
|
|
|
|
|
| // Print the movw or movt instruction.
|
| -void Decoder::PrintMovwMovt(Instr* instr) {
|
| - int imm = instr->ImmedMovwMovtField();
|
| - int rd = instr->RdField();
|
| +void Decoder::PrintMovwMovt(Instruction* instr) {
|
| + int imm = instr->ImmedMovwMovtValue();
|
| + int rd = instr->RdValue();
|
| PrintRegister(rd);
|
| out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_,
|
| ", #%d", imm);
|
| @@ -411,7 +413,7 @@
|
| // character of the option string (the option escape has already been
|
| // consumed by the caller.) FormatOption returns the number of
|
| // characters that were consumed from the formatting string.
|
| -int Decoder::FormatOption(Instr* instr, const char* format) {
|
| +int Decoder::FormatOption(Instruction* instr, const char* format) {
|
| switch (format[0]) {
|
| case 'a': { // 'a: accumulate multiplies
|
| if (instr->Bit(21) == 0) {
|
| @@ -514,7 +516,7 @@
|
| // 'off12: 12-bit offset for load and store instructions
|
| ASSERT(STRING_STARTS_WITH(format, "off12"));
|
| out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_,
|
| - "%d", instr->Offset12Field());
|
| + "%d", instr->Offset12Value());
|
| return 5;
|
| } else if (format[3] == '0') {
|
| // 'off0to3and8to19 16-bit immediate encoded in bits 19-8 and 3-0.
|
| @@ -527,7 +529,7 @@
|
| }
|
| // 'off8: 8-bit offset for extra load and store instructions
|
| ASSERT(STRING_STARTS_WITH(format, "off8"));
|
| - int offs8 = (instr->ImmedHField() << 4) | instr->ImmedLField();
|
| + int offs8 = (instr->ImmedHValue() << 4) | instr->ImmedLValue();
|
| out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_,
|
| "%d", offs8);
|
| return 4;
|
| @@ -544,10 +546,10 @@
|
| if (format[1] == 'h') { // 'shift_op or 'shift_rm or 'shift_sat.
|
| if (format[6] == 'o') { // 'shift_op
|
| ASSERT(STRING_STARTS_WITH(format, "shift_op"));
|
| - if (instr->TypeField() == 0) {
|
| + if (instr->TypeValue() == 0) {
|
| PrintShiftRm(instr);
|
| } else {
|
| - ASSERT(instr->TypeField() == 1);
|
| + ASSERT(instr->TypeValue() == 1);
|
| PrintShiftImm(instr);
|
| }
|
| return 8;
|
| @@ -562,7 +564,7 @@
|
| }
|
| } else if (format[1] == 'v') { // 'svc
|
| ASSERT(STRING_STARTS_WITH(format, "svc"));
|
| - PrintSoftwareInterrupt(instr->SvcField());
|
| + PrintSoftwareInterrupt(instr->SvcValue());
|
| return 3;
|
| } else if (format[1] == 'i') { // 'sign: signed extra loads and stores
|
| ASSERT(STRING_STARTS_WITH(format, "sign"));
|
| @@ -579,7 +581,7 @@
|
| }
|
| case 't': { // 'target: target of branch instructions
|
| ASSERT(STRING_STARTS_WITH(format, "target"));
|
| - int off = (instr->SImmed24Field() << 2) + 8;
|
| + int off = (instr->SImmed24Value() << 2) + 8;
|
| out_buffer_pos_ += v8i::OS::SNPrintF(
|
| out_buffer_ + out_buffer_pos_,
|
| "%+d -> %s",
|
| @@ -633,7 +635,7 @@
|
| // Format takes a formatting string for a whole instruction and prints it into
|
| // the output buffer. All escaped options are handed to FormatOption to be
|
| // parsed further.
|
| -void Decoder::Format(Instr* instr, const char* format) {
|
| +void Decoder::Format(Instruction* instr, const char* format) {
|
| char cur = *format++;
|
| while ((cur != 0) && (out_buffer_pos_ < (out_buffer_.length() - 1))) {
|
| if (cur == '\'') { // Single quote is used as the formatting escape.
|
| @@ -649,13 +651,13 @@
|
|
|
| // For currently unimplemented decodings the disassembler calls Unknown(instr)
|
| // which will just print "unknown" of the instruction bits.
|
| -void Decoder::Unknown(Instr* instr) {
|
| +void Decoder::Unknown(Instruction* instr) {
|
| Format(instr, "unknown");
|
| }
|
|
|
|
|
| -void Decoder::DecodeType01(Instr* instr) {
|
| - int type = instr->TypeField();
|
| +void Decoder::DecodeType01(Instruction* instr) {
|
| + int type = instr->TypeValue();
|
| if ((type == 0) && instr->IsSpecialType0()) {
|
| // multiply instruction or extra loads and stores
|
| if (instr->Bits(7, 4) == 9) {
|
| @@ -689,7 +691,7 @@
|
| } else if ((instr->Bit(20) == 0) && ((instr->Bits(7, 4) & 0xd) == 0xd)) {
|
| // ldrd, strd
|
| switch (instr->PUField()) {
|
| - case 0: {
|
| + case da_x: {
|
| if (instr->Bit(22) == 0) {
|
| Format(instr, "'memop'cond's 'rd, ['rn], -'rm");
|
| } else {
|
| @@ -697,7 +699,7 @@
|
| }
|
| break;
|
| }
|
| - case 1: {
|
| + case ia_x: {
|
| if (instr->Bit(22) == 0) {
|
| Format(instr, "'memop'cond's 'rd, ['rn], +'rm");
|
| } else {
|
| @@ -705,7 +707,7 @@
|
| }
|
| break;
|
| }
|
| - case 2: {
|
| + case db_x: {
|
| if (instr->Bit(22) == 0) {
|
| Format(instr, "'memop'cond's 'rd, ['rn, -'rm]'w");
|
| } else {
|
| @@ -713,7 +715,7 @@
|
| }
|
| break;
|
| }
|
| - case 3: {
|
| + case ib_x: {
|
| if (instr->Bit(22) == 0) {
|
| Format(instr, "'memop'cond's 'rd, ['rn, +'rm]'w");
|
| } else {
|
| @@ -730,7 +732,7 @@
|
| } else {
|
| // extra load/store instructions
|
| switch (instr->PUField()) {
|
| - case 0: {
|
| + case da_x: {
|
| if (instr->Bit(22) == 0) {
|
| Format(instr, "'memop'cond'sign'h 'rd, ['rn], -'rm");
|
| } else {
|
| @@ -738,7 +740,7 @@
|
| }
|
| break;
|
| }
|
| - case 1: {
|
| + case ia_x: {
|
| if (instr->Bit(22) == 0) {
|
| Format(instr, "'memop'cond'sign'h 'rd, ['rn], +'rm");
|
| } else {
|
| @@ -746,7 +748,7 @@
|
| }
|
| break;
|
| }
|
| - case 2: {
|
| + case db_x: {
|
| if (instr->Bit(22) == 0) {
|
| Format(instr, "'memop'cond'sign'h 'rd, ['rn, -'rm]'w");
|
| } else {
|
| @@ -754,7 +756,7 @@
|
| }
|
| break;
|
| }
|
| - case 3: {
|
| + case ib_x: {
|
| if (instr->Bit(22) == 0) {
|
| Format(instr, "'memop'cond'sign'h 'rd, ['rn, +'rm]'w");
|
| } else {
|
| @@ -772,7 +774,7 @@
|
| }
|
| } else if ((type == 0) && instr->IsMiscType0()) {
|
| if (instr->Bits(22, 21) == 1) {
|
| - switch (instr->Bits(7, 4)) {
|
| + switch (instr->BitField(7, 4)) {
|
| case BX:
|
| Format(instr, "bx'cond 'rm");
|
| break;
|
| @@ -787,7 +789,7 @@
|
| break;
|
| }
|
| } else if (instr->Bits(22, 21) == 3) {
|
| - switch (instr->Bits(7, 4)) {
|
| + switch (instr->BitField(7, 4)) {
|
| case CLZ:
|
| Format(instr, "clz'cond 'rd, 'rm");
|
| break;
|
| @@ -894,27 +896,27 @@
|
| }
|
|
|
|
|
| -void Decoder::DecodeType2(Instr* instr) {
|
| +void Decoder::DecodeType2(Instruction* instr) {
|
| switch (instr->PUField()) {
|
| - case 0: {
|
| + case da_x: {
|
| if (instr->HasW()) {
|
| Unknown(instr); // not used in V8
|
| }
|
| Format(instr, "'memop'cond'b 'rd, ['rn], #-'off12");
|
| break;
|
| }
|
| - case 1: {
|
| + case ia_x: {
|
| if (instr->HasW()) {
|
| Unknown(instr); // not used in V8
|
| }
|
| Format(instr, "'memop'cond'b 'rd, ['rn], #+'off12");
|
| break;
|
| }
|
| - case 2: {
|
| + case db_x: {
|
| Format(instr, "'memop'cond'b 'rd, ['rn, #-'off12]'w");
|
| break;
|
| }
|
| - case 3: {
|
| + case ib_x: {
|
| Format(instr, "'memop'cond'b 'rd, ['rn, #+'off12]'w");
|
| break;
|
| }
|
| @@ -927,14 +929,14 @@
|
| }
|
|
|
|
|
| -void Decoder::DecodeType3(Instr* instr) {
|
| +void Decoder::DecodeType3(Instruction* instr) {
|
| switch (instr->PUField()) {
|
| - case 0: {
|
| + case da_x: {
|
| ASSERT(!instr->HasW());
|
| Format(instr, "'memop'cond'b 'rd, ['rn], -'shift_rm");
|
| break;
|
| }
|
| - case 1: {
|
| + case ia_x: {
|
| if (instr->HasW()) {
|
| ASSERT(instr->Bits(5, 4) == 0x1);
|
| if (instr->Bit(22) == 0x1) {
|
| @@ -947,11 +949,11 @@
|
| }
|
| break;
|
| }
|
| - case 2: {
|
| + case db_x: {
|
| Format(instr, "'memop'cond'b 'rd, ['rn, -'shift_rm]'w");
|
| break;
|
| }
|
| - case 3: {
|
| + case ib_x: {
|
| if (instr->HasW() && (instr->Bits(6, 4) == 0x5)) {
|
| uint32_t widthminus1 = static_cast<uint32_t>(instr->Bits(20, 16));
|
| uint32_t lsbit = static_cast<uint32_t>(instr->Bits(11, 7));
|
| @@ -969,7 +971,7 @@
|
| uint32_t lsbit = static_cast<uint32_t>(instr->Bits(11, 7));
|
| uint32_t msbit = static_cast<uint32_t>(instr->Bits(20, 16));
|
| if (msbit >= lsbit) {
|
| - if (instr->RmField() == 15) {
|
| + if (instr->RmValue() == 15) {
|
| Format(instr, "bfc'cond 'rd, 'f");
|
| } else {
|
| Format(instr, "bfi'cond 'rd, 'rm, 'f");
|
| @@ -991,7 +993,7 @@
|
| }
|
|
|
|
|
| -void Decoder::DecodeType4(Instr* instr) {
|
| +void Decoder::DecodeType4(Instruction* instr) {
|
| ASSERT(instr->Bit(22) == 0); // Privileged mode currently not supported.
|
| if (instr->HasL()) {
|
| Format(instr, "ldm'cond'pu 'rn'w, 'rlist");
|
| @@ -1001,41 +1003,44 @@
|
| }
|
|
|
|
|
| -void Decoder::DecodeType5(Instr* instr) {
|
| +void Decoder::DecodeType5(Instruction* instr) {
|
| Format(instr, "b'l'cond 'target");
|
| }
|
|
|
|
|
| -void Decoder::DecodeType6(Instr* instr) {
|
| +void Decoder::DecodeType6(Instruction* instr) {
|
| DecodeType6CoprocessorIns(instr);
|
| }
|
|
|
|
|
| -int Decoder::DecodeType7(Instr* instr) {
|
| +int Decoder::DecodeType7(Instruction* instr) {
|
| if (instr->Bit(24) == 1) {
|
| - if (instr->SvcField() >= stop) {
|
| + if (instr->SvcValue() >= stop_code) {
|
| Format(instr, "stop'cond 'svc");
|
| // Also print the stop message. Its address is encoded
|
| // in the following 4 bytes.
|
| out_buffer_pos_ +=
|
| v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_,
|
| "\n %p %08x stop message: %s",
|
| - reinterpret_cast<int32_t*>(instr + Instr::kInstrSize),
|
| - *reinterpret_cast<char**>(instr + Instr::kInstrSize),
|
| - *reinterpret_cast<char**>(instr + Instr::kInstrSize));
|
| - // We have decoded 2 * Instr::kInstrSize bytes.
|
| - return 2 * Instr::kInstrSize;
|
| + reinterpret_cast<int32_t*>(instr
|
| + + Instruction::kInstrSize),
|
| + *reinterpret_cast<char**>(instr
|
| + + Instruction::kInstrSize),
|
| + *reinterpret_cast<char**>(instr
|
| + + Instruction::kInstrSize));
|
| + // We have decoded 2 * Instruction::kInstrSize bytes.
|
| + return 2 * Instruction::kInstrSize;
|
| } else {
|
| Format(instr, "svc'cond 'svc");
|
| }
|
| } else {
|
| DecodeTypeVFP(instr);
|
| }
|
| - return Instr::kInstrSize;
|
| + return Instruction::kInstrSize;
|
| }
|
|
|
|
|
| -// void Decoder::DecodeTypeVFP(Instr* instr)
|
| +// void Decoder::DecodeTypeVFP(Instruction* instr)
|
| // vmov: Sn = Rt
|
| // vmov: Rt = Sn
|
| // vcvt: Dd = Sm
|
| @@ -1048,34 +1053,34 @@
|
| // vmrs
|
| // vmsr
|
| // Dd = vsqrt(Dm)
|
| -void Decoder::DecodeTypeVFP(Instr* instr) {
|
| - ASSERT((instr->TypeField() == 7) && (instr->Bit(24) == 0x0) );
|
| +void Decoder::DecodeTypeVFP(Instruction* instr) {
|
| + ASSERT((instr->TypeValue() == 7) && (instr->Bit(24) == 0x0) );
|
| ASSERT(instr->Bits(11, 9) == 0x5);
|
|
|
| if (instr->Bit(4) == 0) {
|
| - if (instr->Opc1Field() == 0x7) {
|
| + if (instr->Opc1Value() == 0x7) {
|
| // Other data processing instructions
|
| - if ((instr->Opc2Field() == 0x0) && (instr->Opc3Field() == 0x1)) {
|
| + if ((instr->Opc2Value() == 0x0) && (instr->Opc3Value() == 0x1)) {
|
| // vmov register to register.
|
| - if (instr->SzField() == 0x1) {
|
| + if (instr->SzValue() == 0x1) {
|
| Format(instr, "vmov.f64'cond 'Dd, 'Dm");
|
| } else {
|
| Format(instr, "vmov.f32'cond 'Sd, 'Sm");
|
| }
|
| - } else if ((instr->Opc2Field() == 0x7) && (instr->Opc3Field() == 0x3)) {
|
| + } else if ((instr->Opc2Value() == 0x7) && (instr->Opc3Value() == 0x3)) {
|
| DecodeVCVTBetweenDoubleAndSingle(instr);
|
| - } else if ((instr->Opc2Field() == 0x8) && (instr->Opc3Field() & 0x1)) {
|
| + } else if ((instr->Opc2Value() == 0x8) && (instr->Opc3Value() & 0x1)) {
|
| DecodeVCVTBetweenFloatingPointAndInteger(instr);
|
| - } else if (((instr->Opc2Field() >> 1) == 0x6) &&
|
| - (instr->Opc3Field() & 0x1)) {
|
| + } else if (((instr->Opc2Value() >> 1) == 0x6) &&
|
| + (instr->Opc3Value() & 0x1)) {
|
| DecodeVCVTBetweenFloatingPointAndInteger(instr);
|
| - } else if (((instr->Opc2Field() == 0x4) || (instr->Opc2Field() == 0x5)) &&
|
| - (instr->Opc3Field() & 0x1)) {
|
| + } else if (((instr->Opc2Value() == 0x4) || (instr->Opc2Value() == 0x5)) &&
|
| + (instr->Opc3Value() & 0x1)) {
|
| DecodeVCMP(instr);
|
| - } else if (((instr->Opc2Field() == 0x1)) && (instr->Opc3Field() == 0x3)) {
|
| + } else if (((instr->Opc2Value() == 0x1)) && (instr->Opc3Value() == 0x3)) {
|
| Format(instr, "vsqrt.f64'cond 'Dd, 'Dm");
|
| - } else if (instr->Opc3Field() == 0x0) {
|
| - if (instr->SzField() == 0x1) {
|
| + } else if (instr->Opc3Value() == 0x0) {
|
| + if (instr->SzValue() == 0x1) {
|
| Format(instr, "vmov.f64'cond 'Dd, 'd");
|
| } else {
|
| Unknown(instr); // Not used by V8.
|
| @@ -1083,9 +1088,9 @@
|
| } else {
|
| Unknown(instr); // Not used by V8.
|
| }
|
| - } else if (instr->Opc1Field() == 0x3) {
|
| - if (instr->SzField() == 0x1) {
|
| - if (instr->Opc3Field() & 0x1) {
|
| + } else if (instr->Opc1Value() == 0x3) {
|
| + if (instr->SzValue() == 0x1) {
|
| + if (instr->Opc3Value() & 0x1) {
|
| Format(instr, "vsub.f64'cond 'Dd, 'Dn, 'Dm");
|
| } else {
|
| Format(instr, "vadd.f64'cond 'Dd, 'Dn, 'Dm");
|
| @@ -1093,14 +1098,14 @@
|
| } else {
|
| Unknown(instr); // Not used by V8.
|
| }
|
| - } else if ((instr->Opc1Field() == 0x2) && !(instr->Opc3Field() & 0x1)) {
|
| - if (instr->SzField() == 0x1) {
|
| + } else if ((instr->Opc1Value() == 0x2) && !(instr->Opc3Value() & 0x1)) {
|
| + if (instr->SzValue() == 0x1) {
|
| Format(instr, "vmul.f64'cond 'Dd, 'Dn, 'Dm");
|
| } else {
|
| Unknown(instr); // Not used by V8.
|
| }
|
| - } else if ((instr->Opc1Field() == 0x4) && !(instr->Opc3Field() & 0x1)) {
|
| - if (instr->SzField() == 0x1) {
|
| + } else if ((instr->Opc1Value() == 0x4) && !(instr->Opc3Value() & 0x1)) {
|
| + if (instr->SzValue() == 0x1) {
|
| Format(instr, "vdiv.f64'cond 'Dd, 'Dn, 'Dm");
|
| } else {
|
| Unknown(instr); // Not used by V8.
|
| @@ -1109,13 +1114,13 @@
|
| Unknown(instr); // Not used by V8.
|
| }
|
| } else {
|
| - if ((instr->VCField() == 0x0) &&
|
| - (instr->VAField() == 0x0)) {
|
| + if ((instr->VCValue() == 0x0) &&
|
| + (instr->VAValue() == 0x0)) {
|
| DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(instr);
|
| - } else if ((instr->VCField() == 0x0) &&
|
| - (instr->VAField() == 0x7) &&
|
| + } else if ((instr->VCValue() == 0x0) &&
|
| + (instr->VAValue() == 0x7) &&
|
| (instr->Bits(19, 16) == 0x1)) {
|
| - if (instr->VLField() == 0) {
|
| + if (instr->VLValue() == 0) {
|
| if (instr->Bits(15, 12) == 0xF) {
|
| Format(instr, "vmsr'cond FPSCR, APSR");
|
| } else {
|
| @@ -1133,11 +1138,12 @@
|
| }
|
|
|
|
|
| -void Decoder::DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(Instr* instr) {
|
| - ASSERT((instr->Bit(4) == 1) && (instr->VCField() == 0x0) &&
|
| - (instr->VAField() == 0x0));
|
| +void Decoder::DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(
|
| + Instruction* instr) {
|
| + ASSERT((instr->Bit(4) == 1) && (instr->VCValue() == 0x0) &&
|
| + (instr->VAValue() == 0x0));
|
|
|
| - bool to_arm_register = (instr->VLField() == 0x1);
|
| + bool to_arm_register = (instr->VLValue() == 0x1);
|
|
|
| if (to_arm_register) {
|
| Format(instr, "vmov'cond 'rt, 'Sn");
|
| @@ -1147,19 +1153,19 @@
|
| }
|
|
|
|
|
| -void Decoder::DecodeVCMP(Instr* instr) {
|
| - ASSERT((instr->Bit(4) == 0) && (instr->Opc1Field() == 0x7));
|
| - ASSERT(((instr->Opc2Field() == 0x4) || (instr->Opc2Field() == 0x5)) &&
|
| - (instr->Opc3Field() & 0x1));
|
| +void Decoder::DecodeVCMP(Instruction* instr) {
|
| + ASSERT((instr->Bit(4) == 0) && (instr->Opc1Value() == 0x7));
|
| + ASSERT(((instr->Opc2Value() == 0x4) || (instr->Opc2Value() == 0x5)) &&
|
| + (instr->Opc3Value() & 0x1));
|
|
|
| // Comparison.
|
| - bool dp_operation = (instr->SzField() == 1);
|
| + bool dp_operation = (instr->SzValue() == 1);
|
| bool raise_exception_for_qnan = (instr->Bit(7) == 0x1);
|
|
|
| if (dp_operation && !raise_exception_for_qnan) {
|
| - if (instr->Opc2Field() == 0x4) {
|
| + if (instr->Opc2Value() == 0x4) {
|
| Format(instr, "vcmp.f64'cond 'Dd, 'Dm");
|
| - } else if (instr->Opc2Field() == 0x5) {
|
| + } else if (instr->Opc2Value() == 0x5) {
|
| Format(instr, "vcmp.f64'cond 'Dd, #0.0");
|
| } else {
|
| Unknown(instr); // invalid
|
| @@ -1170,11 +1176,11 @@
|
| }
|
|
|
|
|
| -void Decoder::DecodeVCVTBetweenDoubleAndSingle(Instr* instr) {
|
| - ASSERT((instr->Bit(4) == 0) && (instr->Opc1Field() == 0x7));
|
| - ASSERT((instr->Opc2Field() == 0x7) && (instr->Opc3Field() == 0x3));
|
| +void Decoder::DecodeVCVTBetweenDoubleAndSingle(Instruction* instr) {
|
| + ASSERT((instr->Bit(4) == 0) && (instr->Opc1Value() == 0x7));
|
| + ASSERT((instr->Opc2Value() == 0x7) && (instr->Opc3Value() == 0x3));
|
|
|
| - bool double_to_single = (instr->SzField() == 1);
|
| + bool double_to_single = (instr->SzValue() == 1);
|
|
|
| if (double_to_single) {
|
| Format(instr, "vcvt.f32.f64'cond 'Sd, 'Dm");
|
| @@ -1184,13 +1190,13 @@
|
| }
|
|
|
|
|
| -void Decoder::DecodeVCVTBetweenFloatingPointAndInteger(Instr* instr) {
|
| - ASSERT((instr->Bit(4) == 0) && (instr->Opc1Field() == 0x7));
|
| - ASSERT(((instr->Opc2Field() == 0x8) && (instr->Opc3Field() & 0x1)) ||
|
| - (((instr->Opc2Field() >> 1) == 0x6) && (instr->Opc3Field() & 0x1)));
|
| +void Decoder::DecodeVCVTBetweenFloatingPointAndInteger(Instruction* instr) {
|
| + ASSERT((instr->Bit(4) == 0) && (instr->Opc1Value() == 0x7));
|
| + ASSERT(((instr->Opc2Value() == 0x8) && (instr->Opc3Value() & 0x1)) ||
|
| + (((instr->Opc2Value() >> 1) == 0x6) && (instr->Opc3Value() & 0x1)));
|
|
|
| bool to_integer = (instr->Bit(18) == 1);
|
| - bool dp_operation = (instr->SzField() == 1);
|
| + bool dp_operation = (instr->SzValue() == 1);
|
| if (to_integer) {
|
| bool unsigned_integer = (instr->Bit(16) == 0);
|
|
|
| @@ -1232,11 +1238,11 @@
|
| // <Rt, Rt2> = vmov(Dm)
|
| // Ddst = MEM(Rbase + 4*offset).
|
| // MEM(Rbase + 4*offset) = Dsrc.
|
| -void Decoder::DecodeType6CoprocessorIns(Instr* instr) {
|
| - ASSERT((instr->TypeField() == 6));
|
| +void Decoder::DecodeType6CoprocessorIns(Instruction* instr) {
|
| + ASSERT(instr->TypeValue() == 6);
|
|
|
| - if (instr->CoprocessorField() == 0xA) {
|
| - switch (instr->OpcodeField()) {
|
| + if (instr->CoprocessorValue() == 0xA) {
|
| + switch (instr->OpcodeValue()) {
|
| case 0x8:
|
| case 0xA:
|
| if (instr->HasL()) {
|
| @@ -1257,8 +1263,8 @@
|
| Unknown(instr); // Not used by V8.
|
| break;
|
| }
|
| - } else if (instr->CoprocessorField() == 0xB) {
|
| - switch (instr->OpcodeField()) {
|
| + } else if (instr->CoprocessorValue() == 0xB) {
|
| + switch (instr->OpcodeValue()) {
|
| case 0x2:
|
| // Load and store double to two GP registers
|
| if (instr->Bits(7, 4) != 0x1) {
|
| @@ -1295,16 +1301,16 @@
|
|
|
| // Disassemble the instruction at *instr_ptr into the output buffer.
|
| int Decoder::InstructionDecode(byte* instr_ptr) {
|
| - Instr* instr = Instr::At(instr_ptr);
|
| + Instruction* instr = Instruction::At(instr_ptr);
|
| // Print raw instruction bytes.
|
| out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_,
|
| "%08x ",
|
| instr->InstructionBits());
|
| if (instr->ConditionField() == special_condition) {
|
| UNIMPLEMENTED();
|
| - return Instr::kInstrSize;
|
| + return Instruction::kInstrSize;
|
| }
|
| - switch (instr->TypeField()) {
|
| + switch (instr->TypeValue()) {
|
| case 0:
|
| case 1: {
|
| DecodeType01(instr);
|
| @@ -1339,7 +1345,7 @@
|
| break;
|
| }
|
| }
|
| - return Instr::kInstrSize;
|
| + return Instruction::kInstrSize;
|
| }
|
|
|
|
|
|
|