Index: src/IceRegistersX8632.h |
diff --git a/src/IceRegistersX8632.h b/src/IceRegistersX8632.h |
index effbf36b9924fe1d7b6abaf0b5e4ea48fd4015e7..3aa8178df8dff011a194d915a0b8f973eda194e3 100644 |
--- a/src/IceRegistersX8632.h |
+++ b/src/IceRegistersX8632.h |
@@ -19,67 +19,71 @@ |
namespace Ice { |
-class RegX8632 { |
-public: |
- // An enum of every register. The enum value may not match the encoding |
- // used to binary encode register operands in instructions. |
- enum AllRegisters { |
+namespace RegX8632 { |
+ |
+// An enum of every register. The enum value may not match the encoding |
+// used to binary encode register operands in instructions. |
+enum AllRegisters { |
#define X(val, encode, name, name16, name8, scratch, preserved, stackptr, \ |
frameptr, isI8, isInt, isFP) \ |
val, |
- REGX8632_TABLE |
+ REGX8632_TABLE |
#undef X |
- Reg_NUM, |
+ Reg_NUM, |
#define X(val, init) val init, |
- REGX8632_TABLE_BOUNDS |
+ REGX8632_TABLE_BOUNDS |
#undef X |
- }; |
+}; |
- // An enum of GPR Registers. The enum value does match encoding used |
- // to binary encode register operands in instructions. |
- enum GPRRegister { |
+// An enum of GPR Registers. The enum value does match encoding used |
+// to binary encode register operands in instructions. |
+enum GPRRegister { |
#define X(val, encode, name, name16, name8, scratch, preserved, stackptr, \ |
frameptr, isI8, isInt, isFP) \ |
Encoded_##val encode, |
- REGX8632_GPR_TABLE |
+ REGX8632_GPR_TABLE |
#undef X |
- }; |
+ Encoded_Not_GPR = -1 |
+}; |
- // An enum of XMM Registers. The enum value does match encoding used |
- // to binary encode register operands in instructions. |
- enum XmmRegister { |
+// An enum of XMM Registers. The enum value does match encoding used |
+// to binary encode register operands in instructions. |
+enum XmmRegister { |
#define X(val, encode, name, name16, name8, scratch, preserved, stackptr, \ |
frameptr, isI8, isInt, isFP) \ |
Encoded_##val encode, |
- REGX8632_XMM_TABLE |
+ REGX8632_XMM_TABLE |
#undef X |
- }; |
+ Encoded_Not_Xmm = -1 |
+}; |
- // An enum of Byte Registers. The enum value does match encoding used |
- // to binary encode register operands in instructions. |
- enum ByteRegister { |
+// An enum of Byte Registers. The enum value does match encoding used |
+// to binary encode register operands in instructions. |
+enum ByteRegister { |
#define X(val, encode) Encoded_##val encode, |
- REGX8632_BYTEREG_TABLE |
+ REGX8632_BYTEREG_TABLE |
#undef X |
- }; |
+ Encoded_Not_ByteReg = -1 |
+}; |
- static GPRRegister getEncodedGPR(int32_t RegNum) { |
- assert(Reg_GPR_First <= RegNum && RegNum <= Reg_GPR_Last); |
- return GPRRegister(RegNum - Reg_GPR_First); |
- } |
+static inline GPRRegister getEncodedGPR(int32_t RegNum) { |
+ assert(Reg_GPR_First <= RegNum && RegNum <= Reg_GPR_Last); |
+ return GPRRegister(RegNum - Reg_GPR_First); |
+} |
- static XmmRegister getEncodedXmm(int32_t RegNum) { |
- assert(Reg_XMM_First <= RegNum && RegNum <= Reg_XMM_Last); |
- return XmmRegister(RegNum - Reg_XMM_First); |
- } |
+static inline XmmRegister getEncodedXmm(int32_t RegNum) { |
+ assert(Reg_XMM_First <= RegNum && RegNum <= Reg_XMM_Last); |
+ return XmmRegister(RegNum - Reg_XMM_First); |
+} |
- static ByteRegister getEncodedByteReg(int32_t RegNum) { |
- assert(RegNum == Reg_ah || (Reg_GPR_First <= RegNum && RegNum <= Reg_ebx)); |
- if (RegNum == Reg_ah) |
- return Encoded_Reg_ah; |
- return ByteRegister(RegNum - Reg_GPR_First); |
- } |
-}; |
+static inline ByteRegister getEncodedByteReg(int32_t RegNum) { |
+ assert(RegNum == Reg_ah || (Reg_GPR_First <= RegNum && RegNum <= Reg_ebx)); |
+ if (RegNum == Reg_ah) |
+ return Encoded_Reg_ah; |
+ return ByteRegister(RegNum - Reg_GPR_First); |
+} |
+ |
+} // end of namespace RegX8632 |
} // end of namespace Ice |