[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 |
---|
[a67b60e] | 11 | // Last Modified By : Peter A. Buhr |
---|
[f271bdd] | 12 | // Last Modified On : Sat Aug 4 09:39:25 2018 |
---|
| 13 | // Update Count : 363 |
---|
[b87a5ed] | 14 | // |
---|
| 15 | |
---|
[e3e16bc] | 16 | #include <cassert> // for assert, strict_dynamic_cast, assertf |
---|
[d180746] | 17 | #include <list> // for list |
---|
| 18 | #include <memory> // for unique_ptr |
---|
| 19 | #include <string> // for string |
---|
[51b7345] | 20 | |
---|
[d180746] | 21 | #include "Common/SemanticError.h" // for SemanticError |
---|
| 22 | #include "Common/utility.h" // for maybeMoveBuild, maybeBuild |
---|
| 23 | #include "ParseNode.h" // for StatementNode, ExpressionNode, bui... |
---|
| 24 | #include "SynTree/Expression.h" // for Expression, ConstantExpr |
---|
| 25 | #include "SynTree/Label.h" // for Label, noLabels |
---|
[6d49ea3] | 26 | #include "SynTree/Declaration.h" |
---|
[d180746] | 27 | #include "SynTree/Statement.h" // for Statement, BranchStmt, CaseStmt |
---|
| 28 | #include "parserutility.h" // for notZeroExpr |
---|
| 29 | |
---|
| 30 | class Declaration; |
---|
[51b7345] | 31 | |
---|
| 32 | using namespace std; |
---|
| 33 | |
---|
[b87a5ed] | 34 | |
---|
[61fc4f6] | 35 | StatementNode::StatementNode( DeclarationNode * decl ) { |
---|
[c0aa336] | 36 | assert( decl ); |
---|
[61fc4f6] | 37 | DeclarationNode * agg = decl->extractAggregate(); |
---|
[c0aa336] | 38 | if ( agg ) { |
---|
[61fc4f6] | 39 | StatementNode * nextStmt = new StatementNode( new DeclStmt( maybeBuild< Declaration >( decl ) ) ); |
---|
[c0aa336] | 40 | set_next( nextStmt ); |
---|
| 41 | if ( decl->get_next() ) { |
---|
| 42 | get_next()->set_next( new StatementNode( dynamic_cast< DeclarationNode * >(decl->get_next()) ) ); |
---|
| 43 | decl->set_next( 0 ); |
---|
[1d4580a] | 44 | } // if |
---|
| 45 | } else { |
---|
[c0aa336] | 46 | if ( decl->get_next() ) { |
---|
| 47 | set_next( new StatementNode( dynamic_cast< DeclarationNode * >( decl->get_next() ) ) ); |
---|
| 48 | decl->set_next( 0 ); |
---|
| 49 | } // if |
---|
| 50 | agg = decl; |
---|
[1d4580a] | 51 | } // if |
---|
[ba3706f] | 52 | stmt.reset( new DeclStmt( maybeMoveBuild< Declaration >(agg) ) ); |
---|
[c0aa336] | 53 | } // StatementNode::StatementNode |
---|
[1d4580a] | 54 | |
---|
[61fc4f6] | 55 | StatementNode * StatementNode::append_last_case( StatementNode * stmt ) { |
---|
| 56 | StatementNode * prev = this; |
---|
[1d4580a] | 57 | // find end of list and maintain previous pointer |
---|
| 58 | for ( StatementNode * curr = prev; curr != nullptr; curr = (StatementNode *)curr->get_next() ) { |
---|
[61fc4f6] | 59 | StatementNode * node = strict_dynamic_cast< StatementNode * >(curr); |
---|
[ac71a86] | 60 | assert( dynamic_cast< CaseStmt * >(node->stmt.get()) ); |
---|
[8cc5cb0] | 61 | prev = curr; |
---|
| 62 | } // for |
---|
[e82aa9df] | 63 | // convert from StatementNode list to Statement list |
---|
[61fc4f6] | 64 | StatementNode * node = dynamic_cast< StatementNode * >(prev); |
---|
[7880579] | 65 | std::list< Statement * > stmts; |
---|
[7ecbb7e] | 66 | buildMoveList( stmt, stmts ); |
---|
[e82aa9df] | 67 | // splice any new Statements to end of current Statements |
---|
[ac71a86] | 68 | CaseStmt * caseStmt = dynamic_cast< CaseStmt * >(node->stmt.get()); |
---|
[8cc5cb0] | 69 | caseStmt->get_statements().splice( caseStmt->get_statements().end(), stmts ); |
---|
| 70 | return this; |
---|
[401e61f] | 71 | } // StatementNode::append_last_case |
---|
[8cc5cb0] | 72 | |
---|
[61fc4f6] | 73 | Statement * build_expr( ExpressionNode * ctl ) { |
---|
| 74 | Expression * e = maybeMoveBuild< Expression >( ctl ); |
---|
[8cc5cb0] | 75 | |
---|
[401e61f] | 76 | if ( e ) return new ExprStmt( e ); |
---|
| 77 | else return new NullStmt(); |
---|
| 78 | } // build_expr |
---|
[8cc5cb0] | 79 | |
---|
[f271bdd] | 80 | Expression * build_if_control( IfCtrl * ctl, std::list< Statement * > & init ) { |
---|
[936e9f4] | 81 | if ( ctl->init != 0 ) { |
---|
| 82 | buildMoveList( ctl->init, init ); |
---|
| 83 | } // if |
---|
| 84 | |
---|
[a01f7c94] | 85 | Expression * cond = nullptr; |
---|
| 86 | if ( ctl->condition ) { |
---|
| 87 | // compare the provided condition against 0 |
---|
[ee3c93d] | 88 | cond = notZeroExpr( maybeMoveBuild< Expression >(ctl->condition) ); |
---|
[a01f7c94] | 89 | } else { |
---|
| 90 | for ( Statement * stmt : init ) { |
---|
| 91 | // build the && of all of the declared variables compared against 0 |
---|
[e3e16bc] | 92 | DeclStmt * declStmt = strict_dynamic_cast< DeclStmt * >( stmt ); |
---|
| 93 | DeclarationWithType * dwt = strict_dynamic_cast< DeclarationWithType * >( declStmt->decl ); |
---|
[a01f7c94] | 94 | Expression * nze = notZeroExpr( new VariableExpr( dwt ) ); |
---|
| 95 | cond = cond ? new LogicalExpr( cond, nze, true ) : nze; |
---|
| 96 | } |
---|
| 97 | } |
---|
[6d49ea3] | 98 | delete ctl; |
---|
[ee3c93d] | 99 | return cond; |
---|
[401e61f] | 100 | } // build_if_control |
---|
[ee3c93d] | 101 | |
---|
[f271bdd] | 102 | Statement * build_if( IfCtrl * ctl, StatementNode * then_stmt, StatementNode * else_stmt ) { |
---|
[401e61f] | 103 | Statement * thenb, * elseb = nullptr; |
---|
[ee3c93d] | 104 | std::list< Statement * > branches; |
---|
| 105 | buildMoveList< Statement, StatementNode >( then_stmt, branches ); |
---|
| 106 | assert( branches.size() == 1 ); |
---|
| 107 | thenb = branches.front(); |
---|
| 108 | |
---|
| 109 | if ( else_stmt ) { |
---|
| 110 | std::list< Statement * > branches; |
---|
| 111 | buildMoveList< Statement, StatementNode >( else_stmt, branches ); |
---|
| 112 | assert( branches.size() == 1 ); |
---|
| 113 | elseb = branches.front(); |
---|
| 114 | } // if |
---|
| 115 | |
---|
| 116 | std::list< Statement * > init; |
---|
| 117 | Expression * cond = build_if_control( ctl, init ); |
---|
[ba3706f] | 118 | return new IfStmt( cond, thenb, elseb, init ); |
---|
[401e61f] | 119 | } // build_if |
---|
[2f22cc4] | 120 | |
---|
[61fc4f6] | 121 | Statement * build_switch( bool isSwitch, ExpressionNode * ctl, StatementNode * stmt ) { |
---|
[7880579] | 122 | std::list< Statement * > branches; |
---|
[7ecbb7e] | 123 | buildMoveList< Statement, StatementNode >( stmt, branches ); |
---|
[6a276a0] | 124 | if ( ! isSwitch ) { // choose statement |
---|
| 125 | for ( Statement * stmt : branches ) { |
---|
| 126 | CaseStmt * caseStmt = strict_dynamic_cast< CaseStmt * >( stmt ); |
---|
| 127 | if ( ! caseStmt->stmts.empty() ) { // code after "case" => end of case list |
---|
| 128 | CompoundStmt * block = strict_dynamic_cast< CompoundStmt * >( caseStmt->stmts.front() ); |
---|
| 129 | block->kids.push_back( new BranchStmt( "", BranchStmt::Break ) ); |
---|
| 130 | } // if |
---|
| 131 | } // for |
---|
| 132 | } // if |
---|
[20519b7] | 133 | // branches.size() == 0 for switch (...) {}, i.e., no declaration or statements |
---|
[ba3706f] | 134 | return new SwitchStmt( maybeMoveBuild< Expression >(ctl), branches ); |
---|
[401e61f] | 135 | } // build_switch |
---|
| 136 | |
---|
[61fc4f6] | 137 | Statement * build_case( ExpressionNode * ctl ) { |
---|
[7880579] | 138 | std::list< Statement * > branches; |
---|
[ba3706f] | 139 | return new CaseStmt( maybeMoveBuild< Expression >(ctl), branches ); |
---|
[401e61f] | 140 | } // build_case |
---|
| 141 | |
---|
[61fc4f6] | 142 | Statement * build_default() { |
---|
[7880579] | 143 | std::list< Statement * > branches; |
---|
[ba3706f] | 144 | return new CaseStmt( nullptr, branches, true ); |
---|
[401e61f] | 145 | } // build_default |
---|
| 146 | |
---|
[f271bdd] | 147 | Statement * build_while( IfCtrl * ctl, StatementNode * stmt ) { |
---|
[401e61f] | 148 | std::list< Statement * > branches; |
---|
| 149 | buildMoveList< Statement, StatementNode >( stmt, branches ); |
---|
| 150 | assert( branches.size() == 1 ); |
---|
| 151 | |
---|
| 152 | std::list< Statement * > init; |
---|
| 153 | Expression * cond = build_if_control( ctl, init ); |
---|
| 154 | return new WhileStmt( cond, branches.front(), init, false ); |
---|
| 155 | } // build_while |
---|
[2f22cc4] | 156 | |
---|
[401e61f] | 157 | Statement * build_do_while( ExpressionNode * ctl, StatementNode * stmt ) { |
---|
[7880579] | 158 | std::list< Statement * > branches; |
---|
[7ecbb7e] | 159 | buildMoveList< Statement, StatementNode >( stmt, branches ); |
---|
[2f22cc4] | 160 | assert( branches.size() == 1 ); |
---|
[ee3c93d] | 161 | |
---|
| 162 | std::list< Statement * > init; |
---|
[401e61f] | 163 | return new WhileStmt( notZeroExpr( maybeMoveBuild< Expression >(ctl) ), branches.front(), init, true ); |
---|
| 164 | } // build_do_while |
---|
[2f22cc4] | 165 | |
---|
[f271bdd] | 166 | Statement * build_for( ForCtrl * forctl, StatementNode * stmt ) { |
---|
[7880579] | 167 | std::list< Statement * > branches; |
---|
[7ecbb7e] | 168 | buildMoveList< Statement, StatementNode >( stmt, branches ); |
---|
[2f22cc4] | 169 | assert( branches.size() == 1 ); |
---|
| 170 | |
---|
[7880579] | 171 | std::list< Statement * > init; |
---|
[2f22cc4] | 172 | if ( forctl->init != 0 ) { |
---|
[7ecbb7e] | 173 | buildMoveList( forctl->init, init ); |
---|
[2f22cc4] | 174 | } // if |
---|
| 175 | |
---|
[61fc4f6] | 176 | Expression * cond = 0; |
---|
[2f22cc4] | 177 | if ( forctl->condition != 0 ) |
---|
[7ecbb7e] | 178 | cond = notZeroExpr( maybeMoveBuild< Expression >(forctl->condition) ); |
---|
[2f22cc4] | 179 | |
---|
[61fc4f6] | 180 | Expression * incr = 0; |
---|
[2f22cc4] | 181 | if ( forctl->change != 0 ) |
---|
[7ecbb7e] | 182 | incr = maybeMoveBuild< Expression >(forctl->change); |
---|
[2f22cc4] | 183 | |
---|
| 184 | delete forctl; |
---|
[ba3706f] | 185 | return new ForStmt( init, cond, incr, branches.front() ); |
---|
[401e61f] | 186 | } // build_for |
---|
[2f22cc4] | 187 | |
---|
[61fc4f6] | 188 | Statement * build_branch( BranchStmt::Type kind ) { |
---|
[ba3706f] | 189 | Statement * ret = new BranchStmt( "", kind ); |
---|
[ab57786] | 190 | return ret; |
---|
[401e61f] | 191 | } // build_branch |
---|
| 192 | |
---|
[61fc4f6] | 193 | Statement * build_branch( std::string * identifier, BranchStmt::Type kind ) { |
---|
| 194 | Statement * ret = new BranchStmt( * identifier, kind ); |
---|
[ab57786] | 195 | delete identifier; // allocated by lexer |
---|
| 196 | return ret; |
---|
[401e61f] | 197 | } // build_branch |
---|
| 198 | |
---|
[61fc4f6] | 199 | Statement * build_computedgoto( ExpressionNode * ctl ) { |
---|
[ba3706f] | 200 | return new BranchStmt( maybeMoveBuild< Expression >(ctl), BranchStmt::Goto ); |
---|
[401e61f] | 201 | } // build_computedgoto |
---|
[8cc5cb0] | 202 | |
---|
[61fc4f6] | 203 | Statement * build_return( ExpressionNode * ctl ) { |
---|
[7880579] | 204 | std::list< Expression * > exps; |
---|
[7ecbb7e] | 205 | buildMoveList( ctl, exps ); |
---|
[ba3706f] | 206 | return new ReturnStmt( exps.size() > 0 ? exps.back() : nullptr ); |
---|
[401e61f] | 207 | } // build_return |
---|
[daf1af8] | 208 | |
---|
[61fc4f6] | 209 | Statement * build_throw( ExpressionNode * ctl ) { |
---|
[7880579] | 210 | std::list< Expression * > exps; |
---|
[7ecbb7e] | 211 | buildMoveList( ctl, exps ); |
---|
[ac71a86] | 212 | assertf( exps.size() < 2, "This means we are leaking memory"); |
---|
[ba3706f] | 213 | return new ThrowStmt( ThrowStmt::Terminate, !exps.empty() ? exps.back() : nullptr ); |
---|
[401e61f] | 214 | } // build_throw |
---|
[daf1af8] | 215 | |
---|
[61fc4f6] | 216 | Statement * build_resume( ExpressionNode * ctl ) { |
---|
[daf1af8] | 217 | std::list< Expression * > exps; |
---|
| 218 | buildMoveList( ctl, exps ); |
---|
| 219 | assertf( exps.size() < 2, "This means we are leaking memory"); |
---|
[ba3706f] | 220 | return new ThrowStmt( ThrowStmt::Resume, !exps.empty() ? exps.back() : nullptr ); |
---|
[401e61f] | 221 | } // build_resume |
---|
[daf1af8] | 222 | |
---|
[61fc4f6] | 223 | Statement * build_resume_at( ExpressionNode * ctl, ExpressionNode * target ) { |
---|
[794c15b] | 224 | (void)ctl; |
---|
| 225 | (void)target; |
---|
| 226 | assertf( false, "resume at (non-local throw) is not yet supported," ); |
---|
[401e61f] | 227 | } // build_resume_at |
---|
[321f55d] | 228 | |
---|
[61fc4f6] | 229 | Statement * build_try( StatementNode * try_stmt, StatementNode * catch_stmt, StatementNode * finally_stmt ) { |
---|
[046e04a] | 230 | std::list< CatchStmt * > branches; |
---|
| 231 | buildMoveList< CatchStmt, StatementNode >( catch_stmt, branches ); |
---|
[61fc4f6] | 232 | CompoundStmt * tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt)); |
---|
| 233 | FinallyStmt * finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) ); |
---|
[ba3706f] | 234 | return new TryStmt( tryBlock, branches, finallyBlock ); |
---|
[401e61f] | 235 | } // build_try |
---|
| 236 | |
---|
[61fc4f6] | 237 | Statement * build_catch( CatchStmt::Kind kind, DeclarationNode * decl, ExpressionNode * cond, StatementNode * body ) { |
---|
[7880579] | 238 | std::list< Statement * > branches; |
---|
[ca78437] | 239 | buildMoveList< Statement, StatementNode >( body, branches ); |
---|
[1d4580a] | 240 | assert( branches.size() == 1 ); |
---|
[ba3706f] | 241 | return new CatchStmt( kind, maybeMoveBuild< Declaration >(decl), maybeMoveBuild< Expression >(cond), branches.front() ); |
---|
[401e61f] | 242 | } // build_catch |
---|
| 243 | |
---|
[61fc4f6] | 244 | Statement * build_finally( StatementNode * stmt ) { |
---|
[7880579] | 245 | std::list< Statement * > branches; |
---|
[7ecbb7e] | 246 | buildMoveList< Statement, StatementNode >( stmt, branches ); |
---|
[1d4580a] | 247 | assert( branches.size() == 1 ); |
---|
[ba3706f] | 248 | return new FinallyStmt( dynamic_cast< CompoundStmt * >( branches.front() ) ); |
---|
[401e61f] | 249 | } // build_finally |
---|
[1d4580a] | 250 | |
---|
[427854b] | 251 | SuspendStmt * build_suspend( StatementNode * then, SuspendStmt::Type type ) { |
---|
| 252 | auto node = new SuspendStmt(); |
---|
| 253 | |
---|
| 254 | node->type = type; |
---|
| 255 | |
---|
| 256 | std::list< Statement * > stmts; |
---|
| 257 | buildMoveList< Statement, StatementNode >( then, stmts ); |
---|
| 258 | if(!stmts.empty()) { |
---|
| 259 | assert( stmts.size() == 1 ); |
---|
| 260 | node->then = dynamic_cast< CompoundStmt * >( stmts.front() ); |
---|
| 261 | } |
---|
| 262 | |
---|
| 263 | return node; |
---|
| 264 | } |
---|
| 265 | |
---|
[135b431] | 266 | WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when ) { |
---|
| 267 | auto node = new WaitForStmt(); |
---|
| 268 | |
---|
| 269 | WaitForStmt::Target target; |
---|
| 270 | target.function = maybeBuild<Expression>( targetExpr ); |
---|
[2065609] | 271 | |
---|
| 272 | ExpressionNode * next = dynamic_cast<ExpressionNode *>( targetExpr->get_next() ); |
---|
| 273 | targetExpr->set_next( nullptr ); |
---|
| 274 | buildMoveList< Expression >( next, target.arguments ); |
---|
| 275 | |
---|
[135b431] | 276 | delete targetExpr; |
---|
| 277 | |
---|
| 278 | node->clauses.push_back( WaitForStmt::Clause{ |
---|
| 279 | target, |
---|
| 280 | maybeMoveBuild<Statement >( stmt ), |
---|
[1dcd9554] | 281 | notZeroExpr( maybeMoveBuild<Expression>( when ) ) |
---|
[135b431] | 282 | }); |
---|
| 283 | |
---|
| 284 | return node; |
---|
[401e61f] | 285 | } // build_waitfor |
---|
[135b431] | 286 | |
---|
| 287 | WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when, WaitForStmt * node ) { |
---|
| 288 | WaitForStmt::Target target; |
---|
| 289 | target.function = maybeBuild<Expression>( targetExpr ); |
---|
[2065609] | 290 | |
---|
| 291 | ExpressionNode * next = dynamic_cast<ExpressionNode *>( targetExpr->get_next() ); |
---|
| 292 | targetExpr->set_next( nullptr ); |
---|
| 293 | buildMoveList< Expression >( next, target.arguments ); |
---|
| 294 | |
---|
[135b431] | 295 | delete targetExpr; |
---|
| 296 | |
---|
[310e5b7] | 297 | node->clauses.insert( node->clauses.begin(), WaitForStmt::Clause{ |
---|
[135b431] | 298 | std::move( target ), |
---|
| 299 | maybeMoveBuild<Statement >( stmt ), |
---|
[1dcd9554] | 300 | notZeroExpr( maybeMoveBuild<Expression>( when ) ) |
---|
[135b431] | 301 | }); |
---|
| 302 | |
---|
| 303 | return node; |
---|
[401e61f] | 304 | } // build_waitfor |
---|
[135b431] | 305 | |
---|
| 306 | WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when ) { |
---|
| 307 | auto node = new WaitForStmt(); |
---|
| 308 | |
---|
| 309 | if( timeout ) { |
---|
| 310 | node->timeout.time = maybeMoveBuild<Expression>( timeout ); |
---|
| 311 | node->timeout.statement = maybeMoveBuild<Statement >( stmt ); |
---|
[1dcd9554] | 312 | node->timeout.condition = notZeroExpr( maybeMoveBuild<Expression>( when ) ); |
---|
[401e61f] | 313 | } else { |
---|
[1dcd9554] | 314 | node->orelse.statement = maybeMoveBuild<Statement >( stmt ); |
---|
| 315 | node->orelse.condition = notZeroExpr( maybeMoveBuild<Expression>( when ) ); |
---|
[401e61f] | 316 | } // if |
---|
[135b431] | 317 | |
---|
| 318 | return node; |
---|
[401e61f] | 319 | } // build_waitfor_timeout |
---|
[135b431] | 320 | |
---|
| 321 | WaitForStmt * build_waitfor_timeout( ExpressionNode * timeout, StatementNode * stmt, ExpressionNode * when, StatementNode * else_stmt, ExpressionNode * else_when ) { |
---|
| 322 | auto node = new WaitForStmt(); |
---|
| 323 | |
---|
| 324 | node->timeout.time = maybeMoveBuild<Expression>( timeout ); |
---|
| 325 | node->timeout.statement = maybeMoveBuild<Statement >( stmt ); |
---|
[1dcd9554] | 326 | node->timeout.condition = notZeroExpr( maybeMoveBuild<Expression>( when ) ); |
---|
[135b431] | 327 | |
---|
[a378ca7] | 328 | node->orelse.statement = maybeMoveBuild<Statement >( else_stmt ); |
---|
[1dcd9554] | 329 | node->orelse.condition = notZeroExpr( maybeMoveBuild<Expression>( else_when ) ); |
---|
[135b431] | 330 | |
---|
| 331 | return node; |
---|
[401e61f] | 332 | } // build_waitfor_timeout |
---|
[135b431] | 333 | |
---|
[e67991f] | 334 | Statement * build_with( ExpressionNode * exprs, StatementNode * stmt ) { |
---|
[a378ca7] | 335 | std::list< Expression * > e; |
---|
| 336 | buildMoveList( exprs, e ); |
---|
| 337 | Statement * s = maybeMoveBuild<Statement>( stmt ); |
---|
[e67991f] | 338 | return new DeclStmt( new WithStmt( e, s ) ); |
---|
[401e61f] | 339 | } // build_with |
---|
[a378ca7] | 340 | |
---|
[61fc4f6] | 341 | Statement * build_compound( StatementNode * first ) { |
---|
| 342 | CompoundStmt * cs = new CompoundStmt(); |
---|
[7ecbb7e] | 343 | buildMoveList( first, cs->get_kids() ); |
---|
[b87a5ed] | 344 | return cs; |
---|
[401e61f] | 345 | } // build_compound |
---|
[51b7345] | 346 | |
---|
[6d539f83] | 347 | Statement * build_asm( bool voltile, Expression * instruction, ExpressionNode * output, ExpressionNode * input, ExpressionNode * clobber, LabelNode * gotolabels ) { |
---|
[7f5566b] | 348 | std::list< Expression * > out, in; |
---|
| 349 | std::list< ConstantExpr * > clob; |
---|
[e82aa9df] | 350 | |
---|
[7ecbb7e] | 351 | buildMoveList( output, out ); |
---|
| 352 | buildMoveList( input, in ); |
---|
| 353 | buildMoveList( clobber, clob ); |
---|
[ba3706f] | 354 | return new AsmStmt( voltile, instruction, out, in, clob, gotolabels ? gotolabels->labels : noLabels ); |
---|
[401e61f] | 355 | } // build_asm |
---|
[7f5566b] | 356 | |
---|
[6d539f83] | 357 | Statement * build_directive( string * directive ) { |
---|
[cc32d83] | 358 | return new DirectiveStmt( *directive ); |
---|
[401e61f] | 359 | } // build_directive |
---|
[61fc4f6] | 360 | |
---|
[51b7345] | 361 | // Local Variables: // |
---|
[b87a5ed] | 362 | // tab-width: 4 // |
---|
| 363 | // mode: c++ // |
---|
| 364 | // compile-command: "make install" // |
---|
[51b7345] | 365 | // End: // |
---|