[llvm-commits] CVS: llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp
Nate Begeman
natebegeman at mac.com
Tue Jul 12 11:34:26 PDT 2005
Changes in directory llvm/lib/Target/PowerPC:
PowerPCAsmPrinter.cpp updated: 1.78 -> 1.79
---
Log message:
Remove some code that moved to the generic asm printer a long time ago.
---
Diffs of the changes: (+0 -84)
PowerPCAsmPrinter.cpp | 84 --------------------------------------------------
1 files changed, 84 deletions(-)
Index: llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.78 llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.79
--- llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp:1.78 Thu Jul 7 19:23:26 2005
+++ llvm/lib/Target/PowerPC/PowerPCAsmPrinter.cpp Tue Jul 12 13:34:15 2005
@@ -225,90 +225,6 @@
}
}
-/// 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<ArrayType>(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<ConstantSInt>(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<ConstantInt>(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.
More information about the llvm-commits
mailing list