-
-//===---------------------------------------------------------------------===//
-// GenerateCodeForTarget Pass
-//
-// Native code generation for a specified target.
-//===---------------------------------------------------------------------===//
-
-class ConstructMachineCodeForMethod : public MethodPass {
- TargetMachine &Target;
-public:
- inline ConstructMachineCodeForMethod(TargetMachine &T) : Target(T) {}
- bool runOnMethod(Method *M) {
- MachineCodeForMethod::construct(M, Target);
- return false;
- }
-};
-
-class InstructionSelection : public MethodPass {
- TargetMachine &Target;
-public:
- inline InstructionSelection(TargetMachine &T) : Target(T) {}
- bool runOnMethod(Method *M) {
- if (SelectInstructionsForMethod(M, Target))
- cerr << "Instr selection failed for method " << M->getName() << "\n";
- return false;
- }
-};
-
-class InstructionScheduling : public MethodPass {
- TargetMachine &Target;
-public:
- inline InstructionScheduling(TargetMachine &T) : Target(T) {}
- bool runOnMethod(Method *M) {
- if (ScheduleInstructionsWithSSA(M, Target))
- cerr << "Instr scheduling failed for method " << M->getName() << "\n\n";
- return false;
- }
-};
-
-struct FreeMachineCodeForMethod : public MethodPass {
- static void freeMachineCode(Instruction *I) {
- MachineCodeForInstruction::destroy(I);
- }
-
- bool runOnMethod(Method *M) {
- for_each(M->inst_begin(), M->inst_end(), freeMachineCode);
- // Don't destruct MachineCodeForMethod - The global printer needs it
- //MachineCodeForMethod::destruct(M);
- return false;
- }
-};
-
-
-