diff options
| author | David Greene <greened@obbligato.org> | 2009-05-14 23:26:46 +0000 |
|---|---|---|
| committer | David Greene <greened@obbligato.org> | 2009-05-14 23:26:46 +0000 |
| commit | 9bea7c85d71bbb192f686a56e9b5bf32ae3389e6 (patch) | |
| tree | dbd9719b6373f1e119b294f122b6c4dac0ab5d0d /utils/TableGen/Record.cpp | |
| parent | 11adeed8b3032fddacb9f678dd122c142a8d08f1 (diff) | |
Implement !if, analogous to $(if) in GNU make.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71815 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/Record.cpp')
| -rw-r--r-- | utils/TableGen/Record.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp index ae2c2f3ea4..fc2de1c135 100644 --- a/utils/TableGen/Record.cpp +++ b/utils/TableGen/Record.cpp @@ -912,6 +912,19 @@ Init *TernOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) { } break; } + + case IF: { + IntInit *LHSi = dynamic_cast<IntInit*>(LHS); + if (LHSi) { + if (LHSi->getValue()) { + return MHS; + } + else { + return RHS; + } + } + break; + } } return this; @@ -932,6 +945,7 @@ std::string TernOpInit::getAsString() const { switch (Opc) { case SUBST: Result = "!subst"; break; case FOREACH: Result = "!foreach"; break; + case IF: Result = "!if"; break; } return Result + "(" + LHS->getAsString() + ", " + MHS->getAsString() + ", " + RHS->getAsString() + ")"; |
