| OLD | NEW |
| 1 //===- subzero/src/IceRegistersX8632.h - Register information ---*- C++ -*-===// | 1 //===- subzero/src/IceRegistersX8632.h - Register information ---*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This file declares the registers and their encodings for x86-32. | 10 // This file declares the registers and their encodings for x86-32. |
| 11 // | 11 // |
| 12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
| 13 | 13 |
| 14 #ifndef SUBZERO_SRC_ICEREGISTERSX8632_H | 14 #ifndef SUBZERO_SRC_ICEREGISTERSX8632_H |
| 15 #define SUBZERO_SRC_ICEREGISTERSX8632_H | 15 #define SUBZERO_SRC_ICEREGISTERSX8632_H |
| 16 | 16 |
| 17 #include "IceDefs.h" | 17 #include "IceDefs.h" |
| 18 #include "IceInstX8632.def" | 18 #include "IceInstX8632.def" |
| 19 #include "IceTypes.h" |
| 19 | 20 |
| 20 namespace Ice { | 21 namespace Ice { |
| 21 | 22 |
| 22 namespace RegX8632 { | 23 namespace RegX8632 { |
| 23 | 24 |
| 24 // An enum of every register. The enum value may not match the encoding | 25 // An enum of every register. The enum value may not match the encoding |
| 25 // used to binary encode register operands in instructions. | 26 // used to binary encode register operands in instructions. |
| 26 enum AllRegisters { | 27 enum AllRegisters { |
| 27 #define X(val, encode, name, name16, name8, scratch, preserved, stackptr, \ | 28 #define X(val, encode, name, name16, name8, scratch, preserved, stackptr, \ |
| 28 frameptr, isI8, isInt, isFP) \ | 29 frameptr, isI8, isInt, isFP) \ |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return XmmRegister(RegNum - Reg_XMM_First); | 77 return XmmRegister(RegNum - Reg_XMM_First); |
| 77 } | 78 } |
| 78 | 79 |
| 79 static inline ByteRegister getEncodedByteReg(int32_t RegNum) { | 80 static inline ByteRegister getEncodedByteReg(int32_t RegNum) { |
| 80 assert(RegNum == Reg_ah || (Reg_GPR_First <= RegNum && RegNum <= Reg_ebx)); | 81 assert(RegNum == Reg_ah || (Reg_GPR_First <= RegNum && RegNum <= Reg_ebx)); |
| 81 if (RegNum == Reg_ah) | 82 if (RegNum == Reg_ah) |
| 82 return Encoded_Reg_ah; | 83 return Encoded_Reg_ah; |
| 83 return ByteRegister(RegNum - Reg_GPR_First); | 84 return ByteRegister(RegNum - Reg_GPR_First); |
| 84 } | 85 } |
| 85 | 86 |
| 87 static inline GPRRegister getEncodedByteRegOrGPR(Type Ty, int32_t RegNum) { |
| 88 if (Ty == IceType_i8 || Ty == IceType_i1) |
| 89 return GPRRegister(getEncodedByteReg(RegNum)); |
| 90 else |
| 91 return getEncodedGPR(RegNum); |
| 92 } |
| 93 |
| 86 } // end of namespace RegX8632 | 94 } // end of namespace RegX8632 |
| 87 | 95 |
| 88 } // end of namespace Ice | 96 } // end of namespace Ice |
| 89 | 97 |
| 90 #endif // SUBZERO_SRC_ICEREGISTERSX8632_H | 98 #endif // SUBZERO_SRC_ICEREGISTERSX8632_H |
| OLD | NEW |