summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Lanai
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2016-09-14 17:23:48 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2016-09-14 17:23:48 +0000
commita2b036e88b8f31c4a2169c1d5634e21c9c8eb927 (patch)
tree42c193d75f862e2c4580fe41e0da38f3a3d5765c /llvm/lib/Target/Lanai
parentc531c9ebf555c2c96d62e2d0e956697fe7011cc3 (diff)
downloadbcm5719-llvm-a2b036e88b8f31c4a2169c1d5634e21c9c8eb927.tar.gz
bcm5719-llvm-a2b036e88b8f31c4a2169c1d5634e21c9c8eb927.zip
AArch64: Use TTI branch functions in branch relaxation
The main change is to return the code size from InsertBranch/RemoveBranch. Patch mostly by Tim Northover llvm-svn: 281505
Diffstat (limited to 'llvm/lib/Target/Lanai')
-rw-r--r--llvm/lib/Target/Lanai/LanaiInstrInfo.cpp9
-rw-r--r--llvm/lib/Target/Lanai/LanaiInstrInfo.h6
2 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/Target/Lanai/LanaiInstrInfo.cpp b/llvm/lib/Target/Lanai/LanaiInstrInfo.cpp
index 673d23daf88..a626da225f1 100644
--- a/llvm/lib/Target/Lanai/LanaiInstrInfo.cpp
+++ b/llvm/lib/Target/Lanai/LanaiInstrInfo.cpp
@@ -662,9 +662,11 @@ unsigned LanaiInstrInfo::InsertBranch(MachineBasicBlock &MBB,
MachineBasicBlock *TrueBlock,
MachineBasicBlock *FalseBlock,
ArrayRef<MachineOperand> Condition,
- const DebugLoc &DL) const {
+ const DebugLoc &DL,
+ int *BytesAdded) const {
// Shouldn't be a fall through.
assert(TrueBlock && "InsertBranch must not be told to insert a fallthrough");
+ assert(!BytesAdded && "code size not handled");
// If condition is empty then an unconditional branch is being inserted.
if (Condition.empty()) {
@@ -688,7 +690,10 @@ unsigned LanaiInstrInfo::InsertBranch(MachineBasicBlock &MBB,
return 2;
}
-unsigned LanaiInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
+unsigned LanaiInstrInfo::RemoveBranch(MachineBasicBlock &MBB,
+ int *BytesRemoved) const {
+ assert(!BytesRemoved && "code size not handled");
+
MachineBasicBlock::iterator Instruction = MBB.end();
unsigned Count = 0;
diff --git a/llvm/lib/Target/Lanai/LanaiInstrInfo.h b/llvm/lib/Target/Lanai/LanaiInstrInfo.h
index 51f6c6ea436..fc845f7ac99 100644
--- a/llvm/lib/Target/Lanai/LanaiInstrInfo.h
+++ b/llvm/lib/Target/Lanai/LanaiInstrInfo.h
@@ -86,7 +86,8 @@ public:
SmallVectorImpl<MachineOperand> &Condition,
bool AllowModify) const override;
- unsigned RemoveBranch(MachineBasicBlock &MBB) const override;
+ unsigned RemoveBranch(MachineBasicBlock &MBB,
+ int *BytesRemoved = nullptr) const override;
// For a comparison instruction, return the source registers in SrcReg and
// SrcReg2 if having two register operands, and the value it compares against
@@ -135,7 +136,8 @@ public:
unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TrueBlock,
MachineBasicBlock *FalseBlock,
ArrayRef<MachineOperand> Condition,
- const DebugLoc &DL) const override;
+ const DebugLoc &DL,
+ int *BytesAdded = nullptr) const override;
};
static inline bool isSPLSOpcode(unsigned Opcode) {
OpenPOWER on IntegriCloud