mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-28 07:05:11 +00:00
ab3be33d40
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298846 91177308-0d34-0410-b5e6-96231b3b80d8
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);
|
|
}
|