LLVM: lib/Target/CSKY/MCTargetDesc/CSKYMCTargetDesc.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
26
27#define GET_INSTRINFO_MC_DESC
28#define ENABLE_INSTR_PREDICATE_VERIFIER
29#include "CSKYGenInstrInfo.inc"
30
31#define GET_REGINFO_MC_DESC
32#include "CSKYGenRegisterInfo.inc"
33
34#define GET_SUBTARGETINFO_MC_DESC
35#include "CSKYGenSubtargetInfo.inc"
36
37using namespace llvm;
38
43
44
45 unsigned Reg = MRI.getDwarfRegNum(CSKY::R14, true);
48 return MAI;
49}
50
53 InitCSKYMCInstrInfo(Info);
55}
56
58 unsigned SyntaxVariant,
63}
64
67 InitCSKYMCRegisterInfo(Info, CSKY::R15);
69}
70
73 std::string CPUName = std::string(CPU);
74 if (CPUName.empty())
75 CPUName = "generic";
76 return createCSKYMCSubtargetInfoImpl(TT, CPUName, CPUName, FS);
77}
78
82 if (TT.isOSBinFormatELF())
84 return nullptr;
85}
86
88 std::unique_ptr &&MAB,
89 std::unique_ptr &&OW,
90 std::unique_ptr &&Emitter) {
93
94 return S;
95}
96
102
106
107namespace {
108
110public:
111 explicit CSKYMCInstrAnalysis(const MCInstrInfo *Info)
112 : MCInstrAnalysis(Info) {}
113
114 bool evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size,
115 uint64_t &Target) const override {
117 int64_t Imm;
120 return true;
121 }
122
123 if (Inst.getOpcode() == CSKY::BSR32) {
125 return true;
126 }
127
129 default:
130 return false;
131 case CSKY::LRW16:
132 case CSKY::LRW32:
133 case CSKY::JSRI32:
134 case CSKY::JMPI32:
136 Target = ((Addr + Imm) & 0xFFFFFFFC);
137 return true;
138 }
139
140 return false;
141 }
142};
143
144}
145
147 return new CSKYMCInstrAnalysis(Info);
148}
149
unsigned const MachineRegisterInfo * MRI
static bool isUnconditionalBranch(Instruction *Term)
Analysis containing CSE Info
static MCSubtargetInfo * createCSKYMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
Definition CSKYMCTargetDesc.cpp:71
static MCInstrInfo * createCSKYMCInstrInfo()
Definition CSKYMCTargetDesc.cpp:51
static MCTargetStreamer * createCSKYObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
Definition CSKYMCTargetDesc.cpp:80
static MCInstrAnalysis * createCSKYInstrAnalysis(const MCInstrInfo *Info)
Definition CSKYMCTargetDesc.cpp:146
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeCSKYTargetMC()
Definition CSKYMCTargetDesc.cpp:150
static MCRegisterInfo * createCSKYMCRegisterInfo(const Triple &TT)
Definition CSKYMCTargetDesc.cpp:65
static MCTargetStreamer * createCSKYAsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrinter)
Definition CSKYMCTargetDesc.cpp:98
static MCAsmInfo * createCSKYMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TT, const MCTargetOptions &Options)
Definition CSKYMCTargetDesc.cpp:39
static MCInstPrinter * createCSKYMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
Definition CSKYMCTargetDesc.cpp:57
static MCTargetStreamer * createCSKYNullTargetStreamer(MCStreamer &S)
Definition CSKYMCTargetDesc.cpp:103
#define LLVM_EXTERNAL_VISIBILITY
dxil DXContainer Global Emitter
This class is intended to be used as a base class for asm properties and features specific to the tar...
void addInitialFrameState(const MCCFIInstruction &Inst)
static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, int64_t Offset, SMLoc Loc={})
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it.
Context object for machine code objects.
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
unsigned getNumOperands() const
unsigned getOpcode() const
const MCOperand & getOperand(unsigned i) const
Interface to description of machine instruction set.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Streaming machine code generation interface.
Generic base class for all target subtargets.
const Triple & getTargetTriple() const
Target specific streamer interface.
StringRef - Represent a constant reference to a string, i.e.
Triple - Helper class for working with autoconf configuration names.
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
This is an optimization pass for GlobalISel generic memory operations.
MCAsmBackend * createCSKYAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
LLVM_ABI MCStreamer * createELFStreamer(MCContext &Ctx, std::unique_ptr< MCAsmBackend > &&TAB, std::unique_ptr< MCObjectWriter > &&OW, std::unique_ptr< MCCodeEmitter > &&CE)
MCCodeEmitter * createCSKYMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
Target & getTheCSKYTarget()
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
static void RegisterMCAsmInfo(Target &T, Target::MCAsmInfoCtorFnTy Fn)
RegisterMCAsmInfo - Register a MCAsmInfo implementation for the given target.
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target.
static void RegisterObjectTargetStreamer(Target &T, Target::ObjectTargetStreamerCtorTy Fn)
static void RegisterMCInstrAnalysis(Target &T, Target::MCInstrAnalysisCtorFnTy Fn)
RegisterMCInstrAnalysis - Register a MCInstrAnalysis implementation for the given target.
static void RegisterELFStreamer(Target &T, Target::ELFStreamerCtorTy Fn)
static void RegisterNullTargetStreamer(Target &T, Target::NullTargetStreamerCtorTy Fn)
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)