[WebAssembly] Add some comments and make some minor source cleanups.
authorDan Gohman <dan433584@gmail.com>
Mon, 21 Dec 2015 16:50:41 +0000 (16:50 +0000)
committerDan Gohman <dan433584@gmail.com>
Mon, 21 Dec 2015 16:50:41 +0000 (16:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256164 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.cpp

index 3a151dec16f39ccb0b01475c17b245540cc6a238..7ce3a00ae360efb6e3d7007901685f25524f8f6a 100644 (file)
@@ -24,7 +24,6 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Target/TargetRegisterInfo.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Target/TargetRegisterInfo.h"
-#include <cctype>
 using namespace llvm;
 
 #define DEBUG_TYPE "asm-printer"
 using namespace llvm;
 
 #define DEBUG_TYPE "asm-printer"
@@ -46,17 +45,19 @@ void WebAssemblyInstPrinter::printRegName(raw_ostream &OS,
 void WebAssemblyInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
                                        StringRef Annot,
                                        const MCSubtargetInfo & /*STI*/) {
 void WebAssemblyInstPrinter::printInst(const MCInst *MI, raw_ostream &OS,
                                        StringRef Annot,
                                        const MCSubtargetInfo & /*STI*/) {
+  // Print the instruction (this uses the AsmStrings from the .td files).
   printInstruction(MI, OS);
 
   printInstruction(MI, OS);
 
+  // Print any additional variadic operands.
   const MCInstrDesc &Desc = MII.get(MI->getOpcode());
   if (Desc.isVariadic())
   const MCInstrDesc &Desc = MII.get(MI->getOpcode());
   if (Desc.isVariadic())
-    for (unsigned i = Desc.getNumOperands(), e = MI->getNumOperands(); i < e;
-         ++i) {
+    for (auto i = Desc.getNumOperands(), e = MI->getNumOperands(); i < e; ++i) {
       if (i != 0)
         OS << ", ";
       printOperand(MI, i, OS);
     }
 
       if (i != 0)
         OS << ", ";
       printOperand(MI, i, OS);
     }
 
+  // Print any added annotation.
   printAnnotation(OS, Annot);
 }
 
   printAnnotation(OS, Annot);
 }