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

Side by Side Diff: src/IceConverter.cpp

Issue 1961743002: Subzero: Update for LLVM 3.9 (trunk). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero@master
Patch Set: Remove unnecessary variable Created 4 years, 7 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
« no previous file with comments | « src/IceCompiler.cpp ('k') | src/IceInst.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceConverter.cpp - Converts LLVM to Ice ---------------===// 1 //===- subzero/src/IceConverter.cpp - Converts LLVM to Ice ---------------===//
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 /// \file 10 /// \file
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 NodeMap.clear(); 104 NodeMap.clear();
105 Func->setFunctionName( 105 Func->setFunctionName(
106 Ctx->getGlobalString(Ice::mangleName(F->getName()))); 106 Ctx->getGlobalString(Ice::mangleName(F->getName())));
107 Func->setReturnType(convertToIceType(F->getReturnType())); 107 Func->setReturnType(convertToIceType(F->getReturnType()));
108 Func->setInternal(F->hasInternalLinkage()); 108 Func->setInternal(F->hasInternalLinkage());
109 Ice::TimerMarker T(Ice::TimerStack::TT_llvmConvert, Func.get()); 109 Ice::TimerMarker T(Ice::TimerStack::TT_llvmConvert, Func.get());
110 110
111 // The initial definition/use of each arg is the entry node. 111 // The initial definition/use of each arg is the entry node.
112 for (auto ArgI = F->arg_begin(), ArgE = F->arg_end(); ArgI != ArgE; 112 for (auto ArgI = F->arg_begin(), ArgE = F->arg_end(); ArgI != ArgE;
113 ++ArgI) { 113 ++ArgI) {
114 Func->addArg(mapValueToIceVar(ArgI)); 114 Func->addArg(mapValueToIceVar(&*ArgI));
115 } 115 }
116 116
117 // Make an initial pass through the block list just to resolve the blocks 117 // Make an initial pass through the block list just to resolve the blocks
118 // in the original linearized order. Otherwise the ICE linearized order 118 // in the original linearized order. Otherwise the ICE linearized order
119 // will be affected by branch targets in terminator instructions. 119 // will be affected by branch targets in terminator instructions.
120 for (const BasicBlock &BBI : *F) 120 for (const BasicBlock &BBI : *F)
121 mapBasicBlockToNode(&BBI); 121 mapBasicBlockToNode(&BBI);
122 for (const BasicBlock &BBI : *F) 122 for (const BasicBlock &BBI : *F)
123 convertBasicBlock(&BBI); 123 convertBasicBlock(&BBI);
124 Func->setEntryNode(mapBasicBlockToNode(&F->getEntryBlock())); 124 Func->setEntryNode(mapBasicBlockToNode(&F->getEntryBlock()));
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 } 701 }
702 702
703 Ice::VariableDeclarationList *GlobalPool; 703 Ice::VariableDeclarationList *GlobalPool;
704 }; 704 };
705 705
706 void LLVM2ICEGlobalsConverter::convertGlobalsToIce(Module *Mod) { 706 void LLVM2ICEGlobalsConverter::convertGlobalsToIce(Module *Mod) {
707 for (Module::const_global_iterator I = Mod->global_begin(), 707 for (Module::const_global_iterator I = Mod->global_begin(),
708 E = Mod->global_end(); 708 E = Mod->global_end();
709 I != E; ++I) { 709 I != E; ++I) {
710 710
711 const GlobalVariable *GV = I; 711 const GlobalVariable *GV = &*I;
712 712
713 Ice::GlobalDeclaration *Var = getConverter().getGlobalDeclaration(GV); 713 Ice::GlobalDeclaration *Var = getConverter().getGlobalDeclaration(GV);
714 auto *VarDecl = cast<Ice::VariableDeclaration>(Var); 714 auto *VarDecl = cast<Ice::VariableDeclaration>(Var);
715 GlobalPool->push_back(VarDecl); 715 GlobalPool->push_back(VarDecl);
716 716
717 if (!GV->hasInternalLinkage() && GV->hasInitializer()) { 717 if (!GV->hasInternalLinkage() && GV->hasInitializer()) {
718 std::string Buffer; 718 std::string Buffer;
719 raw_string_ostream StrBuf(Buffer); 719 raw_string_ostream StrBuf(Buffer);
720 StrBuf << "Can't define external global declaration: " << GV->getName(); 720 StrBuf << "Can't define external global declaration: " << GV->getName();
721 report_fatal_error(StrBuf.str()); 721 report_fatal_error(StrBuf.str());
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 report_fatal_error(StrBuf.str()); 881 report_fatal_error(StrBuf.str());
882 } 882 }
883 if (!IceFunc->validateTypeSignature(Ctx)) 883 if (!IceFunc->validateTypeSignature(Ctx))
884 report_fatal_error(IceFunc->getTypeSignatureError(Ctx)); 884 report_fatal_error(IceFunc->getTypeSignatureError(Ctx));
885 GlobalDeclarationMap[&Func] = IceFunc; 885 GlobalDeclarationMap[&Func] = IceFunc;
886 } 886 }
887 // Install global variable declarations. 887 // Install global variable declarations.
888 for (Module::const_global_iterator I = Mod->global_begin(), 888 for (Module::const_global_iterator I = Mod->global_begin(),
889 E = Mod->global_end(); 889 E = Mod->global_end();
890 I != E; ++I) { 890 I != E; ++I) {
891 const GlobalVariable *GV = I; 891 const GlobalVariable *GV = &*I;
892 constexpr bool NoSuppressMangling = false; 892 constexpr bool NoSuppressMangling = false;
893 auto *Var = VariableDeclaration::create( 893 auto *Var = VariableDeclaration::create(
894 GlobalDeclarationsPool.get(), NoSuppressMangling, GV->getLinkage()); 894 GlobalDeclarationsPool.get(), NoSuppressMangling, GV->getLinkage());
895 Var->setAlignment(GV->getAlignment()); 895 Var->setAlignment(GV->getAlignment());
896 Var->setIsConstant(GV->isConstant()); 896 Var->setIsConstant(GV->isConstant());
897 Var->setName(Ctx, GV->getName()); 897 Var->setName(Ctx, GV->getName());
898 if (!Var->verifyLinkageCorrect()) { 898 if (!Var->verifyLinkageCorrect()) {
899 std::string Buffer; 899 std::string Buffer;
900 raw_string_ostream StrBuf(Buffer); 900 raw_string_ostream StrBuf(Buffer);
901 StrBuf << "Global " << Var->getName() 901 StrBuf << "Global " << Var->getName()
(...skipping 16 matching lines...) Expand all
918 for (const Function &I : *Mod) { 918 for (const Function &I : *Mod) {
919 if (I.empty()) 919 if (I.empty())
920 continue; 920 continue;
921 TimerMarker _(Ctx, I.getName()); 921 TimerMarker _(Ctx, I.getName());
922 LLVM2ICEFunctionConverter FunctionConverter(*this); 922 LLVM2ICEFunctionConverter FunctionConverter(*this);
923 FunctionConverter.convertFunction(&I); 923 FunctionConverter.convertFunction(&I);
924 } 924 }
925 } 925 }
926 926
927 } // end of namespace Ice 927 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCompiler.cpp ('k') | src/IceInst.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698