145bb48eaSTom Stellard //===-- MCTargetDesc/AMDGPUMCAsmInfo.cpp - Assembly Info ------------------===// 245bb48eaSTom Stellard // 32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 645bb48eaSTom Stellard // 745bb48eaSTom Stellard /// \file 845bb48eaSTom Stellard //===----------------------------------------------------------------------===// 945bb48eaSTom Stellard 1045bb48eaSTom Stellard #include "AMDGPUMCAsmInfo.h" 1101e062f5SMatt Arsenault #include "llvm/ADT/Triple.h" 12*ca64ef20SMatt Arsenault #include "llvm/MC/MCSubtargetInfo.h" 13*ca64ef20SMatt Arsenault #include "MCTargetDesc/AMDGPUMCTargetDesc.h" 1445bb48eaSTom Stellard 1545bb48eaSTom Stellard using namespace llvm; 1601e062f5SMatt Arsenault 1750f17235SDaniel Sanders AMDGPUMCAsmInfo::AMDGPUMCAsmInfo(const Triple &TT) : MCAsmInfoELF() { 1812096848SKonstantin Zhuravlyov CodePointerSize = (TT.getArch() == Triple::amdgcn) ? 8 : 4; 19df6539f4SMatt Arsenault StackGrowsUp = true; 2045bb48eaSTom Stellard HasSingleParameterDotFile = false; 2145bb48eaSTom Stellard //===------------------------------------------------------------------===// 22ed1fd7e0SMatt Arsenault MinInstAlignment = 4; 23*ca64ef20SMatt Arsenault 24*ca64ef20SMatt Arsenault // This is the maximum instruction encoded size for gfx10. With a known 25*ca64ef20SMatt Arsenault // subtarget, it can be reduced to 8 bytes. 26*ca64ef20SMatt Arsenault MaxInstLength = (TT.getArch() == Triple::amdgcn) ? 20 : 16; 2745bb48eaSTom Stellard SeparatorString = "\n"; 2845bb48eaSTom Stellard CommentString = ";"; 2945bb48eaSTom Stellard PrivateLabelPrefix = ""; 3045bb48eaSTom Stellard InlineAsmStart = ";#ASMSTART"; 3145bb48eaSTom Stellard InlineAsmEnd = ";#ASMEND"; 3245bb48eaSTom Stellard 3345bb48eaSTom Stellard //===--- Data Emission Directives -------------------------------------===// 3445bb48eaSTom Stellard SunStyleELFSectionSwitchSyntax = true; 3545bb48eaSTom Stellard UsesELFSectionDirectiveForBSS = true; 3645bb48eaSTom Stellard 3745bb48eaSTom Stellard //===--- Global Variable Emission Directives --------------------------===// 3845bb48eaSTom Stellard HasAggressiveSymbolFolding = true; 3945bb48eaSTom Stellard COMMDirectiveAlignmentIsInBytes = false; 4045bb48eaSTom Stellard HasNoDeadStrip = true; 4145bb48eaSTom Stellard WeakRefDirective = ".weakref\t"; 4245bb48eaSTom Stellard //===--- Dwarf Emission Directives -----------------------------------===// 4345bb48eaSTom Stellard SupportsDebugInformation = true; 4445bb48eaSTom Stellard } 45e135ffd5STom Stellard 46e135ffd5STom Stellard bool AMDGPUMCAsmInfo::shouldOmitSectionDirective(StringRef SectionName) const { 4700f2f91aSTom Stellard return SectionName == ".hsatext" || SectionName == ".hsadata_global_agent" || 4800f2f91aSTom Stellard SectionName == ".hsadata_global_program" || 499760f037STom Stellard SectionName == ".hsarodata_readonly_agent" || 50e135ffd5STom Stellard MCAsmInfo::shouldOmitSectionDirective(SectionName); 51e135ffd5STom Stellard } 52*ca64ef20SMatt Arsenault 53*ca64ef20SMatt Arsenault unsigned AMDGPUMCAsmInfo::getMaxInstLength(const MCSubtargetInfo *STI) const { 54*ca64ef20SMatt Arsenault if (!STI || STI->getTargetTriple().getArch() == Triple::r600) 55*ca64ef20SMatt Arsenault return MaxInstLength; 56*ca64ef20SMatt Arsenault 57*ca64ef20SMatt Arsenault // Maximum for NSA encoded images 58*ca64ef20SMatt Arsenault if (STI->getFeatureBits()[AMDGPU::FeatureNSAEncoding]) 59*ca64ef20SMatt Arsenault return 20; 60*ca64ef20SMatt Arsenault 61*ca64ef20SMatt Arsenault // 64-bit instruction with 32-bit literal. 62*ca64ef20SMatt Arsenault if (STI->getFeatureBits()[AMDGPU::FeatureVOP3Literal]) 63*ca64ef20SMatt Arsenault return 12; 64*ca64ef20SMatt Arsenault 65*ca64ef20SMatt Arsenault return 8; 66*ca64ef20SMatt Arsenault } 67