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 /// \file | 10 /// \file |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 Converter.convertToIceType(FuncType->getParamType(I))); | 865 Converter.convertToIceType(FuncType->getParamType(I))); |
866 } | 866 } |
867 FunctionDeclaration *IceFunc = FunctionDeclaration::create( | 867 FunctionDeclaration *IceFunc = FunctionDeclaration::create( |
868 Ctx, Signature, Func.getCallingConv(), Func.getLinkage(), Func.empty()); | 868 Ctx, Signature, Func.getCallingConv(), Func.getLinkage(), Func.empty()); |
869 IceFunc->setName(Func.getName()); | 869 IceFunc->setName(Func.getName()); |
870 if (!IceFunc->verifyLinkageCorrect(Ctx)) { | 870 if (!IceFunc->verifyLinkageCorrect(Ctx)) { |
871 std::string Buffer; | 871 std::string Buffer; |
872 raw_string_ostream StrBuf(Buffer); | 872 raw_string_ostream StrBuf(Buffer); |
873 StrBuf << "Function " << IceFunc->getName() | 873 StrBuf << "Function " << IceFunc->getName() |
874 << " has incorrect linkage: " << IceFunc->getLinkageName(); | 874 << " has incorrect linkage: " << IceFunc->getLinkageName(); |
| 875 if (IceFunc->isExternal()) |
| 876 StrBuf << "\n Use flag -allow-externally-defined-symbols to override"; |
875 report_fatal_error(StrBuf.str()); | 877 report_fatal_error(StrBuf.str()); |
876 } | 878 } |
877 GlobalDeclarationMap[&Func] = IceFunc; | 879 GlobalDeclarationMap[&Func] = IceFunc; |
878 } | 880 } |
879 // Install global variable declarations. | 881 // Install global variable declarations. |
880 for (Module::const_global_iterator I = Mod->global_begin(), | 882 for (Module::const_global_iterator I = Mod->global_begin(), |
881 E = Mod->global_end(); | 883 E = Mod->global_end(); |
882 I != E; ++I) { | 884 I != E; ++I) { |
883 const GlobalVariable *GV = I; | 885 const GlobalVariable *GV = I; |
884 VariableDeclaration *Var = VariableDeclaration::create(Ctx); | 886 VariableDeclaration *Var = VariableDeclaration::create(Ctx); |
885 Var->setName(GV->getName()); | 887 Var->setName(GV->getName()); |
886 Var->setAlignment(GV->getAlignment()); | 888 Var->setAlignment(GV->getAlignment()); |
887 Var->setIsConstant(GV->isConstant()); | 889 Var->setIsConstant(GV->isConstant()); |
888 Var->setLinkage(GV->getLinkage()); | 890 Var->setLinkage(GV->getLinkage()); |
889 if (!Var->verifyLinkageCorrect(Ctx)) { | 891 if (!Var->verifyLinkageCorrect(Ctx)) { |
890 std::string Buffer; | 892 std::string Buffer; |
891 raw_string_ostream StrBuf(Buffer); | 893 raw_string_ostream StrBuf(Buffer); |
892 StrBuf << "Global " << Var->getName() | 894 StrBuf << "Global " << Var->getName() |
893 << " has incorrect linkage: " << Var->getLinkageName(); | 895 << " has incorrect linkage: " << Var->getLinkageName(); |
| 896 if (Var->isExternal()) |
| 897 StrBuf << "\n Use flag -allow-externally-defined-symbols to override"; |
894 report_fatal_error(StrBuf.str()); | 898 report_fatal_error(StrBuf.str()); |
895 } | 899 } |
896 GlobalDeclarationMap[GV] = Var; | 900 GlobalDeclarationMap[GV] = Var; |
897 } | 901 } |
898 } | 902 } |
899 | 903 |
900 void Converter::convertGlobals(Module *Mod) { | 904 void Converter::convertGlobals(Module *Mod) { |
901 lowerGlobals(LLVM2ICEGlobalsConverter(*this).convertGlobalsToIce(Mod)); | 905 lowerGlobals(LLVM2ICEGlobalsConverter(*this).convertGlobalsToIce(Mod)); |
902 } | 906 } |
903 | 907 |
(...skipping 10 matching lines...) Expand all Loading... |
914 Ctx->pushTimer(TimerID, StackID); | 918 Ctx->pushTimer(TimerID, StackID); |
915 } | 919 } |
916 LLVM2ICEFunctionConverter FunctionConverter(*this); | 920 LLVM2ICEFunctionConverter FunctionConverter(*this); |
917 FunctionConverter.convertFunction(&I); | 921 FunctionConverter.convertFunction(&I); |
918 if (TimeThisFunction) | 922 if (TimeThisFunction) |
919 Ctx->popTimer(TimerID, StackID); | 923 Ctx->popTimer(TimerID, StackID); |
920 } | 924 } |
921 } | 925 } |
922 | 926 |
923 } // end of namespace Ice | 927 } // end of namespace Ice |
OLD | NEW |