-
-//===---------------------------------------------------------------------===//
-// GenerateCodeForTarget Pass
-//
-// Native code generation for a specified target.
-//===---------------------------------------------------------------------===//
-
-class ConstructMachineCodeForFunction : public FunctionPass {
- TargetMachine &Target;
-public:
- inline ConstructMachineCodeForFunction(TargetMachine &T) : Target(T) {}
- bool runOnFunction(Function *F) {
- MachineCodeForMethod::construct(F, Target);
- return false;
- }
-};
-
-class InstructionSelection : public FunctionPass {
- TargetMachine &Target;
-public:
- inline InstructionSelection(TargetMachine &T) : Target(T) {}
- bool runOnFunction(Function *F) {
- if (SelectInstructionsForMethod(F, Target)) {
- cerr << "Instr selection failed for function " << F->getName() << "\n";
- abort();
+// addPassesToEmitAssembly - This method controls the entire code generation
+// process for the ultra sparc.
+//
+bool UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out)
+{
+ // Construct and initialize the MachineFunction object for this fn.
+ 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!
+ PM.add(createStackSlotsPass(*this));
+
+ // Specialize LLVM code for this target machine and then
+ // run basic dataflow optimizations on LLVM code.
+ if (!DisablePreSelect)
+ {
+ PM.add(createPreSelectionPass(*this));
+ /* PM.add(createReassociatePass()); */
+ PM.add(createLICMPass());
+ PM.add(createGCSEPass());