Changes in directory llvm/lib/Target/PowerPC:
PPCAsmPrinter.cpp updated: 1.120 -> 1.121 --- Log message: Use generic constant pool emission code in the AsmPrinter class. --- Diffs of the changes: (+4 -30) PPCAsmPrinter.cpp | 34 ++++------------------------------ 1 files changed, 4 insertions(+), 30 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.120 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.121 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.120 Mon Nov 21 02:14:07 2005 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Mon Nov 21 02:26:15 2005 @@ -25,7 +25,6 @@ #include "llvm/Module.h" #include "llvm/Assembly/Writer.h" #include "llvm/CodeGen/AsmPrinter.h" -#include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/ValueTypes.h" @@ -58,8 +57,6 @@ return static_cast<PPCTargetMachine&>(TM); } - void printConstantPool(MachineConstantPool *MCP); - unsigned enumRegToMachineReg(unsigned enumReg) { switch (enumReg) { default: assert(0 && "Unhandled register!"); break; @@ -212,6 +209,7 @@ ZeroDirective = "\t.space\t"; // ".space N" emits N zeros. Data64bitsDirective = 0; // we can't emit a 64-bit unit AlignmentIsInBytes = false; // Alignment is by power of 2. + ConstantPoolSection = "\t.const\t"; } virtual const char *getPassName() const { @@ -237,6 +235,7 @@ ZeroDirective = "\t.space\t"; // ".space N" emits N zeros. Data64bitsDirective = 0; // we can't emit a 64-bit unit AlignmentIsInBytes = false; // Alignment is by power of 2. + ConstantPoolSection = "\t.const\t"; } virtual const char *getPassName() const { @@ -373,31 +372,6 @@ return; } -/// printConstantPool - Print to the current output stream assembly -/// representations of the constants in the constant pool MCP. This is -/// used to print out constants which have been "spilled to memory" by -/// the code generator. -/// -void PPCAsmPrinter::printConstantPool(MachineConstantPool *MCP) { - const std::vector<Constant*> &CP = MCP->getConstants(); - const TargetData &TD = TM.getTargetData(); - - if (CP.empty()) return; - - SwitchSection(".const", 0); - for (unsigned i = 0, e = CP.size(); i != e; ++i) { - // FIXME: force doubles to be naturally aligned. We should handle this - // more correctly in the future. - unsigned Alignment = TD.getTypeAlignmentShift(CP[i]->getType()); - if (CP[i]->getType() == Type::DoubleTy && Alignment < 3) Alignment = 3; - - EmitAlignment(Alignment); - O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << '_' << i - << ":\t\t\t\t\t" << CommentString << *CP[i] << '\n'; - EmitGlobalConstant(CP[i]); - } -} - /// runOnMachineFunction - This uses the printMachineInstruction() /// method to print assembly for each instruction. @@ -407,7 +381,7 @@ O << "\n\n"; // Print out constants referenced by the function - printConstantPool(MF.getConstantPool()); + EmitConstantPool(MF.getConstantPool()); // Print out labels for the function. const Function *F = MF.getFunction(); @@ -588,7 +562,7 @@ SetupMachineFunction(MF); // Print out constants referenced by the function - printConstantPool(MF.getConstantPool()); + EmitConstantPool(MF.getConstantPool()); // Print out header for the function. O << "\t.csect .text[PR]\n" _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits