Path: blob/main/contrib/llvm-project/llvm/lib/Target/Sparc/SparcTargetObjectFile.cpp
35266 views
//===------- SparcTargetObjectFile.cpp - Sparc Object Info Impl -----------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "SparcTargetObjectFile.h"9#include "MCTargetDesc/SparcMCExpr.h"10#include "llvm/BinaryFormat/Dwarf.h"11#include "llvm/CodeGen/MachineModuleInfoImpls.h"12#include "llvm/CodeGen/TargetLowering.h"13#include "llvm/Target/TargetMachine.h"1415using namespace llvm;1617void SparcELFTargetObjectFile::Initialize(MCContext &Ctx,18const TargetMachine &TM) {19TargetLoweringObjectFileELF::Initialize(Ctx, TM);20}2122const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(23const GlobalValue *GV, unsigned Encoding, const TargetMachine &TM,24MachineModuleInfo *MMI, MCStreamer &Streamer) const {2526if (Encoding & dwarf::DW_EH_PE_pcrel) {27MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();2829MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", TM);3031// Add information about the stub reference to ELFMMI so that the stub32// gets emitted by the asmprinter.33MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);34if (!StubSym.getPointer()) {35MCSymbol *Sym = TM.getSymbol(GV);36StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());37}3839MCContext &Ctx = getContext();40return SparcMCExpr::create(SparcMCExpr::VK_Sparc_R_DISP32,41MCSymbolRefExpr::create(SSym, Ctx), Ctx);42}4344return TargetLoweringObjectFileELF::getTTypeGlobalReference(GV, Encoding, TM,45MMI, Streamer);46}474849