diff options
author | Nicola Zaghen <nicola.zaghen@imgtec.com> | 2019-03-01 09:46:29 +0000 |
---|---|---|
committer | Nicola Zaghen <nicola.zaghen@imgtec.com> | 2019-03-01 09:46:29 +0000 |
commit | a896756955fe0c7af49a30f2b471155401cae5b3 (patch) | |
tree | 1d7c20e2c099a376447026c35194f36dda2804c3 /llvm/lib/TableGen/TGParser.cpp | |
parent | 1ed7d8ae36c6d7a9fe96741fdd520b47ddecfb49 (diff) | |
download | bcm5719-llvm-a896756955fe0c7af49a30f2b471155401cae5b3.tar.gz bcm5719-llvm-a896756955fe0c7af49a30f2b471155401cae5b3.zip |
[Tablegen] Add support for the !mul operator.
This is a small addition to arithmetic operations that improves
expressiveness of the language.
Differential Revision: https://reviews.llvm.org/D58775
llvm-svn: 355187
Diffstat (limited to 'llvm/lib/TableGen/TGParser.cpp')
-rw-r--r-- | llvm/lib/TableGen/TGParser.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp index 22b4b16bc39..97a19a91d6d 100644 --- a/llvm/lib/TableGen/TGParser.cpp +++ b/llvm/lib/TableGen/TGParser.cpp @@ -1023,6 +1023,7 @@ Init *TGParser::ParseOperation(Record *CurRec, RecTy *ItemType) { case tgtok::XConcat: case tgtok::XADD: + case tgtok::XMUL: case tgtok::XAND: case tgtok::XOR: case tgtok::XSRA: @@ -1045,6 +1046,7 @@ Init *TGParser::ParseOperation(Record *CurRec, RecTy *ItemType) { default: llvm_unreachable("Unhandled code!"); case tgtok::XConcat: Code = BinOpInit::CONCAT; break; case tgtok::XADD: Code = BinOpInit::ADD; break; + case tgtok::XMUL: Code = BinOpInit::MUL; break; case tgtok::XAND: Code = BinOpInit::AND; break; case tgtok::XOR: Code = BinOpInit::OR; break; case tgtok::XSRA: Code = BinOpInit::SRA; break; @@ -1075,6 +1077,7 @@ Init *TGParser::ParseOperation(Record *CurRec, RecTy *ItemType) { case tgtok::XSRL: case tgtok::XSHL: case tgtok::XADD: + case tgtok::XMUL: Type = IntRecTy::get(); ArgType = IntRecTy::get(); break; @@ -1154,7 +1157,8 @@ Init *TGParser::ParseOperation(Record *CurRec, RecTy *ItemType) { } if (Code != BinOpInit::ADD && Code != BinOpInit::AND && Code != BinOpInit::OR && Code != BinOpInit::SRA && - Code != BinOpInit::SRL && Code != BinOpInit::SHL) + Code != BinOpInit::SRL && Code != BinOpInit::SHL && + Code != BinOpInit::MUL) ArgType = Resolved; } @@ -1176,7 +1180,8 @@ Init *TGParser::ParseOperation(Record *CurRec, RecTy *ItemType) { // shorthand for nesting them. if (Code == BinOpInit::STRCONCAT || Code == BinOpInit::LISTCONCAT || Code == BinOpInit::CONCAT || Code == BinOpInit::ADD || - Code == BinOpInit::AND || Code == BinOpInit::OR) { + Code == BinOpInit::AND || Code == BinOpInit::OR || + Code == BinOpInit::MUL) { while (InitList.size() > 2) { Init *RHS = InitList.pop_back_val(); RHS = (BinOpInit::get(Code, InitList.back(), RHS, Type))->Fold(CurRec); @@ -2007,6 +2012,7 @@ Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType, case tgtok::XConcat: case tgtok::XDag: case tgtok::XADD: + case tgtok::XMUL: case tgtok::XAND: case tgtok::XOR: case tgtok::XSRA: |