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

          Line data    Source code
       1             : #include "AVRELFStreamer.h"
       2             : 
       3             : #include "llvm/BinaryFormat/ELF.h"
       4             : #include "llvm/MC/MCSubtargetInfo.h"
       5             : #include "llvm/MC/SubtargetFeature.h"
       6             : #include "llvm/Support/FormattedStream.h"
       7             : 
       8             : #include "AVRMCTargetDesc.h"
       9             : 
      10             : namespace llvm {
      11             : 
      12          10 : static unsigned getEFlagsForFeatureSet(const FeatureBitset &Features) {
      13             :   unsigned EFlags = 0;
      14             : 
      15             :   // Set architecture
      16          10 :   if (Features[AVR::ELFArchAVR1])
      17             :     EFlags |= ELF::EF_AVR_ARCH_AVR1;
      18          10 :   else if (Features[AVR::ELFArchAVR2])
      19             :     EFlags |= ELF::EF_AVR_ARCH_AVR2;
      20          10 :   else if (Features[AVR::ELFArchAVR25])
      21             :     EFlags |= ELF::EF_AVR_ARCH_AVR25;
      22          10 :   else if (Features[AVR::ELFArchAVR3])
      23             :     EFlags |= ELF::EF_AVR_ARCH_AVR3;
      24          10 :   else if (Features[AVR::ELFArchAVR31])
      25             :     EFlags |= ELF::EF_AVR_ARCH_AVR31;
      26          10 :   else if (Features[AVR::ELFArchAVR35])
      27             :     EFlags |= ELF::EF_AVR_ARCH_AVR35;
      28          10 :   else if (Features[AVR::ELFArchAVR4])
      29             :     EFlags |= ELF::EF_AVR_ARCH_AVR4;
      30          10 :   else if (Features[AVR::ELFArchAVR5])
      31             :     EFlags |= ELF::EF_AVR_ARCH_AVR5;
      32           9 :   else if (Features[AVR::ELFArchAVR51])
      33             :     EFlags |= ELF::EF_AVR_ARCH_AVR51;
      34           9 :   else if (Features[AVR::ELFArchAVR6])
      35             :     EFlags |= ELF::EF_AVR_ARCH_AVR6;
      36           9 :   else if (Features[AVR::ELFArchTiny])
      37             :     EFlags |= ELF::EF_AVR_ARCH_AVRTINY;
      38           9 :   else if (Features[AVR::ELFArchXMEGA1])
      39             :     EFlags |= ELF::EF_AVR_ARCH_XMEGA1;
      40           9 :   else if (Features[AVR::ELFArchXMEGA2])
      41             :     EFlags |= ELF::EF_AVR_ARCH_XMEGA2;
      42           9 :   else if (Features[AVR::ELFArchXMEGA3])
      43             :     EFlags |= ELF::EF_AVR_ARCH_XMEGA3;
      44           9 :   else if (Features[AVR::ELFArchXMEGA4])
      45             :     EFlags |= ELF::EF_AVR_ARCH_XMEGA4;
      46           9 :   else if (Features[AVR::ELFArchXMEGA5])
      47             :     EFlags |= ELF::EF_AVR_ARCH_XMEGA5;
      48           9 :   else if (Features[AVR::ELFArchXMEGA6])
      49             :     EFlags |= ELF::EF_AVR_ARCH_XMEGA6;
      50           9 :   else if (Features[AVR::ELFArchXMEGA7])
      51             :     EFlags |= ELF::EF_AVR_ARCH_XMEGA7;
      52             : 
      53          10 :   return EFlags;
      54             : }
      55             : 
      56          10 : AVRELFStreamer::AVRELFStreamer(MCStreamer &S,
      57          10 :                                const MCSubtargetInfo &STI)
      58          10 :     : AVRTargetStreamer(S) {
      59             : 
      60          10 :   MCAssembler &MCA = getStreamer().getAssembler();
      61          10 :   unsigned EFlags = MCA.getELFHeaderEFlags();
      62             : 
      63          10 :   EFlags |= getEFlagsForFeatureSet(STI.getFeatureBits());
      64             : 
      65             :   MCA.setELFHeaderEFlags(EFlags);
      66          10 : }
      67             : 
      68             : } // end namespace llvm

Generated by: LCOV version 1.13