Commit 58455876 by Karl Schimpf

Add timing of bitcode parser to Subzero.

Adds timers to each bitcode block parser in Subzero, to get a reading on how much time is used by the bitcode parser. BUG=None R=jvoung@chromium.org, stichnot@chromium.org Review URL: https://codereview.chromium.org/688543003
parent dd165074
...@@ -36,6 +36,13 @@ ...@@ -36,6 +36,13 @@
X(livenessLightweight) \ X(livenessLightweight) \
X(llvmConvert) \ X(llvmConvert) \
X(parse) \ X(parse) \
X(parseConstants) \
X(parseFunctions) \
X(parseFunctionValuesymtabs) \
X(parseGlobals) \
X(parseModule) \
X(parseModuleValuesymtabs) \
X(parseTypes) \
X(placePhiLoads) \ X(placePhiLoads) \
X(placePhiStores) \ X(placePhiStores) \
X(regAlloc) \ X(regAlloc) \
......
...@@ -631,11 +631,14 @@ void BlockParserBaseClass::ProcessRecord() { ...@@ -631,11 +631,14 @@ void BlockParserBaseClass::ProcessRecord() {
class TypesParser : public BlockParserBaseClass { class TypesParser : public BlockParserBaseClass {
public: public:
TypesParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser) TypesParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser)
: BlockParserBaseClass(BlockID, EnclosingParser), NextTypeId(0) {} : BlockParserBaseClass(BlockID, EnclosingParser),
Timer(Ice::TimerStack::TT_parseTypes, getTranslator().getContext()),
NextTypeId(0) {}
~TypesParser() override {} ~TypesParser() override {}
private: private:
Ice::TimerMarker Timer;
// The type ID that will be associated with the next type defining // The type ID that will be associated with the next type defining
// record in the types block. // record in the types block.
unsigned NextTypeId; unsigned NextTypeId;
...@@ -801,12 +804,15 @@ void TypesParser::ProcessRecord() { ...@@ -801,12 +804,15 @@ void TypesParser::ProcessRecord() {
class GlobalsParser : public BlockParserBaseClass { class GlobalsParser : public BlockParserBaseClass {
public: public:
GlobalsParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser) GlobalsParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser)
: BlockParserBaseClass(BlockID, EnclosingParser), InitializersNeeded(0), : BlockParserBaseClass(BlockID, EnclosingParser),
NextGlobalID(0), DummyGlobalVar(Ice::VariableDeclaration::create( Timer(Ice::TimerStack::TT_parseGlobals, getTranslator().getContext()),
getTranslator().getContext())), InitializersNeeded(0), NextGlobalID(0),
DummyGlobalVar(
Ice::VariableDeclaration::create(getTranslator().getContext())),
CurGlobalVar(DummyGlobalVar) {} CurGlobalVar(DummyGlobalVar) {}
private: private:
Ice::TimerMarker Timer;
// Keeps track of how many initializers are expected for the global variable // Keeps track of how many initializers are expected for the global variable
// declaration being built. // declaration being built.
unsigned InitializersNeeded; unsigned InitializersNeeded;
...@@ -1004,6 +1010,7 @@ class FunctionParser : public BlockParserBaseClass { ...@@ -1004,6 +1010,7 @@ class FunctionParser : public BlockParserBaseClass {
public: public:
FunctionParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser) FunctionParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser)
: BlockParserBaseClass(BlockID, EnclosingParser), : BlockParserBaseClass(BlockID, EnclosingParser),
Timer(Ice::TimerStack::TT_parseFunctions, getTranslator().getContext()),
Func(new Ice::Cfg(getTranslator().getContext())), CurrentBbIndex(0), Func(new Ice::Cfg(getTranslator().getContext())), CurrentBbIndex(0),
FcnId(Context->getNextFunctionBlockValueID()), FcnId(Context->getNextFunctionBlockValueID()),
FuncDecl(Context->getFunctionByID(FcnId)), FuncDecl(Context->getFunctionByID(FcnId)),
...@@ -1036,6 +1043,7 @@ public: ...@@ -1036,6 +1043,7 @@ public:
} }
private: private:
Ice::TimerMarker Timer;
// The corresponding ICE function defined by the function block. // The corresponding ICE function defined by the function block.
Ice::Cfg *Func; Ice::Cfg *Func;
// The index to the current basic block being built. // The index to the current basic block being built.
...@@ -2251,12 +2259,14 @@ class ConstantsParser : public BlockParserBaseClass { ...@@ -2251,12 +2259,14 @@ class ConstantsParser : public BlockParserBaseClass {
public: public:
ConstantsParser(unsigned BlockID, FunctionParser *FuncParser) ConstantsParser(unsigned BlockID, FunctionParser *FuncParser)
: BlockParserBaseClass(BlockID, FuncParser), FuncParser(FuncParser), : BlockParserBaseClass(BlockID, FuncParser),
NextConstantType(Ice::IceType_void) {} Timer(Ice::TimerStack::TT_parseConstants, getTranslator().getContext()),
FuncParser(FuncParser), NextConstantType(Ice::IceType_void) {}
~ConstantsParser() override {} ~ConstantsParser() override {}
private: private:
Ice::TimerMarker Timer;
// The parser of the function block this constants block appears in. // The parser of the function block this constants block appears in.
FunctionParser *FuncParser; FunctionParser *FuncParser;
// The type to use for succeeding constants. // The type to use for succeeding constants.
...@@ -2366,9 +2376,12 @@ class FunctionValuesymtabParser : public ValuesymtabParser { ...@@ -2366,9 +2376,12 @@ class FunctionValuesymtabParser : public ValuesymtabParser {
public: public:
FunctionValuesymtabParser(unsigned BlockID, FunctionParser *EnclosingParser) FunctionValuesymtabParser(unsigned BlockID, FunctionParser *EnclosingParser)
: ValuesymtabParser(BlockID, EnclosingParser) {} : ValuesymtabParser(BlockID, EnclosingParser),
Timer(Ice::TimerStack::TT_parseFunctionValuesymtabs,
getTranslator().getContext()) {}
private: private:
Ice::TimerMarker Timer;
// Returns the enclosing function parser. // Returns the enclosing function parser.
FunctionParser *getFunctionParser() const { FunctionParser *getFunctionParser() const {
return reinterpret_cast<FunctionParser *>(GetEnclosingParser()); return reinterpret_cast<FunctionParser *>(GetEnclosingParser());
...@@ -2439,11 +2452,14 @@ class ModuleParser : public BlockParserBaseClass { ...@@ -2439,11 +2452,14 @@ class ModuleParser : public BlockParserBaseClass {
public: public:
ModuleParser(unsigned BlockID, TopLevelParser *Context) ModuleParser(unsigned BlockID, TopLevelParser *Context)
: BlockParserBaseClass(BlockID, Context), : BlockParserBaseClass(BlockID, Context),
Timer(Ice::TimerStack::TT_parseModule,
Context->getTranslator().getContext()),
GlobalDeclarationNamesAndInitializersInstalled(false) {} GlobalDeclarationNamesAndInitializersInstalled(false) {}
~ModuleParser() override {} ~ModuleParser() override {}
private: private:
Ice::TimerMarker Timer;
// True if we have already installed names for unnamed global declarations, // True if we have already installed names for unnamed global declarations,
// and have generated global constant initializers. // and have generated global constant initializers.
bool GlobalDeclarationNamesAndInitializersInstalled; bool GlobalDeclarationNamesAndInitializersInstalled;
...@@ -2505,11 +2521,14 @@ class ModuleValuesymtabParser : public ValuesymtabParser { ...@@ -2505,11 +2521,14 @@ class ModuleValuesymtabParser : public ValuesymtabParser {
public: public:
ModuleValuesymtabParser(unsigned BlockID, ModuleParser *MP) ModuleValuesymtabParser(unsigned BlockID, ModuleParser *MP)
: ValuesymtabParser(BlockID, MP) {} : ValuesymtabParser(BlockID, MP),
Timer(Ice::TimerStack::TT_parseModuleValuesymtabs,
getTranslator().getContext()) {}
~ModuleValuesymtabParser() override {} ~ModuleValuesymtabParser() override {}
private: private:
Ice::TimerMarker Timer;
void setValueName(uint64_t Index, StringType &Name) override; void setValueName(uint64_t Index, StringType &Name) override;
void setBbName(uint64_t Index, StringType &Name) override; void setBbName(uint64_t Index, StringType &Name) override;
}; };
......
...@@ -300,12 +300,12 @@ int main(int argc, char **argv) { ...@@ -300,12 +300,12 @@ int main(int argc, char **argv) {
<< "--build-on-read=0 not allowed\n"; << "--build-on-read=0 not allowed\n";
return GetReturnValue(1); return GetReturnValue(1);
} }
if (SubzeroTimingEnabled)
Ctx.dumpTimers();
if (TimeEachFunction) { if (TimeEachFunction) {
const bool DumpCumulative = false; const bool DumpCumulative = false;
Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative);
} }
if (SubzeroTimingEnabled)
Ctx.dumpTimers();
const bool FinalStats = true; const bool FinalStats = true;
Ctx.dumpStats("_FINAL_", FinalStats); Ctx.dumpStats("_FINAL_", FinalStats);
return GetReturnValue(ErrorStatus); return GetReturnValue(ErrorStatus);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment