blob: dd65b881f4d42e4609ffce273c2457fa9c138412 [file] [log] [blame]
Chris Lattner5e693ed2009-07-28 03:13:23 +00001//===-- llvm/Target/TargetLoweringObjectFile.cpp - Object File Info -------===//
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// This file implements classes used to handle lowerings specific to common
11// object file formats.
12//
13//===----------------------------------------------------------------------===//
14
15#include "llvm/Target/TargetLoweringObjectFile.h"
Chandler Carruth9fb823b2013-01-02 11:36:10 +000016#include "llvm/IR/Constants.h"
17#include "llvm/IR/DataLayout.h"
18#include "llvm/IR/DerivedTypes.h"
19#include "llvm/IR/Function.h"
20#include "llvm/IR/GlobalVariable.h"
Rafael Espindola894843c2014-01-07 21:19:40 +000021#include "llvm/IR/Mangler.h"
Rafael Espindola117b20c2013-12-05 05:53:12 +000022#include "llvm/MC/MCAsmInfo.h"
Chris Lattner4d2c0f92009-07-31 18:48:30 +000023#include "llvm/MC/MCContext.h"
Chris Lattnerb8666022009-09-16 01:46:41 +000024#include "llvm/MC/MCExpr.h"
Chris Lattner03627cb2010-03-11 21:55:20 +000025#include "llvm/MC/MCStreamer.h"
Chris Lattnerccbeed22010-01-13 21:29:21 +000026#include "llvm/MC/MCSymbol.h"
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +000027#include "llvm/Support/Dwarf.h"
Chris Lattnerd82510e2009-11-07 09:20:54 +000028#include "llvm/Support/ErrorHandling.h"
Chris Lattnerccbeed22010-01-13 21:29:21 +000029#include "llvm/Support/raw_ostream.h"
Rafael Espindoladaeafb42014-02-19 17:23:20 +000030#include "llvm/Target/TargetLowering.h"
Chandler Carruth442f7842014-03-04 10:07:28 +000031#include "llvm/Target/TargetMachine.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000032#include "llvm/Target/TargetOptions.h"
Eric Christopherd9134482014-08-04 21:25:23 +000033#include "llvm/Target/TargetSubtargetInfo.h"
Chris Lattner5e693ed2009-07-28 03:13:23 +000034using namespace llvm;
35
36//===----------------------------------------------------------------------===//
37// Generic Code
38//===----------------------------------------------------------------------===//
39
Evan Cheng76792992011-07-20 05:58:47 +000040/// Initialize - this method must be called before any actual lowering is
41/// done. This specifies the current context for codegen, and gives the
42/// lowering implementations a chance to set up their default sections.
43void TargetLoweringObjectFile::Initialize(MCContext &ctx,
44 const TargetMachine &TM) {
45 Ctx = &ctx;
Daniel Sandersc81f4502015-06-16 15:44:21 +000046 InitMCObjectFileInfo(TM.getTargetTriple(), TM.getRelocationModel(),
Daniel Sanders8d8b13d2015-06-16 12:18:07 +000047 TM.getCodeModel(), *Ctx);
Chris Lattner5e693ed2009-07-28 03:13:23 +000048}
Saleem Abdulrasool0d3d6c42014-04-16 04:15:25 +000049
Chris Lattner5e693ed2009-07-28 03:13:23 +000050TargetLoweringObjectFile::~TargetLoweringObjectFile() {
51}
52
Nick Lewycky50f02cb2011-12-02 22:16:29 +000053static bool isSuitableForBSS(const GlobalVariable *GV, bool NoZerosInBSS) {
Jay Foad60020682011-06-19 18:37:11 +000054 const Constant *C = GV->getInitializer();
Anton Korobeynikov1df58862009-09-09 08:41:20 +000055
Chris Lattner5e693ed2009-07-28 03:13:23 +000056 // Must have zero initializer.
57 if (!C->isNullValue())
58 return false;
Anton Korobeynikov1df58862009-09-09 08:41:20 +000059
Chris Lattner5e693ed2009-07-28 03:13:23 +000060 // Leave constant zeros in readonly constant sections, so they can be shared.
61 if (GV->isConstant())
62 return false;
Anton Korobeynikov1df58862009-09-09 08:41:20 +000063
Chris Lattner5e693ed2009-07-28 03:13:23 +000064 // If the global has an explicit section specified, don't put it in BSS.
David Majnemer483e4e02014-05-17 05:18:40 +000065 if (GV->hasSection())
Chris Lattner5e693ed2009-07-28 03:13:23 +000066 return false;
Anton Korobeynikov1df58862009-09-09 08:41:20 +000067
Chris Lattner5e693ed2009-07-28 03:13:23 +000068 // If -nozero-initialized-in-bss is specified, don't ever use BSS.
69 if (NoZerosInBSS)
70 return false;
Anton Korobeynikov1df58862009-09-09 08:41:20 +000071
Chris Lattner5e693ed2009-07-28 03:13:23 +000072 // Otherwise, put it in BSS!
73 return true;
74}
75
Chris Lattner81bbf442009-08-04 16:13:09 +000076/// IsNullTerminatedString - Return true if the specified constant (which is
77/// known to have a type that is an array of 1/2/4 byte elements) ends with a
Chris Lattner139822f2012-01-24 14:17:05 +000078/// nul value and contains no other nuls in it. Note that this is more general
79/// than ConstantDataSequential::isString because we allow 2 & 4 byte strings.
Chris Lattner81bbf442009-08-04 16:13:09 +000080static bool IsNullTerminatedString(const Constant *C) {
Chris Lattner139822f2012-01-24 14:17:05 +000081 // First check: is we have constant array terminated with zero
Chris Lattner139822f2012-01-24 14:17:05 +000082 if (const ConstantDataSequential *CDS = dyn_cast<ConstantDataSequential>(C)) {
83 unsigned NumElts = CDS->getNumElements();
84 assert(NumElts != 0 && "Can't have an empty CDS");
85
86 if (CDS->getElementAsInteger(NumElts-1) != 0)
87 return false; // Not null terminated.
88
89 // Verify that the null doesn't occur anywhere else in the string.
90 for (unsigned i = 0; i != NumElts-1; ++i)
91 if (CDS->getElementAsInteger(i) == 0)
92 return false;
93 return true;
94 }
Chris Lattner5e693ed2009-07-28 03:13:23 +000095
96 // Another possibility: [1 x i8] zeroinitializer
97 if (isa<ConstantAggregateZero>(C))
Chris Lattner139822f2012-01-24 14:17:05 +000098 return cast<ArrayType>(C->getType())->getNumElements() == 1;
Chris Lattner5e693ed2009-07-28 03:13:23 +000099
100 return false;
101}
102
Rafael Espindolaf4e6b292013-12-02 16:25:47 +0000103MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
Rafael Espindoladaeafb42014-02-19 17:23:20 +0000104 const GlobalValue *GV, StringRef Suffix, Mangler &Mang,
105 const TargetMachine &TM) const {
Rafael Espindola117b20c2013-12-05 05:53:12 +0000106 assert(!Suffix.empty());
Rafael Espindola117b20c2013-12-05 05:53:12 +0000107
Rafael Espindolaf4e6b292013-12-02 16:25:47 +0000108 SmallString<60> NameStr;
Mehdi Amini5c0fa582015-07-16 06:04:17 +0000109 NameStr += GV->getParent()->getDataLayout().getPrivateGlobalPrefix();
Rafael Espindolaa3ad4e62014-02-19 20:30:41 +0000110 TM.getNameWithPrefix(NameStr, GV, Mang);
Rafael Espindolaf4e6b292013-12-02 16:25:47 +0000111 NameStr.append(Suffix.begin(), Suffix.end());
Jim Grosbach6f482002015-05-18 18:43:14 +0000112 return Ctx->getOrCreateSymbol(NameStr);
Rafael Espindolaf4e6b292013-12-02 16:25:47 +0000113}
Rafael Espindolae133ed82013-10-29 17:28:26 +0000114
Rafael Espindoladaeafb42014-02-19 17:23:20 +0000115MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol(
116 const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
117 MachineModuleInfo *MMI) const {
Rafael Espindolaa3ad4e62014-02-19 20:30:41 +0000118 return TM.getSymbol(GV, Mang);
Rafael Espindolaa83b1772011-04-16 03:51:21 +0000119}
120
121void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,
Mehdi Amini5c0fa582015-07-16 06:04:17 +0000122 const DataLayout &,
Rafael Espindolaa83b1772011-04-16 03:51:21 +0000123 const MCSymbol *Sym) const {
Rafael Espindolaa83b1772011-04-16 03:51:21 +0000124}
125
126
Chris Lattnercbc7b262009-08-05 04:25:40 +0000127/// getKindForGlobal - This is a top-level target-independent classifier for
Chris Lattnerc9c277b2009-08-01 21:11:14 +0000128/// a global variable. Given an global variable and information from TM, it
129/// classifies the global in a variety of ways that make various target
130/// implementations simpler. The target implementation is free to ignore this
131/// extra info of course.
Chris Lattnercbc7b262009-08-05 04:25:40 +0000132SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalValue *GV,
133 const TargetMachine &TM){
134 assert(!GV->isDeclaration() && !GV->hasAvailableExternallyLinkage() &&
135 "Can only be used for global definitions");
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000136
Chris Lattner5e693ed2009-07-28 03:13:23 +0000137 Reloc::Model ReloModel = TM.getRelocationModel();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000138
Chris Lattner5e693ed2009-07-28 03:13:23 +0000139 // Early exit - functions should be always in text sections.
140 const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
Craig Topper062a2ba2014-04-25 05:30:21 +0000141 if (!GVar)
Chris Lattnerf8d97102009-08-01 23:57:16 +0000142 return SectionKind::getText();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000143
Chris Lattner5e693ed2009-07-28 03:13:23 +0000144 // Handle thread-local data first.
145 if (GVar->isThreadLocal()) {
Nick Lewycky50f02cb2011-12-02 22:16:29 +0000146 if (isSuitableForBSS(GVar, TM.Options.NoZerosInBSS))
Chris Lattnerf8d97102009-08-01 23:57:16 +0000147 return SectionKind::getThreadBSS();
148 return SectionKind::getThreadData();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000149 }
150
Chris Lattner5b585f82010-01-19 02:48:26 +0000151 // Variables with common linkage always get classified as common.
152 if (GVar->hasCommonLinkage())
153 return SectionKind::getCommon();
154
Chris Lattner5e693ed2009-07-28 03:13:23 +0000155 // Variable can be easily put to BSS section.
Nick Lewycky50f02cb2011-12-02 22:16:29 +0000156 if (isSuitableForBSS(GVar, TM.Options.NoZerosInBSS)) {
Chris Lattnerb2534212010-01-19 04:15:51 +0000157 if (GVar->hasLocalLinkage())
158 return SectionKind::getBSSLocal();
159 else if (GVar->hasExternalLinkage())
160 return SectionKind::getBSSExtern();
Chris Lattnerf8d97102009-08-01 23:57:16 +0000161 return SectionKind::getBSS();
Chris Lattnerb2534212010-01-19 04:15:51 +0000162 }
Chris Lattner5e693ed2009-07-28 03:13:23 +0000163
Jay Foad60020682011-06-19 18:37:11 +0000164 const Constant *C = GVar->getInitializer();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000165
Chris Lattner5e693ed2009-07-28 03:13:23 +0000166 // If the global is marked constant, we can put it into a mergable section,
167 // a mergable string section, or general .data if it contains relocations.
Chris Lattnerea4e9832011-01-18 01:23:44 +0000168 if (GVar->isConstant()) {
Chris Lattner5e693ed2009-07-28 03:13:23 +0000169 // If the initializer for the global contains something that requires a
Eric Christopherde9e92e2012-05-05 01:16:06 +0000170 // relocation, then we may have to drop this into a writable data section
Chris Lattner5e693ed2009-07-28 03:13:23 +0000171 // even though it is marked const.
172 switch (C->getRelocationInfo()) {
Chris Lattner5e693ed2009-07-28 03:13:23 +0000173 case Constant::NoRelocation:
Chris Lattnerea4e9832011-01-18 01:23:44 +0000174 // If the global is required to have a unique address, it can't be put
175 // into a mergable section: just drop it into the general read-only
176 // section instead.
177 if (!GVar->hasUnnamedAddr())
178 return SectionKind::getReadOnly();
179
Chris Lattner5e693ed2009-07-28 03:13:23 +0000180 // If initializer is a null-terminated string, put it in a "cstring"
Chris Lattner81bbf442009-08-04 16:13:09 +0000181 // section of the right width.
Chris Lattner229907c2011-07-18 04:54:35 +0000182 if (ArrayType *ATy = dyn_cast<ArrayType>(C->getType())) {
183 if (IntegerType *ITy =
Chris Lattner81bbf442009-08-04 16:13:09 +0000184 dyn_cast<IntegerType>(ATy->getElementType())) {
185 if ((ITy->getBitWidth() == 8 || ITy->getBitWidth() == 16 ||
186 ITy->getBitWidth() == 32) &&
187 IsNullTerminatedString(C)) {
188 if (ITy->getBitWidth() == 8)
189 return SectionKind::getMergeable1ByteCString();
190 if (ITy->getBitWidth() == 16)
191 return SectionKind::getMergeable2ByteCString();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000192
Chris Lattner81bbf442009-08-04 16:13:09 +0000193 assert(ITy->getBitWidth() == 32 && "Unknown width");
194 return SectionKind::getMergeable4ByteCString();
195 }
196 }
197 }
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000198
Chris Lattner5e693ed2009-07-28 03:13:23 +0000199 // Otherwise, just drop it into a mergable constant section. If we have
200 // a section for this size, use it, otherwise use the arbitrary sized
201 // mergable section.
Mehdi Amini5c0fa582015-07-16 06:04:17 +0000202 switch (GV->getParent()->getDataLayout().getTypeAllocSize(C->getType())) {
Chris Lattnerf8d97102009-08-01 23:57:16 +0000203 case 4: return SectionKind::getMergeableConst4();
204 case 8: return SectionKind::getMergeableConst8();
205 case 16: return SectionKind::getMergeableConst16();
Rafael Espindola33804ca2015-01-29 14:12:41 +0000206 default:
207 return SectionKind::getReadOnly();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000208 }
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000209
Chris Lattner5e693ed2009-07-28 03:13:23 +0000210 case Constant::LocalRelocation:
211 // In static relocation model, the linker will resolve all addresses, so
212 // the relocation entries will actually be constants by the time the app
213 // starts up. However, we can't put this into a mergable section, because
214 // the linker doesn't take relocations into consideration when it tries to
215 // merge entries in the section.
216 if (ReloModel == Reloc::Static)
Chris Lattnerf8d97102009-08-01 23:57:16 +0000217 return SectionKind::getReadOnly();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000218
Chris Lattner5e693ed2009-07-28 03:13:23 +0000219 // Otherwise, the dynamic linker needs to fix it up, put it in the
220 // writable data.rel.local section.
Chris Lattnerf8d97102009-08-01 23:57:16 +0000221 return SectionKind::getReadOnlyWithRelLocal();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000222
Chris Lattner5e693ed2009-07-28 03:13:23 +0000223 case Constant::GlobalRelocations:
224 // In static relocation model, the linker will resolve all addresses, so
225 // the relocation entries will actually be constants by the time the app
226 // starts up. However, we can't put this into a mergable section, because
227 // the linker doesn't take relocations into consideration when it tries to
228 // merge entries in the section.
229 if (ReloModel == Reloc::Static)
Chris Lattnerf8d97102009-08-01 23:57:16 +0000230 return SectionKind::getReadOnly();
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000231
Chris Lattner5e693ed2009-07-28 03:13:23 +0000232 // Otherwise, the dynamic linker needs to fix it up, put it in the
233 // writable data.rel section.
Chris Lattnerf8d97102009-08-01 23:57:16 +0000234 return SectionKind::getReadOnlyWithRel();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000235 }
236 }
237
238 // Okay, this isn't a constant. If the initializer for the global is going
239 // to require a runtime relocation by the dynamic linker, put it into a more
240 // specific section to improve startup time of the app. This coalesces these
241 // globals together onto fewer pages, improving the locality of the dynamic
242 // linker.
243 if (ReloModel == Reloc::Static)
Chris Lattnerf8d97102009-08-01 23:57:16 +0000244 return SectionKind::getDataNoRel();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000245
246 switch (C->getRelocationInfo()) {
Chris Lattner5e693ed2009-07-28 03:13:23 +0000247 case Constant::NoRelocation:
Chris Lattnerf8d97102009-08-01 23:57:16 +0000248 return SectionKind::getDataNoRel();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000249 case Constant::LocalRelocation:
Chris Lattnerf8d97102009-08-01 23:57:16 +0000250 return SectionKind::getDataRelLocal();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000251 case Constant::GlobalRelocations:
Chris Lattnerf8d97102009-08-01 23:57:16 +0000252 return SectionKind::getDataRel();
Chris Lattner5e693ed2009-07-28 03:13:23 +0000253 }
Chandler Carruthf3e85022012-01-10 18:08:01 +0000254 llvm_unreachable("Invalid relocation");
Chris Lattner5e693ed2009-07-28 03:13:23 +0000255}
256
Rafael Espindola0709a7b2015-05-21 19:20:38 +0000257/// This method computes the appropriate section to emit the specified global
258/// variable or function definition. This should not be passed external (or
259/// available externally) globals.
260MCSection *
261TargetLoweringObjectFile::SectionForGlobal(const GlobalValue *GV,
262 SectionKind Kind, Mangler &Mang,
263 const TargetMachine &TM) const {
Chris Lattner5e693ed2009-07-28 03:13:23 +0000264 // Select section name.
Chris Lattner1ff90132009-08-06 16:39:58 +0000265 if (GV->hasSection())
266 return getExplicitSectionGlobal(GV, Kind, Mang, TM);
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000267
268
Chris Lattner5e693ed2009-07-28 03:13:23 +0000269 // Use default section depending on the 'type' of global
Chris Lattner26fb2772009-08-01 21:46:23 +0000270 return SelectSectionForGlobal(GV, Kind, Mang, TM);
Chris Lattner5e693ed2009-07-28 03:13:23 +0000271}
272
Rafael Espindola0709a7b2015-05-21 19:20:38 +0000273MCSection *TargetLoweringObjectFile::getSectionForJumpTable(
Rafael Espindola29786d42015-02-12 17:16:46 +0000274 const Function &F, Mangler &Mang, const TargetMachine &TM) const {
Mehdi Amini5c0fa582015-07-16 06:04:17 +0000275 return getSectionForConstant(F.getParent()->getDataLayout(),
276 SectionKind::getReadOnly(), /*C=*/nullptr);
Rafael Espindola29786d42015-02-12 17:16:46 +0000277}
278
Rafael Espindoladf195192015-02-17 23:34:51 +0000279bool TargetLoweringObjectFile::shouldPutJumpTableInFunctionSection(
280 bool UsesLabelDifference, const Function &F) const {
281 // In PIC mode, we need to emit the jump table to the same section as the
282 // function body itself, otherwise the label differences won't make sense.
283 // FIXME: Need a better predicate for this: what about custom entries?
284 if (UsesLabelDifference)
285 return true;
286
287 // We should also do if the section name is NULL or function is declared
288 // in discardable section
289 // FIXME: this isn't the right predicate, should be based on the MCSection
290 // for the function.
291 if (F.isWeakForLinker())
292 return true;
293
294 return false;
295}
296
Rafael Espindola0709a7b2015-05-21 19:20:38 +0000297/// Given a mergable constant with the specified size and relocation
298/// information, return a section that it should be placed in.
Mehdi Amini5c0fa582015-07-16 06:04:17 +0000299MCSection *TargetLoweringObjectFile::getSectionForConstant(
300 const DataLayout &DL, SectionKind Kind, const Constant *C) const {
Craig Topper062a2ba2014-04-25 05:30:21 +0000301 if (Kind.isReadOnly() && ReadOnlySection != nullptr)
Chris Lattner5e693ed2009-07-28 03:13:23 +0000302 return ReadOnlySection;
Anton Korobeynikov1df58862009-09-09 08:41:20 +0000303
Chris Lattner5e693ed2009-07-28 03:13:23 +0000304 return DataSection;
305}
306
Anton Korobeynikove42af362012-11-14 01:47:00 +0000307/// getTTypeGlobalReference - Return an MCExpr to use for a
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +0000308/// reference to the specified global variable from exception
309/// handling information.
Rafael Espindola15b26692014-02-09 14:50:44 +0000310const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference(
311 const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
Rafael Espindoladaeafb42014-02-19 17:23:20 +0000312 const TargetMachine &TM, MachineModuleInfo *MMI,
313 MCStreamer &Streamer) const {
Anton Korobeynikove42af362012-11-14 01:47:00 +0000314 const MCSymbolRefExpr *Ref =
Jim Grosbach13760bd2015-05-30 01:25:56 +0000315 MCSymbolRefExpr::create(TM.getSymbol(GV, Mang), getContext());
Anton Korobeynikove42af362012-11-14 01:47:00 +0000316
317 return getTTypeReference(Ref, Encoding, Streamer);
Chris Lattnerb8666022009-09-16 01:46:41 +0000318}
Chris Lattner5e693ed2009-07-28 03:13:23 +0000319
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +0000320const MCExpr *TargetLoweringObjectFile::
Anton Korobeynikove42af362012-11-14 01:47:00 +0000321getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding,
322 MCStreamer &Streamer) const {
Rafael Espindolaa01cdb02011-04-15 15:11:06 +0000323 switch (Encoding & 0x70) {
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +0000324 default:
Chris Lattner2104b8d2010-04-07 22:58:41 +0000325 report_fatal_error("We do not support this DWARF encoding yet!");
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +0000326 case dwarf::DW_EH_PE_absptr:
327 // Do nothing special
Anton Korobeynikove42af362012-11-14 01:47:00 +0000328 return Sym;
Chris Lattner03627cb2010-03-11 21:55:20 +0000329 case dwarf::DW_EH_PE_pcrel: {
330 // Emit a label to the streamer for the current position. This gives us
331 // .-foo addressing.
Jim Grosbach6f482002015-05-18 18:43:14 +0000332 MCSymbol *PCSym = getContext().createTempSymbol();
Chris Lattner03627cb2010-03-11 21:55:20 +0000333 Streamer.EmitLabel(PCSym);
Jim Grosbach13760bd2015-05-30 01:25:56 +0000334 const MCExpr *PC = MCSymbolRefExpr::create(PCSym, getContext());
335 return MCBinaryExpr::createSub(Sym, PC, getContext());
Chris Lattner03627cb2010-03-11 21:55:20 +0000336 }
337 }
Anton Korobeynikovae4ccc12010-02-15 22:35:59 +0000338}
David Blaikief2694972013-06-28 20:05:11 +0000339
Ulrich Weigand2b6fc8d2013-07-02 18:47:09 +0000340const MCExpr *TargetLoweringObjectFile::getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
David Blaikief2694972013-06-28 20:05:11 +0000341 // FIXME: It's not clear what, if any, default this should have - perhaps a
342 // null return could mean 'no location' & we should just do that here.
Jim Grosbach13760bd2015-05-30 01:25:56 +0000343 return MCSymbolRefExpr::create(Sym, *Ctx);
David Blaikief2694972013-06-28 20:05:11 +0000344}
David Majnemer7db449a2015-03-17 23:54:51 +0000345
346void TargetLoweringObjectFile::getNameWithPrefix(
Peter Collingbourne94d77862015-11-03 23:40:03 +0000347 SmallVectorImpl<char> &OutName, const GlobalValue *GV, Mangler &Mang,
348 const TargetMachine &TM) const {
349 Mang.getNameWithPrefix(OutName, GV, /*CannotUsePrivateLabel=*/false);
David Majnemer7db449a2015-03-17 23:54:51 +0000350}