[llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp PointerCompress.cpp PoolAllocate.cpp PoolOptimize.cpp TransformFunctionBody.cpp

John Criswell criswell at cs.uiuc.edu
Tue Oct 24 14:44:13 PDT 2006



Changes in directory llvm-poolalloc/lib/PoolAllocate:

AccessTrace.cpp updated: 1.5 -> 1.6
PointerCompress.cpp updated: 1.70 -> 1.71
PoolAllocate.cpp updated: 1.125 -> 1.126
PoolOptimize.cpp updated: 1.6 -> 1.7
TransformFunctionBody.cpp updated: 1.56 -> 1.57
---
Log message:

Updated to newer LLVM API:
  1) Changed RegisterOpt to RegisterPass
  2) Changed Constant[U|S]Int to ConstantInt



---
Diffs of the changes:  (+23 -23)

 AccessTrace.cpp           |    2 +-
 PointerCompress.cpp       |   18 +++++++++---------
 PoolAllocate.cpp          |   12 ++++++------
 PoolOptimize.cpp          |    2 +-
 TransformFunctionBody.cpp |   12 ++++++------
 5 files changed, 23 insertions(+), 23 deletions(-)


Index: llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp
diff -u llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.5 llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.6
--- llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.5	Wed Jul 26 10:07:40 2006
+++ llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp	Tue Oct 24 16:43:50 2006
@@ -45,7 +45,7 @@
                           PA::FuncInfo *FI, DSGraph &DSG);
   };
 
-  RegisterOpt<PoolAccessTrace>
+  RegisterPass<PoolAccessTrace>
   X("poolaccesstrace", "Instrument program to print trace of accesses");
 }
 


Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp
diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.70 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.71
--- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.70	Wed Jul 26 10:07:40 2006
+++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp	Tue Oct 24 16:43:50 2006
@@ -163,7 +163,7 @@
                              Function &F, DSGraph &DSG, PA::FuncInfo *FI);
   };
 
-  RegisterOpt<PointerCompress>
+  RegisterPass<PointerCompress>
   X("pointercompress", "Compress type-safe data structures");
 }
 
