summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-13 01:42:09 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2015-02-13 01:42:09 +0000
commit0c5c0124acc84754fdf81bf5a98a807ee33c9bae (patch)
treebba3cae61af33ef739b738ccfa01f20febddbad2 /llvm/lib/IR
parent72fe2d0b7928257881bdaba31984ccfc127eed08 (diff)
downloadbcm5719-llvm-0c5c0124acc84754fdf81bf5a98a807ee33c9bae.tar.gz
bcm5719-llvm-0c5c0124acc84754fdf81bf5a98a807ee33c9bae.zip
AsmWriter/Bitcode: MDExpression
llvm-svn: 229023
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/AsmWriter.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index ae9a50c94da..5bfbe78496a 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -1781,10 +1781,27 @@ static void writeMDLocalVariable(raw_ostream &Out, const MDLocalVariable *N,
Out << ")";
}
-static void writeMDExpression(raw_ostream &, const MDExpression *,
- TypePrinting *, SlotTracker *, const Module *) {
- llvm_unreachable("write not implemented");
+static void writeMDExpression(raw_ostream &Out, const MDExpression *N,
+ TypePrinting *TypePrinter, SlotTracker *Machine,
+ const Module *Context) {
+ Out << "!MDExpression(";
+ FieldSeparator FS;
+ if (N->isValid()) {
+ for (auto I = N->expr_op_begin(), E = N->expr_op_end(); I != E; ++I) {
+ const char *OpStr = dwarf::OperationEncodingString(I->getOp());
+ assert(OpStr && "Expected valid opcode");
+
+ Out << FS << OpStr;
+ for (unsigned A = 0, AE = I->getNumArgs(); A != AE; ++A)
+ Out << FS << I->getArg(A);
+ }
+ } else {
+ for (const auto &I : N->getElements())
+ Out << FS << I;
+ }
+ Out << ")";
}
+
static void writeMDObjCProperty(raw_ostream &, const MDObjCProperty *,
TypePrinting *, SlotTracker *, const Module *) {
llvm_unreachable("write not implemented");
OpenPOWER on IntegriCloud