Changeset aedfd91
- Timestamp:
- Jul 25, 2016, 4:20:17 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 29e8bf5
- Parents:
- 72e9222
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Specialize.cc
r72e9222 raedfd91 31 31 #include "Common/UniqueName.h" 32 32 #include "Common/utility.h" 33 #include "InitTweak/InitTweak.h" 33 34 34 35 namespace GenPoly { … … 184 185 mutateAll( appExpr->get_args(), *this ); 185 186 186 // create thunks for the inferred parameters 187 for ( InferredParams::iterator inferParam = appExpr->get_inferParams().begin(); inferParam != appExpr->get_inferParams().end(); ++inferParam ) { 188 inferParam->second.expr = doSpecialization( inferParam->second.formalType, inferParam->second.expr, &appExpr->get_inferParams() ); 189 } 190 191 handleExplicitParams( appExpr ); 187 if ( ! InitTweak::isIntrinsicCallExpr( appExpr ) ) { 188 // create thunks for the inferred parameters 189 // don't need to do this for intrinsic calls, because they aren't actually passed 190 for ( InferredParams::iterator inferParam = appExpr->get_inferParams().begin(); inferParam != appExpr->get_inferParams().end(); ++inferParam ) { 191 inferParam->second.expr = doSpecialization( inferParam->second.formalType, inferParam->second.expr, &appExpr->get_inferParams() ); 192 } 193 194 handleExplicitParams( appExpr ); 195 } 192 196 193 197 return appExpr; -
src/InitTweak/InitTweak.cc
r72e9222 raedfd91 85 85 } 86 86 } 87 namespace { 88 VariableExpr * getCalledFunction( ApplicationExpr * appExpr ) { 89 assert( appExpr ); 90 return dynamic_cast< VariableExpr * >( appExpr->get_function() ); 91 } 92 } 93 94 ApplicationExpr * isIntrinsicCallExpr( Expression * expr ) { 95 ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr ); 96 if ( ! appExpr ) return NULL; 97 VariableExpr * function = getCalledFunction( appExpr ); 98 assert( function ); 99 // check for Intrinsic only - don't want to remove all overridable ctor/dtors because autogenerated ctor/dtor 100 // will call all member dtors, and some members may have a user defined dtor. 101 return function->get_var()->get_linkage() == LinkageSpec::Intrinsic ? appExpr : NULL; 102 } 87 103 88 104 bool isInstrinsicSingleArgCallStmt( Statement * stmt ) { 89 105 Expression * callExpr = getCtorDtorCall( stmt ); 90 106 if ( ! callExpr ) return false; 91 ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( callExpr ); 92 assert( appExpr ); 93 VariableExpr * function = dynamic_cast< VariableExpr * >( appExpr->get_function() ); 94 assert( function ); 95 // check for Intrinsic only - don't want to remove all overridable ctor/dtors because autogenerated ctor/dtor 96 // will call all member dtors, and some members may have a user defined dtor. 97 FunctionType * funcType = GenPoly::getFunctionType( function->get_var()->get_type() ); 98 assert( funcType ); 99 return function->get_var()->get_linkage() == LinkageSpec::Intrinsic && funcType->get_parameters().size() == 1; 107 if ( ApplicationExpr * appExpr = isIntrinsicCallExpr( callExpr ) ) { 108 assert( ! appExpr->get_function()->get_results().empty() ); 109 FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_results().front() ); 110 assert( funcType ); 111 return funcType->get_parameters().size() == 1; 112 } 113 return false; 100 114 } 101 115 -
src/InitTweak/InitTweak.h
r72e9222 raedfd91 35 35 bool isDesignated( Initializer * init ); 36 36 37 /// Non-Null if expr is a call expression whose target function is intrinsic 38 ApplicationExpr * isIntrinsicCallExpr( Expression * expr ); 39 37 40 /// True if stmt is a call statement where the function called is intrinsic and takes one parameter. 38 41 /// Intended to be used for default ctor/dtor calls, but might have use elsewhere.
Note: See TracChangeset
for help on using the changeset viewer.