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

Side by Side Diff: src/IceCfg.cpp

Issue 1326013002: Refactor Lo and Hi out of Variable. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Refactor Hi and Lo out of Variable Created 5 years, 3 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.h ('k') | src/IceInst.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/IceCfg.cpp - Control flow graph implementation ---------===// 1 //===- subzero/src/IceCfg.cpp - Control flow graph implementation ---------===//
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return Node; 68 return Node;
69 } 69 }
70 70
71 void Cfg::swapNodes(NodeList &NewNodes) { 71 void Cfg::swapNodes(NodeList &NewNodes) {
72 assert(Nodes.size() == NewNodes.size()); 72 assert(Nodes.size() == NewNodes.size());
73 Nodes.swap(NewNodes); 73 Nodes.swap(NewNodes);
74 for (SizeT I = 0, NumNodes = getNumNodes(); I < NumNodes; ++I) 74 for (SizeT I = 0, NumNodes = getNumNodes(); I < NumNodes; ++I)
75 Nodes[I]->resetIndex(I); 75 Nodes[I]->resetIndex(I);
76 } 76 }
77 77
78 template <>
79 Variable *Cfg::makeVariable<Variable>(Type Ty) {
80 SizeT Index = Variables.size();
81 Variable *Var = Target->shouldSplitToVariable64On32(Ty)
82 ? Variable64On32::create(this, Ty, Index)
83 : Variable::create(this, Ty, Index);
84 Variables.push_back(Var);
85 return Var;
86 }
87
78 void Cfg::addArg(Variable *Arg) { 88 void Cfg::addArg(Variable *Arg) {
79 Arg->setIsArg(); 89 Arg->setIsArg();
80 Args.push_back(Arg); 90 Args.push_back(Arg);
81 } 91 }
82 92
83 void Cfg::addImplicitArg(Variable *Arg) { 93 void Cfg::addImplicitArg(Variable *Arg) {
84 Arg->setIsImplicitArg(); 94 Arg->setIsImplicitArg();
85 ImplicitArgs.push_back(Arg); 95 ImplicitArgs.push_back(Arg);
86 } 96 }
87 97
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 getContext()->resetTimer(GlobalContext::TSK_Default); 178 getContext()->resetTimer(GlobalContext::TSK_Default);
169 getContext()->setTimerName(GlobalContext::TSK_Default, Name); 179 getContext()->setTimerName(GlobalContext::TSK_Default, Name);
170 } 180 }
171 if (getContext()->getFlags().getTimeEachFunction()) 181 if (getContext()->getFlags().getTimeEachFunction())
172 FunctionTimer.reset(new TimerMarker( 182 FunctionTimer.reset(new TimerMarker(
173 getContext()->getTimerID(GlobalContext::TSK_Funcs, Name), 183 getContext()->getTimerID(GlobalContext::TSK_Funcs, Name),
174 getContext(), GlobalContext::TSK_Funcs)); 184 getContext(), GlobalContext::TSK_Funcs));
175 } 185 }
176 TimerMarker T(TimerStack::TT_translate, this); 186 TimerMarker T(TimerStack::TT_translate, this);
177 187
188 // Create the Hi and Lo variables where a split was needed
189 for (Variable *Var : Variables)
190 if (auto Var64On32 = llvm::dyn_cast<Variable64On32>(Var))
191 Var64On32->initHiLo(this);
192
178 dump("Initial CFG"); 193 dump("Initial CFG");
179 194
180 if (getContext()->getFlags().getEnableBlockProfile()) { 195 if (getContext()->getFlags().getEnableBlockProfile()) {
181 profileBlocks(); 196 profileBlocks();
182 // TODO(jpp): this is fragile, at best. Figure out a better way of 197 // TODO(jpp): this is fragile, at best. Figure out a better way of
183 // detecting exit functions. 198 // detecting exit functions.
184 if (GlobalContext::matchSymbolName(getFunctionName(), "exit")) { 199 if (GlobalContext::matchSymbolName(getFunctionName(), "exit")) {
185 addCallToProfileSummary(); 200 addCallToProfileSummary();
186 } 201 }
187 dump("Profiled CFG"); 202 dump("Profiled CFG");
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 } 788 }
774 } 789 }
775 // Print each basic block 790 // Print each basic block
776 for (CfgNode *Node : Nodes) 791 for (CfgNode *Node : Nodes)
777 Node->dump(this); 792 Node->dump(this);
778 if (isVerbose(IceV_Instructions)) 793 if (isVerbose(IceV_Instructions))
779 Str << "}\n"; 794 Str << "}\n";
780 } 795 }
781 796
782 } // end of namespace Ice 797 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCfg.h ('k') | src/IceInst.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698