X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FAlpha%2FAlphaAsmPrinter.cpp;h=133f6c6039359f3fff485cc21b4f506f6439ebf0;hb=b8973bd8f50d7321635e1e07b81a880a0828d185;hp=88ab8e07798615a80221ae88d52feb1763fe0d1b;hpb=0a70a49dd688eb320f00272d9a6386a2d22ee3a7;p=oota-llvm.git diff --git a/lib/Target/Alpha/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AlphaAsmPrinter.cpp index 88ab8e07798..133f6c60393 100644 --- a/lib/Target/Alpha/AlphaAsmPrinter.cpp +++ b/lib/Target/Alpha/AlphaAsmPrinter.cpp @@ -18,13 +18,11 @@ #include "llvm/Module.h" #include "llvm/Type.h" #include "llvm/Assembly/Writer.h" -#include "llvm/CodeGen/MachineConstantPool.h" -#include "llvm/CodeGen/ValueTypes.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Mangler.h" #include "llvm/ADT/Statistic.h" - +#include using namespace llvm; namespace { @@ -37,8 +35,7 @@ namespace { unsigned LabelNumber; AlphaAsmPrinter(std::ostream &o, TargetMachine &tm) - : AsmPrinter(o, tm), LabelNumber(0) - { + : AsmPrinter(o, tm), LabelNumber(0) { AlignmentIsInBytes = false; PrivateGlobalPrefix = "$"; } @@ -56,8 +53,7 @@ namespace { } bool printInstruction(const MachineInstr *MI); void printOp(const MachineOperand &MO, bool IsCallOp = false); - void printConstantPool(MachineConstantPool *MCP); - void printOperand(const MachineInstr *MI, int opNum, MVT::ValueType VT); + void printOperand(const MachineInstr *MI, int opNum); void printBaseOffsetPair (const MachineInstr *MI, int i, bool brackets=true); void printMachineInstruction(const MachineInstr *MI); bool runOnMachineFunction(MachineFunction &F); @@ -78,7 +74,7 @@ FunctionPass *llvm::createAlphaCodePrinterPass (std::ostream &o, #include "AlphaGenAsmWriter.inc" -void AlphaAsmPrinter::printOperand(const MachineInstr *MI, int opNum, MVT::ValueType VT) +void AlphaAsmPrinter::printOperand(const MachineInstr *MI, int opNum) { const MachineOperand &MO = MI->getOperand(opNum); if (MO.getType() == MachineOperand::MO_MachineRegister) { @@ -121,14 +117,15 @@ void AlphaAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) { case MachineOperand::MO_MachineBasicBlock: { MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); - O << "$LBB" << Mang->getValueName(MBBOp->getParent()->getFunction()) + O << PrivateGlobalPrefix << "LBB" + << Mang->getValueName(MBBOp->getParent()->getFunction()) << "_" << MBBOp->getNumber() << "\t" << CommentString << " " << MBBOp->getBasicBlock()->getName(); return; } case MachineOperand::MO_ConstantPoolIndex: - O << PrivateGlobalPrefix << "CPI" << CurrentFnName << "_" + O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_" << MO.getConstantPoolIndex(); return; @@ -139,9 +136,9 @@ void AlphaAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) { case MachineOperand::MO_GlobalAddress: //Abuse PCrel to specify pcrel calls //calls are the only thing that use this flag - if (MO.isPCRelative()) - O << "$" << Mang->getValueName(MO.getGlobal()) << "..ng"; - else +// if (MO.isPCRelative()) +// O << PrivateGlobalPrefix << Mang->getValueName(MO.getGlobal()) << "..ng"; +// else O << Mang->getValueName(MO.getGlobal()); return; @@ -169,15 +166,15 @@ void AlphaAsmPrinter::printMachineInstruction(const MachineInstr *MI) { /// method to print assembly for each instruction. /// bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) { - setupMachineFunction(MF); + SetupMachineFunction(MF); O << "\n\n"; // Print out constants referenced by the function - printConstantPool(MF.getConstantPool()); + EmitConstantPool(MF.getConstantPool()); // Print out labels for the function. SwitchSection("\t.section .text", MF.getFunction()); - emitAlignment(4); + EmitAlignment(4); O << "\t.globl " << CurrentFnName << "\n"; O << "\t.ent " << CurrentFnName << "\n"; @@ -187,8 +184,8 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) { for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); I != E; ++I) { // Print a label for the basic block. - O << "$LBB" << CurrentFnName << "_" << I->getNumber() << ":\t" - << CommentString << " " << I->getBasicBlock()->getName() << "\n"; + O << PrivateGlobalPrefix << "LBB" << CurrentFnName << "_" << I->getNumber() + << ":\t" << CommentString << " " << I->getBasicBlock()->getName() << "\n"; for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); II != E; ++II) { // Print the assembly for the instruction. @@ -204,27 +201,6 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) { return false; } - -/// 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 AlphaAsmPrinter::printConstantPool(MachineConstantPool *MCP) { - const std::vector &CP = MCP->getConstants(); - const TargetData &TD = TM.getTargetData(); - - if (CP.empty()) return; - - SwitchSection("\t.section .rodata", 0); - for (unsigned i = 0, e = CP.size(); i != e; ++i) { - emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType())); - O << PrivateGlobalPrefix << "CPI" << CurrentFnName << "_" << i - << ":\t\t\t\t\t" << CommentString << *CP[i] << "\n"; - emitGlobalConstant(CP[i]); - } -} - bool AlphaAsmPrinter::doInitialization(Module &M) { AsmPrinter::doInitialization(M); @@ -285,7 +261,7 @@ bool AlphaAsmPrinter::doFinalization(Module &M) { abort(); } - emitAlignment(Align); + EmitAlignment(Align); O << "\t.type " << name << ",@object\n"; O << "\t.size " << name << "," << Size << "\n"; O << name << ":\t\t\t\t# "; @@ -293,7 +269,7 @@ bool AlphaAsmPrinter::doFinalization(Module &M) { O << " = "; WriteAsOperand(O, C, false, false, &M); O << "\n"; - emitGlobalConstant(C); + EmitGlobalConstant(C); } }