2015-09-25 21:41:28 +00:00
|
|
|
//===-- AMDGPUHSATargetObjectFile.cpp - AMDGPU Object Files ---------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2017-03-27 14:04:01 +00:00
|
|
|
#include "AMDGPUTargetMachine.h"
|
2015-12-10 02:13:01 +00:00
|
|
|
#include "AMDGPUTargetObjectFile.h"
|
2015-12-02 19:47:57 +00:00
|
|
|
#include "AMDGPU.h"
|
2015-09-25 21:41:28 +00:00
|
|
|
#include "llvm/MC/MCContext.h"
|
|
|
|
#include "llvm/MC/MCSectionELF.h"
|
|
|
|
#include "llvm/Support/ELF.h"
|
2016-10-20 18:12:38 +00:00
|
|
|
#include "Utils/AMDGPUBaseInfo.h"
|
2015-09-25 21:41:28 +00:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2015-12-10 02:13:01 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Generic Object File
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-09-16 07:33:15 +00:00
|
|
|
MCSection *AMDGPUTargetObjectFile::SelectSectionForGlobal(
|
2016-10-24 19:23:39 +00:00
|
|
|
const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
|
2017-03-27 14:04:01 +00:00
|
|
|
auto AS = static_cast<const AMDGPUTargetMachine*>(&TM)->getAMDGPUAS();
|
|
|
|
if (Kind.isReadOnly() && AMDGPU::isReadOnlySegment(GO, AS) &&
|
2016-10-20 18:12:38 +00:00
|
|
|
AMDGPU::shouldEmitConstantsToTextSection(TM.getTargetTriple()))
|
2015-12-10 02:13:01 +00:00
|
|
|
return TextSection;
|
|
|
|
|
2016-10-24 19:23:39 +00:00
|
|
|
return TargetLoweringObjectFileELF::SelectSectionForGlobal(GO, Kind, TM);
|
2015-12-10 02:13:01 +00:00
|
|
|
}
|