From 559d519549072fc7c3ca3ee5dae78733096f22c0 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 9 Jan 2004 05:53:38 +0000 Subject: [PATCH] Finegrainify namespacification add flags for PR82 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10724 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/ExprTypeConvert.cpp | 5 +++++ lib/Transforms/LevelRaise.cpp | 3 ++- lib/Transforms/TransformInternals.cpp | 28 +++++++++++++++------------ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp index 25b41904d30..3fce96b6288 100644 --- a/lib/Transforms/ExprTypeConvert.cpp +++ b/lib/Transforms/ExprTypeConvert.cpp @@ -799,6 +799,7 @@ static bool OperandConvertibleToType(User *U, Value *V, const Type *Ty, // stream, so we have to delete it when we're done. // if (DataSize != 1) { + // FIXME, PR82 TempScale = BinaryOperator::create(Instruction::Mul, Index, ConstantSInt::get(Type::LongTy, DataSize)); @@ -1011,6 +1012,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, if (const CompositeType *CT = dyn_cast(LoadedTy)) { std::vector Indices; + // FIXME, PR82 Indices.push_back(ConstantSInt::get(Type::LongTy, 0)); unsigned Offset = 0; // No offset, get first leaf. @@ -1047,6 +1049,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, const StructType *SElTy = cast(ElTy); std::vector Indices; + // FIXME, PR82 Indices.push_back(Constant::getNullValue(Type::LongTy)); unsigned Offset = 0; @@ -1076,6 +1079,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, if (isa(ValTy)) { std::vector Indices; + // FIXME: PR82 Indices.push_back(Constant::getNullValue(Type::LongTy)); unsigned Offset = 0; @@ -1109,6 +1113,7 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal, if (DataSize != 1) { // Insert a multiply of the old element type is not a unit size... Index = BinaryOperator::create(Instruction::Mul, Index, + // FIXME: PR82 ConstantSInt::get(Type::LongTy, DataSize), "scale", It); } diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp index 41a47749f79..8b5e253950f 100644 --- a/lib/Transforms/LevelRaise.cpp +++ b/lib/Transforms/LevelRaise.cpp @@ -370,7 +370,8 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) { // Build the index vector, full of all zeros std::vector Indices; - Indices.push_back(ConstantSInt::get(Type::LongTy, 0)); + + Indices.push_back(ConstantSInt::get(Type::LongTy, 0)); // FIXME, PR82 while (CurCTy && !isa(CurCTy)) { const Type *IdxType; if (const StructType *CurSTy = dyn_cast(CurCTy)) { diff --git a/lib/Transforms/TransformInternals.cpp b/lib/Transforms/TransformInternals.cpp index e02bd8bbccb..eb20544344b 100644 --- a/lib/Transforms/TransformInternals.cpp +++ b/lib/Transforms/TransformInternals.cpp @@ -17,8 +17,7 @@ #include "llvm/Analysis/Expressions.h" #include "llvm/Function.h" #include "llvm/iOther.h" - -namespace llvm { +using namespace llvm; static const Type *getStructOffsetStep(const StructType *STy, uint64_t &Offset, std::vector &Indices, @@ -36,6 +35,7 @@ static const Type *getStructOffsetStep(const StructType *STy, uint64_t &Offset, (i == SL->MemberOffsets.size()-1 || Offset < SL->MemberOffsets[i+1])); // Make sure to save the current index... + // FIXME for PR82 Indices.push_back(ConstantUInt::get(Type::UByteTy, i)); Offset = SL->MemberOffsets[i]; return STy->getContainedType(i); @@ -53,9 +53,9 @@ static const Type *getStructOffsetStep(const StructType *STy, uint64_t &Offset, // case, this routine will not drill down to the leaf type. Set StopEarly to // false if you want a leaf // -const Type *getStructOffsetType(const Type *Ty, unsigned &Offset, - std::vector &Indices, - const TargetData &TD, bool StopEarly) { +const Type *llvm::getStructOffsetType(const Type *Ty, unsigned &Offset, + std::vector &Indices, + const TargetData &TD, bool StopEarly) { if (Offset == 0 && StopEarly && !Indices.empty()) return Ty; // Return the leaf type @@ -75,6 +75,7 @@ const Type *getStructOffsetType(const Type *Ty, unsigned &Offset, NextType = ATy->getElementType(); unsigned ChildSize = TD.getTypeSize(NextType); + // FIXME for PR82 Indices.push_back(ConstantSInt::get(Type::LongTy, Offset/ChildSize)); ThisOffset = (Offset/ChildSize)*ChildSize; } else { @@ -94,10 +95,10 @@ const Type *getStructOffsetType(const Type *Ty, unsigned &Offset, // with the values that would be appropriate to make this a getelementptr // instruction. The type returned is the root type that the GEP would point to // -const Type *ConvertibleToGEP(const Type *Ty, Value *OffsetVal, - std::vector &Indices, - const TargetData &TD, - BasicBlock::iterator *BI) { +const Type *llvm::ConvertibleToGEP(const Type *Ty, Value *OffsetVal, + std::vector &Indices, + const TargetData &TD, + BasicBlock::iterator *BI) { const CompositeType *CompTy = dyn_cast(Ty); if (CompTy == 0) return 0; @@ -152,12 +153,13 @@ const Type *ConvertibleToGEP(const Type *Ty, Value *OffsetVal, if (BI) { // Generate code? BasicBlock *BB = (*BI)->getParent(); - if (Expr.Var->getType() != Type::LongTy) - Expr.Var = new CastInst(Expr.Var, Type::LongTy, + if (Expr.Var->getType() != Type::LongTy) // FIXME for PR82 + Expr.Var = new CastInst(Expr.Var, Type::LongTy, // FIXME for PR82 Expr.Var->getName()+"-idxcast", *BI); if (ScaleAmt && ScaleAmt != 1) { // If we have to scale up our index, do so now + // FIXME for PR82 Value *ScaleAmtVal = ConstantSInt::get(Type::LongTy, ScaleAmt); Expr.Var = BinaryOperator::create(Instruction::Mul, Expr.Var, ScaleAmtVal, @@ -165,6 +167,7 @@ const Type *ConvertibleToGEP(const Type *Ty, Value *OffsetVal, } if (Index) { // Add an offset to the index + // FIXME for PR82 Value *IndexAmt = ConstantSInt::get(Type::LongTy, Index); Expr.Var = BinaryOperator::create(Instruction::Add, Expr.Var, IndexAmt, @@ -178,6 +181,7 @@ const Type *ConvertibleToGEP(const Type *Ty, Value *OffsetVal, } else if (Offset >= (int64_t)ElSize || -Offset >= (int64_t)ElSize) { // Calculate the index that we are entering into the array cell with uint64_t Index = Offset/ElSize; + // FIXME for PR82 Indices.push_back(ConstantSInt::get(Type::LongTy, Index)); Offset -= (int64_t)(Index*ElSize); // Consume part of the offset @@ -185,6 +189,7 @@ const Type *ConvertibleToGEP(const Type *Ty, Value *OffsetVal, // Must be indexing a small amount into the first cell of the array // Just index into element zero of the array here. // + // FIXME for PR82 Indices.push_back(ConstantSInt::get(Type::LongTy, 0)); } else { return 0; // Hrm. wierd, can't handle this case. Bail @@ -196,4 +201,3 @@ const Type *ConvertibleToGEP(const Type *Ty, Value *OffsetVal, return NextTy; } -} // End llvm namespace -- 2.34.1