X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FSparcV9%2FSparcV9TargetMachine.cpp;h=faed36c32a8e18fddde85239bb43f7330f564ab8;hb=601899d196db343670943285c8f989534710937e;hp=7ec0a348b1aa94ecdd3bc73bdee87b51a85467c5;hpb=4f9463772b10638c51226cbfb9b10e06f22d1cbc;p=oota-llvm.git diff --git a/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp index 7ec0a348b1a..faed36c32a8 100644 --- a/lib/Target/SparcV9/SparcV9TargetMachine.cpp +++ b/lib/Target/SparcV9/SparcV9TargetMachine.cpp @@ -6,7 +6,7 @@ //===----------------------------------------------------------------------===// #include "SparcInternals.h" -#include "llvm/Target/Sparc.h" +#include "llvm/Target/TargetMachineImpls.h" #include "llvm/Function.h" #include "llvm/PassManager.h" #include "llvm/Transforms/Scalar.h" @@ -28,7 +28,7 @@ const MachineInstrDescriptor SparcMachineInstrDesc[] = { #define I(ENUM, OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \ NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS) \ { OPCODESTRING, NUMOPERANDS, RESULTPOS, MAXIMM, IMMSE, \ - NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS }, + NUMDELAYSLOTS, LATENCY, SCHEDCLASS, INSTFLAGS, 0 }, #include "SparcInstr.def" }; @@ -113,48 +113,6 @@ UltraSparcFrameInfo::getDynamicAreaOffset(MachineFunction& mcInfo, return offset; } -//===---------------------------------------------------------------------===// -// Default code generation passes. -// -// Native code generation for a specified target. -//===---------------------------------------------------------------------===// - -class ConstructMachineCodeForFunction : public FunctionPass { - TargetMachine &Target; -public: - ConstructMachineCodeForFunction(TargetMachine &T) : Target(T) {} - - const char *getPassName() const { - return "ConstructMachineCodeForFunction"; - } - - bool runOnFunction(Function &F) { - MachineFunction::construct(&F, Target); - return false; - } -}; - -struct FreeMachineCodeForFunction : public FunctionPass { - const char *getPassName() const { return "FreeMachineCodeForFunction"; } - - static void freeMachineCode(Instruction &I) { - MachineCodeForInstruction::destroy(&I); - } - - bool runOnFunction(Function &F) { - for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) - for (BasicBlock::iterator I = FI->begin(), E = FI->end(); I != E; ++I) - MachineCodeForInstruction::get(I).dropAllReferences(); - - for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) - for_each(FI->begin(), FI->end(), freeMachineCode); - - return false; - } -}; - - - //--------------------------------------------------------------------------- // class UltraSparcMachine // @@ -167,27 +125,22 @@ struct FreeMachineCodeForFunction : public FunctionPass { //--------------------------------------------------------------------------- UltraSparc::UltraSparc() - : TargetMachine("UltraSparc-Native"), - instrInfo(*this), + : TargetMachine("UltraSparc-Native", 4), schedInfo(*this), regInfo(*this), frameInfo(*this), cacheInfo(*this), - optInfo(*this) -{ - optSizeForSubWordData = 4; - minMemOpWordSize = 8; - maxAtomicMemOpWordSize = 8; + optInfo(*this) { } // addPassesToEmitAssembly - This method controls the entire code generation // process for the ultra sparc. // -void UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) +bool UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) { // Construct and initialize the MachineFunction object for this fn. - PM.add(new ConstructMachineCodeForFunction(*this)); + PM.add(createMachineCodeConstructionPass(*this)); //Insert empty stackslots in the stack frame of each function //so %fp+offset-8 and %fp+offset-16 are empty slots now! @@ -224,7 +177,7 @@ void UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) // function has been emitted. // PM.add(getFunctionAsmPrinterPass(Out)); - PM.add(new FreeMachineCodeForFunction()); // Free stuff no longer needed + PM.add(createMachineCodeDestructionPass()); // Free stuff no longer needed // Emit Module level assembly after all of the functions have been processed. PM.add(getModuleAsmPrinterPass(Out)); @@ -232,4 +185,5 @@ void UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) // Emit bytecode to the assembly file into its special section next PM.add(getEmitBytecodeToAsmPass(Out)); PM.add(getFunctionInfo(Out)); + return false; }