llvm.org GIT mirror llvm / ae9f3a3
Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47367 91177308-0d34-0410-b5e6-96231b3b80d8 Anton Korobeynikov 11 years ago
48 changed file(s) with 93 addition(s) and 40 deletion(s). Raw diff Collapse all Expand all
1515
1616 #include "llvm/Support/MathExtras.h"
1717 #include
18 #include
1819 #include
19 #include assert>
20 #include string>
2021
2122 namespace llvm {
2223
312312 NumEntries = 0;
313313 NumTombstones = 0;
314314 NumBuckets = InitBuckets;
315 assert(InitBuckets && (InitBuckets & InitBuckets-1) == 0 &&
315 assert(InitBuckets && (InitBuckets & (InitBuckets-1)) == 0 &&
316316 "# initial buckets must be a power of two!");
317317 Buckets = reinterpret_cast(new char[sizeof(BucketT)*InitBuckets]);
318318 // Initialize all the keys to EmptyKey.
3939
4040 #include "llvm/ADT/iterator"
4141 #include
42 #include
4243
4344 namespace llvm {
4445
403403 if (BranchInst *BI = dyn_cast(BackedgeBlock->getTerminator()))
404404 if (BI->isConditional()) {
405405 if (ICmpInst *ICI = dyn_cast(BI->getCondition())) {
406 if (ICI->getOperand(0) == Inc)
406 if (ICI->getOperand(0) == Inc) {
407407 if (BI->getSuccessor(0) == getHeader()) {
408408 if (ICI->getPredicate() == ICmpInst::ICMP_NE)
409409 return ICI->getOperand(1);
410410 } else if (ICI->getPredicate() == ICmpInst::ICMP_EQ) {
411411 return ICI->getOperand(1);
412412 }
413 }
413414 }
414415 }
415416
252252 virtual bool hasComputableLoopEvolution(const Loop *L) const {
253253 bool HasVarying = false;
254254 for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
255 if (!getOperand(i)->isLoopInvariant(L))
255 if (!getOperand(i)->isLoopInvariant(L)) {
256256 if (getOperand(i)->hasComputableLoopEvolution(L))
257257 HasVarying = true;
258258 else
259259 return false;
260 }
260261 return HasVarying;
261262 }
262263
210210 // If the first node isn't one we're interested in, advance to one that
211211 // we are interested in.
212212 if (op) {
213 if (!ReturnUses && op->isUse() ||
214 !ReturnDefs && op->isDef())
213 if ((!ReturnUses && op->isUse()) ||
214 (!ReturnDefs && op->isDef()))
215215 ++*this;
216216 }
217217 }
239239 Op = Op->getNextOperandForReg();
240240
241241 // If this is an operand we don't care about, skip it.
242 while (Op && (!ReturnUses && Op->isUse() ||
243 !ReturnDefs && Op->isDef()))
242 while (Op && ((!ReturnUses && Op->isUse()) ||
243 (!ReturnDefs && Op->isDef())))
244244 Op = Op->getNextOperandForReg();
245245
246246 return *this;
842842 static inline SDOperand getEmptyKey() { return SDOperand((SDNode*)-1, -1U); }
843843 static inline SDOperand getTombstoneKey() { return SDOperand((SDNode*)-1, 0);}
844844 static unsigned getHashValue(const SDOperand &Val) {
845 return (unsigned)((uintptr_t)Val.Val >> 4) ^
846 (unsigned)((uintptr_t)Val.Val >> 9) + Val.ResNo;
845 return ((unsigned)((uintptr_t)Val.Val >> 4) ^
846 (unsigned)((uintptr_t)Val.Val >> 9)) + Val.ResNo;
847847 }
848848 static bool isEqual(const SDOperand &LHS, const SDOperand &RHS) {
849849 return LHS == RHS;
2020 #include
2121 #include
2222 #include
23 #include
2324 #include "llvm/Support/DataTypes.h"
2425
2526 namespace llvm {
1616 #ifndef LLVM_TARGET_TARGETJITINFO_H
1717 #define LLVM_TARGET_TARGETJITINFO_H
1818
19 #include
1920 #include
20 #include
21 #include "llvm/Support/DataTypes.h"
2122
2223 namespace llvm {
2324 class Function;
99 #include "llvm-c/Analysis.h"
1010 #include "llvm/Analysis/Verifier.h"
1111 #include
12 #include
1213
1314 using namespace llvm;
1415
138138
139139 Constraint(ConstraintType Ty, unsigned D, unsigned S, unsigned O = 0)
140140 : Type(Ty), Dest(D), Src(S), Offset(O) {
141 assert(Offset == 0 || Ty != AddressOf &&
141 assert((Offset == 0 || Ty != AddressOf) &&
142142 "Offset is illegal on addressof constraints");
143143 }
144144
19301930
19311931 C.Src = FindEquivalentNode(RHSNode, RHSLabel);
19321932 C.Dest = FindEquivalentNode(FindNode(LHSNode), LHSLabel);
1933 if (C.Src == C.Dest && C.Type == Constraint::Copy
1933 if ((C.Src == C.Dest && C.Type == Constraint::Copy)
19341934 || Seen.count(C))
19351935 continue;
19361936
114114 /// case the most generic behavior of this function should be returned.
115115 virtual ModRefBehavior getModRefBehavior(Function *F, CallSite CS,
116116 std::vector *Info) {
117 if (FunctionRecord *FR = getFunctionInfo(F))
117 if (FunctionRecord *FR = getFunctionInfo(F)) {
118118 if (FR->FunctionEffect == 0)
119119 return DoesNotAccessMemory;
120120 else if ((FR->FunctionEffect & Mod) == 0)
121121 return OnlyReadsMemory;
122 }
122123 return AliasAnalysis::getModRefBehavior(F, CS, Info);
123124 }
124125
21442144 Instruction *I = dyn_cast(V);
21452145 if (I == 0 || !L->contains(I->getParent())) return 0;
21462146
2147 if (PHINode *PN = dyn_cast(I))
2147 if (PHINode *PN = dyn_cast(I)) {
21482148 if (L->getHeader() == I->getParent())
21492149 return PN;
21502150 else
21512151 // We don't currently keep track of the control flow needed to evaluate
21522152 // PHIs, so we cannot handle PHIs inside of loops.
21532153 return 0;
2154 }
21542155
21552156 // If we won't be able to constant fold this expression even if the operands
21562157 // are constants, return early.
1717 #include "llvm/Module.h"
1818 #include "llvm/Support/MemoryBuffer.h"
1919 #include "llvm/System/Process.h"
20 #include
21 #include
2022 using namespace llvm;
2123
2224 // getMemberSize - compute the actual physical size of the file member as seen
1616 #include "llvm/Bitcode/Archive.h"
1717 #include "llvm/System/TimeValue.h"
1818 #include "llvm/ADT/StringExtras.h"
19
20 #include
1921
2022 #define ARFILE_MAGIC "!\n" ///< magic string
2123 #define ARFILE_MAGIC_LEN (sizeof(ARFILE_MAGIC)-1) ///< length of magic string
1717
1818 #include
1919 #include "llvmAsmParser.h"
20
21 #include
2022 using namespace llvm;
2123
2224 //===----------------------------------------------------------------------===//
1313 #include "ParserInternals.h"
1414 #include "llvm/Module.h"
1515 #include "llvm/Support/MemoryBuffer.h"
16 #include
1617 using namespace llvm;
1718
1819
1010 #include "llvm/Bitcode/ReaderWriter.h"
1111 #include "llvm/Support/MemoryBuffer.h"
1212 #include
13 #include
1314
1415 using namespace llvm;
1516
3737 #include "llvm/Support/OutputBuffer.h"
3838 #include "llvm/Support/Streams.h"
3939 #include
40 #include
4041 using namespace llvm;
4142
4243 /// AddMachOWriter - Concrete function to add the Mach-O writer to the function
2525 #include "llvm/System/DynamicLibrary.h"
2626 #include "llvm/System/Host.h"
2727 #include "llvm/Target/TargetData.h"
28 #include <math.h>
28 #include <cmath>
29 #include
2930 using namespace llvm;
3031
3132 STATISTIC(NumInitBytes, "Number of bytes of global vars initialized");
1414 #include "llvm-c/ExecutionEngine.h"
1515 #include "llvm/ExecutionEngine/GenericValue.h"
1616 #include "llvm/ExecutionEngine/ExecutionEngine.h"
17 #include
1718
1819 using namespace llvm;
1920
2222 #include "llvm/ADT/Statistic.h"
2323 #include "llvm/Support/Debug.h"
2424 #include "llvm/Support/MathExtras.h"
25 #include
2526 #include
26 #include <algorithm>
27 #include <cstring>
2728 using namespace llvm;
2829
2930 STATISTIC(NumDynamicInsts, "Number of dynamic instructions executed");
2828 #include
2929 #include
3030 #include
31 #include
3132
3233 #ifdef __linux__
3334 #include
1717 #include "llvm/DerivedTypes.h"
1818 #include "llvm/Module.h"
1919 #include "llvm/ModuleProvider.h"
20 #include
2021 using namespace llvm;
2122
2223 static struct RegisterInterp {
1616 #include
1717 #include
1818 #include
19 #include
20 #include
1921 using namespace llvm;
2022
2123
2828 #include
2929 #include
3030 #include
31 #include
3132 using namespace llvm;
3233 using namespace cl;
3334
1515 #include "llvm/System/Path.h"
1616 #include "llvm/System/MappedFile.h"
1717 #include "llvm/ADT/StringExtras.h"
18 #include
1819 #include
1920 #include
2021 using namespace llvm;
1616 #include "llvm/ADT/FoldingSet.h"
1717 #include "llvm/Support/MathExtras.h"
1818 #include
19 #include
1920 using namespace llvm;
2021
2122 //===----------------------------------------------------------------------===//
2727 #include "llvm/ADT/StringExtras.h"
2828 #include
2929 #include
30 #include
3031 using namespace llvm;
3132
3233 // GetLibSupportInfoOutputFile - Return a file stream to print our output on.
1111 //===----------------------------------------------------------------------===//
1212
1313 #include "llvm/ADT/StringExtras.h"
14 #include
1415 using namespace llvm;
1516
1617 /// getToken - This function extracts one token from source, ignoring any
3030 #include "llvm/Support/CommandLine.h"
3131 #include "llvm/Support/MathExtras.h"
3232 #include
33 #include
3334 using namespace llvm;
3435
3536 STATISTIC(EmittedInsts, "Number of machine instrs printed");
1717 #include "llvm/CodeGen/MachineCodeEmitter.h"
1818 #include "llvm/Config/alloca.h"
1919 #include
20 #include
2021 using namespace llvm;
2122
2223 #ifdef _MSC_VER
2929 #include "llvm/Support/Debug.h"
3030 #include "llvm/Target/TargetData.h"
3131 #include "llvm/Transforms/IPO.h"
32 #include
3233 using namespace llvm;
3334
3435 /// This statistic keeps track of the total number of library calls that have
3535 #include "llvm/ADT/STLExtras.h"
3636 #include "llvm/ADT/SmallPtrSet.h"
3737 #include "llvm/IntrinsicInst.h"
38 #include
39 #include
3840 #include
39 #include
4041 using namespace llvm;
4142
4243 STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled");
1717 #include "llvm/Instructions.h"
1818 #include "llvm/ParameterAttributes.h"
1919 #include "llvm/Intrinsics.h"
20 #include
2021 using namespace llvm;
2122
2223
659659 case Instruction::Xor:
660660 return ConstantInt::get(C1V ^ C2V);
661661 case Instruction::Shl:
662 if (uint32_t shiftAmt = C2V.getZExtValue())
662 if (uint32_t shiftAmt = C2V.getZExtValue()) {
663663 if (shiftAmt < C1V.getBitWidth())
664664 return ConstantInt::get(C1V.shl(shiftAmt));
665665 else
666666 return UndefValue::get(C1->getType()); // too big shift is undef
667 }
667668 return const_cast(CI1); // Zero shift is identity
668669 case Instruction::LShr:
669 if (uint32_t shiftAmt = C2V.getZExtValue())
670 if (uint32_t shiftAmt = C2V.getZExtValue()) {
670671 if (shiftAmt < C1V.getBitWidth())
671672 return ConstantInt::get(C1V.lshr(shiftAmt));
672673 else
673674 return UndefValue::get(C1->getType()); // too big shift is undef
675 }
674676 return const_cast(CI1); // Zero shift is identity
675677 case Instruction::AShr:
676 if (uint32_t shiftAmt = C2V.getZExtValue())
678 if (uint32_t shiftAmt = C2V.getZExtValue()) {
677679 if (shiftAmt < C1V.getBitWidth())
678680 return ConstantInt::get(C1V.ashr(shiftAmt));
679681 else
680682 return UndefValue::get(C1->getType()); // too big shift is undef
683 }
681684 return const_cast(CI1); // Zero shift is identity
682685 }
683686 }
10821085 // Ok, we ran out of things they have in common. If any leftovers
10831086 // are non-zero then we have a difference, otherwise we are equal.
10841087 for (; i < CE1->getNumOperands(); ++i)
1085 if (!CE1->getOperand(i)->isNullValue())
1088 if (!CE1->getOperand(i)->isNullValue()) {
10861089 if (isa(CE1->getOperand(i)))
10871090 return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
10881091 else
10891092 return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal.
1093 }
10901094
10911095 for (; i < CE2->getNumOperands(); ++i)
1092 if (!CE2->getOperand(i)->isNullValue())
1096 if (!CE2->getOperand(i)->isNullValue()) {
10931097 if (isa(CE2->getOperand(i)))
10941098 return isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
10951099 else
10961100 return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal.
1101 }
10971102 return ICmpInst::ICMP_EQ;
10981103 }
10991104 }
11221127 if (C1->isNullValue()) {
11231128 if (const GlobalValue *GV = dyn_cast(C2))
11241129 // Don't try to evaluate aliases. External weak GV can be null.
1125 if (!isa(GV) && !GV->hasExternalWeakLinkage())
1130 if (!isa(GV) && !GV->hasExternalWeakLinkage()) {
11261131 if (pred == ICmpInst::ICMP_EQ)
11271132 return ConstantInt::getFalse();
11281133 else if (pred == ICmpInst::ICMP_NE)
11291134 return ConstantInt::getTrue();
1135 }
11301136 // icmp eq/ne(GV,null) -> false/true
11311137 } else if (C2->isNullValue()) {
11321138 if (const GlobalValue *GV = dyn_cast(C1))
11331139 // Don't try to evaluate aliases. External weak GV can be null.
1134 if (!isa(GV) && !GV->hasExternalWeakLinkage())
1140 if (!isa(GV) && !GV->hasExternalWeakLinkage()) {
11351141 if (pred == ICmpInst::ICMP_EQ)
11361142 return ConstantInt::getFalse();
11371143 else if (pred == ICmpInst::ICMP_NE)
11381144 return ConstantInt::getTrue();
1145 }
11391146 }
11401147
11411148 if (isa(C1) && isa(C2)) {
2121 #include "llvm/Support/MemoryBuffer.h"
2222 #include
2323 #include
24 #include
2425
2526 using namespace llvm;
2627
185185 ///
186186 Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
187187 // If the PHI node only has one incoming value, eliminate the PHI node...
188 if (getNumIncomingValues() == 1)
188 if (getNumIncomingValues() == 1) {
189189 if (getIncomingValue(0) != this) // not X = phi X
190190 return getIncomingValue(0);
191191 else
192192 return UndefValue::get(getType()); // Self cycle is dead.
193 }
193194
194195 // Otherwise if all of the incoming values are the same for the PHI, replace
195196 // the PHI node with the incoming value.
197198 Value *InVal = 0;
198199 bool HasUndefInput = false;
199200 for (unsigned i = 0, e = getNumIncomingValues(); i != e; ++i)
200 if (isa(getIncomingValue(i)))
201 if (isa(getIncomingValue(i))) {
201202 HasUndefInput = true;
202 else if (getIncomingValue(i) != this) // Not the PHI node itself...
203 } else if (getIncomingValue(i) != this) { // Not the PHI node itself...
203204 if (InVal && getIncomingValue(i) != InVal)
204205 return 0; // Not the same, bail out.
205206 else
206207 InVal = getIncomingValue(i);
208 }
207209
208210 // The only case that could cause InVal to be null is if we have a PHI node
209211 // that only has entries for itself. In this case, there is no entry into the
450452 cast(cast(Fn->getType())->getElementType());
451453 FTy = FTy; // silence warning.
452454
453 assert((NumArgs == FTy->getNumParams()) ||
454 (FTy->isVarArg() && NumArgs > FTy->getNumParams()) &&
455 assert(((NumArgs == FTy->getNumParams()) ||
456 (FTy->isVarArg() && NumArgs > FTy->getNumParams())) &&
455457 "Calling a function with bad signature");
456458
457459 for (unsigned i = 0, e = NumArgs; i != e; i++) {
10361038 if (!isa(Ptr)) return 0; // Type isn't a pointer type!
10371039
10381040 // Handle the special case of the empty set index set...
1039 if (NumIdx == 0)
1041 if (NumIdx == 0) {
10401042 if (AllowCompositeLeaf ||
10411043 cast(Ptr)->getElementType()->isFirstClassType())
10421044 return cast(Ptr)->getElementType();
10431045 else
10441046 return 0;
1047 }
10451048
10461049 unsigned CurIdx = 0;
10471050 while (const CompositeType *CT = dyn_cast(Ptr)) {
23282331 assert(Op0Ty == Op1Ty &&
23292332 "Both operands to ICmp instruction are not of the same type!");
23302333 // Check that the operands are the right type
2331 assert(Op0Ty->isInteger() || isa(Op0Ty) &&
2334 assert((Op0Ty->isInteger() || isa(Op0Ty)) &&
23322335 "Invalid operand types for ICmp instruction");
23332336 return;
23342337 }
306306 void User::replaceUsesOfWith(Value *From, Value *To) {
307307 if (From == To) return; // Duh what?
308308
309 assert(!isa(this) || isa(this) &&
309 assert((!isa(this) || isa(this)) &&
310310 "Cannot call User::replaceUsesofWith on a constant!");
311311
312312 for (unsigned i = 0, E = getNumOperands(); i != E; ++i)
3737 #include "llvm/System/Signals.h"
3838 #include
3939 #include
40 #include
4041 using namespace llvm;
4142
4243 // Input/Output Options
2121 #include "llvm/ADT/StringExtras.h"
2222 #include
2323 #include
24
24 #include
2525
2626 // Global variables exported from the lexer.
2727 extern int yydebug;
2020 #include "llvm/Support/ManagedStatic.h"
2121 #include "llvm/System/Signals.h"
2222 #include
23 #include
2324 using namespace llvm;
2425
2526 //===----------------------------------------------------------------------===//
1616 #include
1717 #include
1818 #include
19
19 #include
2020 struct Operator;
2121
2222 // Masks are 4-nibble hex numbers. Values 0-7 in any nibble means that it takes
241241
242242 unsigned MismatchOperand = ~0U;
243243 for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
244 if (Operands[i] != Other.Operands[i])
244 if (Operands[i] != Other.Operands[i]) {
245245 if (MismatchOperand != ~0U) // Already have one mismatch?
246246 return ~1U;
247247 else
248248 MismatchOperand = i;
249 }
249250 }
250251 return MismatchOperand;
251252 }
13411341 while (TPN->ApplyTypeConstraints(P, false))
13421342 /* Resolve all types */;
13431343
1344 if (TPN->ContainsUnresolvedType())
1344 if (TPN->ContainsUnresolvedType()) {
13451345 if (iter == 0)
13461346 throw "Value #" + utostr(i) + " of PredicateOperand '" +
13471347 DefaultOps[iter][i]->getName() + "' doesn't have a concrete type!";
13481348 else
13491349 throw "Value #" + utostr(i) + " of OptionalDefOperand '" +
13501350 DefaultOps[iter][i]->getName() + "' doesn't have a concrete type!";
1351
1351 }
13521352 DefaultOpInfo.DefaultOps.push_back(TPN);
13531353 }
13541354
1414 #ifndef CODEGEN_REGISTERS_H
1515 #define CODEGEN_REGISTERS_H
1616
17 #include "llvm/CodeGen/ValueTypes.h"
1718 #include
1819 #include
19 #include "llvm/CodeGen/ValueTypes.h"
20 #include
2021
2122 namespace llvm {
2223 class Record;
11221122 Code += "), 0";
11231123 emitCode(Code2 + Code + ");");
11241124
1125 if (NodeHasChain)
1125 if (NodeHasChain) {
11261126 // Remember which op produces the chain.
11271127 if (!isRoot)
11281128 emitCode(ChainName + " = SDOperand(" + NodeName +
11301130 else
11311131 emitCode(ChainName + " = SDOperand(" + NodeName +
11321132 ", " + utostr(NumResults+NumDstRegs) + ");");
1133 }
11331134
11341135 if (!isRoot) {
11351136 NodeOps.push_back("Tmp" + utostr(ResNo));
1616 #include
1717 #include "llvm/Config/config.h"
1818 #include
19 #include
20 #include
1921 using namespace llvm;
2022
2123 TGLexer::TGLexer(MemoryBuffer *StartBuf) : CurLineNo(1), CurBuf(StartBuf) {