Changeset 417117e for src/SymTab
- Timestamp:
- Jun 28, 2019, 3:50:21 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 03bf5c8
- Parents:
- 55b6476
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/SymTab/Autogen.h ¶
r55b6476 r417117e 21 21 22 22 #include "AST/Decl.hpp" 23 #include "AST/Eval.hpp" 23 24 #include "AST/Expr.hpp" 24 25 #include "AST/Init.hpp" … … 264 265 } 265 266 266 ast::ptr< ast::Expr > begin, end, cmp, update; 267 ast::ptr< ast::Expr > begin, end; 268 std::string cmp, update; 267 269 268 270 if ( forward ) { … … 270 272 begin = ast::ConstantExpr::from_int( loc, 0 ); 271 273 end = array->dimension; 272 cmp = new ast::NameExpr{ loc, "?<?" };273 update = new ast::NameExpr{ loc, "++?" };274 cmp = "?<?"; 275 update = "++?"; 274 276 } else { 275 277 // generate: for ( int i = N-1; i >= 0; --i ) 276 begin = new ast::UntypedExpr{ 277 loc, new ast::NameExpr{ loc, "?-?" }, 278 { array->dimension, ast::ConstantExpr::from_int( loc, 1 ) } }; 278 begin = ast::call( 279 loc, "?-?", array->dimension, ast::ConstantExpr::from_int( loc, 1 ) ); 279 280 end = ast::ConstantExpr::from_int( loc, 0 ); 280 cmp = new ast::NameExpr{ loc, "?>=?" };281 update = new ast::NameExpr{ loc, "--?" };281 cmp = "?>=?"; 282 update = "--?"; 282 283 } 283 284 … … 285 286 loc, indexName.newName(), new ast::BasicType{ ast::BasicType::SignedInt }, 286 287 new ast::SingleInit{ loc, begin } }; 287 288 ast::ptr< ast::Expr > cond = new ast::UntypedExpr{ 289 loc, cmp, { new ast::VariableExpr{ loc, index }, end } }; 290 291 ast::ptr< ast::Expr > inc = new ast::UntypedExpr{ 292 loc, update, { new ast::VariableExpr{ loc, index } } }; 293 294 ast::ptr< ast::Expr > dstIndex = new ast::UntypedExpr{ 295 loc, new ast::NameExpr{ loc, "?[?]" }, 296 { dstParam, new ast::VariableExpr{ loc, index } } }; 288 ast::ptr< ast::Expr > indexVar = new ast::VariableExpr{ loc, index }; 289 290 ast::ptr< ast::Expr > cond = ast::call( loc, cmp, indexVar, end ); 291 292 ast::ptr< ast::Expr > inc = ast::call( loc, update, indexVar ); 293 294 ast::ptr< ast::Expr > dstIndex = ast::call( loc, "?[?]", dstParam, indexVar ); 297 295 298 296 // srcParam must keep track of the array indices to build the source parameter and/or 299 297 // array list initializer 300 srcParam.addArrayIndex( new ast::VariableExpr{ loc, index }, array->dimension );298 srcParam.addArrayIndex( indexVar, array->dimension ); 301 299 302 300 // for stmt's body, eventually containing call … … 384 382 if ( isUnnamedBitfield( obj ) ) return {}; 385 383 386 ast::ptr< ast::Type > addCast = nullptr;384 ast::ptr< ast::Type > addCast; 387 385 if ( (fname == "?{}" || fname == "^?{}") && ( ! obj || ( obj && ! obj->bitfieldWidth ) ) ) { 388 386 assert( dstParam->result );
Note: See TracChangeset
for help on using the changeset viewer.