[Attributes] Determine attribute properties from TableGen data
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 11 Jul 2021 14:54:03 +0000 (16:54 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 12 Jul 2021 20:13:38 +0000 (22:13 +0200)
commit7ed3e87825b48747bc5e4fb6daa1f08b543c4ec9
tree2508dc24690e3dd176cfb44f9140174a588d0d17
parente5e291e13502cdce6eafcb971c8e8beb2754f244
[Attributes] Determine attribute properties from TableGen data

Continuing from D105763, this allows placing certain properties
about attributes in the TableGen definition. In particular, we
store whether an attribute applies to fn/param/ret (or a combination
thereof). This information is used by the Verifier, as well as the
ForceFunctionAttrs pass. I also plan to use this in LLParser,
which also duplicates info on which attributes are valid where.

This keeps metadata about attributes in one place, and makes it
more likely that it stays in sync, rather than in various
functions spread across the codebase.

Differential Revision: https://reviews.llvm.org/D105780
llvm/include/llvm/IR/Attributes.h
llvm/include/llvm/IR/Attributes.td
llvm/lib/IR/Attributes.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp
llvm/unittests/IR/VerifierTest.cpp
llvm/utils/TableGen/Attributes.cpp