Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: src/mips64/constants-mips64.h

Issue 2374013004: MIPS32: Remove EXTRA, NORMAL instruction type check. (Closed)
Patch Set: Fix indentation. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips/simulator-mips.h ('k') | src/mips64/disasm-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 // Read one particular bit out of the instruction bits. 925 // Read one particular bit out of the instruction bits.
926 inline int Bit(int nr) const { 926 inline int Bit(int nr) const {
927 return (InstructionBits() >> nr) & 1; 927 return (InstructionBits() >> nr) & 1;
928 } 928 }
929 929
930 // Read a bit field out of the instruction bits. 930 // Read a bit field out of the instruction bits.
931 inline int Bits(int hi, int lo) const { 931 inline int Bits(int hi, int lo) const {
932 return (InstructionBits() >> lo) & ((2U << (hi - lo)) - 1); 932 return (InstructionBits() >> lo) & ((2U << (hi - lo)) - 1);
933 } 933 }
934 934
935 enum TypeChecks { NORMAL, EXTRA };
936
937 static constexpr uint64_t kOpcodeImmediateTypeMask = 935 static constexpr uint64_t kOpcodeImmediateTypeMask =
938 OpcodeToBitNumber(REGIMM) | OpcodeToBitNumber(BEQ) | 936 OpcodeToBitNumber(REGIMM) | OpcodeToBitNumber(BEQ) |
939 OpcodeToBitNumber(BNE) | OpcodeToBitNumber(BLEZ) | 937 OpcodeToBitNumber(BNE) | OpcodeToBitNumber(BLEZ) |
940 OpcodeToBitNumber(BGTZ) | OpcodeToBitNumber(ADDI) | 938 OpcodeToBitNumber(BGTZ) | OpcodeToBitNumber(ADDI) |
941 OpcodeToBitNumber(DADDI) | OpcodeToBitNumber(ADDIU) | 939 OpcodeToBitNumber(DADDI) | OpcodeToBitNumber(ADDIU) |
942 OpcodeToBitNumber(DADDIU) | OpcodeToBitNumber(SLTI) | 940 OpcodeToBitNumber(DADDIU) | OpcodeToBitNumber(SLTI) |
943 OpcodeToBitNumber(SLTIU) | OpcodeToBitNumber(ANDI) | 941 OpcodeToBitNumber(SLTIU) | OpcodeToBitNumber(ANDI) |
944 OpcodeToBitNumber(ORI) | OpcodeToBitNumber(XORI) | 942 OpcodeToBitNumber(ORI) | OpcodeToBitNumber(XORI) |
945 OpcodeToBitNumber(LUI) | OpcodeToBitNumber(BEQL) | 943 OpcodeToBitNumber(LUI) | OpcodeToBitNumber(BEQL) |
946 OpcodeToBitNumber(BNEL) | OpcodeToBitNumber(BLEZL) | 944 OpcodeToBitNumber(BNEL) | OpcodeToBitNumber(BLEZL) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 } 1005 }
1008 1006
1009 // Safe to call within InstructionType(). 1007 // Safe to call within InstructionType().
1010 inline int RsFieldRawNoAssert() const { 1008 inline int RsFieldRawNoAssert() const {
1011 return InstructionBits() & kRsFieldMask; 1009 return InstructionBits() & kRsFieldMask;
1012 } 1010 }
1013 1011
1014 inline int SaFieldRaw() const { return InstructionBits() & kSaFieldMask; } 1012 inline int SaFieldRaw() const { return InstructionBits() & kSaFieldMask; }
1015 1013
1016 // Get the encoding type of the instruction. 1014 // Get the encoding type of the instruction.
1017 inline Type InstructionType(TypeChecks checks = NORMAL) const; 1015 inline Type InstructionType() const;
1018 1016
1019 protected: 1017 protected:
1020 InstructionBase() {} 1018 InstructionBase() {}
1021 }; 1019 };
1022 1020
1023 template <class T> 1021 template <class T>
1024 class InstructionGetters : public T { 1022 class InstructionGetters : public T {
1025 public: 1023 public:
1026 inline int RsValue() const { 1024 inline int RsValue() const {
1027 DCHECK(this->InstructionType() == InstructionBase::kRegisterType || 1025 DCHECK(this->InstructionType() == InstructionBase::kRegisterType ||
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 // C/C++ argument slots size. 1217 // C/C++ argument slots size.
1220 const int kCArgSlotCount = 0; 1218 const int kCArgSlotCount = 0;
1221 1219
1222 // TODO(plind): below should be based on kPointerSize 1220 // TODO(plind): below should be based on kPointerSize
1223 // TODO(plind): find all usages and remove the needless instructions for n64. 1221 // TODO(plind): find all usages and remove the needless instructions for n64.
1224 const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize * 2; 1222 const int kCArgsSlotsSize = kCArgSlotCount * Instruction::kInstrSize * 2;
1225 1223
1226 const int kInvalidStackOffset = -1; 1224 const int kInvalidStackOffset = -1;
1227 const int kBranchReturnOffset = 2 * Instruction::kInstrSize; 1225 const int kBranchReturnOffset = 2 * Instruction::kInstrSize;
1228 1226
1229 InstructionBase::Type InstructionBase::InstructionType( 1227 InstructionBase::Type InstructionBase::InstructionType() const {
1230 TypeChecks checks) const {
1231 if (checks == EXTRA) {
1232 if (OpcodeToBitNumber(OpcodeFieldRaw()) & kOpcodeImmediateTypeMask) {
1233 return kImmediateType;
1234 }
1235 }
1236 switch (OpcodeFieldRaw()) { 1228 switch (OpcodeFieldRaw()) {
1237 case SPECIAL: 1229 case SPECIAL:
1238 if (checks == EXTRA) { 1230 if (FunctionFieldToBitNumber(FunctionFieldRaw()) &
1239 if (FunctionFieldToBitNumber(FunctionFieldRaw()) & 1231 kFunctionFieldRegisterTypeMask) {
1240 kFunctionFieldRegisterTypeMask) {
1241 return kRegisterType;
1242 } else {
1243 return kUnsupported;
1244 }
1245 } else {
1246 return kRegisterType; 1232 return kRegisterType;
1247 } 1233 }
1248 break; 1234 return kUnsupported;
1249 case SPECIAL2: 1235 case SPECIAL2:
1250 switch (FunctionFieldRaw()) { 1236 switch (FunctionFieldRaw()) {
1251 case MUL: 1237 case MUL:
1252 case CLZ: 1238 case CLZ:
1253 case DCLZ: 1239 case DCLZ:
1254 return kRegisterType; 1240 return kRegisterType;
1255 default: 1241 default:
1256 return kUnsupported; 1242 return kUnsupported;
1257 } 1243 }
1258 break; 1244 break;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 break; 1301 break;
1316 case COP1X: 1302 case COP1X:
1317 return kRegisterType; 1303 return kRegisterType;
1318 1304
1319 // 26 bits immediate type instructions. e.g.: j imm26. 1305 // 26 bits immediate type instructions. e.g.: j imm26.
1320 case J: 1306 case J:
1321 case JAL: 1307 case JAL:
1322 return kJumpType; 1308 return kJumpType;
1323 1309
1324 default: 1310 default:
1325 if (checks == NORMAL) { 1311 return kImmediateType;
1326 return kImmediateType;
1327 } else {
1328 return kUnsupported;
1329 }
1330 } 1312 }
1331 return kUnsupported; 1313 return kUnsupported;
1332 } 1314 }
1333 #undef OpcodeToBitNumber 1315 #undef OpcodeToBitNumber
1334 #undef FunctionFieldToBitNumber 1316 #undef FunctionFieldToBitNumber
1335 1317
1336 // ----------------------------------------------------------------------------- 1318 // -----------------------------------------------------------------------------
1337 // Instructions. 1319 // Instructions.
1338 1320
1339 template <class P> 1321 template <class P>
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 } 1422 }
1441 break; 1423 break;
1442 default: 1424 default:
1443 return false; 1425 return false;
1444 } 1426 }
1445 } 1427 }
1446 } // namespace internal 1428 } // namespace internal
1447 } // namespace v8 1429 } // namespace v8
1448 1430
1449 #endif // #ifndef V8_MIPS_CONSTANTS_H_ 1431 #endif // #ifndef V8_MIPS_CONSTANTS_H_
OLDNEW
« no previous file with comments | « src/mips/simulator-mips.h ('k') | src/mips64/disasm-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698