1 //===-- MCTargetDesc/AMDGPUMCAsmInfo.cpp - Assembly Info ------------------===//
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
8 //===----------------------------------------------------------------------===//
10 #include "AMDGPUMCAsmInfo.h"
11 #include "llvm/ADT/Triple.h"
12 #include "llvm/MC/MCSubtargetInfo.h"
13 #include "MCTargetDesc/AMDGPUMCTargetDesc.h"
17 AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(const Triple
&TT
) : MCAsmInfoELF() {
18 CodePointerSize
= (TT
.getArch() == Triple::amdgcn
) ? 8 : 4;
20 HasSingleParameterDotFile
= false;
21 //===------------------------------------------------------------------===//
24 // This is the maximum instruction encoded size for gfx10. With a known
25 // subtarget, it can be reduced to 8 bytes.
26 MaxInstLength
= (TT
.getArch() == Triple::amdgcn
) ? 20 : 16;
27 SeparatorString
= "\n";
29 PrivateLabelPrefix
= "";
30 InlineAsmStart
= ";#ASMSTART";
31 InlineAsmEnd
= ";#ASMEND";
33 //===--- Data Emission Directives -------------------------------------===//
34 SunStyleELFSectionSwitchSyntax
= true;
35 UsesELFSectionDirectiveForBSS
= true;
37 //===--- Global Variable Emission Directives --------------------------===//
38 HasAggressiveSymbolFolding
= true;
39 COMMDirectiveAlignmentIsInBytes
= false;
40 HasNoDeadStrip
= true;
41 WeakRefDirective
= ".weakref\t";
42 //===--- Dwarf Emission Directives -----------------------------------===//
43 SupportsDebugInformation
= true;
46 bool AMDGPUMCAsmInfo::shouldOmitSectionDirective(StringRef SectionName
) const {
47 return SectionName
== ".hsatext" || SectionName
== ".hsadata_global_agent" ||
48 SectionName
== ".hsadata_global_program" ||
49 SectionName
== ".hsarodata_readonly_agent" ||
50 MCAsmInfo::shouldOmitSectionDirective(SectionName
);
53 unsigned AMDGPUMCAsmInfo::getMaxInstLength(const MCSubtargetInfo
*STI
) const {
54 if (!STI
|| STI
->getTargetTriple().getArch() == Triple::r600
)
57 // Maximum for NSA encoded images
58 if (STI
->getFeatureBits()[AMDGPU::FeatureNSAEncoding
])
61 // 64-bit instruction with 32-bit literal.
62 if (STI
->getFeatureBits()[AMDGPU::FeatureVOP3Literal
])