aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-07-26 17:32:14 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-07-26 17:32:14 +0000
commit12515799e3d6b50788abe5fc5bd400e65987f194 (patch)
tree49d981374f97e8adb8eff702a0fa92066155dc5c /lib
parentc7b7250e31b71a4eea8c81780ed9add67c156d37 (diff)
downloadexternal_llvm-12515799e3d6b50788abe5fc5bd400e65987f194.zip
external_llvm-12515799e3d6b50788abe5fc5bd400e65987f194.tar.gz
external_llvm-12515799e3d6b50788abe5fc5bd400e65987f194.tar.bz2
Don't pollute the meaning of isUnpredicatedTerminator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/X86InstrInfo.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp
index 06b14fe..d0a0a09 100644
--- a/lib/Target/X86/X86InstrInfo.cpp
+++ b/lib/Target/X86/X86InstrInfo.cpp
@@ -402,11 +402,7 @@ X86::CondCode X86::GetOppositeBranchCondition(X86::CondCode CC) {
}
}
-// For purposes of branch analysis do not count FP_REG_KILL as a terminator.
bool X86InstrInfo::isUnpredicatedTerminator(const MachineInstr *MI) const {
- if (MI->getOpcode() == X86::FP_REG_KILL)
- return false;
-
const TargetInstrDescriptor *TID = MI->getInstrDescriptor();
if (TID->Flags & M_TERMINATOR_FLAG) {
// Conditional branch is a special case.
@@ -419,20 +415,28 @@ bool X86InstrInfo::isUnpredicatedTerminator(const MachineInstr *MI) const {
return false;
}
+// For purposes of branch analysis do not count FP_REG_KILL as a terminator.
+static bool isBrAnalysisUnpredicatedTerminator(const MachineInstr *MI,
+ const X86InstrInfo &TII) {
+ if (MI->getOpcode() == X86::FP_REG_KILL)
+ return false;
+ return TII.isUnpredicatedTerminator(MI);
+}
+
bool X86InstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
std::vector<MachineOperand> &Cond) const {
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
- if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
+ if (I == MBB.begin() || !isBrAnalysisUnpredicatedTerminator(--I, *this))
return false;
// Get the last instruction in the block.
MachineInstr *LastInst = I;
// If there is only one terminator instruction, process it.
- if (I == MBB.begin() || !isUnpredicatedTerminator(--I)) {
+ if (I == MBB.begin() || !isBrAnalysisUnpredicatedTerminator(--I, *this)) {
if (!isBranch(LastInst->getOpcode()))
return true;
@@ -457,7 +461,8 @@ bool X86InstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
MachineInstr *SecondLastInst = I;
// If there are three terminators, we don't know what sort of block this is.
- if (SecondLastInst && I != MBB.begin() && isUnpredicatedTerminator(--I))
+ if (SecondLastInst && I != MBB.begin() &&
+ isBrAnalysisUnpredicatedTerminator(--I, *this))
return true;
// If the block ends with X86::JMP and a conditional branch, handle it.