From ede042dc8d59ff48a48ef8e2271f2a7ee8324ba5 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 15 Sep 2011 18:36:29 +0000 Subject: Add support for stored annotations to MCInst, and provide facilities for MC-based InstPrinters to print them out. Enhance the ARM and X86 InstPrinter's to do so in verbose mode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139820 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCInst.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/MC/MCInst.cpp') diff --git a/lib/MC/MCInst.cpp b/lib/MC/MCInst.cpp index 4cb628b395..ec97acc554 100644 --- a/lib/MC/MCInst.cpp +++ b/lib/MC/MCInst.cpp @@ -41,6 +41,16 @@ void MCInst::print(raw_ostream &OS, const MCAsmInfo *MAI) const { OS << " "; getOperand(i).print(OS, MAI); } + + if (getNumAnnotations()) { + OS << " # Annots: "; + for (unsigned i = 0, e = getNumAnnotations(); i != e; ++i) { + OS << " \""; + OS << getAnnotation(i); + OS << '"'; + } + } + OS << ">"; } @@ -57,6 +67,17 @@ void MCInst::dump_pretty(raw_ostream &OS, const MCAsmInfo *MAI, OS << Separator; getOperand(i).print(OS, MAI); } + + if (getNumAnnotations()) { + OS << " # Annots: "; + for (unsigned i = 0, e = getNumAnnotations(); i != e; ++i) { + OS << Separator; + OS << '"'; + OS << getAnnotation(i); + OS << '"'; + } + } + OS << ">"; } -- cgit v1.2.3