DxilInstructions.h 264 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // DxilInstructions.h //
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. // This file is distributed under the University of Illinois Open Source //
  6. // License. See LICENSE.TXT for details. //
  7. // //
  8. // This file provides a library of instruction helper classes. //
  9. // MUCH WORK YET TO BE DONE - EXPECT THIS WILL CHANGE - GENERATED FILE //
  10. // //
  11. ///////////////////////////////////////////////////////////////////////////////
  12. #pragma once
  13. #include "llvm/IR/Constants.h"
  14. #include "llvm/IR/Instruction.h"
  15. #include "llvm/IR/Instructions.h"
  16. // TODO: add correct include directives
  17. // TODO: add accessors with values
  18. // TODO: add validation support code, including calling into right fn
  19. // TODO: add type hierarchy
  20. namespace hlsl {
  21. /* <py>
  22. import hctdb_instrhelp
  23. </py> */
  24. /* <py::lines('INSTR-HELPER')>hctdb_instrhelp.get_instrhelper()</py>*/
  25. // INSTR-HELPER:BEGIN
  26. /// This instruction returns a value (possibly void), from a function.
  27. struct LlvmInst_Ret {
  28. llvm::Instruction *Instr;
  29. // Construction and identification
  30. LlvmInst_Ret(llvm::Instruction *pInstr) : Instr(pInstr) {}
  31. operator bool() const {
  32. return Instr->getOpcode() == llvm::Instruction::Ret;
  33. }
  34. // Validation support
  35. bool isAllowed() const { return true; }
  36. };
  37. /// This instruction branches (conditional or unconditional)
  38. struct LlvmInst_Br {
  39. llvm::Instruction *Instr;
  40. // Construction and identification
  41. LlvmInst_Br(llvm::Instruction *pInstr) : Instr(pInstr) {}
  42. operator bool() const {
  43. return Instr->getOpcode() == llvm::Instruction::Br;
  44. }
  45. // Validation support
  46. bool isAllowed() const { return true; }
  47. };
  48. /// This instruction performs a multiway switch
  49. struct LlvmInst_Switch {
  50. llvm::Instruction *Instr;
  51. // Construction and identification
  52. LlvmInst_Switch(llvm::Instruction *pInstr) : Instr(pInstr) {}
  53. operator bool() const {
  54. return Instr->getOpcode() == llvm::Instruction::Switch;
  55. }
  56. // Validation support
  57. bool isAllowed() const { return true; }
  58. };
  59. /// This instruction branches indirectly
  60. struct LlvmInst_IndirectBr {
  61. llvm::Instruction *Instr;
  62. // Construction and identification
  63. LlvmInst_IndirectBr(llvm::Instruction *pInstr) : Instr(pInstr) {}
  64. operator bool() const {
  65. return Instr->getOpcode() == llvm::Instruction::IndirectBr;
  66. }
  67. // Validation support
  68. bool isAllowed() const { return false; }
  69. };
  70. /// This instruction invokes function with normal and exceptional returns
  71. struct LlvmInst_Invoke {
  72. llvm::Instruction *Instr;
  73. // Construction and identification
  74. LlvmInst_Invoke(llvm::Instruction *pInstr) : Instr(pInstr) {}
  75. operator bool() const {
  76. return Instr->getOpcode() == llvm::Instruction::Invoke;
  77. }
  78. // Validation support
  79. bool isAllowed() const { return false; }
  80. };
  81. /// This instruction resumes the propagation of an exception
  82. struct LlvmInst_Resume {
  83. llvm::Instruction *Instr;
  84. // Construction and identification
  85. LlvmInst_Resume(llvm::Instruction *pInstr) : Instr(pInstr) {}
  86. operator bool() const {
  87. return Instr->getOpcode() == llvm::Instruction::Resume;
  88. }
  89. // Validation support
  90. bool isAllowed() const { return false; }
  91. };
  92. /// This instruction is unreachable
  93. struct LlvmInst_Unreachable {
  94. llvm::Instruction *Instr;
  95. // Construction and identification
  96. LlvmInst_Unreachable(llvm::Instruction *pInstr) : Instr(pInstr) {}
  97. operator bool() const {
  98. return Instr->getOpcode() == llvm::Instruction::Unreachable;
  99. }
  100. // Validation support
  101. bool isAllowed() const { return false; }
  102. };
  103. /// This instruction returns the sum of its two operands
  104. struct LlvmInst_Add {
  105. llvm::Instruction *Instr;
  106. // Construction and identification
  107. LlvmInst_Add(llvm::Instruction *pInstr) : Instr(pInstr) {}
  108. operator bool() const {
  109. return Instr->getOpcode() == llvm::Instruction::Add;
  110. }
  111. // Validation support
  112. bool isAllowed() const { return true; }
  113. };
  114. /// This instruction returns the sum of its two operands
  115. struct LlvmInst_FAdd {
  116. llvm::Instruction *Instr;
  117. // Construction and identification
  118. LlvmInst_FAdd(llvm::Instruction *pInstr) : Instr(pInstr) {}
  119. operator bool() const {
  120. return Instr->getOpcode() == llvm::Instruction::FAdd;
  121. }
  122. // Validation support
  123. bool isAllowed() const { return true; }
  124. };
  125. /// This instruction returns the difference of its two operands
  126. struct LlvmInst_Sub {
  127. llvm::Instruction *Instr;
  128. // Construction and identification
  129. LlvmInst_Sub(llvm::Instruction *pInstr) : Instr(pInstr) {}
  130. operator bool() const {
  131. return Instr->getOpcode() == llvm::Instruction::Sub;
  132. }
  133. // Validation support
  134. bool isAllowed() const { return true; }
  135. };
  136. /// This instruction returns the difference of its two operands
  137. struct LlvmInst_FSub {
  138. llvm::Instruction *Instr;
  139. // Construction and identification
  140. LlvmInst_FSub(llvm::Instruction *pInstr) : Instr(pInstr) {}
  141. operator bool() const {
  142. return Instr->getOpcode() == llvm::Instruction::FSub;
  143. }
  144. // Validation support
  145. bool isAllowed() const { return true; }
  146. };
  147. /// This instruction returns the product of its two operands
  148. struct LlvmInst_Mul {
  149. llvm::Instruction *Instr;
  150. // Construction and identification
  151. LlvmInst_Mul(llvm::Instruction *pInstr) : Instr(pInstr) {}
  152. operator bool() const {
  153. return Instr->getOpcode() == llvm::Instruction::Mul;
  154. }
  155. // Validation support
  156. bool isAllowed() const { return true; }
  157. };
  158. /// This instruction returns the product of its two operands
  159. struct LlvmInst_FMul {
  160. llvm::Instruction *Instr;
  161. // Construction and identification
  162. LlvmInst_FMul(llvm::Instruction *pInstr) : Instr(pInstr) {}
  163. operator bool() const {
  164. return Instr->getOpcode() == llvm::Instruction::FMul;
  165. }
  166. // Validation support
  167. bool isAllowed() const { return true; }
  168. };
  169. /// This instruction returns the quotient of its two unsigned operands
  170. struct LlvmInst_UDiv {
  171. llvm::Instruction *Instr;
  172. // Construction and identification
  173. LlvmInst_UDiv(llvm::Instruction *pInstr) : Instr(pInstr) {}
  174. operator bool() const {
  175. return Instr->getOpcode() == llvm::Instruction::UDiv;
  176. }
  177. // Validation support
  178. bool isAllowed() const { return true; }
  179. };
  180. /// This instruction returns the quotient of its two signed operands
  181. struct LlvmInst_SDiv {
  182. llvm::Instruction *Instr;
  183. // Construction and identification
  184. LlvmInst_SDiv(llvm::Instruction *pInstr) : Instr(pInstr) {}
  185. operator bool() const {
  186. return Instr->getOpcode() == llvm::Instruction::SDiv;
  187. }
  188. // Validation support
  189. bool isAllowed() const { return true; }
  190. };
  191. /// This instruction returns the quotient of its two operands
  192. struct LlvmInst_FDiv {
  193. llvm::Instruction *Instr;
  194. // Construction and identification
  195. LlvmInst_FDiv(llvm::Instruction *pInstr) : Instr(pInstr) {}
  196. operator bool() const {
  197. return Instr->getOpcode() == llvm::Instruction::FDiv;
  198. }
  199. // Validation support
  200. bool isAllowed() const { return true; }
  201. };
  202. /// This instruction returns the remainder from the unsigned division of its two operands
  203. struct LlvmInst_URem {
  204. llvm::Instruction *Instr;
  205. // Construction and identification
  206. LlvmInst_URem(llvm::Instruction *pInstr) : Instr(pInstr) {}
  207. operator bool() const {
  208. return Instr->getOpcode() == llvm::Instruction::URem;
  209. }
  210. // Validation support
  211. bool isAllowed() const { return true; }
  212. };
  213. /// This instruction returns the remainder from the signed division of its two operands
  214. struct LlvmInst_SRem {
  215. llvm::Instruction *Instr;
  216. // Construction and identification
  217. LlvmInst_SRem(llvm::Instruction *pInstr) : Instr(pInstr) {}
  218. operator bool() const {
  219. return Instr->getOpcode() == llvm::Instruction::SRem;
  220. }
  221. // Validation support
  222. bool isAllowed() const { return true; }
  223. };
  224. /// This instruction returns the remainder from the division of its two operands
  225. struct LlvmInst_FRem {
  226. llvm::Instruction *Instr;
  227. // Construction and identification
  228. LlvmInst_FRem(llvm::Instruction *pInstr) : Instr(pInstr) {}
  229. operator bool() const {
  230. return Instr->getOpcode() == llvm::Instruction::FRem;
  231. }
  232. // Validation support
  233. bool isAllowed() const { return true; }
  234. };
  235. /// This instruction shifts left (logical)
  236. struct LlvmInst_Shl {
  237. llvm::Instruction *Instr;
  238. // Construction and identification
  239. LlvmInst_Shl(llvm::Instruction *pInstr) : Instr(pInstr) {}
  240. operator bool() const {
  241. return Instr->getOpcode() == llvm::Instruction::Shl;
  242. }
  243. // Validation support
  244. bool isAllowed() const { return true; }
  245. };
  246. /// This instruction shifts right (logical), with zero bit fill
  247. struct LlvmInst_LShr {
  248. llvm::Instruction *Instr;
  249. // Construction and identification
  250. LlvmInst_LShr(llvm::Instruction *pInstr) : Instr(pInstr) {}
  251. operator bool() const {
  252. return Instr->getOpcode() == llvm::Instruction::LShr;
  253. }
  254. // Validation support
  255. bool isAllowed() const { return true; }
  256. };
  257. /// This instruction shifts right (arithmetic), with 'a' operand sign bit fill
  258. struct LlvmInst_AShr {
  259. llvm::Instruction *Instr;
  260. // Construction and identification
  261. LlvmInst_AShr(llvm::Instruction *pInstr) : Instr(pInstr) {}
  262. operator bool() const {
  263. return Instr->getOpcode() == llvm::Instruction::AShr;
  264. }
  265. // Validation support
  266. bool isAllowed() const { return true; }
  267. };
  268. /// This instruction returns a bitwise logical and of its two operands
  269. struct LlvmInst_And {
  270. llvm::Instruction *Instr;
  271. // Construction and identification
  272. LlvmInst_And(llvm::Instruction *pInstr) : Instr(pInstr) {}
  273. operator bool() const {
  274. return Instr->getOpcode() == llvm::Instruction::And;
  275. }
  276. // Validation support
  277. bool isAllowed() const { return true; }
  278. };
  279. /// This instruction returns a bitwise logical or of its two operands
  280. struct LlvmInst_Or {
  281. llvm::Instruction *Instr;
  282. // Construction and identification
  283. LlvmInst_Or(llvm::Instruction *pInstr) : Instr(pInstr) {}
  284. operator bool() const {
  285. return Instr->getOpcode() == llvm::Instruction::Or;
  286. }
  287. // Validation support
  288. bool isAllowed() const { return true; }
  289. };
  290. /// This instruction returns a bitwise logical xor of its two operands
  291. struct LlvmInst_Xor {
  292. llvm::Instruction *Instr;
  293. // Construction and identification
  294. LlvmInst_Xor(llvm::Instruction *pInstr) : Instr(pInstr) {}
  295. operator bool() const {
  296. return Instr->getOpcode() == llvm::Instruction::Xor;
  297. }
  298. // Validation support
  299. bool isAllowed() const { return true; }
  300. };
  301. /// This instruction allocates memory on the stack frame of the currently executing function
  302. struct LlvmInst_Alloca {
  303. llvm::Instruction *Instr;
  304. // Construction and identification
  305. LlvmInst_Alloca(llvm::Instruction *pInstr) : Instr(pInstr) {}
  306. operator bool() const {
  307. return Instr->getOpcode() == llvm::Instruction::Alloca;
  308. }
  309. // Validation support
  310. bool isAllowed() const { return true; }
  311. };
  312. /// This instruction reads from memory
  313. struct LlvmInst_Load {
  314. llvm::Instruction *Instr;
  315. // Construction and identification
  316. LlvmInst_Load(llvm::Instruction *pInstr) : Instr(pInstr) {}
  317. operator bool() const {
  318. return Instr->getOpcode() == llvm::Instruction::Load;
  319. }
  320. // Validation support
  321. bool isAllowed() const { return true; }
  322. };
  323. /// This instruction writes to memory
  324. struct LlvmInst_Store {
  325. llvm::Instruction *Instr;
  326. // Construction and identification
  327. LlvmInst_Store(llvm::Instruction *pInstr) : Instr(pInstr) {}
  328. operator bool() const {
  329. return Instr->getOpcode() == llvm::Instruction::Store;
  330. }
  331. // Validation support
  332. bool isAllowed() const { return true; }
  333. };
  334. /// This instruction gets the address of a subelement of an aggregate value
  335. struct LlvmInst_GetElementPtr {
  336. llvm::Instruction *Instr;
  337. // Construction and identification
  338. LlvmInst_GetElementPtr(llvm::Instruction *pInstr) : Instr(pInstr) {}
  339. operator bool() const {
  340. return Instr->getOpcode() == llvm::Instruction::GetElementPtr;
  341. }
  342. // Validation support
  343. bool isAllowed() const { return true; }
  344. };
  345. /// This instruction introduces happens-before edges between operations
  346. struct LlvmInst_Fence {
  347. llvm::Instruction *Instr;
  348. // Construction and identification
  349. LlvmInst_Fence(llvm::Instruction *pInstr) : Instr(pInstr) {}
  350. operator bool() const {
  351. return Instr->getOpcode() == llvm::Instruction::Fence;
  352. }
  353. // Validation support
  354. bool isAllowed() const { return false; }
  355. };
  356. /// This instruction atomically modifies memory
  357. struct LlvmInst_AtomicCmpXchg {
  358. llvm::Instruction *Instr;
  359. // Construction and identification
  360. LlvmInst_AtomicCmpXchg(llvm::Instruction *pInstr) : Instr(pInstr) {}
  361. operator bool() const {
  362. return Instr->getOpcode() == llvm::Instruction::AtomicCmpXchg;
  363. }
  364. // Validation support
  365. bool isAllowed() const { return true; }
  366. };
  367. /// This instruction atomically modifies memory
  368. struct LlvmInst_AtomicRMW {
  369. llvm::Instruction *Instr;
  370. // Construction and identification
  371. LlvmInst_AtomicRMW(llvm::Instruction *pInstr) : Instr(pInstr) {}
  372. operator bool() const {
  373. return Instr->getOpcode() == llvm::Instruction::AtomicRMW;
  374. }
  375. // Validation support
  376. bool isAllowed() const { return true; }
  377. };
  378. /// This instruction truncates an integer
  379. struct LlvmInst_Trunc {
  380. llvm::Instruction *Instr;
  381. // Construction and identification
  382. LlvmInst_Trunc(llvm::Instruction *pInstr) : Instr(pInstr) {}
  383. operator bool() const {
  384. return Instr->getOpcode() == llvm::Instruction::Trunc;
  385. }
  386. // Validation support
  387. bool isAllowed() const { return true; }
  388. };
  389. /// This instruction zero extends an integer
  390. struct LlvmInst_ZExt {
  391. llvm::Instruction *Instr;
  392. // Construction and identification
  393. LlvmInst_ZExt(llvm::Instruction *pInstr) : Instr(pInstr) {}
  394. operator bool() const {
  395. return Instr->getOpcode() == llvm::Instruction::ZExt;
  396. }
  397. // Validation support
  398. bool isAllowed() const { return true; }
  399. };
  400. /// This instruction sign extends an integer
  401. struct LlvmInst_SExt {
  402. llvm::Instruction *Instr;
  403. // Construction and identification
  404. LlvmInst_SExt(llvm::Instruction *pInstr) : Instr(pInstr) {}
  405. operator bool() const {
  406. return Instr->getOpcode() == llvm::Instruction::SExt;
  407. }
  408. // Validation support
  409. bool isAllowed() const { return true; }
  410. };
  411. /// This instruction converts a floating point to UInt
  412. struct LlvmInst_FPToUI {
  413. llvm::Instruction *Instr;
  414. // Construction and identification
  415. LlvmInst_FPToUI(llvm::Instruction *pInstr) : Instr(pInstr) {}
  416. operator bool() const {
  417. return Instr->getOpcode() == llvm::Instruction::FPToUI;
  418. }
  419. // Validation support
  420. bool isAllowed() const { return true; }
  421. };
  422. /// This instruction converts a floating point to SInt
  423. struct LlvmInst_FPToSI {
  424. llvm::Instruction *Instr;
  425. // Construction and identification
  426. LlvmInst_FPToSI(llvm::Instruction *pInstr) : Instr(pInstr) {}
  427. operator bool() const {
  428. return Instr->getOpcode() == llvm::Instruction::FPToSI;
  429. }
  430. // Validation support
  431. bool isAllowed() const { return true; }
  432. };
  433. /// This instruction converts a UInt to floating point
  434. struct LlvmInst_UIToFP {
  435. llvm::Instruction *Instr;
  436. // Construction and identification
  437. LlvmInst_UIToFP(llvm::Instruction *pInstr) : Instr(pInstr) {}
  438. operator bool() const {
  439. return Instr->getOpcode() == llvm::Instruction::UIToFP;
  440. }
  441. // Validation support
  442. bool isAllowed() const { return true; }
  443. };
  444. /// This instruction converts a SInt to floating point
  445. struct LlvmInst_SIToFP {
  446. llvm::Instruction *Instr;
  447. // Construction and identification
  448. LlvmInst_SIToFP(llvm::Instruction *pInstr) : Instr(pInstr) {}
  449. operator bool() const {
  450. return Instr->getOpcode() == llvm::Instruction::SIToFP;
  451. }
  452. // Validation support
  453. bool isAllowed() const { return true; }
  454. };
  455. /// This instruction truncates a floating point
  456. struct LlvmInst_FPTrunc {
  457. llvm::Instruction *Instr;
  458. // Construction and identification
  459. LlvmInst_FPTrunc(llvm::Instruction *pInstr) : Instr(pInstr) {}
  460. operator bool() const {
  461. return Instr->getOpcode() == llvm::Instruction::FPTrunc;
  462. }
  463. // Validation support
  464. bool isAllowed() const { return true; }
  465. };
  466. /// This instruction extends a floating point
  467. struct LlvmInst_FPExt {
  468. llvm::Instruction *Instr;
  469. // Construction and identification
  470. LlvmInst_FPExt(llvm::Instruction *pInstr) : Instr(pInstr) {}
  471. operator bool() const {
  472. return Instr->getOpcode() == llvm::Instruction::FPExt;
  473. }
  474. // Validation support
  475. bool isAllowed() const { return true; }
  476. };
  477. /// This instruction converts a pointer to integer
  478. struct LlvmInst_PtrToInt {
  479. llvm::Instruction *Instr;
  480. // Construction and identification
  481. LlvmInst_PtrToInt(llvm::Instruction *pInstr) : Instr(pInstr) {}
  482. operator bool() const {
  483. return Instr->getOpcode() == llvm::Instruction::PtrToInt;
  484. }
  485. // Validation support
  486. bool isAllowed() const { return false; }
  487. };
  488. /// This instruction converts an integer to Pointer
  489. struct LlvmInst_IntToPtr {
  490. llvm::Instruction *Instr;
  491. // Construction and identification
  492. LlvmInst_IntToPtr(llvm::Instruction *pInstr) : Instr(pInstr) {}
  493. operator bool() const {
  494. return Instr->getOpcode() == llvm::Instruction::IntToPtr;
  495. }
  496. // Validation support
  497. bool isAllowed() const { return false; }
  498. };
  499. /// This instruction performs a bit-preserving type cast
  500. struct LlvmInst_BitCast {
  501. llvm::Instruction *Instr;
  502. // Construction and identification
  503. LlvmInst_BitCast(llvm::Instruction *pInstr) : Instr(pInstr) {}
  504. operator bool() const {
  505. return Instr->getOpcode() == llvm::Instruction::BitCast;
  506. }
  507. // Validation support
  508. bool isAllowed() const { return true; }
  509. };
  510. /// This instruction casts a value addrspace
  511. struct LlvmInst_AddrSpaceCast {
  512. llvm::Instruction *Instr;
  513. // Construction and identification
  514. LlvmInst_AddrSpaceCast(llvm::Instruction *pInstr) : Instr(pInstr) {}
  515. operator bool() const {
  516. return Instr->getOpcode() == llvm::Instruction::AddrSpaceCast;
  517. }
  518. // Validation support
  519. bool isAllowed() const { return true; }
  520. };
  521. /// This instruction compares integers
  522. struct LlvmInst_ICmp {
  523. llvm::Instruction *Instr;
  524. // Construction and identification
  525. LlvmInst_ICmp(llvm::Instruction *pInstr) : Instr(pInstr) {}
  526. operator bool() const {
  527. return Instr->getOpcode() == llvm::Instruction::ICmp;
  528. }
  529. // Validation support
  530. bool isAllowed() const { return true; }
  531. };
  532. /// This instruction compares floating points
  533. struct LlvmInst_FCmp {
  534. llvm::Instruction *Instr;
  535. // Construction and identification
  536. LlvmInst_FCmp(llvm::Instruction *pInstr) : Instr(pInstr) {}
  537. operator bool() const {
  538. return Instr->getOpcode() == llvm::Instruction::FCmp;
  539. }
  540. // Validation support
  541. bool isAllowed() const { return true; }
  542. };
  543. /// This instruction is a PHI node instruction
  544. struct LlvmInst_PHI {
  545. llvm::Instruction *Instr;
  546. // Construction and identification
  547. LlvmInst_PHI(llvm::Instruction *pInstr) : Instr(pInstr) {}
  548. operator bool() const {
  549. return Instr->getOpcode() == llvm::Instruction::PHI;
  550. }
  551. // Validation support
  552. bool isAllowed() const { return true; }
  553. };
  554. /// This instruction calls a function
  555. struct LlvmInst_Call {
  556. llvm::Instruction *Instr;
  557. // Construction and identification
  558. LlvmInst_Call(llvm::Instruction *pInstr) : Instr(pInstr) {}
  559. operator bool() const {
  560. return Instr->getOpcode() == llvm::Instruction::Call;
  561. }
  562. // Validation support
  563. bool isAllowed() const { return true; }
  564. };
  565. /// This instruction selects an instruction
  566. struct LlvmInst_Select {
  567. llvm::Instruction *Instr;
  568. // Construction and identification
  569. LlvmInst_Select(llvm::Instruction *pInstr) : Instr(pInstr) {}
  570. operator bool() const {
  571. return Instr->getOpcode() == llvm::Instruction::Select;
  572. }
  573. // Validation support
  574. bool isAllowed() const { return true; }
  575. };
  576. /// This instruction may be used internally in a pass
  577. struct LlvmInst_UserOp1 {
  578. llvm::Instruction *Instr;
  579. // Construction and identification
  580. LlvmInst_UserOp1(llvm::Instruction *pInstr) : Instr(pInstr) {}
  581. operator bool() const {
  582. return Instr->getOpcode() == llvm::Instruction::UserOp1;
  583. }
  584. // Validation support
  585. bool isAllowed() const { return false; }
  586. };
  587. /// This instruction internal to passes only
  588. struct LlvmInst_UserOp2 {
  589. llvm::Instruction *Instr;
  590. // Construction and identification
  591. LlvmInst_UserOp2(llvm::Instruction *pInstr) : Instr(pInstr) {}
  592. operator bool() const {
  593. return Instr->getOpcode() == llvm::Instruction::UserOp2;
  594. }
  595. // Validation support
  596. bool isAllowed() const { return false; }
  597. };
  598. /// This instruction vaarg instruction
  599. struct LlvmInst_VAArg {
  600. llvm::Instruction *Instr;
  601. // Construction and identification
  602. LlvmInst_VAArg(llvm::Instruction *pInstr) : Instr(pInstr) {}
  603. operator bool() const {
  604. return Instr->getOpcode() == llvm::Instruction::VAArg;
  605. }
  606. // Validation support
  607. bool isAllowed() const { return false; }
  608. };
  609. /// This instruction extracts from aggregate
  610. struct LlvmInst_ExtractValue {
  611. llvm::Instruction *Instr;
  612. // Construction and identification
  613. LlvmInst_ExtractValue(llvm::Instruction *pInstr) : Instr(pInstr) {}
  614. operator bool() const {
  615. return Instr->getOpcode() == llvm::Instruction::ExtractValue;
  616. }
  617. // Validation support
  618. bool isAllowed() const { return true; }
  619. };
  620. /// This instruction represents a landing pad
  621. struct LlvmInst_LandingPad {
  622. llvm::Instruction *Instr;
  623. // Construction and identification
  624. LlvmInst_LandingPad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  625. operator bool() const {
  626. return Instr->getOpcode() == llvm::Instruction::LandingPad;
  627. }
  628. // Validation support
  629. bool isAllowed() const { return false; }
  630. };
  631. /// This instruction Helper load operation
  632. struct DxilInst_TempRegLoad {
  633. llvm::Instruction *Instr;
  634. // Construction and identification
  635. DxilInst_TempRegLoad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  636. operator bool() const {
  637. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::TempRegLoad);
  638. }
  639. // Validation support
  640. bool isAllowed() const { return true; }
  641. bool isArgumentListValid() const {
  642. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  643. return true;
  644. }
  645. // Metadata
  646. bool requiresUniformInputs() const { return false; }
  647. // Operand indexes
  648. enum OperandIdx {
  649. arg_index = 1,
  650. };
  651. // Accessors
  652. llvm::Value *get_index() const { return Instr->getOperand(1); }
  653. void set_index(llvm::Value *val) { Instr->setOperand(1, val); }
  654. };
  655. /// This instruction Helper store operation
  656. struct DxilInst_TempRegStore {
  657. llvm::Instruction *Instr;
  658. // Construction and identification
  659. DxilInst_TempRegStore(llvm::Instruction *pInstr) : Instr(pInstr) {}
  660. operator bool() const {
  661. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::TempRegStore);
  662. }
  663. // Validation support
  664. bool isAllowed() const { return true; }
  665. bool isArgumentListValid() const {
  666. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  667. return true;
  668. }
  669. // Metadata
  670. bool requiresUniformInputs() const { return false; }
  671. // Operand indexes
  672. enum OperandIdx {
  673. arg_index = 1,
  674. arg_value = 2,
  675. };
  676. // Accessors
  677. llvm::Value *get_index() const { return Instr->getOperand(1); }
  678. void set_index(llvm::Value *val) { Instr->setOperand(1, val); }
  679. llvm::Value *get_value() const { return Instr->getOperand(2); }
  680. void set_value(llvm::Value *val) { Instr->setOperand(2, val); }
  681. };
  682. /// This instruction Helper load operation for minprecision
  683. struct DxilInst_MinPrecXRegLoad {
  684. llvm::Instruction *Instr;
  685. // Construction and identification
  686. DxilInst_MinPrecXRegLoad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  687. operator bool() const {
  688. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::MinPrecXRegLoad);
  689. }
  690. // Validation support
  691. bool isAllowed() const { return true; }
  692. bool isArgumentListValid() const {
  693. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  694. return true;
  695. }
  696. // Metadata
  697. bool requiresUniformInputs() const { return false; }
  698. // Operand indexes
  699. enum OperandIdx {
  700. arg_regIndex = 1,
  701. arg_index = 2,
  702. arg_component = 3,
  703. };
  704. // Accessors
  705. llvm::Value *get_regIndex() const { return Instr->getOperand(1); }
  706. void set_regIndex(llvm::Value *val) { Instr->setOperand(1, val); }
  707. llvm::Value *get_index() const { return Instr->getOperand(2); }
  708. void set_index(llvm::Value *val) { Instr->setOperand(2, val); }
  709. llvm::Value *get_component() const { return Instr->getOperand(3); }
  710. void set_component(llvm::Value *val) { Instr->setOperand(3, val); }
  711. };
  712. /// This instruction Helper store operation for minprecision
  713. struct DxilInst_MinPrecXRegStore {
  714. llvm::Instruction *Instr;
  715. // Construction and identification
  716. DxilInst_MinPrecXRegStore(llvm::Instruction *pInstr) : Instr(pInstr) {}
  717. operator bool() const {
  718. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::MinPrecXRegStore);
  719. }
  720. // Validation support
  721. bool isAllowed() const { return true; }
  722. bool isArgumentListValid() const {
  723. if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  724. return true;
  725. }
  726. // Metadata
  727. bool requiresUniformInputs() const { return false; }
  728. // Operand indexes
  729. enum OperandIdx {
  730. arg_regIndex = 1,
  731. arg_index = 2,
  732. arg_component = 3,
  733. arg_value = 4,
  734. };
  735. // Accessors
  736. llvm::Value *get_regIndex() const { return Instr->getOperand(1); }
  737. void set_regIndex(llvm::Value *val) { Instr->setOperand(1, val); }
  738. llvm::Value *get_index() const { return Instr->getOperand(2); }
  739. void set_index(llvm::Value *val) { Instr->setOperand(2, val); }
  740. llvm::Value *get_component() const { return Instr->getOperand(3); }
  741. void set_component(llvm::Value *val) { Instr->setOperand(3, val); }
  742. llvm::Value *get_value() const { return Instr->getOperand(4); }
  743. void set_value(llvm::Value *val) { Instr->setOperand(4, val); }
  744. };
  745. /// This instruction Loads the value from shader input
  746. struct DxilInst_LoadInput {
  747. llvm::Instruction *Instr;
  748. // Construction and identification
  749. DxilInst_LoadInput(llvm::Instruction *pInstr) : Instr(pInstr) {}
  750. operator bool() const {
  751. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::LoadInput);
  752. }
  753. // Validation support
  754. bool isAllowed() const { return true; }
  755. bool isArgumentListValid() const {
  756. if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  757. return true;
  758. }
  759. // Metadata
  760. bool requiresUniformInputs() const { return false; }
  761. // Operand indexes
  762. enum OperandIdx {
  763. arg_inputSigId = 1,
  764. arg_rowIndex = 2,
  765. arg_colIndex = 3,
  766. arg_gsVertexAxis = 4,
  767. };
  768. // Accessors
  769. llvm::Value *get_inputSigId() const { return Instr->getOperand(1); }
  770. void set_inputSigId(llvm::Value *val) { Instr->setOperand(1, val); }
  771. llvm::Value *get_rowIndex() const { return Instr->getOperand(2); }
  772. void set_rowIndex(llvm::Value *val) { Instr->setOperand(2, val); }
  773. llvm::Value *get_colIndex() const { return Instr->getOperand(3); }
  774. void set_colIndex(llvm::Value *val) { Instr->setOperand(3, val); }
  775. llvm::Value *get_gsVertexAxis() const { return Instr->getOperand(4); }
  776. void set_gsVertexAxis(llvm::Value *val) { Instr->setOperand(4, val); }
  777. };
  778. /// This instruction Stores the value to shader output
  779. struct DxilInst_StoreOutput {
  780. llvm::Instruction *Instr;
  781. // Construction and identification
  782. DxilInst_StoreOutput(llvm::Instruction *pInstr) : Instr(pInstr) {}
  783. operator bool() const {
  784. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::StoreOutput);
  785. }
  786. // Validation support
  787. bool isAllowed() const { return true; }
  788. bool isArgumentListValid() const {
  789. if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  790. return true;
  791. }
  792. // Metadata
  793. bool requiresUniformInputs() const { return false; }
  794. // Operand indexes
  795. enum OperandIdx {
  796. arg_outputSigId = 1,
  797. arg_rowIndex = 2,
  798. arg_colIndex = 3,
  799. arg_value = 4,
  800. };
  801. // Accessors
  802. llvm::Value *get_outputSigId() const { return Instr->getOperand(1); }
  803. void set_outputSigId(llvm::Value *val) { Instr->setOperand(1, val); }
  804. llvm::Value *get_rowIndex() const { return Instr->getOperand(2); }
  805. void set_rowIndex(llvm::Value *val) { Instr->setOperand(2, val); }
  806. llvm::Value *get_colIndex() const { return Instr->getOperand(3); }
  807. void set_colIndex(llvm::Value *val) { Instr->setOperand(3, val); }
  808. llvm::Value *get_value() const { return Instr->getOperand(4); }
  809. void set_value(llvm::Value *val) { Instr->setOperand(4, val); }
  810. };
  811. /// This instruction returns the absolute value of the input value.
  812. struct DxilInst_FAbs {
  813. llvm::Instruction *Instr;
  814. // Construction and identification
  815. DxilInst_FAbs(llvm::Instruction *pInstr) : Instr(pInstr) {}
  816. operator bool() const {
  817. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::FAbs);
  818. }
  819. // Validation support
  820. bool isAllowed() const { return true; }
  821. bool isArgumentListValid() const {
  822. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  823. return true;
  824. }
  825. // Metadata
  826. bool requiresUniformInputs() const { return false; }
  827. // Operand indexes
  828. enum OperandIdx {
  829. arg_value = 1,
  830. };
  831. // Accessors
  832. llvm::Value *get_value() const { return Instr->getOperand(1); }
  833. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  834. };
  835. /// This instruction clamps the result of a single or double precision floating point value to [0.0f...1.0f]
  836. struct DxilInst_Saturate {
  837. llvm::Instruction *Instr;
  838. // Construction and identification
  839. DxilInst_Saturate(llvm::Instruction *pInstr) : Instr(pInstr) {}
  840. operator bool() const {
  841. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Saturate);
  842. }
  843. // Validation support
  844. bool isAllowed() const { return true; }
  845. bool isArgumentListValid() const {
  846. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  847. return true;
  848. }
  849. // Metadata
  850. bool requiresUniformInputs() const { return false; }
  851. // Operand indexes
  852. enum OperandIdx {
  853. arg_value = 1,
  854. };
  855. // Accessors
  856. llvm::Value *get_value() const { return Instr->getOperand(1); }
  857. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  858. };
  859. /// This instruction Returns true if x is NAN or QNAN, false otherwise.
  860. struct DxilInst_IsNaN {
  861. llvm::Instruction *Instr;
  862. // Construction and identification
  863. DxilInst_IsNaN(llvm::Instruction *pInstr) : Instr(pInstr) {}
  864. operator bool() const {
  865. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::IsNaN);
  866. }
  867. // Validation support
  868. bool isAllowed() const { return true; }
  869. bool isArgumentListValid() const {
  870. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  871. return true;
  872. }
  873. // Metadata
  874. bool requiresUniformInputs() const { return false; }
  875. // Operand indexes
  876. enum OperandIdx {
  877. arg_value = 1,
  878. };
  879. // Accessors
  880. llvm::Value *get_value() const { return Instr->getOperand(1); }
  881. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  882. };
  883. /// This instruction Returns true if x is +INF or -INF, false otherwise.
  884. struct DxilInst_IsInf {
  885. llvm::Instruction *Instr;
  886. // Construction and identification
  887. DxilInst_IsInf(llvm::Instruction *pInstr) : Instr(pInstr) {}
  888. operator bool() const {
  889. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::IsInf);
  890. }
  891. // Validation support
  892. bool isAllowed() const { return true; }
  893. bool isArgumentListValid() const {
  894. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  895. return true;
  896. }
  897. // Metadata
  898. bool requiresUniformInputs() const { return false; }
  899. // Operand indexes
  900. enum OperandIdx {
  901. arg_value = 1,
  902. };
  903. // Accessors
  904. llvm::Value *get_value() const { return Instr->getOperand(1); }
  905. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  906. };
  907. /// This instruction Returns true if x is finite, false otherwise.
  908. struct DxilInst_IsFinite {
  909. llvm::Instruction *Instr;
  910. // Construction and identification
  911. DxilInst_IsFinite(llvm::Instruction *pInstr) : Instr(pInstr) {}
  912. operator bool() const {
  913. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::IsFinite);
  914. }
  915. // Validation support
  916. bool isAllowed() const { return true; }
  917. bool isArgumentListValid() const {
  918. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  919. return true;
  920. }
  921. // Metadata
  922. bool requiresUniformInputs() const { return false; }
  923. // Operand indexes
  924. enum OperandIdx {
  925. arg_value = 1,
  926. };
  927. // Accessors
  928. llvm::Value *get_value() const { return Instr->getOperand(1); }
  929. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  930. };
  931. /// This instruction returns IsNormal
  932. struct DxilInst_IsNormal {
  933. llvm::Instruction *Instr;
  934. // Construction and identification
  935. DxilInst_IsNormal(llvm::Instruction *pInstr) : Instr(pInstr) {}
  936. operator bool() const {
  937. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::IsNormal);
  938. }
  939. // Validation support
  940. bool isAllowed() const { return true; }
  941. bool isArgumentListValid() const {
  942. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  943. return true;
  944. }
  945. // Metadata
  946. bool requiresUniformInputs() const { return false; }
  947. // Operand indexes
  948. enum OperandIdx {
  949. arg_value = 1,
  950. };
  951. // Accessors
  952. llvm::Value *get_value() const { return Instr->getOperand(1); }
  953. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  954. };
  955. /// This instruction returns cosine(theta) for theta in radians.
  956. struct DxilInst_Cos {
  957. llvm::Instruction *Instr;
  958. // Construction and identification
  959. DxilInst_Cos(llvm::Instruction *pInstr) : Instr(pInstr) {}
  960. operator bool() const {
  961. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Cos);
  962. }
  963. // Validation support
  964. bool isAllowed() const { return true; }
  965. bool isArgumentListValid() const {
  966. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  967. return true;
  968. }
  969. // Metadata
  970. bool requiresUniformInputs() const { return false; }
  971. // Operand indexes
  972. enum OperandIdx {
  973. arg_value = 1,
  974. };
  975. // Accessors
  976. llvm::Value *get_value() const { return Instr->getOperand(1); }
  977. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  978. };
  979. /// This instruction returns sine(theta) for theta in radians.
  980. struct DxilInst_Sin {
  981. llvm::Instruction *Instr;
  982. // Construction and identification
  983. DxilInst_Sin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  984. operator bool() const {
  985. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Sin);
  986. }
  987. // Validation support
  988. bool isAllowed() const { return true; }
  989. bool isArgumentListValid() const {
  990. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  991. return true;
  992. }
  993. // Metadata
  994. bool requiresUniformInputs() const { return false; }
  995. // Operand indexes
  996. enum OperandIdx {
  997. arg_value = 1,
  998. };
  999. // Accessors
  1000. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1001. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1002. };
  1003. /// This instruction returns tan(theta) for theta in radians.
  1004. struct DxilInst_Tan {
  1005. llvm::Instruction *Instr;
  1006. // Construction and identification
  1007. DxilInst_Tan(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1008. operator bool() const {
  1009. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Tan);
  1010. }
  1011. // Validation support
  1012. bool isAllowed() const { return true; }
  1013. bool isArgumentListValid() const {
  1014. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1015. return true;
  1016. }
  1017. // Metadata
  1018. bool requiresUniformInputs() const { return false; }
  1019. // Operand indexes
  1020. enum OperandIdx {
  1021. arg_value = 1,
  1022. };
  1023. // Accessors
  1024. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1025. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1026. };
  1027. /// This instruction Returns the arccosine of the specified value. Input should be a floating-point value within the range of -1 to 1.
  1028. struct DxilInst_Acos {
  1029. llvm::Instruction *Instr;
  1030. // Construction and identification
  1031. DxilInst_Acos(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1032. operator bool() const {
  1033. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Acos);
  1034. }
  1035. // Validation support
  1036. bool isAllowed() const { return true; }
  1037. bool isArgumentListValid() const {
  1038. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1039. return true;
  1040. }
  1041. // Metadata
  1042. bool requiresUniformInputs() const { return false; }
  1043. // Operand indexes
  1044. enum OperandIdx {
  1045. arg_value = 1,
  1046. };
  1047. // Accessors
  1048. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1049. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1050. };
  1051. /// This instruction Returns the arccosine of the specified value. Input should be a floating-point value within the range of -1 to 1
  1052. struct DxilInst_Asin {
  1053. llvm::Instruction *Instr;
  1054. // Construction and identification
  1055. DxilInst_Asin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1056. operator bool() const {
  1057. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Asin);
  1058. }
  1059. // Validation support
  1060. bool isAllowed() const { return true; }
  1061. bool isArgumentListValid() const {
  1062. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1063. return true;
  1064. }
  1065. // Metadata
  1066. bool requiresUniformInputs() const { return false; }
  1067. // Operand indexes
  1068. enum OperandIdx {
  1069. arg_value = 1,
  1070. };
  1071. // Accessors
  1072. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1073. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1074. };
  1075. /// This instruction Returns the arctangent of the specified value. The return value is within the range of -PI/2 to PI/2.
  1076. struct DxilInst_Atan {
  1077. llvm::Instruction *Instr;
  1078. // Construction and identification
  1079. DxilInst_Atan(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1080. operator bool() const {
  1081. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Atan);
  1082. }
  1083. // Validation support
  1084. bool isAllowed() const { return true; }
  1085. bool isArgumentListValid() const {
  1086. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1087. return true;
  1088. }
  1089. // Metadata
  1090. bool requiresUniformInputs() const { return false; }
  1091. // Operand indexes
  1092. enum OperandIdx {
  1093. arg_value = 1,
  1094. };
  1095. // Accessors
  1096. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1097. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1098. };
  1099. /// This instruction returns the hyperbolic cosine of the specified value.
  1100. struct DxilInst_Hcos {
  1101. llvm::Instruction *Instr;
  1102. // Construction and identification
  1103. DxilInst_Hcos(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1104. operator bool() const {
  1105. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Hcos);
  1106. }
  1107. // Validation support
  1108. bool isAllowed() const { return true; }
  1109. bool isArgumentListValid() const {
  1110. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1111. return true;
  1112. }
  1113. // Metadata
  1114. bool requiresUniformInputs() const { return false; }
  1115. // Operand indexes
  1116. enum OperandIdx {
  1117. arg_value = 1,
  1118. };
  1119. // Accessors
  1120. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1121. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1122. };
  1123. /// This instruction returns the hyperbolic sine of the specified value.
  1124. struct DxilInst_Hsin {
  1125. llvm::Instruction *Instr;
  1126. // Construction and identification
  1127. DxilInst_Hsin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1128. operator bool() const {
  1129. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Hsin);
  1130. }
  1131. // Validation support
  1132. bool isAllowed() const { return true; }
  1133. bool isArgumentListValid() const {
  1134. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1135. return true;
  1136. }
  1137. // Metadata
  1138. bool requiresUniformInputs() const { return false; }
  1139. // Operand indexes
  1140. enum OperandIdx {
  1141. arg_value = 1,
  1142. };
  1143. // Accessors
  1144. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1145. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1146. };
  1147. /// This instruction returns the hyperbolic tangent of the specified value.
  1148. struct DxilInst_Htan {
  1149. llvm::Instruction *Instr;
  1150. // Construction and identification
  1151. DxilInst_Htan(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1152. operator bool() const {
  1153. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Htan);
  1154. }
  1155. // Validation support
  1156. bool isAllowed() const { return true; }
  1157. bool isArgumentListValid() const {
  1158. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1159. return true;
  1160. }
  1161. // Metadata
  1162. bool requiresUniformInputs() const { return false; }
  1163. // Operand indexes
  1164. enum OperandIdx {
  1165. arg_value = 1,
  1166. };
  1167. // Accessors
  1168. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1169. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1170. };
  1171. /// This instruction returns 2^exponent
  1172. struct DxilInst_Exp {
  1173. llvm::Instruction *Instr;
  1174. // Construction and identification
  1175. DxilInst_Exp(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1176. operator bool() const {
  1177. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Exp);
  1178. }
  1179. // Validation support
  1180. bool isAllowed() const { return true; }
  1181. bool isArgumentListValid() const {
  1182. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1183. return true;
  1184. }
  1185. // Metadata
  1186. bool requiresUniformInputs() const { return false; }
  1187. // Operand indexes
  1188. enum OperandIdx {
  1189. arg_value = 1,
  1190. };
  1191. // Accessors
  1192. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1193. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1194. };
  1195. /// This instruction extract fracitonal component.
  1196. struct DxilInst_Frc {
  1197. llvm::Instruction *Instr;
  1198. // Construction and identification
  1199. DxilInst_Frc(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1200. operator bool() const {
  1201. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Frc);
  1202. }
  1203. // Validation support
  1204. bool isAllowed() const { return true; }
  1205. bool isArgumentListValid() const {
  1206. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1207. return true;
  1208. }
  1209. // Metadata
  1210. bool requiresUniformInputs() const { return false; }
  1211. // Operand indexes
  1212. enum OperandIdx {
  1213. arg_value = 1,
  1214. };
  1215. // Accessors
  1216. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1217. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1218. };
  1219. /// This instruction returns log base 2.
  1220. struct DxilInst_Log {
  1221. llvm::Instruction *Instr;
  1222. // Construction and identification
  1223. DxilInst_Log(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1224. operator bool() const {
  1225. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Log);
  1226. }
  1227. // Validation support
  1228. bool isAllowed() const { return true; }
  1229. bool isArgumentListValid() const {
  1230. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1231. return true;
  1232. }
  1233. // Metadata
  1234. bool requiresUniformInputs() const { return false; }
  1235. // Operand indexes
  1236. enum OperandIdx {
  1237. arg_value = 1,
  1238. };
  1239. // Accessors
  1240. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1241. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1242. };
  1243. /// This instruction returns square root
  1244. struct DxilInst_Sqrt {
  1245. llvm::Instruction *Instr;
  1246. // Construction and identification
  1247. DxilInst_Sqrt(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1248. operator bool() const {
  1249. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Sqrt);
  1250. }
  1251. // Validation support
  1252. bool isAllowed() const { return true; }
  1253. bool isArgumentListValid() const {
  1254. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1255. return true;
  1256. }
  1257. // Metadata
  1258. bool requiresUniformInputs() const { return false; }
  1259. // Operand indexes
  1260. enum OperandIdx {
  1261. arg_value = 1,
  1262. };
  1263. // Accessors
  1264. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1265. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1266. };
  1267. /// This instruction returns reciprocal square root (1 / sqrt(src)
  1268. struct DxilInst_Rsqrt {
  1269. llvm::Instruction *Instr;
  1270. // Construction and identification
  1271. DxilInst_Rsqrt(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1272. operator bool() const {
  1273. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Rsqrt);
  1274. }
  1275. // Validation support
  1276. bool isAllowed() const { return true; }
  1277. bool isArgumentListValid() const {
  1278. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1279. return true;
  1280. }
  1281. // Metadata
  1282. bool requiresUniformInputs() const { return false; }
  1283. // Operand indexes
  1284. enum OperandIdx {
  1285. arg_value = 1,
  1286. };
  1287. // Accessors
  1288. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1289. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1290. };
  1291. /// This instruction floating-point round to integral float.
  1292. struct DxilInst_Round_ne {
  1293. llvm::Instruction *Instr;
  1294. // Construction and identification
  1295. DxilInst_Round_ne(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1296. operator bool() const {
  1297. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Round_ne);
  1298. }
  1299. // Validation support
  1300. bool isAllowed() const { return true; }
  1301. bool isArgumentListValid() const {
  1302. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1303. return true;
  1304. }
  1305. // Metadata
  1306. bool requiresUniformInputs() const { return false; }
  1307. // Operand indexes
  1308. enum OperandIdx {
  1309. arg_value = 1,
  1310. };
  1311. // Accessors
  1312. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1313. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1314. };
  1315. /// This instruction floating-point round to integral float.
  1316. struct DxilInst_Round_ni {
  1317. llvm::Instruction *Instr;
  1318. // Construction and identification
  1319. DxilInst_Round_ni(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1320. operator bool() const {
  1321. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Round_ni);
  1322. }
  1323. // Validation support
  1324. bool isAllowed() const { return true; }
  1325. bool isArgumentListValid() const {
  1326. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1327. return true;
  1328. }
  1329. // Metadata
  1330. bool requiresUniformInputs() const { return false; }
  1331. // Operand indexes
  1332. enum OperandIdx {
  1333. arg_value = 1,
  1334. };
  1335. // Accessors
  1336. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1337. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1338. };
  1339. /// This instruction floating-point round to integral float.
  1340. struct DxilInst_Round_pi {
  1341. llvm::Instruction *Instr;
  1342. // Construction and identification
  1343. DxilInst_Round_pi(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1344. operator bool() const {
  1345. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Round_pi);
  1346. }
  1347. // Validation support
  1348. bool isAllowed() const { return true; }
  1349. bool isArgumentListValid() const {
  1350. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1351. return true;
  1352. }
  1353. // Metadata
  1354. bool requiresUniformInputs() const { return false; }
  1355. // Operand indexes
  1356. enum OperandIdx {
  1357. arg_value = 1,
  1358. };
  1359. // Accessors
  1360. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1361. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1362. };
  1363. /// This instruction floating-point round to integral float.
  1364. struct DxilInst_Round_z {
  1365. llvm::Instruction *Instr;
  1366. // Construction and identification
  1367. DxilInst_Round_z(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1368. operator bool() const {
  1369. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Round_z);
  1370. }
  1371. // Validation support
  1372. bool isAllowed() const { return true; }
  1373. bool isArgumentListValid() const {
  1374. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1375. return true;
  1376. }
  1377. // Metadata
  1378. bool requiresUniformInputs() const { return false; }
  1379. // Operand indexes
  1380. enum OperandIdx {
  1381. arg_value = 1,
  1382. };
  1383. // Accessors
  1384. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1385. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1386. };
  1387. /// This instruction Reverses the order of the bits.
  1388. struct DxilInst_Bfrev {
  1389. llvm::Instruction *Instr;
  1390. // Construction and identification
  1391. DxilInst_Bfrev(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1392. operator bool() const {
  1393. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Bfrev);
  1394. }
  1395. // Validation support
  1396. bool isAllowed() const { return true; }
  1397. bool isArgumentListValid() const {
  1398. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1399. return true;
  1400. }
  1401. // Metadata
  1402. bool requiresUniformInputs() const { return false; }
  1403. // Operand indexes
  1404. enum OperandIdx {
  1405. arg_value = 1,
  1406. };
  1407. // Accessors
  1408. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1409. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1410. };
  1411. /// This instruction Counts the number of bits in the input integer.
  1412. struct DxilInst_Countbits {
  1413. llvm::Instruction *Instr;
  1414. // Construction and identification
  1415. DxilInst_Countbits(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1416. operator bool() const {
  1417. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Countbits);
  1418. }
  1419. // Validation support
  1420. bool isAllowed() const { return true; }
  1421. bool isArgumentListValid() const {
  1422. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1423. return true;
  1424. }
  1425. // Metadata
  1426. bool requiresUniformInputs() const { return false; }
  1427. // Operand indexes
  1428. enum OperandIdx {
  1429. arg_value = 1,
  1430. };
  1431. // Accessors
  1432. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1433. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1434. };
  1435. /// This instruction Returns the location of the first set bit starting from the lowest order bit and working upward.
  1436. struct DxilInst_FirstbitLo {
  1437. llvm::Instruction *Instr;
  1438. // Construction and identification
  1439. DxilInst_FirstbitLo(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1440. operator bool() const {
  1441. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::FirstbitLo);
  1442. }
  1443. // Validation support
  1444. bool isAllowed() const { return true; }
  1445. bool isArgumentListValid() const {
  1446. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1447. return true;
  1448. }
  1449. // Metadata
  1450. bool requiresUniformInputs() const { return false; }
  1451. // Operand indexes
  1452. enum OperandIdx {
  1453. arg_value = 1,
  1454. };
  1455. // Accessors
  1456. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1457. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1458. };
  1459. /// This instruction Returns the location of the first set bit starting from the highest order bit and working downward.
  1460. struct DxilInst_FirstbitHi {
  1461. llvm::Instruction *Instr;
  1462. // Construction and identification
  1463. DxilInst_FirstbitHi(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1464. operator bool() const {
  1465. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::FirstbitHi);
  1466. }
  1467. // Validation support
  1468. bool isAllowed() const { return true; }
  1469. bool isArgumentListValid() const {
  1470. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1471. return true;
  1472. }
  1473. // Metadata
  1474. bool requiresUniformInputs() const { return false; }
  1475. // Operand indexes
  1476. enum OperandIdx {
  1477. arg_value = 1,
  1478. };
  1479. // Accessors
  1480. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1481. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1482. };
  1483. /// This instruction Returns the location of the first set bit from the highest order bit based on the sign.
  1484. struct DxilInst_FirstbitSHi {
  1485. llvm::Instruction *Instr;
  1486. // Construction and identification
  1487. DxilInst_FirstbitSHi(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1488. operator bool() const {
  1489. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::FirstbitSHi);
  1490. }
  1491. // Validation support
  1492. bool isAllowed() const { return true; }
  1493. bool isArgumentListValid() const {
  1494. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1495. return true;
  1496. }
  1497. // Metadata
  1498. bool requiresUniformInputs() const { return false; }
  1499. // Operand indexes
  1500. enum OperandIdx {
  1501. arg_value = 1,
  1502. };
  1503. // Accessors
  1504. llvm::Value *get_value() const { return Instr->getOperand(1); }
  1505. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  1506. };
  1507. /// This instruction returns a if a >= b, else b
  1508. struct DxilInst_FMax {
  1509. llvm::Instruction *Instr;
  1510. // Construction and identification
  1511. DxilInst_FMax(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1512. operator bool() const {
  1513. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::FMax);
  1514. }
  1515. // Validation support
  1516. bool isAllowed() const { return true; }
  1517. bool isArgumentListValid() const {
  1518. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1519. return true;
  1520. }
  1521. // Metadata
  1522. bool requiresUniformInputs() const { return false; }
  1523. // Operand indexes
  1524. enum OperandIdx {
  1525. arg_a = 1,
  1526. arg_b = 2,
  1527. };
  1528. // Accessors
  1529. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1530. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1531. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1532. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1533. };
  1534. /// This instruction returns a if a < b, else b
  1535. struct DxilInst_FMin {
  1536. llvm::Instruction *Instr;
  1537. // Construction and identification
  1538. DxilInst_FMin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1539. operator bool() const {
  1540. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::FMin);
  1541. }
  1542. // Validation support
  1543. bool isAllowed() const { return true; }
  1544. bool isArgumentListValid() const {
  1545. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1546. return true;
  1547. }
  1548. // Metadata
  1549. bool requiresUniformInputs() const { return false; }
  1550. // Operand indexes
  1551. enum OperandIdx {
  1552. arg_a = 1,
  1553. arg_b = 2,
  1554. };
  1555. // Accessors
  1556. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1557. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1558. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1559. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1560. };
  1561. /// This instruction IMax(a,b) returns a if a > b, else b
  1562. struct DxilInst_IMax {
  1563. llvm::Instruction *Instr;
  1564. // Construction and identification
  1565. DxilInst_IMax(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1566. operator bool() const {
  1567. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::IMax);
  1568. }
  1569. // Validation support
  1570. bool isAllowed() const { return true; }
  1571. bool isArgumentListValid() const {
  1572. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1573. return true;
  1574. }
  1575. // Metadata
  1576. bool requiresUniformInputs() const { return false; }
  1577. // Operand indexes
  1578. enum OperandIdx {
  1579. arg_a = 1,
  1580. arg_b = 2,
  1581. };
  1582. // Accessors
  1583. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1584. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1585. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1586. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1587. };
  1588. /// This instruction IMin(a,b) returns a if a < b, else b
  1589. struct DxilInst_IMin {
  1590. llvm::Instruction *Instr;
  1591. // Construction and identification
  1592. DxilInst_IMin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1593. operator bool() const {
  1594. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::IMin);
  1595. }
  1596. // Validation support
  1597. bool isAllowed() const { return true; }
  1598. bool isArgumentListValid() const {
  1599. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1600. return true;
  1601. }
  1602. // Metadata
  1603. bool requiresUniformInputs() const { return false; }
  1604. // Operand indexes
  1605. enum OperandIdx {
  1606. arg_a = 1,
  1607. arg_b = 2,
  1608. };
  1609. // Accessors
  1610. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1611. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1612. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1613. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1614. };
  1615. /// This instruction unsigned integer maximum. UMax(a,b) = a > b ? a : b
  1616. struct DxilInst_UMax {
  1617. llvm::Instruction *Instr;
  1618. // Construction and identification
  1619. DxilInst_UMax(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1620. operator bool() const {
  1621. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::UMax);
  1622. }
  1623. // Validation support
  1624. bool isAllowed() const { return true; }
  1625. bool isArgumentListValid() const {
  1626. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1627. return true;
  1628. }
  1629. // Metadata
  1630. bool requiresUniformInputs() const { return false; }
  1631. // Operand indexes
  1632. enum OperandIdx {
  1633. arg_a = 1,
  1634. arg_b = 2,
  1635. };
  1636. // Accessors
  1637. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1638. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1639. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1640. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1641. };
  1642. /// This instruction unsigned integer minimum. UMin(a,b) = a < b ? a : b
  1643. struct DxilInst_UMin {
  1644. llvm::Instruction *Instr;
  1645. // Construction and identification
  1646. DxilInst_UMin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1647. operator bool() const {
  1648. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::UMin);
  1649. }
  1650. // Validation support
  1651. bool isAllowed() const { return true; }
  1652. bool isArgumentListValid() const {
  1653. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1654. return true;
  1655. }
  1656. // Metadata
  1657. bool requiresUniformInputs() const { return false; }
  1658. // Operand indexes
  1659. enum OperandIdx {
  1660. arg_a = 1,
  1661. arg_b = 2,
  1662. };
  1663. // Accessors
  1664. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1665. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1666. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1667. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1668. };
  1669. /// This instruction multiply of 32-bit operands to produce the correct full 64-bit result.
  1670. struct DxilInst_IMul {
  1671. llvm::Instruction *Instr;
  1672. // Construction and identification
  1673. DxilInst_IMul(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1674. operator bool() const {
  1675. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::IMul);
  1676. }
  1677. // Validation support
  1678. bool isAllowed() const { return true; }
  1679. bool isArgumentListValid() const {
  1680. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1681. return true;
  1682. }
  1683. // Metadata
  1684. bool requiresUniformInputs() const { return false; }
  1685. // Operand indexes
  1686. enum OperandIdx {
  1687. arg_a = 1,
  1688. arg_b = 2,
  1689. };
  1690. // Accessors
  1691. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1692. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1693. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1694. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1695. };
  1696. /// This instruction multiply of 32-bit operands to produce the correct full 64-bit result.
  1697. struct DxilInst_UMul {
  1698. llvm::Instruction *Instr;
  1699. // Construction and identification
  1700. DxilInst_UMul(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1701. operator bool() const {
  1702. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::UMul);
  1703. }
  1704. // Validation support
  1705. bool isAllowed() const { return true; }
  1706. bool isArgumentListValid() const {
  1707. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1708. return true;
  1709. }
  1710. // Metadata
  1711. bool requiresUniformInputs() const { return false; }
  1712. // Operand indexes
  1713. enum OperandIdx {
  1714. arg_a = 1,
  1715. arg_b = 2,
  1716. };
  1717. // Accessors
  1718. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1719. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1720. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1721. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1722. };
  1723. /// This instruction unsigned divide of the 32-bit operand src0 by the 32-bit operand src1.
  1724. struct DxilInst_UDiv {
  1725. llvm::Instruction *Instr;
  1726. // Construction and identification
  1727. DxilInst_UDiv(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1728. operator bool() const {
  1729. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::UDiv);
  1730. }
  1731. // Validation support
  1732. bool isAllowed() const { return true; }
  1733. bool isArgumentListValid() const {
  1734. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1735. return true;
  1736. }
  1737. // Metadata
  1738. bool requiresUniformInputs() const { return false; }
  1739. // Operand indexes
  1740. enum OperandIdx {
  1741. arg_a = 1,
  1742. arg_b = 2,
  1743. };
  1744. // Accessors
  1745. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1746. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1747. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1748. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1749. };
  1750. /// This instruction unsigned add of 32-bit operand with the carry
  1751. struct DxilInst_UAddc {
  1752. llvm::Instruction *Instr;
  1753. // Construction and identification
  1754. DxilInst_UAddc(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1755. operator bool() const {
  1756. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::UAddc);
  1757. }
  1758. // Validation support
  1759. bool isAllowed() const { return true; }
  1760. bool isArgumentListValid() const {
  1761. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1762. return true;
  1763. }
  1764. // Metadata
  1765. bool requiresUniformInputs() const { return false; }
  1766. // Operand indexes
  1767. enum OperandIdx {
  1768. arg_a = 1,
  1769. arg_b = 2,
  1770. };
  1771. // Accessors
  1772. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1773. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1774. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1775. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1776. };
  1777. /// This instruction unsigned subtract of 32-bit operands with the borrow
  1778. struct DxilInst_USubb {
  1779. llvm::Instruction *Instr;
  1780. // Construction and identification
  1781. DxilInst_USubb(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1782. operator bool() const {
  1783. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::USubb);
  1784. }
  1785. // Validation support
  1786. bool isAllowed() const { return true; }
  1787. bool isArgumentListValid() const {
  1788. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1789. return true;
  1790. }
  1791. // Metadata
  1792. bool requiresUniformInputs() const { return false; }
  1793. // Operand indexes
  1794. enum OperandIdx {
  1795. arg_a = 1,
  1796. arg_b = 2,
  1797. };
  1798. // Accessors
  1799. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1800. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1801. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1802. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1803. };
  1804. /// This instruction floating point multiply & add
  1805. struct DxilInst_FMad {
  1806. llvm::Instruction *Instr;
  1807. // Construction and identification
  1808. DxilInst_FMad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1809. operator bool() const {
  1810. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::FMad);
  1811. }
  1812. // Validation support
  1813. bool isAllowed() const { return true; }
  1814. bool isArgumentListValid() const {
  1815. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1816. return true;
  1817. }
  1818. // Metadata
  1819. bool requiresUniformInputs() const { return false; }
  1820. // Operand indexes
  1821. enum OperandIdx {
  1822. arg_a = 1,
  1823. arg_b = 2,
  1824. arg_c = 3,
  1825. };
  1826. // Accessors
  1827. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1828. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1829. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1830. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1831. llvm::Value *get_c() const { return Instr->getOperand(3); }
  1832. void set_c(llvm::Value *val) { Instr->setOperand(3, val); }
  1833. };
  1834. /// This instruction fused multiply-add
  1835. struct DxilInst_Fma {
  1836. llvm::Instruction *Instr;
  1837. // Construction and identification
  1838. DxilInst_Fma(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1839. operator bool() const {
  1840. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Fma);
  1841. }
  1842. // Validation support
  1843. bool isAllowed() const { return true; }
  1844. bool isArgumentListValid() const {
  1845. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1846. return true;
  1847. }
  1848. // Metadata
  1849. bool requiresUniformInputs() const { return false; }
  1850. // Operand indexes
  1851. enum OperandIdx {
  1852. arg_a = 1,
  1853. arg_b = 2,
  1854. arg_c = 3,
  1855. };
  1856. // Accessors
  1857. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1858. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1859. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1860. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1861. llvm::Value *get_c() const { return Instr->getOperand(3); }
  1862. void set_c(llvm::Value *val) { Instr->setOperand(3, val); }
  1863. };
  1864. /// This instruction Signed integer multiply & add
  1865. struct DxilInst_IMad {
  1866. llvm::Instruction *Instr;
  1867. // Construction and identification
  1868. DxilInst_IMad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1869. operator bool() const {
  1870. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::IMad);
  1871. }
  1872. // Validation support
  1873. bool isAllowed() const { return true; }
  1874. bool isArgumentListValid() const {
  1875. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1876. return true;
  1877. }
  1878. // Metadata
  1879. bool requiresUniformInputs() const { return false; }
  1880. // Operand indexes
  1881. enum OperandIdx {
  1882. arg_a = 1,
  1883. arg_b = 2,
  1884. arg_c = 3,
  1885. };
  1886. // Accessors
  1887. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1888. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1889. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1890. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1891. llvm::Value *get_c() const { return Instr->getOperand(3); }
  1892. void set_c(llvm::Value *val) { Instr->setOperand(3, val); }
  1893. };
  1894. /// This instruction Unsigned integer multiply & add
  1895. struct DxilInst_UMad {
  1896. llvm::Instruction *Instr;
  1897. // Construction and identification
  1898. DxilInst_UMad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1899. operator bool() const {
  1900. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::UMad);
  1901. }
  1902. // Validation support
  1903. bool isAllowed() const { return true; }
  1904. bool isArgumentListValid() const {
  1905. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1906. return true;
  1907. }
  1908. // Metadata
  1909. bool requiresUniformInputs() const { return false; }
  1910. // Operand indexes
  1911. enum OperandIdx {
  1912. arg_a = 1,
  1913. arg_b = 2,
  1914. arg_c = 3,
  1915. };
  1916. // Accessors
  1917. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1918. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1919. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1920. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1921. llvm::Value *get_c() const { return Instr->getOperand(3); }
  1922. void set_c(llvm::Value *val) { Instr->setOperand(3, val); }
  1923. };
  1924. /// This instruction masked Sum of Absolute Differences.
  1925. struct DxilInst_Msad {
  1926. llvm::Instruction *Instr;
  1927. // Construction and identification
  1928. DxilInst_Msad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1929. operator bool() const {
  1930. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Msad);
  1931. }
  1932. // Validation support
  1933. bool isAllowed() const { return true; }
  1934. bool isArgumentListValid() const {
  1935. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1936. return true;
  1937. }
  1938. // Metadata
  1939. bool requiresUniformInputs() const { return false; }
  1940. // Operand indexes
  1941. enum OperandIdx {
  1942. arg_a = 1,
  1943. arg_b = 2,
  1944. arg_c = 3,
  1945. };
  1946. // Accessors
  1947. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1948. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1949. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1950. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1951. llvm::Value *get_c() const { return Instr->getOperand(3); }
  1952. void set_c(llvm::Value *val) { Instr->setOperand(3, val); }
  1953. };
  1954. /// This instruction Integer bitfield extract
  1955. struct DxilInst_Ibfe {
  1956. llvm::Instruction *Instr;
  1957. // Construction and identification
  1958. DxilInst_Ibfe(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1959. operator bool() const {
  1960. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Ibfe);
  1961. }
  1962. // Validation support
  1963. bool isAllowed() const { return true; }
  1964. bool isArgumentListValid() const {
  1965. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1966. return true;
  1967. }
  1968. // Metadata
  1969. bool requiresUniformInputs() const { return false; }
  1970. // Operand indexes
  1971. enum OperandIdx {
  1972. arg_a = 1,
  1973. arg_b = 2,
  1974. arg_c = 3,
  1975. };
  1976. // Accessors
  1977. llvm::Value *get_a() const { return Instr->getOperand(1); }
  1978. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  1979. llvm::Value *get_b() const { return Instr->getOperand(2); }
  1980. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  1981. llvm::Value *get_c() const { return Instr->getOperand(3); }
  1982. void set_c(llvm::Value *val) { Instr->setOperand(3, val); }
  1983. };
  1984. /// This instruction Unsigned integer bitfield extract
  1985. struct DxilInst_Ubfe {
  1986. llvm::Instruction *Instr;
  1987. // Construction and identification
  1988. DxilInst_Ubfe(llvm::Instruction *pInstr) : Instr(pInstr) {}
  1989. operator bool() const {
  1990. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Ubfe);
  1991. }
  1992. // Validation support
  1993. bool isAllowed() const { return true; }
  1994. bool isArgumentListValid() const {
  1995. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  1996. return true;
  1997. }
  1998. // Metadata
  1999. bool requiresUniformInputs() const { return false; }
  2000. // Operand indexes
  2001. enum OperandIdx {
  2002. arg_a = 1,
  2003. arg_b = 2,
  2004. arg_c = 3,
  2005. };
  2006. // Accessors
  2007. llvm::Value *get_a() const { return Instr->getOperand(1); }
  2008. void set_a(llvm::Value *val) { Instr->setOperand(1, val); }
  2009. llvm::Value *get_b() const { return Instr->getOperand(2); }
  2010. void set_b(llvm::Value *val) { Instr->setOperand(2, val); }
  2011. llvm::Value *get_c() const { return Instr->getOperand(3); }
  2012. void set_c(llvm::Value *val) { Instr->setOperand(3, val); }
  2013. };
  2014. /// This instruction Given a bit range from the LSB of a number, places that number of bits in another number at any offset
  2015. struct DxilInst_Bfi {
  2016. llvm::Instruction *Instr;
  2017. // Construction and identification
  2018. DxilInst_Bfi(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2019. operator bool() const {
  2020. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Bfi);
  2021. }
  2022. // Validation support
  2023. bool isAllowed() const { return true; }
  2024. bool isArgumentListValid() const {
  2025. if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2026. return true;
  2027. }
  2028. // Metadata
  2029. bool requiresUniformInputs() const { return false; }
  2030. // Operand indexes
  2031. enum OperandIdx {
  2032. arg_width = 1,
  2033. arg_offset = 2,
  2034. arg_value = 3,
  2035. arg_replacedValue = 4,
  2036. };
  2037. // Accessors
  2038. llvm::Value *get_width() const { return Instr->getOperand(1); }
  2039. void set_width(llvm::Value *val) { Instr->setOperand(1, val); }
  2040. llvm::Value *get_offset() const { return Instr->getOperand(2); }
  2041. void set_offset(llvm::Value *val) { Instr->setOperand(2, val); }
  2042. llvm::Value *get_value() const { return Instr->getOperand(3); }
  2043. void set_value(llvm::Value *val) { Instr->setOperand(3, val); }
  2044. llvm::Value *get_replacedValue() const { return Instr->getOperand(4); }
  2045. void set_replacedValue(llvm::Value *val) { Instr->setOperand(4, val); }
  2046. };
  2047. /// This instruction Two-dimensional vector dot-product
  2048. struct DxilInst_Dot2 {
  2049. llvm::Instruction *Instr;
  2050. // Construction and identification
  2051. DxilInst_Dot2(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2052. operator bool() const {
  2053. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Dot2);
  2054. }
  2055. // Validation support
  2056. bool isAllowed() const { return true; }
  2057. bool isArgumentListValid() const {
  2058. if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2059. return true;
  2060. }
  2061. // Metadata
  2062. bool requiresUniformInputs() const { return false; }
  2063. // Operand indexes
  2064. enum OperandIdx {
  2065. arg_ax = 1,
  2066. arg_ay = 2,
  2067. arg_bx = 3,
  2068. arg_by = 4,
  2069. };
  2070. // Accessors
  2071. llvm::Value *get_ax() const { return Instr->getOperand(1); }
  2072. void set_ax(llvm::Value *val) { Instr->setOperand(1, val); }
  2073. llvm::Value *get_ay() const { return Instr->getOperand(2); }
  2074. void set_ay(llvm::Value *val) { Instr->setOperand(2, val); }
  2075. llvm::Value *get_bx() const { return Instr->getOperand(3); }
  2076. void set_bx(llvm::Value *val) { Instr->setOperand(3, val); }
  2077. llvm::Value *get_by() const { return Instr->getOperand(4); }
  2078. void set_by(llvm::Value *val) { Instr->setOperand(4, val); }
  2079. };
  2080. /// This instruction Three-dimensional vector dot-product
  2081. struct DxilInst_Dot3 {
  2082. llvm::Instruction *Instr;
  2083. // Construction and identification
  2084. DxilInst_Dot3(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2085. operator bool() const {
  2086. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Dot3);
  2087. }
  2088. // Validation support
  2089. bool isAllowed() const { return true; }
  2090. bool isArgumentListValid() const {
  2091. if (7 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2092. return true;
  2093. }
  2094. // Metadata
  2095. bool requiresUniformInputs() const { return false; }
  2096. // Operand indexes
  2097. enum OperandIdx {
  2098. arg_ax = 1,
  2099. arg_ay = 2,
  2100. arg_az = 3,
  2101. arg_bx = 4,
  2102. arg_by = 5,
  2103. arg_bz = 6,
  2104. };
  2105. // Accessors
  2106. llvm::Value *get_ax() const { return Instr->getOperand(1); }
  2107. void set_ax(llvm::Value *val) { Instr->setOperand(1, val); }
  2108. llvm::Value *get_ay() const { return Instr->getOperand(2); }
  2109. void set_ay(llvm::Value *val) { Instr->setOperand(2, val); }
  2110. llvm::Value *get_az() const { return Instr->getOperand(3); }
  2111. void set_az(llvm::Value *val) { Instr->setOperand(3, val); }
  2112. llvm::Value *get_bx() const { return Instr->getOperand(4); }
  2113. void set_bx(llvm::Value *val) { Instr->setOperand(4, val); }
  2114. llvm::Value *get_by() const { return Instr->getOperand(5); }
  2115. void set_by(llvm::Value *val) { Instr->setOperand(5, val); }
  2116. llvm::Value *get_bz() const { return Instr->getOperand(6); }
  2117. void set_bz(llvm::Value *val) { Instr->setOperand(6, val); }
  2118. };
  2119. /// This instruction Four-dimensional vector dot-product
  2120. struct DxilInst_Dot4 {
  2121. llvm::Instruction *Instr;
  2122. // Construction and identification
  2123. DxilInst_Dot4(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2124. operator bool() const {
  2125. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Dot4);
  2126. }
  2127. // Validation support
  2128. bool isAllowed() const { return true; }
  2129. bool isArgumentListValid() const {
  2130. if (9 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2131. return true;
  2132. }
  2133. // Metadata
  2134. bool requiresUniformInputs() const { return false; }
  2135. // Operand indexes
  2136. enum OperandIdx {
  2137. arg_ax = 1,
  2138. arg_ay = 2,
  2139. arg_az = 3,
  2140. arg_aw = 4,
  2141. arg_bx = 5,
  2142. arg_by = 6,
  2143. arg_bz = 7,
  2144. arg_bw = 8,
  2145. };
  2146. // Accessors
  2147. llvm::Value *get_ax() const { return Instr->getOperand(1); }
  2148. void set_ax(llvm::Value *val) { Instr->setOperand(1, val); }
  2149. llvm::Value *get_ay() const { return Instr->getOperand(2); }
  2150. void set_ay(llvm::Value *val) { Instr->setOperand(2, val); }
  2151. llvm::Value *get_az() const { return Instr->getOperand(3); }
  2152. void set_az(llvm::Value *val) { Instr->setOperand(3, val); }
  2153. llvm::Value *get_aw() const { return Instr->getOperand(4); }
  2154. void set_aw(llvm::Value *val) { Instr->setOperand(4, val); }
  2155. llvm::Value *get_bx() const { return Instr->getOperand(5); }
  2156. void set_bx(llvm::Value *val) { Instr->setOperand(5, val); }
  2157. llvm::Value *get_by() const { return Instr->getOperand(6); }
  2158. void set_by(llvm::Value *val) { Instr->setOperand(6, val); }
  2159. llvm::Value *get_bz() const { return Instr->getOperand(7); }
  2160. void set_bz(llvm::Value *val) { Instr->setOperand(7, val); }
  2161. llvm::Value *get_bw() const { return Instr->getOperand(8); }
  2162. void set_bw(llvm::Value *val) { Instr->setOperand(8, val); }
  2163. };
  2164. /// This instruction creates the handle to a resource
  2165. struct DxilInst_CreateHandle {
  2166. llvm::Instruction *Instr;
  2167. // Construction and identification
  2168. DxilInst_CreateHandle(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2169. operator bool() const {
  2170. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::CreateHandle);
  2171. }
  2172. // Validation support
  2173. bool isAllowed() const { return true; }
  2174. bool isArgumentListValid() const {
  2175. if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2176. return true;
  2177. }
  2178. // Metadata
  2179. bool requiresUniformInputs() const { return false; }
  2180. // Operand indexes
  2181. enum OperandIdx {
  2182. arg_resourceClass = 1,
  2183. arg_rangeId = 2,
  2184. arg_index = 3,
  2185. arg_nonUniformIndex = 4,
  2186. };
  2187. // Accessors
  2188. llvm::Value *get_resourceClass() const { return Instr->getOperand(1); }
  2189. void set_resourceClass(llvm::Value *val) { Instr->setOperand(1, val); }
  2190. int8_t get_resourceClass_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(1))->getZExtValue()); }
  2191. void set_resourceClass_val(int8_t val) { Instr->setOperand(1, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  2192. llvm::Value *get_rangeId() const { return Instr->getOperand(2); }
  2193. void set_rangeId(llvm::Value *val) { Instr->setOperand(2, val); }
  2194. int32_t get_rangeId_val() const { return (int32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  2195. void set_rangeId_val(int32_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 32), llvm::APInt(32, (uint64_t)val))); }
  2196. llvm::Value *get_index() const { return Instr->getOperand(3); }
  2197. void set_index(llvm::Value *val) { Instr->setOperand(3, val); }
  2198. llvm::Value *get_nonUniformIndex() const { return Instr->getOperand(4); }
  2199. void set_nonUniformIndex(llvm::Value *val) { Instr->setOperand(4, val); }
  2200. bool get_nonUniformIndex_val() const { return (bool)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(4))->getZExtValue()); }
  2201. void set_nonUniformIndex_val(bool val) { Instr->setOperand(4, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 1), llvm::APInt(1, (uint64_t)val))); }
  2202. };
  2203. /// This instruction loads a value from a constant buffer resource
  2204. struct DxilInst_CBufferLoad {
  2205. llvm::Instruction *Instr;
  2206. // Construction and identification
  2207. DxilInst_CBufferLoad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2208. operator bool() const {
  2209. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::CBufferLoad);
  2210. }
  2211. // Validation support
  2212. bool isAllowed() const { return true; }
  2213. bool isArgumentListValid() const {
  2214. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2215. return true;
  2216. }
  2217. // Metadata
  2218. bool requiresUniformInputs() const { return false; }
  2219. // Operand indexes
  2220. enum OperandIdx {
  2221. arg_handle = 1,
  2222. arg_byteOffset = 2,
  2223. arg_alignment = 3,
  2224. };
  2225. // Accessors
  2226. llvm::Value *get_handle() const { return Instr->getOperand(1); }
  2227. void set_handle(llvm::Value *val) { Instr->setOperand(1, val); }
  2228. llvm::Value *get_byteOffset() const { return Instr->getOperand(2); }
  2229. void set_byteOffset(llvm::Value *val) { Instr->setOperand(2, val); }
  2230. llvm::Value *get_alignment() const { return Instr->getOperand(3); }
  2231. void set_alignment(llvm::Value *val) { Instr->setOperand(3, val); }
  2232. uint32_t get_alignment_val() const { return (uint32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(3))->getZExtValue()); }
  2233. void set_alignment_val(uint32_t val) { Instr->setOperand(3, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 32), llvm::APInt(32, (uint64_t)val))); }
  2234. };
  2235. /// This instruction loads a value from a constant buffer resource
  2236. struct DxilInst_CBufferLoadLegacy {
  2237. llvm::Instruction *Instr;
  2238. // Construction and identification
  2239. DxilInst_CBufferLoadLegacy(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2240. operator bool() const {
  2241. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::CBufferLoadLegacy);
  2242. }
  2243. // Validation support
  2244. bool isAllowed() const { return true; }
  2245. bool isArgumentListValid() const {
  2246. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2247. return true;
  2248. }
  2249. // Metadata
  2250. bool requiresUniformInputs() const { return false; }
  2251. // Operand indexes
  2252. enum OperandIdx {
  2253. arg_handle = 1,
  2254. arg_regIndex = 2,
  2255. };
  2256. // Accessors
  2257. llvm::Value *get_handle() const { return Instr->getOperand(1); }
  2258. void set_handle(llvm::Value *val) { Instr->setOperand(1, val); }
  2259. llvm::Value *get_regIndex() const { return Instr->getOperand(2); }
  2260. void set_regIndex(llvm::Value *val) { Instr->setOperand(2, val); }
  2261. };
  2262. /// This instruction samples a texture
  2263. struct DxilInst_Sample {
  2264. llvm::Instruction *Instr;
  2265. // Construction and identification
  2266. DxilInst_Sample(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2267. operator bool() const {
  2268. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Sample);
  2269. }
  2270. // Validation support
  2271. bool isAllowed() const { return true; }
  2272. bool isArgumentListValid() const {
  2273. if (11 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2274. return true;
  2275. }
  2276. // Metadata
  2277. bool requiresUniformInputs() const { return false; }
  2278. // Operand indexes
  2279. enum OperandIdx {
  2280. arg_srv = 1,
  2281. arg_sampler = 2,
  2282. arg_coord0 = 3,
  2283. arg_coord1 = 4,
  2284. arg_coord2 = 5,
  2285. arg_coord3 = 6,
  2286. arg_offset0 = 7,
  2287. arg_offset1 = 8,
  2288. arg_offset2 = 9,
  2289. arg_clamp = 10,
  2290. };
  2291. // Accessors
  2292. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  2293. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  2294. llvm::Value *get_sampler() const { return Instr->getOperand(2); }
  2295. void set_sampler(llvm::Value *val) { Instr->setOperand(2, val); }
  2296. llvm::Value *get_coord0() const { return Instr->getOperand(3); }
  2297. void set_coord0(llvm::Value *val) { Instr->setOperand(3, val); }
  2298. llvm::Value *get_coord1() const { return Instr->getOperand(4); }
  2299. void set_coord1(llvm::Value *val) { Instr->setOperand(4, val); }
  2300. llvm::Value *get_coord2() const { return Instr->getOperand(5); }
  2301. void set_coord2(llvm::Value *val) { Instr->setOperand(5, val); }
  2302. llvm::Value *get_coord3() const { return Instr->getOperand(6); }
  2303. void set_coord3(llvm::Value *val) { Instr->setOperand(6, val); }
  2304. llvm::Value *get_offset0() const { return Instr->getOperand(7); }
  2305. void set_offset0(llvm::Value *val) { Instr->setOperand(7, val); }
  2306. llvm::Value *get_offset1() const { return Instr->getOperand(8); }
  2307. void set_offset1(llvm::Value *val) { Instr->setOperand(8, val); }
  2308. llvm::Value *get_offset2() const { return Instr->getOperand(9); }
  2309. void set_offset2(llvm::Value *val) { Instr->setOperand(9, val); }
  2310. llvm::Value *get_clamp() const { return Instr->getOperand(10); }
  2311. void set_clamp(llvm::Value *val) { Instr->setOperand(10, val); }
  2312. };
  2313. /// This instruction samples a texture after applying the input bias to the mipmap level
  2314. struct DxilInst_SampleBias {
  2315. llvm::Instruction *Instr;
  2316. // Construction and identification
  2317. DxilInst_SampleBias(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2318. operator bool() const {
  2319. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::SampleBias);
  2320. }
  2321. // Validation support
  2322. bool isAllowed() const { return true; }
  2323. bool isArgumentListValid() const {
  2324. if (12 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2325. return true;
  2326. }
  2327. // Metadata
  2328. bool requiresUniformInputs() const { return false; }
  2329. // Operand indexes
  2330. enum OperandIdx {
  2331. arg_srv = 1,
  2332. arg_sampler = 2,
  2333. arg_coord0 = 3,
  2334. arg_coord1 = 4,
  2335. arg_coord2 = 5,
  2336. arg_coord3 = 6,
  2337. arg_offset0 = 7,
  2338. arg_offset1 = 8,
  2339. arg_offset2 = 9,
  2340. arg_bias = 10,
  2341. arg_clamp = 11,
  2342. };
  2343. // Accessors
  2344. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  2345. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  2346. llvm::Value *get_sampler() const { return Instr->getOperand(2); }
  2347. void set_sampler(llvm::Value *val) { Instr->setOperand(2, val); }
  2348. llvm::Value *get_coord0() const { return Instr->getOperand(3); }
  2349. void set_coord0(llvm::Value *val) { Instr->setOperand(3, val); }
  2350. llvm::Value *get_coord1() const { return Instr->getOperand(4); }
  2351. void set_coord1(llvm::Value *val) { Instr->setOperand(4, val); }
  2352. llvm::Value *get_coord2() const { return Instr->getOperand(5); }
  2353. void set_coord2(llvm::Value *val) { Instr->setOperand(5, val); }
  2354. llvm::Value *get_coord3() const { return Instr->getOperand(6); }
  2355. void set_coord3(llvm::Value *val) { Instr->setOperand(6, val); }
  2356. llvm::Value *get_offset0() const { return Instr->getOperand(7); }
  2357. void set_offset0(llvm::Value *val) { Instr->setOperand(7, val); }
  2358. llvm::Value *get_offset1() const { return Instr->getOperand(8); }
  2359. void set_offset1(llvm::Value *val) { Instr->setOperand(8, val); }
  2360. llvm::Value *get_offset2() const { return Instr->getOperand(9); }
  2361. void set_offset2(llvm::Value *val) { Instr->setOperand(9, val); }
  2362. llvm::Value *get_bias() const { return Instr->getOperand(10); }
  2363. void set_bias(llvm::Value *val) { Instr->setOperand(10, val); }
  2364. llvm::Value *get_clamp() const { return Instr->getOperand(11); }
  2365. void set_clamp(llvm::Value *val) { Instr->setOperand(11, val); }
  2366. };
  2367. /// This instruction samples a texture using a mipmap-level offset
  2368. struct DxilInst_SampleLevel {
  2369. llvm::Instruction *Instr;
  2370. // Construction and identification
  2371. DxilInst_SampleLevel(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2372. operator bool() const {
  2373. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::SampleLevel);
  2374. }
  2375. // Validation support
  2376. bool isAllowed() const { return true; }
  2377. bool isArgumentListValid() const {
  2378. if (11 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2379. return true;
  2380. }
  2381. // Metadata
  2382. bool requiresUniformInputs() const { return false; }
  2383. // Operand indexes
  2384. enum OperandIdx {
  2385. arg_srv = 1,
  2386. arg_sampler = 2,
  2387. arg_coord0 = 3,
  2388. arg_coord1 = 4,
  2389. arg_coord2 = 5,
  2390. arg_coord3 = 6,
  2391. arg_offset0 = 7,
  2392. arg_offset1 = 8,
  2393. arg_offset2 = 9,
  2394. arg_LOD = 10,
  2395. };
  2396. // Accessors
  2397. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  2398. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  2399. llvm::Value *get_sampler() const { return Instr->getOperand(2); }
  2400. void set_sampler(llvm::Value *val) { Instr->setOperand(2, val); }
  2401. llvm::Value *get_coord0() const { return Instr->getOperand(3); }
  2402. void set_coord0(llvm::Value *val) { Instr->setOperand(3, val); }
  2403. llvm::Value *get_coord1() const { return Instr->getOperand(4); }
  2404. void set_coord1(llvm::Value *val) { Instr->setOperand(4, val); }
  2405. llvm::Value *get_coord2() const { return Instr->getOperand(5); }
  2406. void set_coord2(llvm::Value *val) { Instr->setOperand(5, val); }
  2407. llvm::Value *get_coord3() const { return Instr->getOperand(6); }
  2408. void set_coord3(llvm::Value *val) { Instr->setOperand(6, val); }
  2409. llvm::Value *get_offset0() const { return Instr->getOperand(7); }
  2410. void set_offset0(llvm::Value *val) { Instr->setOperand(7, val); }
  2411. llvm::Value *get_offset1() const { return Instr->getOperand(8); }
  2412. void set_offset1(llvm::Value *val) { Instr->setOperand(8, val); }
  2413. llvm::Value *get_offset2() const { return Instr->getOperand(9); }
  2414. void set_offset2(llvm::Value *val) { Instr->setOperand(9, val); }
  2415. llvm::Value *get_LOD() const { return Instr->getOperand(10); }
  2416. void set_LOD(llvm::Value *val) { Instr->setOperand(10, val); }
  2417. };
  2418. /// This instruction samples a texture using a gradient to influence the way the sample location is calculated
  2419. struct DxilInst_SampleGrad {
  2420. llvm::Instruction *Instr;
  2421. // Construction and identification
  2422. DxilInst_SampleGrad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2423. operator bool() const {
  2424. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::SampleGrad);
  2425. }
  2426. // Validation support
  2427. bool isAllowed() const { return true; }
  2428. bool isArgumentListValid() const {
  2429. if (17 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2430. return true;
  2431. }
  2432. // Metadata
  2433. bool requiresUniformInputs() const { return false; }
  2434. // Operand indexes
  2435. enum OperandIdx {
  2436. arg_srv = 1,
  2437. arg_sampler = 2,
  2438. arg_coord0 = 3,
  2439. arg_coord1 = 4,
  2440. arg_coord2 = 5,
  2441. arg_coord3 = 6,
  2442. arg_offset0 = 7,
  2443. arg_offset1 = 8,
  2444. arg_offset2 = 9,
  2445. arg_ddx0 = 10,
  2446. arg_ddx1 = 11,
  2447. arg_ddx2 = 12,
  2448. arg_ddy0 = 13,
  2449. arg_ddy1 = 14,
  2450. arg_ddy2 = 15,
  2451. arg_clamp = 16,
  2452. };
  2453. // Accessors
  2454. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  2455. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  2456. llvm::Value *get_sampler() const { return Instr->getOperand(2); }
  2457. void set_sampler(llvm::Value *val) { Instr->setOperand(2, val); }
  2458. llvm::Value *get_coord0() const { return Instr->getOperand(3); }
  2459. void set_coord0(llvm::Value *val) { Instr->setOperand(3, val); }
  2460. llvm::Value *get_coord1() const { return Instr->getOperand(4); }
  2461. void set_coord1(llvm::Value *val) { Instr->setOperand(4, val); }
  2462. llvm::Value *get_coord2() const { return Instr->getOperand(5); }
  2463. void set_coord2(llvm::Value *val) { Instr->setOperand(5, val); }
  2464. llvm::Value *get_coord3() const { return Instr->getOperand(6); }
  2465. void set_coord3(llvm::Value *val) { Instr->setOperand(6, val); }
  2466. llvm::Value *get_offset0() const { return Instr->getOperand(7); }
  2467. void set_offset0(llvm::Value *val) { Instr->setOperand(7, val); }
  2468. llvm::Value *get_offset1() const { return Instr->getOperand(8); }
  2469. void set_offset1(llvm::Value *val) { Instr->setOperand(8, val); }
  2470. llvm::Value *get_offset2() const { return Instr->getOperand(9); }
  2471. void set_offset2(llvm::Value *val) { Instr->setOperand(9, val); }
  2472. llvm::Value *get_ddx0() const { return Instr->getOperand(10); }
  2473. void set_ddx0(llvm::Value *val) { Instr->setOperand(10, val); }
  2474. llvm::Value *get_ddx1() const { return Instr->getOperand(11); }
  2475. void set_ddx1(llvm::Value *val) { Instr->setOperand(11, val); }
  2476. llvm::Value *get_ddx2() const { return Instr->getOperand(12); }
  2477. void set_ddx2(llvm::Value *val) { Instr->setOperand(12, val); }
  2478. llvm::Value *get_ddy0() const { return Instr->getOperand(13); }
  2479. void set_ddy0(llvm::Value *val) { Instr->setOperand(13, val); }
  2480. llvm::Value *get_ddy1() const { return Instr->getOperand(14); }
  2481. void set_ddy1(llvm::Value *val) { Instr->setOperand(14, val); }
  2482. llvm::Value *get_ddy2() const { return Instr->getOperand(15); }
  2483. void set_ddy2(llvm::Value *val) { Instr->setOperand(15, val); }
  2484. llvm::Value *get_clamp() const { return Instr->getOperand(16); }
  2485. void set_clamp(llvm::Value *val) { Instr->setOperand(16, val); }
  2486. };
  2487. /// This instruction samples a texture and compares a single component against the specified comparison value
  2488. struct DxilInst_SampleCmp {
  2489. llvm::Instruction *Instr;
  2490. // Construction and identification
  2491. DxilInst_SampleCmp(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2492. operator bool() const {
  2493. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::SampleCmp);
  2494. }
  2495. // Validation support
  2496. bool isAllowed() const { return true; }
  2497. bool isArgumentListValid() const {
  2498. if (12 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2499. return true;
  2500. }
  2501. // Metadata
  2502. bool requiresUniformInputs() const { return false; }
  2503. // Operand indexes
  2504. enum OperandIdx {
  2505. arg_srv = 1,
  2506. arg_sampler = 2,
  2507. arg_coord0 = 3,
  2508. arg_coord1 = 4,
  2509. arg_coord2 = 5,
  2510. arg_coord3 = 6,
  2511. arg_offset0 = 7,
  2512. arg_offset1 = 8,
  2513. arg_offset2 = 9,
  2514. arg_compareValue = 10,
  2515. arg_clamp = 11,
  2516. };
  2517. // Accessors
  2518. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  2519. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  2520. llvm::Value *get_sampler() const { return Instr->getOperand(2); }
  2521. void set_sampler(llvm::Value *val) { Instr->setOperand(2, val); }
  2522. llvm::Value *get_coord0() const { return Instr->getOperand(3); }
  2523. void set_coord0(llvm::Value *val) { Instr->setOperand(3, val); }
  2524. llvm::Value *get_coord1() const { return Instr->getOperand(4); }
  2525. void set_coord1(llvm::Value *val) { Instr->setOperand(4, val); }
  2526. llvm::Value *get_coord2() const { return Instr->getOperand(5); }
  2527. void set_coord2(llvm::Value *val) { Instr->setOperand(5, val); }
  2528. llvm::Value *get_coord3() const { return Instr->getOperand(6); }
  2529. void set_coord3(llvm::Value *val) { Instr->setOperand(6, val); }
  2530. llvm::Value *get_offset0() const { return Instr->getOperand(7); }
  2531. void set_offset0(llvm::Value *val) { Instr->setOperand(7, val); }
  2532. llvm::Value *get_offset1() const { return Instr->getOperand(8); }
  2533. void set_offset1(llvm::Value *val) { Instr->setOperand(8, val); }
  2534. llvm::Value *get_offset2() const { return Instr->getOperand(9); }
  2535. void set_offset2(llvm::Value *val) { Instr->setOperand(9, val); }
  2536. llvm::Value *get_compareValue() const { return Instr->getOperand(10); }
  2537. void set_compareValue(llvm::Value *val) { Instr->setOperand(10, val); }
  2538. llvm::Value *get_clamp() const { return Instr->getOperand(11); }
  2539. void set_clamp(llvm::Value *val) { Instr->setOperand(11, val); }
  2540. };
  2541. /// This instruction samples a texture and compares a single component against the specified comparison value
  2542. struct DxilInst_SampleCmpLevelZero {
  2543. llvm::Instruction *Instr;
  2544. // Construction and identification
  2545. DxilInst_SampleCmpLevelZero(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2546. operator bool() const {
  2547. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::SampleCmpLevelZero);
  2548. }
  2549. // Validation support
  2550. bool isAllowed() const { return true; }
  2551. bool isArgumentListValid() const {
  2552. if (11 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2553. return true;
  2554. }
  2555. // Metadata
  2556. bool requiresUniformInputs() const { return false; }
  2557. // Operand indexes
  2558. enum OperandIdx {
  2559. arg_srv = 1,
  2560. arg_sampler = 2,
  2561. arg_coord0 = 3,
  2562. arg_coord1 = 4,
  2563. arg_coord2 = 5,
  2564. arg_coord3 = 6,
  2565. arg_offset0 = 7,
  2566. arg_offset1 = 8,
  2567. arg_offset2 = 9,
  2568. arg_compareValue = 10,
  2569. };
  2570. // Accessors
  2571. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  2572. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  2573. llvm::Value *get_sampler() const { return Instr->getOperand(2); }
  2574. void set_sampler(llvm::Value *val) { Instr->setOperand(2, val); }
  2575. llvm::Value *get_coord0() const { return Instr->getOperand(3); }
  2576. void set_coord0(llvm::Value *val) { Instr->setOperand(3, val); }
  2577. llvm::Value *get_coord1() const { return Instr->getOperand(4); }
  2578. void set_coord1(llvm::Value *val) { Instr->setOperand(4, val); }
  2579. llvm::Value *get_coord2() const { return Instr->getOperand(5); }
  2580. void set_coord2(llvm::Value *val) { Instr->setOperand(5, val); }
  2581. llvm::Value *get_coord3() const { return Instr->getOperand(6); }
  2582. void set_coord3(llvm::Value *val) { Instr->setOperand(6, val); }
  2583. llvm::Value *get_offset0() const { return Instr->getOperand(7); }
  2584. void set_offset0(llvm::Value *val) { Instr->setOperand(7, val); }
  2585. llvm::Value *get_offset1() const { return Instr->getOperand(8); }
  2586. void set_offset1(llvm::Value *val) { Instr->setOperand(8, val); }
  2587. llvm::Value *get_offset2() const { return Instr->getOperand(9); }
  2588. void set_offset2(llvm::Value *val) { Instr->setOperand(9, val); }
  2589. llvm::Value *get_compareValue() const { return Instr->getOperand(10); }
  2590. void set_compareValue(llvm::Value *val) { Instr->setOperand(10, val); }
  2591. };
  2592. /// This instruction reads texel data without any filtering or sampling
  2593. struct DxilInst_TextureLoad {
  2594. llvm::Instruction *Instr;
  2595. // Construction and identification
  2596. DxilInst_TextureLoad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2597. operator bool() const {
  2598. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::TextureLoad);
  2599. }
  2600. // Validation support
  2601. bool isAllowed() const { return true; }
  2602. bool isArgumentListValid() const {
  2603. if (9 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2604. return true;
  2605. }
  2606. // Metadata
  2607. bool requiresUniformInputs() const { return false; }
  2608. // Operand indexes
  2609. enum OperandIdx {
  2610. arg_srv = 1,
  2611. arg_mipLevelOrSampleCount = 2,
  2612. arg_coord0 = 3,
  2613. arg_coord1 = 4,
  2614. arg_coord2 = 5,
  2615. arg_offset0 = 6,
  2616. arg_offset1 = 7,
  2617. arg_offset2 = 8,
  2618. };
  2619. // Accessors
  2620. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  2621. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  2622. llvm::Value *get_mipLevelOrSampleCount() const { return Instr->getOperand(2); }
  2623. void set_mipLevelOrSampleCount(llvm::Value *val) { Instr->setOperand(2, val); }
  2624. llvm::Value *get_coord0() const { return Instr->getOperand(3); }
  2625. void set_coord0(llvm::Value *val) { Instr->setOperand(3, val); }
  2626. llvm::Value *get_coord1() const { return Instr->getOperand(4); }
  2627. void set_coord1(llvm::Value *val) { Instr->setOperand(4, val); }
  2628. llvm::Value *get_coord2() const { return Instr->getOperand(5); }
  2629. void set_coord2(llvm::Value *val) { Instr->setOperand(5, val); }
  2630. llvm::Value *get_offset0() const { return Instr->getOperand(6); }
  2631. void set_offset0(llvm::Value *val) { Instr->setOperand(6, val); }
  2632. llvm::Value *get_offset1() const { return Instr->getOperand(7); }
  2633. void set_offset1(llvm::Value *val) { Instr->setOperand(7, val); }
  2634. llvm::Value *get_offset2() const { return Instr->getOperand(8); }
  2635. void set_offset2(llvm::Value *val) { Instr->setOperand(8, val); }
  2636. };
  2637. /// This instruction reads texel data without any filtering or sampling
  2638. struct DxilInst_TextureStore {
  2639. llvm::Instruction *Instr;
  2640. // Construction and identification
  2641. DxilInst_TextureStore(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2642. operator bool() const {
  2643. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::TextureStore);
  2644. }
  2645. // Validation support
  2646. bool isAllowed() const { return true; }
  2647. bool isArgumentListValid() const {
  2648. if (10 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2649. return true;
  2650. }
  2651. // Metadata
  2652. bool requiresUniformInputs() const { return false; }
  2653. // Operand indexes
  2654. enum OperandIdx {
  2655. arg_srv = 1,
  2656. arg_coord0 = 2,
  2657. arg_coord1 = 3,
  2658. arg_coord2 = 4,
  2659. arg_value0 = 5,
  2660. arg_value1 = 6,
  2661. arg_value2 = 7,
  2662. arg_value3 = 8,
  2663. arg_mask = 9,
  2664. };
  2665. // Accessors
  2666. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  2667. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  2668. llvm::Value *get_coord0() const { return Instr->getOperand(2); }
  2669. void set_coord0(llvm::Value *val) { Instr->setOperand(2, val); }
  2670. llvm::Value *get_coord1() const { return Instr->getOperand(3); }
  2671. void set_coord1(llvm::Value *val) { Instr->setOperand(3, val); }
  2672. llvm::Value *get_coord2() const { return Instr->getOperand(4); }
  2673. void set_coord2(llvm::Value *val) { Instr->setOperand(4, val); }
  2674. llvm::Value *get_value0() const { return Instr->getOperand(5); }
  2675. void set_value0(llvm::Value *val) { Instr->setOperand(5, val); }
  2676. llvm::Value *get_value1() const { return Instr->getOperand(6); }
  2677. void set_value1(llvm::Value *val) { Instr->setOperand(6, val); }
  2678. llvm::Value *get_value2() const { return Instr->getOperand(7); }
  2679. void set_value2(llvm::Value *val) { Instr->setOperand(7, val); }
  2680. llvm::Value *get_value3() const { return Instr->getOperand(8); }
  2681. void set_value3(llvm::Value *val) { Instr->setOperand(8, val); }
  2682. llvm::Value *get_mask() const { return Instr->getOperand(9); }
  2683. void set_mask(llvm::Value *val) { Instr->setOperand(9, val); }
  2684. };
  2685. /// This instruction reads from a TypedBuffer
  2686. struct DxilInst_BufferLoad {
  2687. llvm::Instruction *Instr;
  2688. // Construction and identification
  2689. DxilInst_BufferLoad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2690. operator bool() const {
  2691. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::BufferLoad);
  2692. }
  2693. // Validation support
  2694. bool isAllowed() const { return true; }
  2695. bool isArgumentListValid() const {
  2696. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2697. return true;
  2698. }
  2699. // Metadata
  2700. bool requiresUniformInputs() const { return false; }
  2701. // Operand indexes
  2702. enum OperandIdx {
  2703. arg_srv = 1,
  2704. arg_index = 2,
  2705. arg_wot = 3,
  2706. };
  2707. // Accessors
  2708. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  2709. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  2710. llvm::Value *get_index() const { return Instr->getOperand(2); }
  2711. void set_index(llvm::Value *val) { Instr->setOperand(2, val); }
  2712. llvm::Value *get_wot() const { return Instr->getOperand(3); }
  2713. void set_wot(llvm::Value *val) { Instr->setOperand(3, val); }
  2714. };
  2715. /// This instruction writes to a RWTypedBuffer
  2716. struct DxilInst_BufferStore {
  2717. llvm::Instruction *Instr;
  2718. // Construction and identification
  2719. DxilInst_BufferStore(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2720. operator bool() const {
  2721. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::BufferStore);
  2722. }
  2723. // Validation support
  2724. bool isAllowed() const { return true; }
  2725. bool isArgumentListValid() const {
  2726. if (9 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2727. return true;
  2728. }
  2729. // Metadata
  2730. bool requiresUniformInputs() const { return false; }
  2731. // Operand indexes
  2732. enum OperandIdx {
  2733. arg_uav = 1,
  2734. arg_coord0 = 2,
  2735. arg_coord1 = 3,
  2736. arg_value0 = 4,
  2737. arg_value1 = 5,
  2738. arg_value2 = 6,
  2739. arg_value3 = 7,
  2740. arg_mask = 8,
  2741. };
  2742. // Accessors
  2743. llvm::Value *get_uav() const { return Instr->getOperand(1); }
  2744. void set_uav(llvm::Value *val) { Instr->setOperand(1, val); }
  2745. llvm::Value *get_coord0() const { return Instr->getOperand(2); }
  2746. void set_coord0(llvm::Value *val) { Instr->setOperand(2, val); }
  2747. llvm::Value *get_coord1() const { return Instr->getOperand(3); }
  2748. void set_coord1(llvm::Value *val) { Instr->setOperand(3, val); }
  2749. llvm::Value *get_value0() const { return Instr->getOperand(4); }
  2750. void set_value0(llvm::Value *val) { Instr->setOperand(4, val); }
  2751. llvm::Value *get_value1() const { return Instr->getOperand(5); }
  2752. void set_value1(llvm::Value *val) { Instr->setOperand(5, val); }
  2753. llvm::Value *get_value2() const { return Instr->getOperand(6); }
  2754. void set_value2(llvm::Value *val) { Instr->setOperand(6, val); }
  2755. llvm::Value *get_value3() const { return Instr->getOperand(7); }
  2756. void set_value3(llvm::Value *val) { Instr->setOperand(7, val); }
  2757. llvm::Value *get_mask() const { return Instr->getOperand(8); }
  2758. void set_mask(llvm::Value *val) { Instr->setOperand(8, val); }
  2759. };
  2760. /// This instruction atomically increments/decrements the hidden 32-bit counter stored with a Count or Append UAV
  2761. struct DxilInst_BufferUpdateCounter {
  2762. llvm::Instruction *Instr;
  2763. // Construction and identification
  2764. DxilInst_BufferUpdateCounter(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2765. operator bool() const {
  2766. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::BufferUpdateCounter);
  2767. }
  2768. // Validation support
  2769. bool isAllowed() const { return true; }
  2770. bool isArgumentListValid() const {
  2771. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2772. return true;
  2773. }
  2774. // Metadata
  2775. bool requiresUniformInputs() const { return false; }
  2776. // Operand indexes
  2777. enum OperandIdx {
  2778. arg_uav = 1,
  2779. arg_inc = 2,
  2780. };
  2781. // Accessors
  2782. llvm::Value *get_uav() const { return Instr->getOperand(1); }
  2783. void set_uav(llvm::Value *val) { Instr->setOperand(1, val); }
  2784. llvm::Value *get_inc() const { return Instr->getOperand(2); }
  2785. void set_inc(llvm::Value *val) { Instr->setOperand(2, val); }
  2786. };
  2787. /// This instruction determines whether all values from a Sample, Gather, or Load operation accessed mapped tiles in a tiled resource
  2788. struct DxilInst_CheckAccessFullyMapped {
  2789. llvm::Instruction *Instr;
  2790. // Construction and identification
  2791. DxilInst_CheckAccessFullyMapped(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2792. operator bool() const {
  2793. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::CheckAccessFullyMapped);
  2794. }
  2795. // Validation support
  2796. bool isAllowed() const { return true; }
  2797. bool isArgumentListValid() const {
  2798. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2799. return true;
  2800. }
  2801. // Metadata
  2802. bool requiresUniformInputs() const { return false; }
  2803. // Operand indexes
  2804. enum OperandIdx {
  2805. arg_status = 1,
  2806. };
  2807. // Accessors
  2808. llvm::Value *get_status() const { return Instr->getOperand(1); }
  2809. void set_status(llvm::Value *val) { Instr->setOperand(1, val); }
  2810. };
  2811. /// This instruction gets texture size information
  2812. struct DxilInst_GetDimensions {
  2813. llvm::Instruction *Instr;
  2814. // Construction and identification
  2815. DxilInst_GetDimensions(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2816. operator bool() const {
  2817. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::GetDimensions);
  2818. }
  2819. // Validation support
  2820. bool isAllowed() const { return true; }
  2821. bool isArgumentListValid() const {
  2822. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2823. return true;
  2824. }
  2825. // Metadata
  2826. bool requiresUniformInputs() const { return false; }
  2827. // Operand indexes
  2828. enum OperandIdx {
  2829. arg_handle = 1,
  2830. arg_mipLevel = 2,
  2831. };
  2832. // Accessors
  2833. llvm::Value *get_handle() const { return Instr->getOperand(1); }
  2834. void set_handle(llvm::Value *val) { Instr->setOperand(1, val); }
  2835. llvm::Value *get_mipLevel() const { return Instr->getOperand(2); }
  2836. void set_mipLevel(llvm::Value *val) { Instr->setOperand(2, val); }
  2837. };
  2838. /// This instruction gathers the four texels that would be used in a bi-linear filtering operation
  2839. struct DxilInst_TextureGather {
  2840. llvm::Instruction *Instr;
  2841. // Construction and identification
  2842. DxilInst_TextureGather(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2843. operator bool() const {
  2844. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::TextureGather);
  2845. }
  2846. // Validation support
  2847. bool isAllowed() const { return true; }
  2848. bool isArgumentListValid() const {
  2849. if (10 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2850. return true;
  2851. }
  2852. // Metadata
  2853. bool requiresUniformInputs() const { return false; }
  2854. // Operand indexes
  2855. enum OperandIdx {
  2856. arg_srv = 1,
  2857. arg_sampler = 2,
  2858. arg_coord0 = 3,
  2859. arg_coord1 = 4,
  2860. arg_coord2 = 5,
  2861. arg_coord3 = 6,
  2862. arg_offset0 = 7,
  2863. arg_offset1 = 8,
  2864. arg_channel = 9,
  2865. };
  2866. // Accessors
  2867. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  2868. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  2869. llvm::Value *get_sampler() const { return Instr->getOperand(2); }
  2870. void set_sampler(llvm::Value *val) { Instr->setOperand(2, val); }
  2871. llvm::Value *get_coord0() const { return Instr->getOperand(3); }
  2872. void set_coord0(llvm::Value *val) { Instr->setOperand(3, val); }
  2873. llvm::Value *get_coord1() const { return Instr->getOperand(4); }
  2874. void set_coord1(llvm::Value *val) { Instr->setOperand(4, val); }
  2875. llvm::Value *get_coord2() const { return Instr->getOperand(5); }
  2876. void set_coord2(llvm::Value *val) { Instr->setOperand(5, val); }
  2877. llvm::Value *get_coord3() const { return Instr->getOperand(6); }
  2878. void set_coord3(llvm::Value *val) { Instr->setOperand(6, val); }
  2879. llvm::Value *get_offset0() const { return Instr->getOperand(7); }
  2880. void set_offset0(llvm::Value *val) { Instr->setOperand(7, val); }
  2881. llvm::Value *get_offset1() const { return Instr->getOperand(8); }
  2882. void set_offset1(llvm::Value *val) { Instr->setOperand(8, val); }
  2883. llvm::Value *get_channel() const { return Instr->getOperand(9); }
  2884. void set_channel(llvm::Value *val) { Instr->setOperand(9, val); }
  2885. };
  2886. /// This instruction same as TextureGather, except this instrution performs comparison on texels, similar to SampleCmp
  2887. struct DxilInst_TextureGatherCmp {
  2888. llvm::Instruction *Instr;
  2889. // Construction and identification
  2890. DxilInst_TextureGatherCmp(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2891. operator bool() const {
  2892. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::TextureGatherCmp);
  2893. }
  2894. // Validation support
  2895. bool isAllowed() const { return true; }
  2896. bool isArgumentListValid() const {
  2897. if (11 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2898. return true;
  2899. }
  2900. // Metadata
  2901. bool requiresUniformInputs() const { return false; }
  2902. // Operand indexes
  2903. enum OperandIdx {
  2904. arg_srv = 1,
  2905. arg_sampler = 2,
  2906. arg_coord0 = 3,
  2907. arg_coord1 = 4,
  2908. arg_coord2 = 5,
  2909. arg_coord3 = 6,
  2910. arg_offset0 = 7,
  2911. arg_offset1 = 8,
  2912. arg_channel = 9,
  2913. arg_compareVale = 10,
  2914. };
  2915. // Accessors
  2916. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  2917. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  2918. llvm::Value *get_sampler() const { return Instr->getOperand(2); }
  2919. void set_sampler(llvm::Value *val) { Instr->setOperand(2, val); }
  2920. llvm::Value *get_coord0() const { return Instr->getOperand(3); }
  2921. void set_coord0(llvm::Value *val) { Instr->setOperand(3, val); }
  2922. llvm::Value *get_coord1() const { return Instr->getOperand(4); }
  2923. void set_coord1(llvm::Value *val) { Instr->setOperand(4, val); }
  2924. llvm::Value *get_coord2() const { return Instr->getOperand(5); }
  2925. void set_coord2(llvm::Value *val) { Instr->setOperand(5, val); }
  2926. llvm::Value *get_coord3() const { return Instr->getOperand(6); }
  2927. void set_coord3(llvm::Value *val) { Instr->setOperand(6, val); }
  2928. llvm::Value *get_offset0() const { return Instr->getOperand(7); }
  2929. void set_offset0(llvm::Value *val) { Instr->setOperand(7, val); }
  2930. llvm::Value *get_offset1() const { return Instr->getOperand(8); }
  2931. void set_offset1(llvm::Value *val) { Instr->setOperand(8, val); }
  2932. llvm::Value *get_channel() const { return Instr->getOperand(9); }
  2933. void set_channel(llvm::Value *val) { Instr->setOperand(9, val); }
  2934. llvm::Value *get_compareVale() const { return Instr->getOperand(10); }
  2935. void set_compareVale(llvm::Value *val) { Instr->setOperand(10, val); }
  2936. };
  2937. /// This instruction gets the position of the specified sample
  2938. struct DxilInst_Texture2DMSGetSamplePosition {
  2939. llvm::Instruction *Instr;
  2940. // Construction and identification
  2941. DxilInst_Texture2DMSGetSamplePosition(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2942. operator bool() const {
  2943. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Texture2DMSGetSamplePosition);
  2944. }
  2945. // Validation support
  2946. bool isAllowed() const { return true; }
  2947. bool isArgumentListValid() const {
  2948. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2949. return true;
  2950. }
  2951. // Metadata
  2952. bool requiresUniformInputs() const { return false; }
  2953. // Operand indexes
  2954. enum OperandIdx {
  2955. arg_srv = 1,
  2956. arg_index = 2,
  2957. };
  2958. // Accessors
  2959. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  2960. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  2961. llvm::Value *get_index() const { return Instr->getOperand(2); }
  2962. void set_index(llvm::Value *val) { Instr->setOperand(2, val); }
  2963. };
  2964. /// This instruction gets the position of the specified sample
  2965. struct DxilInst_RenderTargetGetSamplePosition {
  2966. llvm::Instruction *Instr;
  2967. // Construction and identification
  2968. DxilInst_RenderTargetGetSamplePosition(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2969. operator bool() const {
  2970. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RenderTargetGetSamplePosition);
  2971. }
  2972. // Validation support
  2973. bool isAllowed() const { return true; }
  2974. bool isArgumentListValid() const {
  2975. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  2976. return true;
  2977. }
  2978. // Metadata
  2979. bool requiresUniformInputs() const { return false; }
  2980. // Operand indexes
  2981. enum OperandIdx {
  2982. arg_index = 1,
  2983. };
  2984. // Accessors
  2985. llvm::Value *get_index() const { return Instr->getOperand(1); }
  2986. void set_index(llvm::Value *val) { Instr->setOperand(1, val); }
  2987. };
  2988. /// This instruction gets the number of samples for a render target
  2989. struct DxilInst_RenderTargetGetSampleCount {
  2990. llvm::Instruction *Instr;
  2991. // Construction and identification
  2992. DxilInst_RenderTargetGetSampleCount(llvm::Instruction *pInstr) : Instr(pInstr) {}
  2993. operator bool() const {
  2994. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RenderTargetGetSampleCount);
  2995. }
  2996. // Validation support
  2997. bool isAllowed() const { return true; }
  2998. bool isArgumentListValid() const {
  2999. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3000. return true;
  3001. }
  3002. // Metadata
  3003. bool requiresUniformInputs() const { return false; }
  3004. };
  3005. /// This instruction performs an atomic operation on two operands
  3006. struct DxilInst_AtomicBinOp {
  3007. llvm::Instruction *Instr;
  3008. // Construction and identification
  3009. DxilInst_AtomicBinOp(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3010. operator bool() const {
  3011. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::AtomicBinOp);
  3012. }
  3013. // Validation support
  3014. bool isAllowed() const { return true; }
  3015. bool isArgumentListValid() const {
  3016. if (7 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3017. return true;
  3018. }
  3019. // Metadata
  3020. bool requiresUniformInputs() const { return false; }
  3021. // Operand indexes
  3022. enum OperandIdx {
  3023. arg_handle = 1,
  3024. arg_atomicOp = 2,
  3025. arg_offset0 = 3,
  3026. arg_offset1 = 4,
  3027. arg_offset2 = 5,
  3028. arg_newValue = 6,
  3029. };
  3030. // Accessors
  3031. llvm::Value *get_handle() const { return Instr->getOperand(1); }
  3032. void set_handle(llvm::Value *val) { Instr->setOperand(1, val); }
  3033. llvm::Value *get_atomicOp() const { return Instr->getOperand(2); }
  3034. void set_atomicOp(llvm::Value *val) { Instr->setOperand(2, val); }
  3035. llvm::Value *get_offset0() const { return Instr->getOperand(3); }
  3036. void set_offset0(llvm::Value *val) { Instr->setOperand(3, val); }
  3037. llvm::Value *get_offset1() const { return Instr->getOperand(4); }
  3038. void set_offset1(llvm::Value *val) { Instr->setOperand(4, val); }
  3039. llvm::Value *get_offset2() const { return Instr->getOperand(5); }
  3040. void set_offset2(llvm::Value *val) { Instr->setOperand(5, val); }
  3041. llvm::Value *get_newValue() const { return Instr->getOperand(6); }
  3042. void set_newValue(llvm::Value *val) { Instr->setOperand(6, val); }
  3043. };
  3044. /// This instruction atomic compare and exchange to memory
  3045. struct DxilInst_AtomicCompareExchange {
  3046. llvm::Instruction *Instr;
  3047. // Construction and identification
  3048. DxilInst_AtomicCompareExchange(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3049. operator bool() const {
  3050. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::AtomicCompareExchange);
  3051. }
  3052. // Validation support
  3053. bool isAllowed() const { return true; }
  3054. bool isArgumentListValid() const {
  3055. if (7 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3056. return true;
  3057. }
  3058. // Metadata
  3059. bool requiresUniformInputs() const { return false; }
  3060. // Operand indexes
  3061. enum OperandIdx {
  3062. arg_handle = 1,
  3063. arg_offset0 = 2,
  3064. arg_offset1 = 3,
  3065. arg_offset2 = 4,
  3066. arg_compareValue = 5,
  3067. arg_newValue = 6,
  3068. };
  3069. // Accessors
  3070. llvm::Value *get_handle() const { return Instr->getOperand(1); }
  3071. void set_handle(llvm::Value *val) { Instr->setOperand(1, val); }
  3072. llvm::Value *get_offset0() const { return Instr->getOperand(2); }
  3073. void set_offset0(llvm::Value *val) { Instr->setOperand(2, val); }
  3074. llvm::Value *get_offset1() const { return Instr->getOperand(3); }
  3075. void set_offset1(llvm::Value *val) { Instr->setOperand(3, val); }
  3076. llvm::Value *get_offset2() const { return Instr->getOperand(4); }
  3077. void set_offset2(llvm::Value *val) { Instr->setOperand(4, val); }
  3078. llvm::Value *get_compareValue() const { return Instr->getOperand(5); }
  3079. void set_compareValue(llvm::Value *val) { Instr->setOperand(5, val); }
  3080. llvm::Value *get_newValue() const { return Instr->getOperand(6); }
  3081. void set_newValue(llvm::Value *val) { Instr->setOperand(6, val); }
  3082. };
  3083. /// This instruction inserts a memory barrier in the shader
  3084. struct DxilInst_Barrier {
  3085. llvm::Instruction *Instr;
  3086. // Construction and identification
  3087. DxilInst_Barrier(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3088. operator bool() const {
  3089. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Barrier);
  3090. }
  3091. // Validation support
  3092. bool isAllowed() const { return true; }
  3093. bool isArgumentListValid() const {
  3094. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3095. return true;
  3096. }
  3097. // Metadata
  3098. bool requiresUniformInputs() const { return false; }
  3099. // Operand indexes
  3100. enum OperandIdx {
  3101. arg_barrierMode = 1,
  3102. };
  3103. // Accessors
  3104. llvm::Value *get_barrierMode() const { return Instr->getOperand(1); }
  3105. void set_barrierMode(llvm::Value *val) { Instr->setOperand(1, val); }
  3106. int32_t get_barrierMode_val() const { return (int32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(1))->getZExtValue()); }
  3107. void set_barrierMode_val(int32_t val) { Instr->setOperand(1, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 32), llvm::APInt(32, (uint64_t)val))); }
  3108. };
  3109. /// This instruction calculates the level of detail
  3110. struct DxilInst_CalculateLOD {
  3111. llvm::Instruction *Instr;
  3112. // Construction and identification
  3113. DxilInst_CalculateLOD(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3114. operator bool() const {
  3115. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::CalculateLOD);
  3116. }
  3117. // Validation support
  3118. bool isAllowed() const { return true; }
  3119. bool isArgumentListValid() const {
  3120. if (7 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3121. return true;
  3122. }
  3123. // Metadata
  3124. bool requiresUniformInputs() const { return false; }
  3125. // Operand indexes
  3126. enum OperandIdx {
  3127. arg_handle = 1,
  3128. arg_sampler = 2,
  3129. arg_coord0 = 3,
  3130. arg_coord1 = 4,
  3131. arg_coord2 = 5,
  3132. arg_clamped = 6,
  3133. };
  3134. // Accessors
  3135. llvm::Value *get_handle() const { return Instr->getOperand(1); }
  3136. void set_handle(llvm::Value *val) { Instr->setOperand(1, val); }
  3137. llvm::Value *get_sampler() const { return Instr->getOperand(2); }
  3138. void set_sampler(llvm::Value *val) { Instr->setOperand(2, val); }
  3139. llvm::Value *get_coord0() const { return Instr->getOperand(3); }
  3140. void set_coord0(llvm::Value *val) { Instr->setOperand(3, val); }
  3141. llvm::Value *get_coord1() const { return Instr->getOperand(4); }
  3142. void set_coord1(llvm::Value *val) { Instr->setOperand(4, val); }
  3143. llvm::Value *get_coord2() const { return Instr->getOperand(5); }
  3144. void set_coord2(llvm::Value *val) { Instr->setOperand(5, val); }
  3145. llvm::Value *get_clamped() const { return Instr->getOperand(6); }
  3146. void set_clamped(llvm::Value *val) { Instr->setOperand(6, val); }
  3147. };
  3148. /// This instruction discard the current pixel
  3149. struct DxilInst_Discard {
  3150. llvm::Instruction *Instr;
  3151. // Construction and identification
  3152. DxilInst_Discard(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3153. operator bool() const {
  3154. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Discard);
  3155. }
  3156. // Validation support
  3157. bool isAllowed() const { return true; }
  3158. bool isArgumentListValid() const {
  3159. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3160. return true;
  3161. }
  3162. // Metadata
  3163. bool requiresUniformInputs() const { return false; }
  3164. // Operand indexes
  3165. enum OperandIdx {
  3166. arg_condition = 1,
  3167. };
  3168. // Accessors
  3169. llvm::Value *get_condition() const { return Instr->getOperand(1); }
  3170. void set_condition(llvm::Value *val) { Instr->setOperand(1, val); }
  3171. };
  3172. /// This instruction computes the rate of change per stamp in x direction.
  3173. struct DxilInst_DerivCoarseX {
  3174. llvm::Instruction *Instr;
  3175. // Construction and identification
  3176. DxilInst_DerivCoarseX(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3177. operator bool() const {
  3178. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::DerivCoarseX);
  3179. }
  3180. // Validation support
  3181. bool isAllowed() const { return true; }
  3182. bool isArgumentListValid() const {
  3183. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3184. return true;
  3185. }
  3186. // Metadata
  3187. bool requiresUniformInputs() const { return false; }
  3188. // Operand indexes
  3189. enum OperandIdx {
  3190. arg_value = 1,
  3191. };
  3192. // Accessors
  3193. llvm::Value *get_value() const { return Instr->getOperand(1); }
  3194. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  3195. };
  3196. /// This instruction computes the rate of change per stamp in y direction.
  3197. struct DxilInst_DerivCoarseY {
  3198. llvm::Instruction *Instr;
  3199. // Construction and identification
  3200. DxilInst_DerivCoarseY(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3201. operator bool() const {
  3202. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::DerivCoarseY);
  3203. }
  3204. // Validation support
  3205. bool isAllowed() const { return true; }
  3206. bool isArgumentListValid() const {
  3207. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3208. return true;
  3209. }
  3210. // Metadata
  3211. bool requiresUniformInputs() const { return false; }
  3212. // Operand indexes
  3213. enum OperandIdx {
  3214. arg_value = 1,
  3215. };
  3216. // Accessors
  3217. llvm::Value *get_value() const { return Instr->getOperand(1); }
  3218. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  3219. };
  3220. /// This instruction computes the rate of change per pixel in x direction.
  3221. struct DxilInst_DerivFineX {
  3222. llvm::Instruction *Instr;
  3223. // Construction and identification
  3224. DxilInst_DerivFineX(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3225. operator bool() const {
  3226. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::DerivFineX);
  3227. }
  3228. // Validation support
  3229. bool isAllowed() const { return true; }
  3230. bool isArgumentListValid() const {
  3231. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3232. return true;
  3233. }
  3234. // Metadata
  3235. bool requiresUniformInputs() const { return false; }
  3236. // Operand indexes
  3237. enum OperandIdx {
  3238. arg_value = 1,
  3239. };
  3240. // Accessors
  3241. llvm::Value *get_value() const { return Instr->getOperand(1); }
  3242. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  3243. };
  3244. /// This instruction computes the rate of change per pixel in y direction.
  3245. struct DxilInst_DerivFineY {
  3246. llvm::Instruction *Instr;
  3247. // Construction and identification
  3248. DxilInst_DerivFineY(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3249. operator bool() const {
  3250. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::DerivFineY);
  3251. }
  3252. // Validation support
  3253. bool isAllowed() const { return true; }
  3254. bool isArgumentListValid() const {
  3255. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3256. return true;
  3257. }
  3258. // Metadata
  3259. bool requiresUniformInputs() const { return false; }
  3260. // Operand indexes
  3261. enum OperandIdx {
  3262. arg_value = 1,
  3263. };
  3264. // Accessors
  3265. llvm::Value *get_value() const { return Instr->getOperand(1); }
  3266. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  3267. };
  3268. /// This instruction evaluates an input attribute at pixel center with an offset
  3269. struct DxilInst_EvalSnapped {
  3270. llvm::Instruction *Instr;
  3271. // Construction and identification
  3272. DxilInst_EvalSnapped(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3273. operator bool() const {
  3274. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::EvalSnapped);
  3275. }
  3276. // Validation support
  3277. bool isAllowed() const { return true; }
  3278. bool isArgumentListValid() const {
  3279. if (6 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3280. return true;
  3281. }
  3282. // Metadata
  3283. bool requiresUniformInputs() const { return false; }
  3284. // Operand indexes
  3285. enum OperandIdx {
  3286. arg_inputSigId = 1,
  3287. arg_inputRowIndex = 2,
  3288. arg_inputColIndex = 3,
  3289. arg_offsetX = 4,
  3290. arg_offsetY = 5,
  3291. };
  3292. // Accessors
  3293. llvm::Value *get_inputSigId() const { return Instr->getOperand(1); }
  3294. void set_inputSigId(llvm::Value *val) { Instr->setOperand(1, val); }
  3295. llvm::Value *get_inputRowIndex() const { return Instr->getOperand(2); }
  3296. void set_inputRowIndex(llvm::Value *val) { Instr->setOperand(2, val); }
  3297. llvm::Value *get_inputColIndex() const { return Instr->getOperand(3); }
  3298. void set_inputColIndex(llvm::Value *val) { Instr->setOperand(3, val); }
  3299. llvm::Value *get_offsetX() const { return Instr->getOperand(4); }
  3300. void set_offsetX(llvm::Value *val) { Instr->setOperand(4, val); }
  3301. llvm::Value *get_offsetY() const { return Instr->getOperand(5); }
  3302. void set_offsetY(llvm::Value *val) { Instr->setOperand(5, val); }
  3303. };
  3304. /// This instruction evaluates an input attribute at a sample location
  3305. struct DxilInst_EvalSampleIndex {
  3306. llvm::Instruction *Instr;
  3307. // Construction and identification
  3308. DxilInst_EvalSampleIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3309. operator bool() const {
  3310. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::EvalSampleIndex);
  3311. }
  3312. // Validation support
  3313. bool isAllowed() const { return true; }
  3314. bool isArgumentListValid() const {
  3315. if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3316. return true;
  3317. }
  3318. // Metadata
  3319. bool requiresUniformInputs() const { return false; }
  3320. // Operand indexes
  3321. enum OperandIdx {
  3322. arg_inputSigId = 1,
  3323. arg_inputRowIndex = 2,
  3324. arg_inputColIndex = 3,
  3325. arg_sampleIndex = 4,
  3326. };
  3327. // Accessors
  3328. llvm::Value *get_inputSigId() const { return Instr->getOperand(1); }
  3329. void set_inputSigId(llvm::Value *val) { Instr->setOperand(1, val); }
  3330. llvm::Value *get_inputRowIndex() const { return Instr->getOperand(2); }
  3331. void set_inputRowIndex(llvm::Value *val) { Instr->setOperand(2, val); }
  3332. llvm::Value *get_inputColIndex() const { return Instr->getOperand(3); }
  3333. void set_inputColIndex(llvm::Value *val) { Instr->setOperand(3, val); }
  3334. llvm::Value *get_sampleIndex() const { return Instr->getOperand(4); }
  3335. void set_sampleIndex(llvm::Value *val) { Instr->setOperand(4, val); }
  3336. };
  3337. /// This instruction evaluates an input attribute at pixel center
  3338. struct DxilInst_EvalCentroid {
  3339. llvm::Instruction *Instr;
  3340. // Construction and identification
  3341. DxilInst_EvalCentroid(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3342. operator bool() const {
  3343. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::EvalCentroid);
  3344. }
  3345. // Validation support
  3346. bool isAllowed() const { return true; }
  3347. bool isArgumentListValid() const {
  3348. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3349. return true;
  3350. }
  3351. // Metadata
  3352. bool requiresUniformInputs() const { return false; }
  3353. // Operand indexes
  3354. enum OperandIdx {
  3355. arg_inputSigId = 1,
  3356. arg_inputRowIndex = 2,
  3357. arg_inputColIndex = 3,
  3358. };
  3359. // Accessors
  3360. llvm::Value *get_inputSigId() const { return Instr->getOperand(1); }
  3361. void set_inputSigId(llvm::Value *val) { Instr->setOperand(1, val); }
  3362. llvm::Value *get_inputRowIndex() const { return Instr->getOperand(2); }
  3363. void set_inputRowIndex(llvm::Value *val) { Instr->setOperand(2, val); }
  3364. llvm::Value *get_inputColIndex() const { return Instr->getOperand(3); }
  3365. void set_inputColIndex(llvm::Value *val) { Instr->setOperand(3, val); }
  3366. };
  3367. /// This instruction returns the sample index in a sample-frequency pixel shader
  3368. struct DxilInst_SampleIndex {
  3369. llvm::Instruction *Instr;
  3370. // Construction and identification
  3371. DxilInst_SampleIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3372. operator bool() const {
  3373. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::SampleIndex);
  3374. }
  3375. // Validation support
  3376. bool isAllowed() const { return true; }
  3377. bool isArgumentListValid() const {
  3378. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3379. return true;
  3380. }
  3381. // Metadata
  3382. bool requiresUniformInputs() const { return false; }
  3383. };
  3384. /// This instruction returns the coverage mask input in a pixel shader
  3385. struct DxilInst_Coverage {
  3386. llvm::Instruction *Instr;
  3387. // Construction and identification
  3388. DxilInst_Coverage(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3389. operator bool() const {
  3390. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Coverage);
  3391. }
  3392. // Validation support
  3393. bool isAllowed() const { return true; }
  3394. bool isArgumentListValid() const {
  3395. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3396. return true;
  3397. }
  3398. // Metadata
  3399. bool requiresUniformInputs() const { return false; }
  3400. };
  3401. /// This instruction returns underestimated coverage input from conservative rasterization in a pixel shader
  3402. struct DxilInst_InnerCoverage {
  3403. llvm::Instruction *Instr;
  3404. // Construction and identification
  3405. DxilInst_InnerCoverage(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3406. operator bool() const {
  3407. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::InnerCoverage);
  3408. }
  3409. // Validation support
  3410. bool isAllowed() const { return true; }
  3411. bool isArgumentListValid() const {
  3412. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3413. return true;
  3414. }
  3415. // Metadata
  3416. bool requiresUniformInputs() const { return false; }
  3417. };
  3418. /// This instruction reads the thread ID
  3419. struct DxilInst_ThreadId {
  3420. llvm::Instruction *Instr;
  3421. // Construction and identification
  3422. DxilInst_ThreadId(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3423. operator bool() const {
  3424. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::ThreadId);
  3425. }
  3426. // Validation support
  3427. bool isAllowed() const { return true; }
  3428. bool isArgumentListValid() const {
  3429. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3430. return true;
  3431. }
  3432. // Metadata
  3433. bool requiresUniformInputs() const { return false; }
  3434. // Operand indexes
  3435. enum OperandIdx {
  3436. arg_component = 1,
  3437. };
  3438. // Accessors
  3439. llvm::Value *get_component() const { return Instr->getOperand(1); }
  3440. void set_component(llvm::Value *val) { Instr->setOperand(1, val); }
  3441. };
  3442. /// This instruction reads the group ID (SV_GroupID)
  3443. struct DxilInst_GroupId {
  3444. llvm::Instruction *Instr;
  3445. // Construction and identification
  3446. DxilInst_GroupId(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3447. operator bool() const {
  3448. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::GroupId);
  3449. }
  3450. // Validation support
  3451. bool isAllowed() const { return true; }
  3452. bool isArgumentListValid() const {
  3453. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3454. return true;
  3455. }
  3456. // Metadata
  3457. bool requiresUniformInputs() const { return false; }
  3458. // Operand indexes
  3459. enum OperandIdx {
  3460. arg_component = 1,
  3461. };
  3462. // Accessors
  3463. llvm::Value *get_component() const { return Instr->getOperand(1); }
  3464. void set_component(llvm::Value *val) { Instr->setOperand(1, val); }
  3465. };
  3466. /// This instruction reads the thread ID within the group (SV_GroupThreadID)
  3467. struct DxilInst_ThreadIdInGroup {
  3468. llvm::Instruction *Instr;
  3469. // Construction and identification
  3470. DxilInst_ThreadIdInGroup(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3471. operator bool() const {
  3472. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::ThreadIdInGroup);
  3473. }
  3474. // Validation support
  3475. bool isAllowed() const { return true; }
  3476. bool isArgumentListValid() const {
  3477. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3478. return true;
  3479. }
  3480. // Metadata
  3481. bool requiresUniformInputs() const { return false; }
  3482. // Operand indexes
  3483. enum OperandIdx {
  3484. arg_component = 1,
  3485. };
  3486. // Accessors
  3487. llvm::Value *get_component() const { return Instr->getOperand(1); }
  3488. void set_component(llvm::Value *val) { Instr->setOperand(1, val); }
  3489. };
  3490. /// This instruction provides a flattened index for a given thread within a given group (SV_GroupIndex)
  3491. struct DxilInst_FlattenedThreadIdInGroup {
  3492. llvm::Instruction *Instr;
  3493. // Construction and identification
  3494. DxilInst_FlattenedThreadIdInGroup(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3495. operator bool() const {
  3496. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::FlattenedThreadIdInGroup);
  3497. }
  3498. // Validation support
  3499. bool isAllowed() const { return true; }
  3500. bool isArgumentListValid() const {
  3501. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3502. return true;
  3503. }
  3504. // Metadata
  3505. bool requiresUniformInputs() const { return false; }
  3506. };
  3507. /// This instruction emits a vertex to a given stream
  3508. struct DxilInst_EmitStream {
  3509. llvm::Instruction *Instr;
  3510. // Construction and identification
  3511. DxilInst_EmitStream(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3512. operator bool() const {
  3513. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::EmitStream);
  3514. }
  3515. // Validation support
  3516. bool isAllowed() const { return true; }
  3517. bool isArgumentListValid() const {
  3518. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3519. return true;
  3520. }
  3521. // Metadata
  3522. bool requiresUniformInputs() const { return false; }
  3523. // Operand indexes
  3524. enum OperandIdx {
  3525. arg_streamId = 1,
  3526. };
  3527. // Accessors
  3528. llvm::Value *get_streamId() const { return Instr->getOperand(1); }
  3529. void set_streamId(llvm::Value *val) { Instr->setOperand(1, val); }
  3530. };
  3531. /// This instruction completes the current primitive topology at the specified stream
  3532. struct DxilInst_CutStream {
  3533. llvm::Instruction *Instr;
  3534. // Construction and identification
  3535. DxilInst_CutStream(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3536. operator bool() const {
  3537. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::CutStream);
  3538. }
  3539. // Validation support
  3540. bool isAllowed() const { return true; }
  3541. bool isArgumentListValid() const {
  3542. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3543. return true;
  3544. }
  3545. // Metadata
  3546. bool requiresUniformInputs() const { return false; }
  3547. // Operand indexes
  3548. enum OperandIdx {
  3549. arg_streamId = 1,
  3550. };
  3551. // Accessors
  3552. llvm::Value *get_streamId() const { return Instr->getOperand(1); }
  3553. void set_streamId(llvm::Value *val) { Instr->setOperand(1, val); }
  3554. };
  3555. /// This instruction equivalent to an EmitStream followed by a CutStream
  3556. struct DxilInst_EmitThenCutStream {
  3557. llvm::Instruction *Instr;
  3558. // Construction and identification
  3559. DxilInst_EmitThenCutStream(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3560. operator bool() const {
  3561. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::EmitThenCutStream);
  3562. }
  3563. // Validation support
  3564. bool isAllowed() const { return true; }
  3565. bool isArgumentListValid() const {
  3566. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3567. return true;
  3568. }
  3569. // Metadata
  3570. bool requiresUniformInputs() const { return false; }
  3571. // Operand indexes
  3572. enum OperandIdx {
  3573. arg_streamId = 1,
  3574. };
  3575. // Accessors
  3576. llvm::Value *get_streamId() const { return Instr->getOperand(1); }
  3577. void set_streamId(llvm::Value *val) { Instr->setOperand(1, val); }
  3578. };
  3579. /// This instruction GSInstanceID
  3580. struct DxilInst_GSInstanceID {
  3581. llvm::Instruction *Instr;
  3582. // Construction and identification
  3583. DxilInst_GSInstanceID(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3584. operator bool() const {
  3585. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::GSInstanceID);
  3586. }
  3587. // Validation support
  3588. bool isAllowed() const { return true; }
  3589. bool isArgumentListValid() const {
  3590. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3591. return true;
  3592. }
  3593. // Metadata
  3594. bool requiresUniformInputs() const { return false; }
  3595. };
  3596. /// This instruction creates a double value
  3597. struct DxilInst_MakeDouble {
  3598. llvm::Instruction *Instr;
  3599. // Construction and identification
  3600. DxilInst_MakeDouble(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3601. operator bool() const {
  3602. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::MakeDouble);
  3603. }
  3604. // Validation support
  3605. bool isAllowed() const { return true; }
  3606. bool isArgumentListValid() const {
  3607. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3608. return true;
  3609. }
  3610. // Metadata
  3611. bool requiresUniformInputs() const { return false; }
  3612. // Operand indexes
  3613. enum OperandIdx {
  3614. arg_lo = 1,
  3615. arg_hi = 2,
  3616. };
  3617. // Accessors
  3618. llvm::Value *get_lo() const { return Instr->getOperand(1); }
  3619. void set_lo(llvm::Value *val) { Instr->setOperand(1, val); }
  3620. llvm::Value *get_hi() const { return Instr->getOperand(2); }
  3621. void set_hi(llvm::Value *val) { Instr->setOperand(2, val); }
  3622. };
  3623. /// This instruction splits a double into low and high parts
  3624. struct DxilInst_SplitDouble {
  3625. llvm::Instruction *Instr;
  3626. // Construction and identification
  3627. DxilInst_SplitDouble(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3628. operator bool() const {
  3629. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::SplitDouble);
  3630. }
  3631. // Validation support
  3632. bool isAllowed() const { return true; }
  3633. bool isArgumentListValid() const {
  3634. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3635. return true;
  3636. }
  3637. // Metadata
  3638. bool requiresUniformInputs() const { return false; }
  3639. // Operand indexes
  3640. enum OperandIdx {
  3641. arg_value = 1,
  3642. };
  3643. // Accessors
  3644. llvm::Value *get_value() const { return Instr->getOperand(1); }
  3645. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  3646. };
  3647. /// This instruction LoadOutputControlPoint
  3648. struct DxilInst_LoadOutputControlPoint {
  3649. llvm::Instruction *Instr;
  3650. // Construction and identification
  3651. DxilInst_LoadOutputControlPoint(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3652. operator bool() const {
  3653. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::LoadOutputControlPoint);
  3654. }
  3655. // Validation support
  3656. bool isAllowed() const { return true; }
  3657. bool isArgumentListValid() const {
  3658. if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3659. return true;
  3660. }
  3661. // Metadata
  3662. bool requiresUniformInputs() const { return false; }
  3663. // Operand indexes
  3664. enum OperandIdx {
  3665. arg_inputSigId = 1,
  3666. arg_row = 2,
  3667. arg_col = 3,
  3668. arg_index = 4,
  3669. };
  3670. // Accessors
  3671. llvm::Value *get_inputSigId() const { return Instr->getOperand(1); }
  3672. void set_inputSigId(llvm::Value *val) { Instr->setOperand(1, val); }
  3673. llvm::Value *get_row() const { return Instr->getOperand(2); }
  3674. void set_row(llvm::Value *val) { Instr->setOperand(2, val); }
  3675. llvm::Value *get_col() const { return Instr->getOperand(3); }
  3676. void set_col(llvm::Value *val) { Instr->setOperand(3, val); }
  3677. llvm::Value *get_index() const { return Instr->getOperand(4); }
  3678. void set_index(llvm::Value *val) { Instr->setOperand(4, val); }
  3679. };
  3680. /// This instruction LoadPatchConstant
  3681. struct DxilInst_LoadPatchConstant {
  3682. llvm::Instruction *Instr;
  3683. // Construction and identification
  3684. DxilInst_LoadPatchConstant(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3685. operator bool() const {
  3686. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::LoadPatchConstant);
  3687. }
  3688. // Validation support
  3689. bool isAllowed() const { return true; }
  3690. bool isArgumentListValid() const {
  3691. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3692. return true;
  3693. }
  3694. // Metadata
  3695. bool requiresUniformInputs() const { return false; }
  3696. // Operand indexes
  3697. enum OperandIdx {
  3698. arg_inputSigId = 1,
  3699. arg_row = 2,
  3700. arg_col = 3,
  3701. };
  3702. // Accessors
  3703. llvm::Value *get_inputSigId() const { return Instr->getOperand(1); }
  3704. void set_inputSigId(llvm::Value *val) { Instr->setOperand(1, val); }
  3705. llvm::Value *get_row() const { return Instr->getOperand(2); }
  3706. void set_row(llvm::Value *val) { Instr->setOperand(2, val); }
  3707. llvm::Value *get_col() const { return Instr->getOperand(3); }
  3708. void set_col(llvm::Value *val) { Instr->setOperand(3, val); }
  3709. };
  3710. /// This instruction DomainLocation
  3711. struct DxilInst_DomainLocation {
  3712. llvm::Instruction *Instr;
  3713. // Construction and identification
  3714. DxilInst_DomainLocation(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3715. operator bool() const {
  3716. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::DomainLocation);
  3717. }
  3718. // Validation support
  3719. bool isAllowed() const { return true; }
  3720. bool isArgumentListValid() const {
  3721. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3722. return true;
  3723. }
  3724. // Metadata
  3725. bool requiresUniformInputs() const { return false; }
  3726. // Operand indexes
  3727. enum OperandIdx {
  3728. arg_component = 1,
  3729. };
  3730. // Accessors
  3731. llvm::Value *get_component() const { return Instr->getOperand(1); }
  3732. void set_component(llvm::Value *val) { Instr->setOperand(1, val); }
  3733. int8_t get_component_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(1))->getZExtValue()); }
  3734. void set_component_val(int8_t val) { Instr->setOperand(1, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  3735. };
  3736. /// This instruction StorePatchConstant
  3737. struct DxilInst_StorePatchConstant {
  3738. llvm::Instruction *Instr;
  3739. // Construction and identification
  3740. DxilInst_StorePatchConstant(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3741. operator bool() const {
  3742. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::StorePatchConstant);
  3743. }
  3744. // Validation support
  3745. bool isAllowed() const { return true; }
  3746. bool isArgumentListValid() const {
  3747. if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3748. return true;
  3749. }
  3750. // Metadata
  3751. bool requiresUniformInputs() const { return false; }
  3752. // Operand indexes
  3753. enum OperandIdx {
  3754. arg_outputSigID = 1,
  3755. arg_row = 2,
  3756. arg_col = 3,
  3757. arg_value = 4,
  3758. };
  3759. // Accessors
  3760. llvm::Value *get_outputSigID() const { return Instr->getOperand(1); }
  3761. void set_outputSigID(llvm::Value *val) { Instr->setOperand(1, val); }
  3762. llvm::Value *get_row() const { return Instr->getOperand(2); }
  3763. void set_row(llvm::Value *val) { Instr->setOperand(2, val); }
  3764. llvm::Value *get_col() const { return Instr->getOperand(3); }
  3765. void set_col(llvm::Value *val) { Instr->setOperand(3, val); }
  3766. llvm::Value *get_value() const { return Instr->getOperand(4); }
  3767. void set_value(llvm::Value *val) { Instr->setOperand(4, val); }
  3768. };
  3769. /// This instruction OutputControlPointID
  3770. struct DxilInst_OutputControlPointID {
  3771. llvm::Instruction *Instr;
  3772. // Construction and identification
  3773. DxilInst_OutputControlPointID(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3774. operator bool() const {
  3775. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::OutputControlPointID);
  3776. }
  3777. // Validation support
  3778. bool isAllowed() const { return true; }
  3779. bool isArgumentListValid() const {
  3780. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3781. return true;
  3782. }
  3783. // Metadata
  3784. bool requiresUniformInputs() const { return false; }
  3785. };
  3786. /// This instruction PrimitiveID
  3787. struct DxilInst_PrimitiveID {
  3788. llvm::Instruction *Instr;
  3789. // Construction and identification
  3790. DxilInst_PrimitiveID(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3791. operator bool() const {
  3792. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::PrimitiveID);
  3793. }
  3794. // Validation support
  3795. bool isAllowed() const { return true; }
  3796. bool isArgumentListValid() const {
  3797. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3798. return true;
  3799. }
  3800. // Metadata
  3801. bool requiresUniformInputs() const { return false; }
  3802. };
  3803. /// This instruction CycleCounterLegacy
  3804. struct DxilInst_CycleCounterLegacy {
  3805. llvm::Instruction *Instr;
  3806. // Construction and identification
  3807. DxilInst_CycleCounterLegacy(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3808. operator bool() const {
  3809. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::CycleCounterLegacy);
  3810. }
  3811. // Validation support
  3812. bool isAllowed() const { return true; }
  3813. bool isArgumentListValid() const {
  3814. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3815. return true;
  3816. }
  3817. // Metadata
  3818. bool requiresUniformInputs() const { return false; }
  3819. };
  3820. /// This instruction returns 1 for the first lane in the wave
  3821. struct DxilInst_WaveIsFirstLane {
  3822. llvm::Instruction *Instr;
  3823. // Construction and identification
  3824. DxilInst_WaveIsFirstLane(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3825. operator bool() const {
  3826. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveIsFirstLane);
  3827. }
  3828. // Validation support
  3829. bool isAllowed() const { return true; }
  3830. bool isArgumentListValid() const {
  3831. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3832. return true;
  3833. }
  3834. // Metadata
  3835. bool requiresUniformInputs() const { return false; }
  3836. };
  3837. /// This instruction returns the index of the current lane in the wave
  3838. struct DxilInst_WaveGetLaneIndex {
  3839. llvm::Instruction *Instr;
  3840. // Construction and identification
  3841. DxilInst_WaveGetLaneIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3842. operator bool() const {
  3843. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveGetLaneIndex);
  3844. }
  3845. // Validation support
  3846. bool isAllowed() const { return true; }
  3847. bool isArgumentListValid() const {
  3848. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3849. return true;
  3850. }
  3851. // Metadata
  3852. bool requiresUniformInputs() const { return false; }
  3853. };
  3854. /// This instruction returns the number of lanes in the wave
  3855. struct DxilInst_WaveGetLaneCount {
  3856. llvm::Instruction *Instr;
  3857. // Construction and identification
  3858. DxilInst_WaveGetLaneCount(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3859. operator bool() const {
  3860. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveGetLaneCount);
  3861. }
  3862. // Validation support
  3863. bool isAllowed() const { return true; }
  3864. bool isArgumentListValid() const {
  3865. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3866. return true;
  3867. }
  3868. // Metadata
  3869. bool requiresUniformInputs() const { return false; }
  3870. };
  3871. /// This instruction returns 1 if any of the lane evaluates the value to true
  3872. struct DxilInst_WaveAnyTrue {
  3873. llvm::Instruction *Instr;
  3874. // Construction and identification
  3875. DxilInst_WaveAnyTrue(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3876. operator bool() const {
  3877. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveAnyTrue);
  3878. }
  3879. // Validation support
  3880. bool isAllowed() const { return true; }
  3881. bool isArgumentListValid() const {
  3882. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3883. return true;
  3884. }
  3885. // Metadata
  3886. bool requiresUniformInputs() const { return false; }
  3887. // Operand indexes
  3888. enum OperandIdx {
  3889. arg_cond = 1,
  3890. };
  3891. // Accessors
  3892. llvm::Value *get_cond() const { return Instr->getOperand(1); }
  3893. void set_cond(llvm::Value *val) { Instr->setOperand(1, val); }
  3894. };
  3895. /// This instruction returns 1 if all the lanes evaluate the value to true
  3896. struct DxilInst_WaveAllTrue {
  3897. llvm::Instruction *Instr;
  3898. // Construction and identification
  3899. DxilInst_WaveAllTrue(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3900. operator bool() const {
  3901. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveAllTrue);
  3902. }
  3903. // Validation support
  3904. bool isAllowed() const { return true; }
  3905. bool isArgumentListValid() const {
  3906. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3907. return true;
  3908. }
  3909. // Metadata
  3910. bool requiresUniformInputs() const { return false; }
  3911. // Operand indexes
  3912. enum OperandIdx {
  3913. arg_cond = 1,
  3914. };
  3915. // Accessors
  3916. llvm::Value *get_cond() const { return Instr->getOperand(1); }
  3917. void set_cond(llvm::Value *val) { Instr->setOperand(1, val); }
  3918. };
  3919. /// This instruction returns 1 if all the lanes have the same value
  3920. struct DxilInst_WaveActiveAllEqual {
  3921. llvm::Instruction *Instr;
  3922. // Construction and identification
  3923. DxilInst_WaveActiveAllEqual(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3924. operator bool() const {
  3925. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveActiveAllEqual);
  3926. }
  3927. // Validation support
  3928. bool isAllowed() const { return true; }
  3929. bool isArgumentListValid() const {
  3930. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3931. return true;
  3932. }
  3933. // Metadata
  3934. bool requiresUniformInputs() const { return false; }
  3935. // Operand indexes
  3936. enum OperandIdx {
  3937. arg_value = 1,
  3938. };
  3939. // Accessors
  3940. llvm::Value *get_value() const { return Instr->getOperand(1); }
  3941. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  3942. };
  3943. /// This instruction returns a struct with a bit set for each lane where the condition is true
  3944. struct DxilInst_WaveActiveBallot {
  3945. llvm::Instruction *Instr;
  3946. // Construction and identification
  3947. DxilInst_WaveActiveBallot(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3948. operator bool() const {
  3949. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveActiveBallot);
  3950. }
  3951. // Validation support
  3952. bool isAllowed() const { return true; }
  3953. bool isArgumentListValid() const {
  3954. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3955. return true;
  3956. }
  3957. // Metadata
  3958. bool requiresUniformInputs() const { return false; }
  3959. // Operand indexes
  3960. enum OperandIdx {
  3961. arg_cond = 1,
  3962. };
  3963. // Accessors
  3964. llvm::Value *get_cond() const { return Instr->getOperand(1); }
  3965. void set_cond(llvm::Value *val) { Instr->setOperand(1, val); }
  3966. };
  3967. /// This instruction returns the value from the specified lane
  3968. struct DxilInst_WaveReadLaneAt {
  3969. llvm::Instruction *Instr;
  3970. // Construction and identification
  3971. DxilInst_WaveReadLaneAt(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3972. operator bool() const {
  3973. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveReadLaneAt);
  3974. }
  3975. // Validation support
  3976. bool isAllowed() const { return true; }
  3977. bool isArgumentListValid() const {
  3978. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  3979. return true;
  3980. }
  3981. // Metadata
  3982. bool requiresUniformInputs() const { return false; }
  3983. // Operand indexes
  3984. enum OperandIdx {
  3985. arg_value = 1,
  3986. arg_lane = 2,
  3987. };
  3988. // Accessors
  3989. llvm::Value *get_value() const { return Instr->getOperand(1); }
  3990. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  3991. llvm::Value *get_lane() const { return Instr->getOperand(2); }
  3992. void set_lane(llvm::Value *val) { Instr->setOperand(2, val); }
  3993. };
  3994. /// This instruction returns the value from the first lane
  3995. struct DxilInst_WaveReadLaneFirst {
  3996. llvm::Instruction *Instr;
  3997. // Construction and identification
  3998. DxilInst_WaveReadLaneFirst(llvm::Instruction *pInstr) : Instr(pInstr) {}
  3999. operator bool() const {
  4000. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveReadLaneFirst);
  4001. }
  4002. // Validation support
  4003. bool isAllowed() const { return true; }
  4004. bool isArgumentListValid() const {
  4005. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4006. return true;
  4007. }
  4008. // Metadata
  4009. bool requiresUniformInputs() const { return false; }
  4010. // Operand indexes
  4011. enum OperandIdx {
  4012. arg_value = 1,
  4013. };
  4014. // Accessors
  4015. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4016. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4017. };
  4018. /// This instruction returns the result the operation across waves
  4019. struct DxilInst_WaveActiveOp {
  4020. llvm::Instruction *Instr;
  4021. // Construction and identification
  4022. DxilInst_WaveActiveOp(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4023. operator bool() const {
  4024. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveActiveOp);
  4025. }
  4026. // Validation support
  4027. bool isAllowed() const { return true; }
  4028. bool isArgumentListValid() const {
  4029. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4030. return true;
  4031. }
  4032. // Metadata
  4033. bool requiresUniformInputs() const { return false; }
  4034. // Operand indexes
  4035. enum OperandIdx {
  4036. arg_value = 1,
  4037. arg_op = 2,
  4038. arg_sop = 3,
  4039. };
  4040. // Accessors
  4041. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4042. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4043. llvm::Value *get_op() const { return Instr->getOperand(2); }
  4044. void set_op(llvm::Value *val) { Instr->setOperand(2, val); }
  4045. int8_t get_op_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  4046. void set_op_val(int8_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  4047. llvm::Value *get_sop() const { return Instr->getOperand(3); }
  4048. void set_sop(llvm::Value *val) { Instr->setOperand(3, val); }
  4049. int8_t get_sop_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(3))->getZExtValue()); }
  4050. void set_sop_val(int8_t val) { Instr->setOperand(3, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  4051. };
  4052. /// This instruction returns the result of the operation across all lanes
  4053. struct DxilInst_WaveActiveBit {
  4054. llvm::Instruction *Instr;
  4055. // Construction and identification
  4056. DxilInst_WaveActiveBit(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4057. operator bool() const {
  4058. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveActiveBit);
  4059. }
  4060. // Validation support
  4061. bool isAllowed() const { return true; }
  4062. bool isArgumentListValid() const {
  4063. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4064. return true;
  4065. }
  4066. // Metadata
  4067. bool requiresUniformInputs() const { return false; }
  4068. // Operand indexes
  4069. enum OperandIdx {
  4070. arg_value = 1,
  4071. arg_op = 2,
  4072. };
  4073. // Accessors
  4074. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4075. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4076. llvm::Value *get_op() const { return Instr->getOperand(2); }
  4077. void set_op(llvm::Value *val) { Instr->setOperand(2, val); }
  4078. int8_t get_op_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  4079. void set_op_val(int8_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  4080. };
  4081. /// This instruction returns the result of the operation on prior lanes
  4082. struct DxilInst_WavePrefixOp {
  4083. llvm::Instruction *Instr;
  4084. // Construction and identification
  4085. DxilInst_WavePrefixOp(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4086. operator bool() const {
  4087. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WavePrefixOp);
  4088. }
  4089. // Validation support
  4090. bool isAllowed() const { return true; }
  4091. bool isArgumentListValid() const {
  4092. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4093. return true;
  4094. }
  4095. // Metadata
  4096. bool requiresUniformInputs() const { return false; }
  4097. // Operand indexes
  4098. enum OperandIdx {
  4099. arg_value = 1,
  4100. arg_op = 2,
  4101. arg_sop = 3,
  4102. };
  4103. // Accessors
  4104. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4105. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4106. llvm::Value *get_op() const { return Instr->getOperand(2); }
  4107. void set_op(llvm::Value *val) { Instr->setOperand(2, val); }
  4108. int8_t get_op_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  4109. void set_op_val(int8_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  4110. llvm::Value *get_sop() const { return Instr->getOperand(3); }
  4111. void set_sop(llvm::Value *val) { Instr->setOperand(3, val); }
  4112. int8_t get_sop_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(3))->getZExtValue()); }
  4113. void set_sop_val(int8_t val) { Instr->setOperand(3, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  4114. };
  4115. /// This instruction reads from a lane in the quad
  4116. struct DxilInst_QuadReadLaneAt {
  4117. llvm::Instruction *Instr;
  4118. // Construction and identification
  4119. DxilInst_QuadReadLaneAt(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4120. operator bool() const {
  4121. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::QuadReadLaneAt);
  4122. }
  4123. // Validation support
  4124. bool isAllowed() const { return true; }
  4125. bool isArgumentListValid() const {
  4126. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4127. return true;
  4128. }
  4129. // Metadata
  4130. bool requiresUniformInputs() const { return false; }
  4131. // Operand indexes
  4132. enum OperandIdx {
  4133. arg_value = 1,
  4134. arg_quadLane = 2,
  4135. };
  4136. // Accessors
  4137. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4138. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4139. llvm::Value *get_quadLane() const { return Instr->getOperand(2); }
  4140. void set_quadLane(llvm::Value *val) { Instr->setOperand(2, val); }
  4141. uint32_t get_quadLane_val() const { return (uint32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  4142. void set_quadLane_val(uint32_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 32), llvm::APInt(32, (uint64_t)val))); }
  4143. };
  4144. /// This instruction returns the result of a quad-level operation
  4145. struct DxilInst_QuadOp {
  4146. llvm::Instruction *Instr;
  4147. // Construction and identification
  4148. DxilInst_QuadOp(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4149. operator bool() const {
  4150. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::QuadOp);
  4151. }
  4152. // Validation support
  4153. bool isAllowed() const { return true; }
  4154. bool isArgumentListValid() const {
  4155. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4156. return true;
  4157. }
  4158. // Metadata
  4159. bool requiresUniformInputs() const { return false; }
  4160. // Operand indexes
  4161. enum OperandIdx {
  4162. arg_value = 1,
  4163. arg_op = 2,
  4164. };
  4165. // Accessors
  4166. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4167. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4168. llvm::Value *get_op() const { return Instr->getOperand(2); }
  4169. void set_op(llvm::Value *val) { Instr->setOperand(2, val); }
  4170. int8_t get_op_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  4171. void set_op_val(int8_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  4172. };
  4173. /// This instruction bitcast between different sizes
  4174. struct DxilInst_BitcastI16toF16 {
  4175. llvm::Instruction *Instr;
  4176. // Construction and identification
  4177. DxilInst_BitcastI16toF16(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4178. operator bool() const {
  4179. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::BitcastI16toF16);
  4180. }
  4181. // Validation support
  4182. bool isAllowed() const { return true; }
  4183. bool isArgumentListValid() const {
  4184. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4185. return true;
  4186. }
  4187. // Metadata
  4188. bool requiresUniformInputs() const { return false; }
  4189. // Operand indexes
  4190. enum OperandIdx {
  4191. arg_value = 1,
  4192. };
  4193. // Accessors
  4194. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4195. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4196. };
  4197. /// This instruction bitcast between different sizes
  4198. struct DxilInst_BitcastF16toI16 {
  4199. llvm::Instruction *Instr;
  4200. // Construction and identification
  4201. DxilInst_BitcastF16toI16(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4202. operator bool() const {
  4203. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::BitcastF16toI16);
  4204. }
  4205. // Validation support
  4206. bool isAllowed() const { return true; }
  4207. bool isArgumentListValid() const {
  4208. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4209. return true;
  4210. }
  4211. // Metadata
  4212. bool requiresUniformInputs() const { return false; }
  4213. // Operand indexes
  4214. enum OperandIdx {
  4215. arg_value = 1,
  4216. };
  4217. // Accessors
  4218. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4219. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4220. };
  4221. /// This instruction bitcast between different sizes
  4222. struct DxilInst_BitcastI32toF32 {
  4223. llvm::Instruction *Instr;
  4224. // Construction and identification
  4225. DxilInst_BitcastI32toF32(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4226. operator bool() const {
  4227. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::BitcastI32toF32);
  4228. }
  4229. // Validation support
  4230. bool isAllowed() const { return true; }
  4231. bool isArgumentListValid() const {
  4232. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4233. return true;
  4234. }
  4235. // Metadata
  4236. bool requiresUniformInputs() const { return false; }
  4237. // Operand indexes
  4238. enum OperandIdx {
  4239. arg_value = 1,
  4240. };
  4241. // Accessors
  4242. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4243. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4244. };
  4245. /// This instruction bitcast between different sizes
  4246. struct DxilInst_BitcastF32toI32 {
  4247. llvm::Instruction *Instr;
  4248. // Construction and identification
  4249. DxilInst_BitcastF32toI32(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4250. operator bool() const {
  4251. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::BitcastF32toI32);
  4252. }
  4253. // Validation support
  4254. bool isAllowed() const { return true; }
  4255. bool isArgumentListValid() const {
  4256. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4257. return true;
  4258. }
  4259. // Metadata
  4260. bool requiresUniformInputs() const { return false; }
  4261. // Operand indexes
  4262. enum OperandIdx {
  4263. arg_value = 1,
  4264. };
  4265. // Accessors
  4266. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4267. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4268. };
  4269. /// This instruction bitcast between different sizes
  4270. struct DxilInst_BitcastI64toF64 {
  4271. llvm::Instruction *Instr;
  4272. // Construction and identification
  4273. DxilInst_BitcastI64toF64(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4274. operator bool() const {
  4275. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::BitcastI64toF64);
  4276. }
  4277. // Validation support
  4278. bool isAllowed() const { return true; }
  4279. bool isArgumentListValid() const {
  4280. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4281. return true;
  4282. }
  4283. // Metadata
  4284. bool requiresUniformInputs() const { return false; }
  4285. // Operand indexes
  4286. enum OperandIdx {
  4287. arg_value = 1,
  4288. };
  4289. // Accessors
  4290. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4291. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4292. };
  4293. /// This instruction bitcast between different sizes
  4294. struct DxilInst_BitcastF64toI64 {
  4295. llvm::Instruction *Instr;
  4296. // Construction and identification
  4297. DxilInst_BitcastF64toI64(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4298. operator bool() const {
  4299. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::BitcastF64toI64);
  4300. }
  4301. // Validation support
  4302. bool isAllowed() const { return true; }
  4303. bool isArgumentListValid() const {
  4304. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4305. return true;
  4306. }
  4307. // Metadata
  4308. bool requiresUniformInputs() const { return false; }
  4309. // Operand indexes
  4310. enum OperandIdx {
  4311. arg_value = 1,
  4312. };
  4313. // Accessors
  4314. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4315. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4316. };
  4317. /// This instruction legacy fuction to convert float (f32) to half (f16) (this is not related to min-precision)
  4318. struct DxilInst_LegacyF32ToF16 {
  4319. llvm::Instruction *Instr;
  4320. // Construction and identification
  4321. DxilInst_LegacyF32ToF16(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4322. operator bool() const {
  4323. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::LegacyF32ToF16);
  4324. }
  4325. // Validation support
  4326. bool isAllowed() const { return true; }
  4327. bool isArgumentListValid() const {
  4328. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4329. return true;
  4330. }
  4331. // Metadata
  4332. bool requiresUniformInputs() const { return false; }
  4333. // Operand indexes
  4334. enum OperandIdx {
  4335. arg_value = 1,
  4336. };
  4337. // Accessors
  4338. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4339. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4340. };
  4341. /// This instruction legacy fuction to convert half (f16) to float (f32) (this is not related to min-precision)
  4342. struct DxilInst_LegacyF16ToF32 {
  4343. llvm::Instruction *Instr;
  4344. // Construction and identification
  4345. DxilInst_LegacyF16ToF32(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4346. operator bool() const {
  4347. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::LegacyF16ToF32);
  4348. }
  4349. // Validation support
  4350. bool isAllowed() const { return true; }
  4351. bool isArgumentListValid() const {
  4352. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4353. return true;
  4354. }
  4355. // Metadata
  4356. bool requiresUniformInputs() const { return false; }
  4357. // Operand indexes
  4358. enum OperandIdx {
  4359. arg_value = 1,
  4360. };
  4361. // Accessors
  4362. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4363. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4364. };
  4365. /// This instruction legacy fuction to convert double to float
  4366. struct DxilInst_LegacyDoubleToFloat {
  4367. llvm::Instruction *Instr;
  4368. // Construction and identification
  4369. DxilInst_LegacyDoubleToFloat(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4370. operator bool() const {
  4371. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::LegacyDoubleToFloat);
  4372. }
  4373. // Validation support
  4374. bool isAllowed() const { return true; }
  4375. bool isArgumentListValid() const {
  4376. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4377. return true;
  4378. }
  4379. // Metadata
  4380. bool requiresUniformInputs() const { return false; }
  4381. // Operand indexes
  4382. enum OperandIdx {
  4383. arg_value = 1,
  4384. };
  4385. // Accessors
  4386. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4387. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4388. };
  4389. /// This instruction legacy fuction to convert double to int32
  4390. struct DxilInst_LegacyDoubleToSInt32 {
  4391. llvm::Instruction *Instr;
  4392. // Construction and identification
  4393. DxilInst_LegacyDoubleToSInt32(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4394. operator bool() const {
  4395. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::LegacyDoubleToSInt32);
  4396. }
  4397. // Validation support
  4398. bool isAllowed() const { return true; }
  4399. bool isArgumentListValid() const {
  4400. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4401. return true;
  4402. }
  4403. // Metadata
  4404. bool requiresUniformInputs() const { return false; }
  4405. // Operand indexes
  4406. enum OperandIdx {
  4407. arg_value = 1,
  4408. };
  4409. // Accessors
  4410. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4411. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4412. };
  4413. /// This instruction legacy fuction to convert double to uint32
  4414. struct DxilInst_LegacyDoubleToUInt32 {
  4415. llvm::Instruction *Instr;
  4416. // Construction and identification
  4417. DxilInst_LegacyDoubleToUInt32(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4418. operator bool() const {
  4419. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::LegacyDoubleToUInt32);
  4420. }
  4421. // Validation support
  4422. bool isAllowed() const { return true; }
  4423. bool isArgumentListValid() const {
  4424. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4425. return true;
  4426. }
  4427. // Metadata
  4428. bool requiresUniformInputs() const { return false; }
  4429. // Operand indexes
  4430. enum OperandIdx {
  4431. arg_value = 1,
  4432. };
  4433. // Accessors
  4434. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4435. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4436. };
  4437. /// This instruction returns the count of bits set to 1 across the wave
  4438. struct DxilInst_WaveAllBitCount {
  4439. llvm::Instruction *Instr;
  4440. // Construction and identification
  4441. DxilInst_WaveAllBitCount(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4442. operator bool() const {
  4443. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveAllBitCount);
  4444. }
  4445. // Validation support
  4446. bool isAllowed() const { return true; }
  4447. bool isArgumentListValid() const {
  4448. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4449. return true;
  4450. }
  4451. // Metadata
  4452. bool requiresUniformInputs() const { return false; }
  4453. // Operand indexes
  4454. enum OperandIdx {
  4455. arg_value = 1,
  4456. };
  4457. // Accessors
  4458. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4459. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4460. };
  4461. /// This instruction returns the count of bits set to 1 on prior lanes
  4462. struct DxilInst_WavePrefixBitCount {
  4463. llvm::Instruction *Instr;
  4464. // Construction and identification
  4465. DxilInst_WavePrefixBitCount(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4466. operator bool() const {
  4467. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WavePrefixBitCount);
  4468. }
  4469. // Validation support
  4470. bool isAllowed() const { return true; }
  4471. bool isArgumentListValid() const {
  4472. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4473. return true;
  4474. }
  4475. // Metadata
  4476. bool requiresUniformInputs() const { return false; }
  4477. // Operand indexes
  4478. enum OperandIdx {
  4479. arg_value = 1,
  4480. };
  4481. // Accessors
  4482. llvm::Value *get_value() const { return Instr->getOperand(1); }
  4483. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  4484. };
  4485. /// This instruction returns the values of the attributes at the vertex.
  4486. struct DxilInst_AttributeAtVertex {
  4487. llvm::Instruction *Instr;
  4488. // Construction and identification
  4489. DxilInst_AttributeAtVertex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4490. operator bool() const {
  4491. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::AttributeAtVertex);
  4492. }
  4493. // Validation support
  4494. bool isAllowed() const { return true; }
  4495. bool isArgumentListValid() const {
  4496. if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4497. return true;
  4498. }
  4499. // Metadata
  4500. bool requiresUniformInputs() const { return false; }
  4501. // Operand indexes
  4502. enum OperandIdx {
  4503. arg_inputSigId = 1,
  4504. arg_inputRowIndex = 2,
  4505. arg_inputColIndex = 3,
  4506. arg_VertexID = 4,
  4507. };
  4508. // Accessors
  4509. llvm::Value *get_inputSigId() const { return Instr->getOperand(1); }
  4510. void set_inputSigId(llvm::Value *val) { Instr->setOperand(1, val); }
  4511. llvm::Value *get_inputRowIndex() const { return Instr->getOperand(2); }
  4512. void set_inputRowIndex(llvm::Value *val) { Instr->setOperand(2, val); }
  4513. llvm::Value *get_inputColIndex() const { return Instr->getOperand(3); }
  4514. void set_inputColIndex(llvm::Value *val) { Instr->setOperand(3, val); }
  4515. llvm::Value *get_VertexID() const { return Instr->getOperand(4); }
  4516. void set_VertexID(llvm::Value *val) { Instr->setOperand(4, val); }
  4517. };
  4518. /// This instruction returns the view index
  4519. struct DxilInst_ViewID {
  4520. llvm::Instruction *Instr;
  4521. // Construction and identification
  4522. DxilInst_ViewID(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4523. operator bool() const {
  4524. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::ViewID);
  4525. }
  4526. // Validation support
  4527. bool isAllowed() const { return true; }
  4528. bool isArgumentListValid() const {
  4529. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4530. return true;
  4531. }
  4532. // Metadata
  4533. bool requiresUniformInputs() const { return false; }
  4534. };
  4535. /// This instruction reads from a raw buffer and structured buffer
  4536. struct DxilInst_RawBufferLoad {
  4537. llvm::Instruction *Instr;
  4538. // Construction and identification
  4539. DxilInst_RawBufferLoad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4540. operator bool() const {
  4541. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RawBufferLoad);
  4542. }
  4543. // Validation support
  4544. bool isAllowed() const { return true; }
  4545. bool isArgumentListValid() const {
  4546. if (6 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4547. return true;
  4548. }
  4549. // Metadata
  4550. bool requiresUniformInputs() const { return false; }
  4551. // Operand indexes
  4552. enum OperandIdx {
  4553. arg_srv = 1,
  4554. arg_index = 2,
  4555. arg_elementOffset = 3,
  4556. arg_mask = 4,
  4557. arg_alignment = 5,
  4558. };
  4559. // Accessors
  4560. llvm::Value *get_srv() const { return Instr->getOperand(1); }
  4561. void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
  4562. llvm::Value *get_index() const { return Instr->getOperand(2); }
  4563. void set_index(llvm::Value *val) { Instr->setOperand(2, val); }
  4564. llvm::Value *get_elementOffset() const { return Instr->getOperand(3); }
  4565. void set_elementOffset(llvm::Value *val) { Instr->setOperand(3, val); }
  4566. llvm::Value *get_mask() const { return Instr->getOperand(4); }
  4567. void set_mask(llvm::Value *val) { Instr->setOperand(4, val); }
  4568. int8_t get_mask_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(4))->getZExtValue()); }
  4569. void set_mask_val(int8_t val) { Instr->setOperand(4, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  4570. llvm::Value *get_alignment() const { return Instr->getOperand(5); }
  4571. void set_alignment(llvm::Value *val) { Instr->setOperand(5, val); }
  4572. int32_t get_alignment_val() const { return (int32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(5))->getZExtValue()); }
  4573. void set_alignment_val(int32_t val) { Instr->setOperand(5, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 32), llvm::APInt(32, (uint64_t)val))); }
  4574. };
  4575. /// This instruction writes to a RWByteAddressBuffer or RWStructuredBuffer
  4576. struct DxilInst_RawBufferStore {
  4577. llvm::Instruction *Instr;
  4578. // Construction and identification
  4579. DxilInst_RawBufferStore(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4580. operator bool() const {
  4581. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RawBufferStore);
  4582. }
  4583. // Validation support
  4584. bool isAllowed() const { return true; }
  4585. bool isArgumentListValid() const {
  4586. if (10 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4587. return true;
  4588. }
  4589. // Metadata
  4590. bool requiresUniformInputs() const { return false; }
  4591. // Operand indexes
  4592. enum OperandIdx {
  4593. arg_uav = 1,
  4594. arg_index = 2,
  4595. arg_elementOffset = 3,
  4596. arg_value0 = 4,
  4597. arg_value1 = 5,
  4598. arg_value2 = 6,
  4599. arg_value3 = 7,
  4600. arg_mask = 8,
  4601. arg_alignment = 9,
  4602. };
  4603. // Accessors
  4604. llvm::Value *get_uav() const { return Instr->getOperand(1); }
  4605. void set_uav(llvm::Value *val) { Instr->setOperand(1, val); }
  4606. llvm::Value *get_index() const { return Instr->getOperand(2); }
  4607. void set_index(llvm::Value *val) { Instr->setOperand(2, val); }
  4608. llvm::Value *get_elementOffset() const { return Instr->getOperand(3); }
  4609. void set_elementOffset(llvm::Value *val) { Instr->setOperand(3, val); }
  4610. llvm::Value *get_value0() const { return Instr->getOperand(4); }
  4611. void set_value0(llvm::Value *val) { Instr->setOperand(4, val); }
  4612. llvm::Value *get_value1() const { return Instr->getOperand(5); }
  4613. void set_value1(llvm::Value *val) { Instr->setOperand(5, val); }
  4614. llvm::Value *get_value2() const { return Instr->getOperand(6); }
  4615. void set_value2(llvm::Value *val) { Instr->setOperand(6, val); }
  4616. llvm::Value *get_value3() const { return Instr->getOperand(7); }
  4617. void set_value3(llvm::Value *val) { Instr->setOperand(7, val); }
  4618. llvm::Value *get_mask() const { return Instr->getOperand(8); }
  4619. void set_mask(llvm::Value *val) { Instr->setOperand(8, val); }
  4620. int8_t get_mask_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(8))->getZExtValue()); }
  4621. void set_mask_val(int8_t val) { Instr->setOperand(8, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  4622. llvm::Value *get_alignment() const { return Instr->getOperand(9); }
  4623. void set_alignment(llvm::Value *val) { Instr->setOperand(9, val); }
  4624. int32_t get_alignment_val() const { return (int32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(9))->getZExtValue()); }
  4625. void set_alignment_val(int32_t val) { Instr->setOperand(9, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 32), llvm::APInt(32, (uint64_t)val))); }
  4626. };
  4627. /// This instruction The user-provided InstanceID on the bottom-level acceleration structure instance within the top-level structure
  4628. struct DxilInst_InstanceID {
  4629. llvm::Instruction *Instr;
  4630. // Construction and identification
  4631. DxilInst_InstanceID(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4632. operator bool() const {
  4633. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::InstanceID);
  4634. }
  4635. // Validation support
  4636. bool isAllowed() const { return true; }
  4637. bool isArgumentListValid() const {
  4638. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4639. return true;
  4640. }
  4641. // Metadata
  4642. bool requiresUniformInputs() const { return false; }
  4643. };
  4644. /// This instruction The autogenerated index of the current instance in the top-level structure
  4645. struct DxilInst_InstanceIndex {
  4646. llvm::Instruction *Instr;
  4647. // Construction and identification
  4648. DxilInst_InstanceIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4649. operator bool() const {
  4650. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::InstanceIndex);
  4651. }
  4652. // Validation support
  4653. bool isAllowed() const { return true; }
  4654. bool isArgumentListValid() const {
  4655. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4656. return true;
  4657. }
  4658. // Metadata
  4659. bool requiresUniformInputs() const { return false; }
  4660. };
  4661. /// This instruction Returns the value passed as HitKind in ReportIntersection(). If intersection was reported by fixed-function triangle intersection, HitKind will be one of HIT_KIND_TRIANGLE_FRONT_FACE or HIT_KIND_TRIANGLE_BACK_FACE.
  4662. struct DxilInst_HitKind {
  4663. llvm::Instruction *Instr;
  4664. // Construction and identification
  4665. DxilInst_HitKind(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4666. operator bool() const {
  4667. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::HitKind);
  4668. }
  4669. // Validation support
  4670. bool isAllowed() const { return true; }
  4671. bool isArgumentListValid() const {
  4672. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4673. return true;
  4674. }
  4675. // Metadata
  4676. bool requiresUniformInputs() const { return false; }
  4677. };
  4678. /// This instruction uint containing the current ray flags.
  4679. struct DxilInst_RayFlags {
  4680. llvm::Instruction *Instr;
  4681. // Construction and identification
  4682. DxilInst_RayFlags(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4683. operator bool() const {
  4684. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayFlags);
  4685. }
  4686. // Validation support
  4687. bool isAllowed() const { return true; }
  4688. bool isArgumentListValid() const {
  4689. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4690. return true;
  4691. }
  4692. // Metadata
  4693. bool requiresUniformInputs() const { return false; }
  4694. };
  4695. /// This instruction The current x and y location within the Width and Height
  4696. struct DxilInst_DispatchRaysIndex {
  4697. llvm::Instruction *Instr;
  4698. // Construction and identification
  4699. DxilInst_DispatchRaysIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4700. operator bool() const {
  4701. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::DispatchRaysIndex);
  4702. }
  4703. // Validation support
  4704. bool isAllowed() const { return true; }
  4705. bool isArgumentListValid() const {
  4706. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4707. return true;
  4708. }
  4709. // Metadata
  4710. bool requiresUniformInputs() const { return false; }
  4711. // Operand indexes
  4712. enum OperandIdx {
  4713. arg_col = 1,
  4714. };
  4715. // Accessors
  4716. llvm::Value *get_col() const { return Instr->getOperand(1); }
  4717. void set_col(llvm::Value *val) { Instr->setOperand(1, val); }
  4718. };
  4719. /// This instruction The Width and Height values from the D3D12_DISPATCH_RAYS_DESC structure provided to the originating DispatchRays() call.
  4720. struct DxilInst_DispatchRaysDimensions {
  4721. llvm::Instruction *Instr;
  4722. // Construction and identification
  4723. DxilInst_DispatchRaysDimensions(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4724. operator bool() const {
  4725. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::DispatchRaysDimensions);
  4726. }
  4727. // Validation support
  4728. bool isAllowed() const { return true; }
  4729. bool isArgumentListValid() const {
  4730. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4731. return true;
  4732. }
  4733. // Metadata
  4734. bool requiresUniformInputs() const { return false; }
  4735. // Operand indexes
  4736. enum OperandIdx {
  4737. arg_col = 1,
  4738. };
  4739. // Accessors
  4740. llvm::Value *get_col() const { return Instr->getOperand(1); }
  4741. void set_col(llvm::Value *val) { Instr->setOperand(1, val); }
  4742. };
  4743. /// This instruction The world-space origin for the current ray.
  4744. struct DxilInst_WorldRayOrigin {
  4745. llvm::Instruction *Instr;
  4746. // Construction and identification
  4747. DxilInst_WorldRayOrigin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4748. operator bool() const {
  4749. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WorldRayOrigin);
  4750. }
  4751. // Validation support
  4752. bool isAllowed() const { return true; }
  4753. bool isArgumentListValid() const {
  4754. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4755. return true;
  4756. }
  4757. // Metadata
  4758. bool requiresUniformInputs() const { return false; }
  4759. // Operand indexes
  4760. enum OperandIdx {
  4761. arg_col = 1,
  4762. };
  4763. // Accessors
  4764. llvm::Value *get_col() const { return Instr->getOperand(1); }
  4765. void set_col(llvm::Value *val) { Instr->setOperand(1, val); }
  4766. };
  4767. /// This instruction The world-space direction for the current ray.
  4768. struct DxilInst_WorldRayDirection {
  4769. llvm::Instruction *Instr;
  4770. // Construction and identification
  4771. DxilInst_WorldRayDirection(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4772. operator bool() const {
  4773. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WorldRayDirection);
  4774. }
  4775. // Validation support
  4776. bool isAllowed() const { return true; }
  4777. bool isArgumentListValid() const {
  4778. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4779. return true;
  4780. }
  4781. // Metadata
  4782. bool requiresUniformInputs() const { return false; }
  4783. // Operand indexes
  4784. enum OperandIdx {
  4785. arg_col = 1,
  4786. };
  4787. // Accessors
  4788. llvm::Value *get_col() const { return Instr->getOperand(1); }
  4789. void set_col(llvm::Value *val) { Instr->setOperand(1, val); }
  4790. };
  4791. /// This instruction Object-space origin for the current ray.
  4792. struct DxilInst_ObjectRayOrigin {
  4793. llvm::Instruction *Instr;
  4794. // Construction and identification
  4795. DxilInst_ObjectRayOrigin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4796. operator bool() const {
  4797. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::ObjectRayOrigin);
  4798. }
  4799. // Validation support
  4800. bool isAllowed() const { return true; }
  4801. bool isArgumentListValid() const {
  4802. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4803. return true;
  4804. }
  4805. // Metadata
  4806. bool requiresUniformInputs() const { return false; }
  4807. // Operand indexes
  4808. enum OperandIdx {
  4809. arg_col = 1,
  4810. };
  4811. // Accessors
  4812. llvm::Value *get_col() const { return Instr->getOperand(1); }
  4813. void set_col(llvm::Value *val) { Instr->setOperand(1, val); }
  4814. };
  4815. /// This instruction Object-space direction for the current ray.
  4816. struct DxilInst_ObjectRayDirection {
  4817. llvm::Instruction *Instr;
  4818. // Construction and identification
  4819. DxilInst_ObjectRayDirection(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4820. operator bool() const {
  4821. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::ObjectRayDirection);
  4822. }
  4823. // Validation support
  4824. bool isAllowed() const { return true; }
  4825. bool isArgumentListValid() const {
  4826. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4827. return true;
  4828. }
  4829. // Metadata
  4830. bool requiresUniformInputs() const { return false; }
  4831. // Operand indexes
  4832. enum OperandIdx {
  4833. arg_col = 1,
  4834. };
  4835. // Accessors
  4836. llvm::Value *get_col() const { return Instr->getOperand(1); }
  4837. void set_col(llvm::Value *val) { Instr->setOperand(1, val); }
  4838. };
  4839. /// This instruction Matrix for transforming from object-space to world-space.
  4840. struct DxilInst_ObjectToWorld {
  4841. llvm::Instruction *Instr;
  4842. // Construction and identification
  4843. DxilInst_ObjectToWorld(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4844. operator bool() const {
  4845. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::ObjectToWorld);
  4846. }
  4847. // Validation support
  4848. bool isAllowed() const { return true; }
  4849. bool isArgumentListValid() const {
  4850. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4851. return true;
  4852. }
  4853. // Metadata
  4854. bool requiresUniformInputs() const { return false; }
  4855. // Operand indexes
  4856. enum OperandIdx {
  4857. arg_row = 1,
  4858. arg_col = 2,
  4859. };
  4860. // Accessors
  4861. llvm::Value *get_row() const { return Instr->getOperand(1); }
  4862. void set_row(llvm::Value *val) { Instr->setOperand(1, val); }
  4863. llvm::Value *get_col() const { return Instr->getOperand(2); }
  4864. void set_col(llvm::Value *val) { Instr->setOperand(2, val); }
  4865. };
  4866. /// This instruction Matrix for transforming from world-space to object-space.
  4867. struct DxilInst_WorldToObject {
  4868. llvm::Instruction *Instr;
  4869. // Construction and identification
  4870. DxilInst_WorldToObject(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4871. operator bool() const {
  4872. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WorldToObject);
  4873. }
  4874. // Validation support
  4875. bool isAllowed() const { return true; }
  4876. bool isArgumentListValid() const {
  4877. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4878. return true;
  4879. }
  4880. // Metadata
  4881. bool requiresUniformInputs() const { return false; }
  4882. // Operand indexes
  4883. enum OperandIdx {
  4884. arg_row = 1,
  4885. arg_col = 2,
  4886. };
  4887. // Accessors
  4888. llvm::Value *get_row() const { return Instr->getOperand(1); }
  4889. void set_row(llvm::Value *val) { Instr->setOperand(1, val); }
  4890. llvm::Value *get_col() const { return Instr->getOperand(2); }
  4891. void set_col(llvm::Value *val) { Instr->setOperand(2, val); }
  4892. };
  4893. /// This instruction float representing the parametric starting point for the ray.
  4894. struct DxilInst_RayTMin {
  4895. llvm::Instruction *Instr;
  4896. // Construction and identification
  4897. DxilInst_RayTMin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4898. operator bool() const {
  4899. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayTMin);
  4900. }
  4901. // Validation support
  4902. bool isAllowed() const { return true; }
  4903. bool isArgumentListValid() const {
  4904. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4905. return true;
  4906. }
  4907. // Metadata
  4908. bool requiresUniformInputs() const { return false; }
  4909. };
  4910. /// This instruction float representing the current parametric ending point for the ray
  4911. struct DxilInst_RayTCurrent {
  4912. llvm::Instruction *Instr;
  4913. // Construction and identification
  4914. DxilInst_RayTCurrent(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4915. operator bool() const {
  4916. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayTCurrent);
  4917. }
  4918. // Validation support
  4919. bool isAllowed() const { return true; }
  4920. bool isArgumentListValid() const {
  4921. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4922. return true;
  4923. }
  4924. // Metadata
  4925. bool requiresUniformInputs() const { return false; }
  4926. };
  4927. /// This instruction Used in an any hit shader to reject an intersection and terminate the shader
  4928. struct DxilInst_IgnoreHit {
  4929. llvm::Instruction *Instr;
  4930. // Construction and identification
  4931. DxilInst_IgnoreHit(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4932. operator bool() const {
  4933. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::IgnoreHit);
  4934. }
  4935. // Validation support
  4936. bool isAllowed() const { return true; }
  4937. bool isArgumentListValid() const {
  4938. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4939. return true;
  4940. }
  4941. // Metadata
  4942. bool requiresUniformInputs() const { return false; }
  4943. };
  4944. /// This instruction Used in an any hit shader to abort the ray query and the intersection shader (if any). The current hit is committed and execution passes to the closest hit shader with the closest hit recorded so far
  4945. struct DxilInst_AcceptHitAndEndSearch {
  4946. llvm::Instruction *Instr;
  4947. // Construction and identification
  4948. DxilInst_AcceptHitAndEndSearch(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4949. operator bool() const {
  4950. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::AcceptHitAndEndSearch);
  4951. }
  4952. // Validation support
  4953. bool isAllowed() const { return true; }
  4954. bool isArgumentListValid() const {
  4955. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4956. return true;
  4957. }
  4958. // Metadata
  4959. bool requiresUniformInputs() const { return false; }
  4960. };
  4961. /// This instruction initiates raytrace
  4962. struct DxilInst_TraceRay {
  4963. llvm::Instruction *Instr;
  4964. // Construction and identification
  4965. DxilInst_TraceRay(llvm::Instruction *pInstr) : Instr(pInstr) {}
  4966. operator bool() const {
  4967. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::TraceRay);
  4968. }
  4969. // Validation support
  4970. bool isAllowed() const { return true; }
  4971. bool isArgumentListValid() const {
  4972. if (16 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  4973. return true;
  4974. }
  4975. // Metadata
  4976. bool requiresUniformInputs() const { return false; }
  4977. // Operand indexes
  4978. enum OperandIdx {
  4979. arg_AccelerationStructure = 1,
  4980. arg_RayFlags = 2,
  4981. arg_InstanceInclusionMask = 3,
  4982. arg_RayContributionToHitGroupIndex = 4,
  4983. arg_MultiplierForGeometryContributionToShaderIndex = 5,
  4984. arg_MissShaderIndex = 6,
  4985. arg_Origin_X = 7,
  4986. arg_Origin_Y = 8,
  4987. arg_Origin_Z = 9,
  4988. arg_TMin = 10,
  4989. arg_Direction_X = 11,
  4990. arg_Direction_Y = 12,
  4991. arg_Direction_Z = 13,
  4992. arg_TMax = 14,
  4993. arg_payload = 15,
  4994. };
  4995. // Accessors
  4996. llvm::Value *get_AccelerationStructure() const { return Instr->getOperand(1); }
  4997. void set_AccelerationStructure(llvm::Value *val) { Instr->setOperand(1, val); }
  4998. llvm::Value *get_RayFlags() const { return Instr->getOperand(2); }
  4999. void set_RayFlags(llvm::Value *val) { Instr->setOperand(2, val); }
  5000. llvm::Value *get_InstanceInclusionMask() const { return Instr->getOperand(3); }
  5001. void set_InstanceInclusionMask(llvm::Value *val) { Instr->setOperand(3, val); }
  5002. llvm::Value *get_RayContributionToHitGroupIndex() const { return Instr->getOperand(4); }
  5003. void set_RayContributionToHitGroupIndex(llvm::Value *val) { Instr->setOperand(4, val); }
  5004. llvm::Value *get_MultiplierForGeometryContributionToShaderIndex() const { return Instr->getOperand(5); }
  5005. void set_MultiplierForGeometryContributionToShaderIndex(llvm::Value *val) { Instr->setOperand(5, val); }
  5006. llvm::Value *get_MissShaderIndex() const { return Instr->getOperand(6); }
  5007. void set_MissShaderIndex(llvm::Value *val) { Instr->setOperand(6, val); }
  5008. llvm::Value *get_Origin_X() const { return Instr->getOperand(7); }
  5009. void set_Origin_X(llvm::Value *val) { Instr->setOperand(7, val); }
  5010. llvm::Value *get_Origin_Y() const { return Instr->getOperand(8); }
  5011. void set_Origin_Y(llvm::Value *val) { Instr->setOperand(8, val); }
  5012. llvm::Value *get_Origin_Z() const { return Instr->getOperand(9); }
  5013. void set_Origin_Z(llvm::Value *val) { Instr->setOperand(9, val); }
  5014. llvm::Value *get_TMin() const { return Instr->getOperand(10); }
  5015. void set_TMin(llvm::Value *val) { Instr->setOperand(10, val); }
  5016. llvm::Value *get_Direction_X() const { return Instr->getOperand(11); }
  5017. void set_Direction_X(llvm::Value *val) { Instr->setOperand(11, val); }
  5018. llvm::Value *get_Direction_Y() const { return Instr->getOperand(12); }
  5019. void set_Direction_Y(llvm::Value *val) { Instr->setOperand(12, val); }
  5020. llvm::Value *get_Direction_Z() const { return Instr->getOperand(13); }
  5021. void set_Direction_Z(llvm::Value *val) { Instr->setOperand(13, val); }
  5022. llvm::Value *get_TMax() const { return Instr->getOperand(14); }
  5023. void set_TMax(llvm::Value *val) { Instr->setOperand(14, val); }
  5024. llvm::Value *get_payload() const { return Instr->getOperand(15); }
  5025. void set_payload(llvm::Value *val) { Instr->setOperand(15, val); }
  5026. };
  5027. /// This instruction returns true if hit was accepted
  5028. struct DxilInst_ReportHit {
  5029. llvm::Instruction *Instr;
  5030. // Construction and identification
  5031. DxilInst_ReportHit(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5032. operator bool() const {
  5033. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::ReportHit);
  5034. }
  5035. // Validation support
  5036. bool isAllowed() const { return true; }
  5037. bool isArgumentListValid() const {
  5038. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5039. return true;
  5040. }
  5041. // Metadata
  5042. bool requiresUniformInputs() const { return false; }
  5043. // Operand indexes
  5044. enum OperandIdx {
  5045. arg_THit = 1,
  5046. arg_HitKind = 2,
  5047. arg_Attributes = 3,
  5048. };
  5049. // Accessors
  5050. llvm::Value *get_THit() const { return Instr->getOperand(1); }
  5051. void set_THit(llvm::Value *val) { Instr->setOperand(1, val); }
  5052. llvm::Value *get_HitKind() const { return Instr->getOperand(2); }
  5053. void set_HitKind(llvm::Value *val) { Instr->setOperand(2, val); }
  5054. llvm::Value *get_Attributes() const { return Instr->getOperand(3); }
  5055. void set_Attributes(llvm::Value *val) { Instr->setOperand(3, val); }
  5056. };
  5057. /// This instruction Call a shader in the callable shader table supplied through the DispatchRays() API
  5058. struct DxilInst_CallShader {
  5059. llvm::Instruction *Instr;
  5060. // Construction and identification
  5061. DxilInst_CallShader(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5062. operator bool() const {
  5063. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::CallShader);
  5064. }
  5065. // Validation support
  5066. bool isAllowed() const { return true; }
  5067. bool isArgumentListValid() const {
  5068. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5069. return true;
  5070. }
  5071. // Metadata
  5072. bool requiresUniformInputs() const { return false; }
  5073. // Operand indexes
  5074. enum OperandIdx {
  5075. arg_ShaderIndex = 1,
  5076. arg_Parameter = 2,
  5077. };
  5078. // Accessors
  5079. llvm::Value *get_ShaderIndex() const { return Instr->getOperand(1); }
  5080. void set_ShaderIndex(llvm::Value *val) { Instr->setOperand(1, val); }
  5081. llvm::Value *get_Parameter() const { return Instr->getOperand(2); }
  5082. void set_Parameter(llvm::Value *val) { Instr->setOperand(2, val); }
  5083. };
  5084. /// This instruction create resource handle from resource struct for library
  5085. struct DxilInst_CreateHandleForLib {
  5086. llvm::Instruction *Instr;
  5087. // Construction and identification
  5088. DxilInst_CreateHandleForLib(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5089. operator bool() const {
  5090. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::CreateHandleForLib);
  5091. }
  5092. // Validation support
  5093. bool isAllowed() const { return true; }
  5094. bool isArgumentListValid() const {
  5095. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5096. return true;
  5097. }
  5098. // Metadata
  5099. bool requiresUniformInputs() const { return false; }
  5100. // Operand indexes
  5101. enum OperandIdx {
  5102. arg_Resource = 1,
  5103. };
  5104. // Accessors
  5105. llvm::Value *get_Resource() const { return Instr->getOperand(1); }
  5106. void set_Resource(llvm::Value *val) { Instr->setOperand(1, val); }
  5107. };
  5108. /// This instruction PrimitiveIndex for raytracing shaders
  5109. struct DxilInst_PrimitiveIndex {
  5110. llvm::Instruction *Instr;
  5111. // Construction and identification
  5112. DxilInst_PrimitiveIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5113. operator bool() const {
  5114. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::PrimitiveIndex);
  5115. }
  5116. // Validation support
  5117. bool isAllowed() const { return true; }
  5118. bool isArgumentListValid() const {
  5119. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5120. return true;
  5121. }
  5122. // Metadata
  5123. bool requiresUniformInputs() const { return false; }
  5124. };
  5125. /// This instruction 2D half dot product with accumulate to float
  5126. struct DxilInst_Dot2AddHalf {
  5127. llvm::Instruction *Instr;
  5128. // Construction and identification
  5129. DxilInst_Dot2AddHalf(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5130. operator bool() const {
  5131. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Dot2AddHalf);
  5132. }
  5133. // Validation support
  5134. bool isAllowed() const { return true; }
  5135. bool isArgumentListValid() const {
  5136. if (6 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5137. return true;
  5138. }
  5139. // Metadata
  5140. bool requiresUniformInputs() const { return false; }
  5141. // Operand indexes
  5142. enum OperandIdx {
  5143. arg_acc = 1,
  5144. arg_ax = 2,
  5145. arg_ay = 3,
  5146. arg_bx = 4,
  5147. arg_by = 5,
  5148. };
  5149. // Accessors
  5150. llvm::Value *get_acc() const { return Instr->getOperand(1); }
  5151. void set_acc(llvm::Value *val) { Instr->setOperand(1, val); }
  5152. llvm::Value *get_ax() const { return Instr->getOperand(2); }
  5153. void set_ax(llvm::Value *val) { Instr->setOperand(2, val); }
  5154. llvm::Value *get_ay() const { return Instr->getOperand(3); }
  5155. void set_ay(llvm::Value *val) { Instr->setOperand(3, val); }
  5156. llvm::Value *get_bx() const { return Instr->getOperand(4); }
  5157. void set_bx(llvm::Value *val) { Instr->setOperand(4, val); }
  5158. llvm::Value *get_by() const { return Instr->getOperand(5); }
  5159. void set_by(llvm::Value *val) { Instr->setOperand(5, val); }
  5160. };
  5161. /// This instruction signed dot product of 4 x i8 vectors packed into i32, with accumulate to i32
  5162. struct DxilInst_Dot4AddI8Packed {
  5163. llvm::Instruction *Instr;
  5164. // Construction and identification
  5165. DxilInst_Dot4AddI8Packed(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5166. operator bool() const {
  5167. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Dot4AddI8Packed);
  5168. }
  5169. // Validation support
  5170. bool isAllowed() const { return true; }
  5171. bool isArgumentListValid() const {
  5172. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5173. return true;
  5174. }
  5175. // Metadata
  5176. bool requiresUniformInputs() const { return false; }
  5177. // Operand indexes
  5178. enum OperandIdx {
  5179. arg_acc = 1,
  5180. arg_a = 2,
  5181. arg_b = 3,
  5182. };
  5183. // Accessors
  5184. llvm::Value *get_acc() const { return Instr->getOperand(1); }
  5185. void set_acc(llvm::Value *val) { Instr->setOperand(1, val); }
  5186. llvm::Value *get_a() const { return Instr->getOperand(2); }
  5187. void set_a(llvm::Value *val) { Instr->setOperand(2, val); }
  5188. llvm::Value *get_b() const { return Instr->getOperand(3); }
  5189. void set_b(llvm::Value *val) { Instr->setOperand(3, val); }
  5190. };
  5191. /// This instruction unsigned dot product of 4 x u8 vectors packed into i32, with accumulate to i32
  5192. struct DxilInst_Dot4AddU8Packed {
  5193. llvm::Instruction *Instr;
  5194. // Construction and identification
  5195. DxilInst_Dot4AddU8Packed(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5196. operator bool() const {
  5197. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Dot4AddU8Packed);
  5198. }
  5199. // Validation support
  5200. bool isAllowed() const { return true; }
  5201. bool isArgumentListValid() const {
  5202. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5203. return true;
  5204. }
  5205. // Metadata
  5206. bool requiresUniformInputs() const { return false; }
  5207. // Operand indexes
  5208. enum OperandIdx {
  5209. arg_acc = 1,
  5210. arg_a = 2,
  5211. arg_b = 3,
  5212. };
  5213. // Accessors
  5214. llvm::Value *get_acc() const { return Instr->getOperand(1); }
  5215. void set_acc(llvm::Value *val) { Instr->setOperand(1, val); }
  5216. llvm::Value *get_a() const { return Instr->getOperand(2); }
  5217. void set_a(llvm::Value *val) { Instr->setOperand(2, val); }
  5218. llvm::Value *get_b() const { return Instr->getOperand(3); }
  5219. void set_b(llvm::Value *val) { Instr->setOperand(3, val); }
  5220. };
  5221. /// This instruction returns the bitmask of active lanes that have the same value
  5222. struct DxilInst_WaveMatch {
  5223. llvm::Instruction *Instr;
  5224. // Construction and identification
  5225. DxilInst_WaveMatch(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5226. operator bool() const {
  5227. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveMatch);
  5228. }
  5229. // Validation support
  5230. bool isAllowed() const { return true; }
  5231. bool isArgumentListValid() const {
  5232. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5233. return true;
  5234. }
  5235. // Metadata
  5236. bool requiresUniformInputs() const { return false; }
  5237. // Operand indexes
  5238. enum OperandIdx {
  5239. arg_value = 1,
  5240. };
  5241. // Accessors
  5242. llvm::Value *get_value() const { return Instr->getOperand(1); }
  5243. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  5244. };
  5245. /// This instruction returns the result of the operation on groups of lanes identified by a bitmask
  5246. struct DxilInst_WaveMultiPrefixOp {
  5247. llvm::Instruction *Instr;
  5248. // Construction and identification
  5249. DxilInst_WaveMultiPrefixOp(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5250. operator bool() const {
  5251. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveMultiPrefixOp);
  5252. }
  5253. // Validation support
  5254. bool isAllowed() const { return true; }
  5255. bool isArgumentListValid() const {
  5256. if (8 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5257. return true;
  5258. }
  5259. // Metadata
  5260. bool requiresUniformInputs() const { return false; }
  5261. // Operand indexes
  5262. enum OperandIdx {
  5263. arg_value = 1,
  5264. arg_mask0 = 2,
  5265. arg_mask1 = 3,
  5266. arg_mask2 = 4,
  5267. arg_mask3 = 5,
  5268. arg_op = 6,
  5269. arg_sop = 7,
  5270. };
  5271. // Accessors
  5272. llvm::Value *get_value() const { return Instr->getOperand(1); }
  5273. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  5274. llvm::Value *get_mask0() const { return Instr->getOperand(2); }
  5275. void set_mask0(llvm::Value *val) { Instr->setOperand(2, val); }
  5276. llvm::Value *get_mask1() const { return Instr->getOperand(3); }
  5277. void set_mask1(llvm::Value *val) { Instr->setOperand(3, val); }
  5278. llvm::Value *get_mask2() const { return Instr->getOperand(4); }
  5279. void set_mask2(llvm::Value *val) { Instr->setOperand(4, val); }
  5280. llvm::Value *get_mask3() const { return Instr->getOperand(5); }
  5281. void set_mask3(llvm::Value *val) { Instr->setOperand(5, val); }
  5282. llvm::Value *get_op() const { return Instr->getOperand(6); }
  5283. void set_op(llvm::Value *val) { Instr->setOperand(6, val); }
  5284. int8_t get_op_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(6))->getZExtValue()); }
  5285. void set_op_val(int8_t val) { Instr->setOperand(6, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  5286. llvm::Value *get_sop() const { return Instr->getOperand(7); }
  5287. void set_sop(llvm::Value *val) { Instr->setOperand(7, val); }
  5288. int8_t get_sop_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(7))->getZExtValue()); }
  5289. void set_sop_val(int8_t val) { Instr->setOperand(7, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  5290. };
  5291. /// This instruction returns the count of bits set to 1 on groups of lanes identified by a bitmask
  5292. struct DxilInst_WaveMultiPrefixBitCount {
  5293. llvm::Instruction *Instr;
  5294. // Construction and identification
  5295. DxilInst_WaveMultiPrefixBitCount(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5296. operator bool() const {
  5297. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WaveMultiPrefixBitCount);
  5298. }
  5299. // Validation support
  5300. bool isAllowed() const { return true; }
  5301. bool isArgumentListValid() const {
  5302. if (6 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5303. return true;
  5304. }
  5305. // Metadata
  5306. bool requiresUniformInputs() const { return false; }
  5307. // Operand indexes
  5308. enum OperandIdx {
  5309. arg_value = 1,
  5310. arg_mask0 = 2,
  5311. arg_mask1 = 3,
  5312. arg_mask2 = 4,
  5313. arg_mask3 = 5,
  5314. };
  5315. // Accessors
  5316. llvm::Value *get_value() const { return Instr->getOperand(1); }
  5317. void set_value(llvm::Value *val) { Instr->setOperand(1, val); }
  5318. llvm::Value *get_mask0() const { return Instr->getOperand(2); }
  5319. void set_mask0(llvm::Value *val) { Instr->setOperand(2, val); }
  5320. llvm::Value *get_mask1() const { return Instr->getOperand(3); }
  5321. void set_mask1(llvm::Value *val) { Instr->setOperand(3, val); }
  5322. llvm::Value *get_mask2() const { return Instr->getOperand(4); }
  5323. void set_mask2(llvm::Value *val) { Instr->setOperand(4, val); }
  5324. llvm::Value *get_mask3() const { return Instr->getOperand(5); }
  5325. void set_mask3(llvm::Value *val) { Instr->setOperand(5, val); }
  5326. };
  5327. /// This instruction Mesh shader intrinsic SetMeshOutputCounts
  5328. struct DxilInst_SetMeshOutputCounts {
  5329. llvm::Instruction *Instr;
  5330. // Construction and identification
  5331. DxilInst_SetMeshOutputCounts(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5332. operator bool() const {
  5333. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::SetMeshOutputCounts);
  5334. }
  5335. // Validation support
  5336. bool isAllowed() const { return true; }
  5337. bool isArgumentListValid() const {
  5338. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5339. return true;
  5340. }
  5341. // Metadata
  5342. bool requiresUniformInputs() const { return false; }
  5343. // Operand indexes
  5344. enum OperandIdx {
  5345. arg_numVertices = 1,
  5346. arg_numPrimitives = 2,
  5347. };
  5348. // Accessors
  5349. llvm::Value *get_numVertices() const { return Instr->getOperand(1); }
  5350. void set_numVertices(llvm::Value *val) { Instr->setOperand(1, val); }
  5351. llvm::Value *get_numPrimitives() const { return Instr->getOperand(2); }
  5352. void set_numPrimitives(llvm::Value *val) { Instr->setOperand(2, val); }
  5353. };
  5354. /// This instruction emit a primitive's vertex indices in a mesh shader
  5355. struct DxilInst_EmitIndices {
  5356. llvm::Instruction *Instr;
  5357. // Construction and identification
  5358. DxilInst_EmitIndices(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5359. operator bool() const {
  5360. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::EmitIndices);
  5361. }
  5362. // Validation support
  5363. bool isAllowed() const { return true; }
  5364. bool isArgumentListValid() const {
  5365. if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5366. return true;
  5367. }
  5368. // Metadata
  5369. bool requiresUniformInputs() const { return false; }
  5370. // Operand indexes
  5371. enum OperandIdx {
  5372. arg_PrimitiveIndex = 1,
  5373. arg_VertexIndex0 = 2,
  5374. arg_VertexIndex1 = 3,
  5375. arg_VertexIndex2 = 4,
  5376. };
  5377. // Accessors
  5378. llvm::Value *get_PrimitiveIndex() const { return Instr->getOperand(1); }
  5379. void set_PrimitiveIndex(llvm::Value *val) { Instr->setOperand(1, val); }
  5380. llvm::Value *get_VertexIndex0() const { return Instr->getOperand(2); }
  5381. void set_VertexIndex0(llvm::Value *val) { Instr->setOperand(2, val); }
  5382. llvm::Value *get_VertexIndex1() const { return Instr->getOperand(3); }
  5383. void set_VertexIndex1(llvm::Value *val) { Instr->setOperand(3, val); }
  5384. llvm::Value *get_VertexIndex2() const { return Instr->getOperand(4); }
  5385. void set_VertexIndex2(llvm::Value *val) { Instr->setOperand(4, val); }
  5386. };
  5387. /// This instruction get the mesh payload which is from amplification shader
  5388. struct DxilInst_GetMeshPayload {
  5389. llvm::Instruction *Instr;
  5390. // Construction and identification
  5391. DxilInst_GetMeshPayload(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5392. operator bool() const {
  5393. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::GetMeshPayload);
  5394. }
  5395. // Validation support
  5396. bool isAllowed() const { return true; }
  5397. bool isArgumentListValid() const {
  5398. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5399. return true;
  5400. }
  5401. // Metadata
  5402. bool requiresUniformInputs() const { return false; }
  5403. };
  5404. /// This instruction stores the value to mesh shader vertex output
  5405. struct DxilInst_StoreVertexOutput {
  5406. llvm::Instruction *Instr;
  5407. // Construction and identification
  5408. DxilInst_StoreVertexOutput(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5409. operator bool() const {
  5410. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::StoreVertexOutput);
  5411. }
  5412. // Validation support
  5413. bool isAllowed() const { return true; }
  5414. bool isArgumentListValid() const {
  5415. if (6 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5416. return true;
  5417. }
  5418. // Metadata
  5419. bool requiresUniformInputs() const { return false; }
  5420. // Operand indexes
  5421. enum OperandIdx {
  5422. arg_outputSigId = 1,
  5423. arg_rowIndex = 2,
  5424. arg_colIndex = 3,
  5425. arg_value = 4,
  5426. arg_vertexIndex = 5,
  5427. };
  5428. // Accessors
  5429. llvm::Value *get_outputSigId() const { return Instr->getOperand(1); }
  5430. void set_outputSigId(llvm::Value *val) { Instr->setOperand(1, val); }
  5431. llvm::Value *get_rowIndex() const { return Instr->getOperand(2); }
  5432. void set_rowIndex(llvm::Value *val) { Instr->setOperand(2, val); }
  5433. llvm::Value *get_colIndex() const { return Instr->getOperand(3); }
  5434. void set_colIndex(llvm::Value *val) { Instr->setOperand(3, val); }
  5435. llvm::Value *get_value() const { return Instr->getOperand(4); }
  5436. void set_value(llvm::Value *val) { Instr->setOperand(4, val); }
  5437. llvm::Value *get_vertexIndex() const { return Instr->getOperand(5); }
  5438. void set_vertexIndex(llvm::Value *val) { Instr->setOperand(5, val); }
  5439. };
  5440. /// This instruction stores the value to mesh shader primitive output
  5441. struct DxilInst_StorePrimitiveOutput {
  5442. llvm::Instruction *Instr;
  5443. // Construction and identification
  5444. DxilInst_StorePrimitiveOutput(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5445. operator bool() const {
  5446. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::StorePrimitiveOutput);
  5447. }
  5448. // Validation support
  5449. bool isAllowed() const { return true; }
  5450. bool isArgumentListValid() const {
  5451. if (6 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5452. return true;
  5453. }
  5454. // Metadata
  5455. bool requiresUniformInputs() const { return false; }
  5456. // Operand indexes
  5457. enum OperandIdx {
  5458. arg_outputSigId = 1,
  5459. arg_rowIndex = 2,
  5460. arg_colIndex = 3,
  5461. arg_value = 4,
  5462. arg_primitiveIndex = 5,
  5463. };
  5464. // Accessors
  5465. llvm::Value *get_outputSigId() const { return Instr->getOperand(1); }
  5466. void set_outputSigId(llvm::Value *val) { Instr->setOperand(1, val); }
  5467. llvm::Value *get_rowIndex() const { return Instr->getOperand(2); }
  5468. void set_rowIndex(llvm::Value *val) { Instr->setOperand(2, val); }
  5469. llvm::Value *get_colIndex() const { return Instr->getOperand(3); }
  5470. void set_colIndex(llvm::Value *val) { Instr->setOperand(3, val); }
  5471. llvm::Value *get_value() const { return Instr->getOperand(4); }
  5472. void set_value(llvm::Value *val) { Instr->setOperand(4, val); }
  5473. llvm::Value *get_primitiveIndex() const { return Instr->getOperand(5); }
  5474. void set_primitiveIndex(llvm::Value *val) { Instr->setOperand(5, val); }
  5475. };
  5476. /// This instruction Amplification shader intrinsic DispatchMesh
  5477. struct DxilInst_DispatchMesh {
  5478. llvm::Instruction *Instr;
  5479. // Construction and identification
  5480. DxilInst_DispatchMesh(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5481. operator bool() const {
  5482. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::DispatchMesh);
  5483. }
  5484. // Validation support
  5485. bool isAllowed() const { return true; }
  5486. bool isArgumentListValid() const {
  5487. if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5488. return true;
  5489. }
  5490. // Metadata
  5491. bool requiresUniformInputs() const { return false; }
  5492. // Operand indexes
  5493. enum OperandIdx {
  5494. arg_threadGroupCountX = 1,
  5495. arg_threadGroupCountY = 2,
  5496. arg_threadGroupCountZ = 3,
  5497. arg_payload = 4,
  5498. };
  5499. // Accessors
  5500. llvm::Value *get_threadGroupCountX() const { return Instr->getOperand(1); }
  5501. void set_threadGroupCountX(llvm::Value *val) { Instr->setOperand(1, val); }
  5502. llvm::Value *get_threadGroupCountY() const { return Instr->getOperand(2); }
  5503. void set_threadGroupCountY(llvm::Value *val) { Instr->setOperand(2, val); }
  5504. llvm::Value *get_threadGroupCountZ() const { return Instr->getOperand(3); }
  5505. void set_threadGroupCountZ(llvm::Value *val) { Instr->setOperand(3, val); }
  5506. llvm::Value *get_payload() const { return Instr->getOperand(4); }
  5507. void set_payload(llvm::Value *val) { Instr->setOperand(4, val); }
  5508. };
  5509. /// This instruction updates a feedback texture for a sampling operation
  5510. struct DxilInst_WriteSamplerFeedback {
  5511. llvm::Instruction *Instr;
  5512. // Construction and identification
  5513. DxilInst_WriteSamplerFeedback(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5514. operator bool() const {
  5515. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WriteSamplerFeedback);
  5516. }
  5517. // Validation support
  5518. bool isAllowed() const { return true; }
  5519. bool isArgumentListValid() const {
  5520. if (9 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5521. return true;
  5522. }
  5523. // Metadata
  5524. bool requiresUniformInputs() const { return false; }
  5525. // Operand indexes
  5526. enum OperandIdx {
  5527. arg_feedbackTex = 1,
  5528. arg_sampledTex = 2,
  5529. arg_sampler = 3,
  5530. arg_c0 = 4,
  5531. arg_c1 = 5,
  5532. arg_c2 = 6,
  5533. arg_c3 = 7,
  5534. arg_clamp = 8,
  5535. };
  5536. // Accessors
  5537. llvm::Value *get_feedbackTex() const { return Instr->getOperand(1); }
  5538. void set_feedbackTex(llvm::Value *val) { Instr->setOperand(1, val); }
  5539. llvm::Value *get_sampledTex() const { return Instr->getOperand(2); }
  5540. void set_sampledTex(llvm::Value *val) { Instr->setOperand(2, val); }
  5541. llvm::Value *get_sampler() const { return Instr->getOperand(3); }
  5542. void set_sampler(llvm::Value *val) { Instr->setOperand(3, val); }
  5543. llvm::Value *get_c0() const { return Instr->getOperand(4); }
  5544. void set_c0(llvm::Value *val) { Instr->setOperand(4, val); }
  5545. llvm::Value *get_c1() const { return Instr->getOperand(5); }
  5546. void set_c1(llvm::Value *val) { Instr->setOperand(5, val); }
  5547. llvm::Value *get_c2() const { return Instr->getOperand(6); }
  5548. void set_c2(llvm::Value *val) { Instr->setOperand(6, val); }
  5549. llvm::Value *get_c3() const { return Instr->getOperand(7); }
  5550. void set_c3(llvm::Value *val) { Instr->setOperand(7, val); }
  5551. llvm::Value *get_clamp() const { return Instr->getOperand(8); }
  5552. void set_clamp(llvm::Value *val) { Instr->setOperand(8, val); }
  5553. };
  5554. /// This instruction updates a feedback texture for a sampling operation with a bias on the mipmap level
  5555. struct DxilInst_WriteSamplerFeedbackBias {
  5556. llvm::Instruction *Instr;
  5557. // Construction and identification
  5558. DxilInst_WriteSamplerFeedbackBias(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5559. operator bool() const {
  5560. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WriteSamplerFeedbackBias);
  5561. }
  5562. // Validation support
  5563. bool isAllowed() const { return true; }
  5564. bool isArgumentListValid() const {
  5565. if (10 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5566. return true;
  5567. }
  5568. // Metadata
  5569. bool requiresUniformInputs() const { return false; }
  5570. // Operand indexes
  5571. enum OperandIdx {
  5572. arg_feedbackTex = 1,
  5573. arg_sampledTex = 2,
  5574. arg_sampler = 3,
  5575. arg_c0 = 4,
  5576. arg_c1 = 5,
  5577. arg_c2 = 6,
  5578. arg_c3 = 7,
  5579. arg_bias = 8,
  5580. arg_clamp = 9,
  5581. };
  5582. // Accessors
  5583. llvm::Value *get_feedbackTex() const { return Instr->getOperand(1); }
  5584. void set_feedbackTex(llvm::Value *val) { Instr->setOperand(1, val); }
  5585. llvm::Value *get_sampledTex() const { return Instr->getOperand(2); }
  5586. void set_sampledTex(llvm::Value *val) { Instr->setOperand(2, val); }
  5587. llvm::Value *get_sampler() const { return Instr->getOperand(3); }
  5588. void set_sampler(llvm::Value *val) { Instr->setOperand(3, val); }
  5589. llvm::Value *get_c0() const { return Instr->getOperand(4); }
  5590. void set_c0(llvm::Value *val) { Instr->setOperand(4, val); }
  5591. llvm::Value *get_c1() const { return Instr->getOperand(5); }
  5592. void set_c1(llvm::Value *val) { Instr->setOperand(5, val); }
  5593. llvm::Value *get_c2() const { return Instr->getOperand(6); }
  5594. void set_c2(llvm::Value *val) { Instr->setOperand(6, val); }
  5595. llvm::Value *get_c3() const { return Instr->getOperand(7); }
  5596. void set_c3(llvm::Value *val) { Instr->setOperand(7, val); }
  5597. llvm::Value *get_bias() const { return Instr->getOperand(8); }
  5598. void set_bias(llvm::Value *val) { Instr->setOperand(8, val); }
  5599. llvm::Value *get_clamp() const { return Instr->getOperand(9); }
  5600. void set_clamp(llvm::Value *val) { Instr->setOperand(9, val); }
  5601. };
  5602. /// This instruction updates a feedback texture for a sampling operation with a mipmap-level offset
  5603. struct DxilInst_WriteSamplerFeedbackLevel {
  5604. llvm::Instruction *Instr;
  5605. // Construction and identification
  5606. DxilInst_WriteSamplerFeedbackLevel(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5607. operator bool() const {
  5608. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WriteSamplerFeedbackLevel);
  5609. }
  5610. // Validation support
  5611. bool isAllowed() const { return true; }
  5612. bool isArgumentListValid() const {
  5613. if (9 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5614. return true;
  5615. }
  5616. // Metadata
  5617. bool requiresUniformInputs() const { return false; }
  5618. // Operand indexes
  5619. enum OperandIdx {
  5620. arg_feedbackTex = 1,
  5621. arg_sampledTex = 2,
  5622. arg_sampler = 3,
  5623. arg_c0 = 4,
  5624. arg_c1 = 5,
  5625. arg_c2 = 6,
  5626. arg_c3 = 7,
  5627. arg_lod = 8,
  5628. };
  5629. // Accessors
  5630. llvm::Value *get_feedbackTex() const { return Instr->getOperand(1); }
  5631. void set_feedbackTex(llvm::Value *val) { Instr->setOperand(1, val); }
  5632. llvm::Value *get_sampledTex() const { return Instr->getOperand(2); }
  5633. void set_sampledTex(llvm::Value *val) { Instr->setOperand(2, val); }
  5634. llvm::Value *get_sampler() const { return Instr->getOperand(3); }
  5635. void set_sampler(llvm::Value *val) { Instr->setOperand(3, val); }
  5636. llvm::Value *get_c0() const { return Instr->getOperand(4); }
  5637. void set_c0(llvm::Value *val) { Instr->setOperand(4, val); }
  5638. llvm::Value *get_c1() const { return Instr->getOperand(5); }
  5639. void set_c1(llvm::Value *val) { Instr->setOperand(5, val); }
  5640. llvm::Value *get_c2() const { return Instr->getOperand(6); }
  5641. void set_c2(llvm::Value *val) { Instr->setOperand(6, val); }
  5642. llvm::Value *get_c3() const { return Instr->getOperand(7); }
  5643. void set_c3(llvm::Value *val) { Instr->setOperand(7, val); }
  5644. llvm::Value *get_lod() const { return Instr->getOperand(8); }
  5645. void set_lod(llvm::Value *val) { Instr->setOperand(8, val); }
  5646. };
  5647. /// This instruction updates a feedback texture for a sampling operation with explicit gradients
  5648. struct DxilInst_WriteSamplerFeedbackGrad {
  5649. llvm::Instruction *Instr;
  5650. // Construction and identification
  5651. DxilInst_WriteSamplerFeedbackGrad(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5652. operator bool() const {
  5653. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::WriteSamplerFeedbackGrad);
  5654. }
  5655. // Validation support
  5656. bool isAllowed() const { return true; }
  5657. bool isArgumentListValid() const {
  5658. if (15 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5659. return true;
  5660. }
  5661. // Metadata
  5662. bool requiresUniformInputs() const { return false; }
  5663. // Operand indexes
  5664. enum OperandIdx {
  5665. arg_feedbackTex = 1,
  5666. arg_sampledTex = 2,
  5667. arg_sampler = 3,
  5668. arg_c0 = 4,
  5669. arg_c1 = 5,
  5670. arg_c2 = 6,
  5671. arg_c3 = 7,
  5672. arg_ddx0 = 8,
  5673. arg_ddx1 = 9,
  5674. arg_ddx2 = 10,
  5675. arg_ddy0 = 11,
  5676. arg_ddy1 = 12,
  5677. arg_ddy2 = 13,
  5678. arg_clamp = 14,
  5679. };
  5680. // Accessors
  5681. llvm::Value *get_feedbackTex() const { return Instr->getOperand(1); }
  5682. void set_feedbackTex(llvm::Value *val) { Instr->setOperand(1, val); }
  5683. llvm::Value *get_sampledTex() const { return Instr->getOperand(2); }
  5684. void set_sampledTex(llvm::Value *val) { Instr->setOperand(2, val); }
  5685. llvm::Value *get_sampler() const { return Instr->getOperand(3); }
  5686. void set_sampler(llvm::Value *val) { Instr->setOperand(3, val); }
  5687. llvm::Value *get_c0() const { return Instr->getOperand(4); }
  5688. void set_c0(llvm::Value *val) { Instr->setOperand(4, val); }
  5689. llvm::Value *get_c1() const { return Instr->getOperand(5); }
  5690. void set_c1(llvm::Value *val) { Instr->setOperand(5, val); }
  5691. llvm::Value *get_c2() const { return Instr->getOperand(6); }
  5692. void set_c2(llvm::Value *val) { Instr->setOperand(6, val); }
  5693. llvm::Value *get_c3() const { return Instr->getOperand(7); }
  5694. void set_c3(llvm::Value *val) { Instr->setOperand(7, val); }
  5695. llvm::Value *get_ddx0() const { return Instr->getOperand(8); }
  5696. void set_ddx0(llvm::Value *val) { Instr->setOperand(8, val); }
  5697. llvm::Value *get_ddx1() const { return Instr->getOperand(9); }
  5698. void set_ddx1(llvm::Value *val) { Instr->setOperand(9, val); }
  5699. llvm::Value *get_ddx2() const { return Instr->getOperand(10); }
  5700. void set_ddx2(llvm::Value *val) { Instr->setOperand(10, val); }
  5701. llvm::Value *get_ddy0() const { return Instr->getOperand(11); }
  5702. void set_ddy0(llvm::Value *val) { Instr->setOperand(11, val); }
  5703. llvm::Value *get_ddy1() const { return Instr->getOperand(12); }
  5704. void set_ddy1(llvm::Value *val) { Instr->setOperand(12, val); }
  5705. llvm::Value *get_ddy2() const { return Instr->getOperand(13); }
  5706. void set_ddy2(llvm::Value *val) { Instr->setOperand(13, val); }
  5707. llvm::Value *get_clamp() const { return Instr->getOperand(14); }
  5708. void set_clamp(llvm::Value *val) { Instr->setOperand(14, val); }
  5709. };
  5710. /// This instruction allocates space for RayQuery and return handle
  5711. struct DxilInst_AllocateRayQuery {
  5712. llvm::Instruction *Instr;
  5713. // Construction and identification
  5714. DxilInst_AllocateRayQuery(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5715. operator bool() const {
  5716. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::AllocateRayQuery);
  5717. }
  5718. // Validation support
  5719. bool isAllowed() const { return true; }
  5720. bool isArgumentListValid() const {
  5721. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5722. return true;
  5723. }
  5724. // Metadata
  5725. bool requiresUniformInputs() const { return false; }
  5726. // Operand indexes
  5727. enum OperandIdx {
  5728. arg_constRayFlags = 1,
  5729. };
  5730. // Accessors
  5731. llvm::Value *get_constRayFlags() const { return Instr->getOperand(1); }
  5732. void set_constRayFlags(llvm::Value *val) { Instr->setOperand(1, val); }
  5733. uint32_t get_constRayFlags_val() const { return (uint32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(1))->getZExtValue()); }
  5734. void set_constRayFlags_val(uint32_t val) { Instr->setOperand(1, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 32), llvm::APInt(32, (uint64_t)val))); }
  5735. };
  5736. /// This instruction initializes RayQuery for raytrace
  5737. struct DxilInst_RayQuery_TraceRayInline {
  5738. llvm::Instruction *Instr;
  5739. // Construction and identification
  5740. DxilInst_RayQuery_TraceRayInline(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5741. operator bool() const {
  5742. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_TraceRayInline);
  5743. }
  5744. // Validation support
  5745. bool isAllowed() const { return true; }
  5746. bool isArgumentListValid() const {
  5747. if (13 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5748. return true;
  5749. }
  5750. // Metadata
  5751. bool requiresUniformInputs() const { return false; }
  5752. // Operand indexes
  5753. enum OperandIdx {
  5754. arg_rayQueryHandle = 1,
  5755. arg_accelerationStructure = 2,
  5756. arg_rayFlags = 3,
  5757. arg_instanceInclusionMask = 4,
  5758. arg_origin_X = 5,
  5759. arg_origin_Y = 6,
  5760. arg_origin_Z = 7,
  5761. arg_tMin = 8,
  5762. arg_direction_X = 9,
  5763. arg_direction_Y = 10,
  5764. arg_direction_Z = 11,
  5765. arg_tMax = 12,
  5766. };
  5767. // Accessors
  5768. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  5769. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  5770. llvm::Value *get_accelerationStructure() const { return Instr->getOperand(2); }
  5771. void set_accelerationStructure(llvm::Value *val) { Instr->setOperand(2, val); }
  5772. llvm::Value *get_rayFlags() const { return Instr->getOperand(3); }
  5773. void set_rayFlags(llvm::Value *val) { Instr->setOperand(3, val); }
  5774. llvm::Value *get_instanceInclusionMask() const { return Instr->getOperand(4); }
  5775. void set_instanceInclusionMask(llvm::Value *val) { Instr->setOperand(4, val); }
  5776. llvm::Value *get_origin_X() const { return Instr->getOperand(5); }
  5777. void set_origin_X(llvm::Value *val) { Instr->setOperand(5, val); }
  5778. llvm::Value *get_origin_Y() const { return Instr->getOperand(6); }
  5779. void set_origin_Y(llvm::Value *val) { Instr->setOperand(6, val); }
  5780. llvm::Value *get_origin_Z() const { return Instr->getOperand(7); }
  5781. void set_origin_Z(llvm::Value *val) { Instr->setOperand(7, val); }
  5782. llvm::Value *get_tMin() const { return Instr->getOperand(8); }
  5783. void set_tMin(llvm::Value *val) { Instr->setOperand(8, val); }
  5784. llvm::Value *get_direction_X() const { return Instr->getOperand(9); }
  5785. void set_direction_X(llvm::Value *val) { Instr->setOperand(9, val); }
  5786. llvm::Value *get_direction_Y() const { return Instr->getOperand(10); }
  5787. void set_direction_Y(llvm::Value *val) { Instr->setOperand(10, val); }
  5788. llvm::Value *get_direction_Z() const { return Instr->getOperand(11); }
  5789. void set_direction_Z(llvm::Value *val) { Instr->setOperand(11, val); }
  5790. llvm::Value *get_tMax() const { return Instr->getOperand(12); }
  5791. void set_tMax(llvm::Value *val) { Instr->setOperand(12, val); }
  5792. };
  5793. /// This instruction advances a ray query
  5794. struct DxilInst_RayQuery_Proceed {
  5795. llvm::Instruction *Instr;
  5796. // Construction and identification
  5797. DxilInst_RayQuery_Proceed(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5798. operator bool() const {
  5799. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_Proceed);
  5800. }
  5801. // Validation support
  5802. bool isAllowed() const { return true; }
  5803. bool isArgumentListValid() const {
  5804. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5805. return true;
  5806. }
  5807. // Metadata
  5808. bool requiresUniformInputs() const { return false; }
  5809. // Operand indexes
  5810. enum OperandIdx {
  5811. arg_rayQueryHandle = 1,
  5812. };
  5813. // Accessors
  5814. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  5815. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  5816. };
  5817. /// This instruction aborts a ray query
  5818. struct DxilInst_RayQuery_Abort {
  5819. llvm::Instruction *Instr;
  5820. // Construction and identification
  5821. DxilInst_RayQuery_Abort(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5822. operator bool() const {
  5823. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_Abort);
  5824. }
  5825. // Validation support
  5826. bool isAllowed() const { return true; }
  5827. bool isArgumentListValid() const {
  5828. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5829. return true;
  5830. }
  5831. // Metadata
  5832. bool requiresUniformInputs() const { return false; }
  5833. // Operand indexes
  5834. enum OperandIdx {
  5835. arg_rayQueryHandle = 1,
  5836. };
  5837. // Accessors
  5838. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  5839. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  5840. };
  5841. /// This instruction commits a non opaque triangle hit
  5842. struct DxilInst_RayQuery_CommitNonOpaqueTriangleHit {
  5843. llvm::Instruction *Instr;
  5844. // Construction and identification
  5845. DxilInst_RayQuery_CommitNonOpaqueTriangleHit(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5846. operator bool() const {
  5847. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommitNonOpaqueTriangleHit);
  5848. }
  5849. // Validation support
  5850. bool isAllowed() const { return true; }
  5851. bool isArgumentListValid() const {
  5852. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5853. return true;
  5854. }
  5855. // Metadata
  5856. bool requiresUniformInputs() const { return false; }
  5857. // Operand indexes
  5858. enum OperandIdx {
  5859. arg_rayQueryHandle = 1,
  5860. };
  5861. // Accessors
  5862. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  5863. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  5864. };
  5865. /// This instruction commits a procedural primitive hit
  5866. struct DxilInst_RayQuery_CommitProceduralPrimitiveHit {
  5867. llvm::Instruction *Instr;
  5868. // Construction and identification
  5869. DxilInst_RayQuery_CommitProceduralPrimitiveHit(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5870. operator bool() const {
  5871. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommitProceduralPrimitiveHit);
  5872. }
  5873. // Validation support
  5874. bool isAllowed() const { return true; }
  5875. bool isArgumentListValid() const {
  5876. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5877. return true;
  5878. }
  5879. // Metadata
  5880. bool requiresUniformInputs() const { return false; }
  5881. // Operand indexes
  5882. enum OperandIdx {
  5883. arg_rayQueryHandle = 1,
  5884. arg_t = 2,
  5885. };
  5886. // Accessors
  5887. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  5888. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  5889. llvm::Value *get_t() const { return Instr->getOperand(2); }
  5890. void set_t(llvm::Value *val) { Instr->setOperand(2, val); }
  5891. };
  5892. /// This instruction returns uint status (COMMITTED_STATUS) of the committed hit in a ray query
  5893. struct DxilInst_RayQuery_CommittedStatus {
  5894. llvm::Instruction *Instr;
  5895. // Construction and identification
  5896. DxilInst_RayQuery_CommittedStatus(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5897. operator bool() const {
  5898. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedStatus);
  5899. }
  5900. // Validation support
  5901. bool isAllowed() const { return true; }
  5902. bool isArgumentListValid() const {
  5903. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5904. return true;
  5905. }
  5906. // Metadata
  5907. bool requiresUniformInputs() const { return false; }
  5908. // Operand indexes
  5909. enum OperandIdx {
  5910. arg_rayQueryHandle = 1,
  5911. };
  5912. // Accessors
  5913. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  5914. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  5915. };
  5916. /// This instruction returns uint candidate type (CANDIDATE_TYPE) of the current hit candidate in a ray query, after Proceed() has returned true
  5917. struct DxilInst_RayQuery_CandidateType {
  5918. llvm::Instruction *Instr;
  5919. // Construction and identification
  5920. DxilInst_RayQuery_CandidateType(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5921. operator bool() const {
  5922. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateType);
  5923. }
  5924. // Validation support
  5925. bool isAllowed() const { return true; }
  5926. bool isArgumentListValid() const {
  5927. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5928. return true;
  5929. }
  5930. // Metadata
  5931. bool requiresUniformInputs() const { return false; }
  5932. // Operand indexes
  5933. enum OperandIdx {
  5934. arg_rayQueryHandle = 1,
  5935. };
  5936. // Accessors
  5937. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  5938. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  5939. };
  5940. /// This instruction returns matrix for transforming from object-space to world-space for a candidate hit.
  5941. struct DxilInst_RayQuery_CandidateObjectToWorld3x4 {
  5942. llvm::Instruction *Instr;
  5943. // Construction and identification
  5944. DxilInst_RayQuery_CandidateObjectToWorld3x4(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5945. operator bool() const {
  5946. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateObjectToWorld3x4);
  5947. }
  5948. // Validation support
  5949. bool isAllowed() const { return true; }
  5950. bool isArgumentListValid() const {
  5951. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5952. return true;
  5953. }
  5954. // Metadata
  5955. bool requiresUniformInputs() const { return false; }
  5956. // Operand indexes
  5957. enum OperandIdx {
  5958. arg_rayQueryHandle = 1,
  5959. arg_row = 2,
  5960. arg_col = 3,
  5961. };
  5962. // Accessors
  5963. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  5964. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  5965. llvm::Value *get_row() const { return Instr->getOperand(2); }
  5966. void set_row(llvm::Value *val) { Instr->setOperand(2, val); }
  5967. llvm::Value *get_col() const { return Instr->getOperand(3); }
  5968. void set_col(llvm::Value *val) { Instr->setOperand(3, val); }
  5969. };
  5970. /// This instruction returns matrix for transforming from world-space to object-space for a candidate hit.
  5971. struct DxilInst_RayQuery_CandidateWorldToObject3x4 {
  5972. llvm::Instruction *Instr;
  5973. // Construction and identification
  5974. DxilInst_RayQuery_CandidateWorldToObject3x4(llvm::Instruction *pInstr) : Instr(pInstr) {}
  5975. operator bool() const {
  5976. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateWorldToObject3x4);
  5977. }
  5978. // Validation support
  5979. bool isAllowed() const { return true; }
  5980. bool isArgumentListValid() const {
  5981. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  5982. return true;
  5983. }
  5984. // Metadata
  5985. bool requiresUniformInputs() const { return false; }
  5986. // Operand indexes
  5987. enum OperandIdx {
  5988. arg_rayQueryHandle = 1,
  5989. arg_row = 2,
  5990. arg_col = 3,
  5991. };
  5992. // Accessors
  5993. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  5994. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  5995. llvm::Value *get_row() const { return Instr->getOperand(2); }
  5996. void set_row(llvm::Value *val) { Instr->setOperand(2, val); }
  5997. llvm::Value *get_col() const { return Instr->getOperand(3); }
  5998. void set_col(llvm::Value *val) { Instr->setOperand(3, val); }
  5999. };
  6000. /// This instruction returns matrix for transforming from object-space to world-space for a Committed hit.
  6001. struct DxilInst_RayQuery_CommittedObjectToWorld3x4 {
  6002. llvm::Instruction *Instr;
  6003. // Construction and identification
  6004. DxilInst_RayQuery_CommittedObjectToWorld3x4(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6005. operator bool() const {
  6006. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedObjectToWorld3x4);
  6007. }
  6008. // Validation support
  6009. bool isAllowed() const { return true; }
  6010. bool isArgumentListValid() const {
  6011. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6012. return true;
  6013. }
  6014. // Metadata
  6015. bool requiresUniformInputs() const { return false; }
  6016. // Operand indexes
  6017. enum OperandIdx {
  6018. arg_rayQueryHandle = 1,
  6019. arg_row = 2,
  6020. arg_col = 3,
  6021. };
  6022. // Accessors
  6023. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6024. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6025. llvm::Value *get_row() const { return Instr->getOperand(2); }
  6026. void set_row(llvm::Value *val) { Instr->setOperand(2, val); }
  6027. llvm::Value *get_col() const { return Instr->getOperand(3); }
  6028. void set_col(llvm::Value *val) { Instr->setOperand(3, val); }
  6029. };
  6030. /// This instruction returns matrix for transforming from world-space to object-space for a Committed hit.
  6031. struct DxilInst_RayQuery_CommittedWorldToObject3x4 {
  6032. llvm::Instruction *Instr;
  6033. // Construction and identification
  6034. DxilInst_RayQuery_CommittedWorldToObject3x4(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6035. operator bool() const {
  6036. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedWorldToObject3x4);
  6037. }
  6038. // Validation support
  6039. bool isAllowed() const { return true; }
  6040. bool isArgumentListValid() const {
  6041. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6042. return true;
  6043. }
  6044. // Metadata
  6045. bool requiresUniformInputs() const { return false; }
  6046. // Operand indexes
  6047. enum OperandIdx {
  6048. arg_rayQueryHandle = 1,
  6049. arg_row = 2,
  6050. arg_col = 3,
  6051. };
  6052. // Accessors
  6053. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6054. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6055. llvm::Value *get_row() const { return Instr->getOperand(2); }
  6056. void set_row(llvm::Value *val) { Instr->setOperand(2, val); }
  6057. llvm::Value *get_col() const { return Instr->getOperand(3); }
  6058. void set_col(llvm::Value *val) { Instr->setOperand(3, val); }
  6059. };
  6060. /// This instruction returns if current candidate procedural primitive is non opaque
  6061. struct DxilInst_RayQuery_CandidateProceduralPrimitiveNonOpaque {
  6062. llvm::Instruction *Instr;
  6063. // Construction and identification
  6064. DxilInst_RayQuery_CandidateProceduralPrimitiveNonOpaque(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6065. operator bool() const {
  6066. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateProceduralPrimitiveNonOpaque);
  6067. }
  6068. // Validation support
  6069. bool isAllowed() const { return true; }
  6070. bool isArgumentListValid() const {
  6071. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6072. return true;
  6073. }
  6074. // Metadata
  6075. bool requiresUniformInputs() const { return false; }
  6076. // Operand indexes
  6077. enum OperandIdx {
  6078. arg_rayQueryHandle = 1,
  6079. };
  6080. // Accessors
  6081. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6082. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6083. };
  6084. /// This instruction returns if current candidate triangle is front facing
  6085. struct DxilInst_RayQuery_CandidateTriangleFrontFace {
  6086. llvm::Instruction *Instr;
  6087. // Construction and identification
  6088. DxilInst_RayQuery_CandidateTriangleFrontFace(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6089. operator bool() const {
  6090. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateTriangleFrontFace);
  6091. }
  6092. // Validation support
  6093. bool isAllowed() const { return true; }
  6094. bool isArgumentListValid() const {
  6095. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6096. return true;
  6097. }
  6098. // Metadata
  6099. bool requiresUniformInputs() const { return false; }
  6100. // Operand indexes
  6101. enum OperandIdx {
  6102. arg_rayQueryHandle = 1,
  6103. };
  6104. // Accessors
  6105. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6106. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6107. };
  6108. /// This instruction returns if current committed triangle is front facing
  6109. struct DxilInst_RayQuery_CommittedTriangleFrontFace {
  6110. llvm::Instruction *Instr;
  6111. // Construction and identification
  6112. DxilInst_RayQuery_CommittedTriangleFrontFace(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6113. operator bool() const {
  6114. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedTriangleFrontFace);
  6115. }
  6116. // Validation support
  6117. bool isAllowed() const { return true; }
  6118. bool isArgumentListValid() const {
  6119. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6120. return true;
  6121. }
  6122. // Metadata
  6123. bool requiresUniformInputs() const { return false; }
  6124. // Operand indexes
  6125. enum OperandIdx {
  6126. arg_rayQueryHandle = 1,
  6127. };
  6128. // Accessors
  6129. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6130. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6131. };
  6132. /// This instruction returns candidate triangle hit barycentrics
  6133. struct DxilInst_RayQuery_CandidateTriangleBarycentrics {
  6134. llvm::Instruction *Instr;
  6135. // Construction and identification
  6136. DxilInst_RayQuery_CandidateTriangleBarycentrics(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6137. operator bool() const {
  6138. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateTriangleBarycentrics);
  6139. }
  6140. // Validation support
  6141. bool isAllowed() const { return true; }
  6142. bool isArgumentListValid() const {
  6143. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6144. return true;
  6145. }
  6146. // Metadata
  6147. bool requiresUniformInputs() const { return false; }
  6148. // Operand indexes
  6149. enum OperandIdx {
  6150. arg_rayQueryHandle = 1,
  6151. arg_component = 2,
  6152. };
  6153. // Accessors
  6154. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6155. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6156. llvm::Value *get_component() const { return Instr->getOperand(2); }
  6157. void set_component(llvm::Value *val) { Instr->setOperand(2, val); }
  6158. int8_t get_component_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  6159. void set_component_val(int8_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  6160. };
  6161. /// This instruction returns committed triangle hit barycentrics
  6162. struct DxilInst_RayQuery_CommittedTriangleBarycentrics {
  6163. llvm::Instruction *Instr;
  6164. // Construction and identification
  6165. DxilInst_RayQuery_CommittedTriangleBarycentrics(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6166. operator bool() const {
  6167. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedTriangleBarycentrics);
  6168. }
  6169. // Validation support
  6170. bool isAllowed() const { return true; }
  6171. bool isArgumentListValid() const {
  6172. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6173. return true;
  6174. }
  6175. // Metadata
  6176. bool requiresUniformInputs() const { return false; }
  6177. // Operand indexes
  6178. enum OperandIdx {
  6179. arg_rayQueryHandle = 1,
  6180. arg_component = 2,
  6181. };
  6182. // Accessors
  6183. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6184. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6185. llvm::Value *get_component() const { return Instr->getOperand(2); }
  6186. void set_component(llvm::Value *val) { Instr->setOperand(2, val); }
  6187. int8_t get_component_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  6188. void set_component_val(int8_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  6189. };
  6190. /// This instruction returns ray flags
  6191. struct DxilInst_RayQuery_RayFlags {
  6192. llvm::Instruction *Instr;
  6193. // Construction and identification
  6194. DxilInst_RayQuery_RayFlags(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6195. operator bool() const {
  6196. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_RayFlags);
  6197. }
  6198. // Validation support
  6199. bool isAllowed() const { return true; }
  6200. bool isArgumentListValid() const {
  6201. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6202. return true;
  6203. }
  6204. // Metadata
  6205. bool requiresUniformInputs() const { return false; }
  6206. // Operand indexes
  6207. enum OperandIdx {
  6208. arg_rayQueryHandle = 1,
  6209. };
  6210. // Accessors
  6211. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6212. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6213. };
  6214. /// This instruction returns world ray origin
  6215. struct DxilInst_RayQuery_WorldRayOrigin {
  6216. llvm::Instruction *Instr;
  6217. // Construction and identification
  6218. DxilInst_RayQuery_WorldRayOrigin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6219. operator bool() const {
  6220. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_WorldRayOrigin);
  6221. }
  6222. // Validation support
  6223. bool isAllowed() const { return true; }
  6224. bool isArgumentListValid() const {
  6225. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6226. return true;
  6227. }
  6228. // Metadata
  6229. bool requiresUniformInputs() const { return false; }
  6230. // Operand indexes
  6231. enum OperandIdx {
  6232. arg_rayQueryHandle = 1,
  6233. arg_component = 2,
  6234. };
  6235. // Accessors
  6236. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6237. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6238. llvm::Value *get_component() const { return Instr->getOperand(2); }
  6239. void set_component(llvm::Value *val) { Instr->setOperand(2, val); }
  6240. int8_t get_component_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  6241. void set_component_val(int8_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  6242. };
  6243. /// This instruction returns world ray direction
  6244. struct DxilInst_RayQuery_WorldRayDirection {
  6245. llvm::Instruction *Instr;
  6246. // Construction and identification
  6247. DxilInst_RayQuery_WorldRayDirection(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6248. operator bool() const {
  6249. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_WorldRayDirection);
  6250. }
  6251. // Validation support
  6252. bool isAllowed() const { return true; }
  6253. bool isArgumentListValid() const {
  6254. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6255. return true;
  6256. }
  6257. // Metadata
  6258. bool requiresUniformInputs() const { return false; }
  6259. // Operand indexes
  6260. enum OperandIdx {
  6261. arg_rayQueryHandle = 1,
  6262. arg_component = 2,
  6263. };
  6264. // Accessors
  6265. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6266. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6267. llvm::Value *get_component() const { return Instr->getOperand(2); }
  6268. void set_component(llvm::Value *val) { Instr->setOperand(2, val); }
  6269. int8_t get_component_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  6270. void set_component_val(int8_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  6271. };
  6272. /// This instruction returns float representing the parametric starting point for the ray.
  6273. struct DxilInst_RayQuery_RayTMin {
  6274. llvm::Instruction *Instr;
  6275. // Construction and identification
  6276. DxilInst_RayQuery_RayTMin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6277. operator bool() const {
  6278. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_RayTMin);
  6279. }
  6280. // Validation support
  6281. bool isAllowed() const { return true; }
  6282. bool isArgumentListValid() const {
  6283. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6284. return true;
  6285. }
  6286. // Metadata
  6287. bool requiresUniformInputs() const { return false; }
  6288. // Operand indexes
  6289. enum OperandIdx {
  6290. arg_rayQueryHandle = 1,
  6291. };
  6292. // Accessors
  6293. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6294. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6295. };
  6296. /// This instruction returns float representing the parametric point on the ray for the current candidate triangle hit.
  6297. struct DxilInst_RayQuery_CandidateTriangleRayT {
  6298. llvm::Instruction *Instr;
  6299. // Construction and identification
  6300. DxilInst_RayQuery_CandidateTriangleRayT(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6301. operator bool() const {
  6302. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateTriangleRayT);
  6303. }
  6304. // Validation support
  6305. bool isAllowed() const { return true; }
  6306. bool isArgumentListValid() const {
  6307. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6308. return true;
  6309. }
  6310. // Metadata
  6311. bool requiresUniformInputs() const { return false; }
  6312. // Operand indexes
  6313. enum OperandIdx {
  6314. arg_rayQueryHandle = 1,
  6315. };
  6316. // Accessors
  6317. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6318. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6319. };
  6320. /// This instruction returns float representing the parametric point on the ray for the current committed hit.
  6321. struct DxilInst_RayQuery_CommittedRayT {
  6322. llvm::Instruction *Instr;
  6323. // Construction and identification
  6324. DxilInst_RayQuery_CommittedRayT(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6325. operator bool() const {
  6326. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedRayT);
  6327. }
  6328. // Validation support
  6329. bool isAllowed() const { return true; }
  6330. bool isArgumentListValid() const {
  6331. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6332. return true;
  6333. }
  6334. // Metadata
  6335. bool requiresUniformInputs() const { return false; }
  6336. // Operand indexes
  6337. enum OperandIdx {
  6338. arg_rayQueryHandle = 1,
  6339. };
  6340. // Accessors
  6341. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6342. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6343. };
  6344. /// This instruction returns candidate hit instance index
  6345. struct DxilInst_RayQuery_CandidateInstanceIndex {
  6346. llvm::Instruction *Instr;
  6347. // Construction and identification
  6348. DxilInst_RayQuery_CandidateInstanceIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6349. operator bool() const {
  6350. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateInstanceIndex);
  6351. }
  6352. // Validation support
  6353. bool isAllowed() const { return true; }
  6354. bool isArgumentListValid() const {
  6355. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6356. return true;
  6357. }
  6358. // Metadata
  6359. bool requiresUniformInputs() const { return false; }
  6360. // Operand indexes
  6361. enum OperandIdx {
  6362. arg_rayQueryHandle = 1,
  6363. };
  6364. // Accessors
  6365. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6366. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6367. };
  6368. /// This instruction returns candidate hit instance ID
  6369. struct DxilInst_RayQuery_CandidateInstanceID {
  6370. llvm::Instruction *Instr;
  6371. // Construction and identification
  6372. DxilInst_RayQuery_CandidateInstanceID(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6373. operator bool() const {
  6374. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateInstanceID);
  6375. }
  6376. // Validation support
  6377. bool isAllowed() const { return true; }
  6378. bool isArgumentListValid() const {
  6379. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6380. return true;
  6381. }
  6382. // Metadata
  6383. bool requiresUniformInputs() const { return false; }
  6384. // Operand indexes
  6385. enum OperandIdx {
  6386. arg_rayQueryHandle = 1,
  6387. };
  6388. // Accessors
  6389. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6390. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6391. };
  6392. /// This instruction returns candidate hit geometry index
  6393. struct DxilInst_RayQuery_CandidateGeometryIndex {
  6394. llvm::Instruction *Instr;
  6395. // Construction and identification
  6396. DxilInst_RayQuery_CandidateGeometryIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6397. operator bool() const {
  6398. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateGeometryIndex);
  6399. }
  6400. // Validation support
  6401. bool isAllowed() const { return true; }
  6402. bool isArgumentListValid() const {
  6403. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6404. return true;
  6405. }
  6406. // Metadata
  6407. bool requiresUniformInputs() const { return false; }
  6408. // Operand indexes
  6409. enum OperandIdx {
  6410. arg_rayQueryHandle = 1,
  6411. };
  6412. // Accessors
  6413. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6414. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6415. };
  6416. /// This instruction returns candidate hit geometry index
  6417. struct DxilInst_RayQuery_CandidatePrimitiveIndex {
  6418. llvm::Instruction *Instr;
  6419. // Construction and identification
  6420. DxilInst_RayQuery_CandidatePrimitiveIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6421. operator bool() const {
  6422. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidatePrimitiveIndex);
  6423. }
  6424. // Validation support
  6425. bool isAllowed() const { return true; }
  6426. bool isArgumentListValid() const {
  6427. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6428. return true;
  6429. }
  6430. // Metadata
  6431. bool requiresUniformInputs() const { return false; }
  6432. // Operand indexes
  6433. enum OperandIdx {
  6434. arg_rayQueryHandle = 1,
  6435. };
  6436. // Accessors
  6437. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6438. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6439. };
  6440. /// This instruction returns candidate hit object ray origin
  6441. struct DxilInst_RayQuery_CandidateObjectRayOrigin {
  6442. llvm::Instruction *Instr;
  6443. // Construction and identification
  6444. DxilInst_RayQuery_CandidateObjectRayOrigin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6445. operator bool() const {
  6446. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateObjectRayOrigin);
  6447. }
  6448. // Validation support
  6449. bool isAllowed() const { return true; }
  6450. bool isArgumentListValid() const {
  6451. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6452. return true;
  6453. }
  6454. // Metadata
  6455. bool requiresUniformInputs() const { return false; }
  6456. // Operand indexes
  6457. enum OperandIdx {
  6458. arg_rayQueryHandle = 1,
  6459. arg_component = 2,
  6460. };
  6461. // Accessors
  6462. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6463. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6464. llvm::Value *get_component() const { return Instr->getOperand(2); }
  6465. void set_component(llvm::Value *val) { Instr->setOperand(2, val); }
  6466. int8_t get_component_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  6467. void set_component_val(int8_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  6468. };
  6469. /// This instruction returns candidate object ray direction
  6470. struct DxilInst_RayQuery_CandidateObjectRayDirection {
  6471. llvm::Instruction *Instr;
  6472. // Construction and identification
  6473. DxilInst_RayQuery_CandidateObjectRayDirection(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6474. operator bool() const {
  6475. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateObjectRayDirection);
  6476. }
  6477. // Validation support
  6478. bool isAllowed() const { return true; }
  6479. bool isArgumentListValid() const {
  6480. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6481. return true;
  6482. }
  6483. // Metadata
  6484. bool requiresUniformInputs() const { return false; }
  6485. // Operand indexes
  6486. enum OperandIdx {
  6487. arg_rayQueryHandle = 1,
  6488. arg_component = 2,
  6489. };
  6490. // Accessors
  6491. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6492. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6493. llvm::Value *get_component() const { return Instr->getOperand(2); }
  6494. void set_component(llvm::Value *val) { Instr->setOperand(2, val); }
  6495. int8_t get_component_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  6496. void set_component_val(int8_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  6497. };
  6498. /// This instruction returns committed hit instance index
  6499. struct DxilInst_RayQuery_CommittedInstanceIndex {
  6500. llvm::Instruction *Instr;
  6501. // Construction and identification
  6502. DxilInst_RayQuery_CommittedInstanceIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6503. operator bool() const {
  6504. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedInstanceIndex);
  6505. }
  6506. // Validation support
  6507. bool isAllowed() const { return true; }
  6508. bool isArgumentListValid() const {
  6509. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6510. return true;
  6511. }
  6512. // Metadata
  6513. bool requiresUniformInputs() const { return false; }
  6514. // Operand indexes
  6515. enum OperandIdx {
  6516. arg_rayQueryHandle = 1,
  6517. };
  6518. // Accessors
  6519. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6520. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6521. };
  6522. /// This instruction returns committed hit instance ID
  6523. struct DxilInst_RayQuery_CommittedInstanceID {
  6524. llvm::Instruction *Instr;
  6525. // Construction and identification
  6526. DxilInst_RayQuery_CommittedInstanceID(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6527. operator bool() const {
  6528. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedInstanceID);
  6529. }
  6530. // Validation support
  6531. bool isAllowed() const { return true; }
  6532. bool isArgumentListValid() const {
  6533. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6534. return true;
  6535. }
  6536. // Metadata
  6537. bool requiresUniformInputs() const { return false; }
  6538. // Operand indexes
  6539. enum OperandIdx {
  6540. arg_rayQueryHandle = 1,
  6541. };
  6542. // Accessors
  6543. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6544. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6545. };
  6546. /// This instruction returns committed hit geometry index
  6547. struct DxilInst_RayQuery_CommittedGeometryIndex {
  6548. llvm::Instruction *Instr;
  6549. // Construction and identification
  6550. DxilInst_RayQuery_CommittedGeometryIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6551. operator bool() const {
  6552. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedGeometryIndex);
  6553. }
  6554. // Validation support
  6555. bool isAllowed() const { return true; }
  6556. bool isArgumentListValid() const {
  6557. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6558. return true;
  6559. }
  6560. // Metadata
  6561. bool requiresUniformInputs() const { return false; }
  6562. // Operand indexes
  6563. enum OperandIdx {
  6564. arg_rayQueryHandle = 1,
  6565. };
  6566. // Accessors
  6567. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6568. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6569. };
  6570. /// This instruction returns committed hit geometry index
  6571. struct DxilInst_RayQuery_CommittedPrimitiveIndex {
  6572. llvm::Instruction *Instr;
  6573. // Construction and identification
  6574. DxilInst_RayQuery_CommittedPrimitiveIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6575. operator bool() const {
  6576. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedPrimitiveIndex);
  6577. }
  6578. // Validation support
  6579. bool isAllowed() const { return true; }
  6580. bool isArgumentListValid() const {
  6581. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6582. return true;
  6583. }
  6584. // Metadata
  6585. bool requiresUniformInputs() const { return false; }
  6586. // Operand indexes
  6587. enum OperandIdx {
  6588. arg_rayQueryHandle = 1,
  6589. };
  6590. // Accessors
  6591. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6592. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6593. };
  6594. /// This instruction returns committed hit object ray origin
  6595. struct DxilInst_RayQuery_CommittedObjectRayOrigin {
  6596. llvm::Instruction *Instr;
  6597. // Construction and identification
  6598. DxilInst_RayQuery_CommittedObjectRayOrigin(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6599. operator bool() const {
  6600. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedObjectRayOrigin);
  6601. }
  6602. // Validation support
  6603. bool isAllowed() const { return true; }
  6604. bool isArgumentListValid() const {
  6605. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6606. return true;
  6607. }
  6608. // Metadata
  6609. bool requiresUniformInputs() const { return false; }
  6610. // Operand indexes
  6611. enum OperandIdx {
  6612. arg_rayQueryHandle = 1,
  6613. arg_component = 2,
  6614. };
  6615. // Accessors
  6616. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6617. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6618. llvm::Value *get_component() const { return Instr->getOperand(2); }
  6619. void set_component(llvm::Value *val) { Instr->setOperand(2, val); }
  6620. int8_t get_component_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  6621. void set_component_val(int8_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  6622. };
  6623. /// This instruction returns committed object ray direction
  6624. struct DxilInst_RayQuery_CommittedObjectRayDirection {
  6625. llvm::Instruction *Instr;
  6626. // Construction and identification
  6627. DxilInst_RayQuery_CommittedObjectRayDirection(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6628. operator bool() const {
  6629. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedObjectRayDirection);
  6630. }
  6631. // Validation support
  6632. bool isAllowed() const { return true; }
  6633. bool isArgumentListValid() const {
  6634. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6635. return true;
  6636. }
  6637. // Metadata
  6638. bool requiresUniformInputs() const { return false; }
  6639. // Operand indexes
  6640. enum OperandIdx {
  6641. arg_rayQueryHandle = 1,
  6642. arg_component = 2,
  6643. };
  6644. // Accessors
  6645. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6646. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6647. llvm::Value *get_component() const { return Instr->getOperand(2); }
  6648. void set_component(llvm::Value *val) { Instr->setOperand(2, val); }
  6649. int8_t get_component_val() const { return (int8_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  6650. void set_component_val(int8_t val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 8), llvm::APInt(8, (uint64_t)val))); }
  6651. };
  6652. /// This instruction The autogenerated index of the current geometry in the bottom-level structure
  6653. struct DxilInst_GeometryIndex {
  6654. llvm::Instruction *Instr;
  6655. // Construction and identification
  6656. DxilInst_GeometryIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6657. operator bool() const {
  6658. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::GeometryIndex);
  6659. }
  6660. // Validation support
  6661. bool isAllowed() const { return true; }
  6662. bool isArgumentListValid() const {
  6663. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6664. return true;
  6665. }
  6666. // Metadata
  6667. bool requiresUniformInputs() const { return false; }
  6668. };
  6669. /// This instruction returns candidate hit InstanceContributionToHitGroupIndex
  6670. struct DxilInst_RayQuery_CandidateInstanceContributionToHitGroupIndex {
  6671. llvm::Instruction *Instr;
  6672. // Construction and identification
  6673. DxilInst_RayQuery_CandidateInstanceContributionToHitGroupIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6674. operator bool() const {
  6675. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CandidateInstanceContributionToHitGroupIndex);
  6676. }
  6677. // Validation support
  6678. bool isAllowed() const { return true; }
  6679. bool isArgumentListValid() const {
  6680. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6681. return true;
  6682. }
  6683. // Metadata
  6684. bool requiresUniformInputs() const { return false; }
  6685. // Operand indexes
  6686. enum OperandIdx {
  6687. arg_rayQueryHandle = 1,
  6688. };
  6689. // Accessors
  6690. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6691. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6692. };
  6693. /// This instruction returns committed hit InstanceContributionToHitGroupIndex
  6694. struct DxilInst_RayQuery_CommittedInstanceContributionToHitGroupIndex {
  6695. llvm::Instruction *Instr;
  6696. // Construction and identification
  6697. DxilInst_RayQuery_CommittedInstanceContributionToHitGroupIndex(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6698. operator bool() const {
  6699. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::RayQuery_CommittedInstanceContributionToHitGroupIndex);
  6700. }
  6701. // Validation support
  6702. bool isAllowed() const { return true; }
  6703. bool isArgumentListValid() const {
  6704. if (2 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6705. return true;
  6706. }
  6707. // Metadata
  6708. bool requiresUniformInputs() const { return false; }
  6709. // Operand indexes
  6710. enum OperandIdx {
  6711. arg_rayQueryHandle = 1,
  6712. };
  6713. // Accessors
  6714. llvm::Value *get_rayQueryHandle() const { return Instr->getOperand(1); }
  6715. void set_rayQueryHandle(llvm::Value *val) { Instr->setOperand(1, val); }
  6716. };
  6717. /// This instruction annotate handle with resource properties
  6718. struct DxilInst_AnnotateHandle {
  6719. llvm::Instruction *Instr;
  6720. // Construction and identification
  6721. DxilInst_AnnotateHandle(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6722. operator bool() const {
  6723. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::AnnotateHandle);
  6724. }
  6725. // Validation support
  6726. bool isAllowed() const { return true; }
  6727. bool isArgumentListValid() const {
  6728. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6729. return true;
  6730. }
  6731. // Metadata
  6732. bool requiresUniformInputs() const { return false; }
  6733. // Operand indexes
  6734. enum OperandIdx {
  6735. arg_res = 1,
  6736. arg_props = 2,
  6737. };
  6738. // Accessors
  6739. llvm::Value *get_res() const { return Instr->getOperand(1); }
  6740. void set_res(llvm::Value *val) { Instr->setOperand(1, val); }
  6741. llvm::Value *get_props() const { return Instr->getOperand(2); }
  6742. void set_props(llvm::Value *val) { Instr->setOperand(2, val); }
  6743. };
  6744. /// This instruction create resource handle from binding
  6745. struct DxilInst_CreateHandleFromBinding {
  6746. llvm::Instruction *Instr;
  6747. // Construction and identification
  6748. DxilInst_CreateHandleFromBinding(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6749. operator bool() const {
  6750. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::CreateHandleFromBinding);
  6751. }
  6752. // Validation support
  6753. bool isAllowed() const { return true; }
  6754. bool isArgumentListValid() const {
  6755. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6756. return true;
  6757. }
  6758. // Metadata
  6759. bool requiresUniformInputs() const { return false; }
  6760. // Operand indexes
  6761. enum OperandIdx {
  6762. arg_bind = 1,
  6763. arg_index = 2,
  6764. arg_nonUniformIndex = 3,
  6765. };
  6766. // Accessors
  6767. llvm::Value *get_bind() const { return Instr->getOperand(1); }
  6768. void set_bind(llvm::Value *val) { Instr->setOperand(1, val); }
  6769. llvm::Value *get_index() const { return Instr->getOperand(2); }
  6770. void set_index(llvm::Value *val) { Instr->setOperand(2, val); }
  6771. llvm::Value *get_nonUniformIndex() const { return Instr->getOperand(3); }
  6772. void set_nonUniformIndex(llvm::Value *val) { Instr->setOperand(3, val); }
  6773. bool get_nonUniformIndex_val() const { return (bool)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(3))->getZExtValue()); }
  6774. void set_nonUniformIndex_val(bool val) { Instr->setOperand(3, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 1), llvm::APInt(1, (uint64_t)val))); }
  6775. };
  6776. /// This instruction create resource handle from heap
  6777. struct DxilInst_CreateHandleFromHeap {
  6778. llvm::Instruction *Instr;
  6779. // Construction and identification
  6780. DxilInst_CreateHandleFromHeap(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6781. operator bool() const {
  6782. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::CreateHandleFromHeap);
  6783. }
  6784. // Validation support
  6785. bool isAllowed() const { return true; }
  6786. bool isArgumentListValid() const {
  6787. if (4 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6788. return true;
  6789. }
  6790. // Metadata
  6791. bool requiresUniformInputs() const { return false; }
  6792. // Operand indexes
  6793. enum OperandIdx {
  6794. arg_index = 1,
  6795. arg_samplerHeap = 2,
  6796. arg_nonUniformIndex = 3,
  6797. };
  6798. // Accessors
  6799. llvm::Value *get_index() const { return Instr->getOperand(1); }
  6800. void set_index(llvm::Value *val) { Instr->setOperand(1, val); }
  6801. llvm::Value *get_samplerHeap() const { return Instr->getOperand(2); }
  6802. void set_samplerHeap(llvm::Value *val) { Instr->setOperand(2, val); }
  6803. bool get_samplerHeap_val() const { return (bool)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(2))->getZExtValue()); }
  6804. void set_samplerHeap_val(bool val) { Instr->setOperand(2, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 1), llvm::APInt(1, (uint64_t)val))); }
  6805. llvm::Value *get_nonUniformIndex() const { return Instr->getOperand(3); }
  6806. void set_nonUniformIndex(llvm::Value *val) { Instr->setOperand(3, val); }
  6807. bool get_nonUniformIndex_val() const { return (bool)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(3))->getZExtValue()); }
  6808. void set_nonUniformIndex_val(bool val) { Instr->setOperand(3, llvm::Constant::getIntegerValue(llvm::IntegerType::get(Instr->getContext(), 1), llvm::APInt(1, (uint64_t)val))); }
  6809. };
  6810. /// This instruction unpacks 4 8-bit signed or unsigned values into int32 or int16 vector
  6811. struct DxilInst_Unpack4x8 {
  6812. llvm::Instruction *Instr;
  6813. // Construction and identification
  6814. DxilInst_Unpack4x8(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6815. operator bool() const {
  6816. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Unpack4x8);
  6817. }
  6818. // Validation support
  6819. bool isAllowed() const { return true; }
  6820. bool isArgumentListValid() const {
  6821. if (3 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6822. return true;
  6823. }
  6824. // Metadata
  6825. bool requiresUniformInputs() const { return false; }
  6826. // Operand indexes
  6827. enum OperandIdx {
  6828. arg_unpackMode = 1,
  6829. arg_pk = 2,
  6830. };
  6831. // Accessors
  6832. llvm::Value *get_unpackMode() const { return Instr->getOperand(1); }
  6833. void set_unpackMode(llvm::Value *val) { Instr->setOperand(1, val); }
  6834. llvm::Value *get_pk() const { return Instr->getOperand(2); }
  6835. void set_pk(llvm::Value *val) { Instr->setOperand(2, val); }
  6836. };
  6837. /// This instruction packs vector of 4 signed or unsigned values into a packed datatype, drops or clamps unused bits
  6838. struct DxilInst_Pack4x8 {
  6839. llvm::Instruction *Instr;
  6840. // Construction and identification
  6841. DxilInst_Pack4x8(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6842. operator bool() const {
  6843. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::Pack4x8);
  6844. }
  6845. // Validation support
  6846. bool isAllowed() const { return true; }
  6847. bool isArgumentListValid() const {
  6848. if (6 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6849. return true;
  6850. }
  6851. // Metadata
  6852. bool requiresUniformInputs() const { return false; }
  6853. // Operand indexes
  6854. enum OperandIdx {
  6855. arg_packMode = 1,
  6856. arg_x = 2,
  6857. arg_y = 3,
  6858. arg_z = 4,
  6859. arg_w = 5,
  6860. };
  6861. // Accessors
  6862. llvm::Value *get_packMode() const { return Instr->getOperand(1); }
  6863. void set_packMode(llvm::Value *val) { Instr->setOperand(1, val); }
  6864. llvm::Value *get_x() const { return Instr->getOperand(2); }
  6865. void set_x(llvm::Value *val) { Instr->setOperand(2, val); }
  6866. llvm::Value *get_y() const { return Instr->getOperand(3); }
  6867. void set_y(llvm::Value *val) { Instr->setOperand(3, val); }
  6868. llvm::Value *get_z() const { return Instr->getOperand(4); }
  6869. void set_z(llvm::Value *val) { Instr->setOperand(4, val); }
  6870. llvm::Value *get_w() const { return Instr->getOperand(5); }
  6871. void set_w(llvm::Value *val) { Instr->setOperand(5, val); }
  6872. };
  6873. /// This instruction returns true on helper lanes in pixel shaders
  6874. struct DxilInst_IsHelperLane {
  6875. llvm::Instruction *Instr;
  6876. // Construction and identification
  6877. DxilInst_IsHelperLane(llvm::Instruction *pInstr) : Instr(pInstr) {}
  6878. operator bool() const {
  6879. return hlsl::OP::IsDxilOpFuncCallInst(Instr, hlsl::OP::OpCode::IsHelperLane);
  6880. }
  6881. // Validation support
  6882. bool isAllowed() const { return true; }
  6883. bool isArgumentListValid() const {
  6884. if (1 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands()) return false;
  6885. return true;
  6886. }
  6887. // Metadata
  6888. bool requiresUniformInputs() const { return false; }
  6889. };
  6890. // INSTR-HELPER:END
  6891. } // namespace hlsl