compiler/resolution/wrappers.cpp
// Returns a CallExpr which contains the call to the original function
// as the last statement. Assumes that addDefaultTokensAndReorder etc will
// eventually be called for this call. It will have the wrong
// formal-actual alignment until that happens.
Returns a CallExpr which contains the call to the original function
as the last statement. Assumes that addDefaultTokensAndReorder etc will
eventually be called for this call. It will have the wrong
formal-actual alignment until that happens.
Returns a CallExpr which contains the call to the original function as the last statement . Assumes that addDefaultTokensAndReorder etc will eventually be called for this call . It will have the wrong formal - actual alignment until that happens .
static CallExpr* createPromotedCallForWrapper(PromotionInfo& promotion) {
  FnSymbol* fn = promotion.fn;
  CallExpr* retval     = new CallExpr(fn);
  Vec<Symbol*> actuals;
  std::vector<ArgSymbol*> actualIdxToFormal;
  int i = 0;
  for_formals(formal, fn) {
    SET_LINENO(formal);
    Expr* actual = NULL;
    if (promotion.promotedType[i] != NULL) {
      const char* name = astr("p_i_", istr(i+1));
      actual = new UnresolvedSymExpr(name);
    } else if (promotion.defaulted[i] == false) {
      ArgSymbol* newFormal = promotion.wrapperFormals[i];
      actual = new SymExpr(newFormal);
    }
    if (actual != NULL) {
      retval->insertAtTail(actual);
      actualIdxToFormal.push_back(formal);
    }
    i++;
  }
  return retval;
}
static CallExpr * createPromotedCallForWrapper ( PromotionInfo & promotion ) { FnSymbol * fn = promotion . fn ; CallExpr * retval = new CallExpr ( fn ) ; Vec < Symbol * > actuals ; std :: vector < ArgSymbol * > actualIdxToFormal ; int i = 0 ; for_formals ( formal , fn ) { SET_LINENO ( formal ) ; Expr * actual = NULL ; if ( promotion . promotedType [ i ] != NULL ) { const char * name = astr ( " " , istr ( i + 1 ) ) ; actual = new UnresolvedSymExpr ( name ) ; } else if ( promotion . defaulted [ i ] == false ) { ArgSymbol * newFormal = promotion . wrapperFormals [ i ] ; actual = new SymExpr ( newFormal ) ; } if ( actual != NULL ) { retval -> insertAtTail ( actual ) ; actualIdxToFormal . push_back ( formal ) ; } i ++ ; } return retval ; }
Returns a CallExpr which contains the call to the original function
as the last statement.
Returns a CallExpr which contains the call to the original function as the last statement .
// When adding the call to the original function within a // promotion wrapper, we need to pass non-promoted arguments // to the original function through. But some of the arguments // might not need to be passed if we're using their default value. // a promoted argument