Skip to content

Commit

Permalink
AMDGPU: Add support for MCExpr to instruction printer
Browse files Browse the repository at this point in the history
Reviewers: tstellard

Subscribers: arsenm

Differential Revision: http://reviews.llvm.org/D19790

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269477 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
jvesely committed May 13, 2016
1 parent d32e2de commit 7417b1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,15 @@ void AMDGPUInstPrinter::printOModSI(const MCInst *MI, unsigned OpNo,

void AMDGPUInstPrinter::printLiteral(const MCInst *MI, unsigned OpNo,
raw_ostream &O) {
int32_t Imm = MI->getOperand(OpNo).getImm();
O << Imm << '(' << BitsToFloat(Imm) << ')';
const MCOperand &Op = MI->getOperand(OpNo);
assert(Op.isImm() || Op.isExpr());
if (Op.isImm()) {
int64_t Imm = Op.getImm();
O << Imm << '(' << BitsToFloat(Imm) << ')';
}
if (Op.isExpr()) {
Op.getExpr()->print(O << '@', &MAI);
}
}

void AMDGPUInstPrinter::printLast(const MCInst *MI, unsigned OpNo,
Expand Down
2 changes: 1 addition & 1 deletion lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class AMDGPUInstPrinter : public MCInstPrinter {
static void printClamp(const MCInst *MI, unsigned OpNo, raw_ostream &O);
static void printClampSI(const MCInst *MI, unsigned OpNo, raw_ostream &O);
static void printOModSI(const MCInst *MI, unsigned OpNo, raw_ostream &O);
static void printLiteral(const MCInst *MI, unsigned OpNo, raw_ostream &O);
void printLiteral(const MCInst *MI, unsigned OpNo, raw_ostream &O);
static void printLast(const MCInst *MI, unsigned OpNo, raw_ostream &O);
static void printNeg(const MCInst *MI, unsigned OpNo, raw_ostream &O);
static void printOMOD(const MCInst *MI, unsigned OpNo, raw_ostream &O);
Expand Down

0 comments on commit 7417b1b

Please sign in to comment.