mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-03 14:31:10 +00:00
generalize 'CaseBlock'. It really allows any comparison to be inserted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31161 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
578e64a041
commit
7b248d9866
@ -82,20 +82,19 @@ public:
|
|||||||
/// SDISel for the code generation of additional basic blocks needed by multi-
|
/// SDISel for the code generation of additional basic blocks needed by multi-
|
||||||
/// case switch statements.
|
/// case switch statements.
|
||||||
struct CaseBlock {
|
struct CaseBlock {
|
||||||
CaseBlock(ISD::CondCode cc, Value *s, Constant *c, MachineBasicBlock *lhs,
|
CaseBlock(ISD::CondCode cc, Value *cmplhs, Value *cmprhs,
|
||||||
MachineBasicBlock *rhs, MachineBasicBlock *me) :
|
MachineBasicBlock *lhs, MachineBasicBlock *rhs,
|
||||||
CC(cc), SwitchV(s), CaseC(c), LHSBB(lhs), RHSBB(rhs), ThisBB(me) {}
|
MachineBasicBlock *me) :
|
||||||
|
CC(cc), CmpLHS(cmplhs), CmpRHS(cmprhs), LHSBB(lhs), RHSBB(rhs), ThisBB(me){}
|
||||||
// CC - the condition code to use for the case block's setcc node
|
// CC - the condition code to use for the case block's setcc node
|
||||||
ISD::CondCode CC;
|
ISD::CondCode CC;
|
||||||
// SwitchV - the value to be switched on, 'foo' in switch(foo)
|
// CmpLHS/CmpRHS - The LHS/RHS of the comparison to emit.
|
||||||
Value *SwitchV;
|
Value *CmpLHS, *CmpRHS;
|
||||||
// CaseC - the constant the setcc node will compare against SwitchV
|
|
||||||
Constant *CaseC;
|
|
||||||
// LHSBB - the block to branch to if the setcc is true
|
// LHSBB - the block to branch to if the setcc is true
|
||||||
MachineBasicBlock *LHSBB;
|
MachineBasicBlock *LHSBB;
|
||||||
// RHSBB - the block to branch to if the setcc is false
|
// RHSBB - the block to branch to if the setcc is false
|
||||||
MachineBasicBlock *RHSBB;
|
MachineBasicBlock *RHSBB;
|
||||||
// ThisBB - the blcok into which to emit the code for the setcc and branches
|
// ThisBB - the block into which to emit the code for the setcc and branches
|
||||||
MachineBasicBlock *ThisBB;
|
MachineBasicBlock *ThisBB;
|
||||||
};
|
};
|
||||||
struct JumpTable {
|
struct JumpTable {
|
||||||
|
@ -819,9 +819,8 @@ void SelectionDAGLowering::visitBr(BranchInst &I) {
|
|||||||
/// visitSwitchCase - Emits the necessary code to represent a single node in
|
/// visitSwitchCase - Emits the necessary code to represent a single node in
|
||||||
/// the binary search tree resulting from lowering a switch instruction.
|
/// the binary search tree resulting from lowering a switch instruction.
|
||||||
void SelectionDAGLowering::visitSwitchCase(SelectionDAGISel::CaseBlock &CB) {
|
void SelectionDAGLowering::visitSwitchCase(SelectionDAGISel::CaseBlock &CB) {
|
||||||
SDOperand SwitchOp = getValue(CB.SwitchV);
|
SDOperand Cond = DAG.getSetCC(MVT::i1, getValue(CB.CmpLHS),
|
||||||
SDOperand CaseOp = getValue(CB.CaseC);
|
getValue(CB.CmpRHS), CB.CC);
|
||||||
SDOperand Cond = DAG.getSetCC(MVT::i1, SwitchOp, CaseOp, CB.CC);
|
|
||||||
|
|
||||||
// Set NextBlock to be the MBB immediately after the current one, if any.
|
// Set NextBlock to be the MBB immediately after the current one, if any.
|
||||||
// This is used to avoid emitting unnecessary branches to the next block.
|
// This is used to avoid emitting unnecessary branches to the next block.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user