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

Side by Side Diff: src/IceCfg.cpp

Issue 1738443002: Subzero. Performance tweaks. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments -- all of them 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/IceConverter.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 11 matching lines...) Expand all
22 #include "IceGlobalInits.h" 22 #include "IceGlobalInits.h"
23 #include "IceInst.h" 23 #include "IceInst.h"
24 #include "IceInstVarIter.h" 24 #include "IceInstVarIter.h"
25 #include "IceLiveness.h" 25 #include "IceLiveness.h"
26 #include "IceLoopAnalyzer.h" 26 #include "IceLoopAnalyzer.h"
27 #include "IceOperand.h" 27 #include "IceOperand.h"
28 #include "IceTargetLowering.h" 28 #include "IceTargetLowering.h"
29 29
30 namespace Ice { 30 namespace Ice {
31 31
32 ICE_TLS_DEFINE_FIELD(const Cfg *, Cfg, CurrentCfg);
33
34 ArenaAllocator<> *getCurrentCfgAllocator() {
35 return Cfg::getCurrentCfgAllocator();
36 }
37
38 Cfg::Cfg(GlobalContext *Ctx, uint32_t SequenceNumber) 32 Cfg::Cfg(GlobalContext *Ctx, uint32_t SequenceNumber)
39 : Ctx(Ctx), SequenceNumber(SequenceNumber), 33 : Ctx(Ctx), SequenceNumber(SequenceNumber),
40 VMask(Ctx->getFlags().getVerbose()), NextInstNumber(Inst::NumberInitial), 34 VMask(Ctx->getFlags().getVerbose()), NextInstNumber(Inst::NumberInitial),
41 Allocator(new ArenaAllocator<>()), Live(nullptr), 35 Allocator(new ArenaAllocator()), Live(nullptr),
42 Target(TargetLowering::createLowering(Ctx->getFlags().getTargetArch(), 36 Target(TargetLowering::createLowering(Ctx->getFlags().getTargetArch(),
43 this)), 37 this)),
44 VMetadata(new VariablesMetadata(this)), 38 VMetadata(new VariablesMetadata(this)),
45 TargetAssembler(Target->createAssembler()) { 39 TargetAssembler(Target->createAssembler()) {
46 if (Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == RPI_Randomize) { 40 if (Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == RPI_Randomize) {
47 // If -randomize-pool-immediates=randomize, create a random number 41 // If -randomize-pool-immediates=randomize, create a random number
48 // generator to generate a cookie for constant blinding. 42 // generator to generate a cookie for constant blinding.
49 RandomNumberGenerator RNG(Ctx->getFlags().getRandomSeed(), 43 RandomNumberGenerator RNG(Ctx->getFlags().getRandomSeed(),
50 RPE_ConstantBlinding, this->SequenceNumber); 44 RPE_ConstantBlinding, this->SequenceNumber);
51 ConstantBlindingCookie = 45 ConstantBlindingCookie =
52 (uint32_t)RNG.next((uint64_t)std::numeric_limits<uint32_t>::max() + 1); 46 (uint32_t)RNG.next((uint64_t)std::numeric_limits<uint32_t>::max() + 1);
53 } 47 }
54 } 48 }
55 49
56 Cfg::~Cfg() { assert(ICE_TLS_GET_FIELD(CurrentCfg) == nullptr); } 50 Cfg::~Cfg() { assert(CfgAllocatorTraits::current() == nullptr); }
57 51
58 /// Create a string like "foo(i=123:b=9)" indicating the function name, number 52 /// Create a string like "foo(i=123:b=9)" indicating the function name, number
59 /// of high-level instructions, and number of basic blocks. This string is only 53 /// of high-level instructions, and number of basic blocks. This string is only
60 /// used for dumping and other diagnostics, and the idea is that given a set of 54 /// used for dumping and other diagnostics, and the idea is that given a set of
61 /// functions to debug a problem on, it's easy to find the smallest or simplest 55 /// functions to debug a problem on, it's easy to find the smallest or simplest
62 /// function to attack. Note that the counts may change somewhat depending on 56 /// function to attack. Note that the counts may change somewhat depending on
63 /// what point it is called during the translation passes. 57 /// what point it is called during the translation passes.
64 IceString Cfg::getFunctionNameAndSize() const { 58 IceString Cfg::getFunctionNameAndSize() const {
65 if (!BuildDefs::dump()) 59 if (!BuildDefs::dump())
66 return getFunctionName(); 60 return getFunctionName();
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 } 1128 }
1135 } 1129 }
1136 // Print each basic block 1130 // Print each basic block
1137 for (CfgNode *Node : Nodes) 1131 for (CfgNode *Node : Nodes)
1138 Node->dump(this); 1132 Node->dump(this);
1139 if (isVerbose(IceV_Instructions)) 1133 if (isVerbose(IceV_Instructions))
1140 Str << "}\n"; 1134 Str << "}\n";
1141 } 1135 }
1142 1136
1143 } // end of namespace Ice 1137 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCfg.h ('k') | src/IceConverter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698