[llvm-commits] [llvm] r128405 - in /llvm/trunk/lib/Target/PTX: PTXISelLowering.cpp PTXInstrInfo.cpp PTXInstrInfo.td
Che-Liang Chiou
clchiou at gmail.com
Mon Mar 28 03:23:13 PDT 2011
Author: clchiou
Date: Mon Mar 28 05:23:13 2011
New Revision: 128405
URL: http://llvm.org/viewvc/llvm-project?rev=128405&view=rev
Log:
ptx: clean up branch code a bit
Modified:
llvm/trunk/lib/Target/PTX/PTXISelLowering.cpp
llvm/trunk/lib/Target/PTX/PTXInstrInfo.cpp
llvm/trunk/lib/Target/PTX/PTXInstrInfo.td
Modified: llvm/trunk/lib/Target/PTX/PTXISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXISelLowering.cpp?rev=128405&r1=128404&r2=128405&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PTX/PTXISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PTX/PTXISelLowering.cpp Mon Mar 28 05:23:13 2011
@@ -56,8 +56,6 @@
llvm_unreachable("Unimplemented operand");
case ISD::GlobalAddress:
return LowerGlobalAddress(Op, DAG);
- case ISD::BRCOND:
- return LowerGlobalAddress(Op, DAG);
}
}
Modified: llvm/trunk/lib/Target/PTX/PTXInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXInstrInfo.cpp?rev=128405&r1=128404&r2=128405&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PTX/PTXInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/PTX/PTXInstrInfo.cpp Mon Mar 28 05:23:13 2011
@@ -247,11 +247,15 @@
}
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 @@
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");
Modified: llvm/trunk/lib/Target/PTX/PTXInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXInstrInfo.td?rev=128405&r1=128404&r2=128405&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PTX/PTXInstrInfo.td (original)
+++ llvm/trunk/lib/Target/PTX/PTXInstrInfo.td Mon Mar 28 05:23:13 2011
@@ -618,12 +618,11 @@
}
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 {
More information about the llvm-commits
mailing list