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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 private: | 669 private: |
670 // Data | 670 // Data |
671 Ice::GlobalContext *Ctx; | 671 Ice::GlobalContext *Ctx; |
672 Ice::Cfg *Func; | 672 Ice::Cfg *Func; |
673 Ice::CfgNode *CurrentNode; | 673 Ice::CfgNode *CurrentNode; |
674 Ice::Type SubzeroPointerType; | 674 Ice::Type SubzeroPointerType; |
675 std::map<const Value *, Ice::Variable *> VarMap; | 675 std::map<const Value *, Ice::Variable *> VarMap; |
676 std::map<const BasicBlock *, Ice::CfgNode *> NodeMap; | 676 std::map<const BasicBlock *, Ice::CfgNode *> NodeMap; |
677 }; | 677 }; |
678 | 678 |
679 } // end of anonymous namespace. | 679 } // end of anonymous namespace |
680 | 680 |
681 namespace Ice { | 681 namespace Ice { |
682 | 682 |
683 void Converter::convertToIce(Module *Mod) { | 683 void Converter::convertToIce(Module *Mod) { |
684 if (!Flags.DisableGlobals) | 684 if (!Ctx->getFlags().DisableGlobals) |
685 convertGlobals(Mod); | 685 convertGlobals(Mod); |
686 convertFunctions(Mod); | 686 convertFunctions(Mod); |
687 } | 687 } |
688 | 688 |
689 void Converter::convertGlobals(Module *Mod) { | 689 void Converter::convertGlobals(Module *Mod) { |
690 OwningPtr<TargetGlobalInitLowering> GlobalLowering( | 690 OwningPtr<TargetGlobalInitLowering> GlobalLowering( |
691 TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx)); | 691 TargetGlobalInitLowering::createLowering(Ctx->getTargetArch(), Ctx)); |
692 for (Module::const_global_iterator I = Mod->global_begin(), | 692 for (Module::const_global_iterator I = Mod->global_begin(), |
693 E = Mod->global_end(); | 693 E = Mod->global_end(); |
694 I != E; ++I) { | 694 I != E; ++I) { |
(...skipping 21 matching lines...) Expand all Loading... |
716 NumElements = AT->getNumElements(); | 716 NumElements = AT->getNumElements(); |
717 IsZeroInitializer = true; | 717 IsZeroInitializer = true; |
718 } else { | 718 } else { |
719 llvm_unreachable("Unhandled constant aggregate zero type"); | 719 llvm_unreachable("Unhandled constant aggregate zero type"); |
720 } | 720 } |
721 } else { | 721 } else { |
722 llvm_unreachable("Unhandled global initializer"); | 722 llvm_unreachable("Unhandled global initializer"); |
723 } | 723 } |
724 | 724 |
725 GlobalLowering->lower(Name, Align, IsInternal, IsConst, IsZeroInitializer, | 725 GlobalLowering->lower(Name, Align, IsInternal, IsConst, IsZeroInitializer, |
726 NumElements, Data, Flags.DisableTranslation); | 726 NumElements, Data, |
| 727 Ctx->getFlags().DisableTranslation); |
727 } | 728 } |
728 GlobalLowering.reset(); | 729 GlobalLowering.reset(); |
729 } | 730 } |
730 | 731 |
731 void Converter::convertFunctions(Module *Mod) { | 732 void Converter::convertFunctions(Module *Mod) { |
732 for (Module::const_iterator I = Mod->begin(), E = Mod->end(); I != E; ++I) { | 733 for (Module::const_iterator I = Mod->begin(), E = Mod->end(); I != E; ++I) { |
733 if (I->empty()) | 734 if (I->empty()) |
734 continue; | 735 continue; |
735 LLVM2ICEConverter FunctionConverter(Ctx); | 736 LLVM2ICEConverter FunctionConverter(Ctx); |
736 | 737 |
737 Timer TConvert; | 738 Timer TConvert; |
738 Cfg *Fcn = FunctionConverter.convertFunction(I); | 739 Cfg *Fcn = FunctionConverter.convertFunction(I); |
739 if (Flags.SubzeroTimingEnabled) { | 740 if (Ctx->getFlags().SubzeroTimingEnabled) { |
740 std::cerr << "[Subzero timing] Convert function " | 741 std::cerr << "[Subzero timing] Convert function " |
741 << Fcn->getFunctionName() << ": " << TConvert.getElapsedSec() | 742 << Fcn->getFunctionName() << ": " << TConvert.getElapsedSec() |
742 << " sec\n"; | 743 << " sec\n"; |
743 } | 744 } |
744 translateFcn(Fcn); | 745 translateFcn(Fcn); |
745 } | 746 } |
746 | 747 |
747 emitConstants(); | 748 emitConstants(); |
748 } | 749 } |
749 | 750 |
750 } // end of Ice namespace. | 751 } // end of namespace Ice |
OLD | NEW |