mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-24 08:24:33 +00:00
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
This commit is contained in:
@ -179,11 +179,6 @@ TrapFuncName("trap-func", cl::Hidden,
|
|||||||
cl::desc("Emit a call to trap function rather than a trap instruction"),
|
cl::desc("Emit a call to trap function rather than a trap instruction"),
|
||||||
cl::init(""));
|
cl::init(""));
|
||||||
|
|
||||||
cl::opt<std::string>
|
|
||||||
ABIName("target-abi", cl::Hidden,
|
|
||||||
cl::desc("The name of the ABI to be targeted from the backend."),
|
|
||||||
cl::init(""));
|
|
||||||
|
|
||||||
cl::opt<bool>
|
cl::opt<bool>
|
||||||
EnablePIE("enable-pie",
|
EnablePIE("enable-pie",
|
||||||
cl::desc("Assume the creation of a position independent executable."),
|
cl::desc("Assume the creation of a position independent executable."),
|
||||||
@ -285,7 +280,6 @@ static inline TargetOptions InitTargetOptionsFromCodeGenFlags() {
|
|||||||
Options.DisableTailCalls = DisableTailCalls;
|
Options.DisableTailCalls = DisableTailCalls;
|
||||||
Options.StackAlignmentOverride = OverrideStackAlignment;
|
Options.StackAlignmentOverride = OverrideStackAlignment;
|
||||||
Options.TrapFuncName = TrapFuncName;
|
Options.TrapFuncName = TrapFuncName;
|
||||||
Options.ABIName = ABIName;
|
|
||||||
Options.PositionIndependentExecutable = EnablePIE;
|
Options.PositionIndependentExecutable = EnablePIE;
|
||||||
Options.UseInitArray = !UseCtors;
|
Options.UseInitArray = !UseCtors;
|
||||||
Options.DataSections = DataSections;
|
Options.DataSections = DataSections;
|
||||||
|
@ -10,8 +10,12 @@
|
|||||||
#ifndef LLVM_MC_MCTARGETOPTIONS_H
|
#ifndef LLVM_MC_MCTARGETOPTIONS_H
|
||||||
#define LLVM_MC_MCTARGETOPTIONS_H
|
#define LLVM_MC_MCTARGETOPTIONS_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
|
class StringRef;
|
||||||
|
|
||||||
class MCTargetOptions {
|
class MCTargetOptions {
|
||||||
public:
|
public:
|
||||||
enum AsmInstrumentation {
|
enum AsmInstrumentation {
|
||||||
@ -31,6 +35,11 @@ public:
|
|||||||
bool ShowMCInst : 1;
|
bool ShowMCInst : 1;
|
||||||
bool AsmVerbose : 1;
|
bool AsmVerbose : 1;
|
||||||
int DwarfVersion;
|
int DwarfVersion;
|
||||||
|
/// getABIName - If this returns a non-empty string this represents the
|
||||||
|
/// textual name of the ABI that we want the backend to use, e.g. o32, or
|
||||||
|
/// aapcs-linux.
|
||||||
|
StringRef getABIName() const;
|
||||||
|
std::string ABIName;
|
||||||
MCTargetOptions();
|
MCTargetOptions();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,7 +54,8 @@ inline bool operator==(const MCTargetOptions &LHS, const MCTargetOptions &RHS) {
|
|||||||
ARE_EQUAL(ShowMCEncoding) &&
|
ARE_EQUAL(ShowMCEncoding) &&
|
||||||
ARE_EQUAL(ShowMCInst) &&
|
ARE_EQUAL(ShowMCInst) &&
|
||||||
ARE_EQUAL(AsmVerbose) &&
|
ARE_EQUAL(AsmVerbose) &&
|
||||||
ARE_EQUAL(DwarfVersion));
|
ARE_EQUAL(DwarfVersion) &&
|
||||||
|
ARE_EQUAL(ABIName));
|
||||||
#undef ARE_EQUAL
|
#undef ARE_EQUAL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,11 @@ cl::opt<bool> ShowMCInst("asm-show-inst",
|
|||||||
cl::desc("Emit internal instruction representation to "
|
cl::desc("Emit internal instruction representation to "
|
||||||
"assembly file"));
|
"assembly file"));
|
||||||
|
|
||||||
|
cl::opt<std::string>
|
||||||
|
ABIName("target-abi", cl::Hidden,
|
||||||
|
cl::desc("The name of the ABI to be targeted from the backend."),
|
||||||
|
cl::init(""));
|
||||||
|
|
||||||
static inline MCTargetOptions InitMCTargetOptionsFromFlags() {
|
static inline MCTargetOptions InitMCTargetOptionsFromFlags() {
|
||||||
MCTargetOptions Options;
|
MCTargetOptions Options;
|
||||||
Options.SanitizeAddress =
|
Options.SanitizeAddress =
|
||||||
@ -47,6 +52,7 @@ static inline MCTargetOptions InitMCTargetOptionsFromFlags() {
|
|||||||
Options.MCRelaxAll = RelaxAll;
|
Options.MCRelaxAll = RelaxAll;
|
||||||
Options.DwarfVersion = DwarfVersion;
|
Options.DwarfVersion = DwarfVersion;
|
||||||
Options.ShowMCInst = ShowMCInst;
|
Options.ShowMCInst = ShowMCInst;
|
||||||
|
Options.ABIName = ABIName;
|
||||||
return Options;
|
return Options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ namespace llvm {
|
|||||||
UseInitArray(false), DisableIntegratedAS(false),
|
UseInitArray(false), DisableIntegratedAS(false),
|
||||||
CompressDebugSections(false), FunctionSections(false),
|
CompressDebugSections(false), FunctionSections(false),
|
||||||
DataSections(false), TrapUnreachable(false), TrapFuncName(),
|
DataSections(false), TrapUnreachable(false), TrapFuncName(),
|
||||||
ABIName(), FloatABIType(FloatABI::Default),
|
FloatABIType(FloatABI::Default),
|
||||||
AllowFPOpFusion(FPOpFusion::Standard), JTType(JumpTable::Single),
|
AllowFPOpFusion(FPOpFusion::Standard), JTType(JumpTable::Single),
|
||||||
FCFI(false), ThreadModel(ThreadModel::POSIX),
|
FCFI(false), ThreadModel(ThreadModel::POSIX),
|
||||||
CFIType(CFIntegrity::Sub), CFIEnforcing(false), CFIFuncName() {}
|
CFIType(CFIntegrity::Sub), CFIEnforcing(false), CFIFuncName() {}
|
||||||
@ -207,12 +207,6 @@ namespace llvm {
|
|||||||
std::string TrapFuncName;
|
std::string TrapFuncName;
|
||||||
StringRef getTrapFunctionName() const;
|
StringRef getTrapFunctionName() const;
|
||||||
|
|
||||||
/// getABIName - If this returns a non-empty string this represents the
|
|
||||||
/// textual name of the ABI that we want the backend to use, e.g. o32, or
|
|
||||||
/// aapcs-linux.
|
|
||||||
std::string ABIName;
|
|
||||||
StringRef getABIName() const;
|
|
||||||
|
|
||||||
/// FloatABIType - This setting is set by -float-abi=xxx option is specfied
|
/// FloatABIType - This setting is set by -float-abi=xxx option is specfied
|
||||||
/// on the command line. This setting may either be Default, Soft, or Hard.
|
/// on the command line. This setting may either be Default, Soft, or Hard.
|
||||||
/// Default selects the target's default behavior. Soft selects the ABI for
|
/// Default selects the target's default behavior. Soft selects the ABI for
|
||||||
@ -292,7 +286,6 @@ inline bool operator==(const TargetOptions &LHS,
|
|||||||
ARE_EQUAL(UseInitArray) &&
|
ARE_EQUAL(UseInitArray) &&
|
||||||
ARE_EQUAL(TrapUnreachable) &&
|
ARE_EQUAL(TrapUnreachable) &&
|
||||||
ARE_EQUAL(TrapFuncName) &&
|
ARE_EQUAL(TrapFuncName) &&
|
||||||
ARE_EQUAL(ABIName) &&
|
|
||||||
ARE_EQUAL(FloatABIType) &&
|
ARE_EQUAL(FloatABIType) &&
|
||||||
ARE_EQUAL(AllowFPOpFusion) &&
|
ARE_EQUAL(AllowFPOpFusion) &&
|
||||||
ARE_EQUAL(JTType) &&
|
ARE_EQUAL(JTType) &&
|
||||||
|
@ -58,10 +58,3 @@ StringRef TargetOptions::getTrapFunctionName() const {
|
|||||||
StringRef TargetOptions::getCFIFuncName() const {
|
StringRef TargetOptions::getCFIFuncName() const {
|
||||||
return CFIFuncName;
|
return CFIFuncName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getABIName - If this returns a non-empty string this represents the
|
|
||||||
/// textual name of the ABI that we want the backend to use, e.g. o32, or
|
|
||||||
/// aapcs-linux.
|
|
||||||
StringRef TargetOptions::getABIName() const {
|
|
||||||
return ABIName;
|
|
||||||
}
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include "llvm/MC/MCTargetOptions.h"
|
#include "llvm/MC/MCTargetOptions.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -15,6 +16,10 @@ MCTargetOptions::MCTargetOptions()
|
|||||||
: SanitizeAddress(false), MCRelaxAll(false), MCNoExecStack(false),
|
: SanitizeAddress(false), MCRelaxAll(false), MCNoExecStack(false),
|
||||||
MCFatalWarnings(false), MCSaveTempLabels(false),
|
MCFatalWarnings(false), MCSaveTempLabels(false),
|
||||||
MCUseDwarfDirectory(false), ShowMCEncoding(false), ShowMCInst(false),
|
MCUseDwarfDirectory(false), ShowMCEncoding(false), ShowMCInst(false),
|
||||||
AsmVerbose(false), DwarfVersion(0) {}
|
AsmVerbose(false), DwarfVersion(0), ABIName() {}
|
||||||
|
|
||||||
|
StringRef MCTargetOptions::getABIName() const {
|
||||||
|
return ABIName;
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
@ -55,12 +55,13 @@ static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
|
|||||||
static ARMBaseTargetMachine::ARMABI
|
static ARMBaseTargetMachine::ARMABI
|
||||||
computeTargetABI(const Triple &TT, StringRef CPU,
|
computeTargetABI(const Triple &TT, StringRef CPU,
|
||||||
const TargetOptions &Options) {
|
const TargetOptions &Options) {
|
||||||
if (Options.getABIName().startswith("aapcs"))
|
if (Options.MCOptions.getABIName().startswith("aapcs"))
|
||||||
return ARMBaseTargetMachine::ARM_ABI_AAPCS;
|
return ARMBaseTargetMachine::ARM_ABI_AAPCS;
|
||||||
else if (Options.getABIName().startswith("apcs"))
|
else if (Options.MCOptions.getABIName().startswith("apcs"))
|
||||||
return ARMBaseTargetMachine::ARM_ABI_APCS;
|
return ARMBaseTargetMachine::ARM_ABI_APCS;
|
||||||
|
|
||||||
assert(Options.getABIName().empty() && "Unknown target-abi option!");
|
assert(Options.MCOptions.getABIName().empty() &&
|
||||||
|
"Unknown target-abi option!");
|
||||||
|
|
||||||
ARMBaseTargetMachine::ARMABI TargetABI =
|
ARMBaseTargetMachine::ARMABI TargetABI =
|
||||||
ARMBaseTargetMachine::ARM_ABI_UNKNOWN;
|
ARMBaseTargetMachine::ARM_ABI_UNKNOWN;
|
||||||
|
Reference in New Issue
Block a user