[PATCH] D22943: [Driver] Add FIXME's where we can't use effective triples (NFC)
Vedant Kumar via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 28 15:11:05 PDT 2016
vsk created this revision.
vsk added reviewers: echristo, dexonsmith.
vsk added subscribers: joerg, rengolin, cfe-commits.
Herald added subscribers: mehdi_amini, aemerson.
... even though we *should* be able to.
If we used effective triples at the marked sites, we would fail:
- test/Driver/{darwin-dsymutil.c, darwin-debug-version.c}
-ccc-print-bindings is expected to print 'x86_64-apple-darwin10',
but prints 'x86_64-apple-macosx10.6.0' instead.
- test/Driver/netbsd.c
We see -mcpu=arm1022e instead of arm926ej-s in a single run.
- test/Driver/linux-as.c
An extra '-mfpu=neon' argument appears in a single run. Probably
harmless -- the test could be relaxed.
This is part of on ongoing effort to use effective target triples
whenever we can in the clang driver (see: [cfe-dev] Lessening the
driver's reliance on default target triples).
https://reviews.llvm.org/D22943
Files:
lib/Driver/Driver.cpp
lib/Driver/Tools.cpp
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -8726,9 +8726,13 @@
claimNoWarnArgs(Args);
ArgStringList CmdArgs;
+ // FIXME: We should be able to use the effective triple here, but there is an
+ // inconsistency between the ARM target parser and the expected output.
+ const llvm::Triple &Triple = getToolChain().getTriple();
+
// GNU as needs different flags for creating the correct output format
// on architectures with different ABIs or optional feature sets.
- switch (getToolChain().getArch()) {
+ switch (Triple.getArch()) {
case llvm::Triple::x86:
CmdArgs.push_back("--32");
break;
@@ -8738,8 +8742,7 @@
case llvm::Triple::thumbeb: {
StringRef MArch, MCPU;
getARMArchCPUFromArgs(Args, MArch, MCPU, /*FromAs*/ true);
- std::string Arch =
- arm::getARMTargetCPU(MCPU, MArch, getToolChain().getTriple());
+ std::string Arch = arm::getARMTargetCPU(MCPU, MArch, Triple);
CmdArgs.push_back(Args.MakeArgString("-mcpu=" + Arch));
break;
}
@@ -8750,16 +8753,16 @@
case llvm::Triple::mips64el: {
StringRef CPUName;
StringRef ABIName;
- mips::getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName);
+ mips::getMipsCPUAndABI(Args, Triple, CPUName, ABIName);
CmdArgs.push_back("-march");
CmdArgs.push_back(CPUName.data());
CmdArgs.push_back("-mabi");
CmdArgs.push_back(getGnuCompatibleMipsABIName(ABIName).data());
- if (getToolChain().getArch() == llvm::Triple::mips ||
- getToolChain().getArch() == llvm::Triple::mips64)
+ if (Triple.getArch() == llvm::Triple::mips ||
+ Triple.getArch() == llvm::Triple::mips64)
CmdArgs.push_back("-EB");
else
CmdArgs.push_back("-EL");
@@ -8771,16 +8774,16 @@
case llvm::Triple::sparc:
case llvm::Triple::sparcel: {
CmdArgs.push_back("-32");
- std::string CPU = getCPUName(Args, getToolChain().getTriple());
- CmdArgs.push_back(getSparcAsmModeForCPU(CPU, getToolChain().getTriple()));
+ std::string CPU = getCPUName(Args, Triple);
+ CmdArgs.push_back(getSparcAsmModeForCPU(CPU, Triple));
AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
break;
}
case llvm::Triple::sparcv9: {
CmdArgs.push_back("-64");
- std::string CPU = getCPUName(Args, getToolChain().getTriple());
- CmdArgs.push_back(getSparcAsmModeForCPU(CPU, getToolChain().getTriple()));
+ std::string CPU = getCPUName(Args, Triple);
+ CmdArgs.push_back(getSparcAsmModeForCPU(CPU, Triple));
AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
break;
}
@@ -9076,6 +9079,8 @@
case llvm::Triple::armeb:
case llvm::Triple::thumb:
case llvm::Triple::thumbeb: {
+ // FIXME: We should be able to use the effective triple here, but it breaks
+ // a test for the linux assembler.
const llvm::Triple &Triple2 = getToolChain().getTriple();
switch (Triple2.getSubArch()) {
case llvm::Triple::ARMSubArch_v7:
Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2271,6 +2271,8 @@
BaseInput);
if (CCCPrintBindings && !CCGenDiagnostics) {
+ // FIXME: We should use the effective triple here, but it breaks a test
+ // on Darwin.
llvm::errs() << "# \"" << T->getToolChain().getTripleString() << '"'
<< " - \"" << T->getName() << "\", inputs: [";
for (unsigned i = 0, e = InputInfos.size(); i != e; ++i) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22943.66033.patch
Type: text/x-patch
Size: 3609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160728/1da19cec/attachment.bin>
More information about the cfe-commits
mailing list