Changeset adc6781 for src/GenPoly


Ignore:
Timestamp:
Apr 8, 2016, 2:43:20 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
63c0dbf
Parents:
224e52f
Message:

Remove unnecessarily duplicated name-mangling passes in Box

Location:
src/GenPoly
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r224e52f radc6781  
    385385                for ( std::list< TypeDecl* >::const_iterator param = otypeParams.begin(); param != otypeParams.end(); ++param ) {
    386386                        TypeInstType paramType( Type::Qualifiers(), (*param)->get_name(), *param );
    387                         layoutFnType->get_parameters().push_back( new ObjectDecl( sizeofName( &paramType ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
    388                         layoutFnType->get_parameters().push_back( new ObjectDecl( alignofName( &paramType ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
     387                        std::string paramName = mangleType( &paramType );
     388                        layoutFnType->get_parameters().push_back( new ObjectDecl( sizeofName( paramName ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
     389                        layoutFnType->get_parameters().push_back( new ObjectDecl( alignofName( paramName ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignType.clone(), 0 ) );
    389390                }
    390391        }
    391392
    392393        /// Builds a layout function declaration
    393         FunctionDecl *buildLayoutFunctionDecl( const std::string &typeName, unsigned int functionNesting, FunctionType *layoutFnType ) {
     394        FunctionDecl *buildLayoutFunctionDecl( AggregateDecl *typeDecl, unsigned int functionNesting, FunctionType *layoutFnType ) {
    394395                // Routines at global scope marked "static" to prevent multiple definitions is separate translation units
    395396                // because each unit generates copies of the default routines for each aggregate.
    396397                FunctionDecl *layoutDecl = new FunctionDecl(
    397                         "__layoutof_" + typeName, functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, layoutFnType, new CompoundStmt( noLabels ), true, false );
     398                        layoutofName( typeDecl ), functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static, LinkageSpec::AutoGen, layoutFnType, new CompoundStmt( noLabels ), true, false );
    398399                layoutDecl->fixUniqueId();
    399400                return layoutDecl;
     
    462463                PointerType *sizeAlignOutType = new PointerType( Type::Qualifiers(), sizeAlignType );
    463464               
    464                 ObjectDecl *sizeParam = new ObjectDecl( "__sizeof_" + structDecl->get_name(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
     465                ObjectDecl *sizeParam = new ObjectDecl( sizeofName( structDecl->get_name() ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
    465466                layoutFnType->get_parameters().push_back( sizeParam );
    466                 ObjectDecl *alignParam = new ObjectDecl( "__alignof_" + structDecl->get_name(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
     467                ObjectDecl *alignParam = new ObjectDecl( alignofName( structDecl->get_name() ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
    467468                layoutFnType->get_parameters().push_back( alignParam );
    468                 ObjectDecl *offsetParam = new ObjectDecl( "__offsetof_" + structDecl->get_name(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
     469                ObjectDecl *offsetParam = new ObjectDecl( offsetofName( structDecl->get_name() ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
    469470                layoutFnType->get_parameters().push_back( offsetParam );
    470471                addOtypeParams( layoutFnType, otypeParams );
    471472
    472473                // build function decl
    473                 FunctionDecl *layoutDecl = buildLayoutFunctionDecl( structDecl->get_name(), functionNesting, layoutFnType );
     474                FunctionDecl *layoutDecl = buildLayoutFunctionDecl( structDecl, functionNesting, layoutFnType );
    474475
    475476                // calculate struct layout in function body
     
    523524                PointerType *sizeAlignOutType = new PointerType( Type::Qualifiers(), sizeAlignType );
    524525               
    525                 ObjectDecl *sizeParam = new ObjectDecl( "__sizeof_" + unionDecl->get_name(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
     526                ObjectDecl *sizeParam = new ObjectDecl( sizeofName( unionDecl->get_name() ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType, 0 );
    526527                layoutFnType->get_parameters().push_back( sizeParam );
    527                 ObjectDecl *alignParam = new ObjectDecl( "__alignof_" + unionDecl->get_name(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
     528                ObjectDecl *alignParam = new ObjectDecl( alignofName( unionDecl->get_name() ), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, sizeAlignOutType->clone(), 0 );
    528529                layoutFnType->get_parameters().push_back( alignParam );
    529530                addOtypeParams( layoutFnType, otypeParams );
    530531
    531532                // build function decl
    532                 FunctionDecl *layoutDecl = buildLayoutFunctionDecl( unionDecl->get_name(), functionNesting, layoutFnType );
     533                FunctionDecl *layoutDecl = buildLayoutFunctionDecl( unionDecl, functionNesting, layoutFnType );
    533534
    534535                // calculate union layout in function body
     
    747748                        Type *polyBase = hasPolyBase( parmType, exprTyVars );
    748749                        if ( polyBase && ! dynamic_cast< TypeInstType* >( polyBase ) ) {
    749                                 std::string sizeName = sizeofName( polyBase );
    750                                 if ( seenTypes.count( sizeName ) ) return;
     750                                std::string typeName = mangleType( polyBase );
     751                                if ( seenTypes.count( typeName ) ) return;
    751752
    752753                                arg = appExpr->get_args().insert( arg, new SizeofExpr( argBaseType->clone() ) );
     
    766767                                }
    767768
    768                                 seenTypes.insert( sizeName );
     769                                seenTypes.insert( typeName );
    769770                        }
    770771                }
     
    11241125                                addAssign->get_args().push_back( appExpr->get_args().front() );
    11251126                        } // if
    1126                         addAssign->get_args().push_back( new NameExpr( sizeofName( polyType ) ) );
     1127                        addAssign->get_args().push_back( new NameExpr( sizeofName( mangleType( polyType ) ) ) );
    11271128                        addAssign->get_results().front() = appExpr->get_results().front()->clone();
    11281129                        if ( appExpr->get_env() ) {
     
    11511152                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
    11521153                                                        multiply->get_args().push_back( appExpr->get_args().back() );
    1153                                                         multiply->get_args().push_back( new NameExpr( sizeofName( baseType1 ) ) );
     1154                                                        multiply->get_args().push_back( new SizeofExpr( baseType1->clone() ) );
    11541155                                                        ret->get_args().push_back( appExpr->get_args().front() );
    11551156                                                        ret->get_args().push_back( multiply );
     
    11571158                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
    11581159                                                        multiply->get_args().push_back( appExpr->get_args().front() );
    1159                                                         multiply->get_args().push_back( new NameExpr( sizeofName( baseType2 ) ) );
     1160                                                        multiply->get_args().push_back( new SizeofExpr( baseType2->clone() ) );
    11601161                                                        ret->get_args().push_back( multiply );
    11611162                                                        ret->get_args().push_back( appExpr->get_args().back() );
     
    12201221                                                        UntypedExpr *divide = new UntypedExpr( new NameExpr( "?/?" ) );
    12211222                                                        divide->get_args().push_back( appExpr );
    1222                                                         divide->get_args().push_back( new NameExpr( sizeofName( baseType1 ) ) );
     1223                                                        divide->get_args().push_back( new SizeofExpr( baseType1->clone() ) );
    12231224                                                        divide->get_results().push_front( appExpr->get_results().front()->clone() );
    12241225                                                        if ( appExpr->get_env() ) {
     
    12301231                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
    12311232                                                        multiply->get_args().push_back( appExpr->get_args().back() );
    1232                                                         multiply->get_args().push_back( new NameExpr( sizeofName( baseType1 ) ) );
     1233                                                        multiply->get_args().push_back( new SizeofExpr( baseType1->clone() ) );
    12331234                                                        appExpr->get_args().back() = multiply;
    12341235                                                } else if ( baseType2 ) {
    12351236                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
    12361237                                                        multiply->get_args().push_back( appExpr->get_args().front() );
    1237                                                         multiply->get_args().push_back( new NameExpr( sizeofName( baseType2 ) ) );
     1238                                                        multiply->get_args().push_back( new SizeofExpr( baseType2->clone() ) );
    12381239                                                        appExpr->get_args().front() = multiply;
    12391240                                                } // if
     
    12451246                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
    12461247                                                        multiply->get_args().push_back( appExpr->get_args().back() );
    1247                                                         multiply->get_args().push_back( new NameExpr( sizeofName( baseType ) ) );
     1248                                                        multiply->get_args().push_back( new SizeofExpr( baseType->clone() ) );
    12481249                                                        appExpr->get_args().back() = multiply;
    12491250                                                } // if
     
    15721573                                if ( (*tyParm)->get_kind() == TypeDecl::Any ) {
    15731574                                        TypeInstType parmType( Type::Qualifiers(), (*tyParm)->get_name(), *tyParm );
     1575                                        std::string parmName = mangleType( &parmType );
    15741576
    15751577                                        sizeParm = newObj.clone();
    1576                                         sizeParm->set_name( sizeofName( &parmType ) );
     1578                                        sizeParm->set_name( sizeofName( parmName ) );
    15771579                                        last = funcType->get_parameters().insert( last, sizeParm );
    15781580                                        ++last;
    15791581
    15801582                                        alignParm = newObj.clone();
    1581                                         alignParm->set_name( alignofName( &parmType ) );
     1583                                        alignParm->set_name( alignofName( parmName ) );
    15821584                                        last = funcType->get_parameters().insert( last, alignParm );
    15831585                                        ++last;
     
    15961598                                Type *polyBase = hasPolyBase( (*fnParm)->get_type(), scopeTyVars );
    15971599                                if ( polyBase && ! dynamic_cast< TypeInstType* >( polyBase ) ) {
    1598                                         std::string sizeName = sizeofName( polyBase );
    1599                                         if ( seenTypes.count( sizeName ) ) continue;
     1600                                        std::string typeName = mangleType( polyBase );
     1601                                        if ( seenTypes.count( typeName ) ) continue;
    16001602
    16011603                                        ObjectDecl *sizeParm, *alignParm, *offsetParm;
    16021604                                        sizeParm = newObj.clone();
    1603                                         sizeParm->set_name( sizeName );
     1605                                        sizeParm->set_name( sizeofName( typeName ) );
    16041606                                        last = funcType->get_parameters().insert( last, sizeParm );
    16051607                                        ++last;
    16061608
    16071609                                        alignParm = newObj.clone();
    1608                                         alignParm->set_name( alignofName( polyBase ) );
     1610                                        alignParm->set_name( alignofName( typeName ) );
    16091611                                        last = funcType->get_parameters().insert( last, alignParm );
    16101612                                        ++last;
     
    16141616                                                if ( ! polyBaseStruct->get_baseStruct()->get_members().empty() ) {
    16151617                                                        offsetParm = newPtr.clone();
    1616                                                         offsetParm->set_name( offsetofName( polyBase ) );
     1618                                                        offsetParm->set_name( offsetofName( typeName ) );
    16171619                                                        last = funcType->get_parameters().insert( last, offsetParm );
    16181620                                                        ++last;
     
    16201622                                        }
    16211623
    1622                                         seenTypes.insert( sizeName );
     1624                                        seenTypes.insert( typeName );
    16231625                                }
    16241626                        }
     
    18721874                                Type *polyBase = hasPolyBase( (*fnParm)->get_type(), scopeTyVars );
    18731875                                if ( polyBase && ! dynamic_cast< TypeInstType* >( polyBase ) ) {
    1874                                         knownLayouts.insert( sizeofName( polyBase ) );
     1876                                        knownLayouts.insert( mangleType( polyBase ) );
    18751877                                }
    18761878                        }
     
    18891891                                        Type *declType = objectDecl->get_type();
    18901892                                        UntypedExpr *alloc = new UntypedExpr( new NameExpr( "__builtin_alloca" ) );
    1891                                         alloc->get_args().push_back( new NameExpr( sizeofName( declType ) ) );
     1893                                        alloc->get_args().push_back( new NameExpr( sizeofName( mangleType( declType ) ) ) );
    18921894
    18931895                                        delete objectDecl->get_init();
     
    19211923                        ConstantExpr *fieldIndex = new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), offset_namer.str() ) );
    19221924                        UntypedExpr *fieldOffset = new UntypedExpr( new NameExpr( "?[?]" ) );
    1923                         fieldOffset->get_args().push_back( new NameExpr( offsetofName( objectType ) ) );
     1925                        fieldOffset->get_args().push_back( new NameExpr( offsetofName( mangleType( objectType ) ) ) );
    19241926                        fieldOffset->get_args().push_back( fieldIndex );
    19251927                        return fieldOffset;
     
    19951997                                if ( findGeneric( *param ) ) {
    19961998                                        // push size/align vars for a generic parameter back
    1997                                         layoutCall->get_args().push_back( new NameExpr( sizeofName( *param ) ) );
    1998                                         layoutCall->get_args().push_back( new NameExpr( alignofName( *param ) ) );
     1999                                        std::string paramName = mangleType( *param );
     2000                                        layoutCall->get_args().push_back( new NameExpr( sizeofName( paramName ) ) );
     2001                                        layoutCall->get_args().push_back( new NameExpr( alignofName( paramName ) ) );
    19992002                                } else {
    20002003                                        layoutCall->get_args().push_back( new SizeofExpr( (*param)->clone() ) );
     
    20402043                        } else if ( StructInstType *structTy = dynamic_cast< StructInstType* >( ty ) ) {
    20412044                                // check if this type already has a layout generated for it
    2042                                 std::string sizeName = sizeofName( ty );
    2043                                 if ( knownLayouts.find( sizeName ) != knownLayouts.end() ) return true;
     2045                                std::string typeName = mangleType( ty );
     2046                                if ( knownLayouts.find( typeName ) != knownLayouts.end() ) return true;
    20442047
    20452048                                // check if any of the type parameters have dynamic layout; if none do, this type is (or will be) monomorphized
     
    20482051
    20492052                                // insert local variables for layout and generate call to layout function
    2050                                 knownLayouts.insert( sizeName );  // done early so as not to interfere with the later addition of parameters to the layout call
     2053                                knownLayouts.insert( typeName );  // done early so as not to interfere with the later addition of parameters to the layout call
    20512054                                Type *layoutType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
    20522055
     
    20542057                                if ( n_members == 0 ) {
    20552058                                        // all empty structs have the same layout - size 1, align 1
    2056                                         makeVar( sizeName, layoutType, new SingleInit( new ConstantExpr( Constant::from( (unsigned long)1 ) ) ) );
    2057                                         makeVar( alignofName( ty ), layoutType->clone(), new SingleInit( new ConstantExpr( Constant::from( (unsigned long)1 ) ) ) );
     2059                                        makeVar( sizeofName( typeName ), layoutType, new SingleInit( new ConstantExpr( Constant::from( (unsigned long)1 ) ) ) );
     2060                                        makeVar( alignofName( typeName ), layoutType->clone(), new SingleInit( new ConstantExpr( Constant::from( (unsigned long)1 ) ) ) );
    20582061                                        // NOTE zero-length arrays are forbidden in C, so empty structs have no offsetof array
    20592062                                } else {
    2060                                         ObjectDecl *sizeVar = makeVar( sizeName, layoutType );
    2061                                         ObjectDecl *alignVar = makeVar( alignofName( ty ), layoutType->clone() );
    2062                                         ObjectDecl *offsetVar = makeVar( offsetofName( ty ), new ArrayType( Type::Qualifiers(), layoutType->clone(), new ConstantExpr( Constant::from( n_members ) ), false, false ) );
     2063                                        ObjectDecl *sizeVar = makeVar( sizeofName( typeName ), layoutType );
     2064                                        ObjectDecl *alignVar = makeVar( alignofName( typeName ), layoutType->clone() );
     2065                                        ObjectDecl *offsetVar = makeVar( offsetofName( typeName ), new ArrayType( Type::Qualifiers(), layoutType->clone(), new ConstantExpr( Constant::from( n_members ) ), false, false ) );
    20632066
    20642067                                        // generate call to layout function
    2065                                         UntypedExpr *layoutCall = new UntypedExpr( new NameExpr( "__layoutof_" + structTy->get_baseStruct()->get_name() ) );
     2068                                        UntypedExpr *layoutCall = new UntypedExpr( new NameExpr( layoutofName( structTy->get_baseStruct() ) ) );
    20662069                                        layoutCall->get_args().push_back( new AddressExpr( new VariableExpr( sizeVar ) ) );
    20672070                                        layoutCall->get_args().push_back( new AddressExpr( new VariableExpr( alignVar ) ) );
     
    20752078                        } else if ( UnionInstType *unionTy = dynamic_cast< UnionInstType* >( ty ) ) {
    20762079                                // check if this type already has a layout generated for it
    2077                                 std::string sizeName = sizeofName( ty );
    2078                                 if ( knownLayouts.find( sizeName ) != knownLayouts.end() ) return true;
     2080                                std::string typeName = mangleType( ty );
     2081                                if ( knownLayouts.find( typeName ) != knownLayouts.end() ) return true;
    20792082
    20802083                                // check if any of the type parameters have dynamic layout; if none do, this type is (or will be) monomorphized
     
    20832086
    20842087                                // insert local variables for layout and generate call to layout function
    2085                                 knownLayouts.insert( sizeName );  // done early so as not to interfere with the later addition of parameters to the layout call
     2088                                knownLayouts.insert( typeName );  // done early so as not to interfere with the later addition of parameters to the layout call
    20862089                                Type *layoutType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
    20872090
    2088                                 ObjectDecl *sizeVar = makeVar( sizeName, layoutType );
    2089                                 ObjectDecl *alignVar = makeVar( alignofName( ty ), layoutType->clone() );
     2091                                ObjectDecl *sizeVar = makeVar( sizeofName( typeName ), layoutType );
     2092                                ObjectDecl *alignVar = makeVar( alignofName( typeName ), layoutType->clone() );
    20902093
    20912094                                // generate call to layout function
    2092                                 UntypedExpr *layoutCall = new UntypedExpr( new NameExpr( "__layoutof_" + unionTy->get_baseUnion()->get_name() ) );
     2095                                UntypedExpr *layoutCall = new UntypedExpr( new NameExpr( layoutofName( unionTy->get_baseUnion() ) ) );
    20932096                                layoutCall->get_args().push_back( new AddressExpr( new VariableExpr( sizeVar ) ) );
    20942097                                layoutCall->get_args().push_back( new AddressExpr( new VariableExpr( alignVar ) ) );
     
    21062109                        Type *ty = sizeofExpr->get_type();
    21072110                        if ( findGeneric( ty ) ) {
    2108                                 Expression *ret = new NameExpr( sizeofName( ty ) );
     2111                                Expression *ret = new NameExpr( sizeofName( mangleType( ty ) ) );
    21092112                                delete sizeofExpr;
    21102113                                return ret;
     
    21162119                        Type *ty = alignofExpr->get_type();
    21172120                        if ( findGeneric( ty ) ) {
    2118                                 Expression *ret = new NameExpr( alignofName( ty ) );
     2121                                Expression *ret = new NameExpr( alignofName( mangleType( ty ) ) );
    21192122                                delete alignofExpr;
    21202123                                return ret;
     
    21542157                        if ( findGeneric( ty ) ) {
    21552158                                // pull offset back from generated type information
    2156                                 ret = new NameExpr( offsetofName( ty ) );
     2159                                ret = new NameExpr( offsetofName( mangleType( ty ) ) );
    21572160                        } else {
    2158                                 std::string offsetName = offsetofName( ty );
     2161                                std::string offsetName = offsetofName( mangleType( ty ) );
    21592162                                if ( knownOffsets.find( offsetName ) != knownOffsets.end() ) {
    21602163                                        // use the already-generated offsets for this type
     
    21962199                void PolyGenericCalculator::doEndScope() {
    21972200                        knownLayouts.endScope();
    2198                         knownOffsets.beginScope();
     2201                        knownOffsets.endScope();
    21992202                }
    22002203
  • src/GenPoly/GenPoly.cc

    r224e52f radc6781  
    1616#include "GenPoly.h"
    1717
    18 #include "SymTab/Mangler.h"
    1918#include "SynTree/Expression.h"
    2019#include "SynTree/Type.h"
     
    218217        }
    219218
    220         std::string sizeofName( Type *ty ) {
    221                 return std::string( "_sizeof_" ) + SymTab::Mangler::mangleType( ty );
    222         }
    223 
    224         std::string alignofName( Type *ty ) {
    225                 return std::string( "_alignof_" ) + SymTab::Mangler::mangleType( ty );
    226         }
    227 
    228         std::string offsetofName( Type* ty ) {
    229                 return std::string( "_offsetof_" ) + SymTab::Mangler::mangleType( ty );
    230         }
    231 
    232219} // namespace GenPoly
    233220
  • src/GenPoly/GenPoly.h

    r224e52f radc6781  
    2121#include <iostream>
    2222#include <utility>
     23
     24#include "SymTab/Mangler.h"
    2325
    2426#include "SynTree/Declaration.h"
     
    6971        void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap );
    7072
    71         /// Gets the name of the sizeof parameter for the type
    72         std::string sizeofName( Type *ty );
     73        /// Gets the mangled name of this type; alias for SymTab::Mangler::mangleType().
     74        inline std::string mangleType( Type *ty ) { return SymTab::Mangler::mangleType( ty ); }
     75       
     76        /// Gets the name of the sizeof parameter for the type, given its mangled name
     77        inline std::string sizeofName( const std::string &name ) { return std::string( "_sizeof_" ) + name; }
    7378
    74         /// Gets the name of the alignof parameter for the type
    75         std::string alignofName( Type *ty );
     79        /// Gets the name of the alignof parameter for the type, given its mangled name
     80        inline std::string alignofName( const std::string &name ) { return std::string( "_alignof_" ) + name; }
    7681
    77         /// Gets the name of the offsetof parameter for the type
    78         std::string offsetofName( Type *ty );
     82        /// Gets the name of the offsetof parameter for the type, given its mangled name
     83        inline std::string offsetofName( const std::string &name ) { return std::string( "_offsetof_" ) + name; }
     84
     85        /// Gets the name of the layout function for a given aggregate type, given its declaration
     86        inline std::string layoutofName( AggregateDecl *decl ) { return std::string( "_layoutof_" ) + decl->get_name(); }
     87       
    7988} // namespace GenPoly
    8089
  • src/GenPoly/ScrubTyVars.cc

    r224e52f radc6781  
    6464                // sizeof( T ) => _sizeof_T parameter, which is the size of T
    6565                if ( Type *polyType = isPolyType( szeof->get_type() ) ) {
    66                         Expression *expr = new NameExpr( sizeofName( polyType ) );
     66                        Expression *expr = new NameExpr( sizeofName( mangleType( polyType ) ) );
    6767                        return expr;
    6868                } else {
     
    7474                // alignof( T ) => _alignof_T parameter, which is the alignment of T
    7575                if ( Type *polyType = isPolyType( algnof->get_type() ) ) {
    76                         Expression *expr = new NameExpr( alignofName( polyType ) );
     76                        Expression *expr = new NameExpr( alignofName( mangleType( polyType ) ) );
    7777                        return expr;
    7878                } else {
Note: See TracChangeset for help on using the changeset viewer.