From a8b00cafc4b79f3ef05fdd1cdfc0d58f10740e69 Mon Sep 17 00:00:00 2001 From: Brian Gaeke Date: Sat, 6 Mar 2004 05:30:21 +0000 Subject: [PATCH] Emit register names in lowercase, as required by the assembler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12182 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Sparc/SparcAsmPrinter.cpp | 12 +++++++++++- lib/Target/SparcV8/SparcV8AsmPrinter.cpp | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/Target/Sparc/SparcAsmPrinter.cpp b/lib/Target/Sparc/SparcAsmPrinter.cpp index e9752842a2e..a500f24577b 100644 --- a/lib/Target/Sparc/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/SparcAsmPrinter.cpp @@ -26,6 +26,7 @@ #include "Support/Statistic.h" #include "Support/StringExtras.h" #include "Support/CommandLine.h" +#include 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; diff --git a/lib/Target/SparcV8/SparcV8AsmPrinter.cpp b/lib/Target/SparcV8/SparcV8AsmPrinter.cpp index e9752842a2e..a500f24577b 100644 --- a/lib/Target/SparcV8/SparcV8AsmPrinter.cpp +++ b/lib/Target/SparcV8/SparcV8AsmPrinter.cpp @@ -26,6 +26,7 @@ #include "Support/Statistic.h" #include "Support/StringExtras.h" #include "Support/CommandLine.h" +#include 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; -- 2.34.1