Changeset ffad73a for src


Ignore:
Timestamp:
Dec 15, 2015, 4:57:31 PM (9 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:
5f6c42c
Parents:
78dd0da
Message:

Refactored isPolyType and friends to account for polymorphic generic types

Location:
src/GenPoly
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r78dd0da rffad73a  
    155155                        // with the same mangled name, so we need to further mangle the names.
    156156                        for ( std::list< DeclarationWithType *>::iterator retval = function->get_returnVals().begin(); retval != function->get_returnVals().end(); ++retval ) {
    157                                 if ( isPolyVal( (*retval)->get_type(), tyVars ) ) {
     157                                if ( isPolyType( (*retval)->get_type(), tyVars ) ) {
    158158                                        name << "P";
    159159                                } else {
     
    164164                        std::list< DeclarationWithType *> &paramList = function->get_parameters();
    165165                        for ( std::list< DeclarationWithType *>::iterator arg = paramList.begin(); arg != paramList.end(); ++arg ) {
    166                                 if ( isPolyVal( (*arg)->get_type(), tyVars ) ) {
     166                                if ( isPolyType( (*arg)->get_type(), tyVars ) ) {
    167167                                        name << "P";
    168168                                } else {
     
    326326                }
    327327
    328                 TypeInstType *isPolyType( Type *type, const TypeSubstitution *env, const TyVarMap &tyVars ) {
    329                         if ( TypeInstType *typeInst = dynamic_cast< TypeInstType *>( type ) ) {
    330                                 if ( env ) {
    331                                         if ( Type *newType = env->lookup( typeInst->get_name() ) ) {
    332                                                 return isPolyType( newType, env, tyVars );
    333                                         } // if
    334                                 } // if
    335                                 if ( tyVars.find( typeInst->get_name() ) != tyVars.end() ) {
    336                                         return typeInst;
    337                                 } else {
    338                                         return 0;
    339                                 } // if
    340                         } else {
    341                                 return 0;
    342                         } // if
    343                 }
    344 
    345328                Expression *Pass1::addRetParam( ApplicationExpr *appExpr, FunctionType *function, Type *retType, std::list< Expression *>::iterator &arg ) {
    346329                        if ( useRetval ) {
     
    351334                                ObjectDecl *newObj = makeTemporary( retType->clone() );
    352335                                Expression *paramExpr = new VariableExpr( newObj );
    353                                 if ( ! isPolyType( newObj->get_type(), env, scopeTyVars ) ) {
     336                                if ( ! isPolyType( newObj->get_type(), scopeTyVars, env ) ) {
    354337                                        paramExpr = new AddressExpr( paramExpr );
    355338                                } // if
     
    377360                Expression *Pass1::applyAdapter( ApplicationExpr *appExpr, FunctionType *function, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ) {
    378361                        Expression *ret = appExpr;
    379                         if ( ! function->get_returnVals().empty() && isPolyVal( function->get_returnVals().front()->get_type(), tyVars ) ) {
     362                        if ( ! function->get_returnVals().empty() && isPolyType( function->get_returnVals().front()->get_type(), tyVars ) ) {
    380363                                ret = addRetParam( appExpr, function, function->get_returnVals().front()->get_type(), arg );
    381364                        } // if
     
    391374                void Pass1::boxParam( Type *param, Expression *&arg, const TyVarMap &exprTyVars ) {
    392375                        assert( ! arg->get_results().empty() );
    393 ///   if ( ! dynamic_cast< PointerType *>( arg->get_results().front() ) ) {
     376//   if ( ! dynamic_cast< PointerType *>( arg->get_results().front() ) ) {
    394377                        TypeInstType *typeInst = dynamic_cast< TypeInstType *>( param );
    395378                        if ( typeInst && exprTyVars.find( typeInst->get_name() ) != exprTyVars.end() ) {
     
    411394                                } // if
    412395                        } // if
    413 ///   }
     396//   }
    414397                }
    415398
     
    469452                        // actually make the adapter type
    470453                        FunctionType *adapter = adaptee->clone();
    471                         if ( ! adapter->get_returnVals().empty() && isPolyVal( adapter->get_returnVals().front()->get_type(), tyVars ) ) {
     454                        if ( ! adapter->get_returnVals().empty() && isPolyType( adapter->get_returnVals().front()->get_type(), tyVars ) ) {
    472455                                makeRetParm( adapter );
    473456                        } // if
     
    479462                        assert( param );
    480463                        assert( arg );
    481 ///   std::cout << "arg type is ";
    482 ///   arg->get_type()->print( std::cout );
    483 ///   std::cout << "param type is ";
    484 ///   param->get_type()->print( std::cout );
    485 ///   std::cout << " tyVars are: ";
    486 ///   printTyVarMap( std::cout, tyVars );
    487                         if ( isPolyVal( realParam->get_type(), tyVars ) ) {
    488 ///     if ( dynamic_cast< PointerType *>( arg->get_type() ) ) {
    489 ///       return new CastExpr( new VariableExpr( param ), arg->get_type()->clone() );
    490 ///     } else {
     464                        if ( isPolyType( realParam->get_type(), tyVars ) ) {
     465//     if ( dynamic_cast< PointerType *>( arg->get_type() ) ) {
     466//       return new CastExpr( new VariableExpr( param ), arg->get_type()->clone() );
     467//     } else {
    491468                                if ( dynamic_cast<TypeInstType *>(arg->get_type()) == NULL ) {
    492469                                        UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
     
    495472                                        return deref;
    496473                                } // if
    497 ///     }
     474//     }
    498475                        } // if
    499476                        return new VariableExpr( param );
     
    542519                                addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
    543520                                bodyStmt = new ExprStmt( noLabels, adapteeApp );
    544                         } else if ( isPolyVal( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
     521                        } else if ( isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
    545522                                if ( (*param)->get_name() == "" ) {
    546523                                        (*param)->set_name( "_ret" );
     
    614591                } // passAdapters
    615592
    616                 TypeInstType *isPolyPtr( Type *type, const TypeSubstitution *env, const TyVarMap &tyVars ) {
    617                         if ( PointerType *ptr = dynamic_cast< PointerType *>( type ) ) {
    618                                 return isPolyType( ptr->get_base(), env, tyVars );
    619                         } else if ( env ) {
    620                                 if ( TypeInstType *typeInst = dynamic_cast< TypeInstType *>( type ) ) {
    621                                         if ( Type *newType = env->lookup( typeInst->get_name() ) ) {
    622                                                 return isPolyPtr( newType, env, tyVars );
    623                                         } // if
    624                                 } // if
    625                         } // if
    626                         return 0;
    627                 }
    628 
    629                 TypeInstType *isPolyPtrPtr( Type *type, const TypeSubstitution *env, const TyVarMap &tyVars ) {
    630                         if ( PointerType *ptr = dynamic_cast< PointerType *>( type ) ) {
    631                                 return isPolyPtr( ptr->get_base(), env, tyVars );
    632                         } else if ( env ) {
    633                                 if ( TypeInstType *typeInst = dynamic_cast< TypeInstType *>( type ) ) {
    634                                         if ( Type *newType = env->lookup( typeInst->get_name() ) ) {
    635                                                 return isPolyPtrPtr( newType, env, tyVars );
    636                                         } // if
    637                                 } // if
    638                         } // if
    639                         return 0;
    640                 }
    641 
    642593                Expression *makeIncrDecrExpr( ApplicationExpr *appExpr, Type *polyType, bool isIncr ) {
    643594                        NameExpr *opExpr;
     
    670621                                                assert( ! appExpr->get_results().empty() );
    671622                                                assert( appExpr->get_args().size() == 2 );
    672                                                 TypeInstType *typeInst1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), env, scopeTyVars );
    673                                                 TypeInstType *typeInst2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), env, scopeTyVars );
    674                                                 assert( ! typeInst1 || ! typeInst2 );
     623                                                Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), scopeTyVars, env );
     624                                                Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), scopeTyVars, env );
     625                                                assert( ! baseType1 || ! baseType2 );
    675626                                                UntypedExpr *ret = 0;
    676                                                 if ( typeInst1 || typeInst2 ) {
     627                                                if ( baseType1 || baseType2 ) {
    677628                                                        ret = new UntypedExpr( new NameExpr( "?+?" ) );
    678629                                                } // if
    679                                                 if ( typeInst1 ) {
     630                                                if ( baseType1 ) {
    680631                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
    681632                                                        multiply->get_args().push_back( appExpr->get_args().back() );
    682                                                         multiply->get_args().push_back( new NameExpr( sizeofName( typeInst1 ) ) );
     633                                                        multiply->get_args().push_back( new NameExpr( sizeofName( baseType1 ) ) );
    683634                                                        ret->get_args().push_back( appExpr->get_args().front() );
    684635                                                        ret->get_args().push_back( multiply );
    685                                                 } else if ( typeInst2 ) {
     636                                                } else if ( baseType2 ) {
    686637                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
    687638                                                        multiply->get_args().push_back( appExpr->get_args().front() );
    688                                                         multiply->get_args().push_back( new NameExpr( sizeofName( typeInst2 ) ) );
     639                                                        multiply->get_args().push_back( new NameExpr( sizeofName( baseType2 ) ) );
    689640                                                        ret->get_args().push_back( multiply );
    690641                                                        ret->get_args().push_back( appExpr->get_args().back() );
    691642                                                } // if
    692                                                 if ( typeInst1 || typeInst2 ) {
     643                                                if ( baseType1 || baseType2 ) {
    693644                                                        ret->get_results().push_front( appExpr->get_results().front()->clone() );
    694645                                                        if ( appExpr->get_env() ) {
     
    703654                                                assert( ! appExpr->get_results().empty() );
    704655                                                assert( ! appExpr->get_args().empty() );
    705                                                 if ( isPolyType( appExpr->get_results().front(), env, scopeTyVars ) ) {
     656                                                if ( isPolyType( appExpr->get_results().front(), scopeTyVars, env ) ) {
    706657                                                        Expression *ret = appExpr->get_args().front();
    707658                                                        delete ret->get_results().front();
     
    718669                                                assert( ! appExpr->get_results().empty() );
    719670                                                assert( appExpr->get_args().size() == 1 );
    720                                                 if ( TypeInstType *typeInst = isPolyPtr( appExpr->get_results().front(), env, scopeTyVars ) ) {
     671                                                if ( Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ) ) {
    721672                                                        Type *tempType = appExpr->get_results().front()->clone();
    722673                                                        if ( env ) {
     
    732683                                                                assignExpr->get_args().push_back( appExpr->get_args().front()->clone() );
    733684                                                        } // if
    734                                                         CommaExpr *firstComma = new CommaExpr( assignExpr, makeIncrDecrExpr( appExpr, typeInst, varExpr->get_var()->get_name() == "?++" ) );
     685                                                        CommaExpr *firstComma = new CommaExpr( assignExpr, makeIncrDecrExpr( appExpr, baseType, varExpr->get_var()->get_name() == "?++" ) );
    735686                                                        return new CommaExpr( firstComma, tempExpr );
    736687                                                } // if
     
    738689                                                assert( ! appExpr->get_results().empty() );
    739690                                                assert( appExpr->get_args().size() == 1 );
    740                                                 if ( TypeInstType *typeInst = isPolyPtr( appExpr->get_results().front(), env, scopeTyVars ) ) {
    741                                                         return makeIncrDecrExpr( appExpr, typeInst, varExpr->get_var()->get_name() == "++?" );
     691                                                if ( Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ) ) {
     692                                                        return makeIncrDecrExpr( appExpr, baseType, varExpr->get_var()->get_name() == "++?" );
    742693                                                } // if
    743694                                        } else if ( varExpr->get_var()->get_name() == "?+?" || varExpr->get_var()->get_name() == "?-?" ) {
    744695                                                assert( ! appExpr->get_results().empty() );
    745696                                                assert( appExpr->get_args().size() == 2 );
    746                                                 TypeInstType *typeInst1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), env, scopeTyVars );
    747                                                 TypeInstType *typeInst2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), env, scopeTyVars );
    748                                                 if ( typeInst1 && typeInst2 ) {
     697                                                Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), scopeTyVars, env );
     698                                                Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), scopeTyVars, env );
     699                                                if ( baseType1 && baseType2 ) {
    749700                                                        UntypedExpr *divide = new UntypedExpr( new NameExpr( "?/?" ) );
    750701                                                        divide->get_args().push_back( appExpr );
    751                                                         divide->get_args().push_back( new NameExpr( sizeofName( typeInst1 ) ) );
     702                                                        divide->get_args().push_back( new NameExpr( sizeofName( baseType1 ) ) );
    752703                                                        divide->get_results().push_front( appExpr->get_results().front()->clone() );
    753704                                                        if ( appExpr->get_env() ) {
     
    756707                                                        } // if
    757708                                                        return divide;
    758                                                 } else if ( typeInst1 ) {
     709                                                } else if ( baseType1 ) {
    759710                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
    760711                                                        multiply->get_args().push_back( appExpr->get_args().back() );
    761                                                         multiply->get_args().push_back( new NameExpr( sizeofName( typeInst1 ) ) );
     712                                                        multiply->get_args().push_back( new NameExpr( sizeofName( baseType1 ) ) );
    762713                                                        appExpr->get_args().back() = multiply;
    763                                                 } else if ( typeInst2 ) {
     714                                                } else if ( baseType2 ) {
    764715                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
    765716                                                        multiply->get_args().push_back( appExpr->get_args().front() );
    766                                                         multiply->get_args().push_back( new NameExpr( sizeofName( typeInst2 ) ) );
     717                                                        multiply->get_args().push_back( new NameExpr( sizeofName( baseType2 ) ) );
    767718                                                        appExpr->get_args().front() = multiply;
    768719                                                } // if
     
    770721                                                assert( ! appExpr->get_results().empty() );
    771722                                                assert( appExpr->get_args().size() == 2 );
    772                                                 TypeInstType *typeInst = isPolyPtr( appExpr->get_results().front(), env, scopeTyVars );
    773                                                 if ( typeInst ) {
     723                                                Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env );
     724                                                if ( baseType ) {
    774725                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
    775726                                                        multiply->get_args().push_back( appExpr->get_args().back() );
    776                                                         multiply->get_args().push_back( new NameExpr( sizeofName( typeInst ) ) );
     727                                                        multiply->get_args().push_back( new NameExpr( sizeofName( baseType ) ) );
    777728                                                        appExpr->get_args().back() = multiply;
    778729                                                } // if
     
    841792
    842793                Expression *Pass1::mutate( UntypedExpr *expr ) {
    843                         if ( ! expr->get_results().empty() && isPolyType( expr->get_results().front(), env, scopeTyVars ) ) {
     794                        if ( ! expr->get_results().empty() && isPolyType( expr->get_results().front(), scopeTyVars, env ) ) {
    844795                                if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
    845796                                        if ( name->get_name() == "*?" ) {
     
    857808                        assert( ! addrExpr->get_arg()->get_results().empty() );
    858809                        addrExpr->set_arg( mutateExpression( addrExpr->get_arg() ) );
    859                         if ( isPolyType( addrExpr->get_arg()->get_results().front(), env, scopeTyVars ) ) {
     810                        if ( isPolyType( addrExpr->get_arg()->get_results().front(), scopeTyVars, env ) ) {
    860811                                Expression *ret = addrExpr->get_arg();
    861812                                delete ret->get_results().front();
     
    11041055                Statement *Pass3::mutate( DeclStmt *declStmt ) {
    11051056                        if ( ObjectDecl *objectDecl = dynamic_cast< ObjectDecl *>( declStmt->get_decl() ) ) {
    1106                                 if ( isPolyVal( objectDecl->get_type(), scopeTyVars ) ) {
     1057                                if ( isPolyType( objectDecl->get_type(), scopeTyVars ) ) {
    11071058                                        // change initialization of a polymorphic value object
    11081059                                        // to allocate storage with alloca
    1109                                         TypeInstType *typeInst = dynamic_cast< TypeInstType *>( objectDecl->get_type() );
    1110                                         assert( typeInst );
     1060                                        Type *declType = objectDecl->get_type();
    11111061                                        UntypedExpr *alloc = new UntypedExpr( new NameExpr( "__builtin_alloca" ) );
    1112                                         alloc->get_args().push_back( new NameExpr( sizeofName( typeInst ) ) );
     1062                                        alloc->get_args().push_back( new NameExpr( sizeofName( declType ) ) );
    11131063
    11141064                                        delete objectDecl->get_init();
  • src/GenPoly/GenPoly.cc

    r78dd0da rffad73a  
    1515
    1616#include "GenPoly.h"
     17
     18#include "SymTab/Mangler.h"
     19#include "SynTree/Expression.h"
    1720#include "SynTree/Type.h"
    1821
     
    2124
    2225namespace GenPoly {
    23         /// A function needs an adapter if it returns a polymorphic value or if any of its
    24         /// parameters have polymorphic type
    2526        bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVars ) {
    26                 if ( ! adaptee->get_returnVals().empty() && isPolyVal( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
     27                if ( ! adaptee->get_returnVals().empty() && isPolyType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
    2728                        return true;
    2829                } // if
    2930                for ( std::list< DeclarationWithType* >::const_iterator innerArg = adaptee->get_parameters().begin(); innerArg != adaptee->get_parameters().end(); ++innerArg ) {
    30                         if ( isPolyVal( (*innerArg)->get_type(), tyVars ) ) {
     31                        if ( isPolyType( (*innerArg)->get_type(), tyVars ) ) {
    3132                                return true;
    3233                        } // if
     
    6667        }
    6768
    68         bool isPolyVal( Type *type, const TyVarMap &tyVars ) {
    69                 if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( type ) ) {
     69        namespace {
     70                /// Checks a parameter list for polymorphic parameters
     71                bool hasPolyParams( std::list< Expression* >& params, const TyVarMap &tyVars, const TypeSubstitution *env ) {
     72                        for ( std::list< Expression* >::iterator param = params.begin(); param != params.end(); ++param ) {
     73                                TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
     74                                assert(paramType && "Aggregate parameters should be type expressions");
     75                                if ( isPolyType( paramType->get_type(), tyVars, env ) ) return true;
     76                        }
     77                        return false;
     78                }
     79        }
     80       
     81        Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) {
     82                if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( type ) ) {
     83                        if ( env ) {
     84                                if ( Type *newType = env->lookup( typeInst->get_name() ) ) {
     85                                        return isPolyType( newType, tyVars, env );
     86                                } // if
     87                        } // if
    7088                        if ( tyVars.find( typeInst->get_name() ) != tyVars.end() ) {
    71                                 return true;
     89                                return type;
     90                        }
     91                } else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) {
     92                        if ( hasPolyParams( structType->get_parameters(), tyVars, env ) ) return type;
     93                } else if ( UnionInstType *unionType = dynamic_cast< UnionInstType* >( type ) ) {
     94                        if ( hasPolyParams( unionType->get_parameters(), tyVars, env ) ) return type;
     95                }
     96                return 0;
     97        }
     98
     99        Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) {
     100                if ( PointerType *ptr = dynamic_cast< PointerType *>( type ) ) {
     101                        return isPolyType( ptr->get_base(), tyVars, env );
     102                } else if ( env ) {
     103                        if ( TypeInstType *typeInst = dynamic_cast< TypeInstType *>( type ) ) {
     104                                if ( Type *newType = env->lookup( typeInst->get_name() ) ) {
     105                                        return isPolyPtr( newType, tyVars, env );
     106                                } // if
    72107                        } // if
    73108                } // if
    74                 return false;
    75         }
    76 
    77         bool isPolyObj( Type *type, const TyVarMap &tyVars ) {
    78                 if ( isPolyVal( type, tyVars ) ) {
    79                         return true;
    80                 } else if ( PointerType *pt = dynamic_cast<PointerType*>( type ) ) {
    81                         return isPolyObj( pt->get_base(), tyVars );
    82                 } else {
    83                         return false;
    84                 }
     109                return 0;
    85110        }
    86111
     
    91116                os << std::endl;
    92117        }
     118
     119        std::string sizeofName( Type *ty ) {
     120                return std::string( "_sizeof_" ) + SymTab::Mangler::mangle( ty, false, false );
     121        }
     122
     123        std::string alignofName( Type *ty ) {
     124                return std::string( "_alignof_" ) + SymTab::Mangler::mangle( ty, false, false );
     125        }
    93126} // namespace GenPoly
    94127
  • src/GenPoly/GenPoly.h

    r78dd0da rffad73a  
    2020#include <string>
    2121#include <iostream>
     22
    2223#include "SynTree/Declaration.h"
     24#include "SynTree/TypeSubstitution.h"
    2325
    2426namespace GenPoly {
    2527        typedef std::map< std::string, TypeDecl::Kind > TyVarMap;
    2628
     29        /// A function needs an adapter if it returns a polymorphic value or if any of its
     30        /// parameters have polymorphic type
    2731        bool needsAdapter( FunctionType *adaptee, const TyVarMap &tyVarr );
     32
     33        /// true iff function has polymorphic return type
    2834        bool isPolyRet( FunctionType *function, std::string &name, const TyVarMap &otherTyVars );
    2935        bool isPolyRet( FunctionType *function, std::string &name );
    3036        bool isPolyRet( FunctionType *function, const TyVarMap &otherTyVars );
    31 //      bool isPolyFun( FunctionType *fun, const TyVarMap &tyVars );
    32         bool isPolyVal( Type *type, const TyVarMap &tyVars );
    3337
    34   // true if type variable or any number of pointers to type variable
    35   bool isPolyObj( Type *type, const TyVarMap &tyVars );
     38        /// returns polymorphic type if is polymorphic type, NULL otherwise; will look up substitution in env if provided
     39        Type *isPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
     40
     41        /// returns polymorphic type if is pointer to polymorphic type, NULL otherwise; will look up substitution in env if provided
     42        Type *isPolyPtr( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
     43
     44        /// Prints type variable map
    3645        void printTyVarMap( std::ostream &os, const TyVarMap &tyVarMap );
     46
     47        /// Gets the name of the sizeof parameter for the type
     48        std::string sizeofName( Type *ty );
     49
     50        /// Gets the name of the alignof parameter for the type
     51        std::string alignofName( Type *ty );
    3752} // namespace GenPoly
    3853
  • src/GenPoly/ScrubTyVars.cc

    r78dd0da rffad73a  
    1919#include "GenPoly.h"
    2020#include "ScrubTyVars.h"
    21 
    22 #include "SymTab/Mangler.h"
    2321
    2422#include "SynTree/Mutator.h"
     
    7876                return Mutator::mutate( pointer );
    7977        }
    80        
    81         std::string sizeofName( Type *ty ) {
    82                 return std::string( "_sizeof_" ) + SymTab::Mangler::mangle( ty, false, false );
    83         }
    84 
    85         std::string alignofName( Type *ty ) {
    86                 return std::string( "_alignof_" ) + SymTab::Mangler::mangle( ty, false, false );
    87         }
    8878} // namespace GenPoly
    8979
  • src/GenPoly/ScrubTyVars.h

    r78dd0da rffad73a  
    5959                return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) );
    6060        }
    61 
    62         /// Gets the name of the sizeof parameter for the type
    63         std::string sizeofName( Type *ty );
    64 
    65         /// Gets the name of the alignof parameter for the type
    66         std::string alignofName( Type *ty );
    6761} // namespace GenPoly
    6862
Note: See TracChangeset for help on using the changeset viewer.