Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: src/IceCfgNode.h

Issue 1837663002: Initial Subzero WASM prototype. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review feedback and merging master Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceCfg.cpp ('k') | src/IceCfgNode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceCfgNode.h - Control flow graph node -------*- C++ -*-===// 1 //===- subzero/src/IceCfgNode.h - Control flow graph node -------*- 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
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 /// \name Access predecessor and successor edge lists. 65 /// \name Access predecessor and successor edge lists.
66 /// @{ 66 /// @{
67 const NodeList &getInEdges() const { return InEdges; } 67 const NodeList &getInEdges() const { return InEdges; }
68 const NodeList &getOutEdges() const { return OutEdges; } 68 const NodeList &getOutEdges() const { return OutEdges; }
69 /// @} 69 /// @}
70 70
71 /// \name Manage the instruction list. 71 /// \name Manage the instruction list.
72 /// @{ 72 /// @{
73 InstList &getInsts() { return Insts; } 73 InstList &getInsts() { return Insts; }
74 PhiList &getPhis() { return Phis; } 74 PhiList &getPhis() { return Phis; }
75 void appendInst(Inst *Instr); 75 void appendInst(Inst *Instr, bool AllowPhisAnywhere = false);
76 void renumberInstructions(); 76 void renumberInstructions();
77 /// Rough and generally conservative estimate of the number of instructions in 77 /// Rough and generally conservative estimate of the number of instructions in
78 /// the block. It is updated when an instruction is added, but not when 78 /// the block. It is updated when an instruction is added, but not when
79 /// deleted. It is recomputed during renumberInstructions(). 79 /// deleted. It is recomputed during renumberInstructions().
80 InstNumberT getInstCountEstimate() const { return InstCountEstimate; } 80 InstNumberT getInstCountEstimate() const { return InstCountEstimate; }
81 /// @} 81 /// @}
82 82
83 /// \name Manage predecessors and successors. 83 /// \name Manage predecessors and successors.
84 /// @{ 84 /// @{
85 85
(...skipping 17 matching lines...) Expand all
103 void livenessAddIntervals(Liveness *Liveness, InstNumberT FirstInstNum, 103 void livenessAddIntervals(Liveness *Liveness, InstNumberT FirstInstNum,
104 InstNumberT LastInstNum); 104 InstNumberT LastInstNum);
105 void contractIfEmpty(); 105 void contractIfEmpty();
106 void doBranchOpt(const CfgNode *NextNode); 106 void doBranchOpt(const CfgNode *NextNode);
107 void emit(Cfg *Func) const; 107 void emit(Cfg *Func) const;
108 void emitIAS(Cfg *Func) const; 108 void emitIAS(Cfg *Func) const;
109 void dump(Cfg *Func) const; 109 void dump(Cfg *Func) const;
110 110
111 void profileExecutionCount(VariableDeclaration *Var); 111 void profileExecutionCount(VariableDeclaration *Var);
112 112
113 void addOutEdge(CfgNode *Out) { OutEdges.push_back(Out); }
114 void addInEdge(CfgNode *In) { InEdges.push_back(In); }
115
116 bool hasSingleOutEdge() const {
117 return (getOutEdges().size() == 1 || getOutEdges()[0] == getOutEdges()[1]);
118 }
119
113 private: 120 private:
114 CfgNode(Cfg *Func, SizeT Number); 121 CfgNode(Cfg *Func, SizeT Number);
115 bool livenessValidateIntervals(Liveness *Liveness) const; 122 bool livenessValidateIntervals(Liveness *Liveness) const;
116 Cfg *const Func; 123 Cfg *const Func;
117 SizeT Number; /// invariant: Func->Nodes[Number]==this 124 SizeT Number; /// invariant: Func->Nodes[Number]==this
118 NodeString Name; 125 NodeString Name;
119 SizeT LoopNestDepth = 0; /// the loop nest depth of this node 126 SizeT LoopNestDepth = 0; /// the loop nest depth of this node
120 bool HasReturn = false; /// does this block need an epilog? 127 bool HasReturn = false; /// does this block need an epilog?
121 bool NeedsPlacement = false; 128 bool NeedsPlacement = false;
122 bool NeedsAlignment = false; /// is sandboxing required? 129 bool NeedsAlignment = false; /// is sandboxing required?
123 InstNumberT InstCountEstimate = 0; /// rough instruction count estimate 130 InstNumberT InstCountEstimate = 0; /// rough instruction count estimate
124 NodeList InEdges; /// in no particular order 131 NodeList InEdges; /// in no particular order
125 NodeList OutEdges; /// in no particular order 132 NodeList OutEdges; /// in no particular order
126 PhiList Phis; /// unordered set of phi instructions 133 PhiList Phis; /// unordered set of phi instructions
127 InstList Insts; /// ordered list of non-phi instructions 134 InstList Insts; /// ordered list of non-phi instructions
128 }; 135 };
129 136
130 } // end of namespace Ice 137 } // end of namespace Ice
131 138
132 #endif // SUBZERO_SRC_ICECFGNODE_H 139 #endif // SUBZERO_SRC_ICECFGNODE_H
OLDNEW
« no previous file with comments | « src/IceCfg.cpp ('k') | src/IceCfgNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698