From ca5183d445954a9b2a570d6bbba1bc2b00ad6442 Mon Sep 17 00:00:00 2001 From: Jeff Cohen Date: Mon, 5 Mar 2007 00:00:42 +0000 Subject: [PATCH] Unbreak VC++ build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34917 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/SmallVector.h | 19 ++++++++ include/llvm/Analysis/ScalarEvolution.h | 1 + include/llvm/Support/MathExtras.h | 2 +- lib/Analysis/ConstantFolding.cpp | 4 +- lib/Analysis/IPA/Andersens.cpp | 1 + lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 2 +- lib/Support/APInt.cpp | 10 ++++- lib/Target/TargetData.cpp | 2 +- lib/Transforms/IPO/RaiseAllocations.cpp | 1 + .../Scalar/InstructionCombining.cpp | 1 + lib/Transforms/Scalar/PredicateSimplifier.cpp | 2 +- lib/VMCore/Pass.cpp | 1 + lib/VMCore/PassManager.cpp | 1 + lib/VMCore/Value.cpp | 2 +- tools/llvm-nm/llvm-nm.cpp | 1 + tools/llvm-prof/llvm-prof.cpp | 1 + win32/Analysis/Analysis.vcproj | 9 ++-- win32/Bytecode/Bytecode.vcproj | 3 -- win32/CodeGen/CodeGen.vcproj | 34 +++++++++++--- win32/Support/Support.vcproj | 30 +++++++++++-- win32/System/System.vcproj | 6 +++ win32/TableGen/TableGen.vcproj | 6 +++ win32/Target/Target.vcproj | 9 ++++ win32/Transforms/Transforms.vcproj | 24 ++-------- win32/VMCore/VMCore.vcproj | 16 +++---- win32/x86/x86.vcproj | 45 ++++++++++++++++--- 26 files changed, 173 insertions(+), 60 deletions(-) diff --git a/include/llvm/ADT/SmallVector.h b/include/llvm/ADT/SmallVector.h index b5ee6c454b3..9f2842a6389 100644 --- a/include/llvm/ADT/SmallVector.h +++ b/include/llvm/ADT/SmallVector.h @@ -18,6 +18,25 @@ #include #include +#ifdef _MSC_VER +namespace std { + // Fix bug in VC++ implementation of std::uninitialized_copy. Define + // additional overloads so that the copy is recognized as a scalar and + // not an object copy. + template + inline _Scalar_ptr_iterator_tag _Ptr_cat(T1 **, T2 **) { + _Scalar_ptr_iterator_tag _Cat; + return _Cat; + } + + template + inline _Scalar_ptr_iterator_tag _Ptr_cat(T1* const *, T2 **) { + _Scalar_ptr_iterator_tag _Cat; + return _Cat; + } +} +#endif + namespace llvm { /// SmallVectorImpl - This class consists of common code factored out of the diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index b950ca48c64..27d7e04a3e2 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -22,6 +22,7 @@ #define LLVM_ANALYSIS_SCALAREVOLUTION_H #include "llvm/Pass.h" +#include "llvm/Support/DataTypes.h" #include "llvm/Support/Streams.h" #include diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h index f0bc91f8d0a..41833438078 100644 --- a/include/llvm/Support/MathExtras.h +++ b/include/llvm/Support/MathExtras.h @@ -255,7 +255,7 @@ inline unsigned CountPopulation_64(uint64_t Value) { uint64_t v = Value - ((Value >> 1) & 0x5555555555555555ULL); v = (v & 0x3333333333333333ULL) + ((v >> 2) & 0x3333333333333333ULL); v = (v + (v >> 4)) & 0x0F0F0F0F0F0F0F0FULL; - return (uint64_t)(v * 0x0101010101010101ULL) >> 56; + return unsigned((uint64_t)(v * 0x0101010101010101ULL) >> 56); #endif } diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 01aedda6353..1288674139c 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -72,8 +72,8 @@ static bool IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV, // N = N + Offset Offset += TD.getStructLayout(ST)->getElementOffset(CI->getZExtValue()); } else { - const SequentialType *ST = cast(*GTI); - Offset += TD.getTypeSize(ST->getElementType())*CI->getSExtValue(); + const SequentialType *SQT = cast(*GTI); + Offset += TD.getTypeSize(SQT->getElementType())*CI->getSExtValue(); } } return true; diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp index 52b19194e1b..0a281c89458 100644 --- a/lib/Analysis/IPA/Andersens.cpp +++ b/lib/Analysis/IPA/Andersens.cpp @@ -62,6 +62,7 @@ #include "llvm/Analysis/Passes.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" +#include #include using namespace llvm; diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index afaf7826f68..27890e95be9 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -3301,7 +3301,7 @@ TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy, // Flags[2] -> isSRet // Flags[1] -> isInReg // Flags[0] -> isSigned - unsigned Flags = (isSRet << 2) | (isInReg << 1) | isSigned | + unsigned Flags = (isSRet << 2) | (isInReg << 1) | unsigned(isSigned) | (OriginalAlignment << 27); switch (getTypeAction(VT)) { diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 683211b451b..08ec2362007 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -17,6 +17,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" +#include #include #include #ifndef NDEBUG @@ -1224,9 +1225,16 @@ APInt APInt::sqrt() const { // an IEEE double precision floating point value), then we can use the // libc sqrt function which will probably use a hardware sqrt computation. // This should be faster than the algorithm below. - if (magnitude < 52) + if (magnitude < 52) { +#ifdef _MSC_VER + // Amazingly, VC++ doesn't have round(). + return APInt(BitWidth, + uint64_t(::sqrt(double(isSingleWord()?VAL:pVal[0]))) + 0.5); +#else return APInt(BitWidth, uint64_t(::round(::sqrt(double(isSingleWord()?VAL:pVal[0]))))); +#endif + } // Okay, all the short cuts are exhausted. We must compute it. The following // is a classical Babylonian method for computing the square root. This code diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index dfa6d2a283a..b1f08079f0e 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -400,7 +400,7 @@ uint64_t TargetData::getTypeSize(const Type *Ty) const { unsigned char Alignment; Size = getTypeSize(ATy->getElementType()); Alignment = getABITypeAlignment(ATy->getElementType()); - unsigned AlignedSize = (Size + Alignment - 1)/Alignment*Alignment; + uint64_t AlignedSize = (Size + Alignment - 1)/Alignment*Alignment; return AlignedSize*ATy->getNumElements(); } case Type::StructTyID: { diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp index aeb41738419..ce6db5624a0 100644 --- a/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/lib/Transforms/IPO/RaiseAllocations.cpp @@ -22,6 +22,7 @@ #include "llvm/Support/CallSite.h" #include "llvm/Support/Compiler.h" #include "llvm/ADT/Statistic.h" +#include using namespace llvm; STATISTIC(NumRaised, "Number of allocations raised"); diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 2a08ced68c8..e8dbb73a88f 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -7663,6 +7663,7 @@ Instruction *InstCombiner::FoldPHIArgOpIntoPHI(PHINode &PN) { PhiVal, ConstantOp); else assert(0 && "Unknown operation"); + return 0; } /// DeadPHICycle - Return true if this PHI node is only used by a PHI node cycle diff --git a/lib/Transforms/Scalar/PredicateSimplifier.cpp b/lib/Transforms/Scalar/PredicateSimplifier.cpp index b425a8c3132..324cbc68dae 100644 --- a/lib/Transforms/Scalar/PredicateSimplifier.cpp +++ b/lib/Transforms/Scalar/PredicateSimplifier.cpp @@ -421,7 +421,7 @@ namespace { iSGT = iUGT; iSLT = iULT; } else { - assert(iULT->first->getValue().isPositive() >= 0 && + assert(iULT->first->getValue().isPositive() && iUGT->first->getValue().isNegative() &&"Bad sign comparison."); iSGT = iULT; iSLT = iUGT; diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp index 2e27015c3ac..b593d475ca0 100644 --- a/lib/VMCore/Pass.cpp +++ b/lib/VMCore/Pass.cpp @@ -19,6 +19,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/TypeInfo.h" +#include #include using namespace llvm; diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index a2bbb7d3ab9..470428f17b0 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -19,6 +19,7 @@ #include "llvm/ModuleProvider.h" #include "llvm/Support/Streams.h" #include "llvm/Support/ManagedStatic.h" +#include #include #include diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index 4c76b2b5532..8bc99a8590b 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -128,7 +128,7 @@ void Value::setName(const char *Name) { void Value::setName(const char *NameStr, unsigned NameLen) { if (NameLen == 0 && !hasName()) return; - if (getType() != Type::VoidTy && "Cannot assign a name to void values!"); + assert(getType() != Type::VoidTy && "Cannot assign a name to void values!"); // Get the symbol table to update for this object. ValueSymbolTable *ST; diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index 49f662d7453..bad001e4087 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -22,6 +22,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/System/Signals.h" +#include #include #include #include diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp index b0767e6fdf3..6b1d514bcd6 100644 --- a/tools/llvm-prof/llvm-prof.cpp +++ b/tools/llvm-prof/llvm-prof.cpp @@ -21,6 +21,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/System/Signals.h" +#include #include #include #include diff --git a/win32/Analysis/Analysis.vcproj b/win32/Analysis/Analysis.vcproj index d2241392e7e..56befeac403 100644 --- a/win32/Analysis/Analysis.vcproj +++ b/win32/Analysis/Analysis.vcproj @@ -132,9 +132,6 @@ - - @@ -150,6 +147,9 @@ + + @@ -240,6 +240,9 @@ + + diff --git a/win32/Bytecode/Bytecode.vcproj b/win32/Bytecode/Bytecode.vcproj index b962f1a9500..d0980b992f4 100644 --- a/win32/Bytecode/Bytecode.vcproj +++ b/win32/Bytecode/Bytecode.vcproj @@ -133,9 +133,6 @@ - - diff --git a/win32/CodeGen/CodeGen.vcproj b/win32/CodeGen/CodeGen.vcproj index 43ef031348b..3486f79d818 100644 --- a/win32/CodeGen/CodeGen.vcproj +++ b/win32/CodeGen/CodeGen.vcproj @@ -120,6 +120,9 @@ + + @@ -138,18 +141,24 @@ - - + + + + + + @@ -168,6 +177,9 @@ + + @@ -180,6 +192,9 @@ + + @@ -219,11 +234,14 @@ + + + RelativePath="..\..\include\llvm\CodeGen\FileWriters.h"> @@ -273,6 +291,9 @@ + + @@ -280,7 +301,7 @@ RelativePath="..\..\include\llvm\CodeGen\MachineRelocation.h"> + RelativePath="..\..\include\llvm\CodeGen\MachORelocation.h"> @@ -291,6 +312,9 @@ + + diff --git a/win32/Support/Support.vcproj b/win32/Support/Support.vcproj index 613bb0f3de4..56e98d2351e 100644 --- a/win32/Support/Support.vcproj +++ b/win32/Support/Support.vcproj @@ -115,6 +115,9 @@ + + @@ -128,7 +131,7 @@ + RelativePath="..\..\lib\Support\ConstantRange.cpp"> @@ -172,6 +175,9 @@ Name="VCCLCompilerTool"/> + + @@ -181,6 +187,9 @@ + + @@ -301,6 +310,9 @@ + + @@ -342,10 +354,10 @@ Name="ADT" Filter=""> + RelativePath="..\..\include\llvm\ADT\APInt.h"> + RelativePath="..\..\include\llvm\ADT\BitVector.h"> @@ -374,6 +386,9 @@ + + @@ -389,6 +404,12 @@ + + + + @@ -404,6 +425,9 @@ + + diff --git a/win32/System/System.vcproj b/win32/System/System.vcproj index 1286da3059a..e5cb3e8c982 100644 --- a/win32/System/System.vcproj +++ b/win32/System/System.vcproj @@ -112,6 +112,9 @@ + + @@ -150,6 +153,9 @@ + + diff --git a/win32/TableGen/TableGen.vcproj b/win32/TableGen/TableGen.vcproj index e0a02b7e2eb..407da445789 100644 --- a/win32/TableGen/TableGen.vcproj +++ b/win32/TableGen/TableGen.vcproj @@ -128,6 +128,9 @@ + + @@ -208,6 +211,9 @@ + + diff --git a/win32/Target/Target.vcproj b/win32/Target/Target.vcproj index 36d5ec92eb5..da5f87fbe8f 100644 --- a/win32/Target/Target.vcproj +++ b/win32/Target/Target.vcproj @@ -132,6 +132,9 @@ + + @@ -152,6 +155,9 @@ + + @@ -173,6 +179,9 @@ + + diff --git a/win32/Transforms/Transforms.vcproj b/win32/Transforms/Transforms.vcproj index e1856daac1c..f756c6222e1 100644 --- a/win32/Transforms/Transforms.vcproj +++ b/win32/Transforms/Transforms.vcproj @@ -108,18 +108,6 @@ Name="Source Files" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> - - - - - - - - @@ -129,9 +117,6 @@ - - @@ -144,9 +129,6 @@ - - - - @@ -208,6 +187,9 @@ + + diff --git a/win32/VMCore/VMCore.vcproj b/win32/VMCore/VMCore.vcproj index c9b4b5e7c9f..9ccf289032f 100644 --- a/win32/VMCore/VMCore.vcproj +++ b/win32/VMCore/VMCore.vcproj @@ -116,7 +116,7 @@ RelativePath="..\..\lib\VMCore\BasicBlock.cpp"> + RelativePath="..\..\lib\VMCore\ConstantFold.cpp"> @@ -149,7 +149,8 @@ @@ -159,7 +160,8 @@ @@ -183,9 +185,6 @@ - - @@ -228,7 +227,7 @@ RelativePath="..\..\include\llvm\Constant.h"> + RelativePath="..\..\lib\VMCore\ConstantFold.h"> @@ -299,9 +298,6 @@ - - diff --git a/win32/x86/x86.vcproj b/win32/x86/x86.vcproj index 088d785c947..b0024887dcf 100644 --- a/win32/x86/x86.vcproj +++ b/win32/x86/x86.vcproj @@ -116,36 +116,58 @@ + AdditionalDependencies="$(InputDir)X86InstrInfo.td;$(InputDir)X86RegisterInfo.td;$(InputDir)X86InstrFPStack.td;$(InputDir)X86InstrMMX.td;$(InputDir)X86InstrSSE.td;$(InputDir)X86CallingConv.td;$(InputDir)..\Target.td;$(InputDir)..\TargetSchedule.td;$(InputDir)..\TargetScheduleDAG.td;$(ProjectDir)..\$(IntDir)\TableGen.exe" + Outputs="X86GenRegisterNames.inc;X86GenRegisterInfo.h.inc;X86GenRegisterInfo.inc;X86GenInstrNames.inc;X86GenInstrInfo.inc;X86GenAsmWriter.inc;X86GenAsmWriter1.inc;X86GenDAGISel.inc;X86GenSubtarget.inc;X86GenCallingConv.inc"/> + AdditionalDependencies="$(InputDir)X86InstrInfo.td;$(InputDir)X86RegisterInfo.td;$(InputDir)X86InstrFPStack.td;$(InputDir)X86InstrMMX.td;$(InputDir)X86InstrSSE.td;$(InputDir)X86CallingConv.td;$(InputDir)..\Target.td;$(InputDir)..\TargetSchedule.td;$(InputDir)..\TargetScheduleDAG.td;$(ProjectDir)..\$(IntDir)\TableGen.exe" + Outputs="X86GenRegisterNames.inc;X86GenRegisterInfo.h.inc;X86GenRegisterInfo.inc;X86GenInstrNames.inc;X86GenInstrInfo.inc;X86GenAsmWriter.inc;X86GenAsmWriter1.inc;X86GenDAGISel.inc;X86GenSubtarget.inc;X86GenCallingConv.inc"/> + RelativePath="..\..\lib\Target\X86\X86COFF.h"> + + + + @@ -213,6 +241,9 @@ + + -- 2.34.1