Index: src/IceRegistersARM32.h |
diff --git a/src/IceRegistersARM32.h b/src/IceRegistersARM32.h |
index d601e734b19e334ea40a571d756a8a3c3ce3cbdb..2e022429b55d2e8f3e3c44ebdbcf98d1473ba6d9 100644 |
--- a/src/IceRegistersARM32.h |
+++ b/src/IceRegistersARM32.h |
@@ -82,6 +82,10 @@ public: |
Encoded_Not_QReg = -1 |
}; |
+ static inline SizeT getNumGPRRegs() { |
+ return Reg_GPR_Last + 1 - Reg_GPR_First; |
+ } |
+ |
static inline GPRRegister getEncodedGPR(int32_t RegNum) { |
assert(Reg_GPR_First <= RegNum); |
assert(RegNum <= Reg_GPR_Last); |
@@ -113,15 +117,23 @@ public: |
} |
static inline SRegister getEncodedSReg(int32_t RegNum) { |
- assert(Reg_SREG_First <= RegNum); |
- assert(RegNum <= Reg_SREG_Last); |
+ assert(isEncodedSReg(RegNum)); |
return SRegister(RegNum - Reg_SREG_First); |
} |
+ // Note: D registers are listed from largest to smallest. |
Jim Stichnoth
2015/12/19 15:31:25
We should not be assuming any ordering (including
Karl
2016/01/05 20:24:31
If you note the functions above this one, ALL of t
|
+ |
+ static inline bool isEncodedDReg(int32_t RegNum) { |
+ return Reg_DREG_First >= RegNum && RegNum >= Reg_DREG_Last; |
+ } |
+ |
+ static inline SizeT getNumDRegs() { |
+ return Reg_DREG_First + 1 - Reg_DREG_Last; |
+ } |
+ |
static inline DRegister getEncodedDReg(int32_t RegNum) { |
- assert(Reg_DREG_First <= RegNum); |
- assert(RegNum <= Reg_DREG_Last); |
- return DRegister(RegNum - Reg_DREG_First); |
+ assert(isEncodedDReg(RegNum)); |
+ return DRegister(Reg_DREG_First - RegNum); |
} |
static inline QRegister getEncodedQReg(int32_t RegNum) { |