[llvm-commits] CVS: llvm/lib/Target/SparcV8/SparcV8AsmPrinter.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Sun Mar 7 19:13:02 PST 2004


Changes in directory llvm/lib/Target/SparcV8:

SparcV8AsmPrinter.cpp updated: 1.2 -> 1.3

---
Log message:

Emit register names in lowercase, as required by the assembler.

---
Diffs of the changes:  (+11 -1)

Index: llvm/lib/Target/SparcV8/SparcV8AsmPrinter.cpp
diff -u llvm/lib/Target/SparcV8/SparcV8AsmPrinter.cpp:1.2 llvm/lib/Target/SparcV8/SparcV8AsmPrinter.cpp:1.3
--- llvm/lib/Target/SparcV8/SparcV8AsmPrinter.cpp:1.2	Fri Mar  5 02:39:09 2004
+++ llvm/lib/Target/SparcV8/SparcV8AsmPrinter.cpp	Fri Mar  5 23:30:21 2004
@@ -26,6 +26,7 @@
 #include "Support/Statistic.h"
 #include "Support/StringExtras.h"
 #include "Support/CommandLine.h"
+#include <cctype>
 using namespace llvm;
 
 namespace {
@@ -365,6 +366,15 @@
   return false;
 }
 
+
+std::string LowercaseString (const std::string &S) {
+  std::string result (S);
+  for (unsigned i = 0; i < S.length(); ++i) 
+    if (isupper (result[i]))
+      result[i] = tolower(result[i]);
+  return result;
+}
+
 void V8Printer::printOperand(const MachineOperand &MO) {
   const MRegisterInfo &RI = *TM.getRegisterInfo();
   switch (MO.getType()) {
@@ -376,7 +386,7 @@
     // FALLTHROUGH
   case MachineOperand::MO_MachineRegister:
     if (MRegisterInfo::isPhysicalRegister(MO.getReg()))
-      O << "%" << RI.get(MO.getReg()).Name;
+      O << "%" << LowercaseString (RI.get(MO.getReg()).Name);
     else
       O << "%reg" << MO.getReg();
     return;





More information about the llvm-commits mailing list