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

Unified Diff: src/IceTranslator.cpp

Issue 673783002: Subzero: Improve debugging controls, plus minor refactoring. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | src/llvm2ice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTranslator.cpp
diff --git a/src/IceTranslator.cpp b/src/IceTranslator.cpp
index dad0fa963ba5738f2bdc48796b341da5f77d568c..0391b6c67e83b58ccb435147c31f1d5a7633beca 100644
--- a/src/IceTranslator.cpp
+++ b/src/IceTranslator.cpp
@@ -28,6 +28,16 @@
using namespace Ice;
+namespace {
+
+// Match a symbol name against a match string. An empty match string
+// means match everything. Returns true if there is a match.
+bool matchSymbolName(const IceString &SymbolName, const IceString &Match) {
+ return Match.empty() || Match == SymbolName;
+}
+
+} // end of anonymous namespace
+
Translator::~Translator() {}
IceString Translator::createUnnamedName(const IceString &Prefix, SizeT Index) {
@@ -58,9 +68,13 @@ bool Translator::checkIfUnnamedNameSafe(const IceString &Name, const char *Kind,
void Translator::translateFcn(Cfg *Fcn) {
Ctx->resetStats();
Func.reset(Fcn);
- if (Ctx->getFlags().DisableInternal)
- Func->setInternal(false);
- if (Ctx->getFlags().DisableTranslation) {
+ VerboseMask OldVerboseMask = Ctx->getVerbose();
+ if (!matchSymbolName(Func->getFunctionName(), Ctx->getFlags().VerboseFocusOn))
+ Ctx->setVerbose(IceV_None);
+
+ if (Ctx->getFlags().DisableTranslation ||
+ !matchSymbolName(Func->getFunctionName(),
+ Ctx->getFlags().TranslateOnly)) {
Func->dump();
} else {
Func->translate();
@@ -72,6 +86,8 @@ void Translator::translateFcn(Cfg *Fcn) {
Func->emit();
Ctx->dumpStats(Func->getFunctionName());
}
+
+ Ctx->setVerbose(OldVerboseMask);
}
void Translator::emitConstants() {
@@ -84,12 +100,15 @@ void Translator::lowerGlobals(
llvm::OwningPtr<TargetGlobalInitLowering> GlobalLowering(
TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx));
bool DisableTranslation = Ctx->getFlags().DisableTranslation;
- bool DumpGlobalVariables = Ctx->isVerbose();
+ bool DumpGlobalVariables =
+ Ctx->isVerbose() && Ctx->getFlags().VerboseFocusOn.empty();
Ostream &Stream = Ctx->getStrDump();
+ const IceString &TranslateOnly = Ctx->getFlags().TranslateOnly;
for (const Ice::VariableDeclaration *Global : VariableDeclarations) {
if (DumpGlobalVariables)
Global->dump(getContext(), Stream);
- if(!DisableTranslation)
+ if (!DisableTranslation &&
+ matchSymbolName(Global->getName(), TranslateOnly))
GlobalLowering->lower(*Global);
}
GlobalLowering.reset();
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | src/llvm2ice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698