LCOV - code coverage report
Current view: top level - lib/Target/AVR/MCTargetDesc - AVRMCTargetDesc.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 30 30 100.0 %
Date: 2018-10-20 13:21:21 Functions: 8 8 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- AVRMCTargetDesc.cpp - AVR 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 AVR specific target descriptions.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #include "AVRELFStreamer.h"
      15             : #include "AVRMCAsmInfo.h"
      16             : #include "AVRMCELFStreamer.h"
      17             : #include "AVRMCTargetDesc.h"
      18             : #include "AVRTargetStreamer.h"
      19             : #include "InstPrinter/AVRInstPrinter.h"
      20             : 
      21             : #include "llvm/MC/MCAsmBackend.h"
      22             : #include "llvm/MC/MCELFStreamer.h"
      23             : #include "llvm/MC/MCCodeEmitter.h"
      24             : #include "llvm/MC/MCInstrInfo.h"
      25             : #include "llvm/MC/MCRegisterInfo.h"
      26             : #include "llvm/MC/MCSubtargetInfo.h"
      27             : #include "llvm/Support/TargetRegistry.h"
      28             : 
      29             : #define GET_INSTRINFO_MC_DESC
      30             : #include "AVRGenInstrInfo.inc"
      31             : 
      32             : #define GET_SUBTARGETINFO_MC_DESC
      33             : #include "AVRGenSubtargetInfo.inc"
      34             : 
      35             : #define GET_REGINFO_MC_DESC
      36             : #include "AVRGenRegisterInfo.inc"
      37             : 
      38             : using namespace llvm;
      39             : 
      40        4379 : MCInstrInfo *llvm::createAVRMCInstrInfo() {
      41        4379 :   MCInstrInfo *X = new MCInstrInfo();
      42             :   InitAVRMCInstrInfo(X);
      43             : 
      44        4379 :   return X;
      45             : }
      46             : 
      47         218 : static MCRegisterInfo *createAVRMCRegisterInfo(const Triple &TT) {
      48         218 :   MCRegisterInfo *X = new MCRegisterInfo();
      49             :   InitAVRMCRegisterInfo(X, 0);
      50             : 
      51         218 :   return X;
      52             : }
      53             : 
      54         218 : static MCSubtargetInfo *createAVRMCSubtargetInfo(const Triple &TT,
      55             :                                                  StringRef CPU, StringRef FS) {
      56         218 :   return createAVRMCSubtargetInfoImpl(TT, CPU, FS);
      57             : }
      58             : 
      59         170 : static MCInstPrinter *createAVRMCInstPrinter(const Triple &T,
      60             :                                              unsigned SyntaxVariant,
      61             :                                              const MCAsmInfo &MAI,
      62             :                                              const MCInstrInfo &MII,
      63             :                                              const MCRegisterInfo &MRI) {
      64         170 :   if (SyntaxVariant == 0) {
      65         170 :     return new AVRInstPrinter(MAI, MII, MRI);
      66             :   }
      67             : 
      68             :   return nullptr;
      69             : }
      70             : 
      71          10 : static MCStreamer *createMCStreamer(const Triple &T, MCContext &Context,
      72             :                                     std::unique_ptr<MCAsmBackend> &&MAB,
      73             :                                     std::unique_ptr<MCObjectWriter> &&OW,
      74             :                                     std::unique_ptr<MCCodeEmitter> &&Emitter,
      75             :                                     bool RelaxAll) {
      76          10 :   return createELFStreamer(Context, std::move(MAB), std::move(OW),
      77          10 :                            std::move(Emitter), RelaxAll);
      78             : }
      79             : 
      80             : static MCTargetStreamer *
      81          10 : createAVRObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI) {
      82          10 :   return new AVRELFStreamer(S, STI);
      83             : }
      84             : 
      85         169 : static MCTargetStreamer *createMCAsmTargetStreamer(MCStreamer &S,
      86             :                                                    formatted_raw_ostream &OS,
      87             :                                                    MCInstPrinter *InstPrint,
      88             :                                                    bool isVerboseAsm) {
      89         169 :   return new AVRTargetAsmStreamer(S);
      90             : }
      91             : 
      92       79016 : extern "C" void LLVMInitializeAVRTargetMC() {
      93             :   // Register the MC asm info.
      94       79016 :   RegisterMCAsmInfo<AVRMCAsmInfo> X(getTheAVRTarget());
      95             : 
      96             :   // Register the MC instruction info.
      97       79016 :   TargetRegistry::RegisterMCInstrInfo(getTheAVRTarget(), createAVRMCInstrInfo);
      98             : 
      99             :   // Register the MC register info.
     100       79016 :   TargetRegistry::RegisterMCRegInfo(getTheAVRTarget(), createAVRMCRegisterInfo);
     101             : 
     102             :   // Register the MC subtarget info.
     103       79016 :   TargetRegistry::RegisterMCSubtargetInfo(getTheAVRTarget(),
     104             :                                           createAVRMCSubtargetInfo);
     105             : 
     106             :   // Register the MCInstPrinter.
     107       79016 :   TargetRegistry::RegisterMCInstPrinter(getTheAVRTarget(),
     108             :                                         createAVRMCInstPrinter);
     109             : 
     110             :   // Register the MC Code Emitter
     111       79016 :   TargetRegistry::RegisterMCCodeEmitter(getTheAVRTarget(), createAVRMCCodeEmitter);
     112             : 
     113             :   // Register the obj streamer
     114       79016 :   TargetRegistry::RegisterELFStreamer(getTheAVRTarget(), createMCStreamer);
     115             : 
     116             :   // Register the obj target streamer.
     117       79016 :   TargetRegistry::RegisterObjectTargetStreamer(getTheAVRTarget(),
     118             :                                                createAVRObjectTargetStreamer);
     119             : 
     120             :   // Register the asm target streamer.
     121       79016 :   TargetRegistry::RegisterAsmTargetStreamer(getTheAVRTarget(),
     122             :                                             createMCAsmTargetStreamer);
     123             : 
     124             :   // Register the asm backend (as little endian).
     125       79016 :   TargetRegistry::RegisterMCAsmBackend(getTheAVRTarget(), createAVRAsmBackend);
     126       79016 : }
     127             : 

Generated by: LCOV version 1.13