diff options
author | Nikolay Haustov <Nikolay.Haustov@amd.com> | 2016-04-29 09:02:30 +0000 |
---|---|---|
committer | Nikolay Haustov <Nikolay.Haustov@amd.com> | 2016-04-29 09:02:30 +0000 |
commit | 4f672a34edfd8440a896d26c28b08ab1d52e5238 (patch) | |
tree | 48ff4cf8be805310a0b33956a8610e09458a0086 /llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp | |
parent | 5779fb61b0d3739aacf74fedbbf1269046291ec1 (diff) | |
download | bcm5719-llvm-4f672a34edfd8440a896d26c28b08ab1d52e5238.tar.gz bcm5719-llvm-4f672a34edfd8440a896d26c28b08ab1d52e5238.zip |
AMDGPU/SI: Assembler: Unify parsing/printing of operands.
Summary:
The goal is for each operand type to have its own parse function and
at the same time share common code for tracking state as different
instruction types share operand types (e.g. glc/glc_flat, etc).
Introduce parseAMDGPUOperand which can parse any optional operand.
DPP and Clamp/OMod have custom handling for now. Sam also suggested
to have class hierarchy for operand types instead of table. This
can be done in separate change.
Remove parseVOP3OptionalOps, parseDS*OptionalOps, parseFlatOptionalOps,
parseMubufOptionalOps, parseDPPOptionalOps.
Reduce number of definitions of AsmOperand's and MatchClasses' by using common base class.
Rename AsmMatcher/InstPrinter methods accordingly.
Print immediate type when printing parsed immediate operand.
Use 'off' if offset/index register is unused instead of skipping it to make it more readable (also agreed with SP3).
Update tests.
Reviewers: tstellarAMD, SamWot, artem.tamazov
Subscribers: qcolombet, arsenm, llvm-commits
Differential Revision: http://reviews.llvm.org/D19584
llvm-svn: 268015
Diffstat (limited to 'llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp b/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp index 1ea8c77be69..37acd2eb529 100644 --- a/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp +++ b/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp @@ -94,7 +94,7 @@ void AMDGPUInstPrinter::printMBUFOffset(const MCInst *MI, unsigned OpNo, } } -void AMDGPUInstPrinter::printDSOffset(const MCInst *MI, unsigned OpNo, +void AMDGPUInstPrinter::printOffset(const MCInst *MI, unsigned OpNo, raw_ostream &O) { uint16_t Imm = MI->getOperand(OpNo).getImm(); if (Imm != 0) { @@ -103,7 +103,7 @@ void AMDGPUInstPrinter::printDSOffset(const MCInst *MI, unsigned OpNo, } } -void AMDGPUInstPrinter::printDSOffset0(const MCInst *MI, unsigned OpNo, +void AMDGPUInstPrinter::printOffset0(const MCInst *MI, unsigned OpNo, raw_ostream &O) { if (MI->getOperand(OpNo).getImm()) { O << " offset0:"; @@ -111,7 +111,7 @@ void AMDGPUInstPrinter::printDSOffset0(const MCInst *MI, unsigned OpNo, } } -void AMDGPUInstPrinter::printDSOffset1(const MCInst *MI, unsigned OpNo, +void AMDGPUInstPrinter::printOffset1(const MCInst *MI, unsigned OpNo, raw_ostream &O) { if (MI->getOperand(OpNo).getImm()) { O << " offset1:"; @@ -119,6 +119,16 @@ void AMDGPUInstPrinter::printDSOffset1(const MCInst *MI, unsigned OpNo, } } +void AMDGPUInstPrinter::printSMRDOffset(const MCInst *MI, unsigned OpNo, + raw_ostream &O) { + printU32ImmOperand(MI, OpNo, O); +} + +void AMDGPUInstPrinter::printSMRDLiteralOffset(const MCInst *MI, unsigned OpNo, + raw_ostream &O) { + printU32ImmOperand(MI, OpNo, O); +} + void AMDGPUInstPrinter::printGDS(const MCInst *MI, unsigned OpNo, raw_ostream &O) { printNamedBit(MI, OpNo, O, "gds"); @@ -422,7 +432,7 @@ void AMDGPUInstPrinter::printOperandAndMods(const MCInst *MI, unsigned OpNo, } -void AMDGPUInstPrinter::printDPPCtrlOperand(const MCInst *MI, unsigned OpNo, +void AMDGPUInstPrinter::printDPPCtrl(const MCInst *MI, unsigned OpNo, raw_ostream &O) { unsigned Imm = MI->getOperand(OpNo).getImm(); if (Imm <= 0x0ff) { @@ -461,19 +471,19 @@ void AMDGPUInstPrinter::printDPPCtrlOperand(const MCInst *MI, unsigned OpNo, } } -void AMDGPUInstPrinter::printRowMaskOperand(const MCInst *MI, unsigned OpNo, +void AMDGPUInstPrinter::printRowMask(const MCInst *MI, unsigned OpNo, raw_ostream &O) { O << " row_mask:"; printU4ImmOperand(MI, OpNo, O); } -void AMDGPUInstPrinter::printBankMaskOperand(const MCInst *MI, unsigned OpNo, +void AMDGPUInstPrinter::printBankMask(const MCInst *MI, unsigned OpNo, raw_ostream &O) { O << " bank_mask:"; printU4ImmOperand(MI, OpNo, O); } -void AMDGPUInstPrinter::printBoundCtrlOperand(const MCInst *MI, unsigned OpNo, +void AMDGPUInstPrinter::printBoundCtrl(const MCInst *MI, unsigned OpNo, raw_ostream &O) { unsigned Imm = MI->getOperand(OpNo).getImm(); if (Imm) { |