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

Unified Diff: src/mips/constants-mips.h

Issue 2374013004: MIPS32: Remove EXTRA, NORMAL instruction type check. (Closed)
Patch Set: Fix indentation. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/mips/disasm-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/constants-mips.h
diff --git a/src/mips/constants-mips.h b/src/mips/constants-mips.h
index d6400b65e420bdbd752078f040987ae1a7a36a0a..200939d65a35d35188565c5eefd8ce32ac86cf7e 100644
--- a/src/mips/constants-mips.h
+++ b/src/mips/constants-mips.h
@@ -898,7 +898,6 @@ class InstructionBase {
inline int Bits(int hi, int lo) const {
return (InstructionBits() >> lo) & ((2U << (hi - lo)) - 1);
}
- enum TypeChecks { NORMAL, EXTRA };
static constexpr uint64_t kOpcodeImmediateTypeMask =
@@ -967,7 +966,7 @@ class InstructionBase {
inline int SaFieldRaw() const { return InstructionBits() & kSaFieldMask; }
// Get the encoding type of the instruction.
- inline Type InstructionType(TypeChecks checks = NORMAL) const;
+ inline Type InstructionType() const;
protected:
InstructionBase() {}
@@ -1142,11 +1141,16 @@ class InstructionGetters : public T {
class Instruction : public InstructionGetters<InstructionBase> {
public:
+ // Instructions are read of out a code stream. The only way to get a
+ // reference to an instruction is to convert a pointer. There is no way
+ // to allocate or create instances of class Instruction.
+ // Use the At(pc) function to create references to Instruction.
static Instruction* At(byte* pc) {
return reinterpret_cast<Instruction*>(pc);
}
private:
+ // We need to prevent the creation of instances of class Instruction.
DISALLOW_IMPLICIT_CONSTRUCTORS(Instruction);
};
@@ -1165,26 +1169,14 @@ const int kBArgsSlotsSize = 0 * Instruction::kInstrSize;
const int kBranchReturnOffset = 2 * Instruction::kInstrSize;
-InstructionBase::Type InstructionBase::InstructionType(
- TypeChecks checks) const {
- if (checks == EXTRA) {
- if (OpcodeToBitNumber(OpcodeFieldRaw()) & kOpcodeImmediateTypeMask) {
- return kImmediateType;
- }
- }
+InstructionBase::Type InstructionBase::InstructionType() const {
switch (OpcodeFieldRaw()) {
case SPECIAL:
- if (checks == EXTRA) {
- if (FunctionFieldToBitNumber(FunctionFieldRaw()) &
- kFunctionFieldRegisterTypeMask) {
- return kRegisterType;
- } else {
- return kUnsupported;
- }
- } else {
+ if (FunctionFieldToBitNumber(FunctionFieldRaw()) &
+ kFunctionFieldRegisterTypeMask) {
return kRegisterType;
}
- break;
+ return kUnsupported;
case SPECIAL2:
switch (FunctionFieldRaw()) {
case MUL:
@@ -1239,11 +1231,7 @@ InstructionBase::Type InstructionBase::InstructionType(
return kJumpType;
default:
- if (checks == NORMAL) {
return kImmediateType;
- } else {
- return kUnsupported;
- }
}
}
« no previous file with comments | « no previous file | src/mips/disasm-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698