aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp
diff options
context:
space:
mode:
authorJF Bastien <jfb@google.com>2015-08-24 22:16:48 +0000
committerJF Bastien <jfb@google.com>2015-08-24 22:16:48 +0000
commitaf111db8af5e2ec7bfc9afa6b6e0f285129f0624 (patch)
tree482845bc029a40c8284c9f78981f67889cbbc24d /llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp
parent19c2e6634de882c2f146d278b49adb2952d7d104 (diff)
downloadllvm-af111db8af5e2ec7bfc9afa6b6e0f285129f0624.zip
llvm-af111db8af5e2ec7bfc9afa6b6e0f285129f0624.tar.gz
llvm-af111db8af5e2ec7bfc9afa6b6e0f285129f0624.tar.bz2
WebAssembly: Implement call
Summary: Support function calls. Reviewers: sunfish, sunfishcode Subscribers: sunfishcode, jfb, llvm-commits Differential revision: http://reviews.llvm.org/D12219 llvm-svn: 245887
Diffstat (limited to 'llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp b/llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp
index 0c5792c..cbd2f7d 100644
--- a/llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp
+++ b/llvm/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp
@@ -44,3 +44,16 @@ void WebAssemblyInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
printInstruction(MI, OS);
printAnnotation(OS, Annot);
}
+
+void WebAssemblyInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
+ raw_ostream &O) {
+ const MCOperand &Op = MI->getOperand(OpNo);
+ if (Op.isReg())
+ O << getRegisterName(Op.getReg());
+ else if (Op.isImm())
+ O << '#' << Op.getImm();
+ else {
+ assert(Op.isExpr() && "unknown operand kind in printOperand");
+ Op.getExpr()->print(O, &MAI);
+ }
+}