[llvm-commits] [llvm] r95752 - in /llvm/trunk: include/llvm/MC/MCStreamer.h lib/MC/MCAsmStreamer.cpp tools/llvm-mc/llvm-mc.cpp

Daniel Dunbar daniel at zuster.org
Tue Feb 9 17:41:14 PST 2010


Author: ddunbar
Date: Tue Feb  9 19:41:14 2010
New Revision: 95752

URL: http://llvm.org/viewvc/llvm-project?rev=95752&view=rev
Log:
llvm-mc: Remove --show-fixups and always show as part of --show-encoding.

Also, fix a silly memory leak.

Modified:
    llvm/trunk/include/llvm/MC/MCStreamer.h
    llvm/trunk/lib/MC/MCAsmStreamer.cpp
    llvm/trunk/tools/llvm-mc/llvm-mc.cpp

Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=95752&r1=95751&r2=95752&view=diff

==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Tue Feb  9 19:41:14 2010
@@ -278,15 +278,12 @@
   ///
   /// \param ShowInst - Whether to show the MCInst representation inline with
   /// the assembly.
-  ///
-  /// \param ShowFixups - Whether to show the fixups in an encoded instruction.
   MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
                                 const MCAsmInfo &MAI, bool isLittleEndian,
                                 bool isVerboseAsm,
                                 MCInstPrinter *InstPrint = 0,
                                 MCCodeEmitter *CE = 0,
-                                bool ShowInst = false,
-                                bool ShowFixups = false);
+                                bool ShowInst = false);
 
   // FIXME: These two may end up getting rolled into a single
   // createObjectStreamer interface, which implements the assembler backend, and

Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=95752&r1=95751&r2=95752&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Feb  9 19:41:14 2010
@@ -37,18 +37,17 @@
 
   unsigned IsLittleEndian : 1;
   unsigned IsVerboseAsm : 1;
-  unsigned ShowFixups : 1;
   unsigned ShowInst : 1;
 
 public:
   MCAsmStreamer(MCContext &Context, formatted_raw_ostream &os,
                 const MCAsmInfo &mai,
                 bool isLittleEndian, bool isVerboseAsm, MCInstPrinter *printer,
-                MCCodeEmitter *emitter, bool showInst, bool showFixups)
+                MCCodeEmitter *emitter, bool showInst)
     : MCStreamer(Context), OS(os), MAI(mai), InstPrinter(printer),
       Emitter(emitter), CommentStream(CommentToEmit),
       IsLittleEndian(isLittleEndian), IsVerboseAsm(isVerboseAsm),
-      ShowFixups(showFixups), ShowInst(showInst) {
+      ShowInst(showInst) {
     if (InstPrinter && IsVerboseAsm)
       InstPrinter->setCommentStream(CommentStream);
   }
@@ -543,22 +542,11 @@
   Emitter->EncodeInstruction(Inst, VecOS, Fixups);
   VecOS.flush();
 
-  // If we aren't showing fixups, just show the bytes.
-  if (!ShowFixups) {
-    OS << "encoding: [";
-    for (unsigned i = 0, e = Code.size(); i != e; ++i) {
-      if (i)
-        OS << ',';
-      OS << format("0x%02x", uint8_t(Code[i]));
-    }
-    OS << "]\n";
-    return;
-  }
-
   // If we are showing fixups, create symbolic markers in the encoded
   // representation. We do this by making a per-bit map to the fixup item index,
   // then trying to display it as nicely as possible.
-  uint8_t *FixupMap = new uint8_t[Code.size() * 8];
+  SmallVector<uint8_t, 64> FixupMap;
+  FixupMap.resize(Code.size() * 8);
   for (unsigned i = 0, e = Code.size() * 8; i != e; ++i)
     FixupMap[i] = 0;
 
@@ -652,8 +640,7 @@
                                     formatted_raw_ostream &OS,
                                     const MCAsmInfo &MAI, bool isLittleEndian,
                                     bool isVerboseAsm, MCInstPrinter *IP,
-                                    MCCodeEmitter *CE, bool ShowInst,
-                                    bool ShowFixups) {
+                                    MCCodeEmitter *CE, bool ShowInst) {
   return new MCAsmStreamer(Context, OS, MAI, isLittleEndian, isVerboseAsm,
-                           IP, CE, ShowInst, ShowFixups);
+                           IP, CE, ShowInst);
 }

Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=95752&r1=95751&r2=95752&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Tue Feb  9 19:41:14 2010
@@ -47,9 +47,6 @@
 ShowEncoding("show-encoding", cl::desc("Show instruction encodings"));
 
 static cl::opt<bool>
-ShowFixups("show-fixups", cl::desc("Show fixups inside encodings"));
-
-static cl::opt<bool>
 ShowInst("show-inst", cl::desc("Show internal instruction representation"));
 
 static cl::opt<unsigned>
@@ -273,7 +270,7 @@
     Str.reset(createAsmStreamer(Ctx, *Out, *MAI,
                                 TM->getTargetData()->isLittleEndian(),
                                 /*asmverbose*/true, IP.get(), CE.get(),
-                                ShowInst, ShowFixups));
+                                ShowInst));
   } else {
     assert(FileType == OFT_ObjectFile && "Invalid file type!");
     CE.reset(TheTarget->createCodeEmitter(*TM));





More information about the llvm-commits mailing list