Merge branch 'master' into merge-2.061-2

This commit is contained in:
David Nadlinger
2013-01-12 01:27:02 +01:00
30 changed files with 134 additions and 43 deletions

View File

@@ -47,9 +47,15 @@
#endif #endif
#if IN_LLVM #if IN_LLVM
#if LDC_LLVM_VER >= 303
#include "llvm/IR/Type.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/DerivedTypes.h"
#else
#include "llvm/Type.h" #include "llvm/Type.h"
#include "llvm/LLVMContext.h" #include "llvm/LLVMContext.h"
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
#endif
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include <map> #include <map>

View File

@@ -11,7 +11,9 @@
#include "gen/cl_helpers.h" #include "gen/cl_helpers.h"
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#if LDC_LLVM_VER >= 302 #if LDC_LLVM_VER >= 303
#include "llvm/IR/DataLayout.h"
#elif LDC_LLVM_VER == 302
#include "llvm/DataLayout.h" #include "llvm/DataLayout.h"
#else #else
#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetData.h"

View File

@@ -9,9 +9,14 @@
#include "gen/llvmcompat.h" #include "gen/llvmcompat.h"
#include "gen/llvm.h" #include "gen/llvm.h"
#include "llvm/LinkAllVMCore.h"
#include "llvm/Linker.h" #include "llvm/Linker.h"
#if LDC_LLVM_VER >= 303
#include "llvm/LinkAllIR.h"
#include "llvm/IR/LLVMContext.h"
#else
#include "llvm/LinkAllVMCore.h"
#include "llvm/LLVMContext.h" #include "llvm/LLVMContext.h"
#endif
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetOptions.h"
#include "llvm/Support/TargetSelect.h" #include "llvm/Support/TargetSelect.h"

View File

@@ -8,7 +8,11 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "gen/llvm.h" #include "gen/llvm.h"
#if LDC_LLVM_VER >= 303
#include "llvm/IR/InlineAsm.h"
#else
#include "llvm/InlineAsm.h" #include "llvm/InlineAsm.h"
#endif
//#include "d-gcc-includes.h" //#include "d-gcc-includes.h"
//#include "total.h" //#include "total.h"

View File

@@ -9,7 +9,11 @@
#include "gen/llvm.h" #include "gen/llvm.h"
#include "llvm/Support/CFG.h" #include "llvm/Support/CFG.h"
#if LDC_LLVM_VER >= 303
#include "llvm/IR/Intrinsics.h"
#else
#include "llvm/Intrinsics.h" #include "llvm/Intrinsics.h"
#endif
#include "mtype.h" #include "mtype.h"
#include "aggregate.h" #include "aggregate.h"
@@ -345,7 +349,11 @@ LLFunction* DtoInlineIRFunction(FuncDeclaration* fdecl)
if(errstr != "") if(errstr != "")
error(tinst->loc, error(tinst->loc,
"can't parse inline LLVM IR:\n%s\n%s\n%s\nThe input string was: \n%s", "can't parse inline LLVM IR:\n%s\n%s\n%s\nThe input string was: \n%s",
#if LDC_LLVM_VER >= 303
err.getLineContents().str().c_str(),
#else
err.getLineContents().c_str(), err.getLineContents().c_str(),
#endif
(std::string(err.getColumnNo(), ' ') + '^').c_str(), (std::string(err.getColumnNo(), ' ') + '^').c_str(),
errstr.c_str(), stream.str().c_str()); errstr.c_str(), stream.str().c_str());

View File

