mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54452 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -84,12 +84,12 @@ namespace {
|
|||||||
// XXX : nasty hack to avoid GPREL22 "relocation truncated to fit" linker
|
// XXX : nasty hack to avoid GPREL22 "relocation truncated to fit" linker
|
||||||
// errors - instead of add rX = @gprel(CPI<whatever>), r1;; we now
|
// errors - instead of add rX = @gprel(CPI<whatever>), r1;; we now
|
||||||
// emit movl rX = @gprel(CPI<whatever);;
|
// emit movl rX = @gprel(CPI<whatever);;
|
||||||
// add rX = rX, r1;
|
// add rX = rX, r1;
|
||||||
// this gives us 64 bits instead of 22 (for the add long imm) to play
|
// this gives us 64 bits instead of 22 (for the add long imm) to play
|
||||||
// with, which shuts up the linker. The problem is that the constant
|
// with, which shuts up the linker. The problem is that the constant
|
||||||
// pool entries aren't immediates at this stage, so we check here.
|
// pool entries aren't immediates at this stage, so we check here.
|
||||||
// If it's an immediate, print it the old fashioned way. If it's
|
// If it's an immediate, print it the old fashioned way. If it's
|
||||||
// not, we print it as a constant pool index.
|
// not, we print it as a constant pool index.
|
||||||
if(MI->getOperand(OpNo).isImmediate()) {
|
if(MI->getOperand(OpNo).isImmediate()) {
|
||||||
O << (int64_t)MI->getOperand(OpNo).getImm();
|
O << (int64_t)MI->getOperand(OpNo).getImm();
|
||||||
} else { // this is a constant pool reference: FIXME: assert this
|
} else { // this is a constant pool reference: FIXME: assert this
|
||||||
@ -120,9 +120,9 @@ namespace {
|
|||||||
#include "IA64GenAsmWriter.inc"
|
#include "IA64GenAsmWriter.inc"
|
||||||
|
|
||||||
|
|
||||||
|
// Substitute old hook with new one temporary
|
||||||
std::string IA64AsmPrinter::getSectionForFunction(const Function &F) const {
|
std::string IA64AsmPrinter::getSectionForFunction(const Function &F) const {
|
||||||
// This means "Allocated instruXions in mem, initialized".
|
return TAI->SectionForGlobal(&F);
|
||||||
return "\n\t.section .text, \"ax\", \"progbits\"\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// runOnMachineFunction - This uses the printMachineInstruction()
|
/// runOnMachineFunction - This uses the printMachineInstruction()
|
||||||
@ -210,7 +210,7 @@ void IA64AsmPrinter::printOp(const MachineOperand &MO,
|
|||||||
if (Needfptr)
|
if (Needfptr)
|
||||||
O << "@fptr(";
|
O << "@fptr(";
|
||||||
O << Mang->getValueName(MO.getGlobal());
|
O << Mang->getValueName(MO.getGlobal());
|
||||||
|
|
||||||
if (Needfptr && !isBRCALLinsn)
|
if (Needfptr && !isBRCALLinsn)
|
||||||
O << "#))"; // close both fptr( and ltoff(
|
O << "#))"; // close both fptr( and ltoff(
|
||||||
else {
|
else {
|
||||||
@ -219,7 +219,7 @@ void IA64AsmPrinter::printOp(const MachineOperand &MO,
|
|||||||
if (!isBRCALLinsn)
|
if (!isBRCALLinsn)
|
||||||
O << "#)"; // close only ltoff(
|
O << "#)"; // close only ltoff(
|
||||||
}
|
}
|
||||||
|
|
||||||
int Offset = MO.getOffset();
|
int Offset = MO.getOffset();
|
||||||
if (Offset > 0)
|
if (Offset > 0)
|
||||||
O << " + " << Offset;
|
O << " + " << Offset;
|
||||||
@ -258,7 +258,7 @@ bool IA64AsmPrinter::doInitialization(Module &M) {
|
|||||||
|
|
||||||
bool IA64AsmPrinter::doFinalization(Module &M) {
|
bool IA64AsmPrinter::doFinalization(Module &M) {
|
||||||
const TargetData *TD = TM.getTargetData();
|
const TargetData *TD = TM.getTargetData();
|
||||||
|
|
||||||
// Print out module-level global variables here.
|
// Print out module-level global variables here.
|
||||||
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
|
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
@ -266,7 +266,7 @@ bool IA64AsmPrinter::doFinalization(Module &M) {
|
|||||||
// Check to see if this is a special global used by LLVM, if so, emit it.
|
// Check to see if this is a special global used by LLVM, if so, emit it.
|
||||||
if (EmitSpecialLLVMGlobal(I))
|
if (EmitSpecialLLVMGlobal(I))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
O << "\n\n";
|
O << "\n\n";
|
||||||
std::string name = Mang->getValueName(I);
|
std::string name = Mang->getValueName(I);
|
||||||
Constant *C = I->getInitializer();
|
Constant *C = I->getInitializer();
|
||||||
@ -318,9 +318,9 @@ bool IA64AsmPrinter::doFinalization(Module &M) {
|
|||||||
cerr << "DLLExport linkage is not supported by this target!\n";
|
cerr << "DLLExport linkage is not supported by this target!\n";
|
||||||
abort();
|
abort();
|
||||||
default:
|
default:
|
||||||
assert(0 && "Unknown linkage type!");
|
assert(0 && "Unknown linkage type!");
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitAlignment(Align);
|
EmitAlignment(Align);
|
||||||
O << "\t.type " << name << ",@object\n";
|
O << "\t.type " << name << ",@object\n";
|
||||||
O << "\t.size " << name << "," << Size << "\n";
|
O << "\t.size " << name << "," << Size << "\n";
|
||||||
@ -328,15 +328,15 @@ bool IA64AsmPrinter::doFinalization(Module &M) {
|
|||||||
EmitGlobalConstant(C);
|
EmitGlobalConstant(C);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we print out ".global X \n .type X, @function" for each external function
|
// we print out ".global X \n .type X, @function" for each external function
|
||||||
O << "\n\n// br.call targets referenced (and not defined) above: \n";
|
O << "\n\n// br.call targets referenced (and not defined) above: \n";
|
||||||
for (std::set<std::string>::iterator i = ExternalFunctionNames.begin(),
|
for (std::set<std::string>::iterator i = ExternalFunctionNames.begin(),
|
||||||
e = ExternalFunctionNames.end(); i!=e; ++i) {
|
e = ExternalFunctionNames.end(); i!=e; ++i) {
|
||||||
O << "\t.global " << *i << "\n\t.type " << *i << ", @function\n";
|
O << "\t.global " << *i << "\n\t.type " << *i << ", @function\n";
|
||||||
}
|
}
|
||||||
O << "\n\n";
|
O << "\n\n";
|
||||||
|
|
||||||
// we print out ".global X \n .type X, @object" for each external object
|
// we print out ".global X \n .type X, @object" for each external object
|
||||||
O << "\n\n// (external) symbols referenced (and not defined) above: \n";
|
O << "\n\n// (external) symbols referenced (and not defined) above: \n";
|
||||||
for (std::set<std::string>::iterator i = ExternalObjectNames.begin(),
|
for (std::set<std::string>::iterator i = ExternalObjectNames.begin(),
|
||||||
@ -344,7 +344,7 @@ bool IA64AsmPrinter::doFinalization(Module &M) {
|
|||||||
O << "\t.global " << *i << "\n\t.type " << *i << ", @object\n";
|
O << "\t.global " << *i << "\n\t.type " << *i << ", @object\n";
|
||||||
}
|
}
|
||||||
O << "\n\n";
|
O << "\n\n";
|
||||||
|
|
||||||
return AsmPrinter::doFinalization(M);
|
return AsmPrinter::doFinalization(M);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,5 +356,3 @@ FunctionPass *llvm::createIA64CodePrinterPass(std::ostream &o,
|
|||||||
IA64TargetMachine &tm) {
|
IA64TargetMachine &tm) {
|
||||||
return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo());
|
return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user