forked from OSchip/llvm-project
ARM: deduplicate hard-float detection code. NFC.
ARMSubtarget had a copy/pasted block to determine whether the target was hard-float, but it just delegated to triple features anyway so it's better at the TargetMachine level. llvm-svn: 337384
This commit is contained in:
parent
330d887d72
commit
097a3e3d95
|
@ -302,6 +302,8 @@ void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
|
|||
}
|
||||
}
|
||||
|
||||
bool ARMSubtarget::isTargetHardFloat() const { return TM.isTargetHardFloat(); }
|
||||
|
||||
bool ARMSubtarget::isAPCS_ABI() const {
|
||||
assert(TM.TargetABI != ARMBaseTargetMachine::ARM_ABI_UNKNOWN);
|
||||
return TM.TargetABI == ARMBaseTargetMachine::ARM_ABI_APCS;
|
||||
|
|
|
@ -666,13 +666,7 @@ public:
|
|||
!isTargetDarwin() && !isTargetWindows();
|
||||
}
|
||||
|
||||
bool isTargetHardFloat() const {
|
||||
// FIXME: this is invalid for WindowsCE
|
||||
return TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
|
||||
TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
|
||||
TargetTriple.getEnvironment() == Triple::EABIHF ||
|
||||
isTargetWindows() || isAAPCS16_ABI();
|
||||
}
|
||||
bool isTargetHardFloat() const;
|
||||
|
||||
bool isTargetAndroid() const { return TargetTriple.isAndroid(); }
|
||||
|
||||
|
|
|
@ -215,11 +215,7 @@ ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T, const Triple &TT,
|
|||
|
||||
// Default to triple-appropriate float ABI
|
||||
if (Options.FloatABIType == FloatABI::Default) {
|
||||
if (TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
|
||||
TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
|
||||
TargetTriple.getEnvironment() == Triple::EABIHF ||
|
||||
TargetTriple.isOSWindows() ||
|
||||
TargetABI == ARMBaseTargetMachine::ARM_ABI_AAPCS16)
|
||||
if (isTargetHardFloat())
|
||||
this->Options.FloatABIType = FloatABI::Hard;
|
||||
else
|
||||
this->Options.FloatABIType = FloatABI::Soft;
|
||||
|
|
|
@ -61,6 +61,14 @@ public:
|
|||
TargetLoweringObjectFile *getObjFileLowering() const override {
|
||||
return TLOF.get();
|
||||
}
|
||||
|
||||
bool isTargetHardFloat() const {
|
||||
return TargetTriple.getEnvironment() == Triple::GNUEABIHF ||
|
||||
TargetTriple.getEnvironment() == Triple::MuslEABIHF ||
|
||||
TargetTriple.getEnvironment() == Triple::EABIHF ||
|
||||
TargetTriple.isOSWindows() ||
|
||||
TargetABI == ARMBaseTargetMachine::ARM_ABI_AAPCS16;
|
||||
}
|
||||
};
|
||||
|
||||
/// ARM/Thumb little endian target machine.
|
||||
|
|
Loading…
Reference in New Issue