[llvm-commits] CVS: llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp

Anand Shukla ashukla at cs.uiuc.edu
Sat May 31 21:35:00 PDT 2003


Changes in directory llvm/lib/Reoptimizer/TraceCache:

InstrUtils.cpp updated: 1.9 -> 1.10

---
Log message:

Simple additions to the runtime API

---
Diffs of the changes:

Index: llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp
diff -u llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp:1.9 llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp:1.10
--- llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp:1.9	Fri Feb 14 14:46:11 2003
+++ llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp	Sat May 31 21:32:49 2003
@@ -150,11 +150,11 @@
 }
 
 bool isBranchAlways(unsigned int b){
-  return (((b&0x1e000000)>>25) == 8);
+  return (((b & 0xc0000000) == 0) && (((b&0x1e000000)>>25) == 8));
 }
 
 bool isBranchNever(unsigned int b){
-  return (((b&0x1e000000)>>25) == 0);
+  return (((b & 0xc0000000) == 0) && (((b&0x1e000000)>>25) == 0) && (isDepJump(b) || isNonDepJump(b) || isBPR(b)));
 }
 
 //BPR: (b&(2^22+2^23+2^24) == (2^22+2^23)
@@ -174,4 +174,41 @@
   }
 }
 
+
+unsigned int getInvertedBranch(unsigned int br1){
+
+  assert(isBranchInstr(br1) && "Not a branch!");
+  unsigned int cond = 0;
+ 
+ //check if br1 is a predicated branch
+  if(isBPR(br1)){
+    cond = (br1&0x0e000000)>>25;
+
+    assert(cond !=4 && cond!=0 && cond<8 && 
+         "Incorrect cond codes for BPR Instruction!");
+  
+    //get inverted cond!
+    if(cond<4)
+      cond+=4;
+    else
+      cond %= 4;
+
+    cond = cond << 25;
+    //mask with 2^32-1-2^25-2^26-2^27
+    return (br1 & 4060086271U) | cond;
+  }  
+  
+  cond = (br1&0x1e000000)>>25;
+
+  //reverse cond
+  if(cond<8)
+    cond+=8;
+  else
+    cond %= 8;
+
+  cond = cond << 25;
+
+  //mask with 2^32-1-2^25-2^26-2^27-2^28
+  return (br1 & 3791650815U)|(cond);
+}
 #endif





More information about the llvm-commits mailing list