Changes in src/GenPoly/Box.cc [d7dc824:d56e5bc]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
rd7dc824 rd56e5bc 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 13 09:26:38201713 // Update Count : 34 112 // Last Modified On : Wed Jun 21 15:49:59 2017 13 // Update Count : 346 14 14 // 15 15 … … 62 62 namespace GenPoly { 63 63 namespace { 64 const std::list<Label> noLabels;65 66 64 FunctionType *makeAdapterType( FunctionType *adaptee, const TyVarMap &tyVars ); 67 65 … … 343 341 Statement *makeAlignTo( Expression *lhs, Expression *rhs ) { 344 342 // check that the lhs is zeroed out to the level of rhs 345 Expression *ifCond = makeOp( "?&?", lhs, makeOp( "?-?", rhs, new ConstantExpr( Constant ( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), "1") ) ) );343 Expression *ifCond = makeOp( "?&?", lhs, makeOp( "?-?", rhs, new ConstantExpr( Constant::from_ulong( 1 ) ) ) ); 346 344 // if not aligned, increment to alignment 347 345 Expression *ifExpr = makeOp( "?+=?", lhs->clone(), makeOp( "?-?", rhs->clone(), ifCond->clone() ) ); … … 386 384 387 385 // initialize size and alignment to 0 and 1 (will have at least one member to re-edit size) 388 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant ( sizeAlignType->clone(), "0") ) ) );389 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant ( sizeAlignType->clone(), "1") ) ) );386 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant::from_ulong( 0 ) ) ) ); 387 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant::from_ulong( 1 ) ) ) ); 390 388 unsigned long n_members = 0; 391 389 bool firstMember = true; … … 443 441 444 442 // calculate union layout in function body 445 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant ( sizeAlignType->clone(), "1") ) ) );446 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant ( sizeAlignType->clone(), "1") ) ) );443 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant::from_ulong( 1 ) ) ) ); 444 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant::from_ulong( 1 ) ) ) ); 447 445 for ( std::list< Declaration* >::const_iterator member = unionDecl->get_members().begin(); member != unionDecl->get_members().end(); ++member ) { 448 446 DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member ); … … 1566 1564 /// Returns an index expression into the offset array for a type 1567 1565 Expression *makeOffsetIndex( Type *objectType, long i ) { 1568 std::stringstream offset_namer; 1569 offset_namer << i; 1570 ConstantExpr *fieldIndex = new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), offset_namer.str() ) ); 1566 ConstantExpr *fieldIndex = new ConstantExpr( Constant::from_ulong( i ) ); 1571 1567 UntypedExpr *fieldOffset = new UntypedExpr( new NameExpr( "?[?]" ) ); 1572 1568 fieldOffset->get_args().push_back( new NameExpr( offsetofName( mangleType( objectType ) ) ) ); … … 1781 1777 // all union members are at offset zero 1782 1778 delete offsetofExpr; 1783 return new ConstantExpr( Constant ( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), "0") );1779 return new ConstantExpr( Constant::from_ulong( 0 ) ); 1784 1780 } else return offsetofExpr; 1785 1781 }
Note: See TracChangeset
for help on using the changeset viewer.