This patch removes redundant template argument TargetName from TIIPredicate.
Tablegen can always infer the target name from the context. So we don't need to force users of TIIPredicate to always specify it.
This allows us to better modularize the tablegen class hierarchy for so-called "function predicates". class FunctionPredicateBase has been added; it is currently used as a building block for TIIPredicates. However, I plan to reuse that class to define other function predicates classes (i.e. not just TIIPredicates).
For example, this can be a first step towards implementing proper support for dependency breaking instructions in tablegen.
This patch also adds a verification step on TIIPredicates in tablegen.
We cannot have multiple TIIPredicates with the same name. Otherwise, this will cause build errors later on, when tablegen'd .inc files are included by cpp files and then compiled.
For example, if I add the following conflicting TIIPredicate at the end of X86SchedPredicates.td
def : TIIPredicate<"isThreeOperandsLEA", MCReturnStatement<TruePred>>;
tablegen (-gen-instr-info) now generates the following error:
Included from /home/andrea/llvm/lib/Target/X86/X86.td:405: /home/andrea/llvm/lib/Target/X86/X86SchedPredicates.td:58:1: error: TIIPredicate isThreeOperandsLEA is multiply defined. def : TIIPredicate<"isThreeOperandsLEA", MCReturnStatement<TruePred>>; ^ Included from /home/andrea/llvm/lib/Target/X86/X86.td:405: /home/andrea/llvm/lib/Target/X86/X86SchedPredicates.td:55:1: note: Previous definition of isThreeOperandsLEA was here. def IsThreeOperandsLEAFn : ^ Included from /home/andrea/llvm/lib/Target/X86/X86.td:405: /home/andrea/llvm/lib/Target/X86/X86SchedPredicates.td:58:1: error: Found conflicting definitions of TIIPredicate. def : TIIPredicate<"isThreeOperandsLEA", MCReturnStatement<TruePred>>; ^
Please let me know if okay to commit.
Thanks,
- Andrea