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

          Line data    Source code
       1             : //===-- AVRTargetObjectFile.cpp - AVR Object Files ------------------------===//
       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             : #include "AVRTargetObjectFile.h"
      11             : 
      12             : #include "llvm/BinaryFormat/ELF.h"
      13             : #include "llvm/IR/DerivedTypes.h"
      14             : #include "llvm/IR/GlobalValue.h"
      15             : #include "llvm/IR/Mangler.h"
      16             : #include "llvm/MC/MCContext.h"
      17             : #include "llvm/MC/MCSectionELF.h"
      18             : 
      19             : #include "AVR.h"
      20             : 
      21             : namespace llvm {
      22          81 : void AVRTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM) {
      23          81 :   Base::Initialize(Ctx, TM);
      24          81 :   ProgmemDataSection =
      25          81 :       Ctx.getELFSection(".progmem.data", ELF::SHT_PROGBITS, ELF::SHF_ALLOC);
      26          81 : }
      27             : 
      28             : MCSection *
      29         311 : AVRTargetObjectFile::SelectSectionForGlobal(const GlobalObject *GO,
      30             :                                             SectionKind Kind,
      31             :                                             const TargetMachine &TM) const {
      32             :   // Global values in flash memory are placed in the progmem.data section
      33             :   // unless they already have a user assigned section.
      34         311 :   if (AVR::isProgramMemoryAddress(GO) && !GO->hasSection())
      35           0 :     return ProgmemDataSection;
      36             : 
      37             :   // Otherwise, we work the same way as ELF.
      38         311 :   return Base::SelectSectionForGlobal(GO, Kind, TM);
      39             : }
      40             : } // end of namespace llvm
      41             : 

Generated by: LCOV version 1.13