LCOV - code coverage report
Current view: top level - lib/Target/ARM - ARMTargetObjectFile.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 21 21 100.0 %
Date: 2018-07-13 00:08:38 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- llvm/Target/ARMTargetObjectFile.cpp - ARM Object Info Impl --------===//
       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 "ARMTargetObjectFile.h"
      11             : #include "ARMSubtarget.h"
      12             : #include "ARMTargetMachine.h"
      13             : #include "llvm/BinaryFormat/Dwarf.h"
      14             : #include "llvm/BinaryFormat/ELF.h"
      15             : #include "llvm/MC/MCAsmInfo.h"
      16             : #include "llvm/MC/MCContext.h"
      17             : #include "llvm/MC/MCExpr.h"
      18             : #include "llvm/MC/MCSectionELF.h"
      19             : #include "llvm/MC/MCTargetOptions.h"
      20             : #include "llvm/MC/SectionKind.h"
      21             : #include "llvm/Target/TargetMachine.h"
      22             : #include <cassert>
      23             : 
      24             : using namespace llvm;
      25             : using namespace dwarf;
      26             : 
      27             : //===----------------------------------------------------------------------===//
      28             : //                               ELF Target
      29             : //===----------------------------------------------------------------------===//
      30             : 
      31        1887 : void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
      32             :                                         const TargetMachine &TM) {
      33             :   const ARMBaseTargetMachine &ARM_TM = static_cast<const ARMBaseTargetMachine &>(TM);
      34        1887 :   bool isAAPCS_ABI = ARM_TM.TargetABI == ARMBaseTargetMachine::ARMABI::ARM_ABI_AAPCS;
      35             :   //  genExecuteOnly = ARM_TM.getSubtargetImpl()->genExecuteOnly();
      36             : 
      37        1887 :   TargetLoweringObjectFileELF::Initialize(Ctx, TM);
      38        1887 :   InitializeELF(isAAPCS_ABI);
      39             : 
      40        1887 :   if (isAAPCS_ABI) {
      41        1876 :     LSDASection = nullptr;
      42             :   }
      43        1887 : }
      44             : 
      45           7 : const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(
      46             :     const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM,
      47             :     MachineModuleInfo *MMI, MCStreamer &Streamer) const {
      48           7 :   if (TM.getMCAsmInfo()->getExceptionHandlingType() != ExceptionHandling::ARM)
      49           3 :     return TargetLoweringObjectFileELF::getTTypeGlobalReference(
      50           3 :         GV, Encoding, TM, MMI, Streamer);
      51             : 
      52             :   assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");
      53             : 
      54           8 :   return MCSymbolRefExpr::create(TM.getSymbol(GV),
      55           8 :                                  MCSymbolRefExpr::VK_ARM_TARGET2, getContext());
      56             : }
      57             : 
      58           1 : const MCExpr *ARMElfTargetObjectFile::
      59             : getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
      60           2 :   return MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_ARM_TLSLDO,
      61           3 :                                  getContext());
      62             : }
      63             : 
      64             : static bool isExecuteOnlyFunction(const GlobalObject *GO, SectionKind SK,
      65             :                                   const TargetMachine &TM) {
      66             :   if (const Function *F = dyn_cast<Function>(GO))
      67       11106 :     if (TM.getSubtarget<ARMSubtarget>(*F).genExecuteOnly() && SK.isText())
      68             :       return true;
      69             :   return false;
      70             : }
      71             : 
      72          38 : MCSection *ARMElfTargetObjectFile::getExplicitSectionGlobal(
      73             :     const GlobalObject *GO, SectionKind SK, const TargetMachine &TM) const {
      74             :   // Set execute-only access for the explicit section
      75             :   if (isExecuteOnlyFunction(GO, SK, TM))
      76             :     SK = SectionKind::getExecuteOnly();
      77             : 
      78          38 :   return TargetLoweringObjectFileELF::getExplicitSectionGlobal(GO, SK, TM);
      79             : }
      80             : 
      81       11523 : MCSection *ARMElfTargetObjectFile::SelectSectionForGlobal(
      82             :     const GlobalObject *GO, SectionKind SK, const TargetMachine &TM) const {
      83             :   // Place the global in the execute-only text section
      84             :   if (isExecuteOnlyFunction(GO, SK, TM))
      85             :     SK = SectionKind::getExecuteOnly();
      86             : 
      87       11523 :   return TargetLoweringObjectFileELF::SelectSectionForGlobal(GO, SK, TM);
      88             : }

Generated by: LCOV version 1.13