mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-22 12:33:33 +02:00
da52f0e643
As we introduced target triple environment amdgiz and amdgizcl, the address space values are no longer enums. We have to decide the value by target triple. The basic idea is to use struct AMDGPUAS to represent address space values. For address space values which are not depend on target triple, use static const members, so that they don't occupy extra memory space and is equivalent to a compile time constant. Since the struct is lightweight and cheap, it can be created on the fly at the point of usage. Or it can be added as member to a pass and created at the beginning of the run* function. Differential Revision: https://reviews.llvm.org/D31284 llvm-svn: 298846
33 lines
1.2 KiB
C++
33 lines
1.2 KiB
C++
//===-- 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.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "AMDGPUTargetMachine.h"
|
|
#include "AMDGPUTargetObjectFile.h"
|
|
#include "AMDGPU.h"
|
|
#include "llvm/MC/MCContext.h"
|
|
#include "llvm/MC/MCSectionELF.h"
|
|
#include "llvm/Support/ELF.h"
|
|
#include "Utils/AMDGPUBaseInfo.h"
|
|
|
|
using namespace llvm;
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Generic Object File
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
MCSection *AMDGPUTargetObjectFile::SelectSectionForGlobal(
|
|
const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const {
|
|
auto AS = static_cast<const AMDGPUTargetMachine*>(&TM)->getAMDGPUAS();
|
|
if (Kind.isReadOnly() && AMDGPU::isReadOnlySegment(GO, AS) &&
|
|
AMDGPU::shouldEmitConstantsToTextSection(TM.getTargetTriple()))
|
|
return TextSection;
|
|
|
|
return TargetLoweringObjectFileELF::SelectSectionForGlobal(GO, Kind, TM);
|
|
}
|