14#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXASMPRINTER_H
15#define LLVM_LIB_TARGET_NVPTX_NVPTXASMPRINTER_H
83 unsigned numSymbols()
const {
return Symbols.size(); }
85 bool allSymbolsAligned(
unsigned ptrSize)
const {
87 [=](
unsigned pos) {
return pos % ptrSize == 0; });
92 std::vector<unsigned char> buffer;
111 EmitGeneric = AP.EmitGeneric;
116 unsigned addBytes(
unsigned char *
Ptr,
int Num,
int Bytes) {
119 for (
int i = 0; i < Num; ++i) {
120 buffer[curpos] =
Ptr[i];
123 for (
int i = Num; i < Bytes; ++i) {
130 unsigned addZeros(
int Num) {
132 for (
int i = 0; i < Num; ++i) {
141 Symbols.push_back(GVar);
142 SymbolsBeforeStripping.
push_back(GVarBeforeStripping);
152 friend class AggBuffer;
155 StringRef getPassName()
const override {
return "NVPTX Assembly Printer"; }
158 std::string CurrentFnName;
160 void emitStartOfAsmFile(
Module &M)
override;
162 void emitFunctionEntryLabel()
override;
163 void emitFunctionBodyStart()
override;
164 void emitFunctionBodyEnd()
override;
171 unsigned encodeVirtualRegister(
unsigned Reg);
174 const char *Modifier =
nullptr);
177 void emitGlobals(
const Module &M);
181 void emitVirtualRegister(
unsigned int vr,
raw_ostream &);
192 const MCExpr *lowerConstantForGV(
const Constant *CV,
bool ProcessingGeneric);
196 bool doInitialization(
Module &M)
override;
197 bool doFinalization(
Module &M)
override;
209 VRegRCMap VRegMapping;
212 std::map<const Function *, std::vector<const GlobalVariable *>> localDecls;
217 std::string getPTXFundamentalTypeStr(
Type *Ty,
bool =
true)
const;
220 void bufferLEByte(
const Constant *CPV,
int Bytes, AggBuffer *aggBuffer);
221 void bufferAggregateConstant(
const Constant *CV, AggBuffer *aggBuffer);
230 bool lowerImageHandleOperand(
const MachineInstr *
MI,
unsigned OpNo,
259 AsmPrinter::getAnalysisUsage(AU);
262 std::string getVirtualRegisterName(
unsigned)
const;
264 const MCSymbol *getFunctionFrameSymbol()
const override;
unsigned const MachineRegisterInfo * MRI
#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)
const char LLVMTargetMachineRef TM
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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.
static void printMCExpr(const MCExpr *E, raw_ostream &OS)
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
This class is intended to be used as a driving class for all asm writers.
ConstantFP - Floating Point Values [float, double].
This is an important base class in LLVM.
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.
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.
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.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - 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.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.