@@ -29,6 +29,9 @@
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
#include "llvm/IR/Value.h" #include "llvm/IR/Value.h"
#include "llvm/IR/Attributes.h" #include "llvm/IR/Attributes.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/DebugInfo.h"
#else #else
#include "llvm/Type.h" #include "llvm/Type.h"
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
@@ -40,17 +43,17 @@
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/Value.h" #include "llvm/Value.h"
#include "llvm/Attributes.h" #include "llvm/Attributes.h"
#endif #if LDC_LLVM_VER == 302
#if LDC_LLVM_VER >= 302
#include "llvm/DataLayout.h" #include "llvm/DataLayout.h"
#include "llvm/DebugInfo.h"
#include "llvm/IRBuilder.h" #include "llvm/IRBuilder.h"
#include "llvm/DebugInfo.h"
#else #else
#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetData.h"
#include "llvm/Analysis/DebugInfo.h" #include "llvm/Analysis/DebugInfo.h"
#include "llvm/Support/IRBuilder.h" #include "llvm/Support/IRBuilder.h"
#endif #endif
#endif
#include "gen/llvmcompat.h" #include "gen/llvmcompat.h"

View File

@@ -10,14 +10,21 @@
#include "gen/llvmcompat.h" #include "gen/llvmcompat.h"
#include "llvm/Config/llvm-config.h" #include "llvm/Config/llvm-config.h"
#include "llvm/ADT/Triple.h" #include "llvm/ADT/Triple.h"
#if LDC_LLVM_VER >= 303
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/IRBuilder.h"
#else
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
#include "llvm/Function.h" #include "llvm/Function.h"
#include "llvm/Module.h" #include "llvm/Module.h"
#if LDC_LLVM_VER >= 302 #if LDC_LLVM_VER == 302
#include "llvm/IRBuilder.h" #include "llvm/IRBuilder.h"
#else #else
#include "llvm/Support/IRBuilder.h" #include "llvm/Support/IRBuilder.h"
#endif #endif
#endif
#include <string> #include <string>
#if LDC_LLVM_VER == 300 #if LDC_LLVM_VER == 300

View File

