mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-02 19:24:25 +00:00
* No longer need lowerallocation pass
* Add X86 Stackifier pass * Add peephole optimizer pass git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5233 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
#include "X86TargetMachine.h"
|
#include "X86TargetMachine.h"
|
||||||
#include "X86.h"
|
#include "X86.h"
|
||||||
#include "llvm/Transforms/Scalar.h"
|
|
||||||
#include "llvm/Target/TargetMachineImpls.h"
|
#include "llvm/Target/TargetMachineImpls.h"
|
||||||
#include "llvm/CodeGen/MachineFunction.h"
|
#include "llvm/CodeGen/MachineFunction.h"
|
||||||
|
#include "llvm/CodeGen/Passes.h"
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "Support/CommandLine.h"
|
#include "Support/CommandLine.h"
|
||||||
#include "Support/Statistic.h"
|
#include "Support/Statistic.h"
|
||||||
@ -40,21 +40,17 @@ X86TargetMachine::X86TargetMachine(unsigned Config)
|
|||||||
FrameInfo(TargetFrameInfo::StackGrowsDown, 1/*16*/, 0) {
|
FrameInfo(TargetFrameInfo::StackGrowsDown, 1/*16*/, 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// addPassesToJITCompile - Add passes to the specified pass manager to
|
/// addPassesToJITCompile - Add passes to the specified pass manager to
|
||||||
/// implement a fast dynamic compiler for this target. Return true if this is
|
/// implement a fast dynamic compiler for this target. Return true if this is
|
||||||
/// not supported for this target.
|
/// not supported for this target.
|
||||||
///
|
///
|
||||||
bool X86TargetMachine::addPassesToJITCompile(PassManager &PM) {
|
bool X86TargetMachine::addPassesToJITCompile(PassManager &PM) {
|
||||||
// For the moment we have decided that malloc and free will be
|
|
||||||
// taken care of by converting them to calls, using the existing
|
|
||||||
// LLVM scalar transforms pass to do this.
|
|
||||||
PM.add(createLowerAllocationsPass());
|
|
||||||
|
|
||||||
PM.add(createSimpleX86InstructionSelector(*this));
|
PM.add(createSimpleX86InstructionSelector(*this));
|
||||||
|
|
||||||
// TODO: optional optimizations go here
|
// TODO: optional optimizations go here
|
||||||
|
|
||||||
|
// FIXME: Add SSA based peephole optimizer here.
|
||||||
|
|
||||||
// Print the instruction selected machine code...
|
// Print the instruction selected machine code...
|
||||||
if (PrintCode)
|
if (PrintCode)
|
||||||
PM.add(createMachineFunctionPrinterPass());
|
PM.add(createMachineFunctionPrinterPass());
|
||||||
@ -65,17 +61,22 @@ bool X86TargetMachine::addPassesToJITCompile(PassManager &PM) {
|
|||||||
else
|
else
|
||||||
PM.add(createLocalRegisterAllocator());
|
PM.add(createLocalRegisterAllocator());
|
||||||
|
|
||||||
|
if (PrintCode)
|
||||||
|
PM.add(createMachineFunctionPrinterPass());
|
||||||
|
|
||||||
|
PM.add(createX86FloatingPointStackifierPass());
|
||||||
|
|
||||||
if (PrintCode)
|
if (PrintCode)
|
||||||
PM.add(createMachineFunctionPrinterPass());
|
PM.add(createMachineFunctionPrinterPass());
|
||||||
|
|
||||||
// Insert prolog/epilog code. Eliminate abstract frame index references...
|
// Insert prolog/epilog code. Eliminate abstract frame index references...
|
||||||
PM.add(createPrologEpilogCodeInserter());
|
PM.add(createPrologEpilogCodeInserter());
|
||||||
|
|
||||||
|
PM.add(createX86PeepholeOptimizerPass());
|
||||||
|
|
||||||
if (PrintCode) // Print the register-allocated code
|
if (PrintCode) // Print the register-allocated code
|
||||||
PM.add(createX86CodePrinterPass(std::cerr));
|
PM.add(createX86CodePrinterPass(std::cerr));
|
||||||
|
|
||||||
PM.add(createMachineCodeDestructionPass());
|
|
||||||
|
|
||||||
return false; // success!
|
return false; // success!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user