From 05fcd0c891c1cab4b90368094081a96ebf655e96 Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Thu, 8 Jul 2004 17:58:04 +0000 Subject: [PATCH] * Fix header comment, excise references to X86 * Add suport for printing out references to constant pool indices git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14699 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPC32AsmPrinter.cpp | 38 ++++++++++++++---------- lib/Target/PowerPC/PPCAsmPrinter.cpp | 38 ++++++++++++++---------- lib/Target/PowerPC/PowerPCAsmPrinter.cpp | 38 ++++++++++++++---------- 3 files changed, 69 insertions(+), 45 deletions(-) diff --git a/lib/Target/PowerPC/PPC32AsmPrinter.cpp b/lib/Target/PowerPC/PPC32AsmPrinter.cpp index ebae7ca1d76..c2c219b5f78 100644 --- a/lib/Target/PowerPC/PPC32AsmPrinter.cpp +++ b/lib/Target/PowerPC/PPC32AsmPrinter.cpp @@ -1,4 +1,4 @@ -//===-- PPC32/Printer.cpp - Convert X86 LLVM code to Intel assembly ---------===// +//===-- Printer.cpp - Convert LLVM code to PowerPC assembly ---------------===// // // The LLVM Compiler Infrastructure // @@ -7,14 +7,12 @@ // //===----------------------------------------------------------------------===// // -// This file contains a printer that converts from our internal -// representation of machine-dependent LLVM code to Intel-format -// assembly language. This printer is the output mechanism used -// by `llc' and `lli -print-machineinstrs' on X86. +// This file contains a printer that converts from our internal representation +// of machine-dependent LLVM code to PowerPC assembly language. This printer is +// the output mechanism used by `llc' and `lli -print-machineinstrs'. // -// Documentation at -// http://developer.apple.com/documentation/DeveloperTools/ -// Reference/Assembler/ASMIntroduction/chapter_1_section_1.html +// Documentation at http://developer.apple.com/documentation/DeveloperTools/ +// Reference/Assembler/ASMIntroduction/chapter_1_section_1.html // //===----------------------------------------------------------------------===// @@ -413,6 +411,7 @@ void Printer::printOp(const MachineOperand &MO, } // FALLTHROUGH case MachineOperand::MO_MachineRegister: + case MachineOperand::MO_CCRegister: O << LowercaseString(RI.get(MO.getReg()).Name); return; @@ -420,6 +419,12 @@ void Printer::printOp(const MachineOperand &MO, case MachineOperand::MO_UnextendedImmed: O << (int)MO.getImmedValue(); return; + + case MachineOperand::MO_PCRelativeDisp: + std::cerr << "Shouldn't use addPCDisp() when building PPC MachineInstrs"; + abort(); + return; + case MachineOperand::MO_MachineBasicBlock: { MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); O << ".LBB" << Mang->getValueName(MBBOp->getParent()->getFunction()) @@ -427,10 +432,15 @@ void Printer::printOp(const MachineOperand &MO, << MBBOp->getBasicBlock()->getName(); return; } - case MachineOperand::MO_PCRelativeDisp: - std::cerr << "Shouldn't use addPCDisp() when building PPC MachineInstrs"; - abort(); + + case MachineOperand::MO_ConstantPoolIndex: + O << ".CPI" << CurrentFnName << "_" << MO.getConstantPoolIndex(); return; + + case MachineOperand::MO_ExternalSymbol: + O << MO.getSymbolName(); + return; + case MachineOperand::MO_GlobalAddress: if (!elideOffsetKeyword) { // Dynamically-resolved functions need a stub for the function @@ -443,11 +453,9 @@ void Printer::printOp(const MachineOperand &MO, } } return; - case MachineOperand::MO_ExternalSymbol: - O << MO.getSymbolName(); - return; + default: - O << ""; + O << ""; return; } } diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp index ebae7ca1d76..c2c219b5f78 100644 --- a/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -1,4 +1,4 @@ -//===-- PPC32/Printer.cpp - Convert X86 LLVM code to Intel assembly ---------===// +//===-- Printer.cpp - Convert LLVM code to PowerPC assembly ---------------===// // // The LLVM Compiler Infrastructure // @@ -7,14 +7,12 @@ // //===----------------------------------------------------------------------===// // -// This file contains a printer that converts from our internal -// representation of machine-dependent LLVM code to Intel-format -// assembly language. This printer is the output mechanism used -// by `llc' and `lli -print-machineinstrs' on X86. +// This file contains a printer that converts from our internal representation +// of machine-dependent LLVM code to PowerPC assembly language. This printer is +// the output mechanism used by `llc' and `lli -print-machineinstrs'. // -// Documentation at -// http://developer.apple.com/documentation/DeveloperTools/ -// Reference/Assembler/ASMIntroduction/chapter_1_section_1.html +// Documentation at http://developer.apple.com/documentation/DeveloperTools/ +// Reference/Assembler/ASMIntroduction/chapter_1_section_1.html // //===----------------------------------------------------------------------===// @@ -413,6 +411,7 @@ void Printer::printOp(const MachineOperand &MO, } // FALLTHROUGH case MachineOperand::MO_MachineRegister: + case MachineOperand::MO_CCRegister: O << LowercaseString(RI.get(MO.getReg()).Name); return; @@ -420,6 +419,12 @@ void Printer::printOp(const MachineOperand &MO, case MachineOperand::MO_UnextendedImmed: O << (int)MO.getImmedValue(); return; + + case MachineOperand::MO_PCRelativeDisp: + std::cerr << "Shouldn't use addPCDisp() when building PPC MachineInstrs"; + abort(); + return; + case MachineOperand::MO_MachineBasicBlock: { MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); O << ".LBB" << Mang->getValueName(MBBOp->getParent()->getFunction()) @@ -427,10 +432,15 @@ void Printer::printOp(const MachineOperand &MO, << MBBOp->getBasicBlock()->getName(); return; } - case MachineOperand::MO_PCRelativeDisp: - std::cerr << "Shouldn't use addPCDisp() when building PPC MachineInstrs"; - abort(); + + case MachineOperand::MO_ConstantPoolIndex: + O << ".CPI" << CurrentFnName << "_" << MO.getConstantPoolIndex(); return; + + case MachineOperand::MO_ExternalSymbol: + O << MO.getSymbolName(); + return; + case MachineOperand::MO_GlobalAddress: if (!elideOffsetKeyword) { // Dynamically-resolved functions need a stub for the function @@ -443,11 +453,9 @@ void Printer::printOp(const MachineOperand &MO, } } return; - case MachineOperand::MO_ExternalSymbol: - O << MO.getSymbolName(); - return; + default: - O << ""; + O << ""; return; } } diff --git a/lib/Target/PowerPC/PowerPCAsmPrinter.cpp b/lib/Target/PowerPC/PowerPCAsmPrinter.cpp index ebae7ca1d76..c2c219b5f78 100644 --- a/lib/Target/PowerPC/PowerPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/PowerPCAsmPrinter.cpp @@ -1,4 +1,4 @@ -//===-- PPC32/Printer.cpp - Convert X86 LLVM code to Intel assembly ---------===// +//===-- Printer.cpp - Convert LLVM code to PowerPC assembly ---------------===// // // The LLVM Compiler Infrastructure // @@ -7,14 +7,12 @@ // //===----------------------------------------------------------------------===// // -// This file contains a printer that converts from our internal -// representation of machine-dependent LLVM code to Intel-format -// assembly language. This printer is the output mechanism used -// by `llc' and `lli -print-machineinstrs' on X86. +// This file contains a printer that converts from our internal representation +// of machine-dependent LLVM code to PowerPC assembly language. This printer is +// the output mechanism used by `llc' and `lli -print-machineinstrs'. // -// Documentation at -// http://developer.apple.com/documentation/DeveloperTools/ -// Reference/Assembler/ASMIntroduction/chapter_1_section_1.html +// Documentation at http://developer.apple.com/documentation/DeveloperTools/ +// Reference/Assembler/ASMIntroduction/chapter_1_section_1.html // //===----------------------------------------------------------------------===// @@ -413,6 +411,7 @@ void Printer::printOp(const MachineOperand &MO, } // FALLTHROUGH case MachineOperand::MO_MachineRegister: + case MachineOperand::MO_CCRegister: O << LowercaseString(RI.get(MO.getReg()).Name); return; @@ -420,6 +419,12 @@ void Printer::printOp(const MachineOperand &MO, case MachineOperand::MO_UnextendedImmed: O << (int)MO.getImmedValue(); return; + + case MachineOperand::MO_PCRelativeDisp: + std::cerr << "Shouldn't use addPCDisp() when building PPC MachineInstrs"; + abort(); + return; + case MachineOperand::MO_MachineBasicBlock: { MachineBasicBlock *MBBOp = MO.getMachineBasicBlock(); O << ".LBB" << Mang->getValueName(MBBOp->getParent()->getFunction()) @@ -427,10 +432,15 @@ void Printer::printOp(const MachineOperand &MO, << MBBOp->getBasicBlock()->getName(); return; } - case MachineOperand::MO_PCRelativeDisp: - std::cerr << "Shouldn't use addPCDisp() when building PPC MachineInstrs"; - abort(); + + case MachineOperand::MO_ConstantPoolIndex: + O << ".CPI" << CurrentFnName << "_" << MO.getConstantPoolIndex(); return; + + case MachineOperand::MO_ExternalSymbol: + O << MO.getSymbolName(); + return; + case MachineOperand::MO_GlobalAddress: if (!elideOffsetKeyword) { // Dynamically-resolved functions need a stub for the function @@ -443,11 +453,9 @@ void Printer::printOp(const MachineOperand &MO, } } return; - case MachineOperand::MO_ExternalSymbol: - O << MO.getSymbolName(); - return; + default: - O << ""; + O << ""; return; } }