Home | History | Annotate | Download | only in MCTargetDesc
      1 //===-- BlackfinMCTargetDesc.cpp - Blackfin Target Descriptions -*- C++ -*-===//
      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 Blackfin specific target descriptions.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #include "BlackfinMCTargetDesc.h"
     15 #include "BlackfinMCAsmInfo.h"
     16 #include "llvm/MC/MCCodeGenInfo.h"
     17 #include "llvm/MC/MCInstrInfo.h"
     18 #include "llvm/MC/MCRegisterInfo.h"
     19 #include "llvm/MC/MCSubtargetInfo.h"
     20 #include "llvm/Support/TargetRegistry.h"
     21 
     22 #define GET_INSTRINFO_MC_DESC
     23 #include "BlackfinGenInstrInfo.inc"
     24 
     25 #define GET_SUBTARGETINFO_MC_DESC
     26 #include "BlackfinGenSubtargetInfo.inc"
     27 
     28 #define GET_REGINFO_MC_DESC
     29 #include "BlackfinGenRegisterInfo.inc"
     30 
     31 using namespace llvm;
     32 
     33 
     34 static MCInstrInfo *createBlackfinMCInstrInfo() {
     35   MCInstrInfo *X = new MCInstrInfo();
     36   InitBlackfinMCInstrInfo(X);
     37   return X;
     38 }
     39 
     40 static MCRegisterInfo *createBlackfinMCRegisterInfo(StringRef TT) {
     41   MCRegisterInfo *X = new MCRegisterInfo();
     42   InitBlackfinMCRegisterInfo(X, BF::RETS);
     43   return X;
     44 }
     45 
     46 static MCSubtargetInfo *createBlackfinMCSubtargetInfo(StringRef TT,
     47                                                       StringRef CPU,
     48                                                       StringRef FS) {
     49   MCSubtargetInfo *X = new MCSubtargetInfo();
     50   InitBlackfinMCSubtargetInfo(X, TT, CPU, FS);
     51   return X;
     52 }
     53 
     54 static MCCodeGenInfo *createBlackfinMCCodeGenInfo(StringRef TT, Reloc::Model RM,
     55                                                   CodeModel::Model CM) {
     56   MCCodeGenInfo *X = new MCCodeGenInfo();
     57   X->InitMCCodeGenInfo(RM, CM);
     58   return X;
     59 }
     60 
     61 // Force static initialization.
     62 extern "C" void LLVMInitializeBlackfinTargetMC() {
     63   // Register the MC asm info.
     64   RegisterMCAsmInfo<BlackfinMCAsmInfo> X(TheBlackfinTarget);
     65 
     66   // Register the MC codegen info.
     67   TargetRegistry::RegisterMCCodeGenInfo(TheBlackfinTarget,
     68                                         createBlackfinMCCodeGenInfo);
     69 
     70   // Register the MC instruction info.
     71   TargetRegistry::RegisterMCInstrInfo(TheBlackfinTarget,
     72                                       createBlackfinMCInstrInfo);
     73 
     74   // Register the MC register info.
     75   TargetRegistry::RegisterMCRegInfo(TheBlackfinTarget,
     76                                     createBlackfinMCRegisterInfo);
     77 
     78   // Register the MC subtarget info.
     79   TargetRegistry::RegisterMCSubtargetInfo(TheBlackfinTarget,
     80                                           createBlackfinMCSubtargetInfo);
     81 }
     82