mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-25 00:35:30 +00:00
Number constants from constant pool as CPIf_i where f is the function index
and i is the constant pool index. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6920 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
102f9015c6
commit
5e00157c5a
lib/Target/X86
@ -24,16 +24,12 @@
|
||||
#include "llvm/Module.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
unsigned fnIndex;
|
||||
std::set<const Value*> MangledGlobals;
|
||||
struct Printer : public MachineFunctionPass {
|
||||
|
||||
std::ostream &O;
|
||||
unsigned ConstIdx;
|
||||
Printer(std::ostream &o) : O(o), ConstIdx(0) {}
|
||||
Printer(std::ostream &o) : O(o) {}
|
||||
const TargetData *TD;
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "X86 Assembly Printer";
|
||||
}
|
||||
@ -393,11 +389,11 @@ void Printer::printConstantPool(MachineConstantPool *MCP){
|
||||
|
||||
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
|
||||
O << "\t.section .rodata\n";
|
||||
O << "\t.align " << (unsigned)TD->getTypeAlignment(CP[i]->getType()) << "\n";
|
||||
O << ".CPI" << i+ConstIdx << ":\t\t\t\t\t#" << *CP[i] << "\n";
|
||||
O << "\t.align " << (unsigned)TD->getTypeAlignment(CP[i]->getType())
|
||||
<< "\n";
|
||||
O << ".CPI" << fnIndex << "_" << i << ":\t\t\t\t\t#" << *CP[i] << "\n";
|
||||
printConstantValueOnly (CP[i]);
|
||||
}
|
||||
ConstIdx += CP.size(); // Don't recycle constant pool index numbers
|
||||
}
|
||||
|
||||
/// runOnMachineFunction - This uses the X86InstructionInfo::print method
|
||||
@ -438,6 +434,7 @@ bool Printer::runOnMachineFunction(MachineFunction &MF) {
|
||||
}
|
||||
}
|
||||
|
||||
fnIndex++;
|
||||
// We didn't modify anything.
|
||||
return false;
|
||||
}
|
||||
@ -515,7 +512,8 @@ static void printMemReference(std::ostream &O, const MachineInstr *MI,
|
||||
O << "]";
|
||||
return;
|
||||
} else if (MI->getOperand(Op).isConstantPoolIndex()) {
|
||||
O << "[.CPI" << MI->getOperand(Op).getConstantPoolIndex();
|
||||
O << "[.CPI" << fnIndex << "_"
|
||||
<< MI->getOperand(Op).getConstantPoolIndex();
|
||||
if (MI->getOperand(Op+3).getImmedValue())
|
||||
O << " + " << MI->getOperand(Op+3).getImmedValue();
|
||||
O << "]";
|
||||
@ -823,6 +821,9 @@ bool Printer::doInitialization(Module &M)
|
||||
// with no % decorations on register names.
|
||||
O << "\t.intel_syntax noprefix\n";
|
||||
|
||||
// Start function index at 0
|
||||
fnIndex = 0;
|
||||
|
||||
// Ripped from CWriter:
|
||||
// Calculate which global values have names that will collide when we throw
|
||||
// away type information.
|
||||
|
@ -24,16 +24,12 @@
|
||||
#include "llvm/Module.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
unsigned fnIndex;
|
||||
std::set<const Value*> MangledGlobals;
|
||||
struct Printer : public MachineFunctionPass {
|
||||
|
||||
std::ostream &O;
|
||||
unsigned ConstIdx;
|
||||
Printer(std::ostream &o) : O(o), ConstIdx(0) {}
|
||||
Printer(std::ostream &o) : O(o) {}
|
||||
const TargetData *TD;
|
||||
|
||||
virtual const char *getPassName() const {
|
||||
return "X86 Assembly Printer";
|
||||
}
|
||||
@ -393,11 +389,11 @@ void Printer::printConstantPool(MachineConstantPool *MCP){
|
||||
|
||||
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
|
||||
O << "\t.section .rodata\n";
|
||||
O << "\t.align " << (unsigned)TD->getTypeAlignment(CP[i]->getType()) << "\n";
|
||||
O << ".CPI" << i+ConstIdx << ":\t\t\t\t\t#" << *CP[i] << "\n";
|
||||
O << "\t.align " << (unsigned)TD->getTypeAlignment(CP[i]->getType())
|
||||
<< "\n";
|
||||
O << ".CPI" << fnIndex << "_" << i << ":\t\t\t\t\t#" << *CP[i] << "\n";
|
||||
printConstantValueOnly (CP[i]);
|
||||
}
|
||||
ConstIdx += CP.size(); // Don't recycle constant pool index numbers
|
||||
}
|
||||
|
||||
/// runOnMachineFunction - This uses the X86InstructionInfo::print method
|
||||
@ -438,6 +434,7 @@ bool Printer::runOnMachineFunction(MachineFunction &MF) {
|
||||
}
|
||||
}
|
||||
|
||||
fnIndex++;
|
||||
// We didn't modify anything.
|
||||
return false;
|
||||
}
|
||||
@ -515,7 +512,8 @@ static void printMemReference(std::ostream &O, const MachineInstr *MI,
|
||||
O << "]";
|
||||
return;
|
||||
} else if (MI->getOperand(Op).isConstantPoolIndex()) {
|
||||
O << "[.CPI" << MI->getOperand(Op).getConstantPoolIndex();
|
||||
O << "[.CPI" << fnIndex << "_"
|
||||
<< MI->getOperand(Op).getConstantPoolIndex();
|
||||
if (MI->getOperand(Op+3).getImmedValue())
|
||||
O << " + " << MI->getOperand(Op+3).getImmedValue();
|
||||
O << "]";
|
||||
@ -823,6 +821,9 @@ bool Printer::doInitialization(Module &M)
|
||||
// with no % decorations on register names.
|
||||
O << "\t.intel_syntax noprefix\n";
|
||||
|
||||
// Start function index at 0
|
||||
fnIndex = 0;
|
||||
|
||||
// Ripped from CWriter:
|
||||
// Calculate which global values have names that will collide when we throw
|
||||
// away type information.
|
||||
|
Loading…
x
Reference in New Issue
Block a user