Implement darwin::Link::AddDarwinArch for ARM.

llvm-svn: 81020
This commit is contained in:
Daniel Dunbar 2009-09-04 18:35:31 +00:00
parent 84e727fb72
commit 91dbfd6666
2 changed files with 74 additions and 1 deletions

View File

@ -508,6 +508,7 @@ OPTION("-m64", m64, Flag, m_Group, INVALID, "d", 0, 0, 0)
OPTION("-march=", march_EQ, Joined, m_Group, INVALID, "d", 0, 0, 0)
OPTION("-mcmodel=", mcmodel_EQ, Joined, m_Group, INVALID, "d", 0, 0, 0)
OPTION("-mconstant-cfstrings", mconstant_cfstrings, Flag, clang_ignored_m_Group, INVALID, "", 0, 0, 0)
OPTION("-mcpu=", mcpu_EQ, Joined, m_Group, INVALID, "d", 0, 0, 0)
OPTION("-mdynamic-no-pic", mdynamic_no_pic, Joined, m_Group, INVALID, "q", 0, 0, 0)
OPTION("-mfix-and-continue", mfix_and_continue, Flag, clang_ignored_m_Group, INVALID, "", 0, 0, 0)
OPTION("-miphoneos-version-min=", miphoneos_version_min_EQ, Joined, m_Group, INVALID, "", 0, 0, 0)

View File

@ -1368,11 +1368,83 @@ static bool isMacosxVersionLT(unsigned (&A)[3],
return isMacosxVersionLT(A, B);
}
// FIXME: Can we tablegen this?
static const char *GetArmArchForMArch(llvm::StringRef Value) {
if (Value == "armv6k")
return "armv6";
if (Value == "armv5tej")
return "armv5";
if (Value == "xscale")
return "xscale";
if (Value == "armv4t")
return "armv4t";
if (Value == "armv7" || Value == "armv7-a" || Value == "armv7-r" ||
Value == "armv7-m" || Value == "armv7a" || Value == "armv7r" ||
Value == "armv7m")
return "armv7";
return 0;
}
// FIXME: Can we tablegen this?
static const char *GetArmArchForMCpu(llvm::StringRef Value) {
if (Value == "arm10tdmi" || Value == "arm1020t" || Value == "arm9e" ||
Value == "arm946e-s" || Value == "arm966e-s" ||
Value == "arm968e-s" || Value == "arm10e" ||
Value == "arm1020e" || Value == "arm1022e" || Value == "arm926ej-s" ||
Value == "arm1026ej-s")
return "armv5";
if (Value == "xscale")
return "xscale";
if (Value == "arm1136j-s" || Value == "arm1136jf-s" ||
Value == "arm1176jz-s" || Value == "arm1176jzf-s")
return "armv6";
if (Value == "cortex-a8" || Value == "cortex-r4" || Value == "cortex-m3")
return "armv7";
return 0;
}
void darwin::Link::AddDarwinArch(const ArgList &Args,
ArgStringList &CmdArgs) const {
// Derived from darwin_arch spec.
CmdArgs.push_back("-arch");
CmdArgs.push_back(Args.MakeArgString(getToolChain().getArchName().c_str()));
switch (getToolChain().getTriple().getArch()) {
default:
CmdArgs.push_back(Args.MakeArgString(getToolChain().getArchName().c_str()));
break;
case llvm::Triple::arm: {
// FIXME: gcc isn't actually following this, it looks like the arch is
// getting forced somewhere else (translation?).
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
if (const char *Arch = GetArmArchForMArch(A->getValue(Args))) {
CmdArgs.push_back(Arch);
return;
}
}
if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
if (const char *Arch = GetArmArchForMCpu(A->getValue(Args))) {
CmdArgs.push_back(Arch);
return;
}
}
CmdArgs.push_back("arm");
CmdArgs.push_back("-force_cpusubtype_ALL");
return;
}
}
}
void darwin::Link::AddDarwinSubArch(const ArgList &Args,