| 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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 | 786 |
| 787 } // end of anonymous namespace | 787 } // end of anonymous namespace |
| 788 | 788 |
| 789 namespace Ice { | 789 namespace Ice { |
| 790 | 790 |
| 791 void Converter::nameUnnamedGlobalVariables(Module *Mod) { | 791 void Converter::nameUnnamedGlobalVariables(Module *Mod) { |
| 792 const IceString &GlobalPrefix = Flags.DefaultGlobalPrefix; | 792 const IceString &GlobalPrefix = Flags.DefaultGlobalPrefix; |
| 793 if (GlobalPrefix.empty()) | 793 if (GlobalPrefix.empty()) |
| 794 return; | 794 return; |
| 795 uint32_t NameIndex = 0; | 795 uint32_t NameIndex = 0; |
| 796 Ostream &errs = Ctx->getStrDump(); | |
| 797 for (auto V = Mod->global_begin(), E = Mod->global_end(); V != E; ++V) { | 796 for (auto V = Mod->global_begin(), E = Mod->global_end(); V != E; ++V) { |
| 798 if (!V->hasName()) { | 797 if (!V->hasName()) { |
| 799 V->setName(createUnnamedName(GlobalPrefix, NameIndex)); | 798 V->setName(createUnnamedName(GlobalPrefix, NameIndex)); |
| 800 ++NameIndex; | 799 ++NameIndex; |
| 801 } else { | 800 } else { |
| 802 checkIfUnnamedNameSafe(V->getName(), "global", GlobalPrefix, errs); | 801 checkIfUnnamedNameSafe(V->getName(), "global", GlobalPrefix); |
| 803 } | 802 } |
| 804 } | 803 } |
| 805 } | 804 } |
| 806 | 805 |
| 807 void Converter::nameUnnamedFunctions(Module *Mod) { | 806 void Converter::nameUnnamedFunctions(Module *Mod) { |
| 808 const IceString &FunctionPrefix = Flags.DefaultFunctionPrefix; | 807 const IceString &FunctionPrefix = Flags.DefaultFunctionPrefix; |
| 809 if (FunctionPrefix.empty()) | 808 if (FunctionPrefix.empty()) |
| 810 return; | 809 return; |
| 811 uint32_t NameIndex = 0; | 810 uint32_t NameIndex = 0; |
| 812 Ostream &errs = Ctx->getStrDump(); | |
| 813 for (Function &F : *Mod) { | 811 for (Function &F : *Mod) { |
| 814 if (!F.hasName()) { | 812 if (!F.hasName()) { |
| 815 F.setName(createUnnamedName(FunctionPrefix, NameIndex)); | 813 F.setName(createUnnamedName(FunctionPrefix, NameIndex)); |
| 816 ++NameIndex; | 814 ++NameIndex; |
| 817 } else { | 815 } else { |
| 818 checkIfUnnamedNameSafe(F.getName(), "function", FunctionPrefix, errs); | 816 checkIfUnnamedNameSafe(F.getName(), "function", FunctionPrefix); |
| 819 } | 817 } |
| 820 } | 818 } |
| 821 } | 819 } |
| 822 | 820 |
| 823 void Converter::convertToIce() { | 821 void Converter::convertToIce() { |
| 824 TimerMarker T(TimerStack::TT_convertToIce, Ctx); | 822 TimerMarker T(TimerStack::TT_convertToIce, Ctx); |
| 825 nameUnnamedGlobalVariables(Mod); | 823 nameUnnamedGlobalVariables(Mod); |
| 826 nameUnnamedFunctions(Mod); | 824 nameUnnamedFunctions(Mod); |
| 827 installGlobalDeclarations(Mod); | 825 installGlobalDeclarations(Mod); |
| 828 convertGlobals(Mod); | 826 convertGlobals(Mod); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 Cfg *Fcn = FunctionConverter.convertFunction(&I); | 892 Cfg *Fcn = FunctionConverter.convertFunction(&I); |
| 895 translateFcn(Fcn); | 893 translateFcn(Fcn); |
| 896 if (ALLOW_DUMP && Ctx->getFlags().TimeEachFunction) | 894 if (ALLOW_DUMP && Ctx->getFlags().TimeEachFunction) |
| 897 Ctx->popTimer(TimerID, StackID); | 895 Ctx->popTimer(TimerID, StackID); |
| 898 } | 896 } |
| 899 | 897 |
| 900 emitConstants(); | 898 emitConstants(); |
| 901 } | 899 } |
| 902 | 900 |
| 903 } // end of namespace Ice | 901 } // end of namespace Ice |
| OLD | NEW |