[PATCH] D25204: Register Calling Convention, Clang changes

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 4 09:16:54 PDT 2016


ABataev added inline comments.


> Index.h:3029
>    CXCallingConv_PreserveAll = 15,
> +  CXCallingConv_X86RegCall = 16,
>  

Maybe it is better to use 8, as the previous comment allows it?

  /* Value 8 was PnaclCall, but it was never used, so it could safely be re-used. */

In this case you don't need to increase number of bits used for calling conventions

> ItaniumMangle.cpp:1236-1237
> +      bool isRegCall = (FD != nullptr) &&
> +        FD->getType()->castAs<FunctionProtoType>()->getCallConv() ==
> +          clang::CC_X86RegCall;
> +

What if function type is not a FunctionProtoType?

> MicrosoftMangle.cpp:435-436
> +  if (auto FD = dyn_cast<FunctionDecl>(D))
> +    if (FD->getType()->castAs<FunctionProtoType>()->getCallConv() ==
> +        clang::CC_X86RegCall)
> +      Out << "__regcall3__";

Again, what if type is not FunctionProtoType?

> TargetInfo.cpp:1546-1548
>            State.CC == llvm::CallingConv::X86_FastCall ||
> -              State.CC == llvm::CallingConv::X86_VectorCall,
> +              State.CC == llvm::CallingConv::X86_VectorCall || 
> +              State.CC == llvm::CallingConv::X86_RegCall,

Seems to me this code is clang-formatted

> TargetInfo.cpp:3301-3303
> +  if (RT->getDecl()->hasFlexibleArrayMember()) {
> +    return getIndirectReturnResult(Ty);
> +  }

No braces

> TargetInfo.cpp:3388-3392
> +    if (IsRegCall && it->type->isStructureType())
> +    {
> +      it->info = classifyRegCallStructType(it->type, neededInt, neededSSE);
> +    }
> +    else

Not clang-formatted and extra braces

> SemaDecl.cpp:8288
>          int DiagID =
> -            CC == CC_X86StdCall ? diag::warn_cconv_knr : diag::err_cconv_knr;
> +            (CC == CC_X86StdCall || CC == CC_X86RegCall) ? diag::warn_cconv_knr : diag::err_cconv_knr;
>          Diag(NewFD->getLocation(), DiagID)

Is this formatted?

> SemaDeclAttr.cpp:3833-3837
> +  case AttributeList::AT_RegCall:
> +    D->addAttr(::new (S.Context)
> +      RegCallAttr(Attr.getRange(), S.Context,
> +      Attr.getAttributeSpellingListIndex()));
> +    return;

Not formatted

https://reviews.llvm.org/D25204





More information about the cfe-commits mailing list