aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-04-07 00:58:44 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-04-07 00:58:44 +0000
commit2c69f8eec6a51114799e3e80fa4903c5e3fc429c (patch)
tree9fa488c8ce9dc402a57a02b3616aefc007bc12b8
parent1adb47cc11e708e6009007eeab58caf4310df30f (diff)
Change -arm-divmod-libcall to a target neutral option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129045 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetOptions.h4
-rw-r--r--lib/Target/ARM/ARMISelLowering.cpp7
-rw-r--r--lib/Target/TargetMachine.cpp6
-rw-r--r--test/CodeGen/ARM/divmod.ll2
4 files changed, 12 insertions, 7 deletions
diff --git a/include/llvm/Target/TargetOptions.h b/include/llvm/Target/TargetOptions.h
index 97ceffdaec..fc80a06deb 100644
--- a/include/llvm/Target/TargetOptions.h
+++ b/include/llvm/Target/TargetOptions.h
@@ -157,6 +157,10 @@ namespace llvm {
/// wth earlier copy coalescing.
extern bool StrongPHIElim;
+ /// HasDivModLibcall - This flag indicates whether the target compiler
+ /// runtime library has integer divmod libcalls.
+ extern bool HasDivModLibcall;
+
} // End llvm namespace
#endif
diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp
index 6ff57522f0..d030f68528 100644
--- a/lib/Target/ARM/ARMISelLowering.cpp
+++ b/lib/Target/ARM/ARMISelLowering.cpp
@@ -72,11 +72,6 @@ ARMInterworking("arm-interworking", cl::Hidden,
cl::desc("Enable / disable ARM interworking (for debugging only)"),
cl::init(true));
-static cl::opt<bool>
-UseDivMod("arm-divmod-libcall", cl::Hidden,
- cl::desc("Use __{u}divmod libcalls for div / rem pairs"),
- cl::init(false));
-
void ARMTargetLowering::addTypeForNEON(EVT VT, EVT PromotedLdStVT,
EVT PromotedBitwiseVT) {
if (VT != PromotedLdStVT) {
@@ -398,7 +393,7 @@ ARMTargetLowering::ARMTargetLowering(TargetMachine &TM)
setLibcallCallingConv(RTLIB::UDIV_I32, CallingConv::ARM_AAPCS);
}
- if (UseDivMod) {
+ if (HasDivModLibcall) {
setLibcallName(RTLIB::SDIVREM_I32, "__divmodsi4");
setLibcallName(RTLIB::UDIVREM_I32, "__udivmodsi4");
}
diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp
index 681842ea6b..8c7330a77c 100644
--- a/lib/Target/TargetMachine.cpp
+++ b/lib/Target/TargetMachine.cpp
@@ -48,6 +48,7 @@ namespace llvm {
bool RealignStack;
bool DisableJumpTables;
bool StrongPHIElim;
+ bool HasDivModLibcall;
bool AsmVerbosityDefault(false);
}
@@ -205,6 +206,11 @@ EnableStrongPHIElim(cl::Hidden, "strong-phi-elim",
cl::desc("Use strong PHI elimination."),
cl::location(StrongPHIElim),
cl::init(false));
+static cl::opt<bool, true>
+UseDivMod("use-divmod-libcall",
+ cl::desc("Use __{u}divmod libcalls for div / rem pairs"),
+ cl::location(HasDivModLibcall),
+ cl::init(false));
static cl::opt<bool>
DataSections("fdata-sections",
cl::desc("Emit data into separate sections"),
diff --git a/test/CodeGen/ARM/divmod.ll b/test/CodeGen/ARM/divmod.ll
index 9b5129771f..04b8fbf0f0 100644
--- a/test/CodeGen/ARM/divmod.ll
+++ b/test/CodeGen/ARM/divmod.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=arm-apple-darwin -arm-divmod-libcall | FileCheck %s
+; RUN: llc < %s -mtriple=arm-apple-darwin -use-divmod-libcall | FileCheck %s
define void @foo(i32 %x, i32 %y, i32* nocapture %P) nounwind ssp {
entry: