コード例 #1
0
ファイル: abi-x86-64.cpp プロジェクト: Philpax/ldc
bool X86_64TargetABI::returnInArg(TypeFunction* tf) {
    if (tf->isref)
        return false;

    Type* rt = tf->next;
    return passByVal(rt);
}
コード例 #2
0
ファイル: abi-aarch64.cpp プロジェクト: wilzbach/ldc
  bool returnInArg(TypeFunction *tf, bool) override {
    if (tf->isref) {
      return false;
    }

    Type *rt = tf->next->toBasetype();

    if (!isPOD(rt))
      return true;

    return passByVal(tf, rt);
  }
コード例 #3
0
ファイル: abi-aarch64.cpp プロジェクト: Pursche/ldc-PS4
  void rewriteFunctionType(TypeFunction *tf, IrFuncTy &fty) override {
    Type *retTy = fty.ret->type->toBasetype();
    if (!fty.ret->byref && retTy->ty == Tstruct) {
      // Rewrite HFAs only because union HFAs are turned into IR types that are
      // non-HFA and messes up register selection
      if (isHFA((TypeStruct *)retTy, &fty.ret->ltype)) {
        fty.ret->rewrite = &hfaToArray;
        fty.ret->ltype = hfaToArray.type(fty.ret->type);
      }
      else {
        fty.ret->rewrite = &integerRewrite;
        fty.ret->ltype = integerRewrite.type(fty.ret->type);
      }
    }

    for (auto arg : fty.args) {
      if (!arg->byref)
        rewriteArgument(fty, *arg);
      else if (passByVal(arg->type))
        arg->attrs.remove(LLAttribute::ByVal);
    }
  }