mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 01:24:30 +00:00
Move the subtarget dependent features from the target machine to
the subtarget for the MSP430 target. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211836 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -25,12 +25,15 @@ using namespace llvm;
|
|||||||
|
|
||||||
void MSP430Subtarget::anchor() { }
|
void MSP430Subtarget::anchor() { }
|
||||||
|
|
||||||
MSP430Subtarget::MSP430Subtarget(const std::string &TT,
|
MSP430Subtarget &MSP430Subtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
|
||||||
const std::string &CPU,
|
ParseSubtargetFeatures("generic", FS);
|
||||||
const std::string &FS) :
|
return *this;
|
||||||
MSP430GenSubtargetInfo(TT, CPU, FS) {
|
|
||||||
std::string CPUName = "generic";
|
|
||||||
|
|
||||||
// Parse features string.
|
|
||||||
ParseSubtargetFeatures(CPUName, FS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MSP430Subtarget::MSP430Subtarget(const std::string &TT, const std::string &CPU,
|
||||||
|
const std::string &FS, const TargetMachine &TM)
|
||||||
|
: MSP430GenSubtargetInfo(TT, CPU, FS),
|
||||||
|
// FIXME: Check DataLayout string.
|
||||||
|
DL("e-m:e-p:16:16-i32:16:32-n8:16"), FrameLowering(),
|
||||||
|
InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM),
|
||||||
|
TSInfo(DL) {}
|
||||||
|
@ -14,6 +14,12 @@
|
|||||||
#ifndef LLVM_TARGET_MSP430_SUBTARGET_H
|
#ifndef LLVM_TARGET_MSP430_SUBTARGET_H
|
||||||
#define LLVM_TARGET_MSP430_SUBTARGET_H
|
#define LLVM_TARGET_MSP430_SUBTARGET_H
|
||||||
|
|
||||||
|
#include "MSP430FrameLowering.h"
|
||||||
|
#include "MSP430InstrInfo.h"
|
||||||
|
#include "MSP430ISelLowering.h"
|
||||||
|
#include "MSP430RegisterInfo.h"
|
||||||
|
#include "MSP430SelectionDAGInfo.h"
|
||||||
|
#include "llvm/IR/DataLayout.h"
|
||||||
#include "llvm/Target/TargetSubtargetInfo.h"
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -26,16 +32,33 @@ class StringRef;
|
|||||||
class MSP430Subtarget : public MSP430GenSubtargetInfo {
|
class MSP430Subtarget : public MSP430GenSubtargetInfo {
|
||||||
virtual void anchor();
|
virtual void anchor();
|
||||||
bool ExtendedInsts;
|
bool ExtendedInsts;
|
||||||
|
const DataLayout DL; // Calculates type size & alignment
|
||||||
|
MSP430FrameLowering FrameLowering;
|
||||||
|
MSP430InstrInfo InstrInfo;
|
||||||
|
MSP430TargetLowering TLInfo;
|
||||||
|
MSP430SelectionDAGInfo TSInfo;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// This constructor initializes the data members to match that
|
/// This constructor initializes the data members to match that
|
||||||
/// of the specified triple.
|
/// of the specified triple.
|
||||||
///
|
///
|
||||||
MSP430Subtarget(const std::string &TT, const std::string &CPU,
|
MSP430Subtarget(const std::string &TT, const std::string &CPU,
|
||||||
const std::string &FS);
|
const std::string &FS, const TargetMachine &TM);
|
||||||
|
|
||||||
|
MSP430Subtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
|
||||||
|
|
||||||
/// ParseSubtargetFeatures - Parses features string setting specified
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
||||||
/// subtarget options. Definition of function is auto generated by tblgen.
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
||||||
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
|
||||||
|
|
||||||
|
const TargetFrameLowering *getFrameLowering() const { return &FrameLowering; }
|
||||||
|
const MSP430InstrInfo *getInstrInfo() const { return &InstrInfo; }
|
||||||
|
const DataLayout *getDataLayout() const { return &DL; }
|
||||||
|
const TargetRegisterInfo *getRegisterInfo() const {
|
||||||
|
return &InstrInfo.getRegisterInfo();
|
||||||
|
}
|
||||||
|
const MSP430TargetLowering *getTargetLowering() const { return &TLInfo; }
|
||||||
|
const MSP430SelectionDAGInfo *getSelectionDAGInfo() const { return &TSInfo; }
|
||||||
};
|
};
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
|
@ -24,19 +24,13 @@ extern "C" void LLVMInitializeMSP430Target() {
|
|||||||
RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target);
|
RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target);
|
||||||
}
|
}
|
||||||
|
|
||||||
MSP430TargetMachine::MSP430TargetMachine(const Target &T,
|
MSP430TargetMachine::MSP430TargetMachine(const Target &T, StringRef TT,
|
||||||
StringRef TT,
|
StringRef CPU, StringRef FS,
|
||||||
StringRef CPU,
|
|
||||||
StringRef FS,
|
|
||||||
const TargetOptions &Options,
|
const TargetOptions &Options,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Reloc::Model RM, CodeModel::Model CM,
|
||||||
CodeGenOpt::Level OL)
|
CodeGenOpt::Level OL)
|
||||||
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
|
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
|
||||||
Subtarget(TT, CPU, FS),
|
Subtarget(TT, CPU, FS, *this) {
|
||||||
// FIXME: Check DataLayout string.
|
|
||||||
DL("e-m:e-p:16:16-i32:16:32-n8:16"),
|
|
||||||
InstrInfo(Subtarget), TLInfo(*this), TSInfo(DL),
|
|
||||||
FrameLowering() {
|
|
||||||
initAsmInfo();
|
initAsmInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,13 +15,7 @@
|
|||||||
#ifndef LLVM_TARGET_MSP430_TARGETMACHINE_H
|
#ifndef LLVM_TARGET_MSP430_TARGETMACHINE_H
|
||||||
#define LLVM_TARGET_MSP430_TARGETMACHINE_H
|
#define LLVM_TARGET_MSP430_TARGETMACHINE_H
|
||||||
|
|
||||||
#include "MSP430FrameLowering.h"
|
|
||||||
#include "MSP430ISelLowering.h"
|
|
||||||
#include "MSP430InstrInfo.h"
|
|
||||||
#include "MSP430RegisterInfo.h"
|
|
||||||
#include "MSP430SelectionDAGInfo.h"
|
|
||||||
#include "MSP430Subtarget.h"
|
#include "MSP430Subtarget.h"
|
||||||
#include "llvm/IR/DataLayout.h"
|
|
||||||
#include "llvm/Target/TargetFrameLowering.h"
|
#include "llvm/Target/TargetFrameLowering.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
|
|
||||||
@ -31,11 +25,6 @@ namespace llvm {
|
|||||||
///
|
///
|
||||||
class MSP430TargetMachine : public LLVMTargetMachine {
|
class MSP430TargetMachine : public LLVMTargetMachine {
|
||||||
MSP430Subtarget Subtarget;
|
MSP430Subtarget Subtarget;
|
||||||
const DataLayout DL; // Calculates type size & alignment
|
|
||||||
MSP430InstrInfo InstrInfo;
|
|
||||||
MSP430TargetLowering TLInfo;
|
|
||||||
MSP430SelectionDAGInfo TSInfo;
|
|
||||||
MSP430FrameLowering FrameLowering;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MSP430TargetMachine(const Target &T, StringRef TT,
|
MSP430TargetMachine(const Target &T, StringRef TT,
|
||||||
@ -44,22 +33,25 @@ public:
|
|||||||
CodeGenOpt::Level OL);
|
CodeGenOpt::Level OL);
|
||||||
|
|
||||||
const TargetFrameLowering *getFrameLowering() const override {
|
const TargetFrameLowering *getFrameLowering() const override {
|
||||||
return &FrameLowering;
|
return getSubtargetImpl()->getFrameLowering();
|
||||||
|
}
|
||||||
|
const MSP430InstrInfo *getInstrInfo() const override {
|
||||||
|
return getSubtargetImpl()->getInstrInfo();
|
||||||
|
}
|
||||||
|
const DataLayout *getDataLayout() const override {
|
||||||
|
return getSubtargetImpl()->getDataLayout();
|
||||||
|
}
|
||||||
|
const MSP430Subtarget *getSubtargetImpl() const override {
|
||||||
|
return &Subtarget;
|
||||||
}
|
}
|
||||||
const MSP430InstrInfo *getInstrInfo() const override { return &InstrInfo; }
|
|
||||||
const DataLayout *getDataLayout() const override { return &DL;}
|
|
||||||
const MSP430Subtarget *getSubtargetImpl() const override { return &Subtarget; }
|
|
||||||
|
|
||||||
const TargetRegisterInfo *getRegisterInfo() const override {
|
const TargetRegisterInfo *getRegisterInfo() const override {
|
||||||
return &InstrInfo.getRegisterInfo();
|
return getSubtargetImpl()->getRegisterInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
const MSP430TargetLowering *getTargetLowering() const override {
|
const MSP430TargetLowering *getTargetLowering() const override {
|
||||||
return &TLInfo;
|
return getSubtargetImpl()->getTargetLowering();
|
||||||
}
|
}
|
||||||
|
const MSP430SelectionDAGInfo *getSelectionDAGInfo() const override {
|
||||||
const MSP430SelectionDAGInfo* getSelectionDAGInfo() const override {
|
return getSubtargetImpl()->getSelectionDAGInfo();
|
||||||
return &TSInfo;
|
|
||||||
}
|
}
|
||||||
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
|
||||||
}; // MSP430TargetMachine.
|
}; // MSP430TargetMachine.
|
||||||
|
Reference in New Issue
Block a user