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

Side by Side 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: Clean up code and fix nits. 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 unified diff | Download patch
OLDNEW
1 //===- subzero/src/IceTranslator.cpp - ICE to machine code ------*- C++ -*-===// 1 //===- subzero/src/IceTranslator.cpp - ICE to machine code ------*- C++ -*-===//
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 // This file defines the general driver class for translating ICE to 10 // This file defines the general driver class for translating ICE to
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 return false; 47 return false;
48 } 48 }
49 } 49 }
50 Stream << "Warning : Default " << Kind << " prefix '" << Prefix 50 Stream << "Warning : Default " << Kind << " prefix '" << Prefix
51 << "' potentially conflicts with name '" << Name << "'.\n"; 51 << "' potentially conflicts with name '" << Name << "'.\n";
52 return true; 52 return true;
53 } 53 }
54 return false; 54 return false;
55 } 55 }
56 56
57 void Translator::nameUnnamedGlobalAddresses(llvm::Module *Mod) { 57 void Translator::nameUnnamedGlobalVariables(llvm::Module *Mod) {
58 const IceString &GlobalPrefix = Flags.DefaultGlobalPrefix; 58 const IceString &GlobalPrefix = Flags.DefaultGlobalPrefix;
59 if (GlobalPrefix.empty()) 59 if (GlobalPrefix.empty())
60 return; 60 return;
61 uint32_t NameIndex = 0; 61 uint32_t NameIndex = 0;
62 Ostream &errs = Ctx->getStrDump(); 62 Ostream &errs = Ctx->getStrDump();
63 for (auto V = Mod->global_begin(), E = Mod->global_end(); V != E; ++V) { 63 for (auto V = Mod->global_begin(), E = Mod->global_end(); V != E; ++V) {
64 if (!V->hasName()) { 64 if (!V->hasName()) {
65 V->setName(createUnnamedName(GlobalPrefix, NameIndex)); 65 V->setName(createUnnamedName(GlobalPrefix, NameIndex));
66 ++NameIndex; 66 ++NameIndex;
67 } else { 67 } else {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 Func->emit(); 103 Func->emit();
104 Ctx->dumpStats(Func->getFunctionName()); 104 Ctx->dumpStats(Func->getFunctionName());
105 } 105 }
106 } 106 }
107 107
108 void Translator::emitConstants() { 108 void Translator::emitConstants() {
109 if (!Ctx->getFlags().DisableTranslation && Func) 109 if (!Ctx->getFlags().DisableTranslation && Func)
110 Func->getTarget()->emitConstants(); 110 Func->getTarget()->emitConstants();
111 } 111 }
112 112
113 void Translator::lowerGlobals(const GlobalAddressList &GlobalAddresses) { 113 void Translator::lowerGlobals(const GlobalVariableListType &GlobalVariables) {
114 llvm::OwningPtr<Ice::TargetGlobalInitLowering> GlobalLowering( 114 llvm::OwningPtr<Ice::TargetGlobalInitLowering> GlobalLowering(
115 Ice::TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx)); 115 Ice::TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx));
116 bool DisableTranslation = Ctx->getFlags().DisableTranslation; 116 bool DisableTranslation = Ctx->getFlags().DisableTranslation;
117 for (const Ice::GlobalAddress *Addr : GlobalAddresses) { 117 for (const Ice::GlobalVariable *Global : GlobalVariables) {
118 GlobalLowering->lower(*Addr, DisableTranslation); 118 GlobalLowering->lower(*Global, DisableTranslation);
119 } 119 }
120 GlobalLowering.reset(); 120 GlobalLowering.reset();
121 } 121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698