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

Side by Side Diff: src/IceCfg.cpp

Issue 1746613002: Subzero: Reduce copying of Liveness bitvectors. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix memory over-allocation Created 4 years, 9 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/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/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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 deleteJumpTableInsts(); 1069 deleteJumpTableInsts();
1070 const bool NeedSandboxing = Ctx->getFlags().getUseSandboxing(); 1070 const bool NeedSandboxing = Ctx->getFlags().getUseSandboxing();
1071 for (CfgNode *Node : Nodes) { 1071 for (CfgNode *Node : Nodes) {
1072 if (NeedSandboxing && Node->needsAlignment()) 1072 if (NeedSandboxing && Node->needsAlignment())
1073 getAssembler()->alignCfgNode(); 1073 getAssembler()->alignCfgNode();
1074 Node->emitIAS(this); 1074 Node->emitIAS(this);
1075 } 1075 }
1076 emitJumpTables(); 1076 emitJumpTables();
1077 } 1077 }
1078 1078
1079 size_t Cfg::getTotalMemoryMB() {
1080 constexpr size_t OneMB = 1024 * 1024;
1081 using ArbitraryType = int;
1082 // CfgLocalAllocator draws from the same memory pool regardless of allocated
1083 // object type, so pick an arbitrary type for the template parameter.
1084 return CfgLocalAllocator<ArbitraryType>().current()->getTotalMemory() / OneMB;
1085 }
1086
1079 // Dumps the IR with an optional introductory message. 1087 // Dumps the IR with an optional introductory message.
1080 void Cfg::dump(const IceString &Message) { 1088 void Cfg::dump(const IceString &Message) {
1081 if (!BuildDefs::dump()) 1089 if (!BuildDefs::dump())
1082 return; 1090 return;
1083 if (!isVerbose()) 1091 if (!isVerbose())
1084 return; 1092 return;
1085 OstreamLocker L(Ctx); 1093 OstreamLocker L(Ctx);
1086 Ostream &Str = Ctx->getStrDump(); 1094 Ostream &Str = Ctx->getStrDump();
1087 if (!Message.empty()) 1095 if (!Message.empty())
1088 Str << "================ " << Message << " ================\n"; 1096 Str << "================ " << Message << " ================\n";
1089 if (isVerbose(IceV_Mem)) { 1097 if (isVerbose(IceV_Mem)) {
1090 constexpr size_t OneMB = 1024 * 1024; 1098 Str << "Memory size = " << getTotalMemoryMB() << " MB\n";
1091 Str << "Memory size = "
1092 << (CfgLocalAllocator<int>().current()->getTotalMemory() / OneMB)
1093 << " MB\n";
1094 } 1099 }
1095 setCurrentNode(getEntryNode()); 1100 setCurrentNode(getEntryNode());
1096 // Print function name+args 1101 // Print function name+args
1097 if (isVerbose(IceV_Instructions)) { 1102 if (isVerbose(IceV_Instructions)) {
1098 Str << "define "; 1103 Str << "define ";
1099 if (getInternal() && !Ctx->getFlags().getDisableInternal()) 1104 if (getInternal() && !Ctx->getFlags().getDisableInternal())
1100 Str << "internal "; 1105 Str << "internal ";
1101 Str << ReturnType << " @" << Ctx->mangleName(getFunctionName()) << "("; 1106 Str << ReturnType << " @" << Ctx->mangleName(getFunctionName()) << "(";
1102 for (SizeT i = 0; i < Args.size(); ++i) { 1107 for (SizeT i = 0; i < Args.size(); ++i) {
1103 if (i > 0) 1108 if (i > 0)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 } 1145 }
1141 } 1146 }
1142 // Print each basic block 1147 // Print each basic block
1143 for (CfgNode *Node : Nodes) 1148 for (CfgNode *Node : Nodes)
1144 Node->dump(this); 1149 Node->dump(this);
1145 if (isVerbose(IceV_Instructions)) 1150 if (isVerbose(IceV_Instructions))
1146 Str << "}\n"; 1151 Str << "}\n";
1147 } 1152 }
1148 1153
1149 } // end of namespace Ice 1154 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCfg.h ('k') | src/IceCfgNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698