llvm.org GIT mirror llvm / ce0f74d
Migrate ABIName to MCTargetOptions so that it can be shared between the TargetMachine level and the MC level. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225891 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 5 years ago
7 changed file(s) with 28 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
176176 cl::opt
177177 TrapFuncName("trap-func", cl::Hidden,
178178 cl::desc("Emit a call to trap function rather than a trap instruction"),
179 cl::init(""));
180
181 cl::opt
182 ABIName("target-abi", cl::Hidden,
183 cl::desc("The name of the ABI to be targeted from the backend."),
184179 cl::init(""));
185180
186181 cl::opt
284279 Options.DisableTailCalls = DisableTailCalls;
285280 Options.StackAlignmentOverride = OverrideStackAlignment;
286281 Options.TrapFuncName = TrapFuncName;
287 Options.ABIName = ABIName;
288282 Options.PositionIndependentExecutable = EnablePIE;
289283 Options.UseInitArray = !UseCtors;
290284 Options.DataSections = DataSections;
99 #ifndef LLVM_MC_MCTARGETOPTIONS_H
1010 #define LLVM_MC_MCTARGETOPTIONS_H
1111
12 #include
13
1214 namespace llvm {
15
16 class StringRef;
1317
1418 class MCTargetOptions {
1519 public:
3034 bool ShowMCInst : 1;
3135 bool AsmVerbose : 1;
3236 int DwarfVersion;
37 /// getABIName - If this returns a non-empty string this represents the
38 /// textual name of the ABI that we want the backend to use, e.g. o32, or
39 /// aapcs-linux.
40 StringRef getABIName() const;
41 std::string ABIName;
3342 MCTargetOptions();
3443 };
3544
4453 ARE_EQUAL(ShowMCEncoding) &&
4554 ARE_EQUAL(ShowMCInst) &&
4655 ARE_EQUAL(AsmVerbose) &&
47 ARE_EQUAL(DwarfVersion));
56 ARE_EQUAL(DwarfVersion) &&
57 ARE_EQUAL(ABIName));
4858 #undef ARE_EQUAL
4959 }
5060
3939 cl::desc("Emit internal instruction representation to "
4040 "assembly file"));
4141
42 cl::opt
43 ABIName("target-abi", cl::Hidden,
44 cl::desc("The name of the ABI to be targeted from the backend."),
45 cl::init(""));
46
4247 static inline MCTargetOptions InitMCTargetOptionsFromFlags() {
4348 MCTargetOptions Options;
4449 Options.SanitizeAddress =
4651 Options.MCRelaxAll = RelaxAll;
4752 Options.DwarfVersion = DwarfVersion;
4853 Options.ShowMCInst = ShowMCInst;
54 Options.ABIName = ABIName;
4955 return Options;
5056 }
5157
7878 UseInitArray(false), DisableIntegratedAS(false),
7979 CompressDebugSections(false), FunctionSections(false),
8080 DataSections(false), TrapUnreachable(false), TrapFuncName(),
81 ABIName(), FloatABIType(FloatABI::Default),
81 FloatABIType(FloatABI::Default),
8282 AllowFPOpFusion(FPOpFusion::Standard), JTType(JumpTable::Single),
8383 FCFI(false), ThreadModel(ThreadModel::POSIX),
8484 CFIType(CFIntegrity::Sub), CFIEnforcing(false), CFIFuncName() {}
205205 /// name instead of an ISD::TRAP node.
206206 std::string TrapFuncName;
207207 StringRef getTrapFunctionName() const;
208
209 /// getABIName - If this returns a non-empty string this represents the
210 /// textual name of the ABI that we want the backend to use, e.g. o32, or
211 /// aapcs-linux.
212 std::string ABIName;
213 StringRef getABIName() const;
214208
215209 /// FloatABIType - This setting is set by -float-abi=xxx option is specfied
216210 /// on the command line. This setting may either be Default, Soft, or Hard.
291285 ARE_EQUAL(UseInitArray) &&
292286 ARE_EQUAL(TrapUnreachable) &&
293287 ARE_EQUAL(TrapFuncName) &&
294 ARE_EQUAL(ABIName) &&
295288 ARE_EQUAL(FloatABIType) &&
296289 ARE_EQUAL(AllowFPOpFusion) &&
297290 ARE_EQUAL(JTType) &&
5757 StringRef TargetOptions::getCFIFuncName() const {
5858 return CFIFuncName;
5959 }
60
61 /// getABIName - If this returns a non-empty string this represents the
62 /// textual name of the ABI that we want the backend to use, e.g. o32, or
63 /// aapcs-linux.
64 StringRef TargetOptions::getABIName() const {
65 return ABIName;
66 }
66 //
77 //===----------------------------------------------------------------------===//
88
9 #include "llvm/ADT/StringRef.h"
910 #include "llvm/MC/MCTargetOptions.h"
1011
1112 namespace llvm {
1415 : SanitizeAddress(false), MCRelaxAll(false), MCNoExecStack(false),
1516 MCFatalWarnings(false), MCSaveTempLabels(false),
1617 MCUseDwarfDirectory(false), ShowMCEncoding(false), ShowMCInst(false),
17 AsmVerbose(false), DwarfVersion(0) {}
18 AsmVerbose(false), DwarfVersion(0), ABIName() {}
19
20 StringRef MCTargetOptions::getABIName() const {
21 return ABIName;
22 }
1823
1924 } // end namespace llvm
5454 static ARMBaseTargetMachine::ARMABI
5555 computeTargetABI(const Triple &TT, StringRef CPU,
5656 const TargetOptions &Options) {
57 if (Options.getABIName().startswith("aapcs"))
57 if (Options.MCOptions.getABIName().startswith("aapcs"))
5858 return ARMBaseTargetMachine::ARM_ABI_AAPCS;
59 else if (Options.getABIName().startswith("apcs"))
59 else if (Options.MCOptions.getABIName().startswith("apcs"))
6060 return ARMBaseTargetMachine::ARM_ABI_APCS;
6161
62 assert(Options.getABIName().empty() && "Unknown target-abi option!");
62 assert(Options.MCOptions.getABIName().empty() &&
63 "Unknown target-abi option!");
6364
6465 ARMBaseTargetMachine::ARMABI TargetABI =
6566 ARMBaseTargetMachine::ARM_ABI_UNKNOWN;