94 #define DEPOTNAME "__local_depot"
98 cl::desc(
"NVPTX Specific: Emit Line numbers even without -G"),
103 cl::desc(
"NVPTX Specific: Emit source line in ptx file"),
114 if (
const User *U = dyn_cast<User>(V)) {
115 for (
unsigned i = 0, e = U->getNumOperands();
i != e; ++
i) {
131 if (Visited.
count(GV))
135 if (!Visiting.
insert(GV).second)
173 auto *Scope = cast_or_null<DIScope>(curLoc.
getScope());
177 StringRef fileName(Scope->getFilename());
178 StringRef dirName(Scope->getDirectory());
182 fileName = FullPathName;
185 if (filenameMap.find(fileName) == filenameMap.end())
190 this->emitSrcInText(fileName, curLoc.
getLine());
192 std::stringstream temp;
193 temp <<
"\t.loc " << filenameMap[fileName] <<
" " << curLoc.
getLine()
194 <<
" " << curLoc.
getCol();
201 if (static_cast<NVPTXTargetMachine &>(
TM).getDrvInterface() ==
NVPTX::CUDA)
205 lowerToMCInst(MI, Inst);
210 bool NVPTXAsmPrinter::lowerImageHandleOperand(
const MachineInstr *MI,
218 if (OpNo == 4 && MO.
isImm()) {
219 lowerImageHandleSymbol(MO.
getImm(), MCOp);
223 lowerImageHandleSymbol(MO.
getImm(), MCOp);
233 if (OpNo == VecSize && MO.
isImm()) {
234 lowerImageHandleSymbol(MO.
getImm(), MCOp);
241 if (OpNo == 0 && MO.
isImm()) {
242 lowerImageHandleSymbol(MO.
getImm(), MCOp);
249 if (OpNo == 1 && MO.
isImm()) {
250 lowerImageHandleSymbol(MO.
getImm(), MCOp);
260 void NVPTXAsmPrinter::lowerImageHandleSymbol(
unsigned Index,
MCOperand &MCOp) {
266 std::string *SymNamePtr =
274 if (MI->
getOpcode() == NVPTX::CALL_PROTOTYPE) {
286 if (lowerImageHandleOperand(MI,
i, MCOp)) {
292 if (lowerOperand(MO, MCOp))
338 unsigned NVPTXAsmPrinter::encodeVirtualRegister(
unsigned Reg) {
343 unsigned RegNum = RegMap[
Reg];
348 if (RC == &NVPTX::Int1RegsRegClass) {
350 }
else if (RC == &NVPTX::Int16RegsRegClass) {
352 }
else if (RC == &NVPTX::Int32RegsRegClass) {
354 }
else if (RC == &NVPTX::Int64RegsRegClass) {
356 }
else if (RC == &NVPTX::Float32RegsRegClass) {
358 }
else if (RC == &NVPTX::Float64RegsRegClass) {
365 Ret |= (RegNum & 0x0FFFFFFF);
370 return Reg & 0x0FFFFFFF;
397 if (
auto *ITy = dyn_cast<IntegerType>(Ty)) {
398 size = ITy->getBitWidth();
406 O <<
".param .b" << size <<
" func_retval0";
407 }
else if (isa<PointerType>(Ty)) {
412 unsigned retAlignment = 0;
415 O <<
".param .align " << retAlignment <<
" .b8 func_retval0[" << totalsz
423 for (
unsigned i = 0, e = vtparts.
size();
i != e; ++
i) {
425 EVT elemtype = vtparts[
i];
427 elems = vtparts[
i].getVectorNumElements();
428 elemtype = vtparts[
i].getVectorElementType();
431 for (
unsigned j = 0, je = elems; j != je; ++j) {
435 O <<
".reg .b" << sz <<
" func_retval" << idx;
450 printReturnValStr(F, O);
456 bool NVPTXAsmPrinter::isLoopHeaderOfNoUnroll(
485 if (isLoopHeaderOfNoUnroll(MBB))
489 void NVPTXAsmPrinter::EmitFunctionEntryLabel() {
493 if (!GlobalsEmitted) {
495 GlobalsEmitted =
true;
501 emitLinkageDirective(F, O);
506 printReturnValStr(*MF, O);
511 emitFunctionParamList(*MF, O);
514 emitKernelFunctionDirectives(*F, O);
521 void NVPTXAsmPrinter::EmitFunctionBodyStart() {
524 setAndEmitFunctionVirtualRegisters(*MF);
532 void NVPTXAsmPrinter::EmitFunctionBodyEnd() {
537 void NVPTXAsmPrinter::emitImplicitDef(
const MachineInstr *MI)
const {
549 void NVPTXAsmPrinter::emitKernelFunctionDirectives(
const Function &F,
554 unsigned reqntidx, reqntidy, reqntidz;
555 bool specified =
false;
570 O <<
".reqntid " << reqntidx <<
", " << reqntidy <<
", " << reqntidz
576 unsigned maxntidx, maxntidy, maxntidz;
592 O <<
".maxntid " << maxntidx <<
", " << maxntidy <<
", " << maxntidz
597 O <<
".minnctapersm " << mincta <<
"\n";
601 O <<
".maxnreg " << maxnreg <<
"\n";
612 assert(I != VRegMapping.
end() &&
"Bad register class");
616 assert(VI != RegMap.end() &&
"Bad virtual register");
617 unsigned MappedVR = VI->second;
625 void NVPTXAsmPrinter::emitVirtualRegister(
unsigned int vr,
630 void NVPTXAsmPrinter::printVecModifiedImmediate(
632 static const char vecelem[] = {
'0',
'1',
'2',
'3',
'0',
'1',
'2',
'3' };
633 int Imm = (int) MO.
getImm();
634 if (0 ==
strcmp(Modifier,
"vecelem"))
635 O <<
"_" << vecelem[Imm];
636 else if (0 ==
strcmp(Modifier,
"vecv4comm1")) {
637 if ((Imm < 0) || (Imm > 3))
639 }
else if (0 ==
strcmp(Modifier,
"vecv4comm2")) {
640 if ((Imm < 4) || (Imm > 7))
642 }
else if (0 ==
strcmp(Modifier,
"vecv4pos")) {
645 O <<
"_" << vecelem[Imm % 4];
646 }
else if (0 ==
strcmp(Modifier,
"vecv2comm1")) {
647 if ((Imm < 0) || (Imm > 1))
649 }
else if (0 ==
strcmp(Modifier,
"vecv2comm2")) {
650 if ((Imm < 2) || (Imm > 3))
652 }
else if (0 ==
strcmp(Modifier,
"vecv2pos")) {
655 O <<
"_" << vecelem[Imm % 2];
661 emitLinkageDirective(F, O);
666 printReturnValStr(F, O);
669 emitFunctionParamList(F, O);
678 return GV->getName() !=
"llvm.used";
682 if (
const Constant *C = dyn_cast<Constant>(U))
690 if (
const GlobalVariable *othergv = dyn_cast<GlobalVariable>(U)) {
691 if (othergv->getName() ==
"llvm.used")
695 if (
const Instruction *instr = dyn_cast<Instruction>(U)) {
696 if (instr->getParent() && instr->getParent()->getParent()) {
698 if (oneFunc && (curFunc != oneFunc))
741 if (
const Constant *cu = dyn_cast<Constant>(U)) {
744 }
else if (
const Instruction *
I = dyn_cast<Instruction>(U)) {
751 if (seenMap.
find(caller) != seenMap.
end())
768 emitDeclaration(F, O);
772 if (
const Constant *
C = dyn_cast<Constant>(U)) {
777 emitDeclaration(F, O);
783 emitDeclaration(F, O);
788 if (!isa<Instruction>(U))
801 if (seenMap.
find(caller) != seenMap.
end()) {
802 emitDeclaration(F, O);
810 void NVPTXAsmPrinter::recordAndEmitFilenames(
Module &M) {
816 StringRef Filename = DIUnit->getFilename();
817 StringRef Dirname = DIUnit->getDirectory();
821 Filename = FullPathName;
823 if (filenameMap.find(Filename) != filenameMap.end())
825 filenameMap[Filename] =
i;
826 OutStreamer->EmitDwarfFileDirective(i,
"", Filename);
836 Filename = FullPathName;
838 if (filenameMap.find(Filename) != filenameMap.end())
840 filenameMap[Filename] =
i;
841 OutStreamer->EmitDwarfFileDirective(i,
"", Filename);
847 if (!GV)
return true;
849 if (!InitList)
return true;
869 "Module has a nontrivial global ctor, which NVPTX does not support.");
874 "Module has a nontrivial global dtor, which NVPTX does not support.");
881 MMI = getAnalysisIfAvailable<MachineModuleInfo>();
893 emitHeader(M, OS1, STI);
901 OutStreamer->AddComment(
"Start of file scope inline assembly");
905 OutStreamer->AddComment(
"End of file scope inline assembly");
911 recordAndEmitFilenames(M);
913 GlobalsEmitted =
false;
918 void NVPTXAsmPrinter::emitGlobals(
const Module &M) {
922 emitDeclarations(M, OS2);
938 "Missed a global variable");
939 assert(GVVisiting.
size() == 0 &&
"Did not fully process a global variable");
942 for (
unsigned i = 0, e = Globals.
size(); i != e; ++
i)
943 printModuleLevelGV(Globals[i], OS2);
953 O <<
"// Generated by LLVM NVPTX Back-End\n";
958 O <<
".version " << (PTXVersion / 10) <<
"." << (PTXVersion % 10) <<
"\n";
965 O <<
", texmode_independent";
968 O <<
", map_f64_to_f32";
976 O <<
".address_size ";
989 if (!GlobalsEmitted) {
991 GlobalsEmitted =
true;
998 int i, n = global_list.size();
1005 gv_array[i++] = &*
I;
1008 while (!global_list.empty())
1009 global_list.
remove(global_list.begin());
1015 for (i = 0; i < n; i++)
1016 global_list.
insert(global_list.end(), gv_array[
i]);
1046 void NVPTXAsmPrinter::emitLinkageDirective(
const GlobalValue *V,
1048 if (static_cast<NVPTXTargetMachine &>(TM).getDrvInterface() ==
NVPTX::CUDA) {
1050 if (isa<GlobalVariable>(V)) {
1064 msg.append(
"Error: ");
1065 msg.append(
"Symbol ");
1068 msg.append(
"has unsupported appending linkage type");
1077 void NVPTXAsmPrinter::printModuleLevelGV(
const GlobalVariable *GVar,
1079 bool processDemoted) {
1122 emitPTXGlobalVariable(GVar, O);
1130 const Constant *Initializer =
nullptr;
1144 O <<
"addr_mode_" << i <<
" = ";
1150 O <<
"clamp_to_border";
1153 O <<
"clamp_to_edge";
1164 O <<
"filter_mode = ";
1179 O <<
", force_unnormalized_coords = 1";
1189 if (strncmp(GVar->
getName().
data(),
"unrollpragma", 12) == 0)
1193 if (strncmp(GVar->
getName().
data(),
"filename", 8) == 0)
1199 const Function *demotedFunc =
nullptr;
1201 O <<
"// " << GVar->
getName() <<
" has been demoted\n";
1202 if (localDecls.find(demotedFunc) != localDecls.end())
1203 localDecls[demotedFunc].push_back(GVar);
1205 std::vector<const GlobalVariable *> temp;
1206 temp.push_back(GVar);
1207 localDecls[demotedFunc] = temp;
1216 O <<
" .attribute(.managed)";
1230 O << getPTXFundamentalTypeStr(ETy,
false);
1241 if (!Initializer->
isNullValue() && !isa<UndefValue>(Initializer)) {
1243 printScalarConstant(Initializer, O);
1252 "' is not allowed in addrspace(" +
1258 unsigned int ElementSize = 0;
1275 if (!isa<UndefValue>(Initializer) && !Initializer->
isNullValue()) {
1276 AggBuffer aggBuffer(ElementSize, O, *
this);
1277 bufferAggregateConstant(Initializer, &aggBuffer);
1278 if (aggBuffer.numSymbols) {
1279 if (static_cast<const NVPTXTargetMachine &>(TM).
is64Bit()) {
1283 O << ElementSize / 8;
1288 O << ElementSize / 4;
1328 if (localDecls.find(f) == localDecls.end())
1331 std::vector<const GlobalVariable *> &gvars = localDecls[f];
1333 for (
unsigned i = 0, e = gvars.size(); i != e; ++
i) {
1334 O <<
"\t// demoted variable\n\t";
1335 printModuleLevelGV(gvars[i], O,
true);
1339 void NVPTXAsmPrinter::emitPTXAddressSpace(
unsigned int AddressSpace,
1341 switch (AddressSpace) {
1361 NVPTXAsmPrinter::getPTXFundamentalTypeStr(
Type *Ty,
bool useB4PTR)
const {
1367 unsigned NumBits = cast<IntegerType>(Ty)->
getBitWidth();
1370 else if (NumBits <= 64) {
1371 std::string
name =
"u";
1372 return name +
utostr(NumBits);
1384 if (static_cast<const NVPTXTargetMachine &>(TM).
is64Bit())
1398 void NVPTXAsmPrinter::emitPTXGlobalVariable(
const GlobalVariable *GVar,
1414 O << getPTXFundamentalTypeStr(ETy);
1420 int64_t ElementSize = 0;
1454 unsigned int alignStruct = 1;
1457 for (
unsigned i = 0, e = STy->getNumElements(); i != e; i++) {
1458 Type *ETy = STy->getElementType(i);
1460 if (align > alignStruct)
1461 alignStruct = align;
1475 O <<
"_param_" << paramIndex;
1483 unsigned paramIndex = 0;
1497 Type *Ty = I->getType();
1508 std::string sname = I->getName();
1511 O <<
"\t.param .u64 .ptr .surfref ";
1513 O <<
"\t.param .surfref ";
1515 O <<
"_param_" << paramIndex;
1519 O <<
"\t.param .u64 .ptr .texref ";
1521 O <<
"\t.param .texref ";
1523 O <<
"_param_" << paramIndex;
1527 O <<
"\t.param .u64 .ptr .samplerref ";
1529 O <<
"\t.param .samplerref ";
1531 O <<
"_param_" << paramIndex;
1537 if (!PAL.
hasAttribute(paramIndex + 1, Attribute::ByVal)) {
1547 O <<
"\t.param .align " << align <<
" .b8 ";
1548 printParamName(I, paramIndex, O);
1549 O <<
"[" << sz <<
"]";
1560 if (static_cast<NVPTXTargetMachine &>(TM).getDrvInterface() !=
1564 switch (addrSpace) {
1569 O <<
".ptr .const ";
1572 O <<
".ptr .shared ";
1575 O <<
".ptr .global ";
1580 printParamName(I, paramIndex, O);
1590 O << getPTXFundamentalTypeStr(Ty);
1592 printParamName(I, paramIndex, O);
1598 if (isa<IntegerType>(Ty)) {
1602 }
else if (isa<PointerType>(Ty))
1607 O <<
"\t.param .b" << sz <<
" ";
1609 O <<
"\t.reg .b" << sz <<
" ";
1610 printParamName(I, paramIndex, O);
1616 assert(PTy &&
"Param with byval attribute should be a pointer type");
1619 if (isABI || isKernelFunc) {
1637 if (!isKernelFunc && align < 4)
1640 O <<
"\t.param .align " << align <<
" .b8 ";
1641 printParamName(I, paramIndex, O);
1642 O <<
"[" << sz <<
"]";
1651 for (
unsigned i = 0, e = vtparts.
size(); i != e; ++
i) {
1653 EVT elemtype = vtparts[
i];
1655 elems = vtparts[
i].getVectorNumElements();
1656 elemtype = vtparts[
i].getVectorElementType();
1659 for (
unsigned j = 0, je = elems; j != je; ++j) {
1663 O <<
"\t.reg .b" << sz <<
" ";
1664 printParamName(I, paramIndex, O);
1680 void NVPTXAsmPrinter::emitFunctionParamList(
const MachineFunction &MF,
1683 emitFunctionParamList(F, O);
1686 void NVPTXAsmPrinter::setAndEmitFunctionVirtualRegisters(
1703 O <<
"\t.reg .b64 \t%SP;\n";
1704 O <<
"\t.reg .b64 \t%SPL;\n";
1706 O <<
"\t.reg .b32 \t%SP;\n";
1707 O <<
"\t.reg .b32 \t%SPL;\n";
1715 unsigned int numVRs =
MRI->getNumVirtRegs();
1716 for (
unsigned i = 0; i < numVRs; i++) {
1720 int n = regmap.
size();
1721 regmap.
insert(std::make_pair(vr, n + 1));
1741 int n = regmap.
size();
1745 O <<
"\t.reg " << rcname <<
" \t" << rcStr <<
"<" << (n+1)
1756 unsigned int numHex;
1773 if (hexstr.length() < numHex)
1774 O << std::string(numHex - hexstr.length(),
'0');
1779 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(CPV)) {
1783 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(CPV)) {
1784 printFPConstant(CFP, O);
1787 if (isa<ConstantPointerNull>(CPV)) {
1791 if (
const GlobalValue *GVar = dyn_cast<GlobalValue>(CPV)) {
1792 bool IsNonGenericPointer =
false;
1794 IsNonGenericPointer =
true;
1796 if (EmitGeneric && !isa<Function>(CPV) && !IsNonGenericPointer) {
1805 if (
const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(CPV)) {
1808 bool IsNonGenericPointer =
false;
1810 IsNonGenericPointer =
true;
1812 if (
const GlobalValue *GVar = dyn_cast<GlobalValue>(v)) {
1813 if (EmitGeneric && !isa<Function>(v) && !IsNonGenericPointer) {
1832 int64_t vp = (int64_t)val;
1833 for (
unsigned i = 0; i <
sizeof(
T); ++
i) {
1834 p[
i] = (
unsigned char)vp;
1839 int32_t *vp = (int32_t *)&val;
1840 for (
unsigned i = 0; i <
sizeof(int32_t); ++
i) {
1841 p[
i] = (
unsigned char)*vp;
1846 int64_t *vp = (int64_t *)&val;
1847 for (
unsigned i = 0; i <
sizeof(int64_t); ++
i) {
1848 p[
i] = (
unsigned char)*vp;
1853 void NVPTXAsmPrinter::bufferLEByte(
const Constant *CPV,
int Bytes,
1854 AggBuffer *aggBuffer) {
1861 aggBuffer->addZeros(s);
1865 unsigned char ptr[8];
1871 unsigned char c = (
unsigned char)cast<ConstantInt>(CPV)->getZExtValue();
1872 ConvertIntToBytes<>(ptr, c);
1873 aggBuffer->addBytes(ptr, 1, Bytes);
1875 short int16 = (short)cast<ConstantInt>(CPV)->getZExtValue();
1876 ConvertIntToBytes<>(ptr, int16);
1877 aggBuffer->addBytes(ptr, 2, Bytes);
1879 if (
const ConstantInt *constInt = dyn_cast<ConstantInt>(CPV)) {
1880 int int32 = (int)(constInt->getZExtValue());
1881 ConvertIntToBytes<>(ptr, int32);
1882 aggBuffer->addBytes(ptr, 4, Bytes);
1884 }
else if (
const auto *Cexpr = dyn_cast<ConstantExpr>(CPV)) {
1885 if (
const auto *constInt = dyn_cast_or_null<ConstantInt>(
1887 int int32 = (int)(constInt->getZExtValue());
1888 ConvertIntToBytes<>(ptr, int32);
1889 aggBuffer->addBytes(ptr, 4, Bytes);
1892 if (Cexpr->getOpcode() == Instruction::PtrToInt) {
1894 aggBuffer->addSymbol(v, Cexpr->getOperand(0));
1895 aggBuffer->addZeros(4);
1901 if (
const ConstantInt *constInt = dyn_cast<ConstantInt>(CPV)) {
1902 long long int64 = (
long long)(constInt->getZExtValue());
1903 ConvertIntToBytes<>(ptr, int64);
1904 aggBuffer->addBytes(ptr, 8, Bytes);
1906 }
else if (
const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(CPV)) {
1907 if (
const auto *constInt = dyn_cast_or_null<ConstantInt>(
1909 long long int64 = (
long long)(constInt->getZExtValue());
1910 ConvertIntToBytes<>(ptr, int64);
1911 aggBuffer->addBytes(ptr, 8, Bytes);
1914 if (Cexpr->getOpcode() == Instruction::PtrToInt) {
1916 aggBuffer->addSymbol(v, Cexpr->getOperand(0));
1917 aggBuffer->addZeros(8);
1933 aggBuffer->addBytes(ptr, 4, Bytes);
1937 aggBuffer->addBytes(ptr, 8, Bytes);
1944 if (
const GlobalValue *GVar = dyn_cast<GlobalValue>(CPV)) {
1945 aggBuffer->addSymbol(GVar, GVar);
1946 }
else if (
const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(CPV)) {
1948 aggBuffer->addSymbol(v, Cexpr);
1951 aggBuffer->addZeros(s);
1958 if (isa<ConstantAggregate>(CPV) || isa<ConstantDataSequential>(CPV)) {
1960 bufferAggregateConstant(CPV, aggBuffer);
1961 if (Bytes > ElementSize)
1962 aggBuffer->addZeros(Bytes - ElementSize);
1963 }
else if (isa<ConstantAggregateZero>(CPV))
1964 aggBuffer->addZeros(Bytes);
1975 void NVPTXAsmPrinter::bufferAggregateConstant(
const Constant *CPV,
1976 AggBuffer *aggBuffer) {
1981 if (isa<ConstantArray>(CPV) || isa<ConstantVector>(CPV)) {
1984 bufferLEByte(cast<Constant>(CPV->
getOperand(i)), 0, aggBuffer);
1989 dyn_cast<ConstantDataSequential>(CPV)) {
1990 if (CDS->getNumElements())
1991 for (
unsigned i = 0; i < CDS->getNumElements(); ++
i)
1992 bufferLEByte(cast<Constant>(CDS->getElementAsConstant(i)), 0,
1997 if (isa<ConstantStruct>(CPV)) {
2008 bufferLEByte(cast<Constant>(CPV->
getOperand(i)), Bytes, aggBuffer);
2023 case NVPTX::CallArgBeginInst:
2024 case NVPTX::CallArgEndInst0:
2025 case NVPTX::CallArgEndInst1:
2026 case NVPTX::CallArgF32:
2027 case NVPTX::CallArgF64:
2028 case NVPTX::CallArgI16:
2029 case NVPTX::CallArgI32:
2030 case NVPTX::CallArgI32imm:
2031 case NVPTX::CallArgI64:
2032 case NVPTX::CallArgParam:
2033 case NVPTX::CallVoidInst:
2034 case NVPTX::CallVoidInstReg:
2035 case NVPTX::Callseq_End:
2036 case NVPTX::CallVoidInstReg64:
2037 case NVPTX::DeclareParamInst:
2038 case NVPTX::DeclareRetMemInst:
2039 case NVPTX::DeclareRetRegInst:
2040 case NVPTX::DeclareRetScalarInst:
2041 case NVPTX::DeclareScalarParamInst:
2042 case NVPTX::DeclareScalarRegInst:
2043 case NVPTX::StoreParamF32:
2044 case NVPTX::StoreParamF64:
2045 case NVPTX::StoreParamI16:
2046 case NVPTX::StoreParamI32:
2047 case NVPTX::StoreParamI64:
2048 case NVPTX::StoreParamI8:
2049 case NVPTX::StoreRetvalF32:
2050 case NVPTX::StoreRetvalF64:
2051 case NVPTX::StoreRetvalI16:
2052 case NVPTX::StoreRetvalI32:
2053 case NVPTX::StoreRetvalI64:
2054 case NVPTX::StoreRetvalI8:
2055 case NVPTX::LastCallArgF32:
2056 case NVPTX::LastCallArgF64:
2057 case NVPTX::LastCallArgI16:
2058 case NVPTX::LastCallArgI32:
2059 case NVPTX::LastCallArgI32imm:
2060 case NVPTX::LastCallArgI64:
2061 case NVPTX::LastCallArgParam:
2062 case NVPTX::LoadParamMemF32:
2063 case NVPTX::LoadParamMemF64:
2064 case NVPTX::LoadParamMemI16:
2065 case NVPTX::LoadParamMemI32:
2066 case NVPTX::LoadParamMemI64:
2067 case NVPTX::LoadParamMemI8:
2068 case NVPTX::PrototypeInst:
2069 case NVPTX::DBG_VALUE:
2080 NVPTXAsmPrinter::lowerConstantForGV(
const Constant *CV,
bool ProcessingGeneric) {
2086 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(CV))
2089 if (
const GlobalValue *GV = dyn_cast<GlobalValue>(CV)) {
2092 if (ProcessingGeneric) {
2111 return lowerConstantForGV(
C, ProcessingGeneric);
2117 OS <<
"Unsupported expression in static initializer: ";
2123 case Instruction::AddrSpaceCast: {
2127 return lowerConstantForGV(cast<const Constant>(CE->
getOperand(0)),
true);
2131 OS <<
"Unsupported expression in static initializer: ";
2137 case Instruction::GetElementPtr: {
2142 cast<GEPOperator>(CE)->accumulateConstantOffset(DL, OffsetAI);
2149 int64_t
Offset = OffsetAI.getSExtValue();
2154 case Instruction::Trunc:
2160 case Instruction::BitCast:
2161 return lowerConstantForGV(CE->
getOperand(0), ProcessingGeneric);
2163 case Instruction::IntToPtr: {
2171 return lowerConstantForGV(Op, ProcessingGeneric);
2174 case Instruction::PtrToInt: {
2182 const MCExpr *OpExpr = lowerConstantForGV(Op, ProcessingGeneric);
2200 const MCExpr *LHS = lowerConstantForGV(CE->
getOperand(0), ProcessingGeneric);
2201 const MCExpr *RHS = lowerConstantForGV(CE->
getOperand(1), ProcessingGeneric);
2214 return cast<MCTargetExpr>(&Expr)->printImpl(OS,
MAI);
2216 OS << cast<MCConstantExpr>(Expr).getValue();
2242 if (isa<MCConstantExpr>(BE.
getLHS()) || isa<MCSymbolRefExpr>(BE.
getLHS()) ||
2243 isa<NVPTXGenericMCSymbolRefExpr>(BE.
getLHS())) {
2244 printMCExpr(*BE.
getLHS(), OS);
2247 printMCExpr(*BE.
getLHS(), OS);
2255 if (RHSC->getValue() < 0) {
2256 OS << RHSC->getValue();
2267 if (isa<MCConstantExpr>(BE.
getRHS()) || isa<MCSymbolRefExpr>(BE.
getRHS())) {
2268 printMCExpr(*BE.
getRHS(), OS);
2271 printMCExpr(*BE.
getRHS(), OS);
2283 bool NVPTXAsmPrinter::PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
2284 unsigned AsmVariant,
2286 if (ExtraCode && ExtraCode[0]) {
2287 if (ExtraCode[1] != 0)
2290 switch (ExtraCode[0]) {
2304 bool NVPTXAsmPrinter::PrintAsmMemoryOperand(
2305 const MachineInstr *MI,
unsigned OpNo,
unsigned AsmVariant,
2307 if (ExtraCode && ExtraCode[0])
2311 printMemOperand(MI, OpNo, O);
2323 if (MO.
getReg() == NVPTX::VRDepot)
2328 emitVirtualRegister(MO.
getReg(), O);
2335 else if (strstr(Modifier,
"vec") == Modifier)
2336 printVecModifiedImmediate(MO, Modifier, O);
2339 "Don't know how to handle modifier on immediate operand");
2359 void NVPTXAsmPrinter::printMemOperand(
const MachineInstr *MI,
int opNum,
2363 if (Modifier &&
strcmp(Modifier,
"add") == 0) {
2376 std::stringstream temp;
2377 LineReader *reader = this->getReader(filename);
2379 temp << filename.
str();
2388 LineReader *NVPTXAsmPrinter::getReader(
const std::string &filename) {
2402 if (lineNum < theCurLine) {
2404 fstr.seekg(0, std::ios::beg);
2406 while (theCurLine < lineNum) {
2407 fstr.getline(buff, 500);
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type (if unknown returns 0).
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
void push_back(const T &Elt)
bool doesSupportDebugInformation() const
A parsed version of the target data layout string in and methods for querying it. ...
static cl::opt< bool > InterleaveSrc("nvptx-emit-src", cl::ZeroOrMore, cl::Hidden, cl::desc("NVPTX Specific: Emit source line in ptx file"), cl::init(false))
StringRef getTargetCPU() const
static Type * getDoubleTy(LLVMContext &C)
const GlobalValue * getGlobal() const
uint64_t getZExtValue() const
Get zero extended value.
const MCSymbol & getSymbol() const
std::unique_ptr< MCStreamer > OutStreamer
This is the MCStreamer object for the file we are generating.
MCSymbol * getSymbol(const GlobalValue *GV) const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
bool getAlign(const Function &F, unsigned index, unsigned &align)
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
MDNode * getScope() const
bool getMaxNReg(const Function &F, unsigned &x)
const ConstantFP * getFPImm() const
MachineBasicBlock * getMBB() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static unsigned index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
A Module instance is used to store all the information related to an LLVM module. ...
float convertToFloat() const
const DataLayout & getDataLayout() const
Return information about data layout.
2: 32-bit floating point type
bool doFinalization(Module &M) override
Shut down the asmprinter.
MCContext & OutContext
This is the context for the output file that we are streaming.
static MCOperand createExpr(const MCExpr *Val)
Implements a dense probed hash-table based set.
const GlobalListType & getGlobalList() const
Get the Module's list of global variables (constant).
unsigned getNumOperands() const
unsigned getPointerTypeSizeInBits(Type *) const
Layout pointer size, in bits, based on the type.
unsigned getPrefTypeAlignment(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
Describe properties that are true of each instruction in the target description file.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
bool isTexture(const Value &val)
Type * getValueType() const
bool hasAppendingLinkage() const
unsigned getPointerPrefAlignment(unsigned AS=0) const
Return target's alignment for stack-based pointers FIXME: The defaults need to be removed once all of...
const MachineFunction * MF
The current machine function.
unsigned getSizeInBits() const
bool hasAvailableExternallyLinkage() const
bool erase(const ValueT &V)
A raw_ostream that writes to an SmallVector or SmallString.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
Type * getReturnType() const
Returns the type of the ret val.
MachineBasicBlock reference.
const Function * getParent() const
Return the enclosing method, or null if none.
unsigned getFunctionNumber() const
Return a unique ID for the current function.
const char * getSymbolName() const
unsigned getParamAlignment(unsigned Index) const
Return the alignment for the specified function parameter.
static const MCBinaryExpr * createAnd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
unsigned getAddressSpace() const
Return the address space of the Pointer type.
static IntegerType * getInt64Ty(LLVMContext &C)
Type * getElementType() const
static IntegerType * getInt16Ty(LLVMContext &C)
const Constant * getInitializer() const
getInitializer - Return the initializer for this global variable.
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with strcmp
unsigned getOpcode() const
Return the opcode at the root of this constant expression.
std::string getVirtualRegisterName(unsigned) const
void processModule(const Module &M)
Process entire module and collect debug info anchors.
uint64_t getTypeAllocSizeInBits(Type *Ty) const
Returns the offset in bits between successive objects of the specified type, including alignment padd...
static const NVPTXFloatMCExpr * createConstantFPSingle(const APFloat &Flt, MCContext &Ctx)
StringRef getName() const
Return a constant reference to the value's name.
unsigned getMaxAlignment() const
Return the alignment in bytes that this function must be aligned to, which is greater than the defaul...
const Triple & getTargetTriple() const
bool isSingleValueType() const
Return true if the type is a valid type for a register in codegen.
uint64_t getStackSize() const
Return the number of bytes that must be allocated to hold all of the fixed size frame objects...
std::string readLine(unsigned line)
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
static Constant * getIntegerCast(Constant *C, Type *Ty, bool isSigned)
Create a ZExt, Bitcast or Trunc for integer -> integer casts.
bool hasCommonLinkage() const
unsigned getNumRegClasses() const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
static void DiscoverDependentGlobals(const Value *V, DenseSet< const GlobalVariable * > &Globals)
DiscoverDependentGlobals - Return a set of GlobalVariables on which V depends.
static MCOperand createReg(unsigned Reg)
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const StructLayout * getStructLayout(StructType *Ty) const
Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of i...
static Type * getFloatTy(LLVMContext &C)
const APInt & getValue() const
Return the constant as an APInt value reference.
static bool usedInOneFunc(const User *U, Function const *&oneFunc)
Class to represent struct types.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
const TargetRegisterClass * getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
bool hasInternalLinkage() const
void clearAnnotationCache(const Module *Mod)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Base class for the full range of assembler expressions which are needed for parsing.
Name of external global symbol.
Utility to find all debug info in a module.
Reg
All possible values of the reg field in the ModR/M byte.
This file contains the simple types necessary to represent the attributes associated with functions a...
APInt bitcastToAPInt() const
Represent a reference to a symbol from inside an expression.
bool is_absolute(const Twine &path)
Is path absolute?
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
const char * getImageHandleSymbol(unsigned Idx) const
Returns the symbol name at the given index.
static const NVPTXFloatMCExpr * createConstantFPDouble(const APFloat &Flt, MCContext &Ctx)
Windows NT (Windows on ARM)
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...
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
bool isInteger() const
isInteger - Return true if this is an integer, or a vector integer type.
This file implements a class to represent arbitrary precision integral constant values and operations...
bool hasPrivateLinkage() const
Target & getTheNVPTXTarget64()
unsigned getNumOperands() const
Access to explicit operands of the instruction.
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
bool getMaxNTIDz(const Function &F, unsigned &z)
bool ignoreLoc(const MachineInstr &)
Context object for machine code objects.
Constant * ConstantFoldConstant(const Constant *C, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr)
ConstantFoldConstant - Attempt to fold the constant using the specified DataLayout.
A constant value that is initialized with an expression using other constant values.
Class to represent function types.
bool isKernelFunction(const Function &F)
bool isSurface(const Value &val)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
unsigned int getSmVersion() const
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
void printAsOperand(raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const
Print the name of this Value out to the specified raw_ostream.
unsigned getAlignment() const
Unary assembler expressions.
Class to represent array types.
bool getMaxNTIDx(const Function &F, unsigned &x)
std::string getTextureName(const Value &val)
StringRef getSection() const
Get the custom section of this global if it has one.
static std::string utostr(uint64_t X, bool isNeg=false)
TypeID getTypeID() const
Return the type id for the type.
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
iterator_range< compile_unit_iterator > compile_units() const
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx)
bool isSampler(const Value &val)
void ComputeValueVTs(const TargetLowering &TLI, const DataLayout &DL, Type *Ty, SmallVectorImpl< EVT > &ValueVTs, SmallVectorImpl< uint64_t > *Offsets=nullptr, uint64_t StartingOffset=0)
ComputeValueVTs - Given an LLVM IR type, compute a sequence of EVTs that represent all the individual...
MachineModuleInfo * MMI
This is a pointer to the current MachineModuleInfo.
Instances of this class represent a single low-level machine instruction.
static const NVPTXGenericMCSymbolRefExpr * create(const MCSymbolRefExpr *SymExpr, MCContext &Ctx)
Class to represent pointers.
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
iterator_range< subprogram_iterator > subprograms() const
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
static const fltSemantics & IEEEsingle()
uint64_t getElementOffset(unsigned Idx) const
11: Arbitrary bit width integers
bool hasSection() const
Check if this global has a custom object file section.
Target & getTheNVPTXTarget32()
MachineLoop * getLoopFor(const MachineBasicBlock *BB) const
Return the innermost loop that BB lives in.
const MCExpr * getLHS() const
Get the left-hand side expression of the binary operator.
StringRef filename(StringRef path)
Get filename.
Address of a global value.
static bool isEmptyXXStructor(GlobalVariable *GV)
initializer< Ty > init(const Ty &Val)
unsigned const MachineRegisterInfo * MRI
MCSymbol * CurrentFnSym
The symbol for the current function.
MVT - Machine Value Type.
LLVM Basic Block Representation.
const MCAsmInfo * MAI
Target Asm Printer information.
The instances of the Type class are immutable: once they are created, they are never changed...
bool isVectorTy() const
True if this is an instance of VectorType.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
This is an important base class in LLVM.
static bool is64Bit(const char *name)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const MachineOperand & getOperand(unsigned i) const
static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol, HexagonAsmPrinter &Printer, bool MustExtend)
const NVPTXTargetLowering * getTargetLowering() const override
virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode, raw_ostream &OS)
Print the specified operand of MI, an INLINEASM instruction, using the specified assembler variant...
std::pair< iterator, bool > insert(const ValueT &V)
ConstantFP - Floating Point Values [float, double].
TargetMachine & TM
Target machine description.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
static const char * getRegisterName(unsigned RegNo)
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
ManagedStringPool * getManagedStrPool() const
Value * getOperand(unsigned i) const
void emitLineNumberAsDotLoc(const MachineInstr &)
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
EVT - Extended Value Type.
bool isPointerTy() const
True if this is an instance of PointerType.
bool hasWeakLinkage() const
Binary assembler expressions.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
pred_iterator pred_begin()
LLVMContext & getContext() const
All values hold a context through their type.
MCSymbol * getSymbol() const
Return the MCSymbol for this basic block.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool getMaxNTIDy(const Function &F, unsigned &y)
Triple - Helper class for working with autoconf configuration names.
bool getReqNTIDx(const Function &F, unsigned &x)
const std::string & getModuleInlineAsm() const
Get any module-scope inline assembly blocks.
bool isImage(const Value &val)
static cl::opt< bool > EmitLineNumbers("nvptx-emit-line-numbers", cl::Hidden, cl::desc("NVPTX Specific: Emit Line numbers even without -G"), cl::init(true))
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
bool getReqNTIDz(const Function &F, unsigned &z)
unsigned getABITypeAlignment(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
bool hasExternalLinkage() const
Iterator for intrusive lists based on ilist_node.
void setOpcode(unsigned Op)
This is the shared class of boolean and integer constants.
static void ConvertFloatToBytes(unsigned char *p, float val)
std::string * getManagedString(const char *S)
StringRef getTargetFeatureString() const
16: SIMD 'packed' format, or other vector type
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
virtual const MCExpr * lowerConstant(const Constant *CV)
Lower the specified LLVM Constant to an MCExpr.
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
bool isVector(MCInstrInfo const &MCII, MCInst const &MCI)
bool isImageReadWrite(const Value &val)
GlobalVariable * getNamedGlobal(StringRef Name)
Return the global variable in the module with the specified name, of arbitrary type.
void EmitToStreamer(MCStreamer &S, const MCInst &Inst)
bool doInitialization(Module &M) override
Set up the AsmPrinter when we are working on a new module.
std::string getTargetName() const
Value * stripPointerCasts()
Strip off pointer casts, all-zero GEPs, and aliases.
StringRef str()
Return a StringRef for the vector contents.
std::string getSurfaceName(const Value &val)
bool isNullValue() const
Return true if this is the value that would be returned by getNullValue.
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
AttributeSet getAttributes() const
Return the attribute list for this Function.
std::string getSamplerName(const Value &val)
virtual void EmitBasicBlockStart(const MachineBasicBlock &MBB) const
Targets can override this to emit stuff at the start of a basic block.
Class for arbitrary precision integers.
bool hasInitializer() const
Definitions have initializers, declarations don't.
ConstantArray - Constant Array Declarations.
bool isManaged(const Value &val)
bool getReqNTIDy(const Function &F, unsigned &y)
bool isIntegerTy() const
True if this is an instance of IntegerType.
iterator_range< user_iterator > users()
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
MDNode * GetUnrollMetadata(MDNode *LoopID, StringRef Name)
Given an llvm.loop loop id metadata node, returns the loop hint metadata node with the given name (fo...
double convertToDouble() const
static const fltSemantics & IEEEdouble()
const MCExpr * getRHS() const
Get the right-hand side expression of the binary operator.
bool hasLinkOnceLinkage() const
Representation of each machine instruction.
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
pointer remove(iterator &IT)
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
static bool printOperand(raw_ostream &OS, const SelectionDAG *G, const SDValue Value)
PointerType * getType() const
Global values are always pointers.
const MCExpr * getSubExpr() const
Get the child of this unary expression.
iterator insert(iterator where, pointer New)
bool isAggregateType() const
Return true if the type is an aggregate type.
size_type count(const ValueT &V) const
Return 1 if the specified key is in the set, 0 otherwise.
std::string getNVPTXRegClassStr(TargetRegisterClass const *RC)
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
static IntegerType * getInt32Ty(LLVMContext &C)
MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
static bool usedInGlobalVarDef(const Constant *C)
unsigned getSizeInBits() const
getSizeInBits - Return the size of the specified value type in bits.
Opcode getOpcode() const
Get the kind of this binary expression.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
std::string getNVPTXRegClassName(TargetRegisterClass const *RC)
size_t alias_size() const
iterator find(const KeyT &Val)
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
References to labels and assigned expressions.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
static bool canDemoteGlobalVar(const GlobalVariable *gv, Function const *&f)
bool isLoopHeader(const MachineBasicBlock *BB) const
True if the block is a loop header node.
static std::string utohexstr(uint64_t X, bool LowerCase=false)
const APFloat & getValueAPF() const
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
3: 64-bit floating point type
unsigned getReg() const
getReg - Returns the register number.
const TargetLoweringObjectFile & getObjFileLowering() const
Return information about object file lowering.
static unsigned int getOpenCLAlignment(const DataLayout &DL, Type *Ty)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool useFuncSeen(const Constant *C, DenseMap< const Function *, bool > &seenMap)
bool hasImageHandles() const
A raw_ostream that writes to an std::string.
MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
Floating-point immediate operand.
RegisterAsmPrinter - Helper template for registering a target specific assembly printer, for use in the target machine initialization function.
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
This class implements an extremely fast bulk output stream that can only output to a stream...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Primary interface to the complete machine description for the target machine.
static void ConvertDoubleToBytes(unsigned char *p, double val)
iterator_range< global_iterator > globals()
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
void addOperand(const MCOperand &Op)
virtual void print(raw_ostream &O, const Module *M) const
print - Print out the internal state of the pass.
StringRef - Represent a constant reference to a string, i.e.
bool getMinCTASm(const Function &F, unsigned &x)
Target specific expression.
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml","ocaml 3.10-compatible collector")
static void ConvertIntToBytes(unsigned char *p, T val)
Instances of this class represent operands of the MCInst class.
MCSymbol * GetExternalSymbolSymbol(StringRef Sym) const
Return the MCSymbol for the specified ExternalSymbol.
static MCOperand createImm(int64_t Val)
static IntegerType * getInt8Ty(LLVMContext &C)
const BasicBlock * getParent() const
static const MCConstantExpr * create(int64_t Value, MCContext &Ctx)
bool isImageWriteOnly(const Value &val)
NVPTX::DrvInterface getDrvInterface() const
void LLVMInitializeNVPTXAsmPrinter()
bool doFinalization(Module &M) override
Shut down the asmprinter.
unsigned getPTXVersion() const
This file describes how to lower LLVM code to machine code.
const NVPTXRegisterInfo * getRegisterInfo() const override
Opcode getOpcode() const
Get the kind of this unary expression.
const char * getName(unsigned RegNo) const