]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCAsmInfo.cpp
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / llvm / lib / Target / AMDGPU / MCTargetDesc / AMDGPUMCAsmInfo.cpp
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"
11 #include "llvm/ADT/Triple.h"
12 #include "llvm/MC/MCSubtargetInfo.h"
13 #include "MCTargetDesc/AMDGPUMCTargetDesc.h"
14
15 using namespace llvm;
16
17 AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(const Triple &TT) : MCAsmInfoELF() {
18   CodePointerSize = (TT.getArch() == Triple::amdgcn) ? 8 : 4;
19   StackGrowsUp = true;
20   HasSingleParameterDotFile = false;
21   //===------------------------------------------------------------------===//
22   MinInstAlignment = 4;
23
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";
28   CommentString = ";";
29   PrivateLabelPrefix = "";
30   InlineAsmStart = ";#ASMSTART";
31   InlineAsmEnd = ";#ASMEND";
32
33   //===--- Data Emission Directives -------------------------------------===//
34   SunStyleELFSectionSwitchSyntax = true;
35   UsesELFSectionDirectiveForBSS = true;
36
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;
44 }
45
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);
51 }
52
53 unsigned AMDGPUMCAsmInfo::getMaxInstLength(const MCSubtargetInfo *STI) const {
54   if (!STI || STI->getTargetTriple().getArch() == Triple::r600)
55     return MaxInstLength;
56
57   // Maximum for NSA encoded images
58   if (STI->getFeatureBits()[AMDGPU::FeatureNSAEncoding])
59     return 20;
60
61   // 64-bit instruction with 32-bit literal.
62   if (STI->getFeatureBits()[AMDGPU::FeatureVOP3Literal])
63     return 12;
64
65   return 8;
66 }