[llvm] [TableGen] Support automatic type deduction (PR #109434)

Francesco Petrogalli via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 16:09:17 PDT 2024


fpetrogalli wrote:

> Especially for code like:
> 
> ```
> class Intrinsic<list<LLVMType> ret_types,
>                 list<LLVMType> param_types = [],
>                 list<IntrinsicProperty> intr_properties = [],
>                 string name = "",
>                 list<SDNodeProperty> sd_properties = [],
>                 bit disable_default_attributes = true> : SDPatternOperator {
>   string LLVMName = name;
>   string TargetPrefix = "";   // Set to a prefix for target-specific intrinsics.
>   list<LLVMType> RetTypes = ret_types;
>   list<LLVMType> ParamTypes = param_types;
> ```
> 
> where param_type and ret_types have their type declared, so we can avoid repeating it again in `RetTypes` and `ParamTypes`.

When someone adds more fields before `string LLVMName`, the fields with `auto` will move further away and it will not as easy as before to know the types from the context.

https://github.com/llvm/llvm-project/pull/109434


More information about the llvm-commits mailing list