summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Sparc/SparcInstrInfo.h
diff options
context:
space:
mode:
authorJames Y Knight <jyknight@google.com>2016-01-13 04:44:14 +0000
committerJames Y Knight <jyknight@google.com>2016-01-13 04:44:14 +0000
commit7699494f0847665631cfbf9bae5190ed11e98cf4 (patch)
tree6cd68e6dd38d3e0bc79602403cb4392fc25ec722 /llvm/lib/Target/Sparc/SparcInstrInfo.h
parent81f18a58f1ccf52dd9225e82b7e90169f2ffb864 (diff)
downloadbcm5719-llvm-7699494f0847665631cfbf9bae5190ed11e98cf4.tar.gz
bcm5719-llvm-7699494f0847665631cfbf9bae5190ed11e98cf4.zip
[SPARC] Revamp AnalyzeBranch and add ReverseBranchCondition.
AnalyzeBranch on X86 (and, previously, SPARC, which implementation was copied from X86) tries to modify the branches based on block layout (e.g. checking isLayoutSuccessor), when AllowModify is true. The rest of the architectures leave that up to the caller, which can call InsertBranch, RemoveBranch, and ReverseBranchCondition as appropriate. That appears to be the preferred way to do it nowadays. This commit makes SPARC like the rest: replaces AnalyzeBranch with an implementation cribbed from AArch64, and adds a ReverseBranchCondition implementation. Additionally, a test-case has been added (also cribbed from AArch64) demonstrating that redundant branch sequences no longer get emitted. E.g., it used to emit code like this: bne .LBB1_2 nop ba .LBB1_1 nop .LBB1_2: And now emits: cmp %i0, 42 be .LBB1_1 nop llvm-svn: 257572
Diffstat (limited to 'llvm/lib/Target/Sparc/SparcInstrInfo.h')
-rw-r--r--llvm/lib/Target/Sparc/SparcInstrInfo.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Target/Sparc/SparcInstrInfo.h b/llvm/lib/Target/Sparc/SparcInstrInfo.h
index 15673f134d8..9de624cc958 100644
--- a/llvm/lib/Target/Sparc/SparcInstrInfo.h
+++ b/llvm/lib/Target/Sparc/SparcInstrInfo.h
@@ -76,6 +76,9 @@ public:
MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
DebugLoc DL) const override;
+ bool
+ ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;
+
void copyPhysReg(MachineBasicBlock &MBB,
MachineBasicBlock::iterator I, DebugLoc DL,
unsigned DestReg, unsigned SrcReg,
OpenPOWER on IntegriCloud