[b87a5ed] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
[0f8e4ac] | 7 | // StatementNode.cc -- |
---|
[b87a5ed] | 8 | // |
---|
| 9 | // Author : Rodolfo G. Esteves |
---|
| 10 | // Created On : Sat May 16 14:59:41 2015 |
---|
[1db21619] | 11 | // Last Modified By : Peter A. Buhr |
---|
[4e06c1e] | 12 | // Last Modified On : Tue Jul 12 17:21:02 2016 |
---|
| 13 | // Update Count : 133 |
---|
[b87a5ed] | 14 | // |
---|
| 15 | |
---|
[51b7345] | 16 | #include <list> |
---|
| 17 | #include <algorithm> |
---|
| 18 | #include <cassert> |
---|
| 19 | |
---|
| 20 | #include "ParseNode.h" |
---|
| 21 | #include "SynTree/Statement.h" |
---|
| 22 | #include "SynTree/Expression.h" |
---|
| 23 | #include "parseutility.h" |
---|
[d3b7937] | 24 | #include "Common/utility.h" |
---|
[51b7345] | 25 | |
---|
| 26 | using namespace std; |
---|
| 27 | |
---|
[b87a5ed] | 28 | const char *StatementNode::StType[] = { |
---|
[0f8e4ac] | 29 | "Exp", "If", "Switch", "Case", "Default", "Choose", "Fallthru", |
---|
| 30 | "While", "Do", "For", |
---|
[b87a5ed] | 31 | "Goto", "Continue", "Break", "Return", "Throw", |
---|
| 32 | "Try", "Catch", "Finally", "Asm", |
---|
| 33 | "Decl" |
---|
| 34 | }; |
---|
| 35 | |
---|
| 36 | StatementNode::StatementNode() : ParseNode(), control( 0 ), block( 0 ), labels( 0 ), target( 0 ), decl( 0 ), isCatchRest ( false ) {} |
---|
| 37 | |
---|
[7f5566b] | 38 | StatementNode::StatementNode( const string *name ) : ParseNode( name ), control( 0 ), block( 0 ), labels( 0 ), target( 0 ), decl( 0 ), isCatchRest ( false ) {} |
---|
[b87a5ed] | 39 | |
---|
| 40 | StatementNode::StatementNode( DeclarationNode *decl ) : type( Decl ), control( 0 ), block( 0 ), labels( 0 ), target( 0 ), isCatchRest ( false ) { |
---|
| 41 | if ( decl ) { |
---|
| 42 | if ( DeclarationNode *agg = decl->extractAggregate() ) { |
---|
| 43 | this->decl = agg; |
---|
| 44 | StatementNode *nextStmt = new StatementNode; |
---|
| 45 | nextStmt->type = Decl; |
---|
| 46 | nextStmt->decl = decl; |
---|
| 47 | next = nextStmt; |
---|
| 48 | if ( decl->get_link() ) { |
---|
| 49 | next->set_next( new StatementNode( dynamic_cast< DeclarationNode* >( decl->get_link() ) ) ); |
---|
| 50 | decl->set_next( 0 ); |
---|
[44b5ca0] | 51 | } // if |
---|
[b87a5ed] | 52 | } else { |
---|
| 53 | if ( decl->get_link() ) { |
---|
| 54 | next = new StatementNode( dynamic_cast< DeclarationNode* >( decl->get_link() ) ); |
---|
| 55 | decl->set_next( 0 ); |
---|
[44b5ca0] | 56 | } // if |
---|
[b87a5ed] | 57 | this->decl = decl; |
---|
[44b5ca0] | 58 | } // if |
---|
| 59 | } // if |
---|
[51b7345] | 60 | } |
---|
| 61 | |
---|
[7f5566b] | 62 | StatementNode::StatementNode( Type t, ExpressionNode *ctrl_label, StatementNode *block ) : type( t ), control( ctrl_label ), block( block ), labels( 0 ), target( 0 ), decl( 0 ), isCatchRest ( false ) { |
---|
| 63 | this->control = ( t == Default ) ? 0 : control; |
---|
[0f8e4ac] | 64 | } |
---|
[51b7345] | 65 | |
---|
[7f5566b] | 66 | StatementNode::StatementNode( Type t, string *target ) : type( t ), control( 0 ), block( 0 ), labels( 0 ), target( target ), decl( 0 ), isCatchRest ( false ) {} |
---|
[51b7345] | 67 | |
---|
[b87a5ed] | 68 | StatementNode::~StatementNode() { |
---|
| 69 | delete control; |
---|
| 70 | delete block; |
---|
| 71 | delete target; |
---|
| 72 | delete decl; |
---|
[51b7345] | 73 | } |
---|
| 74 | |
---|
[b87a5ed] | 75 | StatementNode * StatementNode::newCatchStmt( DeclarationNode *d, StatementNode *s, bool catchRestP ) { |
---|
[0f8e4ac] | 76 | StatementNode *ret = new StatementNode( StatementNode::Catch, 0, s ); |
---|
[b87a5ed] | 77 | ret->addDeclaration( d ); |
---|
| 78 | ret->setCatchRest( catchRestP ); |
---|
[51b7345] | 79 | |
---|
[b87a5ed] | 80 | return ret; |
---|
[51b7345] | 81 | } |
---|
| 82 | |
---|
| 83 | std::string StatementNode::get_target() const{ |
---|
[b87a5ed] | 84 | if ( target ) |
---|
| 85 | return *target; |
---|
[51b7345] | 86 | |
---|
[b87a5ed] | 87 | return string(""); |
---|
[51b7345] | 88 | } |
---|
| 89 | |
---|
[b87a5ed] | 90 | StatementNode * StatementNode::clone() const { |
---|
| 91 | StatementNode *newnode = new StatementNode( type, maybeClone( control ), maybeClone( block ) ); |
---|
| 92 | if ( target ) { |
---|
| 93 | newnode->target = new string( *target ); |
---|
| 94 | } else { |
---|
| 95 | newnode->target = 0; |
---|
[44b5ca0] | 96 | } // if |
---|
[b87a5ed] | 97 | newnode->decl = maybeClone( decl ); |
---|
| 98 | return newnode; |
---|
[51b7345] | 99 | } |
---|
| 100 | |
---|
[59db689] | 101 | StatementNode *StatementNode::add_label( const std::string *l ) { |
---|
[b87a5ed] | 102 | if ( l != 0 ) { |
---|
[0f8e4ac] | 103 | labels.push_front( *l ); |
---|
[b87a5ed] | 104 | delete l; |
---|
[44b5ca0] | 105 | } // if |
---|
[b87a5ed] | 106 | return this; |
---|
[51b7345] | 107 | } |
---|
| 108 | |
---|
[00c32e9] | 109 | // StatementNode *StatementNode::add_controlexp( ExpressionNode *e ) { |
---|
| 110 | // if ( control && e ) |
---|
| 111 | // control->add_to_list( e ); // xxx - check this |
---|
| 112 | // return this; |
---|
| 113 | // } |
---|
[51b7345] | 114 | |
---|
[b87a5ed] | 115 | StatementNode *StatementNode::append_block( StatementNode *stmt ) { |
---|
| 116 | if ( stmt != 0 ) { |
---|
| 117 | if ( block == 0 ) |
---|
| 118 | block = stmt; |
---|
| 119 | else |
---|
| 120 | block->set_link( stmt ); |
---|
[44b5ca0] | 121 | } // if |
---|
[b87a5ed] | 122 | return this; |
---|
[51b7345] | 123 | } |
---|
| 124 | |
---|
[b87a5ed] | 125 | StatementNode *StatementNode::append_last_case( StatementNode *stmt ) { |
---|
| 126 | if ( stmt != 0 ) { |
---|
| 127 | StatementNode *next = ( StatementNode *)get_link(); |
---|
| 128 | if ( next && ( next->get_type() == StatementNode::Case || next->get_type() == StatementNode::Default ) ) |
---|
| 129 | next->append_last_case ( stmt ); |
---|
| 130 | else |
---|
| 131 | if ( block == 0 ) |
---|
| 132 | block = stmt; |
---|
| 133 | else |
---|
| 134 | block->set_link( stmt ); |
---|
[44b5ca0] | 135 | } // if |
---|
[b87a5ed] | 136 | return this; |
---|
[51b7345] | 137 | } |
---|
| 138 | |
---|
| 139 | void StatementNode::print( std::ostream &os, int indent ) const { |
---|
[7f5566b] | 140 | if ( ! labels.empty() ) { |
---|
[1db21619] | 141 | std::list<std::string>::const_iterator i; |
---|
[b87a5ed] | 142 | |
---|
[1db21619] | 143 | os << string( indent, ' ' ); |
---|
| 144 | for ( i = labels.begin(); i != labels.end(); i++ ) |
---|
| 145 | os << *i << ":"; |
---|
| 146 | os << endl; |
---|
[44b5ca0] | 147 | } // if |
---|
[b87a5ed] | 148 | |
---|
[a32b204] | 149 | switch ( type ) { |
---|
[b87a5ed] | 150 | case Decl: |
---|
| 151 | decl->print( os, indent ); |
---|
| 152 | break; |
---|
| 153 | case Exp: |
---|
| 154 | if ( control ) { |
---|
| 155 | os << string( indent, ' ' ); |
---|
| 156 | control->print( os, indent ); |
---|
| 157 | os << endl; |
---|
[0f8e4ac] | 158 | } else |
---|
[b87a5ed] | 159 | os << string( indent, ' ' ) << "Null Statement" << endl; |
---|
| 160 | break; |
---|
| 161 | default: |
---|
[44b5ca0] | 162 | os << string( indent, ' ' ) << StatementNode::StType[type] << endl; |
---|
[b87a5ed] | 163 | if ( type == Catch ) { |
---|
| 164 | if ( decl ) { |
---|
[44b5ca0] | 165 | os << string( indent + ParseNode::indent_by, ' ' ) << "Declaration: " << endl; |
---|
[7f5566b] | 166 | decl->print( os, indent + 2 * ParseNode::indent_by ); |
---|
[b87a5ed] | 167 | } else if ( isCatchRest ) { |
---|
[44b5ca0] | 168 | os << string( indent + ParseNode::indent_by, ' ' ) << "Catches the rest " << endl; |
---|
[b87a5ed] | 169 | } else { |
---|
| 170 | ; // should never reach here |
---|
[44b5ca0] | 171 | } // if |
---|
| 172 | } // if |
---|
[b87a5ed] | 173 | if ( control ) { |
---|
[7f5566b] | 174 | os << string( indent + ParseNode::indent_by, ' ' ) << "Control: " << endl; |
---|
| 175 | control->printList( os, indent + 2 * ParseNode::indent_by ); |
---|
[44b5ca0] | 176 | } // if |
---|
[b87a5ed] | 177 | if ( block ) { |
---|
[44b5ca0] | 178 | os << string( indent + ParseNode::indent_by, ' ' ) << "Branches of execution: " << endl; |
---|
[0f8e4ac] | 179 | block->printList( os, indent + 2 * ParseNode::indent_by ); |
---|
[44b5ca0] | 180 | } // if |
---|
[b87a5ed] | 181 | if ( target ) { |
---|
[44b5ca0] | 182 | os << string( indent + ParseNode::indent_by, ' ' ) << "Target: " << get_target() << endl; |
---|
| 183 | } // if |
---|
[b87a5ed] | 184 | break; |
---|
[44b5ca0] | 185 | } // switch |
---|
[51b7345] | 186 | } |
---|
| 187 | |
---|
| 188 | Statement *StatementNode::build() const { |
---|
[b87a5ed] | 189 | std::list<Statement *> branches; |
---|
| 190 | std::list<Expression *> exps; |
---|
| 191 | std::list<Label> labs; |
---|
| 192 | |
---|
[1db21619] | 193 | if ( ! labels.empty() ) { |
---|
[b87a5ed] | 194 | std::back_insert_iterator< std::list<Label> > lab_it( labs ); |
---|
[1db21619] | 195 | copy( labels.begin(), labels.end(), lab_it ); |
---|
[44b5ca0] | 196 | } // if |
---|
[b87a5ed] | 197 | |
---|
| 198 | // try { |
---|
| 199 | buildList<Statement, StatementNode>( get_block(), branches ); |
---|
| 200 | |
---|
[a32b204] | 201 | switch ( type ) { |
---|
[b87a5ed] | 202 | case Decl: |
---|
| 203 | return new DeclStmt( labs, maybeBuild< Declaration >( decl ) ); |
---|
| 204 | case Exp: |
---|
| 205 | { |
---|
| 206 | Expression *e = maybeBuild< Expression >( get_control() ); |
---|
| 207 | |
---|
| 208 | if ( e ) |
---|
| 209 | return new ExprStmt( labs, e ); |
---|
| 210 | else |
---|
| 211 | return new NullStmt( labs ); |
---|
| 212 | } |
---|
| 213 | case If: |
---|
| 214 | { |
---|
| 215 | Statement *thenb = 0, *elseb = 0; |
---|
| 216 | assert( branches.size() >= 1 ); |
---|
| 217 | |
---|
| 218 | thenb = branches.front(); |
---|
| 219 | branches.pop_front(); |
---|
[a32b204] | 220 | if ( ! branches.empty() ) { |
---|
[b87a5ed] | 221 | elseb = branches.front(); |
---|
| 222 | branches.pop_front(); |
---|
[44b5ca0] | 223 | } // if |
---|
[e04ef3a] | 224 | return new IfStmt( labs, notZeroExpr( maybeBuild<Expression>(get_control()) ), thenb, elseb ); |
---|
[b87a5ed] | 225 | } |
---|
| 226 | case While: |
---|
| 227 | assert( branches.size() == 1 ); |
---|
[e04ef3a] | 228 | return new WhileStmt( labs, notZeroExpr( maybeBuild<Expression>(get_control()) ), branches.front() ); |
---|
[b87a5ed] | 229 | case Do: |
---|
| 230 | assert( branches.size() == 1 ); |
---|
[e04ef3a] | 231 | return new WhileStmt( labs, notZeroExpr( maybeBuild<Expression>(get_control()) ), branches.front(), true ); |
---|
[b87a5ed] | 232 | case For: |
---|
| 233 | { |
---|
| 234 | assert( branches.size() == 1 ); |
---|
| 235 | |
---|
| 236 | ForCtlExprNode *ctl = dynamic_cast<ForCtlExprNode *>( get_control() ); |
---|
| 237 | assert( ctl != 0 ); |
---|
| 238 | |
---|
[145f1fc] | 239 | std::list<Statement *> init; |
---|
| 240 | if ( ctl->get_init() != 0 ) { |
---|
| 241 | buildList( ctl->get_init(), init ); |
---|
[1db21619] | 242 | } // if |
---|
[b87a5ed] | 243 | |
---|
| 244 | Expression *cond = 0; |
---|
| 245 | if ( ctl->get_condition() != 0 ) |
---|
[e04ef3a] | 246 | cond = notZeroExpr( maybeBuild<Expression>(ctl->get_condition()) ); |
---|
[b87a5ed] | 247 | |
---|
| 248 | Expression *incr = 0; |
---|
| 249 | if ( ctl->get_change() != 0 ) |
---|
[e04ef3a] | 250 | incr = maybeBuild<Expression>(ctl->get_change()); |
---|
[b87a5ed] | 251 | |
---|
[145f1fc] | 252 | return new ForStmt( labs, init, cond, incr, branches.front() ); |
---|
[b87a5ed] | 253 | } |
---|
| 254 | case Switch: |
---|
[e04ef3a] | 255 | return new SwitchStmt( labs, maybeBuild<Expression>(get_control()), branches ); |
---|
[0f8e4ac] | 256 | case Case: |
---|
[e04ef3a] | 257 | return new CaseStmt( labs, maybeBuild<Expression>(get_control()), branches ); |
---|
[b87a5ed] | 258 | case Default: |
---|
| 259 | return new CaseStmt( labs, 0, branches, true ); |
---|
| 260 | case Goto: |
---|
| 261 | { |
---|
| 262 | if ( get_target() == "" ) { // computed goto |
---|
| 263 | assert( get_control() != 0 ); |
---|
[e04ef3a] | 264 | return new BranchStmt( labs, maybeBuild<Expression>(get_control()), BranchStmt::Goto ); |
---|
[44b5ca0] | 265 | } // if |
---|
[b87a5ed] | 266 | |
---|
| 267 | return new BranchStmt( labs, get_target(), BranchStmt::Goto ); |
---|
| 268 | } |
---|
| 269 | case Break: |
---|
| 270 | return new BranchStmt( labs, get_target(), BranchStmt::Break ); |
---|
| 271 | case Continue: |
---|
| 272 | return new BranchStmt( labs, get_target(), BranchStmt::Continue ); |
---|
| 273 | case Return: |
---|
| 274 | case Throw : |
---|
| 275 | buildList( get_control(), exps ); |
---|
| 276 | if ( exps.size() ==0 ) |
---|
| 277 | return new ReturnStmt( labs, 0, type == Throw ); |
---|
| 278 | if ( exps.size() > 0 ) |
---|
| 279 | return new ReturnStmt( labs, exps.back(), type == Throw ); |
---|
| 280 | case Try: |
---|
| 281 | { |
---|
| 282 | assert( branches.size() >= 0 ); |
---|
| 283 | CompoundStmt *tryBlock = dynamic_cast<CompoundStmt *>( branches.front()); |
---|
| 284 | branches.pop_front(); |
---|
| 285 | FinallyStmt *finallyBlock = 0; |
---|
| 286 | if ( ( finallyBlock = dynamic_cast<FinallyStmt *>( branches.back())) ) { |
---|
| 287 | branches.pop_back(); |
---|
[44b5ca0] | 288 | } // if |
---|
[b87a5ed] | 289 | return new TryStmt( labs, tryBlock, branches, finallyBlock ); |
---|
| 290 | } |
---|
| 291 | case Catch: |
---|
| 292 | { |
---|
| 293 | assert( branches.size() == 1 ); |
---|
| 294 | |
---|
| 295 | return new CatchStmt( labs, maybeBuild< Declaration >( decl ), branches.front(), isCatchRest ); |
---|
| 296 | } |
---|
| 297 | case Finally: |
---|
| 298 | { |
---|
| 299 | assert( branches.size() == 1 ); |
---|
| 300 | CompoundStmt *block = dynamic_cast<CompoundStmt *>( branches.front() ); |
---|
| 301 | assert( block != 0 ); |
---|
| 302 | |
---|
| 303 | return new FinallyStmt( labs, block ); |
---|
| 304 | } |
---|
[7f5566b] | 305 | case Asm: |
---|
| 306 | assert( false ); |
---|
[b87a5ed] | 307 | default: |
---|
| 308 | // shouldn't be here |
---|
| 309 | return 0; |
---|
[44b5ca0] | 310 | } // switch |
---|
[51b7345] | 311 | } |
---|
| 312 | |
---|
[7f5566b] | 313 | |
---|
[59db689] | 314 | CompoundStmtNode::CompoundStmtNode() : first( 0 ), last( 0 ) {} |
---|
[51b7345] | 315 | |
---|
[59db689] | 316 | CompoundStmtNode::CompoundStmtNode( const string *name_ ) : StatementNode( name_ ), first( 0 ), last( 0 ) {} |
---|
[51b7345] | 317 | |
---|
[59db689] | 318 | CompoundStmtNode::CompoundStmtNode( StatementNode *stmt ) : first( stmt ) { |
---|
[b87a5ed] | 319 | if ( first ) { |
---|
| 320 | last = ( StatementNode *)( stmt->get_last()); |
---|
| 321 | } else { |
---|
| 322 | last = 0; |
---|
[44b5ca0] | 323 | } // if |
---|
[51b7345] | 324 | } |
---|
| 325 | |
---|
[b87a5ed] | 326 | CompoundStmtNode::~CompoundStmtNode() { |
---|
| 327 | delete first; |
---|
[51b7345] | 328 | } |
---|
| 329 | |
---|
[b87a5ed] | 330 | void CompoundStmtNode::add_statement( StatementNode *stmt ) { |
---|
| 331 | if ( stmt != 0 ) { |
---|
| 332 | last->set_link( stmt ); |
---|
| 333 | last = ( StatementNode *)( stmt->get_link()); |
---|
[44b5ca0] | 334 | } // if |
---|
[51b7345] | 335 | } |
---|
| 336 | |
---|
[b87a5ed] | 337 | void CompoundStmtNode::print( ostream &os, int indent ) const { |
---|
| 338 | if ( first ) { |
---|
| 339 | first->printList( os, indent+2 ); |
---|
[44b5ca0] | 340 | } // if |
---|
[51b7345] | 341 | } |
---|
| 342 | |
---|
| 343 | Statement *CompoundStmtNode::build() const { |
---|
[b87a5ed] | 344 | std::list<Label> labs; |
---|
[1db21619] | 345 | const std::list<std::string> &labels = get_labels(); |
---|
[51b7345] | 346 | |
---|
[1db21619] | 347 | if ( ! labels.empty() ) { |
---|
[b87a5ed] | 348 | std::back_insert_iterator< std::list<Label> > lab_it( labs ); |
---|
[1db21619] | 349 | copy( labels.begin(), labels.end(), lab_it ); |
---|
[44b5ca0] | 350 | } // if |
---|
[51b7345] | 351 | |
---|
[b87a5ed] | 352 | CompoundStmt *cs = new CompoundStmt( labs ); |
---|
| 353 | buildList( first, cs->get_kids() ); |
---|
| 354 | return cs; |
---|
[51b7345] | 355 | } |
---|
| 356 | |
---|
[7f5566b] | 357 | |
---|
| 358 | AsmStmtNode::AsmStmtNode( Type t, bool voltile, ConstantNode *instruction, ExpressionNode *output, ExpressionNode *input, ConstantNode *clobber, LabelNode *gotolabels ) : |
---|
| 359 | StatementNode( t ), voltile( voltile ), instruction( instruction ), output( output ), input( input ), clobber( clobber ) { |
---|
| 360 | if ( gotolabels ) { |
---|
| 361 | this->gotolabels = gotolabels->get_labels(); |
---|
| 362 | delete gotolabels; |
---|
| 363 | } // if |
---|
| 364 | } |
---|
| 365 | |
---|
| 366 | AsmStmtNode::~AsmStmtNode() { |
---|
| 367 | delete instruction; delete output; delete input; delete clobber; |
---|
| 368 | } |
---|
| 369 | |
---|
| 370 | void AsmStmtNode::print( std::ostream &os, int indent ) const { |
---|
| 371 | StatementNode::print( os, indent ); // print statement labels |
---|
| 372 | os << string( indent + ParseNode::indent_by, ' ' ) << "volatile:" << voltile << endl; |
---|
| 373 | if ( instruction ) { |
---|
| 374 | os << string( indent + ParseNode::indent_by, ' ' ) << "Instruction:" << endl; |
---|
| 375 | instruction->printList( os, indent + 2 * ParseNode::indent_by ); |
---|
| 376 | } // if |
---|
| 377 | if ( output ) { |
---|
| 378 | os << string( indent + ParseNode::indent_by, ' ' ) << "Output:" << endl; |
---|
| 379 | output->printList( os, indent + 2 * ParseNode::indent_by ); |
---|
| 380 | } // if |
---|
| 381 | if ( input ) { |
---|
| 382 | os << string( indent + ParseNode::indent_by, ' ' ) << "Input:" << endl; |
---|
| 383 | input->printList( os, indent + 2 * ParseNode::indent_by ); |
---|
| 384 | } // if |
---|
| 385 | if ( clobber ) { |
---|
| 386 | os << string( indent + ParseNode::indent_by, ' ' ) << "Clobber:" << endl; |
---|
| 387 | clobber->printList( os, indent + 2 * ParseNode::indent_by ); |
---|
| 388 | } // if |
---|
| 389 | if ( ! gotolabels.empty() ) { |
---|
| 390 | os << string( indent + ParseNode::indent_by, ' ' ) << "Goto Labels:" << endl; |
---|
| 391 | os << string( indent + 2 * ParseNode::indent_by, ' ' ); |
---|
[0f8e4ac] | 392 | for ( std::list<Label>::const_iterator i = gotolabels.begin();; ) { |
---|
[7f5566b] | 393 | os << *i; |
---|
| 394 | i++; |
---|
| 395 | if ( i == gotolabels.end() ) break; |
---|
| 396 | os << ", "; |
---|
| 397 | } |
---|
| 398 | os << endl; |
---|
| 399 | } // if |
---|
| 400 | } |
---|
| 401 | |
---|
| 402 | Statement *AsmStmtNode::build() const { |
---|
| 403 | std::list<Label> labs; |
---|
| 404 | |
---|
| 405 | if ( ! get_labels().empty() ) { |
---|
| 406 | std::back_insert_iterator< std::list<Label> > lab_it( labs ); |
---|
| 407 | copy( get_labels().begin(), get_labels().end(), lab_it ); |
---|
| 408 | } // if |
---|
| 409 | |
---|
| 410 | std::list< Expression * > out, in; |
---|
| 411 | std::list< ConstantExpr * > clob; |
---|
| 412 | buildList( output, out ); |
---|
| 413 | buildList( input, in ); |
---|
| 414 | buildList( clobber, clob ); |
---|
| 415 | std::list< Label > gotolabs = gotolabels; |
---|
| 416 | return new AsmStmt( labs, voltile, (ConstantExpr *)maybeBuild< Expression >( instruction ), out, in, clob, gotolabs ); |
---|
| 417 | } |
---|
| 418 | |
---|
[51b7345] | 419 | // Local Variables: // |
---|
[b87a5ed] | 420 | // tab-width: 4 // |
---|
| 421 | // mode: c++ // |
---|
| 422 | // compile-command: "make install" // |
---|
[51b7345] | 423 | // End: // |
---|