summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMRegisterInfo.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2006-12-18 11:07:09 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2006-12-18 11:07:09 +0000
commit3ab9256d19e4ad1381c960e622a4b906d5877ca6 (patch)
tree39cf87f83cfcd1a283fa1b5012d77153292662c0 /llvm/lib/Target/ARM/ARMRegisterInfo.cpp
parente45ac2ab119fc37c24634d3111b52023aaa18cee (diff)
downloadbcm5719-llvm-3ab9256d19e4ad1381c960e622a4b906d5877ca6.tar.gz
bcm5719-llvm-3ab9256d19e4ad1381c960e622a4b906d5877ca6.zip
macros -> Inline functions
Lauros's patch llvm-svn: 32656
Diffstat (limited to 'llvm/lib/Target/ARM/ARMRegisterInfo.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMRegisterInfo.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/llvm/lib/Target/ARM/ARMRegisterInfo.cpp b/llvm/lib/Target/ARM/ARMRegisterInfo.cpp
index 47090b2488c..73fd7a4899d 100644
--- a/llvm/lib/Target/ARM/ARMRegisterInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMRegisterInfo.cpp
@@ -35,9 +35,13 @@ static bool hasFP(const MachineFunction &MF) {
return NoFramePointerElim || MFI->hasVarSizedObjects();
}
-#define ROTATE32L(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
+static inline unsigned rotateL(unsigned x, unsigned n){
+ return ((x << n) | (x >> (32 - n)));
+}
-#define ROTATE32R(x, n) (((x) >> (n)) | ((x) << (32 - (n))))
+static inline unsigned rotateR(unsigned x, unsigned n){
+ return ((x >> n) | (x << (32 - n)));
+}
// finds the end position of largest sequence of zeros in binary representation
// of 'immediate'.
@@ -50,19 +54,19 @@ static int findLargestZeroSequence(unsigned immediate){
int end_pos;
while ((immediate & 0x3) == 0) {
- immediate = ROTATE32R(immediate, 2);
+ immediate = rotateR(immediate, 2);
pos+=2;
}
end_pos = pos+32;
while (pos<end_pos){
while ((immediate & 0x3) != 0) {
- immediate = ROTATE32R(immediate, 2);
+ immediate = rotateR(immediate, 2);
pos+=2;
}
zero_pos = pos;
while ((immediate & 0x3) == 0) {
- immediate = ROTATE32R(immediate, 2);
+ immediate = rotateR(immediate, 2);
pos+=2;
}
zero_length = pos - zero_pos;
@@ -90,19 +94,19 @@ static void splitInstructionWithImmediate(MachineBasicBlock &BB,
}
int start_pos = findLargestZeroSequence(immediate);
- unsigned immediate_tmp = ROTATE32R(immediate, start_pos);
+ unsigned immediate_tmp = rotateR(immediate, start_pos);
int pos = 0;
while (pos < 32){
while(((immediate_tmp&0x3) == 0)&&(pos<32)){
- immediate_tmp = ROTATE32R(immediate_tmp,2);
+ immediate_tmp = rotateR(immediate_tmp,2);
pos+=2;
}
if (pos < 32){
BuildMI(BB, I, TID, DestReg).addReg(OrigReg)
- .addImm(ROTATE32L(immediate_tmp&0xFF, (start_pos + pos) % 32 ))
+ .addImm(rotateL(immediate_tmp&0xFF, (start_pos + pos) % 32 ))
.addImm(0).addImm(ARMShift::LSL);
- immediate_tmp = ROTATE32R(immediate_tmp,8);
+ immediate_tmp = rotateR(immediate_tmp,8);
pos+=8;
}
}
OpenPOWER on IntegriCloud