TableGen: Check the dynamic type of !cast<Rec>(string)
authorNicolai Haehnle <nhaehnle@gmail.com>
Mon, 19 Mar 2018 14:14:20 +0000 (14:14 +0000)
committerNicolai Haehnle <nhaehnle@gmail.com>
Mon, 19 Mar 2018 14:14:20 +0000 (14:14 +0000)
commit4186cc7c08b2c1cdd7f7a583fa728e065b5be033
tree7dc97c873ec1ac33733e867a70308de8e0f52f81
parent18f1998a00492bb70de37aaab4441ea9cea306f5
TableGen: Check the dynamic type of !cast<Rec>(string)

Summary:
The docs already claim that this happens, but so far it hasn't. As a
consequence, existing TableGen files get this wrong a lot, but luckily
the fixes are all reasonably straightforward.

To make this work with all the existing forms of self-references (since
the true type of a record is only built up over time), the lookup of
self-references in !cast is delayed until the final resolving step.

Change-Id: If5923a72a252ba2fbc81a889d59775df0ef31164

Reviewers: arsenm, craig.topper, tra, MartinO

Subscribers: wdng, javed.absar, llvm-commits

Differential Revision: https://reviews.llvm.org/D44475

llvm-svn: 327849
llvm/include/llvm/TableGen/Record.h
llvm/include/llvm/Target/TargetSelectionDAG.td
llvm/lib/TableGen/Record.cpp
llvm/lib/Target/AArch64/AArch64InstrFormats.td
llvm/lib/Target/AMDGPU/SMInstructions.td
llvm/lib/Target/SystemZ/SystemZOperands.td
llvm/test/TableGen/cast-typeerror.td
llvm/test/TableGen/self-reference.td