@@ -682,11 +682,11 @@
   for (unsigned i = 1, e = GEPI.getNumOperands(); i != e; ++i, ++GTI) {
     Value *Idx = GEPI.getOperand(i);
     if (const StructType *STy = dyn_cast<StructType>(*GTI)) {
-      unsigned Field = (unsigned)cast<ConstantUInt>(Idx)->getValue();
+      uint64_t Field = (unsigned)cast<ConstantInt>(Idx)->getZExtValue();
       if (Field) {
         uint64_t FieldOffs = TD.getStructLayout(cast<StructType>(NTy))
                                         ->MemberOffsets[Field];
-        Constant *FieldOffsCst = ConstantUInt::get(SCALARUINTTYPE, FieldOffs);
+        Constant *FieldOffsCst = ConstantInt::get(SCALARUINTTYPE, FieldOffs);
         Val = BinaryOperator::createAdd(Val, FieldOffsCst,
                                         GEPI.getName(), &GEPI);
       }
@@ -705,7 +705,7 @@
         if (Idx->getType() != SCALARUINTTYPE)
           Idx = new CastInst(Idx, SCALARUINTTYPE, Idx->getName(), &GEPI);
 
-        Constant *Scale = ConstantUInt::get(SCALARUINTTYPE,
+        Constant *Scale = ConstantInt::get(SCALARUINTTYPE,
                                             TD.getTypeSize(ElTy));
         Idx = BinaryOperator::createMul(Idx, Scale, "fieldidx", &GEPI);
         Val = BinaryOperator::createAdd(Val, Idx, GEPI.getName(), &GEPI);
@@ -836,11 +836,11 @@
   std::vector<Value*> Ops;
   Ops.push_back(CI.getOperand(1));
   // Transform to pass in the compressed size.
-  Ops.push_back(ConstantUInt::get(Type::UIntTy, PI->getNewSize()));
+  Ops.push_back(ConstantInt::get(Type::UIntTy, PI->getNewSize()));
 
   // Pointer compression can reduce the alignment restriction to 4 bytes from 8.
   // Reevaluate the desired alignment.
-  Ops.push_back(ConstantUInt::get(Type::UIntTy,
+  Ops.push_back(ConstantInt::get(Type::UIntTy,
              PA::Heuristic::getRecommendedAlignment(PI->getNewType(), TD)));
   // TODO: Compression could reduce the alignment restriction for the pool!
   Value *PB = new CallInst(PtrComp.PoolInitPC, Ops, "", &CI);
@@ -880,11 +880,11 @@
     if (OldSizeV != PI->getNewSize()) {
       // Emit code to scale the allocated size down by the old size then up by
       // the new size.  We actually compute (N+OS-1)/OS * NS.
-      Value *OldSize = ConstantUInt::get(Type::UIntTy, OldSizeV);
-      Value *NewSize = ConstantUInt::get(Type::UIntTy, PI->getNewSize());
+      Value *OldSize = ConstantInt::get(Type::UIntTy, OldSizeV);
+      Value *NewSize = ConstantInt::get(Type::UIntTy, PI->getNewSize());
 
       Size = BinaryOperator::createAdd(Size,
-                                  ConstantUInt::get(Type::UIntTy, OldSizeV-1),
+                                  ConstantInt::get(Type::UIntTy, OldSizeV-1),
                                        "roundup", &CI);
       Size = BinaryOperator::createDiv(Size, OldSize, "numnodes", &CI);
       Size = BinaryOperator::createMul(Size, NewSize, "newbytes", &CI);


Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp
diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.125 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.126
--- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.125	Wed Jul 26 10:07:40 2006
+++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp	Tue Oct 24 16:43:50 2006
@@ -52,9 +52,9 @@
 #endif
 
 namespace {
-  RegisterOpt<PoolAllocate>
+  RegisterPass<PoolAllocate>
   X("poolalloc", "Pool allocate disjoint data structures");
-  RegisterOpt<PoolAllocatePassAllPools>
+  RegisterPass<PoolAllocatePassAllPools>
   Y("poolalloc-passing-all-pools", "Pool allocate disjoint data structures");
 
   Statistic<> NumArgsAdded("poolalloc", "Number of function arguments added");
@@ -523,8 +523,8 @@
     while (isa<AllocaInst>(InsertPt)) ++InsertPt;
   }
 
-  Value *ElSize = ConstantUInt::get(Type::UIntTy, RecSize);
-  Value *AlignV = ConstantUInt::get(Type::UIntTy, Align);
+  Value *ElSize = ConstantInt::get(Type::UIntTy, RecSize);
+  Value *AlignV = ConstantInt::get(Type::UIntTy, Align);
   new CallInst(PoolInit, make_vector((Value*)GV, ElSize, AlignV, 0),
                "", InsertPt);
   ++NumPools;
@@ -861,9 +861,9 @@
 
   // Insert the calls to initialize the pool.
   unsigned ElSizeV = Heuristic::getRecommendedSize(Node);
-  Value *ElSize = ConstantUInt::get(Type::UIntTy, ElSizeV);
+  Value *ElSize = ConstantInt::get(Type::UIntTy, ElSizeV);
   unsigned AlignV = Heuristic::getRecommendedAlignment(Node);
-  Value *Align  = ConstantUInt::get(Type::UIntTy, AlignV);
+  Value *Align  = ConstantInt::get(Type::UIntTy, AlignV);
 
   for (unsigned i = 0, e = PoolInitPoints.size(); i != e; ++i) {
     new CallInst(PoolInit, make_vector((Value*)PD, ElSize, Align, 0),


Index: llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp
diff -u llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.6 llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.7
--- llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.6	Wed Jan 25 16:07:36 2006
+++ llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp	Tue Oct 24 16:43:50 2006
@@ -26,7 +26,7 @@
     bool runOnModule(Module &M);
   };
 
-  RegisterOpt<PoolOptimize>
+  RegisterPass<PoolOptimize>
   X("pooloptimize", "Optimize a pool allocated program");
 }
 


Index: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp
diff -u llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.56 llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.57
--- llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.56	Wed Jul 26 10:07:40 2006
+++ llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp	Tue Oct 24 16:43:50 2006
@@ -197,7 +197,7 @@
 
   TargetData &TD = PAInfo.getAnalysis<TargetData>();
   Value *AllocSize =
-    ConstantUInt::get(Type::UIntTy, TD.getTypeSize(MI.getAllocatedType()));
+    ConstantInt::get(Type::UIntTy, TD.getTypeSize(MI.getAllocatedType()));
 
   if (MI.isArrayAllocation())
     AllocSize = BinaryOperator::create(Instruction::Mul, AllocSize,
@@ -239,7 +239,7 @@
     if (PH == 0 || isa<ConstantPointerNull>(PH)) return;
     TargetData &TD = PAInfo.getAnalysis<TargetData>();
     Value *AllocSize =
-      ConstantUInt::get(Type::UIntTy, TD.getTypeSize(MI.getAllocatedType()));
+      ConstantInt::get(Type::UIntTy, TD.getTypeSize(MI.getAllocatedType()));
     
     if (MI.isArrayAllocation())
       AllocSize = BinaryOperator::create(Instruction::Mul, AllocSize,
@@ -328,8 +328,8 @@
                        BBI);
   
   // We know that the memory returned by poolalloc is at least 4 byte aligned.
-  new CallInst(MemSet, make_vector(Ptr, ConstantUInt::get(Type::UByteTy, 0),
-                                   V2,  ConstantUInt::get(Type::UIntTy, 4), 0),
+  new CallInst(MemSet, make_vector(Ptr, ConstantInt::get(Type::UByteTy, 0),
+                                   V2,  ConstantInt::get(Type::UIntTy, 4), 0),
                "", BBI);
 }
 
@@ -649,8 +649,8 @@
 	  BasicBlock::iterator InsertPt = TheCall->getParent()->getParent()->front().begin();
 	  Type *VoidPtrTy = PointerType::get(Type::SByteTy);
 	  ArgVal =  new AllocaInst(ArrayType::get(VoidPtrTy, 16), 0, "PD", InsertPt);
-	  Value *ElSize = ConstantUInt::get(Type::UIntTy,0);
-	  Value *Align  = ConstantUInt::get(Type::UIntTy,0);
+	  Value *ElSize = ConstantInt::get(Type::UIntTy,0);
+	  Value *Align  = ConstantInt::get(Type::UIntTy,0);
 	  new CallInst(PAInfo.PoolInit, make_vector(ArgVal, ElSize, Align, 0),"", TheCall);
 	    new CallInst(PAInfo.PoolDestroy, make_vector(ArgVal, 0), "",
 		       TheCall->getNext());






More information about the llvm-commits mailing list