TableGen: Allow use of #NAME# outside of 'def' names.
authorJim Grosbach <grosbach@apple.com>
Thu, 2 Aug 2012 18:46:42 +0000 (18:46 +0000)
committerJim Grosbach <grosbach@apple.com>
Thu, 2 Aug 2012 18:46:42 +0000 (18:46 +0000)
commitcfbda4a04dacaf976505c54a5308f6954b3b9a58
treedafefb43d1afbe12801b6814320d75192560117c
parent79a20ce6f0d6c1041a5031aca41b50a1e58b1d4b
TableGen: Allow use of #NAME# outside of 'def' names.

Previously, def NAME values were only populated, and references to NAME
resolved, when NAME was referenced in the 'def' entry of the multiclass
sub-entry. e.g.,
multiclass foo<...> {
  def prefix_#NAME : ...
}

It's useful, however, to be able to reference NAME even when the default
def name is used. For example, when a multiclass has 'def : Pat<...>'
or 'def : InstAlias<...>' entries which refer to earlier instruction
definitions in the same multiclass. e.g.,
multiclass myMulti<RegisterClass rc> {
  def _r : myI<(outs rc:$d), (ins rc:$r), "r $d, $r", []>;

  def : InstAlias<\"wilma $r\", (!cast<Instruction>(NAME#\"_r\") rc:$r, rc:$r)>;
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161198 91177308-0d34-0410-b5e6-96231b3b80d8
lib/TableGen/TGParser.cpp