зеркало из https://github.com/microsoft/clang-1.git
[Mips] Support -mmicromips / -mno-micromips command line options.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179489 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
a814161451
Коммит
321ae79aae
|
@ -957,6 +957,8 @@ def mprfchw : Flag<["-"], "mprfchw">, Group<m_x86_Features_Group>;
|
|||
def mrdseed : Flag<["-"], "mrdseed">, Group<m_x86_Features_Group>;
|
||||
def mips16 : Flag<["-"], "mips16">, Group<m_Group>;
|
||||
def mno_mips16 : Flag<["-"], "mno-mips16">, Group<m_Group>;
|
||||
def mmicromips : Flag<["-"], "mmicromips">, Group<m_Group>;
|
||||
def mno_micromips : Flag<["-"], "mno-micromips">, Group<m_Group>;
|
||||
def mxgot : Flag<["-"], "mxgot">, Group<m_Group>;
|
||||
def mno_xgot : Flag<["-"], "mno-xgot">, Group<m_Group>;
|
||||
def mdsp : Flag<["-"], "mdsp">, Group<m_Group>;
|
||||
|
|
|
@ -4405,6 +4405,7 @@ class MipsTargetInfoBase : public TargetInfo {
|
|||
static const Builtin::Info BuiltinInfo[];
|
||||
std::string CPU;
|
||||
bool IsMips16;
|
||||
bool IsMicromips;
|
||||
bool IsSingleFloat;
|
||||
enum MipsFloatABI {
|
||||
HardFloat, SoftFloat
|
||||
|
@ -4423,6 +4424,7 @@ public:
|
|||
: TargetInfo(triple),
|
||||
CPU(CPUStr),
|
||||
IsMips16(false),
|
||||
IsMicromips(false),
|
||||
IsSingleFloat(false),
|
||||
FloatABI(HardFloat),
|
||||
DspRev(NoDSP),
|
||||
|
@ -4461,6 +4463,9 @@ public:
|
|||
if (IsMips16)
|
||||
Builder.defineMacro("__mips16", Twine(1));
|
||||
|
||||
if (IsMicromips)
|
||||
Builder.defineMacro("__mips_micromips", Twine(1));
|
||||
|
||||
switch (DspRev) {
|
||||
default:
|
||||
break;
|
||||
|
@ -4550,7 +4555,8 @@ public:
|
|||
Name == "o32" || Name == "n32" || Name == "n64" || Name == "eabi" ||
|
||||
Name == "mips32" || Name == "mips32r2" ||
|
||||
Name == "mips64" || Name == "mips64r2" ||
|
||||
Name == "mips16" || Name == "dsp" || Name == "dspr2") {
|
||||
Name == "mips16" || Name == "micromips" ||
|
||||
Name == "dsp" || Name == "dspr2") {
|
||||
Features[Name] = Enabled;
|
||||
return true;
|
||||
} else if (Name == "32") {
|
||||
|
@ -4565,6 +4571,7 @@ public:
|
|||
|
||||
virtual void HandleTargetFeatures(std::vector<std::string> &Features) {
|
||||
IsMips16 = false;
|
||||
IsMicromips = false;
|
||||
IsSingleFloat = false;
|
||||
FloatABI = HardFloat;
|
||||
DspRev = NoDSP;
|
||||
|
@ -4577,6 +4584,8 @@ public:
|
|||
FloatABI = SoftFloat;
|
||||
else if (*it == "+mips16")
|
||||
IsMips16 = true;
|
||||
else if (*it == "+micromips")
|
||||
IsMicromips = true;
|
||||
else if (*it == "+dsp")
|
||||
DspRev = std::max(DspRev, DSP1);
|
||||
else if (*it == "+dspr2")
|
||||
|
|
|
@ -990,6 +990,9 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args,
|
|||
AddTargetFeature(Args, CmdArgs,
|
||||
options::OPT_mips16, options::OPT_mno_mips16,
|
||||
"mips16");
|
||||
AddTargetFeature(Args, CmdArgs,
|
||||
options::OPT_mmicromips, options::OPT_mno_micromips,
|
||||
"micromips");
|
||||
AddTargetFeature(Args, CmdArgs,
|
||||
options::OPT_mdsp, options::OPT_mno_dsp,
|
||||
"dsp");
|
||||
|
|
|
@ -14,6 +14,18 @@
|
|||
// RUN: | FileCheck --check-prefix=CHECK-NOMIPS16 %s
|
||||
// CHECK-NOMIPS16: "-target-feature" "-mips16"
|
||||
//
|
||||
// -mmicromips
|
||||
// RUN: %clang -target mips-linux-gnu -### -c %s \
|
||||
// RUN: -mno-micromips -mmicromips 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-MICROMIPS %s
|
||||
// CHECK-MICROMIPS: "-target-feature" "+micromips"
|
||||
//
|
||||
// -mno-micromips
|
||||
// RUN: %clang -target mips-linux-gnu -### -c %s \
|
||||
// RUN: -mmicromips -mno-micromips 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-NOMICROMIPS %s
|
||||
// CHECK-NOMICROMIPS: "-target-feature" "-micromips"
|
||||
//
|
||||
// -mdsp
|
||||
// RUN: %clang -target mips-linux-gnu -### -c %s \
|
||||
// RUN: -mno-dsp -mdsp 2>&1 \
|
||||
|
|
|
@ -1168,6 +1168,16 @@
|
|||
// RUN: | FileCheck -check-prefix NOMIPS16 %s
|
||||
// NOMIPS16-NOT:#define __mips16 1
|
||||
//
|
||||
// RUN: %clang_cc1 -target-feature +micromips \
|
||||
// RUN: -E -dM -triple=mips-none-none < /dev/null \
|
||||
// RUN: | FileCheck -check-prefix MICROMIPS %s
|
||||
// MICROMIPS:#define __mips_micromips 1
|
||||
//
|
||||
// RUN: %clang_cc1 -target-feature -micromips \
|
||||
// RUN: -E -dM -triple=mips-none-none < /dev/null \
|
||||
// RUN: | FileCheck -check-prefix NOMICROMIPS %s
|
||||
// NOMICROMIPS-NOT:#define __mips_micromips 1
|
||||
//
|
||||
// RUN: %clang_cc1 -target-feature +dsp \
|
||||
// RUN: -E -dM -triple=mips-none-none < /dev/null \
|
||||
// RUN: | FileCheck -check-prefix MIPS-DSP %s
|
||||
|
|
Загрузка…
Ссылка в новой задаче