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

Anand Shukla ashukla at cs.uiuc.edu
Sun Sep 15 17:34:00 PDT 2002


Changes in directory llvm/lib/Reoptimizer/TraceCache:

InstrUtils.cpp updated: 1.1 -> 1.2

---
Log message:

Made InstrUtils.cpp compatible with old gcc


---
Diffs of the changes:

Index: llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp
diff -u llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp:1.1 llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp:1.2
--- llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp:1.1	Sun Sep 15 15:36:07 2002
+++ llvm/lib/Reoptimizer/TraceCache/InstrUtils.cpp	Sun Sep 15 17:33:48 2002
@@ -7,7 +7,6 @@
 #include "llvm/Reoptimizer/InstrUtils.h"
 #include <assert.h>
 #include <iostream>
-//#include <algorithm>
 
 bool isNonDepJump(unsigned int y){
   return ((y & 0x01c00000) == 4194304);
@@ -18,11 +17,11 @@
 }
 
 uint64_t getNonDepJmpTarget(unsigned int y, uint64_t oldAdd){
-  return (oldAdd+4*(((y&262144)==262144) ? ((y&0x0007ffff)|0xfffffffffff80000) : (y&0x0007ffff)));
+  return (oldAdd+4ull*(((y&262144ull)==262144ull) ? ((y&0x0007ffffull)|0xfffffffffff80000ull) : (y&0x0007ffffull)));
 }
 
 uint64_t getDepJmpTarget(unsigned int y, uint64_t oldAdd){
-  return (oldAdd+4*(((y&2097152)==2097152) ? ((y&0x003fffff)|0xffffffffffc00000) : (y&0x003fffff)));
+  return (oldAdd+4ull*(((y&2097152ull)==2097152ull) ? ((y&0x003fffffull)|0xffffffffffc00000ull) : (y&0x003fffffull)));
 }
 
 /*
@@ -62,7 +61,7 @@
 }
 
 uint64_t getCallTarget(unsigned int y, uint64_t oldAdd){
-  uint64_t toRet = (oldAdd + 4*(((y&536870912)==536870912)?(0xffffffffc0000000|(y&0x3fffffff)):(y&0x3fffffff)));
+  uint64_t toRet = (oldAdd + 4ull*(((y&536870912ull)==536870912ull)?(0xffffffffc0000000ull|(y&0x3fffffffull)):(y&0x3fffffffull)));
   std::cerr<<"\t\t\tCall Target:"<<(void *)toRet<<"\n";
   return toRet;
 }
@@ -95,19 +94,9 @@
 }
 
 uint64_t getBPRTarget(unsigned int b, uint64_t oldAdd){
-  return (oldAdd+4*(((b&2097152)==2097152)?(0xffffffffffff0000|((b&3145728)>>6)|(b&16383)):(((b&3145728)>>6)|(b&16383))));
+  return (oldAdd+4ull*(((b&2097152ull)==2097152ull)?(0xffffffffffff0000ull|((b&3145728ull)>>6)|(b&16383ull)):(((b&3145728ull)>>6)|(b&16383ull))));
 }
 
-// unsigned int getBPRInstr(unsigned int b, uint64_t to, uint64_t frm){
-//   //frame = 2^32-1-(2^21+2^20+2^14-1)
-//   unsigned int frame = b&4291805184;
-//   uint64_t target = (to-frm)/4;
-//   assert((target&(2147483647))<32768 && "Target out of range!");
-//   unsigned int hi = ((target & (2147483648))>>10)|((target&(16384))<<6);
-//   unsigned lo = target&(16383);
-//   return (frame|hi|lo);
-// }
-
 std::pair<unsigned int, unsigned int> getBPRInstr(unsigned int b, uint64_t to, 
                                                   uint64_t frm){
 
@@ -122,10 +111,10 @@
   frm+=4;
   uint64_t target = (to-frm)/4;
   //target < 2^21
-  assert((target&(0x7fffffffffffffff))<2097152 && "Target out of range!");
+  assert((target&(0x7fffffffffffffffull))<2097152 && "Target out of range!");
   
   unsigned int inst = 
-    ((target & (2097151))|((target&(0x8000000000000000))>>42));
+    ((target & (2097151))|((target&(0x8000000000000000ull))>>42));
   
   inst = inst|(0x00800000);//skeleton filled in
 
@@ -150,7 +139,8 @@
 }
 
 void doFlush(uint64_t st_addr, uint64_t end_addr){
-  for(uint64_t i = st_addr; i<=end_addr; i+=8){
-    asm("flush %0"::"r" (i));
-  }
+  return;
+  //for(uint64_t i = st_addr; i<=end_addr; i+=8){
+  //asm("flush %0"::"r" (i));
+  //}
 }





More information about the llvm-commits mailing list