Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/Sparc/SparcTargetObjectFile.cpp
Line
Count
Source
1
//===------- SparcTargetObjectFile.cpp - Sparc Object Info Impl -----------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "SparcTargetObjectFile.h"
10
#include "MCTargetDesc/SparcMCExpr.h"
11
#include "llvm/BinaryFormat/Dwarf.h"
12
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
13
#include "llvm/CodeGen/TargetLowering.h"
14
15
using namespace llvm;
16
17
void SparcELFTargetObjectFile::Initialize(MCContext &Ctx,
18
198
                                          const TargetMachine &TM) {
19
198
  TargetLoweringObjectFileELF::Initialize(Ctx, TM);
20
198
  InitializeELF(TM.Options.UseInitArray);
21
198
}
22
23
const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(
24
    const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM,
25
8
    MachineModuleInfo *MMI, MCStreamer &Streamer) const {
26
8
27
8
  if (Encoding & dwarf::DW_EH_PE_pcrel) {
28
4
    MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
29
4
30
4
    MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", TM);
31
4
32
4
    // Add information about the stub reference to ELFMMI so that the stub
33
4
    // gets emitted by the asmprinter.
34
4
    MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
35
4
    if (!StubSym.getPointer()) {
36
4
      MCSymbol *Sym = TM.getSymbol(GV);
37
4
      StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
38
4
    }
39
4
40
4
    MCContext &Ctx = getContext();
41
4
    return SparcMCExpr::create(SparcMCExpr::VK_Sparc_R_DISP32,
42
4
                               MCSymbolRefExpr::create(SSym, Ctx), Ctx);
43
4
  }
44
4
45
4
  return TargetLoweringObjectFileELF::getTTypeGlobalReference(GV, Encoding, TM,
46
4
                                                              MMI, Streamer);
47
4
}