diff options
| author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-08-14 18:36:54 +0000 | 
|---|---|---|
| committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-08-14 18:36:54 +0000 | 
| commit | 9eaf5aa006994ae0d3af4ff695822a4c5a62703f (patch) | |
| tree | 638ad611e7efc4908c6c401f39c47e23d8bce7fb /llvm/utils/TableGen/PredicateExpander.h | |
| parent | 3afc797e42f8c745cbd4e2049c5e81c64fef5001 (diff) | |
| download | bcm5719-llvm-9eaf5aa006994ae0d3af4ff695822a4c5a62703f.tar.gz bcm5719-llvm-9eaf5aa006994ae0d3af4ff695822a4c5a62703f.zip | |
[Tablegen][MCInstPredicate] Removed redundant template argument from class TIIPredicate, and implemented verification rules for TIIPredicates.
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 the
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 model other function predicate classes too (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.
Differential Revision: https://reviews.llvm.org/D50708
llvm-svn: 339706
Diffstat (limited to 'llvm/utils/TableGen/PredicateExpander.h')
| -rw-r--r-- | llvm/utils/TableGen/PredicateExpander.h | 8 | 
1 files changed, 4 insertions, 4 deletions
| diff --git a/llvm/utils/TableGen/PredicateExpander.h b/llvm/utils/TableGen/PredicateExpander.h index b39452f0fbf..9337a0f3d2c 100644 --- a/llvm/utils/TableGen/PredicateExpander.h +++ b/llvm/utils/TableGen/PredicateExpander.h @@ -30,14 +30,15 @@ class PredicateExpander {    bool NegatePredicate;    bool ExpandForMC;    unsigned IndentLevel; +  StringRef TargetName;    PredicateExpander(const PredicateExpander &) = delete;    PredicateExpander &operator=(const PredicateExpander &) = delete;  public: -  PredicateExpander() +  PredicateExpander(StringRef Target)        : EmitCallsByRef(true), NegatePredicate(false), ExpandForMC(false), -        IndentLevel(1U) {} +        IndentLevel(1U), TargetName(Target) {}    bool isByRef() const { return EmitCallsByRef; }    bool shouldNegate() const { return NegatePredicate; }    bool shouldExpandForMC() const { return ExpandForMC; } @@ -65,8 +66,7 @@ public:    void expandCheckOpcode(raw_ostream &OS, const RecVec &Opcodes);    void expandPredicateSequence(raw_ostream &OS, const RecVec &Sequence,                                 bool IsCheckAll); -  void expandTIIFunctionCall(raw_ostream &OS, StringRef TargetName, -                             StringRef MethodName); +  void expandTIIFunctionCall(raw_ostream &OS, StringRef MethodName);    void expandCheckIsRegOperand(raw_ostream &OS, int OpIndex);    void expandCheckIsImmOperand(raw_ostream &OS, int OpIndex);    void expandCheckInvalidRegOperand(raw_ostream &OS, int OpIndex); | 

