aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@gmail.com>2011-03-28 10:23:13 +0000
committerChe-Liang Chiou <clchiou@gmail.com>2011-03-28 10:23:13 +0000
commitfb4a8344b6f4be1113498e6e69dc182408dc2ec9 (patch)
tree77318401a20b49d5fa1ad98e260668a62ebee3d1
parent282fdd381a344a0c85ddb025126b6db9485e2f88 (diff)
ptx: clean up branch code a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128405 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/PTX/PTXISelLowering.cpp2
-rw-r--r--lib/Target/PTX/PTXInstrInfo.cpp24
-rw-r--r--lib/Target/PTX/PTXInstrInfo.td7
3 files changed, 17 insertions, 16 deletions
diff --git a/lib/Target/PTX/PTXISelLowering.cpp b/lib/Target/PTX/PTXISelLowering.cpp
index a58cb80b28..7187518c52 100644
--- a/lib/Target/PTX/PTXISelLowering.cpp
+++ b/lib/Target/PTX/PTXISelLowering.cpp
@@ -56,8 +56,6 @@ SDValue PTXTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
llvm_unreachable("Unimplemented operand");
case ISD::GlobalAddress:
return LowerGlobalAddress(Op, DAG);
- case ISD::BRCOND:
- return LowerGlobalAddress(Op, DAG);
}
}
diff --git a/lib/Target/PTX/PTXInstrInfo.cpp b/lib/Target/PTX/PTXInstrInfo.cpp
index be31580677..e8675f27e4 100644
--- a/lib/Target/PTX/PTXInstrInfo.cpp
+++ b/lib/Target/PTX/PTXInstrInfo.cpp
@@ -247,11 +247,15 @@ AnalyzeBranch(MachineBasicBlock &MBB,
}
unsigned PTXInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
- unsigned count;
- for (count = 0; IsAnyKindOfBranch(MBB.back()); ++count)
- MBB.pop_back();
+ unsigned count = 0;
+ while (!MBB.empty())
+ if (IsAnyKindOfBranch(MBB.back())) {
+ MBB.pop_back();
+ ++count;
+ } else
+ break;
DEBUG(dbgs() << "RemoveBranch: MBB: " << MBB.getName().str() << "\n");
- DEBUG(dbgs() << "RemoveBranch: count: " << count << "\n");
+ DEBUG(dbgs() << "RemoveBranch: remove " << count << " branch inst\n");
return count;
}
@@ -262,12 +266,12 @@ InsertBranch(MachineBasicBlock &MBB,
const SmallVectorImpl<MachineOperand> &Cond,
DebugLoc DL) const {
DEBUG(dbgs() << "InsertBranch: MBB: " << MBB.getName().str() << "\n");
- DEBUG(if (TBB) dbgs() << "InsertBranch: TBB: "
- << TBB->getName().str() << "\n";
- else dbgs() << "InsertBranch: TBB: (NULL)\n");
- DEBUG(if (FBB) dbgs() << "InsertBranch: FBB: "
- << FBB->getName().str() << "\n";
- else dbgs() << "InsertBranch: FBB: (NULL)\n");
+ DEBUG(if (TBB) dbgs() << "InsertBranch: TBB: " << TBB->getName().str()
+ << "\n";
+ else dbgs() << "InsertBranch: TBB: (NULL)\n");
+ DEBUG(if (FBB) dbgs() << "InsertBranch: FBB: " << FBB->getName().str()
+ << "\n";
+ else dbgs() << "InsertBranch: FBB: (NULL)\n");
DEBUG(dbgs() << "InsertBranch: Cond size: " << Cond.size() << "\n");
assert(TBB && "TBB is NULL");
diff --git a/lib/Target/PTX/PTXInstrInfo.td b/lib/Target/PTX/PTXInstrInfo.td
index 7d9ca58c3c..f21c98d964 100644
--- a/lib/Target/PTX/PTXInstrInfo.td
+++ b/lib/Target/PTX/PTXInstrInfo.td
@@ -618,12 +618,11 @@ let isBranch = 1, isTerminator = 1, isBarrier = 1 in {
}
let isBranch = 1, isTerminator = 1 in {
- // FIXME: should be able to write a pattern for brcond, but can't use
- // a two-value operand where a dag node expects two operands. :(
- // NOTE: ARM & PowerPC backend also report the same problem
+ // FIXME: The pattern part is blank because I cannot (or do not yet know
+ // how to) use the first operand of PredicateOperand (a Preds register) here
def BRAdp
: InstPTX<(outs), (ins brtarget:$d), "bra\t$d",
- [/*(brcond bb:$d, Preds:$p, i32imm:$c)*/]>;
+ [/*(brcond pred:$_p, bb:$d)*/]>;
}
let isReturn = 1, isTerminator = 1, isBarrier = 1 in {