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

Side by Side Diff: src/IceTranslator.cpp

Issue 622443002: Subzero: Change llvm::OwningPtr to C++11's std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Remove ErrorOr for now 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
11 // machine code. 11 // machine code.
12 // 12 //
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #include <iostream>
16 #include <memory>
17
18 #include "llvm/IR/Constant.h"
19 #include "llvm/IR/Constants.h"
20 #include "llvm/IR/Module.h"
21
15 #include "IceCfg.h" 22 #include "IceCfg.h"
16 #include "IceClFlags.h" 23 #include "IceClFlags.h"
17 #include "IceDefs.h" 24 #include "IceDefs.h"
18 #include "IceTargetLowering.h" 25 #include "IceTargetLowering.h"
19 #include "IceTranslator.h" 26 #include "IceTranslator.h"
20 #include "llvm/IR/Module.h"
21 #include "llvm/IR/Constant.h"
22 #include "llvm/IR/Constants.h"
23
24 #include <iostream>
25 27
26 using namespace Ice; 28 using namespace Ice;
27 29
28 Translator::~Translator() {} 30 Translator::~Translator() {}
29 31
30 namespace { 32 namespace {
31 void setValueName(llvm::Value *V, const char *Kind, const IceString &Prefix, 33 void setValueName(llvm::Value *V, const char *Kind, const IceString &Prefix,
32 uint32_t &NameIndex, Ostream &errs) { 34 uint32_t &NameIndex, Ostream &errs) {
33 if (V->hasName()) { 35 if (V->hasName()) {
34 const std::string &Name(V->getName()); 36 const std::string &Name(V->getName());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 Ctx->dumpStats(Func->getFunctionName()); 91 Ctx->dumpStats(Func->getFunctionName());
90 } 92 }
91 } 93 }
92 94
93 void Translator::emitConstants() { 95 void Translator::emitConstants() {
94 if (!Ctx->getFlags().DisableTranslation && Func) 96 if (!Ctx->getFlags().DisableTranslation && Func)
95 Func->getTarget()->emitConstants(); 97 Func->getTarget()->emitConstants();
96 } 98 }
97 99
98 void Translator::convertGlobals(llvm::Module *Mod) { 100 void Translator::convertGlobals(llvm::Module *Mod) {
99 llvm::OwningPtr<TargetGlobalInitLowering> GlobalLowering( 101 std::unique_ptr<TargetGlobalInitLowering> GlobalLowering(
100 TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx)); 102 TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx));
101 for (llvm::Module::const_global_iterator I = Mod->global_begin(), 103 for (llvm::Module::const_global_iterator I = Mod->global_begin(),
102 E = Mod->global_end(); 104 E = Mod->global_end();
103 I != E; ++I) { 105 I != E; ++I) {
104 if (!I->hasInitializer()) 106 if (!I->hasInitializer())
105 continue; 107 continue;
106 const llvm::Constant *Initializer = I->getInitializer(); 108 const llvm::Constant *Initializer = I->getInitializer();
107 IceString Name = I->getName(); 109 IceString Name = I->getName();
108 unsigned Align = I->getAlignment(); 110 unsigned Align = I->getAlignment();
109 uint64_t NumElements = 0; 111 uint64_t NumElements = 0;
(...skipping 23 matching lines...) Expand all
133 } else { 135 } else {
134 llvm_unreachable("Unhandled global initializer"); 136 llvm_unreachable("Unhandled global initializer");
135 } 137 }
136 138
137 GlobalLowering->lower(Name, Align, IsInternal, IsConst, IsZeroInitializer, 139 GlobalLowering->lower(Name, Align, IsInternal, IsConst, IsZeroInitializer,
138 NumElements, Data, 140 NumElements, Data,
139 Ctx->getFlags().DisableTranslation); 141 Ctx->getFlags().DisableTranslation);
140 } 142 }
141 GlobalLowering.reset(); 143 GlobalLowering.reset();
142 } 144 }
OLDNEW
« no previous file with comments | « src/IceTranslator.h ('k') | src/IceTypeConverter.h » ('j') | src/PNaClTranslator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698