Merge branch 'master' into merge-2.067

This commit is contained in:
Kai Nacke 2015-05-17 13:06:46 +02:00
commit 1036edc266
5 changed files with 34 additions and 20 deletions

View file

@ -544,6 +544,16 @@ static void initializePasses() {
/// Register the MIPS ABI.
static void registerMipsABI()
{
#if LDC_LLVM_VER >= 307
// FIXME: EABI?
auto dl = gTargetMachine->getDataLayout();
if (dl->getPointerSizeInBits() == 64)
VersionCondition::addPredefinedGlobalIdent("MIPS_N64");
else if (dl->getLargestLegalIntTypeSize() == 64)
VersionCondition::addPredefinedGlobalIdent("MIPS_N32");
else
VersionCondition::addPredefinedGlobalIdent("MIPS_O32");
#else
llvm::StringRef features = gTargetMachine->getTargetFeatureString();
if (features.find("+o32") != std::string::npos)
VersionCondition::addPredefinedGlobalIdent("MIPS_O32");
@ -553,6 +563,7 @@ static void registerMipsABI()
VersionCondition::addPredefinedGlobalIdent("MIPS_N64");
if (features.find("+eabi") != std::string::npos)
VersionCondition::addPredefinedGlobalIdent("MIPS_EABI");
#endif
}
/// Register the float ABI.
@ -562,7 +573,7 @@ static void registerPredefinedFloatABI(const char *soft, const char *hard, const
// Use target floating point unit instead of s/w float routines
#if LDC_LLVM_VER >= 307
// FIXME: This is a semantic change!
bool useFPU = gTargetMachine->Options.FloatABIType = llvm::FloatABI::Hard;
bool useFPU = gTargetMachine->Options.FloatABIType == llvm::FloatABI::Hard;
#else
bool useFPU = !gTargetMachine->Options.UseSoftFloat;
#endif
@ -687,7 +698,7 @@ static void registerPredefinedTargetVersions() {
}
// a generic 64bit version
if (global.params.is64bit) {
if (global.params.isLP64) {
VersionCondition::addPredefinedGlobalIdent("D_LP64");
}
@ -1025,20 +1036,6 @@ int main(int argc, char **argv)
bitness, mFloatABI, mRelocModel, mCodeModel, codeGenOptLevel(),
global.params.symdebug || disableFpElim, disableLinkerStripDead);
{
llvm::Triple triple = llvm::Triple(gTargetMachine->getTargetTriple());
global.params.targetTriple = triple;
global.params.isLinux = triple.getOS() == llvm::Triple::Linux;
global.params.isOSX = triple.isMacOSX();
global.params.isWindows = triple.isOSWindows();
global.params.isFreeBSD = triple.getOS() == llvm::Triple::FreeBSD;
global.params.isOpenBSD = triple.getOS() == llvm::Triple::OpenBSD;
global.params.isSolaris = triple.getOS() == llvm::Triple::Solaris;
// FIXME: Correctly handle the x32 ABI (AMD64 ILP32) here.
global.params.isLP64 = triple.isArch64Bit();
global.params.is64bit = triple.isArch64Bit();
}
#if LDC_LLVM_VER >= 307
gDataLayout = gTargetMachine->getDataLayout();
#elif LDC_LLVM_VER >= 306
@ -1049,6 +1046,19 @@ int main(int argc, char **argv)
gDataLayout = gTargetMachine->getTargetData();
#endif
{
llvm::Triple triple = llvm::Triple(gTargetMachine->getTargetTriple());
global.params.targetTriple = triple;
global.params.isLinux = triple.getOS() == llvm::Triple::Linux;
global.params.isOSX = triple.isMacOSX();
global.params.isWindows = triple.isOSWindows();
global.params.isFreeBSD = triple.getOS() == llvm::Triple::FreeBSD;
global.params.isOpenBSD = triple.getOS() == llvm::Triple::OpenBSD;
global.params.isSolaris = triple.getOS() == llvm::Triple::Solaris;
global.params.isLP64 = gDataLayout->getPointerSizeInBits() == 64;
global.params.is64bit = triple.isArch64Bit();
}
// allocate the target abi
gABI = TargetABI::getTarget();