summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2017-09-05 20:14:58 +0000
committerReid Kleckner <rnk@google.com>2017-09-05 20:14:58 +0000
commite33c94f1b06b4fd5f08cce1e0625c6b6ac474f77 (patch)
treec8ea712e4a10d46a47f9e962f9925f93bc3c032d /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
parent3f0e4ad833e0f367255522b4b3dd3e625a1c40c1 (diff)
downloadbcm5719-llvm-e33c94f1b06b4fd5f08cce1e0625c6b6ac474f77.tar.gz
bcm5719-llvm-e33c94f1b06b4fd5f08cce1e0625c6b6ac474f77.zip
Add llvm.codeview.annotation to implement MSVC __annotation
Summary: This intrinsic represents a label with a list of associated metadata strings. It is modelled as reading and writing inaccessible memory so that it won't be removed as dead code. I think the intention is that the annotation strings should appear at most once in the debug info, so I marked it noduplicate. We are allowed to inline code with annotations as long as we strip the annotation, but that can be done later. Reviewers: majnemer Subscribers: eraman, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D36904 llvm-svn: 312569
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 4da821e6c55..da0a9516fd1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -5651,6 +5651,18 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
// Discard annotate attributes and assumptions
return nullptr;
+ case Intrinsic::codeview_annotation: {
+ // Emit a label associated with this metadata.
+ MachineFunction &MF = DAG.getMachineFunction();
+ MCSymbol *Label =
+ MF.getMMI().getContext().createTempSymbol("annotation", true);
+ Metadata *MD = cast<MetadataAsValue>(I.getArgOperand(0))->getMetadata();
+ MF.addCodeViewAnnotation(Label, cast<MDNode>(MD));
+ Res = DAG.getLabelNode(ISD::ANNOTATION_LABEL, sdl, getRoot(), Label);
+ DAG.setRoot(Res);
+ return nullptr;
+ }
+
case Intrinsic::init_trampoline: {
const Function *F = cast<Function>(I.getArgOperand(1)->stripPointerCasts());
OpenPOWER on IntegriCloud