Import a whole bunch of clang trunk commits to enable self-hosting clang
3.4 on Sparc64 (commit descriptions left out for brevity): r198311 r198312 r198911 r198912 r198918 r198923 r199012 r199034 r199037 r199188 r199399 r200452 Submitted by: rdivacky
This commit is contained in:
parent
48173d357a
commit
e18c3d5a5a
@ -4529,6 +4529,13 @@ class SparcV9TargetInfo : public SparcTargetInfo {
|
||||
UIntMaxType = UnsignedLong;
|
||||
}
|
||||
Int64Type = IntMaxType;
|
||||
|
||||
// The SPARCv8 System V ABI has long double 128-bits in size, but 64-bit
|
||||
// aligned. The SPARCv9 SCD 2.4.1 says 16-byte aligned.
|
||||
LongDoubleWidth = 128;
|
||||
LongDoubleAlign = 128;
|
||||
LongDoubleFormat = &llvm::APFloat::IEEEquad;
|
||||
MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
|
||||
}
|
||||
|
||||
virtual void getTargetDefines(const LangOptions &Opts,
|
||||
|
@ -5349,6 +5349,11 @@ SparcV9ABIInfo::classifyType(QualType Ty, unsigned SizeLimit) const {
|
||||
if (!isAggregateTypeForABI(Ty))
|
||||
return ABIArgInfo::getDirect();
|
||||
|
||||
// If a C++ object has either a non-trivial copy constructor or a non-trivial
|
||||
// destructor, it is passed with an explicit indirect pointer / sret pointer.
|
||||
if (CGCXXABI::RecordArgABI RAA = getRecordArgABI(Ty, getCXXABI()))
|
||||
return ABIArgInfo::getIndirect(0, RAA == CGCXXABI::RAA_DirectInMemory);
|
||||
|
||||
// This is a small aggregate type that should be passed in registers.
|
||||
// Build a coercion type from the LLVM struct type.
|
||||
llvm::StructType *StrTy = dyn_cast<llvm::StructType>(CGT.ConvertType(Ty));
|
||||
|
@ -1164,6 +1164,13 @@ void Generic_GCC::GCCInstallationDetector::print(raw_ostream &OS) const {
|
||||
"powerpc64le-suse-linux",
|
||||
"ppc64le-redhat-linux" };
|
||||
|
||||
static const char *const SPARCv8LibDirs[] = { "/lib32", "/lib" };
|
||||
static const char *const SPARCv8Triples[] = { "sparc-linux-gnu",
|
||||
"sparcv8-linux-gnu" };
|
||||
static const char *const SPARCv9LibDirs[] = { "/lib64", "/lib" };
|
||||
static const char *const SPARCv9Triples[] = { "sparc64-linux-gnu",
|
||||
"sparcv9-linux-gnu" };
|
||||
|
||||
static const char *const SystemZLibDirs[] = { "/lib64", "/lib" };
|
||||
static const char *const SystemZTriples[] = {
|
||||
"s390x-linux-gnu", "s390x-unknown-linux-gnu", "s390x-ibm-linux-gnu",
|
||||
@ -1283,6 +1290,26 @@ void Generic_GCC::GCCInstallationDetector::print(raw_ostream &OS) const {
|
||||
TripleAliases.append(PPC64LETriples,
|
||||
PPC64LETriples + llvm::array_lengthof(PPC64LETriples));
|
||||
break;
|
||||
case llvm::Triple::sparc:
|
||||
LibDirs.append(SPARCv8LibDirs,
|
||||
SPARCv8LibDirs + llvm::array_lengthof(SPARCv8LibDirs));
|
||||
TripleAliases.append(SPARCv8Triples,
|
||||
SPARCv8Triples + llvm::array_lengthof(SPARCv8Triples));
|
||||
BiarchLibDirs.append(SPARCv9LibDirs,
|
||||
SPARCv9LibDirs + llvm::array_lengthof(SPARCv9LibDirs));
|
||||
BiarchTripleAliases.append(
|
||||
SPARCv9Triples, SPARCv9Triples + llvm::array_lengthof(SPARCv9Triples));
|
||||
break;
|
||||
case llvm::Triple::sparcv9:
|
||||
LibDirs.append(SPARCv9LibDirs,
|
||||
SPARCv9LibDirs + llvm::array_lengthof(SPARCv9LibDirs));
|
||||
TripleAliases.append(SPARCv9Triples,
|
||||
SPARCv9Triples + llvm::array_lengthof(SPARCv9Triples));
|
||||
BiarchLibDirs.append(SPARCv8LibDirs,
|
||||
SPARCv8LibDirs + llvm::array_lengthof(SPARCv8LibDirs));
|
||||
BiarchTripleAliases.append(
|
||||
SPARCv8Triples, SPARCv8Triples + llvm::array_lengthof(SPARCv8Triples));
|
||||
break;
|
||||
case llvm::Triple::systemz:
|
||||
LibDirs.append(SystemZLibDirs,
|
||||
SystemZLibDirs + llvm::array_lengthof(SystemZLibDirs));
|
||||
@ -1379,6 +1406,7 @@ static bool findTargetBiarchSuffix(std::string &Suffix, StringRef Path,
|
||||
Suffix = "/n32";
|
||||
else if (TargetArch == llvm::Triple::x86_64 ||
|
||||
TargetArch == llvm::Triple::ppc64 ||
|
||||
TargetArch == llvm::Triple::sparcv9 ||
|
||||
TargetArch == llvm::Triple::systemz ||
|
||||
TargetArch == llvm::Triple::mips64 ||
|
||||
TargetArch == llvm::Triple::mips64el)
|
||||
|
@ -5785,6 +5785,19 @@ void freebsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
default:
|
||||
CmdArgs.push_back("-matpcs");
|
||||
}
|
||||
} else if (getToolChain().getArch() == llvm::Triple::sparc ||
|
||||
getToolChain().getArch() == llvm::Triple::sparcv9) {
|
||||
Arg *LastPICArg = Args.getLastArg(options::OPT_fPIC, options::OPT_fno_PIC,
|
||||
options::OPT_fpic, options::OPT_fno_pic,
|
||||
options::OPT_fPIE, options::OPT_fno_PIE,
|
||||
options::OPT_fpie, options::OPT_fno_pie);
|
||||
if (LastPICArg &&
|
||||
(LastPICArg->getOption().matches(options::OPT_fPIC) ||
|
||||
LastPICArg->getOption().matches(options::OPT_fpic) ||
|
||||
LastPICArg->getOption().matches(options::OPT_fPIE) ||
|
||||
LastPICArg->getOption().matches(options::OPT_fpie))) {
|
||||
CmdArgs.push_back("-KPIC");
|
||||
}
|
||||
}
|
||||
|
||||
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
|
||||
@ -6194,6 +6207,7 @@ void gnutools::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
const ArgList &Args,
|
||||
const char *LinkingOutput) const {
|
||||
ArgStringList CmdArgs;
|
||||
bool NeedsKPIC = false;
|
||||
|
||||
// Add --32/--64 to make sure we get the format we want.
|
||||
// This is incomplete
|
||||
@ -6213,6 +6227,14 @@ void gnutools::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
CmdArgs.push_back("-a64");
|
||||
CmdArgs.push_back("-mppc64le");
|
||||
CmdArgs.push_back("-many");
|
||||
} else if (getToolChain().getArch() == llvm::Triple::sparc) {
|
||||
CmdArgs.push_back("-32");
|
||||
CmdArgs.push_back("-Av8plusa");
|
||||
NeedsKPIC = true;
|
||||
} else if (getToolChain().getArch() == llvm::Triple::sparcv9) {
|
||||
CmdArgs.push_back("-64");
|
||||
CmdArgs.push_back("-Av9a");
|
||||
NeedsKPIC = true;
|
||||
} else if (getToolChain().getArch() == llvm::Triple::arm) {
|
||||
StringRef MArch = getToolChain().getArchName();
|
||||
if (MArch == "armv7" || MArch == "armv7a" || MArch == "armv7-a")
|
||||
@ -6272,6 +6294,15 @@ void gnutools::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
CmdArgs.push_back(Args.MakeArgString("-mmsa"));
|
||||
}
|
||||
|
||||
NeedsKPIC = true;
|
||||
} else if (getToolChain().getArch() == llvm::Triple::systemz) {
|
||||
// Always pass an -march option, since our default of z10 is later
|
||||
// than the GNU assembler's default.
|
||||
StringRef CPUName = getSystemZTargetCPU(Args);
|
||||
CmdArgs.push_back(Args.MakeArgString("-march=" + CPUName));
|
||||
}
|
||||
|
||||
if (NeedsKPIC) {
|
||||
Arg *LastPICArg = Args.getLastArg(options::OPT_fPIC, options::OPT_fno_PIC,
|
||||
options::OPT_fpic, options::OPT_fno_pic,
|
||||
options::OPT_fPIE, options::OPT_fno_PIE,
|
||||
@ -6283,11 +6314,6 @@ void gnutools::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
LastPICArg->getOption().matches(options::OPT_fpie))) {
|
||||
CmdArgs.push_back("-KPIC");
|
||||
}
|
||||
} else if (getToolChain().getArch() == llvm::Triple::systemz) {
|
||||
// Always pass an -march option, since our default of z10 is later
|
||||
// than the GNU assembler's default.
|
||||
StringRef CPUName = getSystemZTargetCPU(Args);
|
||||
CmdArgs.push_back(Args.MakeArgString("-march=" + CPUName));
|
||||
}
|
||||
|
||||
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
|
||||
@ -6357,7 +6383,8 @@ static StringRef getLinuxDynamicLinker(const ArgList &Args,
|
||||
const toolchains::Linux &ToolChain) {
|
||||
if (ToolChain.getTriple().getEnvironment() == llvm::Triple::Android)
|
||||
return "/system/bin/linker";
|
||||
else if (ToolChain.getArch() == llvm::Triple::x86)
|
||||
else if (ToolChain.getArch() == llvm::Triple::x86 ||
|
||||
ToolChain.getArch() == llvm::Triple::sparc)
|
||||
return "/lib/ld-linux.so.2";
|
||||
else if (ToolChain.getArch() == llvm::Triple::aarch64)
|
||||
return "/lib/ld-linux-aarch64.so.1";
|
||||
@ -6382,6 +6409,8 @@ static StringRef getLinuxDynamicLinker(const ArgList &Args,
|
||||
ToolChain.getArch() == llvm::Triple::ppc64le ||
|
||||
ToolChain.getArch() == llvm::Triple::systemz)
|
||||
return "/lib64/ld64.so.1";
|
||||
else if (ToolChain.getArch() == llvm::Triple::sparcv9)
|
||||
return "/lib64/ld-linux.so.2";
|
||||
else
|
||||
return "/lib64/ld-linux-x86-64.so.2";
|
||||
}
|
||||
@ -6444,6 +6473,10 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
CmdArgs.push_back("elf32ppclinux");
|
||||
else if (ToolChain.getArch() == llvm::Triple::ppc64)
|
||||
CmdArgs.push_back("elf64ppc");
|
||||
else if (ToolChain.getArch() == llvm::Triple::sparc)
|
||||
CmdArgs.push_back("elf32_sparc");
|
||||
else if (ToolChain.getArch() == llvm::Triple::sparcv9)
|
||||
CmdArgs.push_back("elf64_sparc");
|
||||
else if (ToolChain.getArch() == llvm::Triple::mips)
|
||||
CmdArgs.push_back("elf32btsmip");
|
||||
else if (ToolChain.getArch() == llvm::Triple::mipsel)
|
||||
|
Loading…
Reference in New Issue
Block a user