Home | History | Annotate | Download | only in arm

Lines Matching refs:Instr

102   int FormatVFPRegister(Instr* instr, const char* format);
103 int FormatVFPinstruction(Instr* instr, const char* format);
104 void PrintCondition(Instr* instr);
105 void PrintShiftRm(Instr* instr);
106 void PrintShiftImm(Instr* instr);
107 void PrintPU(Instr* instr);
111 int FormatRegister(Instr* instr, const char* option);
112 int FormatOption(Instr* instr, const char* option);
113 void Format(Instr* instr, const char* format);
114 void Unknown(Instr* instr);
120 void DecodeType01(Instr* instr);
121 void DecodeType2(Instr* instr);
122 void DecodeType3(Instr* instr);
123 void DecodeType4(Instr* instr);
124 void DecodeType5(Instr* instr);
125 void DecodeType6(Instr* instr);
126 void DecodeType7(Instr* instr);
127 void DecodeUnconditional(Instr* instr);
129 void DecodeTypeVFP(Instr* instr);
130 void DecodeType6CoprocessorIns(Instr* instr);
172 void Decoder::PrintCondition(Instr* instr) {
173 Print(cond_names[instr->ConditionField()]);
202 void Decoder::PrintShiftRm(Instr* instr) {
203 Shift shift = instr->ShiftField();
204 int shift_amount = instr->ShiftAmountField();
205 int rm = instr->RmField();
209 if ((instr->RegShiftField() == 0) && (shift == LSL) && (shift_amount == 0)) {
213 if (instr->RegShiftField() == 0) {
226 int rs = instr->RsField();
236 void Decoder::PrintShiftImm(Instr* instr) {
237 int rotate = instr->RotateField() * 2;
238 int immed8 = instr->Immed8Field();
246 void Decoder::PrintPU(Instr* instr) {
247 switch (instr->PUField()) {
293 int Decoder::FormatRegister(Instr* instr, const char* format) {
296 int reg = instr->RnField();
300 int reg = instr->RdField();
304 int reg = instr->RsField();
308 int reg = instr->RmField();
312 int reg = instr->RtField();
318 int rlist = instr->RlistField();
342 int Decoder::FormatVFPRegister(Instr* instr, const char* format) {
346 int reg = instr->VnField();
347 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->NField()));
351 int reg = instr->VmField();
352 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->MField()));
356 int reg = instr->VdField();
357 if (format[0] == 'S') PrintSRegister(((reg << 1) | instr->DField()));
367 int Decoder::FormatVFPinstruction(Instr* instr, const char* format) {
378 int Decoder::FormatOption(Instr* instr, const char* format) {
381 if (instr->Bit(21) == 0) {
389 if (instr->HasB()) {
396 PrintCondition(instr);
400 if (instr->HasH()) {
408 if (instr->HasLink()) {
416 if (instr->HasL()) {
426 reinterpret_cast<byte*>(instr->InstructionBits() & 0x0fffffff);
436 "%d", instr->Offset12Field());
441 "%d", instr->Bits(20, 16) +1);
446 "%d", instr->ShiftAmountField());
451 int offs8 = (instr->ImmedHField() << 4) | instr->ImmedLField();
458 PrintPU(instr);
462 return FormatRegister(instr, format);
468 if (instr->TypeField() == 0) {
469 PrintShiftRm(instr);
471 ASSERT(instr->TypeField() == 1);
472 PrintShiftImm(instr);
477 PrintShiftRm(instr);
482 PrintSoftwareInterrupt(instr->SwiField());
486 if (instr->HasSign()) {
492 if (instr->HasS()) {
499 int off = (instr->SImmed24Field() << 2) + 8;
504 converter_.NameOfAddress(reinterpret_cast<byte*>(instr) + off));
520 if (instr->Bit(22) == 0) {
528 return FormatVFPinstruction(instr, format);
532 return FormatVFPRegister(instr, format);
535 if (instr->HasW()) {
553 void Decoder::Format(Instr* instr, const char* format) {
557 format += FormatOption(instr, format);
567 // For currently unimplemented decodings the disassembler calls Unknown(instr)
569 void Decoder::Unknown(Instr* instr) {
570 Format(instr, "unknown");
574 void Decoder::DecodeType01(Instr* instr) {
575 int type = instr->TypeField();
576 if ((type == 0) && instr->IsSpecialType0()) {
578 if (instr->Bits(7, 4) == 9) {
579 if (instr->Bit(24) == 0) {
581 if (instr->Bit(23) == 0) {
582 if (instr->Bit(21) == 0) {
586 Format(instr, "mul'cond's 'rn, 'rm, 'rs");
592 Format(instr, "mla'cond's 'rn, 'rm, 'rs, 'rd");
601 Format(instr, "'um'al'cond's 'rd, 'rn, 'rm, 'rs");
604 Unknown(instr); // not used by V8
608 switch (instr->PUField()) {
610 if (instr->Bit(22) == 0) {
611 Format(instr, "'memop'cond'sign'h 'rd, ['rn], -'rm");
613 Format(instr, "'memop'cond'sign'h 'rd, ['rn], #-'off8");
618 if (instr->Bit(22) == 0) {
619 Format(instr, "'memop'cond'sign'h 'rd, ['rn], +'rm");
621 Format(instr, "'memop'cond'sign'h 'rd, ['rn], #+'off8");
626 if (instr->Bit(22) == 0) {
627 Format(instr, "'memop'cond'sign'h 'rd, ['rn, -'rm]'w");
629 Format(instr, "'memop'cond'sign'h 'rd, ['rn, #-'off8]'w");
634 if (instr->Bit(22) == 0) {
635 Format(instr, "'memop'cond'sign'h 'rd, ['rn, +'rm]'w");
637 Format(instr, "'memop'cond'sign'h 'rd, ['rn, #+'off8]'w");
650 switch (instr->OpcodeField()) {
652 Format(instr, "and'cond's 'rd, 'rn, 'shift_op");
656 Format(instr, "eor'cond's 'rd, 'rn, 'shift_op");
660 Format(instr, "sub'cond's 'rd, 'rn, 'shift_op");
664 Format(instr, "rsb'cond's 'rd, 'rn, 'shift_op");
668 Format(instr, "add'cond's 'rd, 'rn, 'shift_op");
672 Format(instr, "adc'cond's 'rd, 'rn, 'shift_op");
676 Format(instr, "sbc'cond's 'rd, 'rn, 'shift_op");
680 Format(instr, "rsc'cond's 'rd, 'rn, 'shift_op");
684 if (instr->HasS()) {
685 Format(instr, "tst'cond 'rn, 'shift_op");
687 Unknown(instr); // not used by V8
692 if (instr->HasS()) {
693 Format(instr, "teq'cond 'rn, 'shift_op");
695 switch (instr->Bits(7, 4)) {
697 Format(instr, "bx'cond 'rm");
700 Format(instr, "blx'cond 'rm");
703 Unknown(instr); // not used by V8
710 if (instr->HasS()) {
711 Format(instr, "cmp'cond 'rn, 'shift_op");
713 Unknown(instr); // not used by V8
718 if (instr->HasS()) {
719 Format(instr, "cmn'cond 'rn, 'shift_op");
721 switch (instr->Bits(7, 4)) {
723 Format(instr, "clz'cond 'rd, 'rm");
726 Unknown(instr); // not used by V8
733 Format(instr, "orr'cond's 'rd, 'rn, 'shift_op");
737 Format(instr, "mov'cond's 'rd, 'shift_op");
741 Format(instr, "bic'cond's 'rd, 'rn, 'shift_op");
745 Format(instr, "mvn'cond's 'rd, 'shift_op");
758 void Decoder::DecodeType2(Instr* instr) {
759 switch (instr->PUField()) {
761 if (instr->HasW()) {
762 Unknown(instr); // not used in V8
764 Format(instr, "'memop'cond'b 'rd, ['rn], #-'off12");
768 if (instr->HasW()) {
769 Unknown(instr); // not used in V8
771 Format(instr, "'memop'cond'b 'rd, ['rn], #+'off12");
775 Format(instr, "'memop'cond'b 'rd, ['rn, #-'off12]'w");
779 Format(instr, "'memop'cond'b 'rd, ['rn, #+'off12]'w");
791 void Decoder::DecodeType3(Instr* instr) {
792 switch (instr->PUField()) {
794 ASSERT(!instr->HasW());
795 Format(instr, "'memop'cond'b 'rd, ['rn], -'shift_rm");
799 ASSERT(!instr->HasW());
800 Format(instr, "'memop'cond'b 'rd, ['rn], +'shift_rm");
804 Format(instr, "'memop'cond'b 'rd, ['rn, -'shift_rm]'w");
808 if (instr->HasW() && (instr->Bits(6, 4) == 0x5)) {
809 uint32_t widthminus1 = static_cast<uint32_t>(instr->Bits(20, 16));
810 uint32_t lsbit = static_cast<uint32_t>(instr->ShiftAmountField());
813 Format(instr, "ubfx'cond 'rd, 'rm, #'off7to11, #'off16to20");
818 Format(instr, "'memop'cond'b 'rd, ['rn, +'shift_rm]'w");
831 void Decoder::DecodeType4(Instr* instr) {
832 ASSERT(instr->Bit(22) == 0); // Privileged mode currently not supported.
833 if (instr->HasL()) {
834 Format(instr, "ldm'cond'pu 'rn'w, 'rlist");
836 Format(instr, "stm'cond'pu 'rn'w, 'rlist");
841 void Decoder::DecodeType5(Instr* instr) {
842 Format(instr, "b'l'cond 'target");
846 void Decoder::DecodeType6(Instr* instr) {
847 DecodeType6CoprocessorIns(instr);
851 void Decoder::DecodeType7(Instr* instr) {
852 if (instr->Bit(24) == 1) {
853 Format(instr, "swi'cond 'swi");
855 DecodeTypeVFP(instr);
859 void Decoder::DecodeUnconditional(Instr* instr) {
860 if (instr->Bits(7, 4) == 0xB && instr->Bits(27, 25) == 0 && instr->HasL()) {
861 Format(instr, "'memop'h'pu 'rd, ");
862 bool immediate = instr->HasB();
863 switch (instr->PUField()) {
866 if (instr->HasW()) {
867 Unknown(instr);
871 Format(instr, "['rn], #-'imm12");
873 Format(instr, "['rn], -'rm");
879 if (instr->HasW()) {
880 Unknown(instr);
884 Format(instr, "['rn], #+'imm12");
886 Format(instr, "['rn], +'rm");
893 Format(instr, "['rn, #-'imm12]'w");
895 Format(instr, "['rn, -'rm]'w");
902 Format(instr, "['rn, #+'imm12]'w");
904 Format(instr, "['rn, +'rm]'w");
916 Format(instr, "break 'msg");
920 // void Decoder::DecodeTypeVFP(Instr* instr)
931 void Decoder::DecodeTypeVFP(Instr* instr) {
932 ASSERT((instr->TypeField() == 7) && (instr->Bit(24) == 0x0) );
934 if (instr->Bit(23) == 1) {
935 if ((instr->Bits(21, 19) == 0x7) &&
936 (instr->Bits(18, 16) == 0x5) &&
937 (instr->Bits(11, 9) == 0x5) &&
938 (instr->Bit(8) == 1) &&
939 (instr->Bit(6) == 1) &&
940 (instr->Bit(4) == 0)) {
941 Format(instr, "vcvt.s32.f64'cond 'Sd, 'Dm");
942 } else if ((instr->Bits(21, 19) == 0x7) &&
943 (instr->Bits(18, 16) == 0x0) &&
944 (instr->Bits(11, 9) == 0x5) &&
945 (instr->Bit(8) == 1) &&
946 (instr->Bit(7) == 1) &&
947 (instr->Bit(6) == 1) &&
948 (instr->Bit(4) == 0)) {
949 Format(instr, "vcvt.f64.s32'cond 'Dd, 'Sm");
950 } else if ((instr->Bit(21) == 0x0) &&
951 (instr->Bit(20) == 0x0) &&
952 (instr->Bits(11, 9) == 0x5) &&
953 (instr->Bit(8) == 1) &&
954 (instr->Bit(6) == 0) &&
955 (instr->Bit(4) == 0)) {
956 Format(instr, "vdiv.f64'cond 'Dd, 'Dn, 'Dm");
957 } else if ((instr->Bits(21, 20) == 0x3) &&
958 (instr->Bits(19, 16) == 0x4) &&
959 (instr->Bits(11, 9) == 0x5) &&
960 (instr->Bit(8) == 0x1) &&
961 (instr->Bit(6) == 0x1) &&
962 (instr->Bit(4) == 0x0)) {
963 Format(instr, "vcmp.f64'cond 'Dd, 'Dm");
964 } else if ((instr->Bits(23, 20) == 0xF) &&
965 (instr->Bits(19, 16) == 0x1) &&
966 (instr->Bits(11, 8) == 0xA) &&
967 (instr->Bits(7, 5) == 0x0) &&
968 (instr->Bit(4) == 0x1) &&
969 (instr->Bits(3, 0) == 0x0)) {
970 if (instr->Bits(15, 12) == 0xF)
971 Format(instr, "vmrs'cond APSR, FPSCR");
973 Unknown(instr); // Not used by V8.
975 Unknown(instr); // Not used by V8.
977 } else if (instr->Bit(21) == 1) {
978 if ((instr->Bit(20) == 0x1) &&
979 (instr->Bits(11, 9) == 0x5) &&
980 (instr->Bit(8) == 0x1) &&
981 (instr->Bit(6) == 0) &&
982 (instr->Bit(4) == 0)) {
983 Format(instr, "vadd.f64'cond 'Dd, 'Dn, 'Dm");
984 } else if ((instr->Bit(20) == 0x1) &&
985 (instr->Bits(11, 9) == 0x5) &&
986 (instr->Bit(8) == 0x1) &&
987 (instr->Bit(6) == 1) &&
988 (instr->Bit(4) == 0)) {
989 Format(instr, "vsub.f64'cond 'Dd, 'Dn, 'Dm");
990 } else if ((instr->Bit(20) == 0x0) &&
991 (instr->Bits(11, 9) == 0x5) &&
992 (instr->Bit(8) == 0x1) &&
993 (instr->Bit(6) == 0) &&
994 (instr->Bit(4) == 0)) {
995 Format(instr, "vmul.f64'cond 'Dd, 'Dn, 'Dm");
997 Unknown(instr); // Not used by V8.
1000 if ((instr->Bit(20) == 0x0) &&
1001 (instr->Bits(11, 8) == 0xA) &&
1002 (instr->Bits(6, 5) == 0x0) &&
1003 (instr->Bit(4) == 1) &&
1004 (instr->Bits(3, 0) == 0x0)) {
1005 Format(instr, "vmov'cond 'Sn, 'rt");
1006 } else if ((instr->Bit(20) == 0x1) &&
1007 (instr->Bits(11, 8) == 0xA) &&
1008 (instr->Bits(6, 5) == 0x0) &&
1009 (instr->Bit(4) == 1) &&
1010 (instr->Bits(3, 0) == 0x0)) {
1011 Format(instr, "vmov'cond 'rt, 'Sn");
1013 Unknown(instr); // Not used by V8.
1024 void Decoder::DecodeType6CoprocessorIns(Instr* instr) {
1025 ASSERT((instr->TypeField() == 6));
1027 if (instr->CoprocessorField() != 0xB) {
1028 Unknown(instr); // Not used by V8.
1030 switch (instr->OpcodeField()) {
1033 if (instr->Bits(7, 4) != 0x1) {
1034 Unknown(instr); // Not used by V8.
1035 } else if (instr->HasL()) {
1036 Format(instr, "vmov'cond 'rt, 'rn, 'Dm");
1038 Format(instr, "vmov'cond 'Dm, 'rt, 'rn");
1042 if (instr->HasL()) {
1043 Format(instr, "vldr'cond 'Dd, ['rn - 4*'off8]");
1045 Format(instr, "vstr'cond 'Dd, ['rn - 4*'off8]");
1049 if (instr->HasL()) {
1050 Format(instr, "vldr'cond 'Dd, ['rn + 4*'off8]");
1052 Format(instr, "vstr'cond 'Dd, ['rn + 4*'off8]");
1056 Unknown(instr); // Not used by V8.
1065 Instr* instr = Instr::At(instr_ptr);
1069 instr->InstructionBits());
1070 if (instr->ConditionField() == special_condition) {
1071 DecodeUnconditional(instr);
1072 return Instr::kInstrSize;
1074 switch (instr->TypeField()) {
1077 DecodeType01(instr);
1081 DecodeType2(instr);
1085 DecodeType3(instr);
1089 DecodeType4(instr);
1093 DecodeType5(instr);
1097 DecodeType6(instr);
1101 DecodeType7(instr);
1110 return Instr::kInstrSize;