| OLD | NEW |
| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 const IceString &Name = getFunctionName(); | 196 const IceString &Name = getFunctionName(); |
| 197 if (TimingFocusOn == "*" || TimingFocusOn == Name) { | 197 if (TimingFocusOn == "*" || TimingFocusOn == Name) { |
| 198 setFocusedTiming(); | 198 setFocusedTiming(); |
| 199 getContext()->resetTimer(GlobalContext::TSK_Default); | 199 getContext()->resetTimer(GlobalContext::TSK_Default); |
| 200 getContext()->setTimerName(GlobalContext::TSK_Default, Name); | 200 getContext()->setTimerName(GlobalContext::TSK_Default, Name); |
| 201 } | 201 } |
| 202 if (getContext()->getFlags().getTimeEachFunction()) | 202 if (getContext()->getFlags().getTimeEachFunction()) |
| 203 FunctionTimer.reset(new TimerMarker( | 203 FunctionTimer.reset(new TimerMarker( |
| 204 getContext()->getTimerID(GlobalContext::TSK_Funcs, Name), | 204 getContext()->getTimerID(GlobalContext::TSK_Funcs, Name), |
| 205 getContext(), GlobalContext::TSK_Funcs)); | 205 getContext(), GlobalContext::TSK_Funcs)); |
| 206 if (isVerbose(IceV_Status)) | 206 if (isVerbose(IceV_Status)) { |
| 207 getContext()->getStrDump() << ">>>Translating " << Name << "\n"; | 207 getContext()->getStrDump() << ">>>Translating " |
| 208 << getFunctionNameAndSize() << "\n"; |
| 209 } |
| 208 } | 210 } |
| 209 TimerMarker T(TimerStack::TT_translate, this); | 211 TimerMarker T(TimerStack::TT_translate, this); |
| 210 | 212 |
| 211 dump("Initial CFG"); | 213 dump("Initial CFG"); |
| 212 | 214 |
| 213 if (getContext()->getFlags().getEnableBlockProfile()) { | 215 if (getContext()->getFlags().getEnableBlockProfile()) { |
| 214 profileBlocks(); | 216 profileBlocks(); |
| 215 // TODO(jpp): this is fragile, at best. Figure out a better way of | 217 // TODO(jpp): this is fragile, at best. Figure out a better way of |
| 216 // detecting exit functions. | 218 // detecting exit functions. |
| 217 if (GlobalContext::matchSymbolName(getFunctionName(), "exit")) { | 219 if (GlobalContext::matchSymbolName(getFunctionName(), "exit")) { |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 // Dumps the IR with an optional introductory message. | 1079 // Dumps the IR with an optional introductory message. |
| 1078 void Cfg::dump(const IceString &Message) { | 1080 void Cfg::dump(const IceString &Message) { |
| 1079 if (!BuildDefs::dump()) | 1081 if (!BuildDefs::dump()) |
| 1080 return; | 1082 return; |
| 1081 if (!isVerbose()) | 1083 if (!isVerbose()) |
| 1082 return; | 1084 return; |
| 1083 OstreamLocker L(Ctx); | 1085 OstreamLocker L(Ctx); |
| 1084 Ostream &Str = Ctx->getStrDump(); | 1086 Ostream &Str = Ctx->getStrDump(); |
| 1085 if (!Message.empty()) | 1087 if (!Message.empty()) |
| 1086 Str << "================ " << Message << " ================\n"; | 1088 Str << "================ " << Message << " ================\n"; |
| 1089 if (isVerbose(IceV_Mem)) { |
| 1090 constexpr size_t OneMB = 1024 * 1024; |
| 1091 Str << "Memory size = " |
| 1092 << (CfgLocalAllocator<int>().current()->getTotalMemory() / OneMB) |
| 1093 << " MB\n"; |
| 1094 } |
| 1087 setCurrentNode(getEntryNode()); | 1095 setCurrentNode(getEntryNode()); |
| 1088 // Print function name+args | 1096 // Print function name+args |
| 1089 if (isVerbose(IceV_Instructions)) { | 1097 if (isVerbose(IceV_Instructions)) { |
| 1090 Str << "define "; | 1098 Str << "define "; |
| 1091 if (getInternal() && !Ctx->getFlags().getDisableInternal()) | 1099 if (getInternal() && !Ctx->getFlags().getDisableInternal()) |
| 1092 Str << "internal "; | 1100 Str << "internal "; |
| 1093 Str << ReturnType << " @" << Ctx->mangleName(getFunctionName()) << "("; | 1101 Str << ReturnType << " @" << Ctx->mangleName(getFunctionName()) << "("; |
| 1094 for (SizeT i = 0; i < Args.size(); ++i) { | 1102 for (SizeT i = 0; i < Args.size(); ++i) { |
| 1095 if (i > 0) | 1103 if (i > 0) |
| 1096 Str << ", "; | 1104 Str << ", "; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 } | 1140 } |
| 1133 } | 1141 } |
| 1134 // Print each basic block | 1142 // Print each basic block |
| 1135 for (CfgNode *Node : Nodes) | 1143 for (CfgNode *Node : Nodes) |
| 1136 Node->dump(this); | 1144 Node->dump(this); |
| 1137 if (isVerbose(IceV_Instructions)) | 1145 if (isVerbose(IceV_Instructions)) |
| 1138 Str << "}\n"; | 1146 Str << "}\n"; |
| 1139 } | 1147 } |
| 1140 | 1148 |
| 1141 } // end of namespace Ice | 1149 } // end of namespace Ice |
| OLD | NEW |