Emit register names in lowercase, as required by the assembler.
authorBrian Gaeke <gaeke@uiuc.edu>
Sat, 6 Mar 2004 05:30:21 +0000 (05:30 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Sat, 6 Mar 2004 05:30:21 +0000 (05:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12182 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Sparc/SparcAsmPrinter.cpp
lib/Target/SparcV8/SparcV8AsmPrinter.cpp

index e9752842a2e276753667d2229c6b06db53e22bb0..a500f24577b9e5c0c30344b6230ea1273f5068ed 100644 (file)
@@ -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 @@ bool V8Printer::runOnMachineFunction(MachineFunction &MF) {
   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 @@ void V8Printer::printOperand(const MachineOperand &MO) {
     // 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;
index e9752842a2e276753667d2229c6b06db53e22bb0..a500f24577b9e5c0c30344b6230ea1273f5068ed 100644 (file)
@@ -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 @@ bool V8Printer::runOnMachineFunction(MachineFunction &MF) {
   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 @@ void V8Printer::printOperand(const MachineOperand &MO) {
     // 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;