* 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:
Chris Lattner 2002-02-03 07:48:06 +00:00
parent 884f4b5af0
commit c019a17137

View File

@ -10,10 +10,9 @@
#include "SparcInternals.h"
#include "llvm/Analysis/SlotCalculator.h"
#include "llvm/Transforms/Linker.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineCodeForMethod.h"
#include "llvm/GlobalVariable.h"
#include "llvm/GlobalValue.h"
#include "llvm/ConstantVals.h"
#include "llvm/DerivedTypes.h"
#include "llvm/BasicBlock.h"
@ -21,7 +20,6 @@
#include "llvm/Module.h"
#include "Support/StringExtras.h"
#include "Support/HashExtras.h"
#include <locale.h>
using std::string;
namespace {
@ -48,14 +46,11 @@ class SparcAsmPrinter {
public:
inline SparcAsmPrinter(std::ostream &o, const Module *M, const UltraSparc &t)
: toAsm(o), Table(SlotCalculator(M, true)), Target(t), CurSection(Unknown) {
emitModule(M);
}
private :
void emitModule(const Module *M);
void emitMethod(const Method *M);
void emitGlobalsAndConstants(const Module* module);
//void processMethodArgument(const MethodArgument *MA);
void emitGlobalsAndConstants(const Module *M);
private :
void emitBasicBlock(const BasicBlock *BB);
void emitMachineInst(const MachineInstr *MI);
@ -453,11 +448,6 @@ ConstantToSize(const Constant* CV, const TargetMachine& target)
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.
@ -606,7 +596,7 @@ SparcAsmPrinter::printGlobalVariable(const GlobalVariable* GV)
<< TypeToAlignment(GV->getType()->getElementType(), Target) << "\n";
toAsm << "\t.type\t" << getID(GV) << ",#object\n";
toAsm << "\t.reserve\t" << getID(GV) << ","
<< TypeToSize(GV->getType()->getElementType(), Target)
<< Target.findOptimalStorageSize(GV->getType()->getElementType())
<< "\n";
}
}
@ -685,27 +675,30 @@ SparcAsmPrinter::emitGlobalsAndConstants(const Module *M)
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
//
// 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
// method. The specified method must have been compiled before this may be
// used.
//
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);
}