LLVM 22.0.0git
AMDGPUMCAsmInfo.cpp
Go to the documentation of this file.
1//===-- MCTargetDesc/AMDGPUMCAsmInfo.cpp - Assembly Info ------------------===//
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/// \file
8//===----------------------------------------------------------------------===//
9
10#include "AMDGPUMCAsmInfo.h"
13#include "llvm/MC/MCExpr.h"
16
17using namespace llvm;
18
20 {AMDGPUMCExpr::S_GOTPCREL, "gotpcrel"},
21 {AMDGPUMCExpr::S_GOTPCREL32_LO, "gotpcrel32@lo"},
22 {AMDGPUMCExpr::S_GOTPCREL32_HI, "gotpcrel32@hi"},
23 {AMDGPUMCExpr::S_REL32_LO, "rel32@lo"},
24 {AMDGPUMCExpr::S_REL32_HI, "rel32@hi"},
25 {AMDGPUMCExpr::S_REL64, "rel64"},
26 {AMDGPUMCExpr::S_ABS32_LO, "abs32@lo"},
27 {AMDGPUMCExpr::S_ABS32_HI, "abs32@hi"},
28 {AMDGPUMCExpr::S_ABS64, "abs64"},
29};
30
32 const MCTargetOptions &Options) {
33 CodePointerSize = (TT.isAMDGCN()) ? 8 : 4;
34 StackGrowsUp = true;
36 //===------------------------------------------------------------------===//
38
39 // This is the maximum instruction encoded size for gfx10. With a known
40 // subtarget, it can be reduced to 8 bytes.
41 MaxInstLength = (TT.isAMDGCN()) ? 20 : 16;
42 SeparatorString = "\n";
43 CommentString = ";";
44 InlineAsmStart = ";#ASMSTART";
45 InlineAsmEnd = ";#ASMEND";
47
48 //===--- Data Emission Directives -------------------------------------===//
50
51 //===--- Global Variable Emission Directives --------------------------===//
53 HasNoDeadStrip = true;
54 //===--- Dwarf Emission Directives -----------------------------------===//
56 UsesCFIWithoutEH = true;
57 DwarfRegNumForCFI = true;
58
61}
62
64 return SectionName == ".hsatext" || SectionName == ".hsadata_global_agent" ||
65 SectionName == ".hsadata_global_program" ||
66 SectionName == ".hsarodata_readonly_agent" ||
68}
69
71 if (!STI || STI->getTargetTriple().getArch() == Triple::r600)
72 return MaxInstLength;
73
74 // Maximum for NSA encoded images
75 if (STI->hasFeature(AMDGPU::FeatureNSAEncoding))
76 return 20;
77
78 // VOP3PX/VOP3PX2 encoding.
79 if (STI->hasFeature(AMDGPU::FeatureGFX950Insts) ||
80 STI->hasFeature(AMDGPU::FeatureGFX1250Insts))
81 return 16;
82
83 // 64-bit instruction with 32-bit literal.
84 if (STI->hasFeature(AMDGPU::FeatureVOP3Literal))
85 return 12;
86
87 return 8;
88}
const MCAsmInfo::AtSpecifier atSpecifiers[]
Provides AMDGPU specific target descriptions.
static LVOptions Options
Definition LVOptions.cpp:25
unsigned getMaxInstLength(const MCSubtargetInfo *STI) const override
Returns the maximum possible encoded instruction size in bytes.
AMDGPUMCAsmInfo(const Triple &TT, const MCTargetOptions &Options)
bool shouldOmitSectionDirective(StringRef SectionName) const override
Return true if the .section directive should be omitted when emitting SectionName.
unsigned MinInstAlignment
Every possible instruction length is a multiple of this value.
Definition MCAsmInfo.h:123
bool HasNoDeadStrip
True if this target supports the MachO .no_dead_strip directive.
Definition MCAsmInfo.h:318
void initializeAtSpecifiers(ArrayRef< AtSpecifier >)
bool UseIntegratedAssembler
Should we use the integrated assembler?
Definition MCAsmInfo.h:412
bool UsesSetToEquateSymbol
Use .set instead of = to equate a symbol to an expression.
Definition MCAsmInfo.h:149
unsigned MaxInstLength
This is the maximum possible length of an instruction, which is needed to compute the size of an inli...
Definition MCAsmInfo.h:119
const char * InlineAsmStart
If these are nonempty, they contain a directive to emit before and after an inline assembly statement...
Definition MCAsmInfo.h:174
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition MCAsmInfo.h:263
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition MCAsmInfo.h:356
bool StackGrowsUp
True if target stack grow up. Default is false.
Definition MCAsmInfo.h:97
const char * InlineAsmEnd
Definition MCAsmInfo.h:175
const char * SeparatorString
This string, if specified, is used to separate instructions from each other when on the same line.
Definition MCAsmInfo.h:131
virtual bool shouldOmitSectionDirective(StringRef SectionName) const
Return true if the .section directive should be omitted when emitting SectionName.
bool UsesCFIWithoutEH
True if target uses CFI unwind information for other purposes than EH (debugging / sanitizers) when E...
Definition MCAsmInfo.h:363
bool HasSingleParameterDotFile
True if the target has a single parameter .file directive, this is true for ELF targets.
Definition MCAsmInfo.h:310
bool COMMDirectiveAlignmentIsInBytes
True is .comm's and .lcomms optional alignment is to be specified in bytes instead of log2(n).
Definition MCAsmInfo.h:294
bool DwarfRegNumForCFI
True if dwarf register numbers are printed instead of symbolic register names in ....
Definition MCAsmInfo.h:382
unsigned CodePointerSize
Code pointer size in bytes. Default is 4.
Definition MCAsmInfo.h:87
StringRef CommentString
This indicates the comment string used by the assembler.
Definition MCAsmInfo.h:135
Generic base class for all target subtargets.
bool hasFeature(unsigned Feature) const
const Triple & getTargetTriple() const
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
ArchType getArch() const
Get the parsed architecture type of this triple.
Definition Triple.h:411
This is an optimization pass for GlobalISel generic memory operations.