Skip to content

Commit

Permalink
Merge branch 'master' into release-0.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
redstar committed Sep 19, 2015
2 parents 459392b + dc8ff49 commit 42c27f5
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 16 deletions.
10 changes: 6 additions & 4 deletions dmd2/cond.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ bool VersionCondition::isPredefined(const char *ident)
"SPARC64",
"S390",
"S390X",
#if IN_LLVM
"SystemZ",
#endif
"HPPA",
"HPPA64",
"SH",
Expand All @@ -216,6 +219,9 @@ bool VersionCondition::isPredefined(const char *ident)
"BigEndian",
"ELFv1",
"ELFv2",
#if IN_LLVM
"CRuntime_Bionic",
#endif
"CRuntime_Digitalmars",
"CRuntime_Glibc",
"CRuntime_Microsoft",
Expand All @@ -235,10 +241,6 @@ bool VersionCondition::isPredefined(const char *ident)
"assert",
"all",
"none",
#if IN_LLVM
"darwin", "Thumb",
"NVPTX", "NVPTX64",
#endif
NULL
};

Expand Down
9 changes: 9 additions & 0 deletions driver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,13 @@ static void registerPredefinedTargetVersions() {
VersionCondition::addPredefinedGlobalIdent("NVPTX64");
VersionCondition::addPredefinedGlobalIdent("D_HardFloat");
break;
#endif
#if LDC_LLVM_VER >= 303
case llvm::Triple::systemz:
VersionCondition::addPredefinedGlobalIdent("SystemZ");
VersionCondition::addPredefinedGlobalIdent("S390X"); // For backwards compatibility.
VersionCondition::addPredefinedGlobalIdent("D_HardFloat");
break;
#endif
default:
error(Loc(), "invalid cpu architecture specified: %s", global.params.targetTriple.getArchName().str().c_str());
Expand Down Expand Up @@ -742,12 +749,14 @@ static void registerPredefinedTargetVersions() {
if (global.params.targetTriple.getEnvironment() == llvm::Triple::Android)
{
VersionCondition::addPredefinedGlobalIdent("Android");
VersionCondition::addPredefinedGlobalIdent("CRuntime_Bionic");
}
else
#endif
{
VersionCondition::addPredefinedGlobalIdent("linux");
VersionCondition::addPredefinedGlobalIdent("Posix");
VersionCondition::addPredefinedGlobalIdent("CRuntime_Glibc");
}
break;
case llvm::Triple::Haiku:
Expand Down
25 changes: 25 additions & 0 deletions gen/abi-x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,31 @@ struct X86TargetABI : TargetABI
// IMPLICIT PARAMETERS

// EXPLICIT PARAMETERS

// Clang does not pass empty structs, while it seems that GCC does,
// at least on Linux x86.
if (isOSX)
{
size_t i = 0;
while (i < fty.args.size())
{
Type *type = fty.args[i]->type->toBasetype();
if (type->ty == Tstruct)
{
// Do not pass empty structs at all for C++ ABI compatibility.
// Tests with clang reveal that more complex "empty" types, for
// example a struct containing an empty struct, are not
// optimized in the same way.
StructDeclaration *sd = static_cast<TypeStruct *>(type)->sym;
if (sd->fields.empty())
{
fty.args.erase(fty.args.begin() + i);
continue;
}
}
++i;
}
}
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion gen/asm-x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace AsmParserx8664
std::string gccName; // GAS will take upper case, but GCC won't (needed for the clobber list)
Identifier * ident;
char size;
char baseReg; // %% todo: Reg, Reg_XX
signed char baseReg; // %% todo: Reg, Reg_XX
} regInfo[N_Regs] =
{
{ "EAX", NULL_TREE, NULL, 4, Reg_EAX },
Expand Down
11 changes: 0 additions & 11 deletions gen/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,6 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype,
}
else if (!passPointer)
{
if (loweredDType->toBasetype()->ty == Tstruct)
{
// Do not pass empty structs at all for C++ ABI compatibility.
// Tests with clang reveal that more complex "empty" types, for
// example a struct containing an empty struct, are not
// optimized in the same way.
StructDeclaration *sd =
static_cast<TypeStruct*>(loweredDType->toBasetype())->sym;
if (sd->fields.empty()) continue;
}

if (abi->passByVal(loweredDType))
{
attrBuilder.add(LDC_ATTRIBUTE(ByVal));
Expand Down
8 changes: 8 additions & 0 deletions gen/pragma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,10 +570,18 @@ bool DtoIsIntrinsic(FuncDeclaration *fd)
switch (fd->llvmInternal)
{
case LLVMintrinsic:
case LLVMalloca:
case LLVMfence:
case LLVMatomic_store:
case LLVMatomic_load:
case LLVMatomic_cmp_xchg:
case LLVMatomic_rmw:
case LLVMbitop_bt:
case LLVMbitop_btc:
case LLVMbitop_btr:
case LLVMbitop_bts:
case LLVMbitop_vld:
case LLVMbitop_vst:
return true;

default:
Expand Down

0 comments on commit 42c27f5

Please sign in to comment.