LLVM 23.0.0git
NVPTXAsmPrinter.cpp File Reference
#include "NVPTXAsmPrinter.h"
#include "MCTargetDesc/NVPTXBaseInfo.h"
#include "MCTargetDesc/NVPTXInstPrinter.h"
#include "MCTargetDesc/NVPTXMCAsmInfo.h"
#include "MCTargetDesc/NVPTXTargetStreamer.h"
#include "NVPTX.h"
#include "NVPTXDwarfDebug.h"
#include "NVPTXMCExpr.h"
#include "NVPTXMachineFunctionInfo.h"
#include "NVPTXRegisterInfo.h"
#include "NVPTXSubtarget.h"
#include "NVPTXTargetMachine.h"
#include "NVPTXUtilities.h"
#include "NVVMProperties.h"
#include "TargetInfo/NVPTXTargetInfo.h"
#include "cl_common_defines.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/CodeGenTypes/MachineValueType.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/NativeFormatting.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/Utils/UnrollLoop.h"
#include <cassert>
#include <cstdint>
#include <cstring>
#include <string>

Go to the source code of this file.

Macros

#define DEPOTNAME   "__local_depot"

Functions

static StringRef getTextureName (const Value &V)
static StringRef getSurfaceName (const Value &V)
static StringRef getSamplerName (const Value &V)
static void discoverDependentGlobals (const Value *V, DenseSet< const GlobalVariable * > &Globals)
 discoverDependentGlobals - Return a set of GlobalVariables on which V depends.
static void VisitGlobalVariableForEmission (const GlobalVariable *GV, SmallVectorImpl< const GlobalVariable * > &Order, DenseSet< const GlobalVariable * > &Visited, DenseSet< const GlobalVariable * > &Visiting)
 VisitGlobalVariableForEmission - Add GV to the list of GlobalVariable instances to be emitted, but only after any dependents have been added first.s.
static bool usedInGlobalVarDef (const Constant *C)
static bool usedInOneFunc (const User *U, Function const *&OneFunc)
static bool canDemoteGlobalVar (const GlobalVariable *GV, Function const *&f)
static bool useFuncSeen (const Constant *C, const SmallPtrSetImpl< const Function * > &SeenSet)
static bool hasFullDebugInfo (Module &M)
static bool isPTXInstruction (StringRef Line)
 Returns true if Line begins with an alphabetic character or underscore, indicating it is a PTX instruction that should receive a .loc directive.
static const DILocationgetInlineAsmDebugLoc (const MachineInstr *MI)
 Returns the DILocation for an inline asm MachineInstr if debug line info should be emitted, or nullptr otherwise.
static InlineAsmInliningContext getInlineAsmInliningContext (const DILocation *DL, const MachineFunction &MF, NVPTXDwarfDebug *NVDD, MCStreamer &Streamer, unsigned CUID)
 Resolves the enhanced-lineinfo inlining context for an inline asm debug location.
 INITIALIZE_PASS (NVPTXAsmPrinter, "nvptx-asm-printer", "NVPTX Assembly Printer", false, false) extern "C" LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeNVPTXAsmPrinter()

Macro Definition Documentation

◆ DEPOTNAME

#define DEPOTNAME   "__local_depot"

Definition at line 97 of file NVPTXAsmPrinter.cpp.

Referenced by llvm::NVPTXAsmPrinter::getFunctionFrameSymbol().

Function Documentation

◆ canDemoteGlobalVar()

◆ discoverDependentGlobals()

void discoverDependentGlobals ( const Value * V,
DenseSet< const GlobalVariable * > & Globals )
static

discoverDependentGlobals - Return a set of GlobalVariables on which V depends.

Definition at line 117 of file NVPTXAsmPrinter.cpp.

References discoverDependentGlobals(), and llvm::dyn_cast().

Referenced by discoverDependentGlobals(), and VisitGlobalVariableForEmission().

◆ getInlineAsmDebugLoc()

const DILocation * getInlineAsmDebugLoc ( const MachineInstr * MI)
static

Returns the DILocation for an inline asm MachineInstr if debug line info should be emitted, or nullptr otherwise.

Definition at line 2079 of file NVPTXAsmPrinter.cpp.

References DL, MI, and llvm::DICompileUnit::NoDebug.

◆ getInlineAsmInliningContext()

InlineAsmInliningContext getInlineAsmInliningContext ( const DILocation * DL,
const MachineFunction & MF,
NVPTXDwarfDebug * NVDD,
MCStreamer & Streamer,
unsigned CUID )
static

Resolves the enhanced-lineinfo inlining context for an inline asm debug location.

Returns a default (empty) context if inlining info is unavailable.

Definition at line 2105 of file NVPTXAsmPrinter.cpp.

References DL, llvm::MCStreamer::emitDwarfFileDirective(), llvm::getDISubprogram(), llvm::NVPTXDwarfDebug::getOrCreateFuncNameSymbol(), llvm::NVPTXDwarfDebug::isEnhancedLineinfo(), and llvm::AsmPrinter::MF.

◆ getSamplerName()

StringRef getSamplerName ( const Value & V)
static

Definition at line 109 of file NVPTXAsmPrinter.cpp.

References assert().

◆ getSurfaceName()

StringRef getSurfaceName ( const Value & V)
static

Definition at line 104 of file NVPTXAsmPrinter.cpp.

References assert().

◆ getTextureName()

StringRef getTextureName ( const Value & V)
static

Definition at line 99 of file NVPTXAsmPrinter.cpp.

References assert().

◆ hasFullDebugInfo()

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( NVPTXAsmPrinter ,
"nvptx-asm-printer" ,
"NVPTX Assembly Printer" ,
false ,
false  )

◆ isPTXInstruction()

bool isPTXInstruction ( StringRef Line)
static

Returns true if Line begins with an alphabetic character or underscore, indicating it is a PTX instruction that should receive a .loc directive.

Definition at line 2070 of file NVPTXAsmPrinter.cpp.

References llvm::StringRef::empty(), and llvm::StringRef::ltrim().

◆ usedInGlobalVarDef()

bool usedInGlobalVarDef ( const Constant * C)
static

Definition at line 553 of file NVPTXAsmPrinter.cpp.

References llvm::CallingConv::C, llvm::dyn_cast(), and usedInGlobalVarDef().

Referenced by usedInGlobalVarDef().

◆ usedInOneFunc()

bool usedInOneFunc ( const User * U,
Function const *& OneFunc )
static

Definition at line 568 of file NVPTXAsmPrinter.cpp.

References llvm::dyn_cast(), I, usedInOneFunc(), and llvm::Value::users().

Referenced by canDemoteGlobalVar(), and usedInOneFunc().

◆ useFuncSeen()

bool useFuncSeen ( const Constant * C,
const SmallPtrSetImpl< const Function * > & SeenSet )
static

◆ VisitGlobalVariableForEmission()