aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM/ARMTargetMachine.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-06-09 01:46:50 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-06-09 01:46:50 +0000
commit8bf0e4870680e0e6043b8696b22b82eaf93cfd6c (patch)
tree145a6dcf84fe04b550119feb6eea2bef67ec8f76 /lib/Target/ARM/ARMTargetMachine.cpp
parentc1c576af0c3dbed0f644115a144b0b50ac0e1d29 (diff)
downloadexternal_llvm-8bf0e4870680e0e6043b8696b22b82eaf93cfd6c.zip
external_llvm-8bf0e4870680e0e6043b8696b22b82eaf93cfd6c.tar.gz
external_llvm-8bf0e4870680e0e6043b8696b22b82eaf93cfd6c.tar.bz2
Thumb2 IT blocks are fairly expensive. When there are multiple selects using
the same condition, it's important to make sure they are scheduled together to avoid forming multiple IT blocks. I'm adding a pre-regalloc pass that forms IT blocks early (by re-scheduling instructions and split basic blocks) to attempt to fix this. This is not turned on by default since I am not sure this is the right fix. Another issue is llvm selects are modeled as two-address conditional moves. This can be very bad when the copies before the conditional moves are not coalesced away. Teach IT formation pass to move the copies above the IT block (when legal) to avoid breaking the IT block. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105669 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMTargetMachine.cpp')
-rw-r--r--lib/Target/ARM/ARMTargetMachine.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp
index b4a9252..0060c23 100644
--- a/lib/Target/ARM/ARMTargetMachine.cpp
+++ b/lib/Target/ARM/ARMTargetMachine.cpp
@@ -16,11 +16,17 @@
#include "ARM.h"
#include "llvm/PassManager.h"
#include "llvm/CodeGen/Passes.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetRegistry.h"
using namespace llvm;
+static cl::opt<bool>
+EarlyITBlockFormation("thumb2-early-it-blocks", cl::Hidden,
+ cl::desc("Form IT blocks earlt, before register allocation"),
+ cl::init(false));
+
static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) {
Triple TheTriple(TT);
switch (TheTriple.getOS()) {
@@ -98,6 +104,10 @@ bool ARMBaseTargetMachine::addPreRegAlloc(PassManagerBase &PM,
// FIXME: temporarily disabling load / store optimization pass for Thumb1.
if (OptLevel != CodeGenOpt::None && !Subtarget.isThumb1Only())
PM.add(createARMLoadStoreOptimizationPass(true));
+
+ if (OptLevel != CodeGenOpt::None && Subtarget.isThumb2() &&
+ EarlyITBlockFormation)
+ PM.add(createThumb2ITBlockPass(true));
return true;
}