LLVM  3.7.0
BPFMCTargetDesc.cpp
Go to the documentation of this file.
1 //===-- BPFMCTargetDesc.cpp - BPF Target Descriptions ---------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file provides BPF specific target descriptions.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "BPF.h"
15 #include "BPFMCTargetDesc.h"
16 #include "BPFMCAsmInfo.h"
18 #include "llvm/MC/MCCodeGenInfo.h"
19 #include "llvm/MC/MCInstrInfo.h"
20 #include "llvm/MC/MCRegisterInfo.h"
21 #include "llvm/MC/MCStreamer.h"
25 
26 #define GET_INSTRINFO_MC_DESC
27 #include "BPFGenInstrInfo.inc"
28 
29 #define GET_SUBTARGETINFO_MC_DESC
30 #include "BPFGenSubtargetInfo.inc"
31 
32 #define GET_REGINFO_MC_DESC
33 #include "BPFGenRegisterInfo.inc"
34 
35 using namespace llvm;
36 
38  MCInstrInfo *X = new MCInstrInfo();
39  InitBPFMCInstrInfo(X);
40  return X;
41 }
42 
45  InitBPFMCRegisterInfo(X, BPF::R11 /* RAReg doesn't exist */);
46  return X;
47 }
48 
50  StringRef CPU, StringRef FS) {
51  return createBPFMCSubtargetInfoImpl(TT, CPU, FS);
52 }
53 
56  CodeGenOpt::Level OL) {
57  MCCodeGenInfo *X = new MCCodeGenInfo();
58  X->initMCCodeGenInfo(RM, CM, OL);
59  return X;
60 }
61 
63  MCContext &Ctx, MCAsmBackend &MAB,
64  raw_pwrite_stream &OS, MCCodeEmitter *Emitter,
65  bool RelaxAll) {
66  return createELFStreamer(Ctx, MAB, OS, Emitter, RelaxAll);
67 }
68 
70  unsigned SyntaxVariant,
71  const MCAsmInfo &MAI,
72  const MCInstrInfo &MII,
73  const MCRegisterInfo &MRI) {
74  if (SyntaxVariant == 0)
75  return new BPFInstPrinter(MAI, MII, MRI);
76  return 0;
77 }
78 
79 extern "C" void LLVMInitializeBPFTargetMC() {
81  // Register the MC asm info.
83 
84  // Register the MC codegen info.
86 
87  // Register the MC instruction info.
89 
90  // Register the MC register info.
92 
93  // Register the MC subtarget info.
96 
97  // Register the object streamer
99 
100  // Register the MCInstPrinter.
102  }
103 
104  // Register the MC code emitter
107 
108  // Register the ASM Backend
111 
115  } else {
118  }
119 }
static MCSubtargetInfo * createBPFMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
Target TheBPFTarget
Context object for machine code objects.
Definition: MCContext.h:48
MCCodeEmitter * createBPFbeMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
static const bool IsLittleEndianHost
Definition: Host.h:38
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:58
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
Streaming machine code generation interface.
Definition: MCStreamer.h:157
void LLVMInitializeBPFTargetMC()
MCCodeEmitter - Generic instruction encoding interface.
Definition: MCCodeEmitter.h:23
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:24
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
static void RegisterMCCodeGenInfo(Target &T, Target::MCCodeGenInfoCtorFnTy Fn)
RegisterMCCodeGenInfo - Register a MCCodeGenInfo implementation for the given target.
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target...
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
MCAsmBackend * createBPFAsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU)
RegisterMCAsmInfo - Helper template for registering a target assembly info implementation.
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
MCStreamer * createELFStreamer(MCContext &Ctx, MCAsmBackend &TAB, raw_pwrite_stream &OS, MCCodeEmitter *CE, bool RelaxAll)
Takes ownership of TAB and CE.
static MCInstPrinter * createBPFMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
static MCCodeGenInfo * createBPFMCCodeGenInfo(const Triple &TT, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL)
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
Target - Wrapper for Target specific information.
Target TheBPFleTarget
static MCInstrInfo * createBPFMCInstrInfo()
static MCStreamer * createBPFMCStreamer(const Triple &T, MCContext &Ctx, MCAsmBackend &MAB, raw_pwrite_stream &OS, MCCodeEmitter *Emitter, bool RelaxAll)
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Definition: MCInstPrinter.h:38
MCAsmBackend * createBPFbeAsmBackend(const Target &T, const MCRegisterInfo &MRI, const Triple &TT, StringRef CPU)
void initMCCodeGenInfo(Reloc::Model RM=Reloc::Default, CodeModel::Model CM=CodeModel::Default, CodeGenOpt::Level OL=CodeGenOpt::Default)
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target. ...
MCSubtargetInfo - Generic base class for all target subtargets.
static void RegisterELFStreamer(Target &T, Target::ELFStreamerCtorTy Fn)
Target TheBPFbeTarget
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:321
cl::opt< bool > RelaxAll("mc-relax-all", cl::desc("When used with filetype=obj, ""relax all fixups in the emitted object file"))
static MCRegisterInfo * createBPFMCRegisterInfo(const Triple &TT)
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:34
MCCodeEmitter * createBPFMCCodeEmitter(const MCInstrInfo &MCII, const MCRegisterInfo &MRI, MCContext &Ctx)
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40