LLVM  13.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"
11 #include "llvm/ADT/Triple.h"
14 
15 using namespace llvm;
16 
18  const MCTargetOptions &Options)
19  : MCAsmInfoELF() {
20  CodePointerSize = (TT.getArch() == Triple::amdgcn) ? 8 : 4;
21  StackGrowsUp = true;
23  //===------------------------------------------------------------------===//
24  MinInstAlignment = 4;
25 
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";
34 
35  //===--- Data Emission Directives -------------------------------------===//
38 
39  //===--- Global Variable Emission Directives --------------------------===//
42  HasNoDeadStrip = true;
43  //===--- Dwarf Emission Directives -----------------------------------===//
45  UsesCFIForDebug = true;
46  DwarfRegNumForCFI = true;
47 
48  UseIntegratedAssembler = false;
49 }
50 
52  return SectionName == ".hsatext" || SectionName == ".hsadata_global_agent" ||
53  SectionName == ".hsadata_global_program" ||
54  SectionName == ".hsarodata_readonly_agent" ||
56 }
57 
59  if (!STI || STI->getTargetTriple().getArch() == Triple::r600)
60  return MaxInstLength;
61 
62  // Maximum for NSA encoded images
63  if (STI->getFeatureBits()[AMDGPU::FeatureNSAEncoding])
64  return 20;
65 
66  // 64-bit instruction with 32-bit literal.
67  if (STI->getFeatureBits()[AMDGPU::FeatureVOP3Literal])
68  return 12;
69 
70  return 8;
71 }
llvm::MCAsmInfoELF
Definition: MCAsmInfoELF.h:16
llvm
Definition: AllocatorList.h:23
llvm::MCAsmInfo::StackGrowsUp
bool StackGrowsUp
True if target stack grow up. Default is false.
Definition: MCAsmInfo.h:82
llvm::Triple::amdgcn
@ amdgcn
Definition: Triple.h:72
llvm::MCAsmInfo::SupportsDebugInformation
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition: MCAsmInfo.h:438
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::MCAsmInfo::HasNoDeadStrip
bool HasNoDeadStrip
True if this target supports the MachO .no_dead_strip directive.
Definition: MCAsmInfo.h:396
llvm::MCAsmInfo::InlineAsmEnd
const char * InlineAsmEnd
Definition: MCAsmInfo.h:180
llvm::MCAsmInfo::UsesELFSectionDirectiveForBSS
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition: MCAsmInfo.h:316
llvm::MCAsmInfo::PrivateLabelPrefix
StringRef PrivateLabelPrefix
This prefix is used for labels for basic blocks.
Definition: MCAsmInfo.h:169
llvm::MCAsmInfo::UsesCFIForDebug
bool UsesCFIForDebug
True if target uses CFI unwind information for debugging purpose when ExceptionsType == ExceptionHand...
Definition: MCAsmInfo.h:445
llvm::MCAsmInfo::shouldOmitSectionDirective
virtual bool shouldOmitSectionDirective(StringRef SectionName) const
Return true if the .section directive should be omitted when emitting SectionName.
Definition: MCAsmInfo.cpp:133
llvm::MCAsmInfo::HasSingleParameterDotFile
bool HasSingleParameterDotFile
True if the target has a single parameter .file directive, this is true for ELF targets.
Definition: MCAsmInfo.h:388
llvm::MCSubtargetInfo::getTargetTriple
const Triple & getTargetTriple() const
Definition: MCSubtargetInfo.h:107
llvm::MCAsmInfo::MinInstAlignment
unsigned MinInstAlignment
Every possible instruction length is a multiple of this value.
Definition: MCAsmInfo.h:115
MCSubtargetInfo.h
llvm::MCSubtargetInfo::getFeatureBits
const FeatureBitset & getFeatureBits() const
Definition: MCSubtargetInfo.h:111
llvm::AMDGPUMCAsmInfo::getMaxInstLength
unsigned getMaxInstLength(const MCSubtargetInfo *STI) const override
Returns the maximum possible encoded instruction size in bytes.
Definition: AMDGPUMCAsmInfo.cpp:58
llvm::Triple::r600
@ r600
Definition: Triple.h:71
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::MCAsmInfo::UseIntegratedAssembler
bool UseIntegratedAssembler
Should we use the integrated assembler? The integrated assembler should be enabled by default (by the...
Definition: MCAsmInfo.h:495
llvm::Triple::getArch
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:307
llvm::MCAsmInfo::SeparatorString
const char * SeparatorString
This string, if specified, is used to separate instructions from each other when on the same line.
Definition: MCAsmInfo.h:131
llvm::AMDGPUMCAsmInfo::shouldOmitSectionDirective
bool shouldOmitSectionDirective(StringRef SectionName) const override
Return true if the .section directive should be omitted when emitting SectionName.
Definition: AMDGPUMCAsmInfo.cpp:51
llvm::AMDGPUMCAsmInfo::AMDGPUMCAsmInfo
AMDGPUMCAsmInfo(const Triple &TT, const MCTargetOptions &Options)
Definition: AMDGPUMCAsmInfo.cpp:17
AMDGPUMCTargetDesc.h
llvm::MCAsmInfo::CommentString
StringRef CommentString
This indicates the comment string used by the assembler.
Definition: MCAsmInfo.h:135
llvm::MCAsmInfo::DwarfRegNumForCFI
bool DwarfRegNumForCFI
True if dwarf register numbers are printed instead of symbolic register names in ....
Definition: MCAsmInfo.h:468
llvm::MCAsmInfo::COMMDirectiveAlignmentIsInBytes
bool COMMDirectiveAlignmentIsInBytes
True is .comm's and .lcomms optional alignment is to be specified in bytes instead of log2(n).
Definition: MCAsmInfo.h:362
llvm::MCAsmInfo::CodePointerSize
unsigned CodePointerSize
Code pointer size in bytes. Default is 4.
Definition: MCAsmInfo.h:72
llvm::MCTargetOptions
Definition: MCTargetOptions.h:36
Triple.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::MCAsmInfo::SunStyleELFSectionSwitchSyntax
bool SunStyleELFSectionSwitchSyntax
This is true if this target uses "Sun Style" syntax for section switching ("#alloc,...
Definition: MCAsmInfo.h:311
llvm::MCAsmInfo::InlineAsmStart
const char * InlineAsmStart
If these are nonempty, they contain a directive to emit before and after an inline assembly statement...
Definition: MCAsmInfo.h:179
AMDGPUMCAsmInfo.h
llvm::SectionName
Definition: DWARFSection.h:21
llvm::MCAsmInfo::MaxInstLength
unsigned MaxInstLength
This is the maximum possible length of an instruction, which is needed to compute the size of an inli...
Definition: MCAsmInfo.h:111
llvm::MCAsmInfo::HasAggressiveSymbolFolding
bool HasAggressiveSymbolFolding
False if the assembler requires that we use.
Definition: MCAsmInfo.h:358
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75