diff options
| author | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-02-23 10:46:07 +0000 |
|---|---|---|
| committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2018-02-23 10:46:07 +0000 |
| commit | 0243aaf42c6c766ea64868b67357dc761ea95b99 (patch) | |
| tree | 9e3d8f974fdbfe91f1b1d28d30fb3423ec7b6aa1 /llvm/docs/TableGen | |
| parent | 6cf306decae7704640f7d62d617979a88cd46e37 (diff) | |
| download | bcm5719-llvm-0243aaf42c6c766ea64868b67357dc761ea95b99.tar.gz bcm5719-llvm-0243aaf42c6c766ea64868b67357dc761ea95b99.zip | |
TableGen: Add !size operation
Summary:
Returns the size of a list. I have found this to be rather useful in some
development for the AMDGPU backend where we could simplify our .td files
by concatenating list<LLVMType> for complex intrinsics. Doing so requires
us to compute the position argument for LLVMMatchType.
Basically, the usage is in a pattern that looks somewhat like this:
list<LLVMType> argtypes =
!listconcat(base,
[llvm_any_ty, LLVMMatchType<!size(base)>]);
Change-Id: I360a0b000fd488d18bea412228230fd93722bd2c
Reviewers: arsenm, craig.topper, tra, MartinO
Subscribers: wdng, llvm-commits, tpr
Differential Revision: https://reviews.llvm.org/D43553
llvm-svn: 325883
Diffstat (limited to 'llvm/docs/TableGen')
| -rw-r--r-- | llvm/docs/TableGen/LangIntro.rst | 3 | ||||
| -rw-r--r-- | llvm/docs/TableGen/LangRef.rst | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/llvm/docs/TableGen/LangIntro.rst b/llvm/docs/TableGen/LangIntro.rst index 460ff9067f2..534597b041b 100644 --- a/llvm/docs/TableGen/LangIntro.rst +++ b/llvm/docs/TableGen/LangIntro.rst @@ -205,6 +205,9 @@ supported include: ``!empty(a)`` An integer {0,1} indicating whether list 'a' is empty. +``!size(a)`` + An integer indicating the number of elements in list 'a'. + ``!if(a,b,c)`` 'b' if the result of 'int' or 'bit' operator 'a' is nonzero, 'c' otherwise. diff --git a/llvm/docs/TableGen/LangRef.rst b/llvm/docs/TableGen/LangRef.rst index 285572fa481..5f7917a5b4b 100644 --- a/llvm/docs/TableGen/LangRef.rst +++ b/llvm/docs/TableGen/LangRef.rst @@ -98,7 +98,7 @@ wide variety of meanings: :!eq !if !head !tail !con :!add !shl !sra !srl !and :!or !empty !subst !foreach !strconcat - :!cast !listconcat + :!cast !listconcat !size Syntax |

