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

Unified Diff: src/IceTranslator.cpp

Issue 641193002: Introduce the notion of function addresses in Subzero. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nit in test. 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/IceTranslator.h ('k') | src/PNaClTranslator.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 e86d60a304d6155751ce836693851590270a46d4..6d4af11a24dd4ed4ba91149332a1c4a5112de4a8 100644
--- a/src/IceTranslator.cpp
+++ b/src/IceTranslator.cpp
@@ -22,6 +22,7 @@
#include "IceCfg.h"
#include "IceClFlags.h"
#include "IceDefs.h"
+#include "IceGlobalInits.h"
#include "IceTargetLowering.h"
#include "IceTranslator.h"
@@ -54,38 +55,6 @@ bool Translator::checkIfUnnamedNameSafe(const IceString &Name, const char *Kind,
return false;
}
-void Translator::nameUnnamedGlobalAddresses(llvm::Module *Mod) {
- const IceString &GlobalPrefix = Flags.DefaultGlobalPrefix;
- if (GlobalPrefix.empty())
- return;
- uint32_t NameIndex = 0;
- Ostream &errs = Ctx->getStrDump();
- for (auto V = Mod->global_begin(), E = Mod->global_end(); V != E; ++V) {
- if (!V->hasName()) {
- V->setName(createUnnamedName(GlobalPrefix, NameIndex));
- ++NameIndex;
- } else {
- checkIfUnnamedNameSafe(V->getName(), "global", GlobalPrefix, errs);
- }
- }
-}
-
-void Translator::nameUnnamedFunctions(llvm::Module *Mod) {
- const IceString &FunctionPrefix = Flags.DefaultFunctionPrefix;
- if (FunctionPrefix.empty())
- return;
- uint32_t NameIndex = 0;
- Ostream &errs = Ctx->getStrDump();
- for (llvm::Function &F : *Mod) {
- if (!F.hasName()) {
- F.setName(createUnnamedName(FunctionPrefix, NameIndex));
- ++NameIndex;
- } else {
- checkIfUnnamedNameSafe(F.getName(), "function", FunctionPrefix, errs);
- }
- }
-}
-
void Translator::translateFcn(Cfg *Fcn) {
Ctx->resetStats();
Func.reset(Fcn);
@@ -110,12 +79,18 @@ void Translator::emitConstants() {
Func->getTarget()->emitConstants();
}
-void Translator::lowerGlobals(const GlobalAddressList &GlobalAddresses) {
- llvm::OwningPtr<Ice::TargetGlobalInitLowering> GlobalLowering(
- Ice::TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx));
+void Translator::lowerGlobals(
+ const VariableDeclarationListType &VariableDeclarations) {
+ llvm::OwningPtr<TargetGlobalInitLowering> GlobalLowering(
+ TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx));
bool DisableTranslation = Ctx->getFlags().DisableTranslation;
- for (const Ice::GlobalAddress *Addr : GlobalAddresses) {
- GlobalLowering->lower(*Addr, DisableTranslation);
+ bool DumpGlobalVariables = Ctx->isVerbose();
+ Ostream &Stream = Ctx->getStrDump();
+ for (const Ice::VariableDeclaration *Global : VariableDeclarations) {
+ if (DumpGlobalVariables)
+ Global->dump(Stream);
+ if(!DisableTranslation)
+ GlobalLowering->lower(*Global);
}
GlobalLowering.reset();
}
« no previous file with comments | « src/IceTranslator.h ('k') | src/PNaClTranslator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698