From be4b78ff53ad711063408186cd07cab2333173a0 Mon Sep 17 00:00:00 2001 From: Nate Begeman Date: Tue, 12 Jul 2005 18:34:15 +0000 Subject: [PATCH] Remove some code that moved to the generic asm printer a long time ago. llvm-svn: 22407 --- lib/Target/PowerPC/PowerPCAsmPrinter.cpp | 84 ------------------------ 1 file changed, 84 deletions(-) diff --git a/lib/Target/PowerPC/PowerPCAsmPrinter.cpp b/lib/Target/PowerPC/PowerPCAsmPrinter.cpp index d9a818b6bd0..a468c5eb75b 100644 --- a/lib/Target/PowerPC/PowerPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/PowerPCAsmPrinter.cpp @@ -225,90 +225,6 @@ static void SwitchSection(std::ostream &OS, std::string &CurSection, } } -/// isStringCompatible - Can we treat the specified array as a string? -/// Only if it is an array of ubytes or non-negative sbytes. -/// -static bool isStringCompatible(const ConstantArray *CVA) { - const Type *ETy = cast(CVA->getType())->getElementType(); - if (ETy == Type::UByteTy) return true; - if (ETy != Type::SByteTy) return false; - - for (unsigned i = 0; i < CVA->getNumOperands(); ++i) - if (cast(CVA->getOperand(i))->getValue() < 0) - return false; - - return true; -} - -/// toOctal - Convert the low order bits of X into an octal digit. -/// -static inline char toOctal(int X) { - return (X&7)+'0'; -} - -// Possible states while outputting ASCII strings -namespace { - enum StringSection { - None, - Alpha, - Numeric - }; -} - -/// SwitchStringSection - manage the changes required to output bytes as -/// characters in a string vs. numeric decimal values -/// -static inline void SwitchStringSection(std::ostream &O, StringSection NewSect, - StringSection &Current) { - if (Current == None) { - if (NewSect == Alpha) - O << "\t.byte \""; - else if (NewSect == Numeric) - O << "\t.byte "; - } else if (Current == Alpha) { - if (NewSect == None) - O << "\""; - else if (NewSect == Numeric) - O << "\"\n" - << "\t.byte "; - } else if (Current == Numeric) { - if (NewSect == Alpha) - O << '\n' - << "\t.byte \""; - else if (NewSect == Numeric) - O << ", "; - } - - Current = NewSect; -} - -/// getAsCString - Return the specified array as a C compatible -/// string, only if the predicate isStringCompatible is true. -/// -static void printAsCString(std::ostream &O, const ConstantArray *CVA) { - assert(isStringCompatible(CVA) && "Array is not string compatible!"); - - if (CVA->getNumOperands() == 0) - return; - - StringSection Current = None; - for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i) { - unsigned char C = cast(CVA->getOperand(i))->getRawValue(); - if (C == '"') { - SwitchStringSection(O, Alpha, Current); - O << "\"\""; - } else if (isprint(C)) { - SwitchStringSection(O, Alpha, Current); - O << C; - } else { - SwitchStringSection(O, Numeric, Current); - O << utostr((unsigned)C); - } - } - SwitchStringSection(O, None, Current); - O << '\n'; -} - /// createDarwinAsmPrinterPass - Returns a pass that prints the PPC assembly /// code for a MachineFunction to the given output stream, in a format that the /// Darwin assembler can deal with.