summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2017-09-08 23:32:38 +0000
committerYonghong Song <yhs@fb.com>2017-09-08 23:32:38 +0000
commit093420f929e015fcac39539167aa82af83520673 (patch)
treedbb4b6f474bc2dabd07a12917f0a3f586bb8fe28 /llvm/lib
parent62d6414465c37bca4d945a2aca047acea5dfd08a (diff)
downloadbcm5719-llvm-093420f929e015fcac39539167aa82af83520673.tar.gz
bcm5719-llvm-093420f929e015fcac39539167aa82af83520673.zip
bpf: proper print imm64 expression in inst printer
Fixed an issue in printImm64Operand where if the value is an expression, print out the expression properly. Currently, it will print r1 = <MCOperand Expr:(tx_port)>ll With the patch, the printout will be r1 = tx_port Suggested-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Yonghong Song <yhs@fb.com> Acked-by: Alexei Starovoitov <ast@kernel.org> llvm-svn: 312833
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/BPF/BPFInstrInfo.td2
-rw-r--r--llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/BPF/BPFInstrInfo.td b/llvm/lib/Target/BPF/BPFInstrInfo.td
index 3b239e7463d..d4c50e768f7 100644
--- a/llvm/lib/Target/BPF/BPFInstrInfo.td
+++ b/llvm/lib/Target/BPF/BPFInstrInfo.td
@@ -249,7 +249,7 @@ class MOV_RI<string OpcodeStr>
class LD_IMM64<bits<4> Pseudo, string OpcodeStr>
: InstBPF<(outs GPR:$dst), (ins u64imm:$imm),
- "$dst "#OpcodeStr#" ${imm}ll",
+ "$dst "#OpcodeStr#" ${imm}",
[(set GPR:$dst, (i64 imm:$imm))]> {
bits<3> mode;
diff --git a/llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.cpp b/llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.cpp
index 64e986fe0f0..bb5546ea40e 100644
--- a/llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.cpp
+++ b/llvm/lib/Target/BPF/InstPrinter/BPFInstPrinter.cpp
@@ -88,7 +88,9 @@ void BPFInstPrinter::printImm64Operand(const MCInst *MI, unsigned OpNo,
raw_ostream &O) {
const MCOperand &Op = MI->getOperand(OpNo);
if (Op.isImm())
- O << (uint64_t)Op.getImm();
+ O << (uint64_t)Op.getImm() << "ll";
+ else if (Op.isExpr())
+ printExpr(Op.getExpr(), O);
else
O << Op;
}
OpenPOWER on IntegriCloud