mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Move ABI handling and 64-bitness to the PowerPC target machine.
This required changing how the computation of the ABI is handled and how some of the checks for ABI/target are done. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229471 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -123,6 +123,30 @@ static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
|
||||
return make_unique<PPC64LinuxTargetObjectFile>();
|
||||
}
|
||||
|
||||
static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
|
||||
const TargetOptions &Options) {
|
||||
if (Options.MCOptions.getABIName().startswith("elfv1"))
|
||||
return PPCTargetMachine::PPC_ABI_ELFv1;
|
||||
else if (Options.MCOptions.getABIName().startswith("elfv2"))
|
||||
return PPCTargetMachine::PPC_ABI_ELFv2;
|
||||
|
||||
assert(Options.MCOptions.getABIName().empty() &&
|
||||
"Unknown target-abi option!");
|
||||
|
||||
if (!TT.isMacOSX()) {
|
||||
switch (TT.getArch()) {
|
||||
case Triple::ppc64le:
|
||||
return PPCTargetMachine::PPC_ABI_ELFv2;
|
||||
case Triple::ppc64:
|
||||
return PPCTargetMachine::PPC_ABI_ELFv1;
|
||||
default:
|
||||
// Fallthrough.
|
||||
;
|
||||
}
|
||||
}
|
||||
return PPCTargetMachine::PPC_ABI_UNKNOWN;
|
||||
}
|
||||
|
||||
// The FeatureString here is a little subtle. We are modifying the feature string
|
||||
// with what are (currently) non-function specific overrides as it goes into the
|
||||
// LLVMTargetMachine constructor and then using the stored value in the
|
||||
@@ -134,6 +158,7 @@ PPCTargetMachine::PPCTargetMachine(const Target &T, StringRef TT, StringRef CPU,
|
||||
: LLVMTargetMachine(T, TT, CPU, computeFSAdditions(FS, OL, TT), Options, RM,
|
||||
CM, OL),
|
||||
TLOF(createTLOF(Triple(getTargetTriple()))),
|
||||
TargetABI(computeTargetABI(Triple(TT), Options)),
|
||||
DL(getDataLayoutString(Triple(TT))), Subtarget(TT, CPU, TargetFS, *this) {
|
||||
initAsmInfo();
|
||||
}
|
||||
|
Reference in New Issue
Block a user