diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2007-03-25 15:07:15 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2007-03-25 15:07:15 +0000 |
commit | 3a84b9baf67c938454840d10d9e53269c755cd3e (patch) | |
tree | ba5473b360afdaa339d52e7bcfb037e1a1bd69f5 /include/llvm/CodeGen/SelectionDAGISel.h | |
parent | 4be4e51a50c7fc7f73b2feaf129b67156dadc948 (diff) | |
download | llvm-3a84b9baf67c938454840d10d9e53269c755cd3e.tar.gz llvm-3a84b9baf67c938454840d10d9e53269c755cd3e.tar.bz2 llvm-3a84b9baf67c938454840d10d9e53269c755cd3e.tar.xz |
First step of switch lowering refactoring: perform worklist-driven
strategy, emit JT's where possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/SelectionDAGISel.h')
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGISel.h | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h index 6ffe86a41e..8e0cad2335 100644 --- a/include/llvm/CodeGen/SelectionDAGISel.h +++ b/include/llvm/CodeGen/SelectionDAGISel.h @@ -42,8 +42,7 @@ public: std::vector<SDNode*> TopOrder; unsigned DAGSize; - explicit SelectionDAGISel(TargetLowering &tli) - : TLI(tli), DAGSize(0), JT(0,0,0,0) {} + explicit SelectionDAGISel(TargetLowering &tli) : TLI(tli), DAGSize(0) {} TargetLowering &getTargetLowering() { return TLI; } @@ -99,19 +98,31 @@ public: }; 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. + 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. + /// 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. + /// 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. + /// 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; }; - + struct JumpTableHeader { + JumpTableHeader(uint64_t F, uint64_t L, Value* SV, MachineBasicBlock* H, + bool E = false): + First(F), Last(L), SValue(SV), HeaderBB(H), Emitted(E) {}; + uint64_t First; + uint64_t Last; + Value *SValue; + MachineBasicBlock *HeaderBB; + bool Emitted; + }; + typedef std::pair<JumpTableHeader, JumpTable> JumpTableBlock; + protected: /// Pick a safe ordering and emit instructions for each target node in the /// graph. @@ -141,8 +152,9 @@ private: /// SwitchInst code generation information. std::vector<CaseBlock> SwitchCases; - /// JT - Record which holds necessary information for emitting a jump table - JumpTable JT; + /// JTCases - Vector of JumpTable structures which holds necessary information + /// for emitting a jump tables during SwitchInst code generation. + std::vector<JumpTableBlock> JTCases; }; } |