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

Side by Side Diff: src/IceConverter.cpp

Issue 1197863003: Subzero: Reduce the amount of #ifdef'd code. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Cleanup Created 5 years, 6 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/IceDefs.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 // This file implements the LLVM to ICE converter. 10 // This file implements the LLVM to ICE converter.
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 private: 161 private:
162 // LLVM values (instructions, etc.) are mapped directly to ICE variables. 162 // LLVM values (instructions, etc.) are mapped directly to ICE variables.
163 // mapValueToIceVar has a version that forces an ICE type on the variable, 163 // mapValueToIceVar has a version that forces an ICE type on the variable,
164 // and a version that just uses convertToIceType on V. 164 // and a version that just uses convertToIceType on V.
165 Ice::Variable *mapValueToIceVar(const Value *V, Ice::Type IceTy) { 165 Ice::Variable *mapValueToIceVar(const Value *V, Ice::Type IceTy) {
166 if (IceTy == Ice::IceType_void) 166 if (IceTy == Ice::IceType_void)
167 return nullptr; 167 return nullptr;
168 if (VarMap.find(V) == VarMap.end()) { 168 if (VarMap.find(V) == VarMap.end()) {
169 VarMap[V] = Func->makeVariable(IceTy); 169 VarMap[V] = Func->makeVariable(IceTy);
170 if (ALLOW_DUMP) 170 if (Ice::BuildDefs::dump())
171 VarMap[V]->setName(Func.get(), V->getName()); 171 VarMap[V]->setName(Func.get(), V->getName());
172 } 172 }
173 return VarMap[V]; 173 return VarMap[V];
174 } 174 }
175 175
176 Ice::Variable *mapValueToIceVar(const Value *V) { 176 Ice::Variable *mapValueToIceVar(const Value *V) {
177 return mapValueToIceVar(V, convertToIceType(V->getType())); 177 return mapValueToIceVar(V, convertToIceType(V->getType()));
178 } 178 }
179 179
180 Ice::CfgNode *mapBasicBlockToNode(const BasicBlock *BB) { 180 Ice::CfgNode *mapBasicBlockToNode(const BasicBlock *BB) {
181 if (NodeMap.find(BB) == NodeMap.end()) { 181 if (NodeMap.find(BB) == NodeMap.end()) {
182 NodeMap[BB] = Func->makeNode(); 182 NodeMap[BB] = Func->makeNode();
183 if (ALLOW_DUMP) 183 if (Ice::BuildDefs::dump())
184 NodeMap[BB]->setName(BB->getName()); 184 NodeMap[BB]->setName(BB->getName());
185 } 185 }
186 return NodeMap[BB]; 186 return NodeMap[BB];
187 } 187 }
188 188
189 Ice::Type convertToIceType(Type *LLVMTy) const { 189 Ice::Type convertToIceType(Type *LLVMTy) const {
190 Ice::Type IceTy = TypeConverter.convertToIceType(LLVMTy); 190 Ice::Type IceTy = TypeConverter.convertToIceType(LLVMTy);
191 if (IceTy == Ice::IceType_NUM) 191 if (IceTy == Ice::IceType_NUM)
192 report_fatal_error(std::string("Invalid PNaCl type ") + 192 report_fatal_error(std::string("Invalid PNaCl type ") +
193 LLVMObjectAsString(LLVMTy)); 193 LLVMObjectAsString(LLVMTy));
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 Ctx->pushTimer(TimerID, StackID); 902 Ctx->pushTimer(TimerID, StackID);
903 } 903 }
904 LLVM2ICEFunctionConverter FunctionConverter(*this); 904 LLVM2ICEFunctionConverter FunctionConverter(*this);
905 FunctionConverter.convertFunction(&I); 905 FunctionConverter.convertFunction(&I);
906 if (TimeThisFunction) 906 if (TimeThisFunction)
907 Ctx->popTimer(TimerID, StackID); 907 Ctx->popTimer(TimerID, StackID);
908 } 908 }
909 } 909 }
910 910
911 } // end of namespace Ice 911 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCompiler.cpp ('k') | src/IceDefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698