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

Side by Side Diff: src/PNaClTranslator.cpp

Issue 1201023002: Subzero: Use more "= default;" for ctors and dtors. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: 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/IceTargetLoweringMIPS32.h ('k') | no next file » | 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/PNaClTranslator.cpp - ICE from bitcode -----------------===// 1 //===- subzero/src/PNaClTranslator.cpp - ICE from bitcode -----------------===//
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 PNaCl bitcode file to Ice, to machine code 10 // This file implements the PNaCl bitcode file to Ice, to machine code
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 public: 162 public:
163 typedef std::vector<Ice::FunctionDeclaration *> FunctionDeclarationListType; 163 typedef std::vector<Ice::FunctionDeclaration *> FunctionDeclarationListType;
164 164
165 TopLevelParser(Ice::Translator &Translator, NaClBitstreamCursor &Cursor, 165 TopLevelParser(Ice::Translator &Translator, NaClBitstreamCursor &Cursor,
166 Ice::ErrorCode &ErrorStatus) 166 Ice::ErrorCode &ErrorStatus)
167 : NaClBitcodeParser(Cursor), Translator(Translator), 167 : NaClBitcodeParser(Cursor), Translator(Translator),
168 ErrorStatus(ErrorStatus), 168 ErrorStatus(ErrorStatus),
169 VariableDeclarations(new Ice::VariableDeclarationList()) {} 169 VariableDeclarations(new Ice::VariableDeclarationList()) {}
170 170
171 ~TopLevelParser() override {} 171 ~TopLevelParser() override = default;
172 172
173 Ice::Translator &getTranslator() const { return Translator; } 173 Ice::Translator &getTranslator() const { return Translator; }
174 174
175 void setBlockParser(BlockParserBaseClass *NewBlockParser) { 175 void setBlockParser(BlockParserBaseClass *NewBlockParser) {
176 BlockParser = NewBlockParser; 176 BlockParser = NewBlockParser;
177 } 177 }
178 178
179 /// Generates error with given Message, occurring at BitPosition 179 /// Generates error with given Message, occurring at BitPosition
180 /// within the bitcode file. Always returns true. 180 /// within the bitcode file. Always returns true.
181 bool ErrorAt(naclbitc::ErrorLevel Level, uint64_t BitPosition, 181 bool ErrorAt(naclbitc::ErrorLevel Level, uint64_t BitPosition,
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 class TypesParser : public BlockParserBaseClass { 721 class TypesParser : public BlockParserBaseClass {
722 TypesParser() = delete; 722 TypesParser() = delete;
723 TypesParser(const TypesParser &) = delete; 723 TypesParser(const TypesParser &) = delete;
724 TypesParser &operator=(const TypesParser &) = delete; 724 TypesParser &operator=(const TypesParser &) = delete;
725 725
726 public: 726 public:
727 TypesParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser) 727 TypesParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser)
728 : BlockParserBaseClass(BlockID, EnclosingParser), 728 : BlockParserBaseClass(BlockID, EnclosingParser),
729 Timer(Ice::TimerStack::TT_parseTypes, getTranslator().getContext()) {} 729 Timer(Ice::TimerStack::TT_parseTypes, getTranslator().getContext()) {}
730 730
731 ~TypesParser() override {} 731 ~TypesParser() override = default;
732 732
733 private: 733 private:
734 Ice::TimerMarker Timer; 734 Ice::TimerMarker Timer;
735 // The type ID that will be associated with the next type defining 735 // The type ID that will be associated with the next type defining
736 // record in the types block. 736 // record in the types block.
737 unsigned NextTypeId = 0; 737 unsigned NextTypeId = 0;
738 738
739 void ProcessRecord() override; 739 void ProcessRecord() override;
740 740
741 const char *getBlockName() const override { return "type"; } 741 const char *getBlockName() const override { return "type"; }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 GlobalsParser &operator=(const GlobalsParser &) = delete; 902 GlobalsParser &operator=(const GlobalsParser &) = delete;
903 903
904 public: 904 public:
905 GlobalsParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser) 905 GlobalsParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser)
906 : BlockParserBaseClass(BlockID, EnclosingParser), 906 : BlockParserBaseClass(BlockID, EnclosingParser),
907 Timer(Ice::TimerStack::TT_parseGlobals, getTranslator().getContext()), 907 Timer(Ice::TimerStack::TT_parseGlobals, getTranslator().getContext()),
908 DummyGlobalVar( 908 DummyGlobalVar(
909 Ice::VariableDeclaration::create(getTranslator().getContext())), 909 Ice::VariableDeclaration::create(getTranslator().getContext())),
910 CurGlobalVar(DummyGlobalVar) {} 910 CurGlobalVar(DummyGlobalVar) {}
911 911
912 ~GlobalsParser() final {} 912 ~GlobalsParser() final = default;
913 913
914 const char *getBlockName() const override { return "globals"; } 914 const char *getBlockName() const override { return "globals"; }
915 915
916 private: 916 private:
917 Ice::TimerMarker Timer; 917 Ice::TimerMarker Timer;
918 // Keeps track of how many initializers are expected for the global variable 918 // Keeps track of how many initializers are expected for the global variable
919 // declaration being built. 919 // declaration being built.
920 unsigned InitializersNeeded = 0; 920 unsigned InitializersNeeded = 0;
921 921
922 // The index of the next global variable declaration. 922 // The index of the next global variable declaration.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 /// Base class for parsing a valuesymtab block in the bitcode file. 1056 /// Base class for parsing a valuesymtab block in the bitcode file.
1057 class ValuesymtabParser : public BlockParserBaseClass { 1057 class ValuesymtabParser : public BlockParserBaseClass {
1058 ValuesymtabParser() = delete; 1058 ValuesymtabParser() = delete;
1059 ValuesymtabParser(const ValuesymtabParser &) = delete; 1059 ValuesymtabParser(const ValuesymtabParser &) = delete;
1060 void operator=(const ValuesymtabParser &) = delete; 1060 void operator=(const ValuesymtabParser &) = delete;
1061 1061
1062 public: 1062 public:
1063 ValuesymtabParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser) 1063 ValuesymtabParser(unsigned BlockID, BlockParserBaseClass *EnclosingParser)
1064 : BlockParserBaseClass(BlockID, EnclosingParser) {} 1064 : BlockParserBaseClass(BlockID, EnclosingParser) {}
1065 1065
1066 ~ValuesymtabParser() override {} 1066 ~ValuesymtabParser() override = default;
1067 1067
1068 const char *getBlockName() const override { return "valuesymtab"; } 1068 const char *getBlockName() const override { return "valuesymtab"; }
1069 1069
1070 protected: 1070 protected:
1071 typedef SmallString<128> StringType; 1071 typedef SmallString<128> StringType;
1072 1072
1073 // Associates Name with the value defined by the given Index. 1073 // Associates Name with the value defined by the given Index.
1074 virtual void setValueName(uint64_t Index, StringType &Name) = 0; 1074 virtual void setValueName(uint64_t Index, StringType &Name) = 0;
1075 1075
1076 // Associates Name with the value defined by the given Index; 1076 // Associates Name with the value defined by the given Index;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 if (Context->getNumErrors() == 0 && Func) { 1180 if (Context->getNumErrors() == 0 && Func) {
1181 getTranslator().translateFcn(std::move(Func)); 1181 getTranslator().translateFcn(std::move(Func));
1182 // The translator now has ownership of Func. 1182 // The translator now has ownership of Func.
1183 } else { 1183 } else {
1184 Func.reset(); 1184 Func.reset();
1185 } 1185 }
1186 1186
1187 return ParserResult; 1187 return ParserResult;
1188 } 1188 }
1189 1189
1190 ~FunctionParser() final {} 1190 ~FunctionParser() final = default;
1191 1191
1192 const char *getBlockName() const override { return "function"; } 1192 const char *getBlockName() const override { return "function"; }
1193 1193
1194 Ice::Cfg *getFunc() const { return Func.get(); } 1194 Ice::Cfg *getFunc() const { return Func.get(); }
1195 1195
1196 uint32_t getNumGlobalIDs() const { return CachedNumGlobalValueIDs; } 1196 uint32_t getNumGlobalIDs() const { return CachedNumGlobalValueIDs; }
1197 1197
1198 void setNextLocalInstIndex(Ice::Operand *Op) { 1198 void setNextLocalInstIndex(Ice::Operand *Op) {
1199 setOperand(NextLocalInstIndex++, Op); 1199 setOperand(NextLocalInstIndex++, Op);
1200 } 1200 }
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 ConstantsParser() = delete; 2599 ConstantsParser() = delete;
2600 ConstantsParser(const ConstantsParser &) = delete; 2600 ConstantsParser(const ConstantsParser &) = delete;
2601 ConstantsParser &operator=(const ConstantsParser &) = delete; 2601 ConstantsParser &operator=(const ConstantsParser &) = delete;
2602 2602
2603 public: 2603 public:
2604 ConstantsParser(unsigned BlockID, FunctionParser *FuncParser) 2604 ConstantsParser(unsigned BlockID, FunctionParser *FuncParser)
2605 : BlockParserBaseClass(BlockID, FuncParser), 2605 : BlockParserBaseClass(BlockID, FuncParser),
2606 Timer(Ice::TimerStack::TT_parseConstants, getTranslator().getContext()), 2606 Timer(Ice::TimerStack::TT_parseConstants, getTranslator().getContext()),
2607 FuncParser(FuncParser) {} 2607 FuncParser(FuncParser) {}
2608 2608
2609 ~ConstantsParser() override {} 2609 ~ConstantsParser() override = default;
2610 2610
2611 const char *getBlockName() const override { return "constants"; } 2611 const char *getBlockName() const override { return "constants"; }
2612 2612
2613 private: 2613 private:
2614 Ice::TimerMarker Timer; 2614 Ice::TimerMarker Timer;
2615 // The parser of the function block this constants block appears in. 2615 // The parser of the function block this constants block appears in.
2616 FunctionParser *FuncParser; 2616 FunctionParser *FuncParser;
2617 // The type to use for succeeding constants. 2617 // The type to use for succeeding constants.
2618 Ice::Type NextConstantType = Ice::IceType_void; 2618 Ice::Type NextConstantType = Ice::IceType_void;
2619 2619
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2814 ModuleParser() = delete; 2814 ModuleParser() = delete;
2815 ModuleParser(const ModuleParser &) = delete; 2815 ModuleParser(const ModuleParser &) = delete;
2816 ModuleParser &operator=(const ModuleParser &) = delete; 2816 ModuleParser &operator=(const ModuleParser &) = delete;
2817 2817
2818 public: 2818 public:
2819 ModuleParser(unsigned BlockID, TopLevelParser *Context) 2819 ModuleParser(unsigned BlockID, TopLevelParser *Context)
2820 : BlockParserBaseClass(BlockID, Context), 2820 : BlockParserBaseClass(BlockID, Context),
2821 Timer(Ice::TimerStack::TT_parseModule, 2821 Timer(Ice::TimerStack::TT_parseModule,
2822 Context->getTranslator().getContext()) {} 2822 Context->getTranslator().getContext()) {}
2823 2823
2824 ~ModuleParser() override {} 2824 ~ModuleParser() override = default;
2825 2825
2826 const char *getBlockName() const override { return "module"; } 2826 const char *getBlockName() const override { return "module"; }
2827 2827
2828 private: 2828 private:
2829 Ice::TimerMarker Timer; 2829 Ice::TimerMarker Timer;
2830 // True if we have already installed names for unnamed global declarations, 2830 // True if we have already installed names for unnamed global declarations,
2831 // and have generated global constant initializers. 2831 // and have generated global constant initializers.
2832 bool GlobalDeclarationNamesAndInitializersInstalled = false; 2832 bool GlobalDeclarationNamesAndInitializersInstalled = false;
2833 2833
2834 // Generates names for unnamed global addresses (i.e. functions and 2834 // Generates names for unnamed global addresses (i.e. functions and
(...skipping 19 matching lines...) Expand all
2854 ModuleValuesymtabParser() = delete; 2854 ModuleValuesymtabParser() = delete;
2855 ModuleValuesymtabParser(const ModuleValuesymtabParser &) = delete; 2855 ModuleValuesymtabParser(const ModuleValuesymtabParser &) = delete;
2856 void operator=(const ModuleValuesymtabParser &) = delete; 2856 void operator=(const ModuleValuesymtabParser &) = delete;
2857 2857
2858 public: 2858 public:
2859 ModuleValuesymtabParser(unsigned BlockID, ModuleParser *MP) 2859 ModuleValuesymtabParser(unsigned BlockID, ModuleParser *MP)
2860 : ValuesymtabParser(BlockID, MP), 2860 : ValuesymtabParser(BlockID, MP),
2861 Timer(Ice::TimerStack::TT_parseModuleValuesymtabs, 2861 Timer(Ice::TimerStack::TT_parseModuleValuesymtabs,
2862 getTranslator().getContext()) {} 2862 getTranslator().getContext()) {}
2863 2863
2864 ~ModuleValuesymtabParser() override {} 2864 ~ModuleValuesymtabParser() override = default;
2865 2865
2866 private: 2866 private:
2867 Ice::TimerMarker Timer; 2867 Ice::TimerMarker Timer;
2868 void setValueName(uint64_t Index, StringType &Name) override; 2868 void setValueName(uint64_t Index, StringType &Name) override;
2869 void setBbName(uint64_t Index, StringType &Name) override; 2869 void setBbName(uint64_t Index, StringType &Name) override;
2870 }; 2870 };
2871 2871
2872 void ModuleValuesymtabParser::setValueName(uint64_t Index, StringType &Name) { 2872 void ModuleValuesymtabParser::setValueName(uint64_t Index, StringType &Name) {
2873 Context->getGlobalDeclarationByID(Index) 2873 Context->getGlobalDeclarationByID(Index)
2874 ->setName(StringRef(Name.data(), Name.size())); 2874 ->setName(StringRef(Name.data(), Name.size()));
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
3024 } 3024 }
3025 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) { 3025 if (InputStreamFile.getBitcodeBytes().getExtent() % 4 != 0) {
3026 ErrStream 3026 ErrStream
3027 << IRFilename 3027 << IRFilename
3028 << ": Bitcode stream should be a multiple of 4 bytes in length.\n"; 3028 << ": Bitcode stream should be a multiple of 4 bytes in length.\n";
3029 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes"); 3029 llvm::report_fatal_error("Bitcode stream should be a multiple of 4 bytes");
3030 } 3030 }
3031 } 3031 }
3032 3032
3033 } // end of namespace Ice 3033 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringMIPS32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698