LLVM  16.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  CodePointerSize = (TT.getArch() == Triple::amdgcn) ? 8 : 4;
20  StackGrowsUp = true;
22  //===------------------------------------------------------------------===//
23  MinInstAlignment = 4;
24 
25  // This is the maximum instruction encoded size for gfx10. With a known
26  // subtarget, it can be reduced to 8 bytes.
27  MaxInstLength = (TT.getArch() == Triple::amdgcn) ? 20 : 16;
28  SeparatorString = "\n";
29  CommentString = ";";
30  InlineAsmStart = ";#ASMSTART";
31  InlineAsmEnd = ";#ASMEND";
32 
33  //===--- Data Emission Directives -------------------------------------===//
36 
37  //===--- Global Variable Emission Directives --------------------------===//
40  HasNoDeadStrip = true;
41  //===--- Dwarf Emission Directives -----------------------------------===//
43  UsesCFIForDebug = true;
44  DwarfRegNumForCFI = true;
45 
46  UseIntegratedAssembler = false;
47 }
48 
50  return SectionName == ".hsatext" || SectionName == ".hsadata_global_agent" ||
51  SectionName == ".hsadata_global_program" ||
52  SectionName == ".hsarodata_readonly_agent" ||
54 }
55 
57  if (!STI || STI->getTargetTriple().getArch() == Triple::r600)
58  return MaxInstLength;
59 
60  // Maximum for NSA encoded images
61  if (STI->getFeatureBits()[AMDGPU::FeatureNSAEncoding])
62  return 20;
63 
64  // 64-bit instruction with 32-bit literal.
65  if (STI->getFeatureBits()[AMDGPU::FeatureVOP3Literal])
66  return 12;
67 
68  return 8;
69 }
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
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:74
llvm::MCAsmInfo::SupportsDebugInformation
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition: MCAsmInfo.h:449
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::MCAsmInfo::HasNoDeadStrip
bool HasNoDeadStrip
True if this target supports the MachO .no_dead_strip directive.
Definition: MCAsmInfo.h:403
llvm::MCAsmInfo::InlineAsmEnd
const char * InlineAsmEnd
Definition: MCAsmInfo.h:183
llvm::MCAsmInfo::UsesELFSectionDirectiveForBSS
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition: MCAsmInfo.h:319
llvm::MCAsmInfo::UsesCFIForDebug
bool UsesCFIForDebug
True if target uses CFI unwind information for debugging purpose when ExceptionsType == ExceptionHand...
Definition: MCAsmInfo.h:456
llvm::MCAsmInfo::shouldOmitSectionDirective
virtual bool shouldOmitSectionDirective(StringRef SectionName) const
Return true if the .section directive should be omitted when emitting SectionName.
Definition: MCAsmInfo.cpp:137
llvm::MCAsmInfo::HasSingleParameterDotFile
bool HasSingleParameterDotFile
True if the target has a single parameter .file directive, this is true for ELF targets.
Definition: MCAsmInfo.h:391
llvm::MCSubtargetInfo::getTargetTriple
const Triple & getTargetTriple() const
Definition: MCSubtargetInfo.h:108
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:112
llvm::AMDGPUMCAsmInfo::getMaxInstLength
unsigned getMaxInstLength(const MCSubtargetInfo *STI) const override
Returns the maximum possible encoded instruction size in bytes.
Definition: AMDGPUMCAsmInfo.cpp:56
llvm::Triple::r600
@ r600
Definition: Triple.h:73
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:514
llvm::Triple::getArch
ArchType getArch() const
Get the parsed architecture type of this triple.
Definition: Triple.h:346
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:49
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:483
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:365
llvm::MCAsmInfo::CodePointerSize
unsigned CodePointerSize
Code pointer size in bytes. Default is 4.
Definition: MCAsmInfo.h:72
llvm::MCTargetOptions
Definition: MCTargetOptions.h:37
Triple.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::MCAsmInfo::SunStyleELFSectionSwitchSyntax
bool SunStyleELFSectionSwitchSyntax
This is true if this target uses "Sun Style" syntax for section switching ("#alloc,...
Definition: MCAsmInfo.h:314
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:182
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:361
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:76