OLD | NEW |
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 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 for (const Function &Func : *Mod) { | 844 for (const Function &Func : *Mod) { |
845 FuncSigType Signature; | 845 FuncSigType Signature; |
846 FunctionType *FuncType = Func.getFunctionType(); | 846 FunctionType *FuncType = Func.getFunctionType(); |
847 Signature.setReturnType( | 847 Signature.setReturnType( |
848 Converter.convertToIceType(FuncType->getReturnType())); | 848 Converter.convertToIceType(FuncType->getReturnType())); |
849 for (size_t I = 0; I < FuncType->getNumParams(); ++I) { | 849 for (size_t I = 0; I < FuncType->getNumParams(); ++I) { |
850 Signature.appendArgType( | 850 Signature.appendArgType( |
851 Converter.convertToIceType(FuncType->getParamType(I))); | 851 Converter.convertToIceType(FuncType->getParamType(I))); |
852 } | 852 } |
853 FunctionDeclaration *IceFunc = FunctionDeclaration::create( | 853 FunctionDeclaration *IceFunc = FunctionDeclaration::create( |
854 Ctx, Signature, Func.getCallingConv(), Func.getLinkage(), Func.empty()); | 854 Signature, Func.getCallingConv(), Func.getLinkage(), Func.empty()); |
855 IceFunc->setName(Func.getName()); | 855 IceFunc->setName(Func.getName()); |
856 GlobalDeclarationMap[&Func] = IceFunc; | 856 GlobalDeclarationMap[&Func] = IceFunc; |
857 } | 857 } |
858 // Install global variable declarations. | 858 // Install global variable declarations. |
859 for (Module::const_global_iterator I = Mod->global_begin(), | 859 for (Module::const_global_iterator I = Mod->global_begin(), |
860 E = Mod->global_end(); | 860 E = Mod->global_end(); |
861 I != E; ++I) { | 861 I != E; ++I) { |
862 const GlobalVariable *GV = I; | 862 const GlobalVariable *GV = I; |
863 VariableDeclaration *Var = VariableDeclaration::create(Ctx); | 863 VariableDeclaration *Var = VariableDeclaration::create(); |
864 Var->setName(GV->getName()); | 864 Var->setName(GV->getName()); |
865 Var->setAlignment(GV->getAlignment()); | 865 Var->setAlignment(GV->getAlignment()); |
866 Var->setIsConstant(GV->isConstant()); | 866 Var->setIsConstant(GV->isConstant()); |
867 Var->setLinkage(GV->getLinkage()); | 867 Var->setLinkage(GV->getLinkage()); |
868 GlobalDeclarationMap[GV] = Var; | 868 GlobalDeclarationMap[GV] = Var; |
869 } | 869 } |
870 } | 870 } |
871 | 871 |
872 void Converter::convertGlobals(Module *Mod) { | 872 void Converter::convertGlobals(Module *Mod) { |
873 LLVM2ICEGlobalsConverter GlobalsConverter(*this); | 873 LLVM2ICEGlobalsConverter GlobalsConverter(*this); |
(...skipping 18 matching lines...) Expand all Loading... |
892 Cfg *Fcn = FunctionConverter.convertFunction(&I); | 892 Cfg *Fcn = FunctionConverter.convertFunction(&I); |
893 translateFcn(Fcn); | 893 translateFcn(Fcn); |
894 if (ALLOW_DUMP && Ctx->getFlags().TimeEachFunction) | 894 if (ALLOW_DUMP && Ctx->getFlags().TimeEachFunction) |
895 Ctx->popTimer(TimerID, StackID); | 895 Ctx->popTimer(TimerID, StackID); |
896 } | 896 } |
897 | 897 |
898 emitConstants(); | 898 emitConstants(); |
899 } | 899 } |
900 | 900 |
901 } // end of namespace Ice | 901 } // end of namespace Ice |
OLD | NEW |