OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_MIPS_CONSTANTS_H_ | 5 #ifndef V8_MIPS_CONSTANTS_H_ |
6 #define V8_MIPS_CONSTANTS_H_ | 6 #define V8_MIPS_CONSTANTS_H_ |
7 | 7 |
8 #include "src/base/logging.h" | 8 #include "src/base/logging.h" |
9 #include "src/base/macros.h" | 9 #include "src/base/macros.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 const bool IsMipsSoftFloatABI = false; | 53 const bool IsMipsSoftFloatABI = false; |
54 #elif(defined(__mips_soft_float) && __mips_soft_float != 0) | 54 #elif(defined(__mips_soft_float) && __mips_soft_float != 0) |
55 // This flag is raised when -msoft-float is passed to the compiler. | 55 // This flag is raised when -msoft-float is passed to the compiler. |
56 // Although FPU is a base requirement for v8, soft-float ABI is used | 56 // Although FPU is a base requirement for v8, soft-float ABI is used |
57 // on soft-float systems with FPU kernel emulation. | 57 // on soft-float systems with FPU kernel emulation. |
58 const bool IsMipsSoftFloatABI = true; | 58 const bool IsMipsSoftFloatABI = true; |
59 #else | 59 #else |
60 const bool IsMipsSoftFloatABI = true; | 60 const bool IsMipsSoftFloatABI = true; |
61 #endif | 61 #endif |
62 | 62 |
| 63 #if defined(V8_TARGET_LITTLE_ENDIAN) |
| 64 const uint32_t kMipsLwrOffset = 0; |
| 65 const uint32_t kMipsLwlOffset = 3; |
| 66 const uint32_t kMipsSwrOffset = 0; |
| 67 const uint32_t kMipsSwlOffset = 3; |
| 68 const uint32_t kMipsLdrOffset = 0; |
| 69 const uint32_t kMipsLdlOffset = 7; |
| 70 const uint32_t kMipsSdrOffset = 0; |
| 71 const uint32_t kMipsSdlOffset = 7; |
| 72 #elif defined(V8_TARGET_BIG_ENDIAN) |
| 73 const uint32_t kMipsLwrOffset = 3; |
| 74 const uint32_t kMipsLwlOffset = 0; |
| 75 const uint32_t kMipsSwrOffset = 3; |
| 76 const uint32_t kMipsSwlOffset = 0; |
| 77 const uint32_t kMipsLdrOffset = 7; |
| 78 const uint32_t kMipsLdlOffset = 0; |
| 79 const uint32_t kMipsSdrOffset = 7; |
| 80 const uint32_t kMipsSdlOffset = 0; |
| 81 #else |
| 82 #error Unknown endianness |
| 83 #endif |
63 | 84 |
64 #ifndef __STDC_FORMAT_MACROS | 85 #ifndef __STDC_FORMAT_MACROS |
65 #define __STDC_FORMAT_MACROS | 86 #define __STDC_FORMAT_MACROS |
66 #endif | 87 #endif |
67 #include <inttypes.h> | 88 #include <inttypes.h> |
68 | 89 |
69 | 90 |
70 // Defines constants and accessor classes to assemble, disassemble and | 91 // Defines constants and accessor classes to assemble, disassemble and |
71 // simulate MIPS32 instructions. | 92 // simulate MIPS32 instructions. |
72 // | 93 // |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 // Instruction type. | 925 // Instruction type. |
905 enum Type { | 926 enum Type { |
906 kRegisterType, | 927 kRegisterType, |
907 kImmediateType, | 928 kImmediateType, |
908 kJumpType, | 929 kJumpType, |
909 kUnsupported = -1 | 930 kUnsupported = -1 |
910 }; | 931 }; |
911 | 932 |
912 enum TypeChecks { NORMAL, EXTRA }; | 933 enum TypeChecks { NORMAL, EXTRA }; |
913 | 934 |
914 | |
915 static constexpr uint64_t kOpcodeImmediateTypeMask = | 935 static constexpr uint64_t kOpcodeImmediateTypeMask = |
916 OpcodeToBitNumber(REGIMM) | OpcodeToBitNumber(BEQ) | | 936 OpcodeToBitNumber(REGIMM) | OpcodeToBitNumber(BEQ) | |
917 OpcodeToBitNumber(BNE) | OpcodeToBitNumber(BLEZ) | | 937 OpcodeToBitNumber(BNE) | OpcodeToBitNumber(BLEZ) | |
918 OpcodeToBitNumber(BGTZ) | OpcodeToBitNumber(ADDI) | | 938 OpcodeToBitNumber(BGTZ) | OpcodeToBitNumber(ADDI) | |
919 OpcodeToBitNumber(DADDI) | OpcodeToBitNumber(ADDIU) | | 939 OpcodeToBitNumber(DADDI) | OpcodeToBitNumber(ADDIU) | |
920 OpcodeToBitNumber(DADDIU) | OpcodeToBitNumber(SLTI) | | 940 OpcodeToBitNumber(DADDIU) | OpcodeToBitNumber(SLTI) | |
921 OpcodeToBitNumber(SLTIU) | OpcodeToBitNumber(ANDI) | | 941 OpcodeToBitNumber(SLTIU) | OpcodeToBitNumber(ANDI) | |
922 OpcodeToBitNumber(ORI) | OpcodeToBitNumber(XORI) | | 942 OpcodeToBitNumber(ORI) | OpcodeToBitNumber(XORI) | |
923 OpcodeToBitNumber(LUI) | OpcodeToBitNumber(BEQL) | | 943 OpcodeToBitNumber(LUI) | OpcodeToBitNumber(BEQL) | |
924 OpcodeToBitNumber(BNEL) | OpcodeToBitNumber(BLEZL) | | 944 OpcodeToBitNumber(BNEL) | OpcodeToBitNumber(BLEZL) | |
925 OpcodeToBitNumber(BGTZL) | OpcodeToBitNumber(POP66) | | 945 OpcodeToBitNumber(BGTZL) | OpcodeToBitNumber(POP66) | |
926 OpcodeToBitNumber(POP76) | OpcodeToBitNumber(LB) | OpcodeToBitNumber(LH) | | 946 OpcodeToBitNumber(POP76) | OpcodeToBitNumber(LB) | OpcodeToBitNumber(LH) | |
927 OpcodeToBitNumber(LWL) | OpcodeToBitNumber(LW) | OpcodeToBitNumber(LWU) | | 947 OpcodeToBitNumber(LWL) | OpcodeToBitNumber(LW) | OpcodeToBitNumber(LWU) | |
928 OpcodeToBitNumber(LD) | OpcodeToBitNumber(LBU) | OpcodeToBitNumber(LHU) | | 948 OpcodeToBitNumber(LD) | OpcodeToBitNumber(LBU) | OpcodeToBitNumber(LHU) | |
929 OpcodeToBitNumber(LWR) | OpcodeToBitNumber(SB) | OpcodeToBitNumber(SH) | | 949 OpcodeToBitNumber(LDL) | OpcodeToBitNumber(LDR) | OpcodeToBitNumber(LWR) | |
| 950 OpcodeToBitNumber(SDL) | OpcodeToBitNumber(SB) | OpcodeToBitNumber(SH) | |
930 OpcodeToBitNumber(SWL) | OpcodeToBitNumber(SW) | OpcodeToBitNumber(SD) | | 951 OpcodeToBitNumber(SWL) | OpcodeToBitNumber(SW) | OpcodeToBitNumber(SD) | |
931 OpcodeToBitNumber(SWR) | OpcodeToBitNumber(LWC1) | | 952 OpcodeToBitNumber(SWR) | OpcodeToBitNumber(SDR) | |
932 OpcodeToBitNumber(LDC1) | OpcodeToBitNumber(SWC1) | | 953 OpcodeToBitNumber(LWC1) | OpcodeToBitNumber(LDC1) | |
933 OpcodeToBitNumber(SDC1) | OpcodeToBitNumber(PCREL) | | 954 OpcodeToBitNumber(SWC1) | OpcodeToBitNumber(SDC1) | |
934 OpcodeToBitNumber(DAUI) | OpcodeToBitNumber(BC) | OpcodeToBitNumber(BALC); | 955 OpcodeToBitNumber(PCREL) | OpcodeToBitNumber(DAUI) | |
| 956 OpcodeToBitNumber(BC) | OpcodeToBitNumber(BALC); |
935 | 957 |
936 #define FunctionFieldToBitNumber(function) (1ULL << function) | 958 #define FunctionFieldToBitNumber(function) (1ULL << function) |
937 | 959 |
938 // On r6, DCLZ_R6 aliases to existing MFLO. | 960 // On r6, DCLZ_R6 aliases to existing MFLO. |
939 static const uint64_t kFunctionFieldRegisterTypeMask = | 961 static const uint64_t kFunctionFieldRegisterTypeMask = |
940 FunctionFieldToBitNumber(JR) | FunctionFieldToBitNumber(JALR) | | 962 FunctionFieldToBitNumber(JR) | FunctionFieldToBitNumber(JALR) | |
941 FunctionFieldToBitNumber(BREAK) | FunctionFieldToBitNumber(SLL) | | 963 FunctionFieldToBitNumber(BREAK) | FunctionFieldToBitNumber(SLL) | |
942 FunctionFieldToBitNumber(DSLL) | FunctionFieldToBitNumber(DSLL32) | | 964 FunctionFieldToBitNumber(DSLL) | FunctionFieldToBitNumber(DSLL32) | |
943 FunctionFieldToBitNumber(SRL) | FunctionFieldToBitNumber(DSRL) | | 965 FunctionFieldToBitNumber(SRL) | FunctionFieldToBitNumber(DSRL) | |
944 FunctionFieldToBitNumber(DSRL32) | FunctionFieldToBitNumber(SRA) | | 966 FunctionFieldToBitNumber(DSRL32) | FunctionFieldToBitNumber(SRA) | |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 } | 1301 } |
1280 return kUnsupported; | 1302 return kUnsupported; |
1281 } | 1303 } |
1282 | 1304 |
1283 #undef OpcodeToBitNumber | 1305 #undef OpcodeToBitNumber |
1284 #undef FunctionFieldToBitNumber | 1306 #undef FunctionFieldToBitNumber |
1285 } // namespace internal | 1307 } // namespace internal |
1286 } // namespace v8 | 1308 } // namespace v8 |
1287 | 1309 |
1288 #endif // #ifndef V8_MIPS_CONSTANTS_H_ | 1310 #endif // #ifndef V8_MIPS_CONSTANTS_H_ |
OLD | NEW |