2015-06-27 05:15:07 +08:00
|
|
|
//===-- AMDGPUBaseInfo.h - Top level definitions for AMDGPU -----*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUBASEINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUBASEINFO_H
|
|
|
|
|
|
|
|
#include "AMDKernelCodeT.h"
|
2016-04-07 03:40:20 +08:00
|
|
|
#include "llvm/IR/CallingConv.h"
|
2015-06-27 05:15:07 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class FeatureBitset;
|
2015-12-16 00:26:16 +08:00
|
|
|
class Function;
|
2015-12-03 01:00:42 +08:00
|
|
|
class GlobalValue;
|
2015-09-26 05:41:28 +08:00
|
|
|
class MCContext;
|
|
|
|
class MCSection;
|
2015-12-22 02:44:27 +08:00
|
|
|
class MCSubtargetInfo;
|
2015-06-27 05:15:07 +08:00
|
|
|
|
|
|
|
namespace AMDGPU {
|
|
|
|
|
|
|
|
struct IsaVersion {
|
|
|
|
unsigned Major;
|
|
|
|
unsigned Minor;
|
|
|
|
unsigned Stepping;
|
|
|
|
};
|
|
|
|
|
|
|
|
IsaVersion getIsaVersion(const FeatureBitset &Features);
|
2015-06-27 05:58:31 +08:00
|
|
|
void initDefaultAMDKernelCodeT(amd_kernel_code_t &Header,
|
|
|
|
const FeatureBitset &Features);
|
2015-09-26 05:41:28 +08:00
|
|
|
MCSection *getHSATextSection(MCContext &Ctx);
|
2015-06-27 05:15:07 +08:00
|
|
|
|
2015-12-03 03:47:57 +08:00
|
|
|
MCSection *getHSADataGlobalAgentSection(MCContext &Ctx);
|
|
|
|
|
|
|
|
MCSection *getHSADataGlobalProgramSection(MCContext &Ctx);
|
|
|
|
|
2015-12-03 11:34:32 +08:00
|
|
|
MCSection *getHSARodataReadonlyAgentSection(MCContext &Ctx);
|
|
|
|
|
2015-12-03 01:00:42 +08:00
|
|
|
bool isGroupSegment(const GlobalValue *GV);
|
2015-12-03 03:47:57 +08:00
|
|
|
bool isGlobalSegment(const GlobalValue *GV);
|
|
|
|
bool isReadOnlySegment(const GlobalValue *GV);
|
2015-12-03 01:00:42 +08:00
|
|
|
|
2016-09-07 04:22:28 +08:00
|
|
|
/// \returns Integer value requested using \p F's \p Name attribute.
|
|
|
|
///
|
|
|
|
/// \returns \p Default if attribute is not present.
|
|
|
|
///
|
|
|
|
/// \returns \p Default and emits error if requested value cannot be converted
|
|
|
|
/// to integer.
|
2016-05-12 10:45:18 +08:00
|
|
|
int getIntegerAttribute(const Function &F, StringRef Name, int Default);
|
|
|
|
|
2016-09-07 04:22:28 +08:00
|
|
|
/// \returns A pair of integer values requested using \p F's \p Name attribute
|
|
|
|
/// in "first[,second]" format ("second" is optional unless \p OnlyFirstRequired
|
|
|
|
/// is false).
|
|
|
|
///
|
|
|
|
/// \returns \p Default if attribute is not present.
|
|
|
|
///
|
|
|
|
/// \returns \p Default and emits error if one of the requested values cannot be
|
|
|
|
/// converted to integer, or \p OnlyFirstRequired is false and "second" value is
|
|
|
|
/// not present.
|
|
|
|
std::pair<int, int> getIntegerPairAttribute(const Function &F,
|
|
|
|
StringRef Name,
|
|
|
|
std::pair<int, int> Default,
|
|
|
|
bool OnlyFirstRequired = false);
|
|
|
|
|
2016-01-13 19:45:36 +08:00
|
|
|
unsigned getInitialPSInputAddr(const Function &F);
|
|
|
|
|
2016-04-07 03:40:20 +08:00
|
|
|
bool isShader(CallingConv::ID cc);
|
|
|
|
bool isCompute(CallingConv::ID cc);
|
2015-12-16 00:26:16 +08:00
|
|
|
|
2015-12-22 02:44:27 +08:00
|
|
|
bool isSI(const MCSubtargetInfo &STI);
|
|
|
|
bool isCI(const MCSubtargetInfo &STI);
|
|
|
|
bool isVI(const MCSubtargetInfo &STI);
|
|
|
|
|
|
|
|
/// If \p Reg is a pseudo reg, return the correct hardware register given
|
|
|
|
/// \p STI otherwise return \p Reg.
|
|
|
|
unsigned getMCReg(unsigned Reg, const MCSubtargetInfo &STI);
|
|
|
|
|
2015-06-27 05:15:07 +08:00
|
|
|
} // end namespace AMDGPU
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|