@@ -1645,7 +1645,7 @@ bool mustDefineSymbol(Dsymbol* s)
{ {
// we can't (and probably shouldn't?) define functions // we can't (and probably shouldn't?) define functions
// that weren't semantic3'ed // that weren't semantic3'ed
if (fd->semanticRun < 4) if (fd->semanticRun < PASSsemantic3)
return false; return false;
if (fd->isArrayOp == 1) if (fd->isArrayOp == 1)
@@ -1669,7 +1669,7 @@ bool mustDefineSymbol(Dsymbol* s)
if ( !fd->isStaticCtorDeclaration() if ( !fd->isStaticCtorDeclaration()
&& !fd->isStaticDtorDeclaration() && !fd->isStaticDtorDeclaration()
&& !fd->isUnitTestDeclaration() && !fd->isUnitTestDeclaration()
&& fd->canInline(true)) && fd->canInline(true, false, false))
{ {
return true; return true;
} }

View File

@@ -19,7 +19,11 @@
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#if LDC_LLVM_VER >= 303
#include "llvm/IR/GlobalValue.h"
#else
#include "llvm/GlobalValue.h" #include "llvm/GlobalValue.h"
#endif
#include "llvm/Support/Casting.h" #include "llvm/Support/Casting.h"
#include "llvm/Support/raw_os_ostream.h" #include "llvm/Support/raw_os_ostream.h"
#include "llvm/Assembly/Writer.h" #include "llvm/Assembly/Writer.h"

View File

@@ -17,7 +17,11 @@
#define LDC_GEN_METADATA_H #define LDC_GEN_METADATA_H
// MDNode was moved into its own header, and contains Value*s // MDNode was moved into its own header, and contains Value*s
#if LDC_LLVM_VER >= 303
#include "llvm/IR/Metadata.h"
#else
#include "llvm/Metadata.h" #include "llvm/Metadata.h"
#endif
typedef llvm::Value MDNodeField; typedef llvm::Value MDNodeField;
#define METADATA_LINKAGE_TYPE llvm::GlobalValue::WeakODRLinkage #define METADATA_LINKAGE_TYPE llvm::GlobalValue::WeakODRLinkage

View File

@@ -9,13 +9,18 @@
#include "gen/llvm.h" #include "gen/llvm.h"
#include "llvm/Analysis/Verifier.h" #include "llvm/Analysis/Verifier.h"
#include "llvm/Module.h"
#include "llvm/LinkAllPasses.h" #include "llvm/LinkAllPasses.h"
#if LDC_LLVM_VER >= 302 #if LDC_LLVM_VER >= 303
#include "llvm/IR/Module.h"
#include "llvm/IR/DataLayout.h"
#else
#include "llvm/Module.h"
#if LDC_LLVM_VER == 302
#include "llvm/DataLayout.h" #include "llvm/DataLayout.h"
#else #else
#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetData.h"
#endif #endif
#endif
#include "mars.h" #include "mars.h"
#include "module.h" #include "module.h"

View File

@@ -8,7 +8,11 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "gen/llvm.h" #include "gen/llvm.h"
#if LDC_LLVM_VER >= 303
#include "llvm/IR/InlineAsm.h"
#else
#include "llvm/InlineAsm.h" #include "llvm/InlineAsm.h"
#endif
#include "expression.h" #include "expression.h"
#include "statement.h" #include "statement.h"

View File

@@ -17,16 +17,17 @@
#include "llvm/LinkAllPasses.h" #include "llvm/LinkAllPasses.h"
#if LDC_LLVM_VER >= 303 #if LDC_LLVM_VER >= 303
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
#include "llvm/IR/DataLayout.h"
#else #else
#include "llvm/Module.h" #include "llvm/Module.h"
#endif #if LDC_LLVM_VER == 302
#include "llvm/ADT/Triple.h"
#include "llvm/Analysis/Verifier.h"
#if LDC_LLVM_VER >= 302
#include "llvm/DataLayout.h" #include "llvm/DataLayout.h"
#else #else
#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetData.h"
#endif #endif
#endif
#include "llvm/ADT/Triple.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Target/TargetLibraryInfo.h" #include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"

View File

@@ -27,14 +27,17 @@
#include "llvm/IR/Constants.h" #include "llvm/IR/Constants.h"
#include "llvm/IR/Intrinsics.h" #include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IRBuilder.h" #include "llvm/IR/IRBuilder.h"
#include "llvm/IR/DataLayout.h"
#else #else
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/Intrinsics.h" #include "llvm/Intrinsics.h"
#if LDC_LLVM_VER == 302 #if LDC_LLVM_VER == 302
#include "llvm/IRBuilder.h" #include "llvm/IRBuilder.h"
#include "llvm/DataLayout.h"
#else #else
#include "llvm/Support/IRBuilder.h" #include "llvm/Support/IRBuilder.h"
#include "llvm/Target/TargetData.h"
#endif #endif
#endif #endif
#include "llvm/Support/CallSite.h" #include "llvm/Support/CallSite.h"
@@ -42,11 +45,6 @@
#include "llvm/Analysis/CallGraph.h" #include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/ValueTracking.h" #include "llvm/Analysis/ValueTracking.h"
#if LDC_LLVM_VER >= 302
#include "llvm/DataLayout.h"
#else
#include "llvm/Target/TargetData.h"
#endif
#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringMap.h"

View File

@@ -23,22 +23,20 @@
#include "llvm/IR/Function.h" #include "llvm/IR/Function.h"
#include "llvm/IR/Intrinsics.h" #include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IRBuilder.h" #include "llvm/IR/IRBuilder.h"
#include "llvm/IR/DataLayout.h"
#else #else
#include "llvm/Function.h" #include "llvm/Function.h"
#include "llvm/Intrinsics.h" #include "llvm/Intrinsics.h"
#if LDC_LLVM_VER == 302 #if LDC_LLVM_VER == 302
#include "llvm/IRBuilder.h" #include "llvm/IRBuilder.h"
#include "llvm/DataLayout.h"
#else #else
#include "llvm/Support/IRBuilder.h" #include "llvm/Support/IRBuilder.h"
#include "llvm/Target/TargetData.h"
#endif #endif
#endif #endif
#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/ValueTracking.h" #include "llvm/Analysis/ValueTracking.h"
#if LDC_LLVM_VER >= 302
#include "llvm/DataLayout.h"
#else
#include "llvm/Target/TargetData.h"
#endif
#include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringMap.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"

View File

@@ -19,7 +19,11 @@
#include "Passes.h" #include "Passes.h"
#if LDC_LLVM_VER >= 303
#include "llvm/IR/Module.h"
#else
#include "llvm/Module.h" #include "llvm/Module.h"
#endif
#include "llvm/Pass.h" #include "llvm/Pass.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Support/Compiler.h" #include "llvm/Support/Compiler.h"

View File

@@ -15,7 +15,11 @@
#ifndef __LDC_GEN_RTTIBUILDER_H__ #ifndef __LDC_GEN_RTTIBUILDER_H__
#define __LDC_GEN_RTTIBUILDER_H__ #define __LDC_GEN_RTTIBUILDER_H__
#if LDC_LLVM_VER >= 303
#include "llvm/IR/Constant.h"
#else
#include "llvm/Constant.h" #include "llvm/Constant.h"
#endif
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
struct ClassDeclaration; struct ClassDeclaration;

View File

@@ -8,8 +8,13 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "gen/llvm.h" #include "gen/llvm.h"
#if LDC_LLVM_VER >= 303
#include "llvm/IR/Module.h"
#include "llvm/IR/Attributes.h"
#else
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/Attributes.h" #include "llvm/Attributes.h"
#endif
#include "llvm/Bitcode/ReaderWriter.h" #include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"

View File

@@ -13,7 +13,11 @@
#include <fstream> #include <fstream>
#include "gen/llvm.h" #include "gen/llvm.h"
#if LDC_LLVM_VER >= 303
#include "llvm/IR/InlineAsm.h"
#else
#include "llvm/InlineAsm.h" #include "llvm/InlineAsm.h"
#endif
#include "llvm/Support/CFG.h" #include "llvm/Support/CFG.h"
#include "mars.h" #include "mars.h"

View File

@@ -688,24 +688,13 @@ LLConstant* DtoConstFP(Type* t, longdouble value)
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
#if LDC_LLVM_VER >= 301
static inline LLConstant* toConstString(llvm::LLVMContext& ctx, const llvm::StringRef& str)
{
LLSmallVector<uint8_t, 64> vals;
vals.append(str.begin(), str.end());
vals.push_back(0);
return llvm::ConstantDataArray::get(ctx, vals);
}
#endif
LLConstant* DtoConstString(const char* str) LLConstant* DtoConstString(const char* str)
{ {
llvm::StringRef s(str ? str : "");
#if LDC_LLVM_VER == 300 #if LDC_LLVM_VER == 300
llvm::StringRef s(str?str:"");
LLConstant* init = LLConstantArray::get(gIR->context(), s, true); LLConstant* init = LLConstantArray::get(gIR->context(), s, true);
#else #else
llvm::StringRef s(str ? str : ""); LLConstant* init = llvm::ConstantDataArray::getString(gIR->context(), s, true);
LLConstant* init = toConstString(gIR->context(), s);
#endif #endif
llvm::GlobalVariable* gvar = new llvm::GlobalVariable( llvm::GlobalVariable* gvar = new llvm::GlobalVariable(
*gIR->module, init->getType(), true, llvm::GlobalValue::InternalLinkage, init, ".str"); *gIR->module, init->getType(), true, llvm::GlobalValue::InternalLinkage, init, ".str");
@@ -716,14 +705,14 @@ LLConstant* DtoConstString(const char* str)
Type::tchar->arrayOf() Type::tchar->arrayOf()
); );
} }
LLConstant* DtoConstStringPtr(const char* str, const char* section) LLConstant* DtoConstStringPtr(const char* str, const char* section)
{ {
llvm::StringRef s(str);
#if LDC_LLVM_VER == 300 #if LDC_LLVM_VER == 300
llvm::StringRef s(str);
LLConstant* init = LLConstantArray::get(gIR->context(), s, true); LLConstant* init = LLConstantArray::get(gIR->context(), s, true);
#else #else
llvm::StringRef s(str); LLConstant* init = llvm::ConstantDataArray::getString(gIR->context(), s, true);
LLConstant* init = toConstString(gIR->context(), s);
#endif #endif
llvm::GlobalVariable* gvar = new llvm::GlobalVariable( llvm::GlobalVariable* gvar = new llvm::GlobalVariable(
*gIR->module, init->getType(), true, llvm::GlobalValue::InternalLinkage, init, ".str"); *gIR->module, init->getType(), true, llvm::GlobalValue::InternalLinkage, init, ".str");

View File

@@ -7,7 +7,9 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#if LDC_LLVM_VER >= 302 #if LDC_LLVM_VER >= 303
#include "llvm/IR/DataLayout.h"
#elif LDC_LLVM_VER == 302
#include "llvm/DataLayout.h" #include "llvm/DataLayout.h"
#else #else
#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetData.h"

View File

@@ -7,8 +7,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#if LDC_LLVM_VER >= 303
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#else
#include "llvm/Constants.h" #include "llvm/Constants.h"
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
#endif
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
#include "aggregate.h" #include "aggregate.h"

View File

@@ -7,8 +7,13 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#if LDC_LLVM_VER >= 303
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/LLVMContext.h"
#else
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
#include "llvm/LLVMContext.h" #include "llvm/LLVMContext.h"
#endif
#include "mars.h" #include "mars.h"
#include "mtype.h" #include "mtype.h"
#include "gen/irstate.h" #include "gen/irstate.h"

View File

@@ -16,7 +16,11 @@
#ifndef __LDC_IR_IRTYPE_H__ #ifndef __LDC_IR_IRTYPE_H__
#define __LDC_IR_IRTYPE_H__ #define __LDC_IR_IRTYPE_H__
#if LDC_LLVM_VER >= 303
#include "llvm/IR/Type.h"
#else
#include "llvm/Type.h" #include "llvm/Type.h"
#endif
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@@ -7,7 +7,11 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#if LDC_LLVM_VER >= 303
#include "llvm/IR/DerivedTypes.h"
#else
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
#endif
#include "aggregate.h" #include "aggregate.h"
#include "declaration.h" #include "declaration.h"

View File

@@ -15,7 +15,11 @@
#define __LDC_IR_IRTYPECLASS_H__ #define __LDC_IR_IRTYPECLASS_H__
#include "ir/irtypestruct.h" #include "ir/irtypestruct.h"
#if LDC_LLVM_VER >= 303
#include <llvm/IR/DerivedTypes.h>
#else
#include <llvm/DerivedTypes.h> #include <llvm/DerivedTypes.h>
#endif
/// ///
class IrTypeClass : public IrTypeAggr class IrTypeClass : public IrTypeAggr

View File

@@ -7,7 +7,11 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#if LDC_LLVM_VER >= 303
#include "llvm/IR/DerivedTypes.h"
#else
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
#endif
#include "mtype.h" #include "mtype.h"
#include "gen/irstate.h" #include "gen/irstate.h"

View File

@@ -7,7 +7,11 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#if LDC_LLVM_VER >= 303
#include "llvm/IR/DerivedTypes.h"
#else
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
#endif
#include "aggregate.h" #include "aggregate.h"
#include "declaration.h" #include "declaration.h"

View File

@@ -16,7 +16,11 @@
#define LDC_IR_IRVAR_H #define LDC_IR_IRVAR_H
#include "ir/ir.h" #include "ir/ir.h"
#if LDC_LLVM_VER >= 303
#include "llvm/IR/Type.h"
#else
#include "llvm/Type.h" #include "llvm/Type.h"
#endif
struct IrFuncTyArg; struct IrFuncTyArg;