Path: blob/21.2-virgl/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
4574 views
/*1* Copyright 2011 Christoph Bumiller2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice shall be included in11* all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR17* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR19* OTHER DEALINGS IN THE SOFTWARE.20*/2122#include "codegen/nv50_ir.h"23#include "codegen/nv50_ir_target.h"24#include "codegen/nv50_ir_driver.h"2526#include <inttypes.h>2728namespace nv50_ir {2930enum TextStyle31{32TXT_DEFAULT,33TXT_GPR,34TXT_REGISTER,35TXT_FLAGS,36TXT_MEM,37TXT_IMMD,38TXT_BRA,39TXT_INSN40};4142static const char *_colour[8] =43{44"\x1b[00m",45"\x1b[34m",46"\x1b[35m",47"\x1b[35m",48"\x1b[36m",49"\x1b[33m",50"\x1b[37m",51"\x1b[32m"52};5354static const char *_nocolour[8] =55{56"", "", "", "", "", "", "", ""57};5859static const char **colour;6061static void init_colours()62{63if (getenv("NV50_PROG_DEBUG_NO_COLORS") != NULL)64colour = _nocolour;65else66colour = _colour;67}6869const char *operationStr[OP_LAST + 1] =70{71"nop",72"phi",73"union",74"split",75"merge",76"consec",77"mov",78"ld",79"st",80"add",81"sub",82"mul",83"div",84"mod",85"mad",86"fma",87"sad",88"shladd",89"xmad",90"abs",91"neg",92"not",93"and",94"or",95"xor",96"lop3 lut",97"shl",98"shr",99"shf",100"max",101"min",102"sat",103"ceil",104"floor",105"trunc",106"cvt",107"set and",108"set or",109"set xor",110"set",111"selp",112"slct",113"rcp",114"rsq",115"lg2",116"sin",117"cos",118"ex2",119"exp",120"log",121"presin",122"preex2",123"sqrt",124"pow",125"bra",126"call",127"ret",128"cont",129"break",130"preret",131"precont",132"prebreak",133"brkpt",134"joinat",135"join",136"discard",137"exit",138"membar",139"vfetch",140"pfetch",141"afetch",142"export",143"linterp",144"pinterp",145"emit",146"restart",147"final",148"tex",149"texbias",150"texlod",151"texfetch",152"texquery",153"texgrad",154"texgather",155"texquerylod",156"texcsaa",157"texprep",158"suldb",159"suldp",160"sustb",161"sustp",162"suredb",163"suredp",164"sulea",165"subfm",166"suclamp",167"sueau",168"suq",169"madsp",170"texbar",171"dfdx",172"dfdy",173"rdsv",174"wrsv",175"pixld",176"quadop",177"quadon",178"quadpop",179"popcnt",180"insbf",181"extbf",182"bfind",183"brev",184"bmsk",185"permt",186"sgxt",187"atom",188"bar",189"vadd",190"vavg",191"vmin",192"vmax",193"vsad",194"vset",195"vshr",196"vshl",197"vsel",198"cctl",199"shfl",200"vote",201"bufq",202"warpsync",203"(invalid)"204};205206static const char *atomSubOpStr[] =207{208"add", "min", "max", "inc", "dec", "and", "or", "xor", "cas", "exch"209};210211static const char *ldstSubOpStr[] =212{213"", "lock", "unlock"214};215216static const char *subfmOpStr[] =217{218"", "3d"219};220221static const char *shflOpStr[] =222{223"idx", "up", "down", "bfly"224};225226static const char *pixldOpStr[] =227{228"count", "covmask", "covered", "offset", "cent_offset", "sampleid"229};230231static const char *rcprsqOpStr[] =232{233"", "64h"234};235236static const char *emitOpStr[] =237{238"", "restart"239};240241static const char *cctlOpStr[] =242{243"", "", "", "", "", "iv", "ivall"244};245246static const char *barOpStr[] =247{248"sync", "arrive", "red and", "red or", "red popc"249};250251static const char *xmadOpCModeStr[] =252{253"clo", "chi", "csfu", "cbcc"254};255256static const char *DataTypeStr[] =257{258"-",259"u8", "s8",260"u16", "s16",261"u32", "s32",262"u64", "s64",263"f16", "f32", "f64",264"b96", "b128"265};266267static const char *RoundModeStr[] =268{269"", "rm", "rz", "rp", "rni", "rmi", "rzi", "rpi"270};271272static const char *CondCodeStr[] =273{274"never",275"lt",276"eq",277"le",278"gt",279"ne",280"ge",281"",282"(invalid)",283"ltu",284"equ",285"leu",286"gtu",287"neu",288"geu",289"",290"no",291"nc",292"ns",293"na",294"a",295"s",296"c",297"o"298};299300static const char *SemanticStr[] =301{302"POSITION",303"VERTEX_ID",304"INSTANCE_ID",305"INVOCATION_ID",306"PRIMITIVE_ID",307"VERTEX_COUNT",308"LAYER",309"VIEWPORT_INDEX",310"VIEWPORT_MASK",311"Y_DIR",312"FACE",313"POINT_SIZE",314"POINT_COORD",315"CLIP_DISTANCE",316"SAMPLE_INDEX",317"SAMPLE_POS",318"SAMPLE_MASK",319"TESS_OUTER",320"TESS_INNER",321"TESS_COORD",322"TID",323"COMBINED_TID",324"CTAID",325"NTID",326"GRIDID",327"NCTAID",328"LANEID",329"PHYSID",330"NPHYSID",331"CLOCK",332"LBASE",333"SBASE",334"VERTEX_STRIDE",335"INVOCATION_INFO",336"THREAD_KILL",337"BASEVERTEX",338"BASEINSTANCE",339"DRAWID",340"WORK_DIM",341"LANEMASK_EQ",342"LANEMASK_LT",343"LANEMASK_LE",344"LANEMASK_GT",345"LANEMASK_GE",346"?",347"(INVALID)"348};349350static const char *TSStr[17] =351{352"THREAD_STATE_ENUM0",353"THREAD_STATE_ENUM1",354"THREAD_STATE_ENUM2",355"THREAD_STATE_ENUM3",356"THREAD_STATE_ENUM4",357"TRAP_RETURN_PC_LO",358"TRAP_RETURN_PC_HI",359"TRAP_RETURN_MASK",360"MEXITED",361"MKILL",362"MACTIVE",363"MATEXIT",364"OPT_STACK",365"API_CALL_DEPTH",366"ATEXIT_PC_LO",367"ATEXIT_PC_HI",368"PQUAD_MACTIVE",369};370371static const char *interpStr[16] =372{373"pass",374"mul",375"flat",376"sc",377"cent pass",378"cent mul",379"cent flat",380"cent sc",381"off pass",382"off mul",383"off flat",384"off sc",385"samp pass",386"samp mul",387"samp flat",388"samp sc"389};390391static const char *texMaskStr[16] =392{393"____",394"r___",395"_g__",396"rg__",397"__b_",398"r_b_",399"_gb_",400"rgb_",401"___a",402"r__a",403"_g_a",404"rg_a",405"__ba",406"r_ba",407"_gba",408"rgba",409};410411static const char *gatherCompStr[4] =412{413"r", "g", "b", "a",414};415416#define PRINT(args...) \417do { \418pos += snprintf(&buf[pos], size - pos, args); \419} while(0)420421#define SPACE_PRINT(cond, args...) \422do { \423if (cond) \424buf[pos++] = ' '; \425pos += snprintf(&buf[pos], size - pos, args); \426} while(0)427428#define SPACE() \429do { \430if (pos < size) \431buf[pos++] = ' '; \432} while(0)433434int Modifier::print(char *buf, size_t size) const435{436size_t pos = 0;437438if (bits)439PRINT("%s", colour[TXT_INSN]);440441size_t base = pos;442443if (bits & NV50_IR_MOD_NOT)444PRINT("not");445if (bits & NV50_IR_MOD_SAT)446SPACE_PRINT(pos > base && pos < size, "sat");447if (bits & NV50_IR_MOD_NEG)448SPACE_PRINT(pos > base && pos < size, "neg");449if (bits & NV50_IR_MOD_ABS)450SPACE_PRINT(pos > base && pos < size, "abs");451452return pos;453}454455int LValue::print(char *buf, size_t size, DataType ty) const456{457const char *postFix = "";458size_t pos = 0;459int idx = join->reg.data.id >= 0 ? join->reg.data.id : id;460char p = join->reg.data.id >= 0 ? '$' : '%';461char r;462int col = TXT_DEFAULT;463464switch (reg.file) {465case FILE_GPR:466r = 'r'; col = TXT_GPR;467if (reg.size == 2) {468if (p == '$') {469postFix = (idx & 1) ? "h" : "l";470idx /= 2;471} else {472postFix = "s";473}474} else475if (reg.size == 8) {476postFix = "d";477} else478if (reg.size == 16) {479postFix = "q";480} else481if (reg.size == 12) {482postFix = "t";483}484break;485case FILE_PREDICATE:486r = 'p'; col = TXT_REGISTER;487if (reg.size == 2)488postFix = "d";489else490if (reg.size == 4)491postFix = "q";492break;493case FILE_FLAGS:494r = 'c'; col = TXT_FLAGS;495break;496case FILE_ADDRESS:497r = 'a'; col = TXT_REGISTER;498break;499case FILE_BARRIER:500r = 'b'; col = TXT_REGISTER;501break;502default:503assert(!"invalid file for lvalue");504r = '?';505break;506}507508PRINT("%s%c%c%i%s", colour[col], p, r, idx, postFix);509510return pos;511}512513int ImmediateValue::print(char *buf, size_t size, DataType ty) const514{515size_t pos = 0;516517PRINT("%s", colour[TXT_IMMD]);518519switch (ty) {520case TYPE_F32: PRINT("%f", reg.data.f32); break;521case TYPE_F64: PRINT("%f", reg.data.f64); break;522case TYPE_U8: PRINT("0x%02x", reg.data.u8); break;523case TYPE_S8: PRINT("%i", reg.data.s8); break;524case TYPE_U16: PRINT("0x%04x", reg.data.u16); break;525case TYPE_S16: PRINT("%i", reg.data.s16); break;526case TYPE_U32: PRINT("0x%08x", reg.data.u32); break;527case TYPE_S32: PRINT("%i", reg.data.s32); break;528case TYPE_U64:529case TYPE_S64:530default:531PRINT("0x%016" PRIx64, reg.data.u64);532break;533}534return pos;535}536537int Symbol::print(char *buf, size_t size, DataType ty) const538{539return print(buf, size, NULL, NULL, ty);540}541542int Symbol::print(char *buf, size_t size,543Value *rel, Value *dimRel, DataType ty) const544{545STATIC_ASSERT(ARRAY_SIZE(SemanticStr) == SV_LAST + 1);546547size_t pos = 0;548char c;549550if (ty == TYPE_NONE)551ty = typeOfSize(reg.size);552553if (reg.file == FILE_SYSTEM_VALUE) {554PRINT("%ssv[%s%s:%i%s", colour[TXT_MEM],555colour[TXT_REGISTER],556SemanticStr[reg.data.sv.sv], reg.data.sv.index, colour[TXT_MEM]);557if (rel) {558PRINT("%s+", colour[TXT_DEFAULT]);559pos += rel->print(&buf[pos], size - pos);560}561PRINT("%s]", colour[TXT_MEM]);562return pos;563} else if (reg.file == FILE_THREAD_STATE) {564PRINT("%sts[%s%s%s]", colour[TXT_MEM], colour[TXT_REGISTER],565TSStr[reg.data.ts], colour[TXT_MEM]);566return pos;567}568569switch (reg.file) {570case FILE_MEMORY_CONST: c = 'c'; break;571case FILE_SHADER_INPUT: c = 'a'; break;572case FILE_SHADER_OUTPUT: c = 'o'; break;573case FILE_MEMORY_BUFFER: c = 'b'; break; // Only used before lowering574case FILE_MEMORY_GLOBAL: c = 'g'; break;575case FILE_MEMORY_SHARED: c = 's'; break;576case FILE_MEMORY_LOCAL: c = 'l'; break;577case FILE_BARRIER: c = 'b'; break;578default:579assert(!"invalid file");580c = '?';581break;582}583584if (c == 'c')585PRINT("%s%c%i[", colour[TXT_MEM], c, reg.fileIndex);586else587PRINT("%s%c[", colour[TXT_MEM], c);588589if (dimRel) {590pos += dimRel->print(&buf[pos], size - pos, TYPE_S32);591PRINT("%s][", colour[TXT_MEM]);592}593594if (rel) {595pos += rel->print(&buf[pos], size - pos);596PRINT("%s%c", colour[TXT_DEFAULT], (reg.data.offset < 0) ? '-' : '+');597} else {598assert(reg.data.offset >= 0);599}600PRINT("%s0x%x%s]", colour[TXT_IMMD], abs(reg.data.offset), colour[TXT_MEM]);601602return pos;603}604605void Instruction::print() const606{607#define BUFSZ 512608609const size_t size = BUFSZ;610611char buf[BUFSZ];612int s, d;613size_t pos = 0;614615PRINT("%s", colour[TXT_INSN]);616617if (join)618PRINT("join ");619620if (predSrc >= 0) {621const size_t pre = pos;622if (getSrc(predSrc)->reg.file == FILE_PREDICATE) {623if (cc == CC_NOT_P)624PRINT("not");625} else {626PRINT("%s", CondCodeStr[cc]);627}628if (pos > pre)629SPACE();630pos += getSrc(predSrc)->print(&buf[pos], BUFSZ - pos);631PRINT(" %s", colour[TXT_INSN]);632}633634if (saturate)635PRINT("sat ");636637if (asFlow()) {638PRINT("%s", operationStr[op]);639if (asFlow()->indirect)640PRINT(" ind");641if (asFlow()->absolute)642PRINT(" abs");643if (op == OP_CALL && asFlow()->builtin) {644PRINT(" %sBUILTIN:%i", colour[TXT_BRA], asFlow()->target.builtin);645} else646if (op == OP_CALL && asFlow()->target.fn) {647PRINT(" %s%s:%i", colour[TXT_BRA],648asFlow()->target.fn->getName(),649asFlow()->target.fn->getLabel());650} else651if (asFlow()->target.bb)652PRINT(" %sBB:%i", colour[TXT_BRA], asFlow()->target.bb->getId());653} else {654if (asTex())655PRINT("%s%s ", operationStr[op], asTex()->tex.scalar ? "s" : "");656else657PRINT("%s ", operationStr[op]);658if (op == OP_LINTERP || op == OP_PINTERP)659PRINT("%s ", interpStr[ipa]);660switch (op) {661case OP_SUREDP:662case OP_SUREDB:663case OP_ATOM:664if (subOp < ARRAY_SIZE(atomSubOpStr))665PRINT("%s ", atomSubOpStr[subOp]);666break;667case OP_LOAD:668case OP_STORE:669if (subOp < ARRAY_SIZE(ldstSubOpStr))670PRINT("%s ", ldstSubOpStr[subOp]);671break;672case OP_SUBFM:673if (subOp < ARRAY_SIZE(subfmOpStr))674PRINT("%s ", subfmOpStr[subOp]);675break;676case OP_SHFL:677if (subOp < ARRAY_SIZE(shflOpStr))678PRINT("%s ", shflOpStr[subOp]);679break;680case OP_PIXLD:681if (subOp < ARRAY_SIZE(pixldOpStr))682PRINT("%s ", pixldOpStr[subOp]);683break;684case OP_RCP:685case OP_RSQ:686if (subOp < ARRAY_SIZE(rcprsqOpStr))687PRINT("%s ", rcprsqOpStr[subOp]);688break;689case OP_EMIT:690if (subOp < ARRAY_SIZE(emitOpStr))691PRINT("%s ", emitOpStr[subOp]);692break;693case OP_CCTL:694if (subOp < ARRAY_SIZE(cctlOpStr))695PRINT("%s ", cctlOpStr[subOp]);696break;697case OP_BAR:698if (subOp < ARRAY_SIZE(barOpStr))699PRINT("%s ", barOpStr[subOp]);700break;701case OP_XMAD: {702if (subOp & NV50_IR_SUBOP_XMAD_PSL)703PRINT("psl ");704if (subOp & NV50_IR_SUBOP_XMAD_MRG)705PRINT("mrg ");706unsigned cmode = (subOp & NV50_IR_SUBOP_XMAD_CMODE_MASK);707cmode >>= NV50_IR_SUBOP_XMAD_CMODE_SHIFT;708if (cmode && cmode <= ARRAY_SIZE(xmadOpCModeStr))709PRINT("%s ", xmadOpCModeStr[cmode - 1]);710for (int i = 0; i < 2; i++)711PRINT("h%d ", (subOp & NV50_IR_SUBOP_XMAD_H1(i)) ? 1 : 0);712break;713}714default:715if (subOp)716PRINT("(SUBOP:%u) ", subOp);717break;718}719if (perPatch)720PRINT("patch ");721if (asTex()) {722PRINT("%s %s$r%u $s%u ", asTex()->tex.target.getName(),723colour[TXT_MEM], asTex()->tex.r, asTex()->tex.s);724if (op == OP_TXG)725PRINT("%s ", gatherCompStr[asTex()->tex.gatherComp]);726PRINT("%s %s", texMaskStr[asTex()->tex.mask], colour[TXT_INSN]);727}728729if (postFactor)730PRINT("x2^%i ", postFactor);731PRINT("%s%s", dnz ? "dnz " : (ftz ? "ftz " : ""), DataTypeStr[dType]);732}733734if (rnd != ROUND_N)735PRINT(" %s", RoundModeStr[rnd]);736737if (defExists(1))738PRINT(" {");739for (d = 0; defExists(d); ++d) {740SPACE();741pos += getDef(d)->print(&buf[pos], size - pos);742}743if (d > 1)744PRINT(" %s}", colour[TXT_INSN]);745else746if (!d && !asFlow())747PRINT(" %s#", colour[TXT_INSN]);748749if (asCmp())750PRINT(" %s%s", colour[TXT_INSN], CondCodeStr[asCmp()->setCond]);751752if (sType != dType)753PRINT(" %s%s", colour[TXT_INSN], DataTypeStr[sType]);754755for (s = 0; srcExists(s); ++s) {756if (s == predSrc || src(s).usedAsPtr)757continue;758const size_t pre = pos;759SPACE();760pos += src(s).mod.print(&buf[pos], BUFSZ - pos);761if (pos > pre + 1)762SPACE();763if (src(s).isIndirect(0) || src(s).isIndirect(1))764pos += getSrc(s)->asSym()->print(&buf[pos], BUFSZ - pos,765getIndirect(s, 0),766getIndirect(s, 1));767else768pos += getSrc(s)->print(&buf[pos], BUFSZ - pos, sType);769}770if (exit)771PRINT("%s exit", colour[TXT_INSN]);772773PRINT("%s", colour[TXT_DEFAULT]);774775buf[MIN2(pos, BUFSZ - 1)] = 0;776777INFO("%s (%u)\n", buf, encSize);778}779780class PrintPass : public Pass781{782public:783PrintPass(bool omitLineNum) : serial(0), omit_serial(omitLineNum) { }784785virtual bool visit(Function *);786virtual bool visit(BasicBlock *);787virtual bool visit(Instruction *);788789private:790int serial;791bool omit_serial;792};793794bool795PrintPass::visit(Function *fn)796{797char str[16];798799INFO("\n%s:%i (", fn->getName(), fn->getLabel());800801if (!fn->outs.empty())802INFO("out");803for (std::deque<ValueRef>::iterator it = fn->outs.begin();804it != fn->outs.end();805++it) {806it->get()->print(str, sizeof(str), typeOfSize(it->get()->reg.size));807INFO(" %s", str);808}809810if (!fn->ins.empty())811INFO("%s%sin", colour[TXT_DEFAULT], fn->outs.empty() ? "" : ", ");812for (std::deque<ValueDef>::iterator it = fn->ins.begin();813it != fn->ins.end();814++it) {815it->get()->print(str, sizeof(str), typeOfSize(it->get()->reg.size));816INFO(" %s", str);817}818INFO("%s)\n", colour[TXT_DEFAULT]);819820return true;821}822823bool824PrintPass::visit(BasicBlock *bb)825{826#if 0827INFO("---\n");828for (Graph::EdgeIterator ei = bb->cfg.incident(); !ei.end(); ei.next())829INFO(" <- BB:%i (%s)\n",830BasicBlock::get(ei.getNode())->getId(),831ei.getEdge()->typeStr());832#endif833INFO("BB:%i (%u instructions) - ", bb->getId(), bb->getInsnCount());834835if (bb->idom())836INFO("idom = BB:%i, ", bb->idom()->getId());837838INFO("df = { ");839for (DLList::Iterator df = bb->getDF().iterator(); !df.end(); df.next())840INFO("BB:%i ", BasicBlock::get(df)->getId());841842INFO("}\n");843844for (Graph::EdgeIterator ei = bb->cfg.outgoing(); !ei.end(); ei.next())845INFO(" -> BB:%i (%s)\n",846BasicBlock::get(ei.getNode())->getId(),847ei.getEdge()->typeStr());848849return true;850}851852bool853PrintPass::visit(Instruction *insn)854{855if (omit_serial)856INFO(" ");857else858INFO("%3i: ", serial);859serial++;860insn->print();861return true;862}863864void865Function::print()866{867PrintPass pass(prog->driver->omitLineNum);868pass.run(this, true, false);869}870871void872Program::print()873{874PrintPass pass(driver->omitLineNum);875init_colours();876pass.run(this, true, false);877}878879void880Function::printLiveIntervals() const881{882INFO("printing live intervals ...\n");883884for (ArrayList::Iterator it = allLValues.iterator(); !it.end(); it.next()) {885const Value *lval = Value::get(it)->asLValue();886if (lval && !lval->livei.isEmpty()) {887INFO("livei(%%%i): ", lval->id);888lval->livei.print();889}890}891}892893} // namespace nv50_ir894895extern void896nv50_ir_prog_info_out_print(struct nv50_ir_prog_info_out *info_out)897{898int i;899900INFO("{\n");901INFO(" \"target\":\"%d\",\n", info_out->target);902INFO(" \"type\":\"%d\",\n", info_out->type);903904// Bin905INFO(" \"bin\":{\n");906INFO(" \"maxGPR\":\"%d\",\n", info_out->bin.maxGPR);907INFO(" \"tlsSpace\":\"%d\",\n", info_out->bin.tlsSpace);908INFO(" \"smemSize\":\"%d\",\n", info_out->bin.smemSize);909INFO(" \"codeSize\":\"%d\",\n", info_out->bin.codeSize);910INFO(" \"instructions\":\"%d\",\n", info_out->bin.instructions);911912// RelocInfo913INFO(" \"RelocInfo\":");914if (!info_out->bin.relocData) {915INFO("\"NULL\",\n");916} else {917nv50_ir::RelocInfo *reloc = (nv50_ir::RelocInfo *)info_out->bin.relocData;918INFO("{\n");919INFO(" \"codePos\":\"%d\",\n", reloc->codePos);920INFO(" \"libPos\":\"%d\",\n", reloc->libPos);921INFO(" \"dataPos\":\"%d\",\n", reloc->dataPos);922INFO(" \"count\":\"%d\",\n", reloc->count);923INFO(" \"RelocEntry\":[\n");924for (unsigned int i = 0; i < reloc->count; i++) {925INFO(" {\"data\":\"%d\",\t\"mask\":\"%d\",\t\"offset\":\"%d\",\t\"bitPos\":\"%d\",\t\"type\":\"%d\"}",926reloc->entry[i].data, reloc->entry[i].mask, reloc->entry[i].offset, reloc->entry[i].bitPos, reloc->entry[i].type927);928}929INFO("\n");930INFO(" ]\n");931INFO(" },\n");932}933934// FixupInfo935INFO(" \"FixupInfo\":");936if (!info_out->bin.fixupData) {937INFO("\"NULL\"\n");938} else {939nv50_ir::FixupInfo *fixup = (nv50_ir::FixupInfo *)info_out->bin.fixupData;940INFO("{\n");941INFO(" \"count\":\"%d\"\n", fixup->count);942INFO(" \"FixupEntry\":[\n");943for (unsigned int i = 0; i < fixup->count; i++) {944INFO(" {\"apply\":\"%p\",\t\"ipa\":\"%d\",\t\"reg\":\"%d\",\t\"loc\":\"%d\"}\n",945fixup->entry[i].apply, fixup->entry[i].ipa, fixup->entry[i].reg, fixup->entry[i].loc);946}947INFO("\n");948INFO(" ]\n");949INFO(" }\n");950951INFO(" },\n");952}953954if (info_out->numSysVals) {955INFO(" \"sv\":[\n");956for (i = 0; i < info_out->numSysVals; i++) {957if (&(info_out->sv[i])) {958INFO(" {\"id\":\"%d\", \"sn\":\"%d\", \"si\":\"%d\"}\n",959info_out->sv[i].id, info_out->sv[i].sn, info_out->sv[i].si);960}961}962INFO("\n ],\n");963}964if (info_out->numInputs) {965INFO(" \"in\":[\n");966for (i = 0; i < info_out->numInputs; i++) {967if (&(info_out->in[i])) {968INFO(" {\"id\":\"%d\",\t\"sn\":\"%d\",\t\"si\":\"%d\"}\n",969info_out->in[i].id, info_out->in[i].sn, info_out->in[i].si);970}971}972INFO("\n ],\n");973}974if (info_out->numOutputs) {975INFO(" \"out\":[\n");976for (i = 0; i < info_out->numOutputs; i++) {977if (&(info_out->out[i])) {978INFO(" {\"id\":\"%d\",\t\"sn\":\"%d\",\t\"si\":\"%d\"}\n",979info_out->out[i].id, info_out->out[i].sn, info_out->out[i].si);980}981}982INFO("\n ],\n");983}984985INFO(" \"numInputs\":\"%d\",\n", info_out->numInputs);986INFO(" \"numOutputs\":\"%d\",\n", info_out->numOutputs);987INFO(" \"numPatchConstants\":\"%d\",\n", info_out->numPatchConstants);988INFO(" \"numSysVals\":\"%d\",\n", info_out->numSysVals);989990INFO(" \"prop\":{\n");991switch (info_out->type) {992case PIPE_SHADER_VERTEX:993INFO(" \"vp\": {\"usesDrawParameters\":\"%s\"}\n",994info_out->prop.vp.usesDrawParameters ? "true" : "false");995break;996case PIPE_SHADER_TESS_CTRL:997case PIPE_SHADER_TESS_EVAL:998INFO(" \"tp\":{\n");999INFO(" \"outputPatchSize\":\"%d\"\n", info_out->prop.tp.outputPatchSize);1000INFO(" \"partitioning\":\"%d\"\n", info_out->prop.tp.partitioning);1001INFO(" \"winding\":\"%d\"\n", info_out->prop.tp.winding);1002INFO(" \"domain\":\"%d\"\n", info_out->prop.tp.domain);1003INFO(" \"outputPrim\":\"%d\"\n", info_out->prop.tp.outputPrim);1004break;1005case PIPE_SHADER_GEOMETRY:1006INFO(" \"gp\":{\n");1007INFO(" \"outputPrim\":\"%d\"\n", info_out->prop.gp.outputPrim);1008INFO(" \"instancesCount\":\"%d\"\n", info_out->prop.gp.instanceCount);1009INFO(" \"maxVertices\":\"%d\"\n", info_out->prop.gp.maxVertices);1010break;1011case PIPE_SHADER_FRAGMENT:1012INFO(" \"fp\":{\n");1013INFO(" \"numColourResults\":\"%d\"\n", info_out->prop.fp.numColourResults);1014INFO(" \"writesDepth\":\"%s\"\n", info_out->prop.fp.writesDepth ? "true" : "false");1015INFO(" \"earlyFragTests\":\"%s\"\n", info_out->prop.fp.earlyFragTests ? "true" : "false");1016INFO(" \"postDepthCoverage\":\"%s\"\n", info_out->prop.fp.postDepthCoverage ? "true" : "false");1017INFO(" \"usesDiscard\":\"%s\"\n", info_out->prop.fp.usesDiscard ? "true" : "false");1018INFO(" \"usesSampleMaskIn\":\"%s\"\n", info_out->prop.fp.usesSampleMaskIn ? "true" : "false");1019INFO(" \"readsFramebuffer\":\"%s\"\n", info_out->prop.fp.readsFramebuffer ? "true" : "false");1020INFO(" \"readsSampleLocations\":\"%s\"\n", info_out->prop.fp.readsSampleLocations ? "true" : "false");1021INFO(" \"separateFragData\":\"%s\"\n", info_out->prop.fp.separateFragData ? "true" : "false");1022break;1023default:1024assert("!unhandled pipe shader type\n");1025}1026INFO(" }\n");1027INFO(" }\n");10281029INFO(" \"io\":{\n");1030INFO(" \"clipDistances\":\"%d\"\n", info_out->io.clipDistances);1031INFO(" \"cullDistances\":\"%d\"\n", info_out->io.cullDistances);1032INFO(" \"genUserClip\":\"%d\"\n", info_out->io.genUserClip);1033INFO(" \"instanceId\":\"%d\"\n", info_out->io.instanceId);1034INFO(" \"vertexId\":\"%d\"\n", info_out->io.vertexId);1035INFO(" \"edgeFlagIn\":\"%d\"\n", info_out->io.edgeFlagIn);1036INFO(" \"edgeFlagOut\":\"%d\"\n", info_out->io.edgeFlagOut);1037INFO(" \"fragDepth\":\"%d\"\n", info_out->io.fragDepth);1038INFO(" \"sampleMask\":\"%d\"\n", info_out->io.sampleMask);1039INFO(" \"globalAccess\":\"%d\"\n", info_out->io.globalAccess);1040INFO(" \"fp64\":\"%s\"\n", info_out->io.fp64 ? "true" : "false");1041INFO(" \"layer_viewport_relative\":\"%s\"\n", info_out->io.layer_viewport_relative ? "true" : "false");1042INFO(" \"}\n");1043INFO(" \"numBarriers\":\"%d\"\n", info_out->numBarriers);1044INFO(" \"driverPriv\":\"%p\"\n", info_out->driverPriv);10451046INFO("}\n");1047}104810491050