Skip to content

Commit 42c27f5

Browse files
committed
Merge branch 'master' into release-0.16.0
2 parents 459392b + dc8ff49 commit 42c27f5

File tree

6 files changed

+49
-16
lines changed

6 files changed

+49
-16
lines changed

dmd2/cond.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ bool VersionCondition::isPredefined(const char *ident)
205205
"SPARC64",
206206
"S390",
207207
"S390X",
208+
#if IN_LLVM
209+
"SystemZ",
210+
#endif
208211
"HPPA",
209212
"HPPA64",
210213
"SH",
@@ -216,6 +219,9 @@ bool VersionCondition::isPredefined(const char *ident)
216219
"BigEndian",
217220
"ELFv1",
218221
"ELFv2",
222+
#if IN_LLVM
223+
"CRuntime_Bionic",
224+
#endif
219225
"CRuntime_Digitalmars",
220226
"CRuntime_Glibc",
221227
"CRuntime_Microsoft",
@@ -235,10 +241,6 @@ bool VersionCondition::isPredefined(const char *ident)
235241
"assert",
236242
"all",
237243
"none",
238-
#if IN_LLVM
239-
"darwin", "Thumb",
240-
"NVPTX", "NVPTX64",
241-
#endif
242244
NULL
243245
};
244246

driver/main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,13 @@ static void registerPredefinedTargetVersions() {
671671
VersionCondition::addPredefinedGlobalIdent("NVPTX64");
672672
VersionCondition::addPredefinedGlobalIdent("D_HardFloat");
673673
break;
674+
#endif
675+
#if LDC_LLVM_VER >= 303
676+
case llvm::Triple::systemz:
677+
VersionCondition::addPredefinedGlobalIdent("SystemZ");
678+
VersionCondition::addPredefinedGlobalIdent("S390X"); // For backwards compatibility.
679+
VersionCondition::addPredefinedGlobalIdent("D_HardFloat");
680+
break;
674681
#endif
675682
default:
676683
error(Loc(), "invalid cpu architecture specified: %s", global.params.targetTriple.getArchName().str().c_str());
@@ -742,12 +749,14 @@ static void registerPredefinedTargetVersions() {
742749
if (global.params.targetTriple.getEnvironment() == llvm::Triple::Android)
743750
{
744751
VersionCondition::addPredefinedGlobalIdent("Android");
752+
VersionCondition::addPredefinedGlobalIdent("CRuntime_Bionic");
745753
}
746754
else
747755
#endif
748756
{
749757
VersionCondition::addPredefinedGlobalIdent("linux");
750758
VersionCondition::addPredefinedGlobalIdent("Posix");
759+
VersionCondition::addPredefinedGlobalIdent("CRuntime_Glibc");
751760
}
752761
break;
753762
case llvm::Triple::Haiku:

gen/abi-x86.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,31 @@ struct X86TargetABI : TargetABI
215215
// IMPLICIT PARAMETERS
216216

217217
// EXPLICIT PARAMETERS
218+
219+
// Clang does not pass empty structs, while it seems that GCC does,
220+
// at least on Linux x86.
221+
if (isOSX)
222+
{
223+
size_t i = 0;
224+
while (i < fty.args.size())
225+
{
226+
Type *type = fty.args[i]->type->toBasetype();
227+
if (type->ty == Tstruct)
228+
{
229+
// Do not pass empty structs at all for C++ ABI compatibility.
230+
// Tests with clang reveal that more complex "empty" types, for
231+
// example a struct containing an empty struct, are not
232+
// optimized in the same way.
233+
StructDeclaration *sd = static_cast<TypeStruct *>(type)->sym;
234+
if (sd->fields.empty())
235+
{
236+
fty.args.erase(fty.args.begin() + i);
237+
continue;
238+
}
239+
}
240+
++i;
241+
}
242+
}
218243
}
219244
}
220245
};

gen/asm-x86.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ namespace AsmParserx8664
9292
std::string gccName; // GAS will take upper case, but GCC won't (needed for the clobber list)
9393
Identifier * ident;
9494
char size;
95-
char baseReg; // %% todo: Reg, Reg_XX
95+
signed char baseReg; // %% todo: Reg, Reg_XX
9696
} regInfo[N_Regs] =
9797
{
9898
{ "EAX", NULL_TREE, NULL, 4, Reg_EAX },

gen/functions.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,6 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype,
164164
}
165165
else if (!passPointer)
166166
{
167-
if (loweredDType->toBasetype()->ty == Tstruct)
168-
{
169-
// Do not pass empty structs at all for C++ ABI compatibility.
170-
// Tests with clang reveal that more complex "empty" types, for
171-
// example a struct containing an empty struct, are not
172-
// optimized in the same way.
173-
StructDeclaration *sd =
174-
static_cast<TypeStruct*>(loweredDType->toBasetype())->sym;
175-
if (sd->fields.empty()) continue;
176-
}
177-
178167
if (abi->passByVal(loweredDType))
179168
{
180169
attrBuilder.add(LDC_ATTRIBUTE(ByVal));

gen/pragma.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,18 @@ bool DtoIsIntrinsic(FuncDeclaration *fd)
570570
switch (fd->llvmInternal)
571571
{
572572
case LLVMintrinsic:
573+
case LLVMalloca:
574+
case LLVMfence:
573575
case LLVMatomic_store:
574576
case LLVMatomic_load:
575577
case LLVMatomic_cmp_xchg:
576578
case LLVMatomic_rmw:
579+
case LLVMbitop_bt:
580+
case LLVMbitop_btc:
581+
case LLVMbitop_btr:
582+
case LLVMbitop_bts:
583+
case LLVMbitop_vld:
584+
case LLVMbitop_vst:
577585
return true;
578586

579587
default:

0 commit comments

Comments
 (0)