mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
* prune #includes
* Implement permethod output of machine code to assembly git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1652 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -10,10 +10,9 @@
|
|||||||
|
|
||||||
#include "SparcInternals.h"
|
#include "SparcInternals.h"
|
||||||
#include "llvm/Analysis/SlotCalculator.h"
|
#include "llvm/Analysis/SlotCalculator.h"
|
||||||
#include "llvm/Transforms/Linker.h"
|
|
||||||
#include "llvm/CodeGen/MachineInstr.h"
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
|
#include "llvm/CodeGen/MachineCodeForMethod.h"
|
||||||
#include "llvm/GlobalVariable.h"
|
#include "llvm/GlobalVariable.h"
|
||||||
#include "llvm/GlobalValue.h"
|
|
||||||
#include "llvm/ConstantVals.h"
|
#include "llvm/ConstantVals.h"
|
||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/BasicBlock.h"
|
#include "llvm/BasicBlock.h"
|
||||||
@@ -21,7 +20,6 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "Support/StringExtras.h"
|
#include "Support/StringExtras.h"
|
||||||
#include "Support/HashExtras.h"
|
#include "Support/HashExtras.h"
|
||||||
#include <locale.h>
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -48,14 +46,11 @@ class SparcAsmPrinter {
|
|||||||
public:
|
public:
|
||||||
inline SparcAsmPrinter(std::ostream &o, const Module *M, const UltraSparc &t)
|
inline SparcAsmPrinter(std::ostream &o, const Module *M, const UltraSparc &t)
|
||||||
: toAsm(o), Table(SlotCalculator(M, true)), Target(t), CurSection(Unknown) {
|
: toAsm(o), Table(SlotCalculator(M, true)), Target(t), CurSection(Unknown) {
|
||||||
emitModule(M);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private :
|
|
||||||
void emitModule(const Module *M);
|
|
||||||
void emitMethod(const Method *M);
|
void emitMethod(const Method *M);
|
||||||
void emitGlobalsAndConstants(const Module* module);
|
void emitGlobalsAndConstants(const Module *M);
|
||||||
//void processMethodArgument(const MethodArgument *MA);
|
private :
|
||||||
void emitBasicBlock(const BasicBlock *BB);
|
void emitBasicBlock(const BasicBlock *BB);
|
||||||
void emitMachineInst(const MachineInstr *MI);
|
void emitMachineInst(const MachineInstr *MI);
|
||||||
|
|
||||||
@@ -453,11 +448,6 @@ ConstantToSize(const Constant* CV, const TargetMachine& target)
|
|||||||
return target.findOptimalStorageSize(CV->getType());
|
return target.findOptimalStorageSize(CV->getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
unsigned int TypeToSize(const Type* type, const TargetMachine& target)
|
|
||||||
{
|
|
||||||
return target.findOptimalStorageSize(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Align data larger than one L1 cache line on L1 cache line boundaries.
|
// Align data larger than one L1 cache line on L1 cache line boundaries.
|
||||||
@@ -606,7 +596,7 @@ SparcAsmPrinter::printGlobalVariable(const GlobalVariable* GV)
|
|||||||
<< TypeToAlignment(GV->getType()->getElementType(), Target) << "\n";
|
<< TypeToAlignment(GV->getType()->getElementType(), Target) << "\n";
|
||||||
toAsm << "\t.type\t" << getID(GV) << ",#object\n";
|
toAsm << "\t.type\t" << getID(GV) << ",#object\n";
|
||||||
toAsm << "\t.reserve\t" << getID(GV) << ","
|
toAsm << "\t.reserve\t" << getID(GV) << ","
|
||||||
<< TypeToSize(GV->getType()->getElementType(), Target)
|
<< Target.findOptimalStorageSize(GV->getType()->getElementType())
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -685,27 +675,30 @@ SparcAsmPrinter::emitGlobalsAndConstants(const Module *M)
|
|||||||
toAsm << "\n";
|
toAsm << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
SparcAsmPrinter::emitModule(const Module *M)
|
|
||||||
{
|
|
||||||
// TODO: Look for a filename annotation on M to emit a .file directive
|
|
||||||
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
|
|
||||||
emitMethod(*I);
|
|
||||||
|
|
||||||
emitGlobalsAndConstants(M);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End anonymous namespace
|
} // End anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// emitAssembly - Output assembly language code (a .s file) for global
|
||||||
|
// components of the specified module. This assumes that methods have been
|
||||||
|
// previously output.
|
||||||
|
//
|
||||||
|
void
|
||||||
|
UltraSparc::emitAssembly(const Method *M, std::ostream &OutStr) const
|
||||||
|
{
|
||||||
|
SparcAsmPrinter Print(OutStr, M->getParent(), *this);
|
||||||
|
Print.emitMethod(M);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// emitAssembly - Output assembly language code (a .s file) for the specified
|
// emitAssembly - Output assembly language code (a .s file) for the specified
|
||||||
// method. The specified method must have been compiled before this may be
|
// method. The specified method must have been compiled before this may be
|
||||||
// used.
|
// used.
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
UltraSparc::emitAssembly(const Module *M, std::ostream &toAsm) const
|
UltraSparc::emitAssembly(const Module *M, std::ostream &OutStr) const
|
||||||
{
|
{
|
||||||
SparcAsmPrinter Print(toAsm, M, *this);
|
SparcAsmPrinter Print(OutStr, M, *this);
|
||||||
|
Print.emitGlobalsAndConstants(M);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user