From 86a8790826c253dd56e10902abdcd7f87c2cbdaa Mon Sep 17 00:00:00 2001 From: Brian Gaeke Date: Tue, 6 Apr 2004 23:21:24 +0000 Subject: [PATCH] Add references to delay slot filler pass. Fill in addPassesToJITCompile method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12729 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Sparc/Sparc.h | 1 + lib/Target/Sparc/SparcTargetMachine.cpp | 24 ++++++++++++++++++++- lib/Target/SparcV8/SparcV8.h | 1 + lib/Target/SparcV8/SparcV8TargetMachine.cpp | 24 ++++++++++++++++++++- 4 files changed, 48 insertions(+), 2 deletions(-) diff --git a/lib/Target/Sparc/Sparc.h b/lib/Target/Sparc/Sparc.h index 1cade3cd854..44ee15aeae8 100644 --- a/lib/Target/Sparc/Sparc.h +++ b/lib/Target/Sparc/Sparc.h @@ -25,6 +25,7 @@ namespace llvm { FunctionPass *createSparcV8SimpleInstructionSelector(TargetMachine &TM); FunctionPass *createSparcV8CodePrinterPass(std::ostream &OS, TargetMachine &TM); + FunctionPass *createSparcV8DelaySlotFillerPass(TargetMachine &TM); } // end namespace llvm; diff --git a/lib/Target/Sparc/SparcTargetMachine.cpp b/lib/Target/Sparc/SparcTargetMachine.cpp index 1b5b80abdbc..9cd97ee496b 100644 --- a/lib/Target/Sparc/SparcTargetMachine.cpp +++ b/lib/Target/Sparc/SparcTargetMachine.cpp @@ -54,6 +54,12 @@ bool SparcV8TargetMachine::addPassesToEmitAssembly(PassManager &PM, if (PrintMachineCode) PM.add(createMachineFunctionPrinterPass(&std::cerr)); + PM.add(createSparcV8DelaySlotFillerPass(*this)); + + // Print machine instructions after filling delay slots. + if (PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + // Output assembly language. PM.add(createSparcV8CodePrinterPass(Out, *this)); @@ -66,7 +72,23 @@ bool SparcV8TargetMachine::addPassesToEmitAssembly(PassManager &PM, /// implement a fast dynamic compiler for this target. /// void SparcV8JITInfo::addPassesToJITCompile(FunctionPassManager &PM) { - // + PM.add(createSparcV8SimpleInstructionSelector(TM)); + + // Print machine instructions as they were initially generated. + if (PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + PM.add(createRegisterAllocator()); PM.add(createPrologEpilogCodeInserter()); + + // Print machine instructions after register allocation and prolog/epilog + // insertion. + if (PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + + PM.add(createSparcV8DelaySlotFillerPass(TM)); + + // Print machine instructions after filling delay slots. + if (PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); } diff --git a/lib/Target/SparcV8/SparcV8.h b/lib/Target/SparcV8/SparcV8.h index 1cade3cd854..44ee15aeae8 100644 --- a/lib/Target/SparcV8/SparcV8.h +++ b/lib/Target/SparcV8/SparcV8.h @@ -25,6 +25,7 @@ namespace llvm { FunctionPass *createSparcV8SimpleInstructionSelector(TargetMachine &TM); FunctionPass *createSparcV8CodePrinterPass(std::ostream &OS, TargetMachine &TM); + FunctionPass *createSparcV8DelaySlotFillerPass(TargetMachine &TM); } // end namespace llvm; diff --git a/lib/Target/SparcV8/SparcV8TargetMachine.cpp b/lib/Target/SparcV8/SparcV8TargetMachine.cpp index 1b5b80abdbc..9cd97ee496b 100644 --- a/lib/Target/SparcV8/SparcV8TargetMachine.cpp +++ b/lib/Target/SparcV8/SparcV8TargetMachine.cpp @@ -54,6 +54,12 @@ bool SparcV8TargetMachine::addPassesToEmitAssembly(PassManager &PM, if (PrintMachineCode) PM.add(createMachineFunctionPrinterPass(&std::cerr)); + PM.add(createSparcV8DelaySlotFillerPass(*this)); + + // Print machine instructions after filling delay slots. + if (PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + // Output assembly language. PM.add(createSparcV8CodePrinterPass(Out, *this)); @@ -66,7 +72,23 @@ bool SparcV8TargetMachine::addPassesToEmitAssembly(PassManager &PM, /// implement a fast dynamic compiler for this target. /// void SparcV8JITInfo::addPassesToJITCompile(FunctionPassManager &PM) { - // + PM.add(createSparcV8SimpleInstructionSelector(TM)); + + // Print machine instructions as they were initially generated. + if (PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + PM.add(createRegisterAllocator()); PM.add(createPrologEpilogCodeInserter()); + + // Print machine instructions after register allocation and prolog/epilog + // insertion. + if (PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); + + PM.add(createSparcV8DelaySlotFillerPass(TM)); + + // Print machine instructions after filling delay slots. + if (PrintMachineCode) + PM.add(createMachineFunctionPrinterPass(&std::cerr)); }