From 024d91a00b8580ad9a59a350ebbba157531bde2e Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Thu, 16 Jul 2015 00:58:23 +0000 Subject: [ARM] Define a subtarget feature that is used to avoid using movt/movw pairs for 32-bit immediates. This change is needed to avoid emitting movt/movw pairs when doing LTO and do so on a per-function basis. Out-of-tree projects currently using cl::opt option -arm-use-movt=0 or false to avoid emitting movt/movw pairs should make changes to add subtarget feature "+no-movt" (see the changes made to clang in r242368). rdar://problem/21529937 Differential Revision: http://reviews.llvm.org/D11026 llvm-svn: 242369 --- llvm/lib/Target/ARM/ARMSubtarget.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'llvm/lib/Target/ARM/ARMSubtarget.cpp') diff --git a/llvm/lib/Target/ARM/ARMSubtarget.cpp b/llvm/lib/Target/ARM/ARMSubtarget.cpp index 002c3e9b629..31b65f2bfec 100644 --- a/llvm/lib/Target/ARM/ARMSubtarget.cpp +++ b/llvm/lib/Target/ARM/ARMSubtarget.cpp @@ -43,9 +43,6 @@ static cl::opt ReserveR9("arm-reserve-r9", cl::Hidden, cl::desc("Reserve R9, making it unavailable as GPR")); -static cl::opt -ArmUseMOVT("arm-use-movt", cl::init(true), cl::Hidden); - static cl::opt UseFusedMulOps("arm-use-mulops", cl::init(true), cl::Hidden); @@ -148,7 +145,7 @@ void ARMSubtarget::initializeEnvironment() { HasThumb2 = false; NoARM = false; IsR9Reserved = ReserveR9; - UseMovt = false; + NoMovt = false; SupportsTailCall = false; HasFP16 = false; HasD16 = false; @@ -215,8 +212,6 @@ void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { if (isTargetNaCl()) stackAlignment = 16; - UseMovt = hasV6T2Ops() && ArmUseMOVT; - if (isTargetMachO()) { IsR9Reserved = ReserveR9 || !HasV6Ops; SupportsTailCall = !isTargetIOS() || !getTargetTriple().isOSVersionLT(5, 0); @@ -337,8 +332,9 @@ bool ARMSubtarget::useMovt(const MachineFunction &MF) const { // NOTE Windows on ARM needs to use mov.w/mov.t pairs to materialise 32-bit // immediates as it is inherently position independent, and may be out of // range otherwise. - return UseMovt && (isTargetWindows() || - !MF.getFunction()->hasFnAttribute(Attribute::MinSize)); + return !NoMovt && hasV6T2Ops() && + (isTargetWindows() || + !MF.getFunction()->hasFnAttribute(Attribute::MinSize)); } bool ARMSubtarget::useFastISel() const { -- cgit v1.2.3