LLVM  12.0.0git
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 //===----------------------------------------------------------------------===//
10 #include "AMDGPUMCAsmInfo.h"
11 #include "llvm/ADT/Triple.h"
15 using namespace llvm;
18  const MCTargetOptions &Options)
19  : MCAsmInfoELF() {
20  CodePointerSize = (TT.getArch() == Triple::amdgcn) ? 8 : 4;
21  StackGrowsUp = true;
23  //===------------------------------------------------------------------===//
24  MinInstAlignment = 4;
26  // This is the maximum instruction encoded size for gfx10. With a known
27  // subtarget, it can be reduced to 8 bytes.
28  MaxInstLength = (TT.getArch() == Triple::amdgcn) ? 20 : 16;
29  SeparatorString = "\n";
30  CommentString = ";";
31  PrivateLabelPrefix = "";
32  InlineAsmStart = ";#ASMSTART";
33  InlineAsmEnd = ";#ASMEND";
35  //===--- Data Emission Directives -------------------------------------===//
39  //===--- Global Variable Emission Directives --------------------------===//
42  HasNoDeadStrip = true;
43  WeakRefDirective = ".weakref\t";
44  //===--- Dwarf Emission Directives -----------------------------------===//
46  DwarfRegNumForCFI = true;
48  UseIntegratedAssembler = false;
49 }
52  return SectionName == ".hsatext" || SectionName == ".hsadata_global_agent" ||
53  SectionName == ".hsadata_global_program" ||
54  SectionName == ".hsarodata_readonly_agent" ||
56 }
59  if (!STI || STI->getTargetTriple().getArch() == Triple::r600)
60  return MaxInstLength;
62  // Maximum for NSA encoded images
63  if (STI->getFeatureBits()[AMDGPU::FeatureNSAEncoding])
64  return 20;
66  // 64-bit instruction with 32-bit literal.
67  if (STI->getFeatureBits()[AMDGPU::FeatureVOP3Literal])
68  return 12;
70  return 8;
71 }
bool HasSingleParameterDotFile
True if the target has a single parameter .file directive, this is true for ELF targets.
Definition: MCAsmInfo.h:300
bool UseIntegratedAssembler
Should we use the integrated assembler? The integrated assembler should be enabled by default (by the...
Definition: MCAsmInfo.h:389
StringRef PrivateLabelPrefix
This prefix is used for labels for basic blocks.
Definition: MCAsmInfo.h:136
bool DwarfRegNumForCFI
True if dwarf register numbers are printed instead of symbolic register names in .cfi_* directives.
Definition: MCAsmInfo.h:368
This class represents lattice values for constants.
Definition: AllocatorList.h:23
bool shouldOmitSectionDirective(StringRef SectionName) const override
Return true if the .section directive should be omitted when emitting SectionName.
const char * SeparatorString
This string, if specified, is used to separate instructions from each other when on the same line...
Definition: MCAsmInfo.h:114
const Triple & getTargetTriple() const
bool HasNoDeadStrip
True if this target supports the MachO .no_dead_strip directive.
Definition: MCAsmInfo.h:308
const FeatureBitset & getFeatureBits() const
StringRef CommentString
This indicates the comment character used by the assembler.
Definition: MCAsmInfo.h:118
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition: MCAsmInfo.h:238
bool HasAggressiveSymbolFolding
False if the assembler requires that we use.
Definition: MCAsmInfo.h:280
bool StackGrowsUp
True if target stack grow up. Default is false.
Definition: MCAsmInfo.h:73
bool SunStyleELFSectionSwitchSyntax
This is true if this target uses "Sun Style" syntax for section switching ("#alloc,#write" etc) instead of the normal ELF syntax (,"a,w") in .section directives.
Definition: MCAsmInfo.h:233
AMDGPUMCAsmInfo(const Triple &TT, const MCTargetOptions &Options)
virtual bool shouldOmitSectionDirective(StringRef SectionName) const
Return true if the .section directive should be omitted when emitting SectionName.
Definition: MCAsmInfo.cpp:122
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:300
const char * InlineAsmStart
If these are nonempty, they contain a directive to emit before and after an inline assembly statement...
Definition: MCAsmInfo.h:146
bool COMMDirectiveAlignmentIsInBytes
True is .comm's and .lcomms optional alignment is to be specified in bytes instead of log2(n)...
Definition: MCAsmInfo.h:284
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition: MCAsmInfo.h:350
const char * WeakRefDirective
This directive, if non-null, is used to declare a global as being a weak undefined symbol...
Definition: MCAsmInfo.h:319
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
const char * InlineAsmEnd
Definition: MCAsmInfo.h:147
unsigned MinInstAlignment
Every possible instruction length is a multiple of this value.
Definition: MCAsmInfo.h:106
unsigned getMaxInstLength(const MCSubtargetInfo *STI) const override
Returns the maximum possible encoded instruction size in bytes.
unsigned CodePointerSize
Code pointer size in bytes. Default is 4.
Definition: MCAsmInfo.h:63
Provides AMDGPU specific target descriptions.
Generic base class for all target subtargets.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
unsigned MaxInstLength
This is the maximum possible length of an instruction, which is needed to compute the size of an inli...
Definition: MCAsmInfo.h:102