OLD | NEW |
1 //===------ subzero/src/IcePhiLoweringImpl.h - Phi lowering -----*- C++ -*-===// | 1 //===------ subzero/src/IcePhiLoweringImpl.h - Phi lowering -----*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
11 /// This contains utilities for targets to lower Phis. | 11 /// This contains utilities for targets to lower Phis. |
12 /// | 12 /// |
13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
14 | 14 |
15 #ifndef SUBZERO_SRC_ICEPHILOWERINGIMPL_H | 15 #ifndef SUBZERO_SRC_ICEPHILOWERINGIMPL_H |
16 #define SUBZERO_SRC_ICEPHILOWERINGIMPL_H | 16 #define SUBZERO_SRC_ICEPHILOWERINGIMPL_H |
17 | 17 |
18 #include "IceCfg.h" | 18 #include "IceCfg.h" |
19 #include "IceCfgNode.h" | 19 #include "IceCfgNode.h" |
20 #include "IceDefs.h" | 20 #include "IceDefs.h" |
21 #include "IceInst.h" | 21 #include "IceInst.h" |
22 #include "IceOperand.h" | 22 #include "IceOperand.h" |
23 | 23 |
24 namespace Ice { | 24 namespace Ice { |
25 namespace PhiLowering { | 25 namespace PhiLowering { |
26 | 26 |
27 // Turn an i64 Phi instruction into a pair of i32 Phi instructions, to | 27 /// Turn an i64 Phi instruction into a pair of i32 Phi instructions, to preserve |
28 // preserve integrity of liveness analysis. This is needed for 32-bit | 28 /// integrity of liveness analysis. This is needed for 32-bit targets. This |
29 // targets. This assumes the 32-bit target has loOperand, hiOperand, | 29 /// assumes the 32-bit target has loOperand, hiOperand, and legalizeUndef |
30 // and legalizeUndef methods. Undef values are also legalized, since | 30 /// methods. Undef values are also legalized, since loOperand() and hiOperand() |
31 // loOperand() and hiOperand() don't expect Undef input. | 31 /// don't expect Undef input. |
32 template <class TargetT> | 32 template <class TargetT> |
33 void prelowerPhis32Bit(TargetT *Target, CfgNode *Node, Cfg *Func) { | 33 void prelowerPhis32Bit(TargetT *Target, CfgNode *Node, Cfg *Func) { |
34 for (Inst &I : Node->getPhis()) { | 34 for (Inst &I : Node->getPhis()) { |
35 auto Phi = llvm::dyn_cast<InstPhi>(&I); | 35 auto Phi = llvm::dyn_cast<InstPhi>(&I); |
36 if (Phi->isDeleted()) | 36 if (Phi->isDeleted()) |
37 continue; | 37 continue; |
38 Variable *Dest = Phi->getDest(); | 38 Variable *Dest = Phi->getDest(); |
39 if (Dest->getType() == IceType_i64) { | 39 if (Dest->getType() == IceType_i64) { |
40 Variable *DestLo = llvm::cast<Variable>(Target->loOperand(Dest)); | 40 Variable *DestLo = llvm::cast<Variable>(Target->loOperand(Dest)); |
41 Variable *DestHi = llvm::cast<Variable>(Target->hiOperand(Dest)); | 41 Variable *DestHi = llvm::cast<Variable>(Target->hiOperand(Dest)); |
(...skipping 10 matching lines...) Expand all Loading... |
52 Node->getPhis().push_back(PhiHi); | 52 Node->getPhis().push_back(PhiHi); |
53 Phi->setDeleted(); | 53 Phi->setDeleted(); |
54 } | 54 } |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 } // end of namespace PhiLowering | 58 } // end of namespace PhiLowering |
59 } // end of namespace Ice | 59 } // end of namespace Ice |
60 | 60 |
61 #endif // SUBZERO_SRC_ICEPHILOWERINGIMPL_H | 61 #endif // SUBZERO_SRC_ICEPHILOWERINGIMPL_H |
OLD | NEW |