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))
342 unsigned NVPTXAsmPrinter::encodeVirtualRegister(
unsigned Reg) {
347 unsigned RegNum = RegMap[
Reg];
352 if (RC == &NVPTX::Int1RegsRegClass) {
354 }
else if (RC == &NVPTX::Int16RegsRegClass) {
356 }
else if (RC == &NVPTX::Int32RegsRegClass) {
358 }
else if (RC == &NVPTX::Int64RegsRegClass) {
360 }
else if (RC == &NVPTX::Float32RegsRegClass) {
362 }
else if (RC == &NVPTX::Float64RegsRegClass) {
364 }
else if (RC == &NVPTX::Float16RegsRegClass) {
366 }
else if (RC == &NVPTX::Float16x2RegsRegClass) {
373 Ret |= (RegNum & 0x0FFFFFFF);
378 return Reg & 0x0FFFFFFF;
405 if (
auto *ITy = dyn_cast<IntegerType>(Ty)) {
406 size = ITy->getBitWidth();
417 O <<
".param .b" << size <<
" func_retval0";
418 }
else if (isa<PointerType>(Ty)) {
423 unsigned retAlignment = 0;
426 O <<
".param .align " << retAlignment <<
" .b8 func_retval0[" << totalsz
434 for (
unsigned i = 0, e = vtparts.
size(); i != e; ++i) {
436 EVT elemtype = vtparts[i];
438 elems = vtparts[i].getVectorNumElements();
439 elemtype = vtparts[i].getVectorElementType();
442 for (
unsigned j = 0, je = elems; j != je; ++j) {
446 O <<
".reg .b" << sz <<
" func_retval" << idx;
461 printReturnValStr(F, O);
467 bool NVPTXAsmPrinter::isLoopHeaderOfNoUnroll(
496 if (isLoopHeaderOfNoUnroll(MBB))
500 void NVPTXAsmPrinter::EmitFunctionEntryLabel() {
504 if (!GlobalsEmitted) {
506 GlobalsEmitted =
true;
512 emitLinkageDirective(F, O);
517 printReturnValStr(*MF, O);
522 emitFunctionParamList(*MF, O);
525 emitKernelFunctionDirectives(*F, O);
532 void NVPTXAsmPrinter::EmitFunctionBodyStart() {
535 setAndEmitFunctionVirtualRegisters(*MF);
543 void NVPTXAsmPrinter::EmitFunctionBodyEnd() {
548 void NVPTXAsmPrinter::emitImplicitDef(
const MachineInstr *MI)
const {
560 void NVPTXAsmPrinter::emitKernelFunctionDirectives(
const Function &F,
565 unsigned reqntidx, reqntidy, reqntidz;
566 bool specified =
false;
581 O <<
".reqntid " << reqntidx <<
", " << reqntidy <<
", " << reqntidz
587 unsigned maxntidx, maxntidy, maxntidz;
603 O <<
".maxntid " << maxntidx <<
", " << maxntidy <<
", " << maxntidz
608 O <<
".minnctapersm " << mincta <<
"\n";
612 O <<
".maxnreg " << maxnreg <<
"\n";
623 assert(I != VRegMapping.
end() &&
"Bad register class");
627 assert(VI != RegMap.end() &&
"Bad virtual register");
628 unsigned MappedVR = VI->second;
636 void NVPTXAsmPrinter::emitVirtualRegister(
unsigned int vr,
641 void NVPTXAsmPrinter::printVecModifiedImmediate(
643 static const char vecelem[] = {
'0',
'1',
'2',
'3',
'0',
'1',
'2',
'3' };
644 int Imm = (int) MO.
getImm();
645 if (0 == strcmp(Modifier,
"vecelem"))
646 O <<
"_" << vecelem[Imm];
647 else if (0 == strcmp(Modifier,
"vecv4comm1")) {
648 if ((Imm < 0) || (Imm > 3))
650 }
else if (0 == strcmp(Modifier,
"vecv4comm2")) {
651 if ((Imm < 4) || (Imm > 7))
653 }
else if (0 == strcmp(Modifier,
"vecv4pos")) {
656 O <<
"_" << vecelem[Imm % 4];
657 }
else if (0 == strcmp(Modifier,
"vecv2comm1")) {
658 if ((Imm < 0) || (Imm > 1))
660 }
else if (0 == strcmp(Modifier,
"vecv2comm2")) {
661 if ((Imm < 2) || (Imm > 3))
663 }
else if (0 == strcmp(Modifier,
"vecv2pos")) {
666 O <<
"_" << vecelem[Imm % 2];
672 emitLinkageDirective(F, O);
677 printReturnValStr(F, O);
680 emitFunctionParamList(F, O);
689 return GV->getName() !=
"llvm.used";
693 if (
const Constant *C = dyn_cast<Constant>(U))
701 if (
const GlobalVariable *othergv = dyn_cast<GlobalVariable>(U)) {
702 if (othergv->getName() ==
"llvm.used")
706 if (
const Instruction *instr = dyn_cast<Instruction>(U)) {
707 if (instr->getParent() && instr->getParent()->getParent()) {
709 if (oneFunc && (curFunc != oneFunc))
752 if (
const Constant *cu = dyn_cast<Constant>(U)) {
755 }
else if (
const Instruction *
I = dyn_cast<Instruction>(U)) {
762 if (seenMap.
find(caller) != seenMap.
end())
779 emitDeclaration(F, O);
783 if (
const Constant *
C = dyn_cast<Constant>(U)) {
788 emitDeclaration(F, O);
794 emitDeclaration(F, O);
799 if (!isa<Instruction>(U))
812 if (seenMap.
find(caller) != seenMap.
end()) {
813 emitDeclaration(F, O);
821 void NVPTXAsmPrinter::recordAndEmitFilenames(
Module &M) {
827 StringRef Filename = DIUnit->getFilename();
828 StringRef Dirname = DIUnit->getDirectory();
832 Filename = FullPathName;
834 if (filenameMap.find(Filename) != filenameMap.end())
836 filenameMap[Filename] = i;
837 OutStreamer->EmitDwarfFileDirective(i,
"", Filename);
847 Filename = FullPathName;
849 if (filenameMap.find(Filename) != filenameMap.end())
851 filenameMap[Filename] = i;
852 OutStreamer->EmitDwarfFileDirective(i,
"", Filename);
858 if (!GV)
return true;
860 if (!InitList)
return true;
880 "Module has a nontrivial global ctor, which NVPTX does not support.");
885 "Module has a nontrivial global dtor, which NVPTX does not support.");
892 MMI = getAnalysisIfAvailable<MachineModuleInfo>();
904 emitHeader(M, OS1, STI);
912 OutStreamer->AddComment(
"Start of file scope inline assembly");
916 OutStreamer->AddComment(
"End of file scope inline assembly");
922 recordAndEmitFilenames(M);
924 GlobalsEmitted =
false;
929 void NVPTXAsmPrinter::emitGlobals(
const Module &M) {
933 emitDeclarations(M, OS2);
949 "Missed a global variable");
950 assert(GVVisiting.
size() == 0 &&
"Did not fully process a global variable");
953 for (
unsigned i = 0, e = Globals.
size(); i != e; ++i)
954 printModuleLevelGV(Globals[i], OS2);
964 O <<
"// Generated by LLVM NVPTX Back-End\n";
969 O <<
".version " << (PTXVersion / 10) <<
"." << (PTXVersion % 10) <<
"\n";
976 O <<
", texmode_independent";
979 O <<
", map_f64_to_f32";
987 O <<
".address_size ";
1000 if (!GlobalsEmitted) {
1002 GlobalsEmitted =
true;
1009 int i, n = global_list.size();
1016 gv_array[i++] = &*
I;
1019 while (!global_list.empty())
1020 global_list.
remove(global_list.begin());
1026 for (i = 0; i < n; i++)
1027 global_list.
insert(global_list.end(), gv_array[i]);
1057 void NVPTXAsmPrinter::emitLinkageDirective(
const GlobalValue *V,
1059 if (static_cast<NVPTXTargetMachine &>(TM).getDrvInterface() ==
NVPTX::CUDA) {
1061 if (isa<GlobalVariable>(V)) {
1075 msg.append(
"Error: ");
1076 msg.append(
"Symbol ");
1079 msg.append(
"has unsupported appending linkage type");
1088 void NVPTXAsmPrinter::printModuleLevelGV(
const GlobalVariable *GVar,
1090 bool processDemoted) {
1133 emitPTXGlobalVariable(GVar, O);
1141 const Constant *Initializer =
nullptr;
1155 O <<
"addr_mode_" << i <<
" = ";
1161 O <<
"clamp_to_border";
1164 O <<
"clamp_to_edge";
1175 O <<
"filter_mode = ";
1190 O <<
", force_unnormalized_coords = 1";
1200 if (strncmp(GVar->
getName().
data(),
"unrollpragma", 12) == 0)
1204 if (strncmp(GVar->
getName().
data(),
"filename", 8) == 0)
1210 const Function *demotedFunc =
nullptr;
1212 O <<
"// " << GVar->
getName() <<
" has been demoted\n";
1213 if (localDecls.find(demotedFunc) != localDecls.end())
1214 localDecls[demotedFunc].push_back(GVar);
1216 std::vector<const GlobalVariable *> temp;
1217 temp.push_back(GVar);
1218 localDecls[demotedFunc] = temp;
1227 O <<
" .attribute(.managed)";
1242 O << getPTXFundamentalTypeStr(ETy,
false);
1253 if (!Initializer->
isNullValue() && !isa<UndefValue>(Initializer)) {
1255 printScalarConstant(Initializer, O);
1264 "' is not allowed in addrspace(" +
1270 unsigned int ElementSize = 0;
1288 if (!isa<UndefValue>(Initializer) && !Initializer->
isNullValue()) {
1289 AggBuffer aggBuffer(ElementSize, O, *
this);
1290 bufferAggregateConstant(Initializer, &aggBuffer);
1291 if (aggBuffer.numSymbols) {
1292 if (static_cast<const NVPTXTargetMachine &>(TM).
is64Bit()) {
1296 O << ElementSize / 8;
1301 O << ElementSize / 4;
1341 if (localDecls.find(f) == localDecls.end())
1344 std::vector<const GlobalVariable *> &gvars = localDecls[f];
1346 for (
unsigned i = 0, e = gvars.size(); i != e; ++i) {
1347 O <<
"\t// demoted variable\n\t";
1348 printModuleLevelGV(gvars[i], O,
true);
1352 void NVPTXAsmPrinter::emitPTXAddressSpace(
unsigned int AddressSpace,
1354 switch (AddressSpace) {
1374 NVPTXAsmPrinter::getPTXFundamentalTypeStr(
Type *Ty,
bool useB4PTR)
const {
1380 unsigned NumBits = cast<IntegerType>(Ty)->
getBitWidth();
1383 else if (NumBits <= 64) {
1384 std::string
name =
"u";
1385 return name +
utostr(NumBits);
1400 if (static_cast<const NVPTXTargetMachine &>(TM).
is64Bit())
1414 void NVPTXAsmPrinter::emitPTXGlobalVariable(
const GlobalVariable *GVar,
1430 O << getPTXFundamentalTypeStr(ETy);
1436 int64_t ElementSize = 0;
1470 unsigned int alignStruct = 1;
1473 for (
unsigned i = 0, e = STy->getNumElements(); i != e; i++) {
1474 Type *ETy = STy->getElementType(i);
1476 if (align > alignStruct)
1477 alignStruct = align;
1491 O <<
"_param_" << paramIndex;
1499 unsigned paramIndex = 0;
1524 std::string sname = I->
getName();
1527 O <<
"\t.param .u64 .ptr .surfref ";
1529 O <<
"\t.param .surfref ";
1531 O <<
"_param_" << paramIndex;
1535 O <<
"\t.param .u64 .ptr .texref ";
1537 O <<
"\t.param .texref ";
1539 O <<
"_param_" << paramIndex;
1543 O <<
"\t.param .u64 .ptr .samplerref ";
1545 O <<
"\t.param .samplerref ";
1547 O <<
"_param_" << paramIndex;
1563 O <<
"\t.param .align " << align <<
" .b8 ";
1564 printParamName(I, paramIndex, O);
1565 O <<
"[" << sz <<
"]";
1576 if (static_cast<NVPTXTargetMachine &>(TM).getDrvInterface() !=
1580 switch (addrSpace) {
1585 O <<
".ptr .const ";
1588 O <<
".ptr .shared ";
1591 O <<
".ptr .global ";
1596 printParamName(I, paramIndex, O);
1606 O << getPTXFundamentalTypeStr(Ty);
1608 printParamName(I, paramIndex, O);
1614 if (isa<IntegerType>(Ty)) {
1618 }
else if (isa<PointerType>(Ty))
1628 O <<
"\t.param .b" << sz <<
" ";
1630 O <<
"\t.reg .b" << sz <<
" ";
1631 printParamName(I, paramIndex, O);
1637 assert(PTy &&
"Param with byval attribute should be a pointer type");
1640 if (isABI || isKernelFunc) {
1658 if (!isKernelFunc && align < 4)
1661 O <<
"\t.param .align " << align <<
" .b8 ";
1662 printParamName(I, paramIndex, O);
1663 O <<
"[" << sz <<
"]";
1672 for (
unsigned i = 0, e = vtparts.
size(); i != e; ++i) {
1674 EVT elemtype = vtparts[i];
1676 elems = vtparts[i].getVectorNumElements();
1677 elemtype = vtparts[i].getVectorElementType();
1680 for (
unsigned j = 0, je = elems; j != je; ++j) {
1684 O <<
"\t.reg .b" << sz <<
" ";
1685 printParamName(I, paramIndex, O);
1701 void NVPTXAsmPrinter::emitFunctionParamList(
const MachineFunction &MF,
1704 emitFunctionParamList(F, O);
1707 void NVPTXAsmPrinter::setAndEmitFunctionVirtualRegisters(
1724 O <<
"\t.reg .b64 \t%SP;\n";
1725 O <<
"\t.reg .b64 \t%SPL;\n";
1727 O <<
"\t.reg .b32 \t%SP;\n";
1728 O <<
"\t.reg .b32 \t%SPL;\n";
1736 unsigned int numVRs =
MRI->getNumVirtRegs();
1737 for (
unsigned i = 0; i < numVRs; i++) {
1741 int n = regmap.
size();
1742 regmap.
insert(std::make_pair(vr, n + 1));
1762 int n = regmap.
size();
1766 O <<
"\t.reg " << rcname <<
" \t" << rcStr <<
"<" << (n+1)
1777 unsigned int numHex;
1794 if (hexstr.length() < numHex)
1795 O << std::string(numHex - hexstr.length(),
'0');
1800 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(CPV)) {
1804 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(CPV)) {
1805 printFPConstant(CFP, O);
1808 if (isa<ConstantPointerNull>(CPV)) {
1812 if (
const GlobalValue *GVar = dyn_cast<GlobalValue>(CPV)) {
1813 bool IsNonGenericPointer =
false;
1815 IsNonGenericPointer =
true;
1817 if (EmitGeneric && !isa<Function>(CPV) && !IsNonGenericPointer) {
1826 if (
const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(CPV)) {
1829 bool IsNonGenericPointer =
false;
1831 IsNonGenericPointer =
true;
1833 if (
const GlobalValue *GVar = dyn_cast<GlobalValue>(v)) {
1834 if (EmitGeneric && !isa<Function>(v) && !IsNonGenericPointer) {
1853 int64_t vp = (int64_t)val;
1854 for (
unsigned i = 0; i <
sizeof(
T); ++i) {
1855 p[i] = (
unsigned char)vp;
1860 int32_t *vp = (int32_t *)&val;
1861 for (
unsigned i = 0; i <
sizeof(int32_t); ++i) {
1862 p[i] = (
unsigned char)*vp;
1867 int64_t *vp = (int64_t *)&val;
1868 for (
unsigned i = 0; i <
sizeof(int64_t); ++i) {
1869 p[i] = (
unsigned char)*vp;
1874 void NVPTXAsmPrinter::bufferLEByte(
const Constant *CPV,
int Bytes,
1875 AggBuffer *aggBuffer) {
1882 aggBuffer->addZeros(s);
1886 unsigned char ptr[8];
1892 unsigned char c = (
unsigned char)cast<ConstantInt>(CPV)->getZExtValue();
1893 ConvertIntToBytes<>(ptr, c);
1894 aggBuffer->addBytes(ptr, 1, Bytes);
1896 short int16 = (short)cast<ConstantInt>(CPV)->getZExtValue();
1897 ConvertIntToBytes<>(ptr, int16);
1898 aggBuffer->addBytes(ptr, 2, Bytes);
1900 if (
const ConstantInt *constInt = dyn_cast<ConstantInt>(CPV)) {
1901 int int32 = (int)(constInt->getZExtValue());
1902 ConvertIntToBytes<>(ptr, int32);
1903 aggBuffer->addBytes(ptr, 4, Bytes);
1905 }
else if (
const auto *Cexpr = dyn_cast<ConstantExpr>(CPV)) {
1906 if (
const auto *constInt = dyn_cast_or_null<ConstantInt>(
1908 int int32 = (int)(constInt->getZExtValue());
1909 ConvertIntToBytes<>(ptr, int32);
1910 aggBuffer->addBytes(ptr, 4, Bytes);
1913 if (Cexpr->getOpcode() == Instruction::PtrToInt) {
1915 aggBuffer->addSymbol(v, Cexpr->getOperand(0));
1916 aggBuffer->addZeros(4);
1922 if (
const ConstantInt *constInt = dyn_cast<ConstantInt>(CPV)) {
1923 long long int64 = (
long long)(constInt->getZExtValue());
1924 ConvertIntToBytes<>(ptr, int64);
1925 aggBuffer->addBytes(ptr, 8, Bytes);
1927 }
else if (
const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(CPV)) {
1928 if (
const auto *constInt = dyn_cast_or_null<ConstantInt>(
1930 long long int64 = (
long long)(constInt->getZExtValue());
1931 ConvertIntToBytes<>(ptr, int64);
1932 aggBuffer->addBytes(ptr, 8, Bytes);
1935 if (Cexpr->getOpcode() == Instruction::PtrToInt) {
1937 aggBuffer->addSymbol(v, Cexpr->getOperand(0));
1938 aggBuffer->addZeros(8);
1954 aggBuffer->addBytes(ptr, 4, Bytes);
1958 aggBuffer->addBytes(ptr, 8, Bytes);
1965 if (
const GlobalValue *GVar = dyn_cast<GlobalValue>(CPV)) {
1966 aggBuffer->addSymbol(GVar, GVar);
1967 }
else if (
const ConstantExpr *Cexpr = dyn_cast<ConstantExpr>(CPV)) {
1969 aggBuffer->addSymbol(v, Cexpr);
1972 aggBuffer->addZeros(s);
1979 if (isa<ConstantAggregate>(CPV) || isa<ConstantDataSequential>(CPV)) {
1981 bufferAggregateConstant(CPV, aggBuffer);
1982 if (Bytes > ElementSize)
1983 aggBuffer->addZeros(Bytes - ElementSize);
1984 }
else if (isa<ConstantAggregateZero>(CPV))
1985 aggBuffer->addZeros(Bytes);
1996 void NVPTXAsmPrinter::bufferAggregateConstant(
const Constant *CPV,
1997 AggBuffer *aggBuffer) {
2002 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(CPV)) {
2006 aggBuffer->addBytes(&Byte, 1, 1);
2013 if (isa<ConstantArray>(CPV) || isa<ConstantVector>(CPV)) {
2016 bufferLEByte(cast<Constant>(CPV->
getOperand(i)), 0, aggBuffer);
2021 dyn_cast<ConstantDataSequential>(CPV)) {
2022 if (CDS->getNumElements())
2023 for (
unsigned i = 0; i < CDS->getNumElements(); ++i)
2024 bufferLEByte(cast<Constant>(CDS->getElementAsConstant(i)), 0,
2029 if (isa<ConstantStruct>(CPV)) {
2040 bufferLEByte(cast<Constant>(CPV->
getOperand(i)), Bytes, aggBuffer);
2055 case NVPTX::CallArgBeginInst:
2056 case NVPTX::CallArgEndInst0:
2057 case NVPTX::CallArgEndInst1:
2058 case NVPTX::CallArgF32:
2059 case NVPTX::CallArgF64:
2060 case NVPTX::CallArgI16:
2061 case NVPTX::CallArgI32:
2062 case NVPTX::CallArgI32imm:
2063 case NVPTX::CallArgI64:
2064 case NVPTX::CallArgParam:
2065 case NVPTX::CallVoidInst:
2066 case NVPTX::CallVoidInstReg:
2067 case NVPTX::Callseq_End:
2068 case NVPTX::CallVoidInstReg64:
2069 case NVPTX::DeclareParamInst:
2070 case NVPTX::DeclareRetMemInst:
2071 case NVPTX::DeclareRetRegInst:
2072 case NVPTX::DeclareRetScalarInst:
2073 case NVPTX::DeclareScalarParamInst:
2074 case NVPTX::DeclareScalarRegInst:
2075 case NVPTX::StoreParamF32:
2076 case NVPTX::StoreParamF64:
2077 case NVPTX::StoreParamI16:
2078 case NVPTX::StoreParamI32:
2079 case NVPTX::StoreParamI64:
2080 case NVPTX::StoreParamI8:
2081 case NVPTX::StoreRetvalF32:
2082 case NVPTX::StoreRetvalF64:
2083 case NVPTX::StoreRetvalI16:
2084 case NVPTX::StoreRetvalI32:
2085 case NVPTX::StoreRetvalI64:
2086 case NVPTX::StoreRetvalI8:
2087 case NVPTX::LastCallArgF32:
2088 case NVPTX::LastCallArgF64:
2089 case NVPTX::LastCallArgI16:
2090 case NVPTX::LastCallArgI32:
2091 case NVPTX::LastCallArgI32imm:
2092 case NVPTX::LastCallArgI64:
2093 case NVPTX::LastCallArgParam:
2094 case NVPTX::LoadParamMemF32:
2095 case NVPTX::LoadParamMemF64:
2096 case NVPTX::LoadParamMemI16:
2097 case NVPTX::LoadParamMemI32:
2098 case NVPTX::LoadParamMemI64:
2099 case NVPTX::LoadParamMemI8:
2100 case NVPTX::PrototypeInst:
2101 case NVPTX::DBG_VALUE:
2112 NVPTXAsmPrinter::lowerConstantForGV(
const Constant *CV,
bool ProcessingGeneric) {
2118 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(CV))
2121 if (
const GlobalValue *GV = dyn_cast<GlobalValue>(CV)) {
2124 if (ProcessingGeneric) {
2143 return lowerConstantForGV(
C, ProcessingGeneric);
2149 OS <<
"Unsupported expression in static initializer: ";
2155 case Instruction::AddrSpaceCast: {
2159 return lowerConstantForGV(cast<const Constant>(CE->
getOperand(0)),
true);
2163 OS <<
"Unsupported expression in static initializer: ";
2169 case Instruction::GetElementPtr: {
2174 cast<GEPOperator>(CE)->accumulateConstantOffset(DL, OffsetAI);
2181 int64_t
Offset = OffsetAI.getSExtValue();
2186 case Instruction::Trunc:
2192 case Instruction::BitCast:
2193 return lowerConstantForGV(CE->
getOperand(0), ProcessingGeneric);
2195 case Instruction::IntToPtr: {
2203 return lowerConstantForGV(Op, ProcessingGeneric);
2206 case Instruction::PtrToInt: {
2214 const MCExpr *OpExpr = lowerConstantForGV(Op, ProcessingGeneric);
2232 const MCExpr *LHS = lowerConstantForGV(CE->
getOperand(0), ProcessingGeneric);
2233 const MCExpr *RHS = lowerConstantForGV(CE->
getOperand(1), ProcessingGeneric);
2246 return cast<MCTargetExpr>(&Expr)->printImpl(OS,
MAI);
2248 OS << cast<MCConstantExpr>(Expr).getValue();
2274 if (isa<MCConstantExpr>(BE.
getLHS()) || isa<MCSymbolRefExpr>(BE.
getLHS()) ||
2275 isa<NVPTXGenericMCSymbolRefExpr>(BE.
getLHS())) {
2276 printMCExpr(*BE.
getLHS(), OS);
2279 printMCExpr(*BE.
getLHS(), OS);
2287 if (RHSC->getValue() < 0) {
2288 OS << RHSC->getValue();
2299 if (isa<MCConstantExpr>(BE.
getRHS()) || isa<MCSymbolRefExpr>(BE.
getRHS())) {
2300 printMCExpr(*BE.
getRHS(), OS);
2303 printMCExpr(*BE.
getRHS(), OS);
2315 bool NVPTXAsmPrinter::PrintAsmOperand(
const MachineInstr *MI,
unsigned OpNo,
2316 unsigned AsmVariant,
2318 if (ExtraCode && ExtraCode[0]) {
2319 if (ExtraCode[1] != 0)
2322 switch (ExtraCode[0]) {
2336 bool NVPTXAsmPrinter::PrintAsmMemoryOperand(
2337 const MachineInstr *MI,
unsigned OpNo,
unsigned AsmVariant,
2339 if (ExtraCode && ExtraCode[0])
2343 printMemOperand(MI, OpNo, O);
2355 if (MO.
getReg() == NVPTX::VRDepot)
2360 emitVirtualRegister(MO.
getReg(), O);
2367 else if (strstr(Modifier,
"vec") == Modifier)
2368 printVecModifiedImmediate(MO, Modifier, O);
2371 "Don't know how to handle modifier on immediate operand");
2391 void NVPTXAsmPrinter::printMemOperand(
const MachineInstr *MI,
int opNum,
2395 if (Modifier && strcmp(Modifier,
"add") == 0) {
2408 std::stringstream temp;
2409 LineReader *reader = this->getReader(filename);
2411 temp << filename.
str();
2420 LineReader *NVPTXAsmPrinter::getReader(
const std::string &filename) {
2434 if (lineNum < theCurLine) {
2436 fstr.seekg(0, std::ios::beg);
2438 while (theCurLine < lineNum) {
2439 fstr.getline(buff, 500);
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
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
This class represents an incoming formal argument to a Function.
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.
const Value * stripPointerCasts() const
Strip off pointer casts, all-zero GEPs, and aliases.
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.
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
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.
1: 16-bit floating point 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.
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...
AttributeList getAttributes() const
Return the attribute list for this Function.
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)
const GlobalVariable * getNamedGlobal(StringRef Name) const
Return the global variable in the module with the specified name, of arbitrary type.
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...
bool is_absolute(const Twine &path, Style style=Style::native)
Is path absolute?
APInt bitcastToAPInt() const
Represent a reference to a symbol from inside an expression.
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...
void lshrInPlace(unsigned ShiftAmt)
Logical right-shift this APInt by ShiftAmt in place.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
bool isInteger() const
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.
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
Equivalent to hasAttribute(ArgNo + FirstArgIndex, Kind).
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 fltSemantics & IEEEdouble() LLVM_READNONE
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.
iterator find(const_arg_type_t< KeyT > Val)
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.
Address of a global value.
static bool isEmptyXXStructor(GlobalVariable *GV)
Type * getReturnType() const
Returns the type of the ret val.
initializer< Ty > init(const Ty &Val)
unsigned const MachineRegisterInfo * MRI
MCSymbol * CurrentFnSym
The symbol for the current function.
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...
const Function * getParent() const
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.
APInt getLoBits(unsigned numBits) const
Compute an APInt containing numBits lowbits from this APInt.
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.
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.
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
static const fltSemantics & IEEEsingle() LLVM_READNONE
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...
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
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)
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
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...
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
llvm_unreachable("Unknown RegBank!")
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.
std::string getNVPTXRegClassStr(TargetRegisterClass const *RC)
StringRef filename(StringRef path, Style style=Style::native)
Get filename.
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
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
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 const NVPTXFloatMCExpr * createConstantFPHalf(const APFloat &Flt, MCContext &Ctx)
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
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 getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
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