mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-04-29 14:40:40 +03:00
Merge remote-tracking branch 'origin/ltsmaster'
This commit is contained in:
commit
e55823fd09
11 changed files with 60 additions and 38 deletions
|
@ -164,10 +164,15 @@ static int linkObjToBinaryGcc(bool sharedLib, bool fullyStatic) {
|
||||||
switch (global.params.targetTriple->getOS()) {
|
switch (global.params.targetTriple->getOS()) {
|
||||||
case llvm::Triple::Linux:
|
case llvm::Triple::Linux:
|
||||||
addSoname = true;
|
addSoname = true;
|
||||||
args.push_back("-lrt");
|
|
||||||
if (!opts::disableLinkerStripDead) {
|
if (!opts::disableLinkerStripDead) {
|
||||||
args.push_back("-Wl,--gc-sections");
|
args.push_back("-Wl,--gc-sections");
|
||||||
}
|
}
|
||||||
|
if (global.params.targetTriple.getEnvironment() == llvm::Triple::Android) {
|
||||||
|
args.push_back("-ldl");
|
||||||
|
args.push_back("-lm");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
args.push_back("-lrt");
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case llvm::Triple::Darwin:
|
case llvm::Triple::Darwin:
|
||||||
case llvm::Triple::MacOSX:
|
case llvm::Triple::MacOSX:
|
||||||
|
|
|
@ -754,8 +754,6 @@ static void registerPredefinedTargetVersions() {
|
||||||
VersionCondition::addPredefinedGlobalIdent("Android");
|
VersionCondition::addPredefinedGlobalIdent("Android");
|
||||||
VersionCondition::addPredefinedGlobalIdent("CRuntime_Bionic");
|
VersionCondition::addPredefinedGlobalIdent("CRuntime_Bionic");
|
||||||
} else {
|
} else {
|
||||||
VersionCondition::addPredefinedGlobalIdent("linux");
|
|
||||||
VersionCondition::addPredefinedGlobalIdent("Posix");
|
|
||||||
VersionCondition::addPredefinedGlobalIdent("CRuntime_Glibc");
|
VersionCondition::addPredefinedGlobalIdent("CRuntime_Glibc");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -18,35 +18,10 @@
|
||||||
#include "gen/abi-generic.h"
|
#include "gen/abi-generic.h"
|
||||||
#include "gen/abi-arm.h"
|
#include "gen/abi-arm.h"
|
||||||
|
|
||||||
namespace {
|
|
||||||
struct CompositeToArray32 : ABIRewrite {
|
|
||||||
LLValue *get(Type *dty, LLValue *v) override {
|
|
||||||
Logger::println("rewriting i32 array -> as %s", dty->toChars());
|
|
||||||
LLValue *lval = DtoRawAlloca(v->getType(), 0);
|
|
||||||
DtoStore(v, lval);
|
|
||||||
|
|
||||||
LLType *pTy = getPtrToType(DtoType(dty));
|
|
||||||
return DtoLoad(DtoBitCast(lval, pTy), "get-result");
|
|
||||||
}
|
|
||||||
|
|
||||||
LLValue *put(DValue *dv) override {
|
|
||||||
Type *dty = dv->getType();
|
|
||||||
Logger::println("rewriting %s -> as i32 array", dty->toChars());
|
|
||||||
LLType *t = type(dty, nullptr);
|
|
||||||
return DtoLoad(DtoBitCast(dv->getRVal(), getPtrToType(t)));
|
|
||||||
}
|
|
||||||
|
|
||||||
LLType *type(Type *t, LLType *) override {
|
|
||||||
// An i32 array that will hold Type 't'
|
|
||||||
size_t sz = (t->size() + 3) / 4;
|
|
||||||
return LLArrayType::get(LLIntegerType::get(gIR->context(), 32), sz);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ArmTargetABI : TargetABI {
|
struct ArmTargetABI : TargetABI {
|
||||||
HFAToArray hfaToArray;
|
HFAToArray hfaToArray;
|
||||||
CompositeToArray32 compositeToArray32;
|
CompositeToArray32 compositeToArray32;
|
||||||
|
CompositeToArray64 compositeToArray64;
|
||||||
IntegerRewrite integerRewrite;
|
IntegerRewrite integerRewrite;
|
||||||
|
|
||||||
bool returnInArg(TypeFunction *tf) override {
|
bool returnInArg(TypeFunction *tf) override {
|
||||||
|
@ -134,9 +109,12 @@ struct ArmTargetABI : TargetABI {
|
||||||
// non-HFA and messes up register selection
|
// non-HFA and messes up register selection
|
||||||
if (isHFA((TypeStruct *)ty, &arg.ltype)) {
|
if (isHFA((TypeStruct *)ty, &arg.ltype)) {
|
||||||
arg.rewrite = &hfaToArray;
|
arg.rewrite = &hfaToArray;
|
||||||
} else {
|
} else if (DtoAlignment(ty) <= 4) {
|
||||||
arg.rewrite = &compositeToArray32;
|
arg.rewrite = &compositeToArray32;
|
||||||
arg.ltype = compositeToArray32.type(arg.type, arg.ltype);
|
arg.ltype = compositeToArray32.type(arg.type, arg.ltype);
|
||||||
|
} else {
|
||||||
|
arg.rewrite = &compositeToArray64;
|
||||||
|
arg.ltype = compositeToArray64.type(arg.type, arg.ltype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,8 +271,8 @@ struct HFAToArray : ABIRewrite {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rewrite a composite as array of i64.
|
* Rewrite a composite as array of i64.
|
||||||
*/
|
*/
|
||||||
struct CompositeToArray64 : ABIRewrite {
|
struct CompositeToArray64 : ABIRewrite {
|
||||||
LLValue *get(Type *dty, LLValue *v) override {
|
LLValue *get(Type *dty, LLValue *v) override {
|
||||||
Logger::println("rewriting i64 array -> as %s", dty->toChars());
|
Logger::println("rewriting i64 array -> as %s", dty->toChars());
|
||||||
|
@ -297,4 +297,31 @@ struct CompositeToArray64 : ABIRewrite {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rewrite a composite as array of i32.
|
||||||
|
*/
|
||||||
|
struct CompositeToArray32 : ABIRewrite {
|
||||||
|
LLValue *get(Type *dty, LLValue *v) override {
|
||||||
|
Logger::println("rewriting i32 array -> as %s", dty->toChars());
|
||||||
|
LLValue *lval = DtoRawAlloca(v->getType(), 0);
|
||||||
|
DtoStore(v, lval);
|
||||||
|
|
||||||
|
LLType *pTy = getPtrToType(DtoType(dty));
|
||||||
|
return DtoLoad(DtoBitCast(lval, pTy), "get-result");
|
||||||
|
}
|
||||||
|
|
||||||
|
LLValue *put(DValue *dv) override {
|
||||||
|
Type *dty = dv->getType();
|
||||||
|
Logger::println("rewriting %s -> as i32 array", dty->toChars());
|
||||||
|
LLType *t = type(dty, nullptr);
|
||||||
|
return DtoLoad(DtoBitCast(dv->getRVal(), getPtrToType(t)));
|
||||||
|
}
|
||||||
|
|
||||||
|
LLType *type(Type *t, LLType *) override {
|
||||||
|
// An i32 array that will hold Type 't'
|
||||||
|
size_t sz = (t->size() + 3) / 4;
|
||||||
|
return LLArrayType::get(LLIntegerType::get(gIR->context(), 32), sz);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -40,7 +40,12 @@ void emitCoverageLinecountInc(Loc &loc) {
|
||||||
|
|
||||||
// Do an atomic increment, so this works when multiple threads are executed.
|
// Do an atomic increment, so this works when multiple threads are executed.
|
||||||
gIR->ir->CreateAtomicRMW(llvm::AtomicRMWInst::Add, ptr, DtoConstUint(1),
|
gIR->ir->CreateAtomicRMW(llvm::AtomicRMWInst::Add, ptr, DtoConstUint(1),
|
||||||
llvm::AtomicOrdering::Monotonic);
|
#if LDC_LLVM_VER >= 309
|
||||||
|
llvm::AtomicOrdering::Monotonic
|
||||||
|
#else
|
||||||
|
llvm::Monotonic
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
unsigned num_sizet_bits = gDataLayout->getTypeSizeInBits(DtoSize_t());
|
unsigned num_sizet_bits = gDataLayout->getTypeSizeInBits(DtoSize_t());
|
||||||
unsigned idx = line / num_sizet_bits;
|
unsigned idx = line / num_sizet_bits;
|
||||||
|
|
|
@ -75,6 +75,13 @@ static llvm::ManagedStatic<llvm::LLVMContext> GlobalContext;
|
||||||
|
|
||||||
llvm::LLVMContext& getGlobalContext() { return *GlobalContext; }
|
llvm::LLVMContext& getGlobalContext() { return *GlobalContext; }
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Global context
|
||||||
|
******************************************************************************/
|
||||||
|
static llvm::ManagedStatic<llvm::LLVMContext> GlobalContext;
|
||||||
|
|
||||||
|
llvm::LLVMContext& getGlobalContext() { return *GlobalContext; }
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* DYNAMIC MEMORY HELPERS
|
* DYNAMIC MEMORY HELPERS
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
|
@ -900,7 +900,9 @@ static void genModuleInfo(Module *m, bool emitFullModuleInfo) {
|
||||||
b.finalize(moduleInfoSym->getType()->getPointerElementType(), moduleInfoSym);
|
b.finalize(moduleInfoSym->getType()->getPointerElementType(), moduleInfoSym);
|
||||||
setLinkage({LLGlobalValue::ExternalLinkage, false}, moduleInfoSym);
|
setLinkage({LLGlobalValue::ExternalLinkage, false}, moduleInfoSym);
|
||||||
|
|
||||||
if (global.params.targetTriple->isOSLinux() || global.params.targetTriple->isOSFreeBSD() ||
|
if ((global.params.targetTriple.isOSLinux() &&
|
||||||
|
global.params.targetTriple.getEnvironment() != llvm::Triple::Android) ||
|
||||||
|
global.params.targetTriple.isOSFreeBSD() ||
|
||||||
#if LDC_LLVM_VER > 305
|
#if LDC_LLVM_VER > 305
|
||||||
global.params.targetTriple->isOSNetBSD() || global.params.targetTriple->isOSOpenBSD() ||
|
global.params.targetTriple->isOSNetBSD() || global.params.targetTriple->isOSOpenBSD() ||
|
||||||
global.params.targetTriple->isOSDragonFly()
|
global.params.targetTriple->isOSDragonFly()
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit a785ec2fdd2f597698980700fa3febbdba5f89b2
|
Subproject commit 545ac5b5bac60de24c1cebb165a713e58364b7de
|
|
@ -1 +1 @@
|
||||||
Subproject commit 85ffe9dd02a228db502e65dca29ed9d28adef221
|
Subproject commit 4075c6d77bd54f1bd2bb4524bfc2c378f7a7dec3
|
|
@ -1,4 +1,4 @@
|
||||||
// RUN: %ldc -c -output-ll -of=%t.ll %s && FileCheck %s < %t.ll
|
// RUN: %ldc -c -de -output-ll -of=%t.ll %s && FileCheck %s < %t.ll
|
||||||
|
|
||||||
import core.atomic;
|
import core.atomic;
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 69a60d69f3bf97e63869456a5994b4a9c354b205
|
Subproject commit 4085d288a0bfdddcb3fe6eadc6bdbdb11d56070a
|
Loading…
Add table
Add a link
Reference in a new issue