diff options
| author | Anand Shukla <ashukla@cs.uiuc.edu> | 2002-06-25 21:07:58 +0000 |
|---|---|---|
| committer | Anand Shukla <ashukla@cs.uiuc.edu> | 2002-06-25 21:07:58 +0000 |
| commit | 2bc6419a82fcf85fde0267abc01f423b63d1f459 (patch) | |
| tree | af86027e443b0d684ffbdc738e835f5bf9f018cf /llvm/lib/Transforms/Scalar | |
| parent | 458496c0603f922301898409417b717476cfbf10 (diff) | |
| download | bcm5719-llvm-2bc6419a82fcf85fde0267abc01f423b63d1f459.tar.gz bcm5719-llvm-2bc6419a82fcf85fde0267abc01f423b63d1f459.zip | |
changes to make it compatible with 64bit gcc
llvm-svn: 2792
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/ADCE.cpp | 1 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp | 13 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Scalar/GCSE.cpp | 3 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 1 |
5 files changed, 18 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp index 237c4589b2a..35189e36838 100644 --- a/llvm/lib/Transforms/Scalar/ADCE.cpp +++ b/llvm/lib/Transforms/Scalar/ADCE.cpp @@ -21,6 +21,7 @@ #include <algorithm> #include <iostream> using std::cerr; +using std::vector; static Statistic<> NumBlockRemoved("adce\t\t- Number of basic blocks removed"); static Statistic<> NumInstRemoved ("adce\t\t- Number of instructions removed"); diff --git a/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp index ab6059a88f6..b18095027bd 100644 --- a/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp +++ b/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp @@ -66,6 +66,7 @@ bool DecomposePass::runOnBasicBlock(BasicBlock &BB) { // uses the last ptr2 generated in the loop and a single index. // If any index is (uint) 0, we omit the getElementPtr instruction. // + void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { MemAccessInst &MAI = cast<MemAccessInst>(*BBI); BasicBlock *BB = MAI.getParent(); @@ -74,10 +75,11 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { // Remove the instruction from the stream BB->getInstList().remove(BBI); - vector<Instruction*> NewInsts; + std::vector<Instruction*> NewInsts; // Process each index except the last one. // + User::const_op_iterator OI = MAI.idx_begin(), OE = MAI.idx_end(); for (; OI+1 != OE; ++OI) { assert(isa<PointerType>(LastPtr->getType())); @@ -92,8 +94,10 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { // and the next index is a structure offset (i.e., not an array offset), // we need to include an initial [0] to index into the pointer. // - vector<Value*> Indices; + + std::vector<Value*> Indices; const PointerType *PtrTy = cast<PointerType>(LastPtr->getType()); + if (isa<StructType>(PtrTy->getElementType()) && !PtrTy->indexValid(*OI)) Indices.push_back(Constant::getNullValue(Type::UIntTy)); @@ -117,6 +121,7 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { NewInsts.push_back(cast<Instruction>(LastPtr)); ++NumAdded; } + // Instruction 2: nextPtr2 = cast nextPtr1 to NextPtrTy // This is not needed if the two types are identical. @@ -134,7 +139,8 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { const PointerType *PtrTy = cast<PointerType>(LastPtr->getType()); // First, get the final index vector. As above, we may need an initial [0]. - vector<Value*> Indices; + + std::vector<Value*> Indices; if (isa<StructType>(PtrTy->getElementType()) && !PtrTy->indexValid(*OI)) Indices.push_back(Constant::getNullValue(Type::UIntTy)); @@ -156,6 +162,7 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { assert(0 && "Unrecognized memory access instruction"); } NewInsts.push_back(NewI); + // Replace all uses of the old instruction with the new MAI.replaceAllUsesWith(NewI); diff --git a/llvm/lib/Transforms/Scalar/GCSE.cpp b/llvm/lib/Transforms/Scalar/GCSE.cpp index 850e65a64f3..56bb191e16d 100644 --- a/llvm/lib/Transforms/Scalar/GCSE.cpp +++ b/llvm/lib/Transforms/Scalar/GCSE.cpp @@ -23,6 +23,9 @@ #include "llvm/Support/CFG.h" #include "Support/StatisticReporter.h" #include <algorithm> +using std::set; +using std::map; + static Statistic<> NumInstRemoved("gcse\t\t- Number of instructions removed"); static Statistic<> NumLoadRemoved("gcse\t\t- Number of loads removed"); diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index 7a32315a544..4913a89ea61 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -16,6 +16,7 @@ #include "llvm/Support/CFG.h" #include "Support/STLExtras.h" #include "Support/StatisticReporter.h" +#include <iostream> static Statistic<> NumRemoved ("indvars\t\t- Number of aux indvars removed"); static Statistic<> NumInserted("indvars\t\t- Number of cannonical indvars added"); @@ -114,7 +115,7 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) { Changed = true; } - DEBUG(cerr << "Induction variables:\n"); + DEBUG(std::cerr << "Induction variables:\n"); // Get the current loop iteration count, which is always the value of the // cannonical phi node... @@ -127,7 +128,7 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) { for (unsigned i = 0; i < IndVars.size(); ++i) { InductionVariable *IV = &IndVars[i]; - DEBUG(cerr << IV); + DEBUG(std::cerr << IV); // Don't modify the cannonical indvar or unrecognized indvars... if (IV != Cannonical && IV->InductionType != InductionVariable::Unknown) { diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 98de44708f0..99ee45e3cd7 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -25,6 +25,7 @@ #include "Support/STLExtras.h" #include "Support/StatisticReporter.h" #include <algorithm> +using std::string; static Statistic<> NumHoistedNPH("licm\t\t- Number of insts hoisted to multiple" " loop preds (bad, no loop pre-header)"); |

