Changeset bee0694
- Timestamp:
- Jan 29, 2019, 4:15:27 PM (6 years ago)
- Branches:
- no_list
- Children:
- bbbc067
- Parents:
- 70a1c3ae
- Location:
- src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/CodeGen/CodeGenerator.cc ¶
r70a1c3ae rbee0694 63 63 } // extension 64 64 65 CodeGenerator::LabelPrinter & CodeGenerator::LabelPrinter::operator()( std:: list< Label > & l ) {65 CodeGenerator::LabelPrinter & CodeGenerator::LabelPrinter::operator()( std::vector< Label > & l ) { 66 66 labels = &l; 67 67 return *this; … … 69 69 70 70 ostream & operator<<( ostream & output, CodeGenerator::LabelPrinter & printLabels ) { 71 std:: list< Label >& labs = *printLabels.labels;71 std::vector< Label > & labs = *printLabels.labels; 72 72 // l.unique(); // assumes a sorted list. Why not use set? Does order matter? 73 73 for ( Label & l : labs ) { … … 911 911 if ( ! asmStmt->get_gotolabels().empty() ) { 912 912 output << " : "; 913 for ( std:: list<Label>::iterator begin = asmStmt->get_gotolabels().begin();; ) {913 for ( std::vector< Label > ::iterator begin = asmStmt->get_gotolabels().begin();; ) { 914 914 output << *begin++; 915 915 if ( begin == asmStmt->get_gotolabels().end() ) break; -
TabularUnified src/CodeGen/CodeGenerator.h ¶
r70a1c3ae rbee0694 124 124 struct LabelPrinter { 125 125 LabelPrinter(CodeGenerator &cg) : cg(cg), labels( 0 ) {} 126 LabelPrinter & operator()( std:: list< Label >& l );126 LabelPrinter & operator()( std::vector< Label > & l ); 127 127 CodeGenerator & cg; 128 std:: list< Label >* labels;128 std::vector< Label > * labels; 129 129 }; 130 130 -
TabularUnified src/ControlStruct/LabelFixer.cc ¶
r70a1c3ae rbee0694 50 50 // prune to at most one label definition for each statement 51 51 void LabelFixer::previsit( Statement *stmt ) { 52 std:: list< Label >&labels = stmt->get_labels();52 std::vector< Label > &labels = stmt->get_labels(); 53 53 54 54 if ( ! labels.empty() ) { … … 77 77 // sets the definition of the labelTable entry to be the provided 78 78 // statement for every label in the list parameter. Happens for every kind of statement 79 Label LabelFixer::setLabelsDef( std:: list< Label >&llabel, Statement *definition ) {79 Label LabelFixer::setLabelsDef( std::vector< Label > &llabel, Statement *definition ) { 80 80 assert( definition != 0 ); 81 81 assert( llabel.size() > 0 ); … … 83 83 Entry * e = new Entry( definition ); 84 84 85 for ( std:: list< Label >::iterator i = llabel.begin(); i != llabel.end(); i++ ) {85 for ( std::vector< Label > ::iterator i = llabel.begin(); i != llabel.end(); i++ ) { 86 86 Label & l = *i; 87 87 l.set_statement( definition ); // attach statement to the label to be used later -
TabularUnified src/ControlStruct/LabelFixer.h ¶
r70a1c3ae rbee0694 46 46 void previsit( LabelAddressExpr *addrExpr ); 47 47 48 Label setLabelsDef( std:: list< Label >&, Statement *definition );48 Label setLabelsDef( std::vector< Label > &, Statement *definition ); 49 49 template< typename UsageNode > 50 50 void setLabelsUsg( Label, UsageNode *usage = 0 ); -
TabularUnified src/ControlStruct/MLEMutator.cc ¶
r70a1c3ae rbee0694 70 70 if ( ! get_breakLabel().empty() ) { 71 71 std::list< Statement * >::iterator next = k+1; 72 std:: list<Label>ls; ls.push_back( get_breakLabel() );72 std::vector< Label > ls; ls.push_back( get_breakLabel() ); 73 73 kids.insert( next, new NullStmt( ls ) ); 74 74 set_breakLabel(""); … … 242 242 if ( e.isContUsed() ) { 243 243 // continue label goes in the body as the last statement 244 std:: list< Label >labels; labels.push_back( e.useContExit() );244 std::vector< Label > labels; labels.push_back( e.useContExit() ); 245 245 newBody->get_kids().push_back( new NullStmt( labels ) ); 246 246 } // if … … 336 336 assert( ! enclosingControlStructures.empty() ); 337 337 if ( enclosingControlStructures.back().isFallUsed() ) { 338 std:: list<Label>ls{ enclosingControlStructures.back().useFallExit() };338 std::vector< Label > ls{ enclosingControlStructures.back().useFallExit() }; 339 339 caseStmt->stmts.push_back( new NullStmt( ls ) ); 340 340 } // if … … 346 346 if ( enclosingControlStructures.back().isFallDefaultUsed() ) { 347 347 // add fallthrough default label if necessary 348 std:: list<Label>ls{ enclosingControlStructures.back().useFallDefaultExit() };348 std::vector< Label > ls{ enclosingControlStructures.back().useFallDefaultExit() }; 349 349 caseStmt->stmts.push_front( new NullStmt( ls ) ); 350 350 } // if -
TabularUnified src/InitTweak/GenInit.cc ¶
r70a1c3ae rbee0694 45 45 namespace InitTweak { 46 46 namespace { 47 const std:: list<Label>noLabels;47 const std::vector< Label > noLabels; 48 48 const std::list<Expression *> noDesignators; 49 49 } -
TabularUnified src/Parser/ParseNode.h ¶
r70a1c3ae rbee0694 169 169 170 170 struct LabelNode { 171 std:: list< Label >labels;171 std::vector< Label > labels; 172 172 }; 173 173 -
TabularUnified src/SynTree/Label.h ¶
r70a1c3ae rbee0694 49 49 inline std::ostream & operator<<( std::ostream & out, const Label & l ) { return out << l.get_name(); } 50 50 51 static const std:: list< Label >noLabels;51 static const std::vector< Label > noLabels; 52 52 53 53 // Local Variables: // -
TabularUnified src/SynTree/Statement.cc ¶
r70a1c3ae rbee0694 32 32 using std::endl; 33 33 34 Statement::Statement( const std:: list<Label>& labels ) : labels( labels ) {}34 Statement::Statement( const std::vector< Label > & labels ) : labels( labels ) {} 35 35 36 36 void Statement::print( std::ostream & os, Indenter indent ) const { … … 60 60 61 61 62 AsmStmt::AsmStmt( bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std:: list<Label>gotolabels ) : Statement(), voltile( voltile ), instruction( instruction ), output( output ), input( input ), clobber( clobber ), gotolabels( gotolabels ) {}62 AsmStmt::AsmStmt( bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::vector< Label > gotolabels ) : Statement(), voltile( voltile ), instruction( instruction ), output( output ), input( input ), clobber( clobber ), gotolabels( gotolabels ) {} 63 63 64 64 AsmStmt::AsmStmt( const AsmStmt & other ) : Statement( other ), voltile( other.voltile ), instruction( maybeClone( other.instruction ) ), gotolabels( other.gotolabels ) { … … 223 223 } 224 224 225 CaseStmt * CaseStmt::makeDefault( const std:: list<Label>& labels, std::list<Statement *> stmts ) {225 CaseStmt * CaseStmt::makeDefault( const std::vector< Label > & labels, std::list<Statement *> stmts ) { 226 226 CaseStmt * stmt = new CaseStmt( nullptr, stmts, true ); 227 227 stmt->labels = labels; … … 511 511 512 512 513 NullStmt::NullStmt( const std:: list<Label>& labels ) : Statement( labels ) {513 NullStmt::NullStmt( const std::vector< Label > & labels ) : Statement( labels ) { 514 514 } 515 515 -
TabularUnified src/SynTree/Statement.h ¶
r70a1c3ae rbee0694 35 35 class Statement : public BaseSyntaxNode { 36 36 public: 37 std:: list<Label>labels;38 39 Statement( const std:: list<Label>& labels = {} );37 std::vector< Label > labels; 38 39 Statement( const std::vector< Label > & labels = {} ); 40 40 virtual ~Statement(); 41 41 42 std:: list<Label>& get_labels() { return labels; }43 const std:: list<Label>& get_labels() const { return labels; }42 std::vector< Label > & get_labels() { return labels; } 43 const std::vector< Label > & get_labels() const { return labels; } 44 44 45 45 virtual Statement *clone() const override = 0; … … 70 70 class NullStmt : public Statement { 71 71 public: 72 NullStmt( const std:: list<Label>& labels = {} );72 NullStmt( const std::vector< Label > & labels = {} ); 73 73 74 74 virtual NullStmt *clone() const override { return new NullStmt( *this ); } … … 101 101 std::list<Expression *> output, input; 102 102 std::list<ConstantExpr *> clobber; 103 std:: list<Label>gotolabels;104 105 AsmStmt( bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std:: list<Label>gotolabels );103 std::vector< Label > gotolabels; 104 105 AsmStmt( bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::vector< Label > gotolabels ); 106 106 AsmStmt( const AsmStmt &other ); 107 107 virtual ~AsmStmt(); … … 117 117 std::list<ConstantExpr *> & get_clobber() { return clobber; } 118 118 void set_clobber( const std::list<ConstantExpr *> &newValue ) { clobber = newValue; } 119 std:: list<Label>& get_gotolabels() { return gotolabels; }120 void set_gotolabels( const std:: list<Label>&newValue ) { gotolabels = newValue; }119 std::vector< Label > & get_gotolabels() { return gotolabels; } 120 void set_gotolabels( const std::vector< Label > &newValue ) { gotolabels = newValue; } 121 121 122 122 virtual AsmStmt * clone() const { return new AsmStmt( *this ); } … … 196 196 virtual ~CaseStmt(); 197 197 198 static CaseStmt * makeDefault( const std:: list<Label>& labels = {}, std::list<Statement *> stmts = std::list<Statement *>() );198 static CaseStmt * makeDefault( const std::vector< Label > & labels = {}, std::list<Statement *> stmts = std::list<Statement *>() ); 199 199 200 200 bool isDefault() const { return _isDefault; }
Note: See TracChangeset
for help on using the changeset viewer.