[InstCombine] Signed saturation patterns
[llvm-complete.git] / lib / Target / AMDGPU / AMDGPUTargetObjectFile.cpp
blob6569980d2c75c1090a572a80f98d48aff3806bc3
1 //===-- AMDGPUHSATargetObjectFile.cpp - AMDGPU Object Files ---------------===//
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 //===----------------------------------------------------------------------===//
9 #include "AMDGPUTargetObjectFile.h"
10 #include "AMDGPU.h"
11 #include "AMDGPUTargetMachine.h"
12 #include "Utils/AMDGPUBaseInfo.h"
13 #include "llvm/BinaryFormat/ELF.h"
14 #include "llvm/MC/MCContext.h"
15 #include "llvm/MC/MCSectionELF.h"
17 using namespace llvm;
19 //===----------------------------------------------------------------------===//
20 // Generic Object File
21 //===----------------------------------------------------------------------===//
23 MCSection *AMDGPUTargetObjectFile::SelectSectionForGlobal(
24 const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
25 if (Kind.isReadOnly() && AMDGPU::isReadOnlySegment(GO) &&
26 AMDGPU::shouldEmitConstantsToTextSection(TM.getTargetTriple()))
27 return TextSection;
29 return TargetLoweringObjectFileELF::SelectSectionForGlobal(GO, Kind, TM);
32 MCSection *AMDGPUTargetObjectFile::getExplicitSectionGlobal(
33 const GlobalObject *GO, SectionKind SK, const TargetMachine &TM) const {
34 // Set metadata access for the explicit section
35 StringRef SectionName = GO->getSection();
36 if (SectionName.startswith(".AMDGPU.comment."))
37 SK = SectionKind::getMetadata();
39 return TargetLoweringObjectFileELF::getExplicitSectionGlobal(GO, SK, TM);