mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-11 16:37:42 +00:00
Move PPCJITInfo off of the TargetMachine and onto the subtarget.
Needed to migrate a few functions around to avoid circular header dependencies. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210845 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ad807370e9
commit
4ecff11794
@ -13,7 +13,7 @@
|
||||
|
||||
#include "PPCJITInfo.h"
|
||||
#include "PPCRelocations.h"
|
||||
#include "PPCTargetMachine.h"
|
||||
#include "PPCSubtarget.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
@ -25,6 +25,11 @@ using namespace llvm;
|
||||
|
||||
static TargetJITInfo::JITCompilerFn JITCompilerFunction;
|
||||
|
||||
PPCJITInfo::PPCJITInfo(PPCSubtarget &STI)
|
||||
: Subtarget(STI), is64Bit(STI.isPPC64()) {
|
||||
useGOT = 0;
|
||||
}
|
||||
|
||||
#define BUILD_ADDIS(RD,RS,IMM16) \
|
||||
((15 << 26) | ((RD) << 21) | ((RS) << 16) | ((IMM16) & 65535))
|
||||
#define BUILD_ORI(RD,RS,UIMM16) \
|
||||
|
@ -14,36 +14,33 @@
|
||||
#ifndef POWERPC_JITINFO_H
|
||||
#define POWERPC_JITINFO_H
|
||||
|
||||
#include "PPCSubtarget.h"
|
||||
#include "llvm/CodeGen/JITCodeEmitter.h"
|
||||
#include "llvm/Target/TargetJITInfo.h"
|
||||
|
||||
namespace llvm {
|
||||
class PPCSubtarget;
|
||||
class PPCJITInfo : public TargetJITInfo {
|
||||
protected:
|
||||
PPCSubtarget &Subtarget;
|
||||
bool is64Bit;
|
||||
|
||||
class PPCJITInfo : public TargetJITInfo {
|
||||
protected:
|
||||
PPCSubtarget &Subtarget;
|
||||
bool is64Bit;
|
||||
public:
|
||||
PPCJITInfo(PPCSubtarget &STI)
|
||||
: Subtarget(STI), is64Bit(STI.isPPC64()) {
|
||||
useGOT = 0;
|
||||
}
|
||||
public:
|
||||
PPCJITInfo(PPCSubtarget &STI);
|
||||
|
||||
StubLayout getStubLayout() override;
|
||||
void *emitFunctionStub(const Function* F, void *Fn,
|
||||
JITCodeEmitter &JCE) override;
|
||||
LazyResolverFn getLazyResolverFunction(JITCompilerFn) override;
|
||||
void relocate(void *Function, MachineRelocation *MR,
|
||||
unsigned NumRelocs, unsigned char* GOTBase) override;
|
||||
StubLayout getStubLayout() override;
|
||||
void *emitFunctionStub(const Function *F, void *Fn,
|
||||
JITCodeEmitter &JCE) override;
|
||||
LazyResolverFn getLazyResolverFunction(JITCompilerFn) override;
|
||||
void relocate(void *Function, MachineRelocation *MR, unsigned NumRelocs,
|
||||
unsigned char *GOTBase) override;
|
||||
|
||||
/// replaceMachineCodeForFunction - Make it so that calling the function
|
||||
/// whose machine code is at OLD turns into a call to NEW, perhaps by
|
||||
/// overwriting OLD with a branch to NEW. This is used for self-modifying
|
||||
/// code.
|
||||
///
|
||||
void replaceMachineCodeForFunction(void *Old, void *New) override;
|
||||
};
|
||||
/// replaceMachineCodeForFunction - Make it so that calling the function
|
||||
/// whose machine code is at OLD turns into a call to NEW, perhaps by
|
||||
/// overwriting OLD with a branch to NEW. This is used for self-modifying
|
||||
/// code.
|
||||
///
|
||||
void replaceMachineCodeForFunction(void *Old, void *New) override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -80,7 +80,7 @@ PPCSubtarget::PPCSubtarget(const std::string &TT, const std::string &CPU,
|
||||
: PPCGenSubtargetInfo(TT, CPU, FS), IsPPC64(is64Bit), TargetTriple(TT),
|
||||
OptLevel(OptLevel),
|
||||
FrameLowering(initializeSubtargetDependencies(CPU, FS)),
|
||||
DL(getDataLayoutString(*this)), InstrInfo(*this) {}
|
||||
DL(getDataLayoutString(*this)), InstrInfo(*this), JITInfo(*this) {}
|
||||
|
||||
/// SetJITMode - This is called to inform the subtarget info that we are
|
||||
/// producing code for the JIT.
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "PPCFrameLowering.h"
|
||||
#include "PPCInstrInfo.h"
|
||||
#include "PPCJITInfo.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/MC/MCInstrItineraries.h"
|
||||
@ -105,9 +106,10 @@ protected:
|
||||
/// OptLevel - What default optimization level we're emitting code for.
|
||||
CodeGenOpt::Level OptLevel;
|
||||
|
||||
PPCFrameLowering FrameLowering;
|
||||
PPCFrameLowering FrameLowering;
|
||||
const DataLayout DL;
|
||||
PPCInstrInfo InstrInfo;
|
||||
PPCJITInfo JITInfo;
|
||||
|
||||
public:
|
||||
/// This constructor initializes the data members to match that
|
||||
@ -141,6 +143,7 @@ public:
|
||||
const PPCFrameLowering *getFrameLowering() const { return &FrameLowering; }
|
||||
const DataLayout *getDataLayout() const { return &DL; }
|
||||
const PPCInstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||
PPCJITInfo *getJITInfo() { return &JITInfo; }
|
||||
|
||||
/// initializeSubtargetDependencies - Initializes using a CPU and feature string
|
||||
/// so that we can use initializer lists for subtarget initialization.
|
||||
|
@ -42,8 +42,7 @@ PPCTargetMachine::PPCTargetMachine(const Target &T, StringRef TT, StringRef CPU,
|
||||
Reloc::Model RM, CodeModel::Model CM,
|
||||
CodeGenOpt::Level OL, bool is64Bit)
|
||||
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
|
||||
Subtarget(TT, CPU, FS, is64Bit, OL), JITInfo(Subtarget),
|
||||
TLInfo(*this), TSInfo(*this) {
|
||||
Subtarget(TT, CPU, FS, is64Bit, OL), TLInfo(*this), TSInfo(*this) {
|
||||
initAsmInfo();
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ namespace llvm {
|
||||
///
|
||||
class PPCTargetMachine : public LLVMTargetMachine {
|
||||
PPCSubtarget Subtarget;
|
||||
PPCJITInfo JITInfo;
|
||||
PPCTargetLowering TLInfo;
|
||||
PPCSelectionDAGInfo TSInfo;
|
||||
|
||||
@ -45,7 +44,7 @@ public:
|
||||
const PPCFrameLowering *getFrameLowering() const override {
|
||||
return getSubtargetImpl()->getFrameLowering();
|
||||
}
|
||||
PPCJITInfo *getJITInfo() override { return &JITInfo; }
|
||||
PPCJITInfo *getJITInfo() override { return Subtarget.getJITInfo(); }
|
||||
const PPCTargetLowering *getTargetLowering() const override {
|
||||
return &TLInfo;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user