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

Unified Diff: src/IceRegistersX8632.h

Issue 574133002: Add initial integrated assembler w/ some Xmm ops. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: remove duplicate pxor, and use enum Created 6 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 | « src/IceMemoryRegion.cpp ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/IceMemoryRegion.cpp ('k') | src/IceTargetLowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698