diff options
Diffstat (limited to 'lib')
58 files changed, 4956 insertions, 3926 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index fdc452b44f..8d4cbdb93d 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -468,11 +468,10 @@ static bool ValuesEqual(Value *V1, Value *V2) { /// CheckGEPInstructions - Check two GEP instructions with known must-aliasing /// base pointers. This checks to see if the index expressions preclude the /// pointers from aliasing... -AliasAnalysis::AliasResult BasicAliasAnalysis:: -CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, - unsigned G1S, - const Type *BasePtr2Ty, std::vector<Value*> &GEP2Ops, - unsigned G2S) { +AliasAnalysis::AliasResult +BasicAliasAnalysis::CheckGEPInstructions( + const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, unsigned G1S, + const Type *BasePtr2Ty, std::vector<Value*> &GEP2Ops, unsigned G2S) { // We currently can't handle the case when the base pointers have different // primitive types. Since this is uncommon anyway, we are happy being // extremely conservative. @@ -670,7 +669,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, if (const ConstantInt *Op1C = dyn_cast<ConstantInt>(Op1)) { // If this is an array index, make sure the array element is in range. if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) - if (Op1C->getRawValue() >= AT->getNumElements()) + if (Op1C->getZExtValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses } else { @@ -685,7 +684,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, // value possible. // if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) - GEP1Ops[i] = ConstantSInt::get(Type::LongTy,AT->getNumElements()-1); + GEP1Ops[i] = ConstantInt::get(Type::LongTy, AT->getNumElements()-1); } } @@ -693,7 +692,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, if (const ConstantInt *Op2C = dyn_cast<ConstantInt>(Op2)) { // If this is an array index, make sure the array element is in range. if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) - if (Op2C->getRawValue() >= AT->getNumElements()) + if (Op2C->getZExtValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses } else { // Conservatively assume the minimum value for this index GEP2Ops[i] = Constant::getNullValue(Op2->getType()); diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 7e802ba7dd..359766d444 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -163,14 +163,15 @@ llvm::ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands) { default: break; } - } else if (ConstantUInt *Op = dyn_cast<ConstantUInt>(Operands[0])) { - uint64_t V = Op->getValue(); + } else if (ConstantInt *Op = dyn_cast<ConstantInt>(Operands[0])) { + assert(Op->getType()->isUnsigned() && "bswap args must be unsigned"); + uint64_t V = Op->getZExtValue(); if (Name == "llvm.bswap.i16") - return ConstantUInt::get(Ty, ByteSwap_16(V)); + return ConstantInt::get(Ty, ByteSwap_16(V)); else if (Name == "llvm.bswap.i32") - return ConstantUInt::get(Ty, ByteSwap_32(V)); + return ConstantInt::get(Ty, ByteSwap_32(V)); else if (Name == "llvm.bswap.i64") - return ConstantUInt::get(Ty, ByteSwap_64(V)); + return ConstantInt::get(Ty, ByteSwap_64(V)); } } else if (Operands.size() == 2) { if (ConstantFP *Op1 = dyn_cast<ConstantFP>(Operands[0])) { diff --git a/lib/Analysis/ConstantRange.cpp b/lib/Analysis/ConstantRange.cpp index beb61754fc..9e12c9343d 100644 --- a/lib/Analysis/ConstantRange.cpp +++ b/lib/Analysis/ConstantRange.cpp @@ -161,7 +161,7 @@ uint64_t ConstantRange::getSetSize() const { // Simply subtract the bounds... Constant *Result = ConstantExpr::getSub(Upper, Lower); - return cast<ConstantInt>(Result)->getRawValue(); + return cast<ConstantInt>(Result)->getZExtValue(); } /// contains - Return true if the specified value is in the set. @@ -288,7 +288,7 @@ ConstantRange ConstantRange::zeroExtend(const Type *Ty) const { // Change a source full set into [0, 1 << 8*numbytes) unsigned SrcTySize = getLower()->getType()->getPrimitiveSize(); return ConstantRange(Constant::getNullValue(Ty), - ConstantUInt::get(Ty, 1ULL << SrcTySize*8)); + ConstantInt::get(Ty, 1ULL << SrcTySize*8)); } Constant *Lower = getLower(); diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index dbfbea3981..c5c68b3a69 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/lib/Analysis/DataStructure/Local.cpp @@ -407,7 +407,7 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) { I != E; ++I) if (const StructType *STy = dyn_cast<StructType>(*I)) { unsigned FieldNo = - (unsigned)cast<ConstantUInt>(I.getOperand())->getValue(); + (unsigned)cast<ConstantInt>(I.getOperand())->getZExtValue(); Offset += (unsigned)TD.getStructLayout(STy)->MemberOffsets[FieldNo]; } else if (const PointerType *PTy = dyn_cast<PointerType>(*I)) { if (!isa<Constant>(I.getOperand()) || diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 93d20f474f..a992e51e0f 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -177,7 +177,7 @@ SCEVHandle SCEVConstant::get(ConstantInt *V) { // Make sure that SCEVConstant instances are all unsigned. if (V->getType()->isSigned()) { const Type *NewTy = V->getType()->getUnsignedVersion(); - V = cast<ConstantUInt>(ConstantExpr::getCast(V, NewTy)); + V = cast<ConstantInt>(ConstantExpr::getCast(V, NewTy)); } SCEVConstant *&R = (*SCEVConstants)[V]; @@ -463,9 +463,9 @@ SCEVHandle SCEVUnknown::getIntegerSCEV(int Val, const Type *Ty) { else if (Ty->isFloatingPoint()) C = ConstantFP::get(Ty, Val); else if (Ty->isSigned()) - C = ConstantSInt::get(Ty, Val); + C = ConstantInt::get(Ty, Val); else { - C = ConstantSInt::get(Ty->getSignedVersion(), Val); + C = ConstantInt::get(Ty->getSignedVersion(), Val); C = ConstantExpr::getCast(C, Ty); } return SCEVUnknown::get(C); @@ -507,11 +507,11 @@ static SCEVHandle PartialFact(SCEVHandle V, unsigned NumSteps) { // Handle this case efficiently, it is common to have constant iteration // counts while computing loop exit values. if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V)) { - uint64_t Val = SC->getValue()->getRawValue(); + uint64_t Val = SC->getValue()->getZExtValue(); uint64_t Result = 1; for (; NumSteps; --NumSteps) Result *= Val-(NumSteps-1); - Constant *Res = ConstantUInt::get(Type::ULongTy, Result); + Constant *Res = ConstantInt::get(Type::ULongTy, Result); return SCEVUnknown::get(ConstantExpr::getCast(Res, V->getType())); } @@ -1605,7 +1605,7 @@ GetAddressedElementFromGlobal(GlobalVariable *GV, const std::vector<ConstantInt*> &Indices) { Constant *Init = GV->getInitializer(); for (unsigned i = 0, e = Indices.size(); i != e; ++i) { - uint64_t Idx = Indices[i]->getRawValue(); + uint64_t Idx = Indices[i]->getZExtValue(); if (ConstantStruct *CS = dyn_cast<ConstantStruct>(Init)) { assert(Idx < CS->getNumOperands() && "Bad struct index!"); Init = cast<Constant>(CS->getOperand(Idx)); @@ -1679,8 +1679,8 @@ ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS, unsigned MaxSteps = MaxBruteForceIterations; for (unsigned IterationNum = 0; IterationNum != MaxSteps; ++IterationNum) { - ConstantUInt *ItCst = - ConstantUInt::get(IdxExpr->getType()->getUnsignedVersion(), IterationNum); + ConstantInt *ItCst = + ConstantInt::get(IdxExpr->getType()->getUnsignedVersion(), IterationNum); ConstantInt *Val = EvaluateConstantChrecAtConstant(IdxExpr, ItCst); // Form the GEP offset. @@ -1896,7 +1896,7 @@ ComputeIterationCountExhaustively(const Loop *L, Value *Cond, bool ExitWhen) { if (CondVal->getValue() == ExitWhen) { ConstantEvolutionLoopExitValue[PN] = PHIVal; ++NumBruteForceTripCountsComputed; - return SCEVConstant::get(ConstantUInt::get(Type::UIntTy, IterationNum)); + return SCEVConstant::get(ConstantInt::get(Type::UIntTy, IterationNum)); } // Compute the value of the PHI node for the next iteration. @@ -1935,7 +1935,7 @@ SCEVHandle ScalarEvolutionsImpl::getSCEVAtScope(SCEV *V, const Loop *L) { // this is a constant evolving PHI node, get the final value at // the specified iteration number. Constant *RV = getConstantEvolutionLoopExitValue(PN, - ICC->getValue()->getRawValue(), + ICC->getValue()->getZExtValue(), LI); if (RV) return SCEVUnknown::get(RV); } @@ -2076,10 +2076,10 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) { SqrtTerm = ConstantExpr::getSub(ConstantExpr::getMul(B, B), SqrtTerm); // Compute floor(sqrt(B^2-4ac)) - ConstantUInt *SqrtVal = - cast<ConstantUInt>(ConstantExpr::getCast(SqrtTerm, + ConstantInt *SqrtVal = + cast<ConstantInt>(ConstantExpr::getCast(SqrtTerm, SqrtTerm->getType()->getUnsignedVersion())); - uint64_t SqrtValV = SqrtVal->getValue(); + uint64_t SqrtValV = SqrtVal->getZExtValue(); uint64_t SqrtValV2 = (uint64_t)sqrt((double)SqrtValV); // The square root might not be precise for arbitrary 64-bit integer // values. Do some sanity checks to ensure it's correct. @@ -2089,7 +2089,7 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) { return std::make_pair(CNC, CNC); } - SqrtVal = ConstantUInt::get(Type::ULongTy, SqrtValV2); + SqrtVal = ConstantInt::get(Type::ULongTy, SqrtValV2); SqrtTerm = ConstantExpr::getCast(SqrtVal, SqrtTerm->getType()); Constant *NegB = ConstantExpr::getNeg(B); diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp index fd33e2fae2..68b52dd4fa 100644 --- a/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/lib/Analysis/ScalarEvolutionExpander.cpp @@ -144,7 +144,7 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) { // IF the step is by one, just return the inserted IV. if (ConstantIntegral *CI = dyn_cast<ConstantIntegral>(F)) - if (CI->getRawValue() == 1) + if (CI->getZExtValue() == 1) return I; // If the insert point is directly inside of the loop, emit the multiply at diff --git a/lib/AsmParser/Lexer.cpp.cvs b/lib/AsmParser/Lexer.cpp.cvs index f6306aff9d..605a8c9230 100644 --- a/lib/AsmParser/Lexer.cpp.cvs +++ b/lib/AsmParser/Lexer.cpp.cvs @@ -17,7 +17,7 @@ #define yylineno llvmAsmlineno #line 20 "Lexer.cpp" -/* A lexical scanner generated by flex */ +/* A lexical scanner generated by flex*/ /* Scanner skeleton version: * $Header$ @@ -28,6 +28,7 @@ #define YY_FLEX_MINOR_VERSION 5 #include <stdio.h> +#include <unistd.h> /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ @@ -41,7 +42,6 @@ #ifdef __cplusplus #include <stdlib.h> -#include <unistd.h> /* Use prototypes in function declarations. */ #define YY_USE_PROTOS @@ -153,6 +153,15 @@ extern FILE *yyin, *yyout; #define unput(c) yyunput( c, yytext_ptr ) +/* Some routines like yy_flex_realloc() are emitted as static but are + not called by all lexers. This generates warnings in some compilers, + notably GCC. Arrange to suppress these. */ +#ifdef __GNUC__ +#define YY_MAY_BE_UNUSED __attribute__((unused)) +#else +#define YY_MAY_BE_UNUSED +#endif + /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). @@ -259,7 +268,7 @@ YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED; static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer @@ -829,7 +838,7 @@ goto find_rule; \ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 1 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" #define INITIAL 0 /*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===// // @@ -844,7 +853,7 @@ char *yytext; // //===----------------------------------------------------------------------===*/ #define YY_NEVER_INTERACTIVE 1 -#line 28 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 28 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" #include "ParserInternals.h" #include "llvm/Module.h" #include <list> @@ -970,7 +979,7 @@ using namespace llvm; /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing * it to deal with 64 bit numbers. */ -#line 974 "Lexer.cpp" +#line 983 "Lexer.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1118,13 +1127,13 @@ YY_MALLOC_DECL YY_DECL { register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; + register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 179 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 179 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" -#line 1128 "Lexer.cpp" +#line 1137 "Lexer.cpp" if ( yy_init ) { @@ -1217,507 +1226,507 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 181 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 181 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { /* Ignore comments for now */ } YY_BREAK case 2: YY_RULE_SETUP -#line 183 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 183 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return BEGINTOK; } YY_BREAK case 3: YY_RULE_SETUP -#line 184 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 184 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return ENDTOK; } YY_BREAK case 4: YY_RULE_SETUP -#line 185 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 185 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return TRUETOK; } YY_BREAK case 5: YY_RULE_SETUP -#line 186 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 186 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return FALSETOK; } YY_BREAK case 6: YY_RULE_SETUP -#line 187 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 187 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return DECLARE; } YY_BREAK case 7: YY_RULE_SETUP -#line 188 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 188 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return GLOBAL; } YY_BREAK case 8: YY_RULE_SETUP -#line 189 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 189 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return CONSTANT; } YY_BREAK case 9: YY_RULE_SETUP -#line 190 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 190 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return INTERNAL; } YY_BREAK case 10: YY_RULE_SETUP -#line 191 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 191 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return LINKONCE; } YY_BREAK case 11: YY_RULE_SETUP -#line 192 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 192 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return WEAK; } YY_BREAK case 12: YY_RULE_SETUP -#line 193 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 193 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return APPENDING; } YY_BREAK case 13: YY_RULE_SETUP -#line 194 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 194 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return DLLIMPORT; } YY_BREAK case 14: YY_RULE_SETUP -#line 195 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 195 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return DLLEXPORT; } YY_BREAK case 15: YY_RULE_SETUP -#line 196 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 196 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return EXTERN_WEAK; } YY_BREAK case 16: YY_RULE_SETUP -#line 197 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 197 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return EXTERNAL; } /* Deprecated, turn into external */ YY_BREAK case 17: YY_RULE_SETUP -#line 198 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 198 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return EXTERNAL; } YY_BREAK case 18: YY_RULE_SETUP -#line 199 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 199 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return IMPLEMENTATION; } YY_BREAK case 19: YY_RULE_SETUP -#line 200 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 200 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return ZEROINITIALIZER; } YY_BREAK case 20: YY_RULE_SETUP -#line 201 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 201 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return DOTDOTDOT; } YY_BREAK case 21: YY_RULE_SETUP -#line 202 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 202 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return UNDEF; } YY_BREAK case 22: YY_RULE_SETUP -#line 203 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 203 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return NULL_TOK; } YY_BREAK case 23: YY_RULE_SETUP -#line 204 "/Users/resistor/llvm/src/llvm/lib/AsmParser/Lexer.l" +#line 204 "/proj/llvm/llvm/lib/AsmParser/Lexer.l" { return TO; } YY_BREAK case 24: YY_RULE_SETUP |