SelectionDAG *CurDAG;
MachineBasicBlock *BB;
- SelectionDAGISel(TargetLowering &tli) : TLI(tli) {}
+ SelectionDAGISel(TargetLowering &tli) : TLI(tli), JT(0,0,0,0) {}
+
+ TargetLowering &getTargetLowering() { return TLI; }
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
SelectionDAG &DAG) {
return true;
}
+
+ /// CanBeFoldedBy - Returns true if the specific operand node N of U can be
+ /// folded during instruction selection?
+ virtual bool CanBeFoldedBy(SDNode *N, SDNode *U) { return true; }
/// CreateTargetHazardRecognizer - Return a newly allocated hazard recognizer
/// to use for this target when scheduling the DAG.
// ThisBB - the blcok into which to emit the code for the setcc and branches
MachineBasicBlock *ThisBB;
};
+ struct JumpTable {
+ JumpTable(unsigned R, unsigned J, MachineBasicBlock *M,
+ MachineBasicBlock *D) : Reg(R), JTI(J), MBB(M), Default(D) {}
+ // Reg - the virtual register containing the index of the jump table entry
+ // to jump to.
+ unsigned Reg;
+ // JTI - the JumpTableIndex for this jump table in the function.
+ unsigned JTI;
+ // MBB - the MBB into which to emit the code for the indirect jump.
+ MachineBasicBlock *MBB;
+ // Default - the MBB of the default bb, which is a successor of the range
+ // check MBB. This is when updating PHI nodes in successors.
+ MachineBasicBlock *Default;
+ };
protected:
/// Pick a safe ordering and emit instructions for each target node in the
/// by tblgen. Others should not call it.
void SelectInlineAsmMemoryOperands(std::vector<SDOperand> &Ops,
SelectionDAG &DAG);
-
+
private:
SDOperand CopyValueToVirtualRegister(SelectionDAGLowering &SDL,
Value *V, unsigned Reg);
/// SwitchCases - Vector of CaseBlock structures used to communicate
/// SwitchInst code generation information.
std::vector<CaseBlock> SwitchCases;
+
+ /// JT - Record which holds necessary information for emitting a jump table
+ JumpTable JT;
};
}