14#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXASMPRINTER_H
15#define LLVM_LIB_TARGET_NVPTX_NVPTXASMPRINTER_H
85 unsigned numSymbols()
const {
return Symbols.size(); }
87 bool allSymbolsAligned(
unsigned ptrSize)
const {
89 [=](
unsigned pos) {
return pos % ptrSize == 0; });
94 std::vector<unsigned char> buffer;
107 const bool EmitGeneric;
112 EmitGeneric(AP.EmitGeneric) {}
114 unsigned getBufferSize()
const {
return Size; }
117 unsigned getCurpos()
const {
return curpos; }
121 void addBytes(
const unsigned char *Ptr,
unsigned Num,
unsigned Bytes) {
125 addZeros(Bytes - Num);
130 buffer[curpos] = Byte;
134 void addZeros(
unsigned Num) {
135 for ([[maybe_unused]]
unsigned _ :
llvm::seq(Num)) {
142 Symbols.push_back(GVar);
143 SymbolsBeforeStripping.
push_back(GVarBeforeStripping);
153 friend class AggBuffer;
165 void emitStartOfAsmFile(
Module &M)
override;
167 void emitFunctionEntryLabel()
override;
168 void emitFunctionBodyStart()
override;
169 void emitFunctionBodyEnd()
override;
176 unsigned encodeVirtualRegister(
unsigned Reg);
179 const char *Modifier =
nullptr);
182 void emitGlobals(
const Module &M);
186 void emitVirtualRegister(
unsigned int vr,
raw_ostream &);
192 void emitCallPrototype(
const CallBase &CB,
unsigned UniqueCallSite,
203 bool ProcessingGeneric)
const;
212 bool doInitialization(
Module &M)
override;
213 bool doFinalization(
Module &M)
override;
228 VRegRCMap VRegMapping;
231 std::map<const Function *, std::vector<const GlobalVariable *>> localDecls;
236 std::string getPTXFundamentalTypeStr(
Type *Ty,
bool =
true)
const;
239 void bufferLEByte(
const Constant *CPV,
int Bytes, AggBuffer *aggBuffer);
240 void bufferAggregateConstant(
const Constant *CV, AggBuffer *aggBuffer);
241 void bufferAggregateConstVec(
const ConstantVector *CV, AggBuffer *aggBuffer);
263 const bool EmitGeneric;
278 std::string getVirtualRegisterName(
unsigned)
const;
280 const MCSymbol *getFunctionFrameSymbol()
const override;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_LIBRARY_VISIBILITY
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This file defines the DenseMap class.
static void addSymbol(Object &Obj, const NewSymbolInfo &SymInfo, uint8_t DefaultVisibility)
static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol, HexagonAsmPrinter &Printer, bool MustExtend)
static void emitInlineAsm(LLVMContext &C, BasicBlock *BB, StringRef AsmText)
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
static void printMemOperand(raw_ostream &OS, const MachineMemOperand &MMO, const MachineFunction *MF, const Module *M, const MachineFrameInfo *MFI, const TargetInstrInfo *TII, LLVMContext &Ctx)
This file defines the SmallVector class.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
TargetMachine & TM
Target machine description.
void getAnalysisUsage(AnalysisUsage &AU) const override
Record analysis usage.
AsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer, char &ID=AsmPrinter::ID)
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
ConstantFP - Floating Point Values [float, double].
Constant Vector Declarations.
This is an important base class in LLVM.
Collects and handles dwarf debug information.
Base class for the full range of assembler expressions which are needed for parsing.
Instances of this class represent a single low-level machine instruction.
Instances of this class represent operands of the MCInst class.
Generic base class for all target subtargets.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
A Module instance is used to store all the information related to an LLVM module.
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
void emitGlobalVariable(const GlobalVariable *GV) override
Emit the specified global variable to the .s file.
NVPTXAsmPrinter(TargetMachine &TM, std::unique_ptr< MCStreamer > Streamer)
void getAnalysisUsage(AnalysisUsage &AU) const override
Record analysis usage.
Implments NVPTX-specific streamer.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Primary interface to the complete machine description for the target machine.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
constexpr auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
Implement std::hash so that hash_code can be used in STL containers.
MachineJumpTableEntry - One jump table in the jump table info.