mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 15:40:55 +03:00
Merge branch 'master' into merge-2.064
This commit is contained in:
commit
58aadf88ef
3 changed files with 19 additions and 30 deletions
|
@ -27,7 +27,7 @@
|
||||||
# We also want an user-specified LLVM_ROOT_DIR to take precedence over the
|
# We also want an user-specified LLVM_ROOT_DIR to take precedence over the
|
||||||
# system default locations such as /usr/local/bin. Executing find_program()
|
# system default locations such as /usr/local/bin. Executing find_program()
|
||||||
# multiples times is the approach recommended in the docs.
|
# multiples times is the approach recommended in the docs.
|
||||||
set(llvm_config_names llvm-config-3.4 llvm-config-3.3 llvm-config-3.2 llvm-config-3.1 llvm-config)
|
set(llvm_config_names llvm-config-3.5 llvm-config-3.4 llvm-config-3.3 llvm-config-3.2 llvm-config-3.1 llvm-config)
|
||||||
find_program(LLVM_CONFIG
|
find_program(LLVM_CONFIG
|
||||||
NAMES ${llvm_config_names}
|
NAMES ${llvm_config_names}
|
||||||
PATHS ${LLVM_ROOT_DIR}/bin NO_DEFAULT_PATH
|
PATHS ${LLVM_ROOT_DIR}/bin NO_DEFAULT_PATH
|
||||||
|
|
|
@ -36,8 +36,11 @@
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#if LDC_LLVM_VER < 302
|
#if LDC_LLVM_VER == 302
|
||||||
using namespace llvm::Attribute;
|
namespace llvm
|
||||||
|
{
|
||||||
|
typedef llvm::Attributes Attribute;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype, Type* nesttype, bool isMain, bool isCtor)
|
llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype, Type* nesttype, bool isMain, bool isCtor)
|
||||||
|
@ -78,7 +81,7 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype,
|
||||||
#if LDC_LLVM_VER >= 302
|
#if LDC_LLVM_VER >= 302
|
||||||
llvm::AttrBuilder attrBuilder;
|
llvm::AttrBuilder attrBuilder;
|
||||||
#else
|
#else
|
||||||
llvm::Attributes a = None;
|
llvm::Attributes a = llvm::Attribute::None;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// sret return
|
// sret return
|
||||||
|
@ -99,8 +102,8 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype,
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
newIrFty.arg_sret = new IrFuncTyArg(rt, true, StructRet | NoAlias
|
newIrFty.arg_sret = new IrFuncTyArg(rt, true,
|
||||||
);
|
llvm::Attribute::StructRet | llvm::Attribute::NoAlias);
|
||||||
#endif
|
#endif
|
||||||
rt = Type::tvoid;
|
rt = Type::tvoid;
|
||||||
lidx++;
|
lidx++;
|
||||||
|
@ -175,7 +178,8 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype,
|
||||||
llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoAlias)
|
llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoAlias)
|
||||||
.addAttribute(llvm::Attributes::NoCapture)));
|
.addAttribute(llvm::Attributes::NoCapture)));
|
||||||
#else
|
#else
|
||||||
newIrFty.arg_argptr = new IrFuncTyArg(Type::tvoid->pointerTo(), false, NoAlias | NoCapture);
|
newIrFty.arg_argptr = new IrFuncTyArg(Type::tvoid->pointerTo(), false,
|
||||||
|
llvm::Attribute::NoAlias | llvm::Attribute::NoCapture);
|
||||||
#endif
|
#endif
|
||||||
lidx++;
|
lidx++;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +214,7 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype,
|
||||||
#if LDC_LLVM_VER >= 302
|
#if LDC_LLVM_VER >= 302
|
||||||
llvm::AttrBuilder attrBuilder;
|
llvm::AttrBuilder attrBuilder;
|
||||||
#else
|
#else
|
||||||
llvm::Attributes a = None;
|
llvm::Attributes a = llvm::Attribute::None;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// handle lazy args
|
// handle lazy args
|
||||||
|
@ -224,10 +228,8 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype,
|
||||||
// byval
|
// byval
|
||||||
else if (abi->passByVal(byref ? argtype->pointerTo() : argtype))
|
else if (abi->passByVal(byref ? argtype->pointerTo() : argtype))
|
||||||
{
|
{
|
||||||
#if LDC_LLVM_VER >= 303
|
#if LDC_LLVM_VER >= 302
|
||||||
if (!byref) attrBuilder.addAttribute(llvm::Attribute::ByVal);
|
if (!byref) attrBuilder.addAttribute(llvm::Attribute::ByVal);
|
||||||
#elif LDC_LLVM_VER == 302
|
|
||||||
if (!byref) attrBuilder.addAttribute(llvm::Attributes::ByVal);
|
|
||||||
#else
|
#else
|
||||||
if (!byref) a |= llvm::Attribute::ByVal;
|
if (!byref) a |= llvm::Attribute::ByVal;
|
||||||
#endif
|
#endif
|
||||||
|
@ -368,13 +370,7 @@ LLFunction* DtoInlineIRFunction(FuncDeclaration* fdecl)
|
||||||
|
|
||||||
LLFunction* fun = gIR->module->getFunction(mangled_name);
|
LLFunction* fun = gIR->module->getFunction(mangled_name);
|
||||||
fun->setLinkage(llvm::GlobalValue::LinkOnceODRLinkage);
|
fun->setLinkage(llvm::GlobalValue::LinkOnceODRLinkage);
|
||||||
#if LDC_LLVM_VER >= 303
|
|
||||||
fun->addFnAttr(llvm::Attribute::AlwaysInline);
|
fun->addFnAttr(llvm::Attribute::AlwaysInline);
|
||||||
#elif LDC_LLVM_VER == 302
|
|
||||||
fun->addFnAttr(llvm::Attributes::AlwaysInline);
|
|
||||||
#else
|
|
||||||
fun->addFnAttr(AlwaysInline);
|
|
||||||
#endif
|
|
||||||
return fun;
|
return fun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,7 +630,7 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati
|
||||||
#if LDC_LLVM_VER == 302
|
#if LDC_LLVM_VER == 302
|
||||||
LLSmallVector<llvm::Attributes, 8> attrptr(n, llvm::Attributes());
|
LLSmallVector<llvm::Attributes, 8> attrptr(n, llvm::Attributes());
|
||||||
#else
|
#else
|
||||||
LLSmallVector<llvm::Attributes, 8> attrptr(n, None);
|
LLSmallVector<llvm::Attributes, 8> attrptr(n, llvm::Attribute::None);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (size_t k = 0; k < n; ++k)
|
for (size_t k = 0; k < n; ++k)
|
||||||
|
@ -787,13 +783,7 @@ void DtoDeclareFunction(FuncDeclaration* fdecl)
|
||||||
if (!fdecl->isIntrinsic()) {
|
if (!fdecl->isIntrinsic()) {
|
||||||
set_param_attrs(f, func, fdecl);
|
set_param_attrs(f, func, fdecl);
|
||||||
if (global.params.disableRedZone) {
|
if (global.params.disableRedZone) {
|
||||||
#if LDC_LLVM_VER >= 303
|
|
||||||
func->addFnAttr(llvm::Attribute::NoRedZone);
|
func->addFnAttr(llvm::Attribute::NoRedZone);
|
||||||
#elif LDC_LLVM_VER == 302
|
|
||||||
func->addFnAttr(llvm::Attributes::NoRedZone);
|
|
||||||
#else
|
|
||||||
func->addFnAttr(NoRedZone);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1023,13 +1013,7 @@ void DtoDefineFunction(FuncDeclaration* fd)
|
||||||
// TODO: Find a better place for this.
|
// TODO: Find a better place for this.
|
||||||
if (global.params.targetTriple.getArch() == llvm::Triple::x86_64)
|
if (global.params.targetTriple.getArch() == llvm::Triple::x86_64)
|
||||||
{
|
{
|
||||||
#if LDC_LLVM_VER >= 303
|
|
||||||
func->addFnAttr(llvm::Attribute::UWTable);
|
func->addFnAttr(llvm::Attribute::UWTable);
|
||||||
#elif LDC_LLVM_VER == 302
|
|
||||||
func->addFnAttr(llvm::Attributes::UWTable);
|
|
||||||
#else
|
|
||||||
func->addFnAttr(UWTable);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string entryname("entry");
|
std::string entryname("entry");
|
||||||
|
|
|
@ -73,6 +73,11 @@ struct ArrayIter
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// From dsymbol.h / declaration.h
|
||||||
|
struct Dsymbol;
|
||||||
|
struct FuncDeclaration;
|
||||||
|
struct VarDeclaration;
|
||||||
|
|
||||||
// some aliases
|
// some aliases
|
||||||
typedef ArrayIter<Dsymbol> DsymbolIter;
|
typedef ArrayIter<Dsymbol> DsymbolIter;
|
||||||
typedef ArrayIter<FuncDeclaration> FuncDeclarationIter;
|
typedef ArrayIter<FuncDeclaration> FuncDeclarationIter;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue