summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-10-28 17:29:57 +0000
committerChris Lattner <sabre@nondot.org>2006-10-28 17:29:57 +0000
commit53ebf20c266ec23b3f19ddd03926458e2d64ce88 (patch)
treea2ff616b9b0da45790951351d2b89b1d1e3e24c7 /llvm/lib
parenteef273a16f23c13c2c2142f557b0a7482f5b8444 (diff)
downloadbcm5719-llvm-53ebf20c266ec23b3f19ddd03926458e2d64ce88.tar.gz
bcm5719-llvm-53ebf20c266ec23b3f19ddd03926458e2d64ce88.zip
add another target hook for branch folding.
llvm-svn: 31262
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86InstrInfo.cpp12
-rw-r--r--llvm/lib/Target/X86/X86InstrInfo.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp
index e89493bff3c..f34f00a32f5 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.cpp
+++ b/llvm/lib/Target/X86/X86InstrInfo.cpp
@@ -420,6 +420,18 @@ void X86InstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
BuildMI(&MBB, X86::JMP, 1).addMBB(FBB);
}
+bool X86InstrInfo::BlockHasNoFallThrough(MachineBasicBlock &MBB) const {
+ if (MBB.empty()) return false;
+
+ switch (MBB.back().getOpcode()) {
+ case X86::JMP: // Uncond branch.
+ case X86::JMP32r: // Indirect branch.
+ case X86::JMP32m: // Indirect branch through mem.
+ return true;
+ default: return false;
+ }
+}
+
bool X86InstrInfo::
ReverseBranchCondition(std::vector<MachineOperand> &Cond) const {
assert(Cond.size() == 1 && "Invalid X86 branch condition!");
diff --git a/llvm/lib/Target/X86/X86InstrInfo.h b/llvm/lib/Target/X86/X86InstrInfo.h
index 9886db301c0..c9ce1fc920b 100644
--- a/llvm/lib/Target/X86/X86InstrInfo.h
+++ b/llvm/lib/Target/X86/X86InstrInfo.h
@@ -267,6 +267,7 @@ public:
virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
const std::vector<MachineOperand> &Cond) const;
+ virtual bool BlockHasNoFallThrough(MachineBasicBlock &MBB) const;
virtual bool ReverseBranchCondition(std::vector<MachineOperand> &Cond) const;
const TargetRegisterClass *getPointerRegClass() const;
OpenPOWER on IntegriCloud