EM_table.x 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718
  1. /* lfr ret should little endian */
  2. #define const13(x) ((x) > -4096 && (x) < 4096)
  3. #define NULL 0
  4. #include "mach_em.h"
  5. define(`RETH_LD',`reg_o1')
  6. define(`RETL_LD',`reg_o0')
  7. define(`RETH_ST',`reg_i1')
  8. define(`RETL_ST',`reg_i0')
  9. define(`LIN_NO',`%g6')
  10. define(`FIL_NAM',`%g7')
  11. define(`BP_OFFSET',`'WINDOWSIZE)
  12. define(`'`EM_BSIZE',EM_BSIZE)
  13. define(STACK_CLICK,4)
  14. #if RESOLV_debug
  15. define(Comment0)
  16. define(Comment)
  17. define(Comment2)
  18. #else
  19. define(Comment0,; `'`)' ; `'`/* */'" ! $1" ; code_combiner`'`(' )
  20. define(Comment, ; `'`)' ; `'`/* */'" ! $1 $2" ; code_combiner`'`(' )
  21. define(Comment2,; `'`)' ; `'`/* */'" ! $1 $2 $3" ; code_combiner`'`(' )
  22. #endif
  23. define(MAX_INT, 0x7fffffff)
  24. define(E_EM_CUF, 100)
  25. define(E_EM_CFF, 101)
  26. define(E_EM_CFI, 102)
  27. define(E_EM_CFU, 103)
  28. #define MAX_UNROLL 16
  29. #undef FAST_LIN_LNI_FIL
  30. define( narg4,
  31. C_$1_narg ==>
  32. ` {
  33. reg_t a;
  34. int n;
  35. Comment0( $1_narg );
  36. if (type_of_tos() == T_cst)
  37. {
  38. n= pop_const(NULL);
  39. C_$1 (n);
  40. }
  41. else
  42. {
  43. a= pop_reg();
  44. force_alloc_output();
  45. "cmp $a, 4";
  46. "be 1f";
  47. "set EILLINS, $reg_o0";
  48. "call trp";
  49. "nop";
  50. "1:";
  51. free_reg(a);
  52. free_output();
  53. C_$1 (4);
  54. }
  55. }.
  56. '
  57. )
  58. /******************************************************************************/
  59. /* */
  60. /* Group 1 : Load instructions */
  61. /* */
  62. /******************************************************************************/
  63. /* %fp : frame pointer
  64. * %sp : stack pointer
  65. * RETH_XX: High part of return value
  66. * RETL_XX: Low part of return value
  67. * LIN_NO : lin_no
  68. * FIL_NAM: Fil_nam
  69. */
  70. C_loc ==>
  71. Comment( loc , $1 );
  72. push_const($1).
  73. C_lol ==>
  74. Comment( lol , $1 );
  75. {
  76. reg_t S1;
  77. if (S1 = find_local($1, NULL)) {
  78. soft_alloc_reg(S1);
  79. push_reg(S1);
  80. } else {
  81. soft_alloc_reg(reg_lb);
  82. push_reg(reg_lb);
  83. inc_tos($1);
  84. push_const(4);
  85. C_los(EM_WSIZE);
  86. }
  87. }.
  88. C_loe.. ==>
  89. Comment2( loe.. , $1, $2 );
  90. {
  91. #ifdef FAST_LIN_LNI_FIL
  92. if ((int*)($1) == (int*)"hol0")
  93. if ($2 == 0)
  94. push_reg(reg_lin);
  95. else if ($2 == 4)
  96. push_reg(reg_fil);
  97. else
  98. arg_error("loe.. hol0+", $2);
  99. else {
  100. #endif
  101. push_ext($1);
  102. inc_tos($2);
  103. push_const(4);
  104. C_los(EM_WSIZE);
  105. #ifdef FAST_LIN_LNI_FIL
  106. }
  107. #endif
  108. }
  109. .
  110. C_lil ==>
  111. Comment( lil , $1 );
  112. {
  113. reg_t S1;
  114. reg_t S2;
  115. if (S1 = find_local($1, NULL)) {
  116. S2 = alloc_reg();
  117. "ld [$S1], $S2";
  118. push_reg(S2);
  119. } else {
  120. soft_alloc_reg(reg_lb);
  121. push_reg(reg_lb);
  122. inc_tos($1);
  123. push_const(4);
  124. C_los(EM_WSIZE);
  125. push_const(4);
  126. C_los(EM_WSIZE);
  127. }
  128. }.
  129. C_lof ==>
  130. Comment( lof , $1 );
  131. inc_tos($1);
  132. push_const(4);
  133. C_los(EM_WSIZE).
  134. C_lal ==>
  135. Comment( lal , $1 );
  136. soft_alloc_reg(reg_lb);
  137. push_reg(reg_lb);
  138. inc_tos($1).
  139. C_lae.. ==>
  140. Comment2( lae.. , $1, $2 );
  141. push_ext($1);
  142. inc_tos($2).
  143. C_lxl
  144. $1 == 0 ==>
  145. Comment( lxl , $1 );
  146. soft_alloc_reg(reg_lb);
  147. push_reg(reg_lb).
  148. $1 == 1 ==>
  149. Comment( lxl , $1 );
  150. soft_alloc_reg(reg_lb);
  151. push_reg(reg_lb);
  152. inc_tos(EM_BSIZE);
  153. push_const(4);
  154. C_los(EM_WSIZE).
  155. default ==>
  156. Comment( lxl , $1 );
  157. {
  158. reg_t a;
  159. reg_t b;
  160. reg_t c;
  161. const_str_t n_str;
  162. a = alloc_reg();
  163. b = alloc_reg();
  164. c = alloc_reg();
  165. sprint(n_str, "%d", $1);
  166. "set $n_str, $a";
  167. "mov $reg_lb, $b";
  168. "1: ld [$b + EM_BSIZE], $c";
  169. "deccc $a";
  170. "bnz 1b";
  171. "mov $c, $b";
  172. push_reg(b);
  173. free_reg(a);
  174. free_reg(c);
  175. }.
  176. C_lxa ==>
  177. C_lxl($1);
  178. inc_tos(EM_BSIZE).
  179. C_loi
  180. ( $1 == 1 ) ||
  181. ( $1 == 2 ) ||
  182. ( $1 % 4 == 0 ) ==>
  183. Comment( loi , $1 );
  184. push_const($1);
  185. C_los(EM_WSIZE).
  186. default ==>
  187. arg_error( "loi", $1).
  188. C_los
  189. $1 == 4 ==>
  190. {
  191. reg_t a;
  192. reg_t b;
  193. reg_t c;
  194. int i;
  195. char *LD;
  196. arith size;
  197. const_str_t n;
  198. const_str_t size_str;
  199. Comment( los, $1);
  200. if (type_of_tos() == T_cst && top_const() <= MAX_UNROLL) {
  201. size = pop_const(size_str);
  202. if (size <= 4) {
  203. switch (size) {
  204. case 1: LD = "ldub"; break;
  205. case 2: LD = "lduh"; break;
  206. case 4: LD = "ld"; break;
  207. default: arg_error("C_los", size);
  208. }
  209. b = alloc_reg();
  210. if (type_of_tos() & T_reg2)
  211. {
  212. a= pop_reg_reg(&c);
  213. "$LD [$a+$c], $b";
  214. free_reg(a);
  215. free_reg(c);
  216. }
  217. else
  218. {
  219. a = pop_reg_c13(n);
  220. "$LD [$a+$n], $b";
  221. free_reg(a);
  222. }
  223. push_reg(b);
  224. } else if (size <= MAX_UNROLL) { /* SUB-OPTIMAL */
  225. inc_tos(size-4);
  226. for (i = 0; i < size; i += 4) {
  227. b = alloc_reg();
  228. if (type_of_tos() & T_reg2)
  229. {
  230. a= pop_reg_reg(&c);
  231. "ld [$a+$c], $b";
  232. push_reg(b);
  233. push_reg(a);
  234. inc_tos_reg(c);
  235. }
  236. else
  237. {
  238. a = pop_reg_c13(n);
  239. "ld [$a+$n], $b";
  240. push_reg(b);
  241. if (n[0] == '-' || isdigit(n[0]))
  242. {
  243. push_reg(a);
  244. inc_tos(atoi(n));
  245. }
  246. else
  247. {
  248. b= alloc_reg();
  249. "add $a, $n, $b";
  250. push_reg(b);
  251. free_reg(a);
  252. }
  253. }
  254. inc_tos(-4);
  255. }
  256. pop_nop(1);
  257. } else
  258. arg_error ("loi", size);
  259. }
  260. else {
  261. a = alloc_reg(); /* count */
  262. pop_reg_as(a);
  263. b = pop_reg(); /* addr */
  264. c = alloc_reg();
  265. flush_cache();
  266. "sub $reg_sp, $a, $reg_sp" /* HACK */
  267. "1: deccc 4, $a"
  268. "ld [$b+$a], $c"
  269. "bnz 1b"
  270. "st $c, [$reg_sp+$a]" /* delay */
  271. free_reg(a);
  272. free_reg(b);
  273. free_reg(c);
  274. }
  275. }.
  276. default ==>
  277. arg_error("C_los", $1).
  278. narg4(los)
  279. C_ldl ==>
  280. Comment( ldl , $1 );
  281. {
  282. reg_t S1;
  283. reg_t S2;
  284. if (S1 = find_local($1, &S2)) {
  285. soft_alloc_reg(S1);
  286. soft_alloc_reg(S2);
  287. push_double_reg(S1);
  288. } else {
  289. soft_alloc_reg(reg_lb);
  290. push_reg(reg_lb);
  291. inc_tos($1);
  292. push_const(8);
  293. C_los(EM_WSIZE);
  294. }
  295. }.
  296. C_lde.. ==>
  297. Comment2( lde.. , $1, $2 );
  298. push_ext($1);
  299. inc_tos($2);
  300. push_const(8);
  301. C_los(EM_WSIZE).
  302. C_ldf ==>
  303. Comment( ldf , $1 );
  304. inc_tos($1);
  305. push_const(8);
  306. C_los(EM_WSIZE).
  307. C_lpi ==>
  308. Comment( lpi , $1 );
  309. push_ext($1).
  310. /******************************************************************************/
  311. /* */
  312. /* Group 2 : Store instructions */
  313. /* */
  314. /******************************************************************************/
  315. C_stl ==>
  316. Comment( stl , $1 );
  317. {
  318. reg_t S1;
  319. if ((S1 = find_local($1, NULL))) {
  320. pop_reg_as(S1);
  321. } else {
  322. soft_alloc_reg(reg_lb);
  323. push_reg(reg_lb);
  324. inc_tos($1);
  325. push_const(4);
  326. C_sts(EM_WSIZE);
  327. }
  328. }.
  329. C_ste.. ==>
  330. Comment2( ste.. , $1, $2 );
  331. push_ext($1);
  332. inc_tos($2);
  333. push_const(4);
  334. C_sts(EM_WSIZE).
  335. C_sil ==>
  336. Comment( sil , $1 );
  337. {
  338. reg_t S1;
  339. reg_t S2;
  340. if (S1 = find_local($1, NULL)) {
  341. S2 = pop_reg();
  342. "st $S2, [$S1]";
  343. free_reg(S2);
  344. } else {
  345. soft_alloc_reg(reg_lb);
  346. push_reg(reg_lb);
  347. inc_tos($1);
  348. push_const(4);
  349. C_los(EM_WSIZE);
  350. push_const(4);
  351. C_sts(EM_WSIZE);
  352. }
  353. }.
  354. C_stf ==>
  355. Comment( stf , $1 );
  356. inc_tos($1);
  357. push_const(4);
  358. C_sts(EM_WSIZE).
  359. C_sti
  360. ( $1 == 1) ||
  361. ( $1 == 2) ||
  362. ( $1 % 4 == 0 ) ==>
  363. Comment( sti, $1 );
  364. push_const($1);
  365. C_sts(EM_WSIZE).
  366. default ==>
  367. arg_error( "sti", $1).
  368. C_sts
  369. $1 == 4 ==>
  370. {
  371. reg_t a;
  372. reg_t b;
  373. reg_t c;
  374. reg_t d;
  375. arith size;
  376. const_str_t n;
  377. const_str_t size_str;
  378. int i;
  379. char *ST;
  380. Comment( sts, $1);
  381. if (type_of_tos() == T_cst && top_const() <= MAX_UNROLL) {
  382. size = pop_const(size_str);
  383. if (size <= 4) {
  384. switch (size) {
  385. case 1: ST = "stb"; break;
  386. case 2: ST = "sth"; break;
  387. case 4: ST = "st"; break;
  388. default: arg_error("C_sti", size);
  389. }
  390. c= NULL;
  391. if (type_of_tos() & T_reg2)
  392. a= pop_reg_reg(&c);
  393. else
  394. a = pop_reg_c13(n);
  395. if (type_of_tos() == T_float) {
  396. b= pop_float();
  397. if (size < 4) {
  398. "st $b,[%fp+64]";
  399. free_reg(b);
  400. b= alloc_reg();
  401. "ld [%fp+64],$b";
  402. }
  403. }
  404. else
  405. b = pop_reg();
  406. if (c)
  407. {
  408. "$ST $b, [$a+$c]";
  409. free_reg(c);
  410. }
  411. else
  412. "$ST $b, [$a+$n]";
  413. free_reg(a);
  414. free_reg(b);
  415. } else if (size <= MAX_UNROLL) {
  416. for (i = 0; i < size; i+=4) {
  417. c= NULL;
  418. if (type_of_tos() & T_reg2)
  419. a= pop_reg_reg(&c);
  420. else
  421. a = pop_reg_c13(n);
  422. if (type_of_tos() == T_float)
  423. b= pop_float();
  424. else
  425. b = pop_reg();
  426. if (c)
  427. "st $b, [$a+$c]";
  428. else
  429. "st $b, [$a+$n]";
  430. free_reg(b);
  431. if (c)
  432. {
  433. push_reg(a);
  434. inc_tos_reg(c);
  435. }
  436. else if (n[0] == '-' || isdigit(n[0]))
  437. {
  438. push_reg(a);
  439. inc_tos(atoi(n));
  440. }
  441. else
  442. {
  443. b= alloc_reg();
  444. "add $a, $n, $b";
  445. push_reg(b);
  446. free_reg(a);
  447. }
  448. inc_tos(4);
  449. }
  450. pop_nop(1);
  451. } else
  452. arg_error ("sti", size);
  453. }
  454. else {
  455. force_alloc_output();
  456. d = pop_reg(); /* size */
  457. a = pop_reg(); /* address */
  458. flush_cache();
  459. b = alloc_reg();
  460. c = alloc_reg();
  461. "cmp $d, 4";
  462. "bg,a 8f";
  463. "andcc $d, 3, %g0"; /* delay slot */
  464. "be,a 4f";
  465. "ld [$reg_sp], $b"; /* delay slot */
  466. "cmp $d, 1";
  467. "be,a 1f";
  468. "ld [$reg_sp], $b"; /* delay slot */
  469. "bl 0f";
  470. "cmp $d, 2";
  471. "be 2f";
  472. "ld [$reg_sp], $b"; /* delay slot */
  473. "3: set EILLINS, %o0";
  474. "call trp";
  475. "nop";
  476. "b 0f";
  477. "nop";
  478. "1:";
  479. "inc STACK_CLICK, $reg_sp";
  480. "b 0f";
  481. "stb $b, [$a]"; /* delay slot */
  482. "2:";
  483. "inc STACK_CLICK, $reg_sp";
  484. "b 0f";
  485. "sth $b, [$a]"; /* delay slot */
  486. "4:";
  487. "inc STACK_CLICK, $reg_sp";
  488. "b 0f";
  489. "st $b, [$a]"; /* delay slot */
  490. "8:";
  491. "bne 3b";
  492. "nop";
  493. "mov $d, $b";
  494. "9: deccc 4, $b";
  495. "ld [$reg_sp+$b], $c";
  496. "bnz 9b";
  497. "st $c, [$a+$b]"; /* delay slot */
  498. "add $reg_sp, $d, $reg_sp" /* HACK */
  499. "0:"
  500. free_reg(a);
  501. free_reg(b);
  502. free_reg(c);
  503. free_reg(d);
  504. free_output();
  505. }
  506. }.
  507. default ==>
  508. arg_error( "sts", $1).
  509. narg4(sts)
  510. C_sdl ==>
  511. Comment( sdl , $1 );
  512. {
  513. reg_t S1;
  514. reg_t S2;
  515. S1 = find_local($1, NULL);
  516. if (S1)
  517. pop_double_reg_as(S1);
  518. else {
  519. soft_alloc_reg(reg_lb);
  520. push_reg(reg_lb);
  521. inc_tos($1);
  522. push_const(8);
  523. C_sts(EM_WSIZE);
  524. }
  525. }.
  526. C_sde.. ==>
  527. Comment2( sde.. , $1, $2 );
  528. push_ext($1);
  529. inc_tos($2);
  530. push_const(8);
  531. C_sts(EM_WSIZE).
  532. C_sdf ==>
  533. Comment( sdf , $1 );
  534. inc_tos($1);
  535. push_const(8);
  536. C_sts(EM_WSIZE).
  537. /******************************************************************************/
  538. /* */
  539. /* Group 3 : Integer arithmetic */
  540. /* */
  541. /******************************************************************************/
  542. C_adi
  543. $1 == 4 ==>
  544. Comment( adi , $1 );
  545. if ((type_of_tos()) == T_cst) {
  546. arith n;
  547. n = pop_const(NULL);
  548. inc_tos(n);
  549. } else {
  550. reg_t a;
  551. reg_t b;
  552. reg_t c;
  553. a = pop_reg();
  554. inc_tos_reg(a);
  555. }.
  556. default ==>
  557. arg_error( "adi", $1).
  558. narg4(adi)
  559. C_sbi
  560. $1 == 4 ==>
  561. Comment( sbi , $1 );
  562. if ((type_of_tos()) == T_cst) {
  563. arith n;
  564. n = pop_const(NULL);
  565. inc_tos(-n);
  566. } else {
  567. reg_t a;
  568. reg_t b;
  569. reg_t c;
  570. a = pop_reg();
  571. b = pop_reg();
  572. c = alloc_reg();
  573. "sub $b, $a, $c";
  574. free_reg(a);
  575. free_reg(b);
  576. push_reg(c);
  577. }.
  578. default ==>
  579. arg_error( "sbi", $1).
  580. narg4(sbi)
  581. C_mli
  582. $1 == 4 ==>
  583. {
  584. unsigned int n0;
  585. unsigned int n1;
  586. reg_t orig;
  587. reg_t a;
  588. reg_t b;
  589. reg_t c;
  590. unsigned int n;
  591. const_str_t n_str;
  592. Comment( mli , $1 );
  593. if (type_of_tos() == T_cst) {
  594. n = pop_const(NULL);
  595. orig = pop_reg();
  596. c = reg_g0;
  597. while (n) {
  598. for (n0 = 0; !(n & 1); n>>=1)
  599. ++n0;
  600. for (n1 = 0; n & 1; n>>=1)
  601. ++n1;
  602. if (n0) {
  603. a = alloc_reg();
  604. sprint(n_str, "%d", n0);
  605. "sll $orig, $n_str, $a";
  606. free_reg(orig);
  607. orig = a;
  608. }
  609. if (n1 == 1) {
  610. if (c == reg_g0) {
  611. soft_alloc_reg(orig);
  612. c = orig;
  613. } else {
  614. a = alloc_reg();
  615. "add $c, $orig, $a";
  616. free_reg(c);
  617. c = a;
  618. }
  619. n <<= n1;
  620. } else {
  621. a = alloc_reg();
  622. sprint(n_str, "%d", n1);
  623. "sll $orig, $n_str, $a";
  624. b = alloc_reg();
  625. "sub $a, $orig, $b";
  626. free_reg(orig);
  627. orig = a;
  628. if (c == reg_g0)
  629. c = b;
  630. else {
  631. a = alloc_reg();
  632. "add $c, $b, $a";
  633. free_reg(b);
  634. free_reg(c);
  635. c = a;
  636. }
  637. }
  638. }
  639. push_reg(c);
  640. free_reg(orig);
  641. } else {
  642. force_alloc_output();
  643. pop_reg_as(reg_o0);
  644. pop_reg_as(reg_o1);
  645. "call mli4";
  646. "nop" /* delay */
  647. free_output();
  648. forced_alloc_reg(reg_o0);
  649. push_reg(reg_o0);
  650. }
  651. }.
  652. default ==>
  653. arg_error( "mli", $1).
  654. narg4(mli)
  655. C_dvi
  656. $1 == 4 ==>
  657. {
  658. reg_t a;
  659. reg_t b;
  660. int n;
  661. int n_exp;
  662. const_str_t n_exp_str;
  663. Comment( dvi , $1 );
  664. #if MATH_DIVIDE
  665. if (type_of_tos() == T_cst &&
  666. power_of_2(top_const(), &n_exp))
  667. {
  668. sprint (n_exp_str, "%d", n_exp);
  669. n= pop_const(NULL);
  670. a= pop_reg();
  671. b= alloc_reg();
  672. "sra $a, $n_exp_str, $b";
  673. free_reg(a);
  674. push_reg(b);
  675. }
  676. else
  677. #endif
  678. {
  679. force_alloc_output();
  680. pop_reg_as(reg_o1); /* denominator */
  681. pop_reg_as(reg_o0); /* numerator */
  682. #if MATH_DIVIDE
  683. "call mathdvi4";
  684. #else
  685. "call dvi4";
  686. #endif
  687. "nop"
  688. free_output();
  689. forced_alloc_reg(reg_o0);
  690. push_reg(reg_o0);
  691. }
  692. }.
  693. default ==>
  694. arg_error( "dvi", $1).
  695. narg4(dvi)
  696. C_rmi
  697. $1 == 4 ==>
  698. Comment( rmi , $1 );
  699. {
  700. force_alloc_output();
  701. pop_reg_as(reg_o1); /* denominator */
  702. pop_reg_as(reg_o0); /* numerator */
  703. #if MATH_DIVIDE
  704. "call mathdvi4";
  705. #else
  706. "call dvi4";
  707. #endif
  708. "nop"
  709. free_output();
  710. forced_alloc_reg(reg_o1);
  711. push_reg(reg_o1);
  712. }.
  713. default ==>
  714. arg_error( "rmi", $1).
  715. narg4(rmi)
  716. C_ngi
  717. $1 == 4 ==>
  718. Comment( ngi , $1 );
  719. {
  720. reg_t a;
  721. reg_t b;
  722. a = pop_reg();
  723. b = alloc_reg();
  724. "sub %g0, $a, $b";
  725. push_reg(b);
  726. free_reg(a);
  727. }.
  728. default ==>
  729. arg_error( "ngi", $1).
  730. narg4(ngi)
  731. C_sli
  732. $1 == 4 ==>
  733. Comment( sli , $1 );
  734. {
  735. reg_t a;
  736. reg_t b;
  737. reg_t c;
  738. b = alloc_reg();
  739. if ((type_of_tos() == T_cst) &&
  740. (const13(top_const()))) {
  741. const_str_t n;
  742. pop_const(n);
  743. a = pop_reg();
  744. "sll $a, $n, $b";
  745. } else {
  746. c = pop_reg();
  747. a = pop_reg();
  748. "sll $a, $c, $b";
  749. free_reg(c);
  750. }
  751. free_reg(a);
  752. push_reg(b);
  753. }.
  754. default ==>
  755. arg_error( "sli", $1).
  756. narg4(sli)
  757. C_sri
  758. $1 == 4 ==>
  759. Comment( sri , $1 );
  760. {
  761. reg_t a;
  762. reg_t b;
  763. reg_t c;
  764. b = alloc_reg();
  765. if ((type_of_tos() == T_cst) &&
  766. (const13(top_const()))) {
  767. const_str_t n;
  768. pop_const(n);
  769. a = pop_reg();
  770. "sra $a, $n, $b";
  771. } else {
  772. c = pop_reg();
  773. a = pop_reg();
  774. "sra $a, $c, $b";
  775. free_reg(c);
  776. }
  777. free_reg(a);
  778. push_reg(b);
  779. }.
  780. default ==>
  781. arg_error( "sri", $1).
  782. narg4(sri)
  783. /******************************************************************************/
  784. /* */
  785. /* Group 4 : Unsigned arithmetic */
  786. /* */
  787. /******************************************************************************/
  788. C_adu ==>
  789. Comment( adu , $1 );
  790. C_adi( w).
  791. narg4(adu)
  792. C_sbu ==>
  793. Comment( sbu , $1 );
  794. C_sbi( w).
  795. narg4(sbu)
  796. C_mlu
  797. $1 == 4 ==>
  798. Comment( mlu , $1 );
  799. C_mli($1).
  800. /*
  801. {
  802. force_alloc_output();
  803. pop_reg_as(reg_o0);
  804. pop_reg_as(reg_o1);
  805. "call mlu4";
  806. "nop"
  807. free_output();
  808. forced_alloc_reg(reg_o0);
  809. push_reg(reg_o0);
  810. }.
  811. */
  812. default ==>
  813. arg_error( "mlu", $1).
  814. narg4(mlu)
  815. C_dvu
  816. $1 == 4 ==>
  817. {
  818. reg_t a;
  819. reg_t b;
  820. unsigned n;
  821. int n_exp;
  822. const_str_t n_exp_str;
  823. Comment( dvu , $1 );
  824. if (type_of_tos() == T_cst &&
  825. uns_power_of_2(top_const(), &n_exp))
  826. {
  827. sprint (n_exp_str, "%d", n_exp);
  828. n= pop_const(NULL);
  829. a= pop_reg();
  830. b= alloc_reg();
  831. "srl $a, $n_exp_str, $b";
  832. free_reg(a);
  833. push_reg(b);
  834. }
  835. else
  836. {
  837. force_alloc_output();
  838. pop_reg_as(reg_o1); /* denominator */
  839. pop_reg_as(reg_o0); /* numerator */
  840. "call dvu4";
  841. "nop"
  842. free_output();
  843. forced_alloc_reg(reg_o0);
  844. push_reg(reg_o0);
  845. }
  846. }.
  847. default ==>
  848. arg_error( "dvu", $1).
  849. narg4(dvu)
  850. C_rmu
  851. $1 == 4 ==>
  852. Comment( rmu , $1 );
  853. {
  854. force_alloc_output();
  855. pop_reg_as(reg_o1);
  856. pop_reg_as(reg_o0);
  857. "call dvu4";
  858. "nop"
  859. free_output();
  860. forced_alloc_reg(reg_o1);
  861. push_reg(reg_o1);
  862. }.
  863. default ==>
  864. arg_error( "rmu", $1).
  865. narg4(rmu)
  866. C_slu ==>
  867. Comment( slu , $1 );
  868. C_sli($1).
  869. narg4(slu)
  870. C_sru
  871. $1 == 4 ==>
  872. {
  873. reg_t a;
  874. reg_t b;
  875. reg_t c;
  876. Comment( sru , $1 );
  877. b = alloc_reg();
  878. if ((type_of_tos() == T_cst) &&
  879. (const13(top_const()))) {
  880. const_str_t n;
  881. pop_const(n);
  882. a = pop_reg();
  883. "srl $a, $n, $b";
  884. } else {
  885. c = pop_reg();
  886. a = pop_reg();
  887. "srl $a, $c, $b";
  888. free_reg(c);
  889. }
  890. free_reg(a);
  891. push_reg(b);
  892. }.
  893. default ==>
  894. arg_error( "sru", $1).
  895. narg4(sru)
  896. /******************************************************************************/
  897. /* */
  898. /* Group 5 : Floating point arithmetic */
  899. /* */
  900. /******************************************************************************/
  901. C_adf ==>
  902. {
  903. Comment( adf, $1);
  904. push_const($1);
  905. C_adf_narg();
  906. }.
  907. C_adf_narg ==>
  908. {
  909. reg_t f1;
  910. reg_t f2;
  911. reg_t f3;
  912. int n;
  913. Comment0( adf_narg);
  914. if (type_of_tos() == T_cst)
  915. {
  916. n= pop_const(NULL);
  917. if (n == EM_WSIZE)
  918. {
  919. f1= pop_float();
  920. f2= pop_float();
  921. f3= alloc_float();
  922. "fadds $f2, $f1, $f3";
  923. free_reg(f1);
  924. free_reg(f2);
  925. push_reg(f3);
  926. }
  927. else if (n == EM_DSIZE)
  928. {
  929. f1= pop_double(NULL);
  930. f2= pop_double(NULL);
  931. f3= alloc_double(NULL);
  932. "faddd $f1, $f2, $f3";
  933. free_double_reg(f1);
  934. free_double_reg(f2);
  935. push_double_reg(f3);
  936. }
  937. else
  938. arg_error ("unimp adf", n);
  939. }
  940. else
  941. not_implemented ("adf_narg");
  942. }.
  943. C_sbf ==>
  944. {
  945. Comment( sbf, $1);
  946. push_const($1);
  947. C_sbf_narg();
  948. }.
  949. C_sbf_narg ==>
  950. {
  951. reg_t f1;
  952. reg_t f2;
  953. reg_t f3;
  954. int n;
  955. Comment0( sbf_narg);
  956. if (type_of_tos() == T_cst)
  957. {
  958. n= pop_const(NULL);
  959. if (n == EM_WSIZE)
  960. {
  961. f1= pop_float();
  962. f2= pop_float();
  963. f3= alloc_float();
  964. "fsubs $f2, $f1, $f3";
  965. free_reg(f1);
  966. free_reg(f2);
  967. push_reg(f3);
  968. }
  969. else if (n == EM_DSIZE)
  970. {
  971. f1= pop_double(NULL);
  972. f2= pop_double(NULL);
  973. f3= alloc_double(NULL);
  974. "fsubd $f2, $f1, $f3";
  975. free_double_reg(f1);
  976. free_double_reg(f2);
  977. push_double_reg(f3);
  978. }
  979. else
  980. arg_error ("unimp sbf", n);
  981. }
  982. else
  983. not_implemented ("sbf_narg");
  984. }.
  985. C_mlf ==>
  986. {
  987. Comment( mlf, $1);
  988. push_const($1);
  989. C_mlf_narg();
  990. }.
  991. C_mlf_narg ==>
  992. {
  993. reg_t f1;
  994. reg_t f2;
  995. reg_t f3;
  996. int n;
  997. Comment0( mlf_narg);
  998. if (type_of_tos() == T_cst)
  999. {
  1000. n= pop_const(NULL);
  1001. if (n == EM_WSIZE)
  1002. {
  1003. f1= pop_float();
  1004. f2= pop_float();
  1005. f3= alloc_float();
  1006. "fmuls $f2, $f1, $f3";
  1007. free_reg(f1);
  1008. free_reg(f2);
  1009. push_reg(f3);
  1010. }
  1011. else if (n == EM_DSIZE)
  1012. {
  1013. f1= pop_double(NULL);
  1014. f2= pop_double(NULL);
  1015. f3= alloc_double(NULL);
  1016. "fmuld $f2, $f1, $f3";
  1017. free_double_reg(f1);
  1018. free_double_reg(f2);
  1019. push_double_reg(f3);
  1020. }
  1021. else
  1022. arg_error ("unimp mlf", n);
  1023. }
  1024. else
  1025. not_implemented ("mlf_narg");
  1026. }.
  1027. C_dvf ==>
  1028. {
  1029. Comment( dvf, $1);
  1030. push_const($1);
  1031. C_dvf_narg();
  1032. }.
  1033. C_dvf_narg ==>
  1034. {
  1035. reg_t f1;
  1036. reg_t f2;
  1037. reg_t f3;
  1038. int n;
  1039. Comment0( dvf_narg);
  1040. if (type_of_tos() == T_cst)
  1041. {
  1042. n= pop_const(NULL);
  1043. if (n == EM_WSIZE)
  1044. {
  1045. f1= pop_float();
  1046. f2= pop_float();
  1047. f3= alloc_float();
  1048. "fdivs $f2, $f1, $f3";
  1049. free_reg(f1);
  1050. free_reg(f2);
  1051. push_reg(f3);
  1052. }
  1053. else if (n == EM_DSIZE)
  1054. {
  1055. f1= pop_double(NULL);
  1056. f2= pop_double(NULL);
  1057. f3= alloc_double(NULL);
  1058. "fdivd $f2, $f1, $f3";
  1059. free_double_reg(f1);
  1060. free_double_reg(f2);
  1061. push_double_reg(f3);
  1062. }
  1063. else
  1064. arg_error ("unimp dvf", n);
  1065. }
  1066. else
  1067. not_implemented ("dvf_narg");
  1068. }.
  1069. C_ngf ==>
  1070. {
  1071. Comment( ngf, $1);
  1072. push_const($1);
  1073. C_ngf_narg();
  1074. }.
  1075. C_ngf_narg ==>
  1076. {
  1077. reg_t f1;
  1078. reg_t f2;
  1079. int n;
  1080. Comment0( ngf_narg);
  1081. if (type_of_tos() == T_cst)
  1082. {
  1083. n= pop_const(NULL);
  1084. if (n == EM_WSIZE || n == EM_DSIZE)
  1085. {
  1086. f1= pop_float();
  1087. f2= alloc_float();
  1088. "fnegs $f1, $f2";
  1089. free_reg(f1);
  1090. push_reg(f2);
  1091. }
  1092. else
  1093. arg_error ("unimp ngf", n);
  1094. }
  1095. else
  1096. not_implemented ("ngf_narg");
  1097. }.
  1098. C_fif ==>
  1099. Comment( fif, $1);
  1100. push_const($1);
  1101. C_fif_narg().
  1102. C_fif_narg ==>
  1103. {
  1104. int n;
  1105. reg_t a;
  1106. reg_t b;
  1107. reg_t c;
  1108. reg_t d;
  1109. Comment0( fif_narg );
  1110. if (type_of_tos() == T_cst)
  1111. {
  1112. n= pop_const(NULL);
  1113. if (n==4)
  1114. {
  1115. "! unimplemented fif 4";
  1116. "st %g0, [%g0]"; /* unimp */
  1117. }
  1118. else if (n==8)
  1119. {
  1120. flush_cache();
  1121. "call fif8";
  1122. "nop";
  1123. }
  1124. else
  1125. arg_error ("fif", n);
  1126. }
  1127. else
  1128. {
  1129. a= alloc_reg();
  1130. flush_cache();
  1131. force_alloc_output();
  1132. b= alloc_reg();
  1133. c= alloc_reg();
  1134. d= pop_reg();
  1135. "cmp 8, $d";
  1136. "be 8f";
  1137. "nop";
  1138. "cmp 4, $d";
  1139. "bne 0f";
  1140. "nop";
  1141. "4:";
  1142. "! unimplemented fif 4";
  1143. "st %g0, [%g0]";
  1144. "b 1f";
  1145. "0:";
  1146. "set EILLINS, $reg_o0";
  1147. "call trp";
  1148. "nop";
  1149. "b 1f";
  1150. "8:";
  1151. "call fif8";
  1152. "nop";
  1153. "1:";
  1154. free_reg(a);
  1155. free_reg(b);
  1156. free_reg(c);
  1157. free_reg(d);
  1158. free_output();
  1159. }
  1160. }.
  1161. C_fef ==>
  1162. Comment( fef, $1);
  1163. push_const($1);
  1164. C_fef_narg().
  1165. C_fef_narg ==>
  1166. {
  1167. int n;
  1168. reg_t a;
  1169. reg_t b;
  1170. reg_t c;
  1171. reg_t d;
  1172. reg_t e;
  1173. Comment0( fef_narg );
  1174. if (type_of_tos() == T_cst)
  1175. {
  1176. n= pop_const(NULL);
  1177. if (n==4)
  1178. {
  1179. "! unimplemented fef 4";
  1180. "st %g0, [%g0]"; /* unimp */
  1181. }
  1182. else if (n==8)
  1183. {
  1184. flush_cache();
  1185. "call fef8";
  1186. "nop";
  1187. }
  1188. else
  1189. arg_error ("fef", n);
  1190. }
  1191. else
  1192. {
  1193. a= alloc_reg();
  1194. flush_cache();
  1195. force_alloc_output();
  1196. b= alloc_reg();
  1197. c= alloc_reg();
  1198. d= pop_reg();
  1199. "cmp 8, $d";
  1200. "be 8f";
  1201. "nop";
  1202. "cmp 4, $d";
  1203. "bne 0f";
  1204. "nop";
  1205. "4:";
  1206. "! unimplemented fef 4";
  1207. "st %g0, [%g0]";
  1208. "b 1f";
  1209. "0:";
  1210. "set EILLINS, $reg_o0";
  1211. "call trp";
  1212. "nop";
  1213. "b 1f";
  1214. "8:";
  1215. "call fef8";
  1216. "nop";
  1217. "1:";
  1218. free_reg(a);
  1219. free_reg(b);
  1220. free_reg(c);
  1221. free_reg(d);
  1222. free_output();
  1223. }
  1224. }.
  1225. /******************************************************************************/
  1226. /* */
  1227. /* Group 6 : Pointer arithmetic */
  1228. /* */
  1229. /******************************************************************************/
  1230. C_adp ==>
  1231. Comment( adp , $1 );
  1232. inc_tos($1).
  1233. C_ads
  1234. $1 == 4 ==>
  1235. Comment( ads , $1 );
  1236. if ((type_of_tos()) == T_cst) {
  1237. arith n;
  1238. n = pop_const(NULL);
  1239. inc_tos(n);
  1240. } else {
  1241. reg_t a;
  1242. reg_t b;
  1243. reg_t c;
  1244. a = pop_reg();
  1245. inc_tos_reg(a);
  1246. }.
  1247. default ==>
  1248. arg_error( "ads", $1).
  1249. narg4(ads)
  1250. C_sbs
  1251. $1 == 4 ==>
  1252. Comment( sbs , $1 );
  1253. if ((type_of_tos()) == T_cst) {
  1254. arith n;
  1255. n = pop_const(NULL);
  1256. inc_tos(-n);
  1257. } else {
  1258. reg_t a;
  1259. reg_t b;
  1260. reg_t c;
  1261. a = pop_reg();
  1262. b = pop_reg();
  1263. c = alloc_reg();
  1264. "sub $b, $a, $c";
  1265. free_reg(a);
  1266. free_reg(b);
  1267. push_reg(c);
  1268. }.
  1269. default ==>
  1270. arg_error( "sbs", $1).
  1271. narg4(sbs)
  1272. /******************************************************************************/
  1273. /* */
  1274. /* Group 7 : Increment/decrement/zero */
  1275. /* */
  1276. /******************************************************************************/
  1277. C_inc ==>
  1278. Comment0( inc );
  1279. inc_tos(1).
  1280. C_inl ==>
  1281. Comment( inl , $1 );
  1282. {
  1283. reg_t S1;
  1284. if (S1 = find_local($1, NULL)) {
  1285. change_reg(S1);
  1286. "inc 1, $S1";
  1287. } else {
  1288. soft_alloc_reg(reg_lb);
  1289. push_reg(reg_lb);
  1290. inc_tos($1);
  1291. C_loi(4);
  1292. C_inc();
  1293. soft_alloc_reg(reg_lb);
  1294. push_reg(reg_lb);
  1295. inc_tos($1);
  1296. C_sti(4);
  1297. }
  1298. }.
  1299. C_ine.. ==>
  1300. {
  1301. char *ename;
  1302. const_str_t evalue;
  1303. reg_t a;
  1304. reg_t b;
  1305. Comment2( ine.. , $1, $2 );
  1306. a= alloc_reg();
  1307. b= alloc_reg();
  1308. ename= $1;
  1309. sprint(evalue, "%d", $2);
  1310. "sethi %hi($ename+$evalue), $a";
  1311. "ld [$a+%lo($ename+$evalue)], $b";
  1312. "inc $b";
  1313. "st $b, [$a+%lo($ename+$evalue)]"
  1314. free_reg(a);
  1315. free_reg(b);
  1316. }.
  1317. C_dec ==>
  1318. Comment0( dec );
  1319. inc_tos(-1).
  1320. C_del ==>
  1321. Comment( del , $1 );
  1322. {
  1323. reg_t S1;
  1324. if (S1 = find_local($1, NULL)) {
  1325. change_reg(S1);
  1326. "dec 1, $S1";
  1327. } else {
  1328. soft_alloc_reg(reg_lb);
  1329. push_reg(reg_lb);
  1330. inc_tos($1);
  1331. C_loi(4);
  1332. C_dec();
  1333. soft_alloc_reg(reg_lb);
  1334. push_reg(reg_lb);
  1335. inc_tos($1);
  1336. C_sti(4);
  1337. }
  1338. }.
  1339. C_dee.. ==>
  1340. {
  1341. char *ename;
  1342. const_str_t evalue;
  1343. reg_t a;
  1344. reg_t b;
  1345. Comment2( dee.. , $1, $2 );
  1346. a= alloc_reg();
  1347. b= alloc_reg();
  1348. ename= $1;
  1349. sprint(evalue, "%d", $2);
  1350. "sethi %hi($ename+$evalue), $a";
  1351. "ld [$a+%lo($ename+$evalue)], $b";
  1352. "dec $b";
  1353. "st $b, [$a+%lo($ename+$evalue)]"
  1354. free_reg(a);
  1355. free_reg(b);
  1356. }.
  1357. C_zrl ==>
  1358. Comment( zrl , $1 );
  1359. {
  1360. reg_t S1;
  1361. if (S1 = find_local($1, NULL)) {
  1362. change_reg(S1);
  1363. "mov 0, $S1";
  1364. } else {
  1365. push_const(0);
  1366. soft_alloc_reg(reg_lb);
  1367. push_reg(reg_lb);
  1368. inc_tos($1);
  1369. C_sti(4);
  1370. }
  1371. }.
  1372. C_zre.. ==>
  1373. {
  1374. char *ename;
  1375. const_str_t evalue;
  1376. reg_t a;
  1377. Comment2( zre.. , $1, $2 );
  1378. a= alloc_reg();
  1379. ename= $1;
  1380. sprint(evalue, "%d", $2);
  1381. "sethi %hi($ename+$evalue), $a";
  1382. "st %g0, [$a+%lo($ename+$evalue)]"
  1383. free_reg(a);
  1384. }.
  1385. C_zrf ==>
  1386. Comment( zrf , $1 );
  1387. push_const($1);
  1388. C_zrf_narg().
  1389. C_zrf_narg ==>
  1390. Comment0( zrf_narg );
  1391. C_zer_narg().
  1392. C_zer ==>
  1393. Comment( zer, $1);
  1394. push_const($1);
  1395. C_zer_narg().
  1396. C_zer_narg ==>
  1397. {
  1398. reg_t a;
  1399. int n;
  1400. const_str_t n_str;
  1401. Comment0( zer_narg);
  1402. if (type_of_tos() == T_cst && top_const() <= 8)
  1403. {
  1404. n= pop_const(n_str);
  1405. if (n == 4)
  1406. push_const(0);
  1407. else if (n == 8)
  1408. {
  1409. push_const(0);
  1410. push_const(0);
  1411. }
  1412. else
  1413. arg_error ("zer", n);
  1414. }
  1415. else
  1416. {
  1417. a= alloc_reg();
  1418. pop_reg_as(a);
  1419. flush_cache();
  1420. "sub $reg_sp, $a, $reg_sp";
  1421. "1:"
  1422. "deccc 4, $a"; /* hack */
  1423. "st %g0, [$reg_sp+$a]";
  1424. "bne 1b";
  1425. "nop";
  1426. free_reg(a);
  1427. }
  1428. }.
  1429. /******************************************************************************/
  1430. /* */
  1431. /* Group 8 : Convert */
  1432. /* */
  1433. /******************************************************************************/
  1434. /* cii, ciu, cuu, cui are assumed to be called with legal arguments only */
  1435. C_cii ==>
  1436. {
  1437. reg_t a; /* target obj size */
  1438. reg_t b; /* src obj size */
  1439. int n1; /* target obj size */
  1440. int n2; /* src obj size */
  1441. const_str_t n1_str;
  1442. Comment0( cii );
  1443. a= NULL;
  1444. b= NULL;
  1445. if (type_of_tos() != T_cst)
  1446. {
  1447. a= alloc_reg();
  1448. pop_reg_as(a);
  1449. b= pop_reg();
  1450. }
  1451. else
  1452. {
  1453. n1= pop_const(n1_str);
  1454. if (type_of_tos() != T_cst)
  1455. {
  1456. a= alloc_reg();
  1457. "set $n1_str, $a";
  1458. b= pop_reg();
  1459. }
  1460. else
  1461. n2= pop_const(NULL);
  1462. }
  1463. if (!a)
  1464. {
  1465. a = pop_reg();
  1466. if (n1 > EM_WSIZE)
  1467. arg_error ("unimp cii", n1);
  1468. if (n2 > EM_WSIZE)
  1469. arg_error ("unimp cii", n2);
  1470. if (n2 < EM_WSIZE) {
  1471. b = alloc_reg();
  1472. if (n2 == 1)
  1473. {
  1474. "sll $a, 24, $b";
  1475. "sra $b, 24, $b";
  1476. }
  1477. else if (n2 == 2)
  1478. {
  1479. "sll $a, 16, $b";
  1480. "sra $b, 16, $b";
  1481. }
  1482. free_reg(a);
  1483. push_reg(b);
  1484. }
  1485. else
  1486. push_reg(a);
  1487. } else {
  1488. flush_cache();
  1489. "cmp $a, $b";
  1490. "ble 4f";
  1491. "nop"; /* delay slot */
  1492. "cmp $b, 1";
  1493. "bne 2f";
  1494. "nop"; /* delay slot */
  1495. "1:";
  1496. "b 3f";
  1497. "ldsb [$reg_sp+3], $a"; /* delay slot */
  1498. "2:"
  1499. "ldsh [$reg_sp+2], $a";
  1500. "3:";
  1501. "st $a, [$reg_sp]";
  1502. "4:";
  1503. free_reg(a);
  1504. free_reg(b);
  1505. }
  1506. }.
  1507. C_cuu ==>
  1508. Comment0( cuu );
  1509. pop_nop(2).
  1510. C_ciu ==>
  1511. Comment0( ciu );
  1512. pop_nop(2).
  1513. C_cui ==>
  1514. Comment0( cui );
  1515. pop_nop(2).
  1516. C_cfi ==>
  1517. {
  1518. reg_t a; /* target (int) size */
  1519. reg_t b; /* src (float) size */
  1520. reg_t s1;
  1521. reg_t s2;
  1522. reg_t d1;
  1523. reg_t d2;
  1524. int n1; /* target (int) size */
  1525. int n2; /* src (float) size */
  1526. const_str_t n1_str;
  1527. Comment0( cfi );
  1528. a= NULL;
  1529. b= NULL;
  1530. if (type_of_tos() != T_cst)
  1531. {
  1532. a= pop_reg();
  1533. b= pop_reg();
  1534. }
  1535. else
  1536. {
  1537. n1= pop_const (n1_str);
  1538. if (type_of_tos() != T_cst)
  1539. {
  1540. a= alloc_reg();
  1541. "set $n1_str, $a";
  1542. b= pop_reg();
  1543. }
  1544. else
  1545. n2= pop_const(NULL);
  1546. }
  1547. if (!a)
  1548. {
  1549. if (n1 != EM_WSIZE)
  1550. arg_error ("unimp cfi", n1);
  1551. if (n2 == EM_WSIZE)
  1552. {
  1553. s1= pop_float();
  1554. d1= alloc_float();
  1555. "fstoi $s1, $d1";
  1556. free_reg(s1);
  1557. push_reg(d1);
  1558. }
  1559. else if (n2 == EM_DSIZE)
  1560. {
  1561. s1= pop_double(NULL);
  1562. d1= alloc_float();
  1563. "fdtoi $s1, $d1";
  1564. free_double_reg(s1);
  1565. push_reg(d1);
  1566. }
  1567. else
  1568. arg_error ("unimp cfi", n2);
  1569. }
  1570. else
  1571. {
  1572. d1= alloc_float();
  1573. flush_cache();
  1574. force_alloc_output();
  1575. "cmp $a, 4";
  1576. "bne 0f";
  1577. "nop";
  1578. "cmp $b, 4";
  1579. "be 4f";
  1580. "nop";
  1581. "cmp $b, 8";
  1582. "bne 0f";
  1583. "nop";
  1584. "8:";
  1585. "ld [$reg_sp], %f0";
  1586. "ld [$reg_sp+STACK_CLICK], %f1";
  1587. "fdtoi %f0, $d1";
  1588. "b 1f";
  1589. "inc 2*STACK_CLICK, $reg_sp"; /* delay slot */
  1590. "4:";
  1591. "ld [$reg_sp+2*STACK_CLICK], %f0";
  1592. "fstoi %f0, $d1";
  1593. "b 1f";
  1594. "inc STACK_CLICK, $reg_sp"; /* delay slot */
  1595. "0:";
  1596. "set E_EM_CFI, %o0";
  1597. "call trp";
  1598. "nop";
  1599. "1:";
  1600. free_reg(a);
  1601. free_reg(b);
  1602. push_reg(d1);
  1603. free_output();
  1604. }
  1605. }.
  1606. C_cfu ==>
  1607. {
  1608. reg_t a; /* target (int) size */
  1609. reg_t b; /* src (float) size */
  1610. int n1; /* target (int) size */
  1611. int n2; /* src (float) size */
  1612. const_str_t n1_str;
  1613. Comment0( cfu );
  1614. a= NULL;
  1615. b= NULL;
  1616. if (type_of_tos() != T_cst)
  1617. {
  1618. a= pop_reg();
  1619. b= pop_reg();
  1620. }
  1621. else
  1622. {
  1623. n1= pop_const (n1_str);
  1624. if (type_of_tos() != T_cst)
  1625. {
  1626. a= alloc_reg();
  1627. "set $n1_str, $a";
  1628. b= pop_reg();
  1629. }
  1630. else
  1631. n2= pop_const(NULL);
  1632. }
  1633. if (!a)
  1634. {
  1635. if (n1 != EM_WSIZE)
  1636. arg_error ("unimp cfu", n1);
  1637. force_alloc_output();
  1638. flush_cache();
  1639. if (n2 == EM_WSIZE)
  1640. {
  1641. "call cfu4";
  1642. "nop";
  1643. }
  1644. else if (n2 == EM_DSIZE)
  1645. {
  1646. "call cfu8";
  1647. "nop";
  1648. }
  1649. else
  1650. arg_error ("unimp cfu", n2);
  1651. soft_alloc_reg(reg_o0);
  1652. free_output();
  1653. push_reg(reg_o0);
  1654. }
  1655. else
  1656. {
  1657. flush_cache();
  1658. force_alloc_output();
  1659. "cmp $a, 4";
  1660. "bne 0f";
  1661. "nop";
  1662. "cmp $b, 4";
  1663. "be 4f";
  1664. "nop";
  1665. "cmp $b, 8";
  1666. "bne 0f";
  1667. "nop";
  1668. "8:";
  1669. "call cfu8";
  1670. "nop";
  1671. "b 1f";
  1672. "4:";
  1673. "call cfu4";
  1674. "nop";
  1675. "b 1f";
  1676. "0:";
  1677. "set E_EM_CFU, %o0";
  1678. "call trp";
  1679. "nop";
  1680. "1:";
  1681. free_reg(a);
  1682. free_reg(b);
  1683. soft_alloc_reg(reg_o0);
  1684. free_output();
  1685. push_reg(reg_o0);
  1686. }
  1687. }.
  1688. C_cff ==>
  1689. {
  1690. reg_t a; /* target (int) size */
  1691. reg_t b; /* src (float) size */
  1692. int n1; /* target (int) size */
  1693. int n2; /* src (float) size */
  1694. const_str_t n1_str;
  1695. Comment0( cff );
  1696. a= NULL;
  1697. b= NULL;
  1698. if (type_of_tos() != T_cst)
  1699. {
  1700. a= pop_reg();
  1701. b= pop_reg();
  1702. }
  1703. else
  1704. {
  1705. n1= pop_const (n1_str);
  1706. if (type_of_tos() != T_cst)
  1707. {
  1708. a= alloc_reg();
  1709. "set $n1_str, $a";
  1710. b= pop_reg();
  1711. }
  1712. else
  1713. n2= pop_const(NULL);
  1714. }
  1715. if (!a)
  1716. {
  1717. if (n1 == EM_WSIZE)
  1718. {
  1719. if (n2 == EM_DSIZE)
  1720. {
  1721. a= pop_double(NULL);
  1722. b= alloc_float();
  1723. "fdtos $a, $b";
  1724. free_double_reg(a);
  1725. push_reg(b);
  1726. } else if (n2 != EM_WSIZE)
  1727. arg_error ("unimp cff", n2);
  1728. }
  1729. else if (n1 == EM_DSIZE)
  1730. {
  1731. if (n2 == EM_WSIZE)
  1732. {
  1733. a= pop_float();
  1734. b= alloc_double(NULL);
  1735. "fstod $a, $b";
  1736. free_reg(a);
  1737. push_double_reg(b);
  1738. } else if (n2 != EM_DSIZE)
  1739. arg_error ("unimp cff", n2);
  1740. }
  1741. else
  1742. arg_error ("unimp cff", n1);
  1743. }
  1744. else
  1745. {
  1746. flush_cache();
  1747. force_alloc_output();
  1748. "cmp $b, $a";
  1749. "be 1f";
  1750. "nop"; /* delay slot */
  1751. "cmp $b, 4";
  1752. "be 4f";
  1753. "nop";
  1754. "cmp $b, 8";
  1755. "be 8f";
  1756. "nop";
  1757. "0:"
  1758. "set E_EM_CFF, %o0";
  1759. "call trp";
  1760. "nop";
  1761. "4:";
  1762. "cmp $a, 8";
  1763. "bne 0b";
  1764. "nop";
  1765. "ld [$reg_sp], %f0";
  1766. "fstod %f0, %f2";
  1767. "dec STACK_CLICK, $reg_sp";
  1768. "st %f2, [$reg_sp]";
  1769. "st %f3, [$reg_sp+STACK_CLICK]";
  1770. "b 1f";
  1771. "nop";
  1772. "8:";
  1773. "cmp $a, 4";
  1774. "bne 0b";
  1775. "nop";
  1776. "ld [$reg_sp], %f0";
  1777. "ld [$reg_sp+STACK_CLICK], %f1";
  1778. "fdtos %f0, %f2";
  1779. "inc STACK_CLICK, $reg_sp";
  1780. "st %f2, [$reg_sp]";
  1781. "1:";
  1782. free_reg(a);
  1783. free_reg(b);
  1784. free_output();
  1785. }
  1786. }.
  1787. C_cif ==>
  1788. {
  1789. reg_t a; /* target (float) size */
  1790. reg_t b; /* src (int) size */
  1791. int n1; /* target (float) size */
  1792. int n2; /* src (int) size */
  1793. reg_t r1;
  1794. reg_t f1;
  1795. const_str_t n1_str;
  1796. Comment0( cif );
  1797. a= NULL;
  1798. b= NULL;
  1799. if (type_of_tos() != T_cst)
  1800. {
  1801. a= pop_reg();
  1802. b= pop_reg();
  1803. }
  1804. else
  1805. {
  1806. n1= pop_const (n1_str);
  1807. if (type_of_tos() != T_cst)
  1808. {
  1809. a= alloc_reg();
  1810. "set $n1_str, $a";
  1811. b= pop_reg();
  1812. }
  1813. else
  1814. n2= pop_const(NULL);
  1815. }
  1816. if (!a)
  1817. {
  1818. if (n2 != EM_WSIZE)
  1819. arg_error ("unimp cif", n2);
  1820. else
  1821. {
  1822. if (n1 == EM_WSIZE)
  1823. {
  1824. r1= pop_float();
  1825. f1= alloc_float();
  1826. "fitos $r1, $f1";
  1827. free_reg(r1);
  1828. push_reg(f1);
  1829. }
  1830. else if (n1 == EM_DSIZE)
  1831. {
  1832. r1= pop_float();
  1833. f1= alloc_double(NULL);
  1834. "fitod $r1, $f1";
  1835. free_reg(r1);
  1836. push_double_reg(f1);
  1837. }
  1838. else
  1839. arg_error ("unimp cif", n1);
  1840. }
  1841. }
  1842. else
  1843. {
  1844. flush_cache();
  1845. force_alloc_output();
  1846. "cmp $a, 4";
  1847. "be 4f";
  1848. "nop"; /* delay slot */
  1849. "cmp $a, 8";
  1850. "be 8f";
  1851. "nop"; /* delay slot */
  1852. "1:"
  1853. "set E_EM_CUF, %o0";
  1854. "call trp";
  1855. "nop";
  1856. "4:";
  1857. "cmp $b, 4";
  1858. "bne 1b";
  1859. "nop"; /* delay slot */
  1860. "ld [$reg_sp], %f0";
  1861. "fitos %f0, %f1";
  1862. "b 0f";
  1863. "st %f1, [$reg_sp]"; /* delay slot */
  1864. "8:";
  1865. "dec STACK_CLICK, $reg_sp";
  1866. "cmp $b, 4";
  1867. "bne 1b";
  1868. "nop"; /* delay slot */
  1869. "ld [$reg_sp+STACK_CLICK], %f0";
  1870. "fitod %f0, %f2";
  1871. "st %f2, [$reg_sp]";
  1872. "b 0f";
  1873. "st %f3, [$reg_sp+STACK_CLICK]"; /* delay slot */
  1874. "0:";
  1875. free_reg(a);
  1876. free_reg(b);
  1877. free_output();
  1878. }
  1879. }.
  1880. C_cuf ==>
  1881. {
  1882. reg_t a; /* target (float) size */
  1883. reg_t b; /* src (int) size */
  1884. reg_t c;
  1885. reg_t fs1;
  1886. reg_t fs2;
  1887. reg_t fd1;
  1888. reg_t fd2;
  1889. int n1; /* target (float) size */
  1890. int n2; /* src (int) size */
  1891. const_str_t n1_str;
  1892. Comment0( cuf );
  1893. a= NULL;
  1894. b= NULL;
  1895. if (type_of_tos() != T_cst)
  1896. {
  1897. a= pop_reg();
  1898. b= pop_reg();
  1899. }
  1900. else
  1901. {
  1902. n1= pop_const (n1_str);
  1903. if (type_of_tos() != T_cst)
  1904. {
  1905. a= alloc_reg();
  1906. "set $n1_str, $a";
  1907. b= pop_reg();
  1908. }
  1909. else
  1910. n2= pop_const(NULL);
  1911. }
  1912. if (!a)
  1913. {
  1914. if (n2 != EM_WSIZE)
  1915. arg_error ("unimp cuf", n2);
  1916. else
  1917. {
  1918. if (n1 == EM_WSIZE)
  1919. {
  1920. fs1= pop_float();
  1921. fs2= alloc_float();
  1922. a= alloc_reg();
  1923. "fitos $fs1, $fs2";
  1924. "sethi %hi(Fs0), $a";
  1925. "ld [$a+%lo(Fs0)], $fs1";
  1926. "fcmpes $fs2, $fs1";
  1927. "nop";
  1928. "fbge 0f";
  1929. "nop";
  1930. "sethi %hi(Fs80000000), $a";
  1931. "ld [$a+%lo(Fs80000000)], $fs1";
  1932. "fadds $fs1, $fs2, $fs2";
  1933. "0:";
  1934. push_reg(fs2);
  1935. free_reg(fs1);
  1936. free_reg(a);
  1937. }
  1938. else if (n1 == EM_DSIZE)
  1939. {
  1940. fs1= pop_float();
  1941. fd1= alloc_double(NULL);
  1942. fd2= alloc_double(NULL);
  1943. a= alloc_reg();
  1944. "fitod $fs1, $fd2";
  1945. "sethi %hi(Fd0), $a";
  1946. "ldd [$a+%lo(Fd0)], $fd1";
  1947. "fcmped $fd2, $fd1";
  1948. "nop";
  1949. "fbge 0f";
  1950. "nop";
  1951. "sethi %hi(Fd80000000), $a";
  1952. "ldd [$a+%lo(Fd80000000)], $fd1";
  1953. "faddd $fd1, $fd2, $fd2";
  1954. "0:";
  1955. free_reg(fs1);
  1956. free_double_reg(fd1);
  1957. push_double_reg(fd2);
  1958. free_reg(a);
  1959. }
  1960. else
  1961. arg_error ("unimp cuf", n1);
  1962. }
  1963. }
  1964. else
  1965. {
  1966. #if 0
  1967. flush_cache();
  1968. "cmp $a, 4";
  1969. "be 4f";
  1970. "nop"; /* delay slot */
  1971. "cmp $a, 8";
  1972. "be 8f";
  1973. "nop"; /* delay slot */
  1974. "1:"
  1975. "set E_EM_CUF, %o0";
  1976. "set fatal, %g1";
  1977. "jmp %g1";
  1978. "nop";
  1979. "4:";
  1980. "cmp $b, 4";
  1981. "bne 1b";
  1982. "nop"; /* delay slot */
  1983. "ld [$reg_sp], $c";
  1984. "tst $c";
  1985. "bl 5f";
  1986. "nop"; /* delay slot */
  1987. "ld [$reg_sp], %f0";
  1988. "fitos %f0, %f1";
  1989. "b 0f";
  1990. "st %f1, [$reg_sp]"; /* delay slot */
  1991. "5:";
  1992. "set MAX_INT, $b";
  1993. "sub $c, $b, $a";
  1994. "st $a, [$reg_sp]";
  1995. "ld [$reg_sp], %f0";
  1996. "st $b, [$reg_sp]";
  1997. "ld [$reg_sp], %f1";
  1998. "fitos %f0, %f2";
  1999. "fitos %f1, %f3";
  2000. "fadds %f2, %f3, %f0";
  2001. "b 0f";
  2002. "st %f0, [$reg_sp]"; /* delay slot */
  2003. "8:";
  2004. "dec STACK_CLICK, $reg_sp";
  2005. "cmp $b, 4";
  2006. "bne 1b";
  2007. "nop"; /* delay slot */
  2008. "ld [$reg_sp+STACK_CLICK], $c";
  2009. "tst $c";
  2010. "bl 9f";
  2011. "nop"; /* delay slot */
  2012. "ld [$reg_sp+STACK_CLICK], %f0";
  2013. "fitod %f0, %f2";
  2014. "st %f2, [$reg_sp]";
  2015. "b 0f";
  2016. "st %f3, [$reg_sp+STACK_CLICK]"; /* delay slot */
  2017. "9:";
  2018. "set MAX_INT, $b";
  2019. "sub $c, $b, $a";
  2020. "st $a, [$reg_sp+STACK_CLICK]";
  2021. "ld [$reg_sp+STACK_CLICK], %f0";
  2022. "st $b, [$reg_sp+STACK_CLICK]";
  2023. "ld [$reg_sp+STACK_CLICK], %f1";
  2024. "fitod %f0, %f2";
  2025. "fitod %f1, %f4";
  2026. "fadds %f2, %f4, %f0";
  2027. "st %f0, [$reg_sp]";
  2028. "b 0f";
  2029. "st %f1, [$reg_sp+STACK_CLICK]"; /* delay slot */
  2030. "0:";
  2031. free_reg(a);
  2032. free_reg(b);
  2033. free_reg(c);
  2034. #else
  2035. not_implemented ("cuf");
  2036. #endif
  2037. }
  2038. }.
  2039. /******************************************************************************/
  2040. /* */
  2041. /* Group 9 : Logical */
  2042. /* */
  2043. /******************************************************************************/
  2044. C_and ==>
  2045. Comment( and, $1);
  2046. push_const($1);
  2047. C_and_narg().
  2048. C_and_narg ==>
  2049. {
  2050. reg_t a;
  2051. reg_t b;
  2052. reg_t c;
  2053. reg_t d;
  2054. reg_t e;
  2055. reg_t f;
  2056. const_str_t a_cst_str;
  2057. const_str_t b_cst_str;
  2058. const_str_t c_cst_str;
  2059. const_str_t d_cst_str;
  2060. int n;
  2061. const_str_t n_str;
  2062. Comment0( and_narg );
  2063. if (type_of_tos() == T_cst)
  2064. {
  2065. n= pop_const(n_str);
  2066. if (n == EM_WSIZE)
  2067. {
  2068. if (type_of_tos() == T_cst && const13(top_const()))
  2069. {
  2070. a= NULL;
  2071. pop_const (a_cst_str);
  2072. }
  2073. else
  2074. a= pop_reg();
  2075. if (type_of_tos() == T_cst && const13(top_const()))
  2076. {
  2077. b= NULL;
  2078. pop_const (b_cst_str);
  2079. }
  2080. else
  2081. b= pop_reg();
  2082. if (!a && !b)
  2083. {
  2084. a= alloc_reg();
  2085. "mov $a_cst_str, $a";
  2086. }
  2087. c= alloc_reg();
  2088. if (a)
  2089. if (b)
  2090. "and $a, $b, $c";
  2091. else
  2092. "and $a, $b_cst_str, $c";
  2093. else
  2094. "and $b, $a_cst_str, $c";
  2095. free_reg(a);
  2096. free_reg(b);
  2097. push_reg(c);
  2098. }
  2099. else if (n == EM_DSIZE)
  2100. {
  2101. if (type_of_tos() == T_cst && const13(top_const()))
  2102. {
  2103. a= NULL;
  2104. pop_const (a_cst_str);
  2105. }
  2106. else
  2107. a= pop_reg();
  2108. if (type_of_tos() == T_cst && const13(top_const()))
  2109. {
  2110. b= NULL;
  2111. pop_const (b_cst_str);
  2112. }
  2113. else
  2114. b= pop_reg();
  2115. if (type_of_tos() == T_cst && const13(top_const()))
  2116. {
  2117. c= NULL;
  2118. pop_const (c_cst_str);
  2119. }
  2120. else
  2121. c= pop_reg();
  2122. if (type_of_tos() == T_cst && const13(top_const()))
  2123. {
  2124. d= NULL;
  2125. pop_const (d_cst_str);
  2126. }
  2127. else
  2128. d= pop_reg();
  2129. if (!b && !d)
  2130. {
  2131. b= alloc_reg();
  2132. "mov $b_cst_str, $b";
  2133. }
  2134. e= alloc_reg();
  2135. if (b)
  2136. if (d)
  2137. "and $b, $d, $e";
  2138. else
  2139. "and $b, $d_cst_str, $e";
  2140. else
  2141. "and $d, $b_cst_str, $e";
  2142. free_reg(b);
  2143. free_reg(d);
  2144. push_reg(e);
  2145. if (!a && !c)
  2146. {
  2147. a= alloc_reg();
  2148. "mov $a_cst_str, $a";
  2149. }
  2150. e= alloc_reg();
  2151. if (a)
  2152. if (c)
  2153. "and $a, $c, $e";
  2154. else
  2155. "and $a, $c_cst_str, $e";
  2156. else
  2157. "and $c, $a_cst_str, $e";
  2158. free_reg(a);
  2159. free_reg(c);
  2160. push_reg(e);
  2161. }
  2162. else if (!(n % EM_WSIZE))
  2163. {
  2164. a= alloc_reg();
  2165. b= alloc_reg();
  2166. c= alloc_reg();
  2167. d= alloc_reg();
  2168. e= alloc_reg();
  2169. f= alloc_reg();
  2170. flush_cache();
  2171. "set $n_str, $a";
  2172. "add $reg_sp, $a, $b";
  2173. "mov $a, $c";
  2174. "1:";
  2175. "deccc 4, $c";
  2176. "ld [$reg_sp+$c], $d";
  2177. "ld [$b+$c], $e";
  2178. "and $d, $e, $f";
  2179. "bnz 1b";
  2180. "st $f, [$b+$c]"; /* delay slot */
  2181. "add $reg_sp, $a, $reg_sp";
  2182. free_reg(a);
  2183. free_reg(b);
  2184. free_reg(c);
  2185. free_reg(d);
  2186. free_reg(e);
  2187. free_reg(f);
  2188. }
  2189. else
  2190. arg_error ("unimp and", n);
  2191. }
  2192. else
  2193. {
  2194. a= pop_reg();
  2195. b= alloc_reg();
  2196. c= alloc_reg();
  2197. d= alloc_reg();
  2198. e= alloc_reg();
  2199. f= alloc_reg();
  2200. flush_cache();
  2201. "add $reg_sp, $a, $b";
  2202. "mov $a, $c";
  2203. "1:";
  2204. "deccc 4, $c";
  2205. "ld [$reg_sp+$c], $d";
  2206. "ld [$b+$c], $e";
  2207. "and $d, $e, $f";
  2208. "bnz 1b";
  2209. "st $f, [$b+$c]"; /* delay slot */
  2210. "add $reg_sp, $a, $reg_sp";
  2211. free_reg(a);
  2212. free_reg(b);
  2213. free_reg(c);
  2214. free_reg(d);
  2215. free_reg(e);
  2216. free_reg(f);
  2217. }
  2218. }.
  2219. C_ior ==>
  2220. Comment( ior, $1);
  2221. push_const($1);
  2222. C_ior_narg().
  2223. C_ior_narg ==>
  2224. {
  2225. reg_t a;
  2226. reg_t b;
  2227. reg_t c;
  2228. reg_t d;
  2229. reg_t e;
  2230. reg_t f;
  2231. const_str_t a_cst_str;
  2232. const_str_t b_cst_str;
  2233. const_str_t c_cst_str;
  2234. const_str_t d_cst_str;
  2235. int n;
  2236. const_str_t n_str;
  2237. Comment0( ior_narg );
  2238. if (type_of_tos() == T_cst)
  2239. {
  2240. n= pop_const(n_str);
  2241. if (n == EM_WSIZE)
  2242. {
  2243. if (type_of_tos() == T_cst && const13(top_const()))
  2244. {
  2245. a= NULL;
  2246. pop_const (a_cst_str);
  2247. }
  2248. else
  2249. a= pop_reg();
  2250. if (type_of_tos() == T_cst && const13(top_const()))
  2251. {
  2252. b= NULL;
  2253. pop_const (b_cst_str);
  2254. }
  2255. else
  2256. b= pop_reg();
  2257. if (!a && !b)
  2258. {
  2259. a= alloc_reg();
  2260. "mov $a_cst_str, $a";
  2261. }
  2262. c= alloc_reg();
  2263. if (a)
  2264. if (b)
  2265. "or $a, $b, $c";
  2266. else
  2267. "or $a, $b_cst_str, $c";
  2268. else
  2269. "or $b, $a_cst_str, $c";
  2270. free_reg(a);
  2271. free_reg(b);
  2272. push_reg(c);
  2273. }
  2274. else if (n == EM_DSIZE)
  2275. {
  2276. if (type_of_tos() == T_cst && const13(top_const()))
  2277. {
  2278. a= NULL;
  2279. pop_const (a_cst_str);
  2280. }
  2281. else
  2282. a= pop_reg();
  2283. if (type_of_tos() == T_cst && const13(top_const()))
  2284. {
  2285. b= NULL;
  2286. pop_const (b_cst_str);
  2287. }
  2288. else
  2289. b= pop_reg();
  2290. if (type_of_tos() == T_cst && const13(top_const()))
  2291. {
  2292. c= NULL;
  2293. pop_const (c_cst_str);
  2294. }
  2295. else
  2296. c= pop_reg();
  2297. if (type_of_tos() == T_cst && const13(top_const()))
  2298. {
  2299. d= NULL;
  2300. pop_const (d_cst_str);
  2301. }
  2302. else
  2303. d= pop_reg();
  2304. if (!b && !d)
  2305. {
  2306. b= alloc_reg();
  2307. "mov $b_cst_str, $b";
  2308. }
  2309. e= alloc_reg();
  2310. if (b)
  2311. if (d)
  2312. "or $b, $d, $e";
  2313. else
  2314. "or $b, $d_cst_str, $e";
  2315. else
  2316. "or $d, $b_cst_str, $e";
  2317. free_reg(b);
  2318. free_reg(d);
  2319. push_reg(e);
  2320. if (!a && !c)
  2321. {
  2322. a= alloc_reg();
  2323. "mov $a_cst_str, $a";
  2324. }
  2325. e= alloc_reg();
  2326. if (a)
  2327. if (c)
  2328. "or $a, $c, $e";
  2329. else
  2330. "or $a, $c_cst_str, $e";
  2331. else
  2332. "or $c, $a_cst_str, $e";
  2333. free_reg(a);
  2334. free_reg(c);
  2335. push_reg(e);
  2336. }
  2337. else if (!(n % EM_WSIZE))
  2338. {
  2339. a= alloc_reg();
  2340. b= alloc_reg();
  2341. c= alloc_reg();
  2342. d= alloc_reg();
  2343. e= alloc_reg();
  2344. f= alloc_reg();
  2345. flush_cache();
  2346. "set $n_str, $a";
  2347. "add $reg_sp, $a, $b";
  2348. "mov $a, $c";
  2349. "1:";
  2350. "deccc 4, $c";
  2351. "ld [$reg_sp+$c], $d";
  2352. "ld [$b+$c], $e";
  2353. "or $d, $e, $f";
  2354. "bnz 1b";
  2355. "st $f, [$b+$c]"; /* delay slot */
  2356. "add $reg_sp, $a, $reg_sp";
  2357. free_reg(a);
  2358. free_reg(b);
  2359. free_reg(c);
  2360. free_reg(d);
  2361. free_reg(e);
  2362. free_reg(f);
  2363. }
  2364. else
  2365. arg_error ("unimp ior", n);
  2366. }
  2367. else
  2368. {
  2369. a= pop_reg();
  2370. b= alloc_reg();
  2371. c= alloc_reg();
  2372. d= alloc_reg();
  2373. e= alloc_reg();
  2374. f= alloc_reg();
  2375. flush_cache();
  2376. "add $reg_sp, $a, $b";
  2377. "mov $a, $c";
  2378. "1:";
  2379. "deccc 4, $c";
  2380. "ld [$reg_sp+$c], $d";
  2381. "ld [$b+$c], $e";
  2382. "or $d, $e, $f";
  2383. "bnz 1b";
  2384. "st $f, [$b+$c]"; /* delay slot */
  2385. "add $reg_sp, $a, $reg_sp";
  2386. free_reg(a);
  2387. free_reg(b);
  2388. free_reg(c);
  2389. free_reg(d);
  2390. free_reg(e);
  2391. free_reg(f);
  2392. }
  2393. }.
  2394. C_xor ==>
  2395. Comment( xor, $1);
  2396. push_const($1);
  2397. C_xor_narg().
  2398. C_xor_narg ==>
  2399. {
  2400. reg_t a;
  2401. reg_t b;
  2402. reg_t c;
  2403. reg_t d;
  2404. reg_t e;
  2405. reg_t f;
  2406. const_str_t a_cst_str;
  2407. const_str_t b_cst_str;
  2408. const_str_t c_cst_str;
  2409. const_str_t d_cst_str;
  2410. int n;
  2411. const_str_t n_str;
  2412. Comment0( xor_narg );
  2413. if (type_of_tos() == T_cst)
  2414. {
  2415. n= pop_const(n_str);
  2416. if (n == EM_WSIZE)
  2417. {
  2418. if (type_of_tos() == T_cst && const13(top_const()))
  2419. {
  2420. a= NULL;
  2421. pop_const (a_cst_str);
  2422. }
  2423. else
  2424. a= pop_reg();
  2425. if (type_of_tos() == T_cst && const13(top_const()))
  2426. {
  2427. b= NULL;
  2428. pop_const (b_cst_str);
  2429. }
  2430. else
  2431. b= pop_reg();
  2432. if (!a && !b)
  2433. {
  2434. a= alloc_reg();
  2435. "mov $a_cst_str, $a";
  2436. }
  2437. c= alloc_reg();
  2438. if (a)
  2439. if (b)
  2440. "xor $a, $b, $c";
  2441. else
  2442. "xor $a, $b_cst_str, $c";
  2443. else
  2444. "xor $b, $a_cst_str, $c";
  2445. free_reg(a);
  2446. free_reg(b);
  2447. push_reg(c);
  2448. }
  2449. else if (n == EM_DSIZE)
  2450. {
  2451. if (type_of_tos() == T_cst && const13(top_const()))
  2452. {
  2453. a= NULL;
  2454. pop_const (a_cst_str);
  2455. }
  2456. else
  2457. a= pop_reg();
  2458. if (type_of_tos() == T_cst && const13(top_const()))
  2459. {
  2460. b= NULL;
  2461. pop_const (b_cst_str);
  2462. }
  2463. else
  2464. b= pop_reg();
  2465. if (type_of_tos() == T_cst && const13(top_const()))
  2466. {
  2467. c= NULL;
  2468. pop_const (c_cst_str);
  2469. }
  2470. else
  2471. c= pop_reg();
  2472. if (type_of_tos() == T_cst && const13(top_const()))
  2473. {
  2474. d= NULL;
  2475. pop_const (d_cst_str);
  2476. }
  2477. else
  2478. d= pop_reg();
  2479. if (!b && !d)
  2480. {
  2481. b= alloc_reg();
  2482. "mov $b_cst_str, $b";
  2483. }
  2484. e= alloc_reg();
  2485. if (b)
  2486. if (d)
  2487. "xor $b, $d, $e";
  2488. else
  2489. "xor $b, $d_cst_str, $e";
  2490. else
  2491. "xor $d, $b_cst_str, $e";
  2492. free_reg(b);
  2493. free_reg(d);
  2494. push_reg(e);
  2495. if (!a && !c)
  2496. {
  2497. a= alloc_reg();
  2498. "mov $a_cst_str, $a";
  2499. }
  2500. e= alloc_reg();
  2501. if (a)
  2502. if (c)
  2503. "xor $a, $c, $e";
  2504. else
  2505. "xor $a, $c_cst_str, $e";
  2506. else
  2507. "xor $c, $a_cst_str, $e";
  2508. free_reg(a);
  2509. free_reg(c);
  2510. push_reg(e);
  2511. }
  2512. else if (!(n % EM_WSIZE))
  2513. {
  2514. a= alloc_reg();
  2515. b= alloc_reg();
  2516. c= alloc_reg();
  2517. d= alloc_reg();
  2518. e= alloc_reg();
  2519. f= alloc_reg();
  2520. flush_cache();
  2521. "set $n_str, $a";
  2522. "add $reg_sp, $a, $b";
  2523. "mov $a, $c";
  2524. "1:";
  2525. "deccc 4, $c";
  2526. "ld [$reg_sp+$c], $d";
  2527. "ld [$b+$c], $e";
  2528. "xor $d, $e, $f";
  2529. "bnz 1b";
  2530. "st $f, [$b+$c]"; /* delay slot */
  2531. "add $reg_sp, $a, $reg_sp";
  2532. free_reg(a);
  2533. free_reg(b);
  2534. free_reg(c);
  2535. free_reg(d);
  2536. free_reg(e);
  2537. free_reg(f);
  2538. }
  2539. else
  2540. arg_error ("unimp xor", n);
  2541. }
  2542. else
  2543. {
  2544. a= pop_reg();
  2545. b= alloc_reg();
  2546. c= alloc_reg();
  2547. d= alloc_reg();
  2548. e= alloc_reg();
  2549. f= alloc_reg();
  2550. flush_cache();
  2551. "add $reg_sp, $a, $b";
  2552. "mov $a, $c";
  2553. "1:";
  2554. "deccc 4, $c";
  2555. "ld [$reg_sp+$c], $d";
  2556. "ld [$b+$c], $e";
  2557. "xor $d, $e, $f";
  2558. "bnz 1b";
  2559. "st $f, [$b+$c]"; /* delay slot */
  2560. "add $reg_sp, $a, $reg_sp";
  2561. free_reg(a);
  2562. free_reg(b);
  2563. free_reg(c);
  2564. free_reg(d);
  2565. free_reg(e);
  2566. free_reg(f);
  2567. }
  2568. }.
  2569. C_com ==>
  2570. Comment( com, $1);
  2571. push_const($1);
  2572. C_com_narg().
  2573. C_com_narg ==>
  2574. {
  2575. reg_t a;
  2576. reg_t b;
  2577. reg_t c;
  2578. reg_t d;
  2579. int n;
  2580. int i;
  2581. const_str_t i_str;
  2582. Comment0( com_narg );
  2583. if (type_of_tos() == T_cst && top_const() <= MAX_UNROLL)
  2584. {
  2585. n= pop_const(NULL);
  2586. if (n == 4)
  2587. {
  2588. a= pop_reg();
  2589. b= alloc_reg();
  2590. "not $a, $b";
  2591. free_reg(a);
  2592. push_reg(b);
  2593. }
  2594. else if (n == 8)
  2595. {
  2596. a= pop_reg();
  2597. b= pop_reg();
  2598. c= alloc_reg();
  2599. d= alloc_reg();
  2600. "not $a, $c";
  2601. "not $b, $d";
  2602. push_reg(d);
  2603. push_reg(c);
  2604. free_reg(b);
  2605. free_reg(a);
  2606. }
  2607. else if (n>0 && !(n % 4))
  2608. {
  2609. flush_cache();
  2610. a= alloc_reg();
  2611. b= alloc_reg();
  2612. for (i= 0; i< n; i += 4)
  2613. {
  2614. sprint(i_str, "%d", i);
  2615. "ld [$reg_sp+$i_str], $a";
  2616. "not $a, $b";
  2617. "st $b, [$reg_sp+$i_str]";
  2618. }
  2619. free_reg(b);
  2620. free_reg(a);
  2621. }
  2622. else
  2623. arg_error ("com", n);
  2624. }
  2625. else
  2626. {
  2627. a= alloc_reg();
  2628. pop_reg_as(a);
  2629. b= alloc_reg();
  2630. c= alloc_reg();
  2631. flush_cache();
  2632. "1:";
  2633. "deccc 4, $a";
  2634. "ld [$reg_sp+$a], $b";
  2635. "not $a, $c";
  2636. "bnz 1b";
  2637. "st $c, [$reg_sp+$a]";
  2638. free_reg(a);
  2639. free_reg(b);
  2640. free_reg(c);
  2641. }
  2642. }.
  2643. C_rol
  2644. $1 == 4 ==>
  2645. {
  2646. reg_t a;
  2647. reg_t b;
  2648. reg_t c;
  2649. reg_t d;
  2650. int n;
  2651. const_str_t n_str;
  2652. Comment( rol, $1);
  2653. if (type_of_tos() == T_cst)
  2654. {
  2655. n= pop_const(NULL);
  2656. if (n<0)
  2657. arg_error("rol 4:", n);
  2658. else
  2659. {
  2660. n= n % 32;
  2661. if (n)
  2662. {
  2663. a= pop_reg();
  2664. b= alloc_reg();
  2665. c= alloc_reg();
  2666. sprint(n_str, "%d", n);
  2667. "sll $a, $n_str, $b";
  2668. sprint(n_str, "%d", 32-n);
  2669. "srl $a, $n_str, $c";
  2670. "or $b, $c, $c";
  2671. free_reg(a);
  2672. free_reg(b);
  2673. push_reg(c);
  2674. }
  2675. }
  2676. }
  2677. else
  2678. {
  2679. a= pop_reg();
  2680. b= pop_reg();
  2681. c= alloc_reg();
  2682. d= alloc_reg();
  2683. "and $a, 31, $c";
  2684. "mov 32, $d";
  2685. "sub $d, $c, $d";
  2686. "sll $b, $c, $c";
  2687. "srl $b, $d, $d";
  2688. "or $c, $d, $d";
  2689. free_reg(a);
  2690. free_reg(b);
  2691. free_reg(c);
  2692. push_ref(d);
  2693. }
  2694. }.
  2695. default ==>
  2696. arg_error( "rol", $1).
  2697. narg4(rol)
  2698. C_ror
  2699. $1 == 4 ==>
  2700. {
  2701. reg_t a;
  2702. reg_t b;
  2703. reg_t c;
  2704. reg_t d;
  2705. int n;
  2706. const_str_t n_str;
  2707. Comment( ror, $1);
  2708. if (type_of_tos() == T_cst)
  2709. {
  2710. n= pop_const(NULL);
  2711. if (n<0)
  2712. arg_error("ror 4:", n);
  2713. else
  2714. {
  2715. n= n % 32;
  2716. if (n)
  2717. {
  2718. a= pop_reg();
  2719. b= alloc_reg();
  2720. c= alloc_reg();
  2721. sprint(n_str, "%d", n);
  2722. "srl $a, $n_str, $b";
  2723. sprint(n_str, "%d", 32-n);
  2724. "sll $a, $n_str, $c";
  2725. "or $b, $c, $c";
  2726. free_reg(a);
  2727. free_reg(b);
  2728. push_reg(c);
  2729. }
  2730. }
  2731. }
  2732. else
  2733. {
  2734. a= pop_reg();
  2735. b= pop_reg();
  2736. c= alloc_reg();
  2737. d= alloc_reg();
  2738. "and $a, 31, $c";
  2739. "mov 32, $d";
  2740. "sub $d, $c, $d";
  2741. "srl $b, $c, $c";
  2742. "sll $b, $d, $d";
  2743. "or $c, $d, $d";
  2744. free_reg(a);
  2745. free_reg(b);
  2746. free_reg(c);
  2747. push_reg(d);
  2748. }
  2749. }.
  2750. default ==>
  2751. arg_error( "ror", $1).
  2752. narg4(ror)
  2753. /******************************************************************************/
  2754. /* */
  2755. /* Group 10 : Sets */
  2756. /* */
  2757. /******************************************************************************/
  2758. C_inn ==>
  2759. Comment( inn, $1);
  2760. push_const($1);
  2761. C_inn_narg().
  2762. C_inn_narg ==>
  2763. {
  2764. reg_t a;
  2765. reg_t b;
  2766. reg_t c;
  2767. reg_t d;
  2768. int i;
  2769. int n;
  2770. const_str_t i_str;
  2771. const_str_t n_str;
  2772. Comment0(inn_narg);
  2773. if (type_of_tos() == T_cst && const13(top_const()))
  2774. {
  2775. n= pop_const(n_str);
  2776. if (n == EM_WSIZE)
  2777. {
  2778. if (type_of_tos() == T_cst)
  2779. {
  2780. i= pop_const (i_str);
  2781. if (i >= n*8)
  2782. push_const(0);
  2783. else
  2784. {
  2785. a= pop_reg();
  2786. b= alloc_reg();
  2787. "srl $a, $i_str, $b";
  2788. "and $b, 1, $b";
  2789. free_reg(a);
  2790. push_reg(b);
  2791. }
  2792. }
  2793. else
  2794. {
  2795. a= pop_reg();
  2796. b= pop_reg();
  2797. c= alloc_reg();
  2798. "srl $b, $a, $c";
  2799. "and $c, 1, $c";
  2800. push_reg(c);
  2801. free_reg(b);
  2802. free_reg(a);
  2803. }
  2804. }
  2805. else if (n == 2*EM_WSIZE)
  2806. {
  2807. if (type_of_tos() == T_cst)
  2808. {
  2809. i= pop_const (i_str);
  2810. if (i >= n*8)
  2811. push_const(0);
  2812. else
  2813. {
  2814. if (i>= EM_WSIZE*8)
  2815. {
  2816. i -= EM_WSIZE*8;
  2817. pop_nop(1);
  2818. a= pop_reg();
  2819. }
  2820. else
  2821. {
  2822. a= pop_reg();
  2823. pop_nop(1);
  2824. }
  2825. b= alloc_reg();
  2826. c= alloc_reg();
  2827. "srl $a, $i_str, $b";
  2828. "and $b, 1, $c";
  2829. free_reg(a);
  2830. free_reg(b);
  2831. push_reg(c);
  2832. }
  2833. }
  2834. else
  2835. {
  2836. a= pop_reg();
  2837. flush_cache();
  2838. b= alloc_reg();
  2839. c= alloc_reg();
  2840. d= alloc_reg();
  2841. flush_cache();
  2842. "andn $a, 31, $b";
  2843. "and $a, 31, $c";
  2844. "srl $b, 3, $d";
  2845. "ld [$reg_sp+$d], $b";
  2846. "inc $n_str, $reg_sp";
  2847. "srl $b, $c, $d";
  2848. "and $d, 1, $b";
  2849. free_reg(a);
  2850. push_reg(b);
  2851. free_reg(c);
  2852. free_reg(d);
  2853. }
  2854. }
  2855. else if (n % EM_WSIZE)
  2856. arg_error ("inn", n);
  2857. else
  2858. {
  2859. a= pop_reg();
  2860. flush_cache();
  2861. b= alloc_reg();
  2862. c= alloc_reg();
  2863. d= alloc_reg();
  2864. flush_cache();
  2865. "andn $a, 31, $b";
  2866. "and $a, 31, $c";
  2867. "srl $b, 3, $d";
  2868. "ld [$reg_sp+$d], $b";
  2869. "inc $n_str, $reg_sp";
  2870. "srl $b, $c, $d";
  2871. "and $d, 1, $b";
  2872. free_reg(a);
  2873. push_reg(b);
  2874. free_reg(c);
  2875. free_reg(d);
  2876. }
  2877. }
  2878. else
  2879. not_implemented ("inn_narg");
  2880. }.
  2881. C_set ==> Comment( set, $1);
  2882. push_const($1);
  2883. C_set_narg().
  2884. C_set_narg ==>
  2885. {
  2886. reg_t a;
  2887. reg_t b;
  2888. reg_t c;
  2889. reg_t d;
  2890. int n;
  2891. const_str_t n_str;
  2892. Comment0( set_narg );
  2893. if (type_of_tos() == T_cst) {
  2894. n = pop_const(n_str);
  2895. if (n == EM_WSIZE) {
  2896. b = alloc_reg();
  2897. c = alloc_reg();
  2898. a = pop_reg();
  2899. "set 1, $c";
  2900. "sll $c, $a, $b";
  2901. free_reg(a);
  2902. free_reg(c);
  2903. push_reg(b);
  2904. } else {
  2905. a= alloc_reg();
  2906. b= pop_reg();
  2907. c= alloc_reg();
  2908. d= alloc_reg();
  2909. flush_cache();
  2910. sprint(n_str, "%d", n);
  2911. "set $n_str, $a";
  2912. "sub $reg_sp, $a, $reg_sp";
  2913. "1:";
  2914. "deccc 4, $a";
  2915. "bnz 1b";
  2916. "st %g0, [$reg_sp+$a]"; /* HACK delay */
  2917. "andn $b, 31, $c";
  2918. "and $b, 31, $d";
  2919. "srl $c, 3, $c";
  2920. "set 1, $a";
  2921. "sll $a, $d, $d";
  2922. "st $d, [$reg_sp+$c]";
  2923. free_reg(a);
  2924. free_reg(b);
  2925. free_reg(c);
  2926. free_reg(d);
  2927. }
  2928. } else {
  2929. a= alloc_reg();
  2930. pop_reg_as(a);
  2931. b= pop_reg();
  2932. flush_cache();
  2933. c= alloc_reg();
  2934. d= alloc_reg();
  2935. "sub $reg_sp, $a, $reg_sp";
  2936. "1:";
  2937. "deccc 4, $a";
  2938. "bnz 1b";
  2939. "st %g0, [$reg_sp+$a]"; /* HACK delay */
  2940. "andn $b, 31, $c";
  2941. "and $b, 31, $d";
  2942. "srl $c, 3, $c";
  2943. "set 1, $a";
  2944. "sll $a, $d, $d";
  2945. "st $d, [$reg_sp+$c]";
  2946. free_reg(a);
  2947. free_reg(b);
  2948. free_reg(c);
  2949. free_reg(d);
  2950. }
  2951. }.
  2952. /******************************************************************************/
  2953. /* */
  2954. /* Group 11 : Array */
  2955. /* */
  2956. /******************************************************************************/
  2957. C_lar
  2958. ($1 == 4) ==>
  2959. Comment(lar, $1);
  2960. force_alloc_output();
  2961. pop_reg_as(reg_o0);
  2962. pop_reg_as(reg_o1);
  2963. pop_reg_as(reg_o2);
  2964. flush_cache();
  2965. "call lar";
  2966. "nop";
  2967. free_output().
  2968. default ==>
  2969. arg_error ("arg error lar", $1).
  2970. narg4(lar)
  2971. C_sar
  2972. ($1 == 4) ==>
  2973. Comment( sar , $1 );
  2974. force_alloc_output();
  2975. pop_reg_as(reg_o0);
  2976. pop_reg_as(reg_o1);
  2977. pop_reg_as(reg_o2);
  2978. flush_cache();
  2979. "call sar";
  2980. "nop"
  2981. free_output().
  2982. default ==>
  2983. arg_error ("arg error sar", $1).
  2984. narg4(sar)
  2985. C_aar
  2986. ($1 == 4) ==>
  2987. Comment(aar, $1);
  2988. force_alloc_output();
  2989. pop_reg_as(reg_o0);
  2990. pop_reg_as(reg_o1);
  2991. pop_reg_as(reg_o2);
  2992. flush_cache();
  2993. "call aar";
  2994. "nop";
  2995. soft_alloc_reg(reg_o0);
  2996. free_output();
  2997. push_reg(reg_o0).
  2998. default ==>
  2999. arg_error ("arg error aar", $1).
  3000. narg4(aar)
  3001. /******************************************************************************/
  3002. /* */
  3003. /* Group 12 : Compare */
  3004. /* */
  3005. /******************************************************************************/
  3006. C_cmi
  3007. $1 == 4 ==>
  3008. {
  3009. reg_t a;
  3010. reg_t b;
  3011. reg_t c;
  3012. const_str_t d;
  3013. Comment( cmi, $1 );
  3014. if (type_of_tos() == T_cst && const13(top_const()))
  3015. {
  3016. pop_const(d);
  3017. a= pop_reg();
  3018. b= alloc_reg();
  3019. "cmp $a, $d";
  3020. "be,a 1f";
  3021. "mov 0, $b"; /* delay slot */
  3022. "bg,a 1f";
  3023. "mov 1, $b"; /* delay slot */
  3024. "mov -1, $b";
  3025. "1:";
  3026. free_reg(a);
  3027. push_reg(b);
  3028. }
  3029. else
  3030. {
  3031. a= pop_reg();
  3032. b= NULL;
  3033. c= alloc_reg();
  3034. if (type_of_tos() == T_cst)
  3035. {
  3036. pop_const(d);
  3037. "cmp $a, $d";
  3038. }
  3039. else
  3040. {
  3041. b= pop_reg();
  3042. "cmp $a, $b";
  3043. }
  3044. "be,a 1f";
  3045. "mov 0, $c"; /* delay slot */
  3046. "bg,a 1f";
  3047. "mov -1, $c"; /* delay slot */
  3048. "mov 1, $c";
  3049. "1:";
  3050. free_reg(a);
  3051. if (b)
  3052. free_reg(b);
  3053. push_reg(c);
  3054. }
  3055. }.
  3056. default ==>
  3057. arg_error ("unimp cmi", $1).
  3058. narg4(cmi)
  3059. C_cmu ==>
  3060. Comment( cmu, $1 );
  3061. push_const($1);
  3062. C_cmu_narg().
  3063. C_cmu_narg ==>
  3064. {
  3065. int n;
  3066. reg_t a;
  3067. reg_t b;
  3068. reg_t c;
  3069. const_str_t d;
  3070. Comment0( cmu_narg );
  3071. if (type_of_tos() == T_cst)
  3072. {
  3073. n= pop_const(NULL);
  3074. if (n != EM_WSIZE)
  3075. arg_error ("unimp cmu", n);
  3076. else
  3077. {
  3078. if (type_of_tos() == T_cst &&
  3079. const13(top_const()))
  3080. {
  3081. pop_const(d);
  3082. a= pop_reg();
  3083. b= alloc_reg();
  3084. "cmp $a, $d";
  3085. "be,a 1f";
  3086. "mov 0, $b"; /* delay slot */
  3087. "bgu,a 1f";
  3088. "mov 1, $b"; /* delay slot */
  3089. "mov -1, $b";
  3090. "1:";
  3091. free_reg(a);
  3092. push_reg(b);
  3093. }
  3094. else
  3095. {
  3096. a= pop_reg();
  3097. b= NULL;
  3098. c= alloc_reg();
  3099. if (type_of_tos() == T_cst &&
  3100. const13(top_const()))
  3101. {
  3102. pop_const(d);
  3103. "cmp $a, $d";
  3104. }
  3105. else
  3106. {
  3107. b= pop_reg();
  3108. "cmp $a, $b";
  3109. }
  3110. "be,a 1f";
  3111. "mov 0, $c"; /* delay slot */
  3112. "bgu,a 1f";
  3113. "mov -1, $c"; /* delay slot */
  3114. "mov 1, $c";
  3115. "1:";
  3116. free_reg(a);
  3117. if (b)
  3118. free_reg(b);
  3119. push_reg(c);
  3120. }
  3121. }
  3122. }
  3123. else
  3124. not_implemented ("cmu_narg");
  3125. }.
  3126. C_cms ==>
  3127. Comment( cms, $1 );
  3128. push_const($1);
  3129. C_cms_narg().
  3130. C_cms_narg ==>
  3131. {
  3132. int n;
  3133. reg_t a;
  3134. reg_t b;
  3135. reg_t c;
  3136. reg_t d;
  3137. reg_t e;
  3138. const_str_t b_str;
  3139. const_str_t n_str;
  3140. Comment0( cms_narg );
  3141. if (type_of_tos() == T_cst && top_const() <= EM_WSIZE)
  3142. {
  3143. n= pop_const(n_str);
  3144. if (n == EM_WSIZE)
  3145. {
  3146. b= NULL;
  3147. c= alloc_reg();
  3148. if (type_of_tos() == T_cst &&
  3149. const13(top_const()))
  3150. {
  3151. pop_const(b_str);
  3152. a= pop_reg();
  3153. "cmp $a, $b_str";
  3154. }
  3155. else
  3156. {
  3157. a= pop_reg();
  3158. b= pop_reg();
  3159. "cmp $a, $b";
  3160. }
  3161. "be,a 1f";
  3162. "mov 0, $c";
  3163. "mov 1, $c";
  3164. "1:";
  3165. free_reg(a);
  3166. if (b)
  3167. free_reg(b);
  3168. push_reg(c);
  3169. }
  3170. else if (n % EM_WSIZE)
  3171. arg_error ("unimp cms", n);
  3172. }
  3173. else
  3174. {
  3175. a= pop_reg();
  3176. flush_cache();
  3177. b= alloc_reg();
  3178. c= alloc_reg();
  3179. d= alloc_reg();
  3180. "add $reg_sp, $a, $b";
  3181. "dec 4, $b";
  3182. "1:";
  3183. "ld [$b], $c";
  3184. "ld [$b+$a], $d";
  3185. "cmp $d, $c";
  3186. "bne,a 2f";
  3187. "mov 1, $b"; /* delay slot */
  3188. "cmp $b, $reg_sp";
  3189. "bg 1b";
  3190. "dec 4, $b"; /* delay slot */
  3191. "mov 0, $b";
  3192. "2:";
  3193. "add $reg_sp, $a, $reg_sp";
  3194. "add $reg_sp, $a, $reg_sp";
  3195. free_reg(a);
  3196. push_reg(b);
  3197. free_reg(c);
  3198. free_reg(d);
  3199. }
  3200. }.
  3201. C_cmp ==>
  3202. Comment0( cmp );
  3203. C_cmu( (arith)4).
  3204. C_tlt ==>
  3205. Comment0( tlt );
  3206. {
  3207. reg_t a;
  3208. reg_t b;
  3209. a = pop_reg();
  3210. b= alloc_reg();
  3211. " tst $a";
  3212. " bl,a 1f";
  3213. " mov 1, $b"; /* delay slot */
  3214. " set 0, $b";
  3215. "1:";
  3216. free_reg(a);
  3217. push_reg(b);
  3218. }.
  3219. C_tle ==>
  3220. Comment0( tle );
  3221. {
  3222. reg_t a;
  3223. reg_t b;
  3224. a = pop_reg();
  3225. b= alloc_reg();
  3226. "tst $a";
  3227. "ble,a 1f";
  3228. "mov 1, $b"; /* delay slot */
  3229. "set 0, $b";
  3230. "1:";
  3231. free_reg(a);
  3232. push_reg(b);
  3233. }.
  3234. C_tge ==>
  3235. Comment0( tge );
  3236. {
  3237. reg_t a;
  3238. reg_t b;
  3239. a = pop_reg();
  3240. b = alloc_reg();
  3241. " tst $a";
  3242. " bge,a 1f";
  3243. " mov 1, $b"; /* delay slot */
  3244. " set 0, $b";
  3245. "1:";
  3246. free_reg(a);
  3247. push_reg(b);
  3248. }.
  3249. C_tgt ==>
  3250. Comment0( tgt );
  3251. {
  3252. reg_t a;
  3253. reg_t b;
  3254. a = pop_reg();
  3255. b = alloc_reg();
  3256. " tst $a";
  3257. " bg,a 1f";
  3258. " mov 1, $b"; /* delay slot */
  3259. " set 0, $b";
  3260. "1:";
  3261. free_reg(a);
  3262. push_reg(b);
  3263. }.
  3264. C_tne ==>
  3265. Comment0( tne );
  3266. {
  3267. reg_t a;
  3268. reg_t b;
  3269. a = pop_reg();
  3270. b = alloc_reg();
  3271. " tst $a";
  3272. " bne,a 1f";
  3273. " mov 1, $b"; /* delay slot */
  3274. " set 0, $b"; /* sup optimal */
  3275. "1:";
  3276. free_reg(a);
  3277. push_reg(b);
  3278. }.
  3279. C_teq ==>
  3280. Comment0( teq );
  3281. {
  3282. reg_t a;
  3283. reg_t b;
  3284. a = pop_reg();
  3285. b = alloc_reg();
  3286. " tst $a";
  3287. " be,a 1f";
  3288. " mov 1, $b"; /* delay slot */
  3289. " set 0, $b";
  3290. "1:";
  3291. free_reg(a);
  3292. push_reg(b);
  3293. }.
  3294. C_cmf ==>
  3295. Comment( cmf, $1);
  3296. push_const($1);
  3297. C_cmf_narg().
  3298. C_cmf_narg ==>
  3299. {
  3300. reg_t a;
  3301. reg_t b;
  3302. reg_t c;
  3303. int n;
  3304. Comment0( cmf_narg);
  3305. if (type_of_tos() == T_cst)
  3306. {
  3307. n= pop_const(NULL);
  3308. if (n == EM_FSIZE)
  3309. {
  3310. a= pop_float();
  3311. b= pop_float();
  3312. c= alloc_reg();
  3313. "fcmpes $b, $a";
  3314. "nop";
  3315. "fbe,a 1f";
  3316. "mov 0, $c";
  3317. "fbl,a 1f";
  3318. "mov -1, $c";
  3319. "mov 1, $c";
  3320. "1:";
  3321. free_reg(a);
  3322. free_reg(b);
  3323. push_reg(c);
  3324. }
  3325. else if (n == EM_DSIZE)
  3326. {
  3327. a= pop_double(NULL);
  3328. b= pop_double(NULL);
  3329. c= alloc_reg();
  3330. "fcmped $b, $a";
  3331. "nop";
  3332. "fbe,a 1f";
  3333. "mov 0, $c";
  3334. "fbl,a 1f";
  3335. "mov -1, $c";
  3336. "mov 1, $c";
  3337. "1:";
  3338. free_double_reg(a);
  3339. free_double_reg(b);
  3340. push_reg(c);
  3341. }
  3342. else
  3343. arg_error ("cmf", n);
  3344. }
  3345. else
  3346. not_implemented ("cmf_narg");
  3347. }.
  3348. /******************************************************************************/
  3349. /* */
  3350. /* Group 13 : Branch */
  3351. /* */
  3352. /******************************************************************************/
  3353. C_bra ==>
  3354. Comment( bra , $1 );
  3355. {
  3356. char *lbl;
  3357. flush_cache();
  3358. lbl = $1;
  3359. "b $lbl";
  3360. "nop"; /* delay slot */
  3361. }.
  3362. C_bge ==>
  3363. Comment( bge , $1 );
  3364. {
  3365. char *lbl = $1;
  3366. reg_t a;
  3367. reg_t b;
  3368. const_str_t n_str;
  3369. a= NULL;
  3370. if (type_of_tos() == T_cst &&
  3371. const13(top_const()))
  3372. pop_const(n_str);
  3373. else
  3374. a = pop_reg();
  3375. b = pop_reg();
  3376. flush_cache();
  3377. if (a)
  3378. "cmp $b, $a";
  3379. else
  3380. "cmp $b, $n_str";
  3381. "bge $lbl";
  3382. "nop" /* delay slot */
  3383. free_reg(a);
  3384. free_reg(b);
  3385. }.
  3386. C_bne ==>
  3387. Comment( bne , $1 );
  3388. {
  3389. char *lbl = $1;
  3390. reg_t a;
  3391. reg_t b;
  3392. const_str_t n_str;
  3393. a= NULL;
  3394. if (type_of_tos() == T_cst &&
  3395. const13(top_const()))
  3396. pop_const(n_str);
  3397. else
  3398. a = pop_reg();
  3399. b = pop_reg();
  3400. flush_cache();
  3401. if (a)
  3402. "cmp $b, $a";
  3403. else
  3404. "cmp $b, $n_str";
  3405. "bne $lbl";
  3406. "nop" /* delay slot */
  3407. free_reg(a);
  3408. free_reg(b);
  3409. }.
  3410. C_beq ==>
  3411. Comment( beq , $1 );
  3412. {
  3413. char *lbl = $1;
  3414. reg_t a;
  3415. reg_t b;
  3416. const_str_t n_str;
  3417. a= NULL;
  3418. if (type_of_tos() == T_cst &&
  3419. const13(top_const()))
  3420. pop_const(n_str);
  3421. else
  3422. a = pop_reg();
  3423. b = pop_reg();
  3424. flush_cache();
  3425. if (a)
  3426. "cmp $b, $a";
  3427. else
  3428. "cmp $b, $n_str";
  3429. "beq $lbl";
  3430. "nop" /* delay slot */
  3431. free_reg(a);
  3432. free_reg(b);
  3433. }.
  3434. C_ble ==>
  3435. Comment( ble , $1 );
  3436. {
  3437. char *lbl = $1;
  3438. reg_t a;
  3439. reg_t b;
  3440. const_str_t n_str;
  3441. a= NULL;
  3442. if (type_of_tos() == T_cst &&
  3443. const13(top_const()))
  3444. pop_const(n_str);
  3445. else
  3446. a = pop_reg();
  3447. b = pop_reg();
  3448. flush_cache();
  3449. if (a)
  3450. "cmp $b, $a";
  3451. else
  3452. "cmp $b, $n_str";
  3453. "ble $lbl";
  3454. "nop" /* delay slot */
  3455. free_reg(a);
  3456. free_reg(b);
  3457. }.
  3458. C_blt ==>
  3459. Comment( blt , $1 );
  3460. {
  3461. char *lbl = $1;
  3462. reg_t a;
  3463. reg_t b;
  3464. const_str_t n_str;
  3465. a= NULL;
  3466. if (type_of_tos() == T_cst &&
  3467. const13(top_const()))
  3468. pop_const(n_str);
  3469. else
  3470. a = pop_reg();
  3471. b = pop_reg();
  3472. flush_cache();
  3473. if (a)
  3474. "cmp $b, $a";
  3475. else
  3476. "cmp $b, $n_str";
  3477. "bl $lbl";
  3478. "nop" /* delay slot */
  3479. free_reg(a);
  3480. free_reg(b);
  3481. }.
  3482. C_bgt ==>
  3483. Comment( bgt , $1 );
  3484. {
  3485. char *lbl = $1;
  3486. reg_t a;
  3487. reg_t b;
  3488. const_str_t n_str;
  3489. a= NULL;
  3490. if (type_of_tos() == T_cst &&
  3491. const13(top_const()))
  3492. pop_const(n_str);
  3493. else
  3494. a = pop_reg();
  3495. b = pop_reg();
  3496. flush_cache();
  3497. if (a)
  3498. "cmp $b, $a";
  3499. else
  3500. "cmp $b, $n_str";
  3501. "bg $lbl";
  3502. "nop" /* delay slot */
  3503. free_reg(a);
  3504. free_reg(b);
  3505. }.
  3506. C_zlt ==>
  3507. Comment( zlt , $1 );
  3508. {
  3509. char *lbl = $1;
  3510. reg_t a;
  3511. a = pop_reg();
  3512. flush_cache();
  3513. "tst $a";
  3514. "bl $lbl";
  3515. "nop"; /* delay slot */
  3516. free_reg(a);
  3517. }
  3518. .
  3519. C_zle ==>
  3520. Comment( zle , $1 );
  3521. {
  3522. char *lbl = $1;
  3523. reg_t a;
  3524. a = pop_reg();
  3525. flush_cache();
  3526. "tst $a";
  3527. "ble $lbl";
  3528. "nop"; /* delay slot */
  3529. free_reg(a);
  3530. }
  3531. .
  3532. C_zeq ==>
  3533. Comment( zeq , $1 );
  3534. {
  3535. char *lbl = $1;
  3536. reg_t a;
  3537. a = pop_reg();
  3538. flush_cache();
  3539. "tst $a";
  3540. "be $lbl";
  3541. "nop"; /* delay slot */
  3542. free_reg(a);
  3543. }
  3544. .
  3545. C_zne ==>
  3546. Comment( zne , $1 );
  3547. {
  3548. char *lbl = $1;
  3549. reg_t a;
  3550. a = pop_reg();
  3551. flush_cache();
  3552. "tst $a";
  3553. "bne $lbl";
  3554. "nop"; /* delay slot */
  3555. free_reg(a);
  3556. }
  3557. .
  3558. C_zge ==>
  3559. Comment( zge , $1 );
  3560. {
  3561. char *lbl = $1;
  3562. reg_t a;
  3563. a = pop_reg();
  3564. flush_cache();
  3565. "tst $a";
  3566. "bge $lbl";
  3567. "nop"; /* delay slot */
  3568. free_reg(a);
  3569. }
  3570. .
  3571. C_zgt ==>
  3572. Comment( zgt , $1 );
  3573. {
  3574. char *lbl = $1;
  3575. reg_t a;
  3576. a = pop_reg();
  3577. flush_cache();
  3578. "tst $a";
  3579. "bg $lbl";
  3580. "nop"; /* delay slot */
  3581. free_reg(a);
  3582. }
  3583. .
  3584. /******************************************************************************/
  3585. /* */
  3586. /* Group 14 : Procedure call instructions */
  3587. /* */
  3588. /******************************************************************************/
  3589. C_cai ==>
  3590. Comment0( cai );
  3591. {
  3592. reg_t a;
  3593. a= pop_reg();
  3594. flush_cache();
  3595. "call $a";
  3596. "nop"; /* delay slot */
  3597. free_reg(a);
  3598. }.
  3599. C_cal ==>
  3600. Comment( cal , $1 );
  3601. {
  3602. char *lbl = $1;
  3603. flush_cache();
  3604. "call $lbl";
  3605. "nop"; /* delay slot */
  3606. }.
  3607. C_lfr
  3608. $1 == 4 ==>
  3609. {
  3610. Comment( lfr , $1 );
  3611. forced_alloc_reg(RETL_LD);
  3612. push_reg(RETL_LD);
  3613. }.
  3614. $1 == 8 ==>
  3615. {
  3616. Comment( lfr , $1 );
  3617. forced_alloc_reg(RETL_LD);
  3618. forced_alloc_reg(RETH_LD);
  3619. push_reg(RETH_LD);
  3620. push_reg(RETL_LD);
  3621. }.
  3622. default ==>
  3623. arg_error( "lfr", $1).
  3624. C_ret
  3625. $1 == 0 ==>
  3626. {
  3627. Comment( ret , $1 );
  3628. load_float_regs();
  3629. if (debug)
  3630. free_all_reg_vars();
  3631. "restore";
  3632. "retl";
  3633. "add %sp, $reg_gap, %sp";
  3634. if (debug)
  3635. alloc_all_reg_vars();
  3636. }.
  3637. $1 == 4 ==>
  3638. {
  3639. Comment( ret , $1 );
  3640. soft_alloc_reg(RETL_ST);
  3641. pop_reg_as(RETL_ST);
  3642. free_reg(RETL_ST);
  3643. load_float_regs();
  3644. if (debug)
  3645. free_all_reg_vars();
  3646. "restore";
  3647. "retl";
  3648. "add %sp, $reg_gap, %sp";
  3649. if (debug)
  3650. alloc_all_reg_vars();
  3651. }.
  3652. $1 == 8 ==>
  3653. {
  3654. Comment( ret , $1 );
  3655. soft_alloc_reg(RETL_ST);
  3656. soft_alloc_reg(RETH_ST);
  3657. pop_reg_as(RETL_ST);
  3658. pop_reg_as(RETH_ST);
  3659. free_reg(RETL_ST);
  3660. free_reg(RETH_ST);
  3661. load_float_regs();
  3662. if (debug)
  3663. free_all_reg_vars();
  3664. "restore";
  3665. "retl";
  3666. "add %sp, $reg_gap, %sp";
  3667. if (debug)
  3668. alloc_all_reg_vars();
  3669. }.
  3670. default ==>
  3671. arg_error( "ret", $1).
  3672. /******************************************************************************/
  3673. /* */
  3674. /* Group 15 : Miscellaneous instructions */
  3675. /* */
  3676. /******************************************************************************/
  3677. C_asp ==>
  3678. Comment( asp , $1 );
  3679. push_const($1);
  3680. C_ass(EM_WSIZE).
  3681. C_ass
  3682. $1 == 4 ==>
  3683. {
  3684. int n;
  3685. const_str_t n_str;
  3686. reg_t a;
  3687. if (type_of_tos() == T_cst)
  3688. {
  3689. n= pop_const(n_str);
  3690. if (n % EM_WSIZE)
  3691. arg_error ("asp", n);
  3692. else
  3693. if (n>=0)
  3694. pop_nop (n/4);
  3695. else
  3696. {
  3697. flush_cache();
  3698. if (const13(n))
  3699. "inc $n_str, $reg_sp";
  3700. else
  3701. {
  3702. a= alloc_reg();
  3703. "set $n_str, $a"
  3704. "add $reg_sp, $a, $reg_sp";
  3705. free_reg(a);
  3706. }
  3707. }
  3708. }
  3709. else
  3710. {
  3711. a= pop_reg();
  3712. flush_cache();
  3713. "add $reg_sp, $a, $reg_sp";
  3714. free_reg(a);
  3715. }
  3716. }.
  3717. default ==>
  3718. arg_error( "ass", $1).
  3719. narg4(ass)
  3720. C_blm ==>
  3721. Comment( blm, $1);
  3722. push_const($1);
  3723. C_bls (EM_WSIZE).
  3724. C_bls
  3725. $1 == 4 ==>
  3726. {
  3727. reg_t a;
  3728. reg_t b;
  3729. reg_t c;
  3730. reg_t d;
  3731. reg_t e;
  3732. reg_t ao_reg;
  3733. reg_t bo_reg;
  3734. int n;
  3735. int i;
  3736. const_str_t n_str;
  3737. const_str_t ac_str;
  3738. const_str_t bc_str;
  3739. Comment( bls , $1 );
  3740. if (type_of_tos() == T_cst)
  3741. {
  3742. n= pop_const(n_str);
  3743. if (n % EM_WSIZE)
  3744. arg_error ("blm", n);
  3745. else if (n <= MAX_UNROLL)
  3746. {
  3747. c= alloc_reg();
  3748. for (i=0; i<n; i += EM_WSIZE)
  3749. {
  3750. if (type_of_tos() & T_reg2) /* dest */
  3751. a= pop_reg_reg (&ao_reg);
  3752. else
  3753. {
  3754. ao_reg= NULL;
  3755. a= pop_reg_c13(ac_str);
  3756. }
  3757. if (type_of_tos() & T_reg2) /* src */
  3758. b= pop_reg_reg (&bo_reg);
  3759. else
  3760. {
  3761. bo_reg= NULL;
  3762. b= pop_reg_c13(bc_str);
  3763. }
  3764. if (bo_reg)
  3765. "ld [$b+$bo_reg], $c";
  3766. else
  3767. "ld [$b+$bc_str], $c";
  3768. if (ao_reg)
  3769. "st $c, [$a+$ao_reg]";
  3770. else
  3771. "st $c, [$a+$ac_str]";
  3772. if (bo_reg)
  3773. {
  3774. push_reg(b);
  3775. inc_tos_reg(bo_reg);
  3776. }
  3777. else if (bc_str[0] == '-' ||
  3778. isdigit(bc_str[0]))
  3779. {
  3780. push_reg(b);
  3781. inc_tos(atoi(bc_str));
  3782. }
  3783. else
  3784. {
  3785. "add $b, $bc_str, $c";
  3786. push_reg(c);
  3787. free_reg(b);
  3788. c= alloc_reg();
  3789. }
  3790. inc_tos(4);
  3791. if (ao_reg)
  3792. {
  3793. push_reg(a);
  3794. inc_tos_reg(ao_reg);
  3795. }
  3796. else if (ac_str[0] == '-' ||
  3797. isdigit(ac_str[0]))
  3798. {
  3799. push_reg(a);
  3800. inc_tos(atoi(ac_str));
  3801. }
  3802. else
  3803. {
  3804. "add $a, $ac_str, $c";
  3805. push_reg(c);
  3806. free_reg(a);
  3807. c= alloc_reg();
  3808. }
  3809. inc_tos(4);
  3810. }
  3811. pop_nop(2);
  3812. free_reg(c);
  3813. }
  3814. else
  3815. {
  3816. a= pop_reg(); /* dest */
  3817. b= pop_reg(); /* src */
  3818. c= alloc_reg();
  3819. d= alloc_reg();
  3820. e = alloc_reg();
  3821. "set $n_str-4, $c";
  3822. "set -4, $e";
  3823. "1:";
  3824. "inc 4, $e";
  3825. "ld [$b+$e], $d";
  3826. "cmp $e,$c";
  3827. "bnz 1b";
  3828. "st $d, [$a+$e]";
  3829. free_reg(a);
  3830. free_reg(b);
  3831. free_reg(c);
  3832. free_reg(d);
  3833. free_reg(e);
  3834. }
  3835. }
  3836. else
  3837. {
  3838. c= alloc_reg(); /* size */
  3839. pop_reg_as(c);
  3840. a= pop_reg(); /* dest */
  3841. b= pop_reg(); /* src */
  3842. d= alloc_reg();
  3843. e= alloc_reg();
  3844. "ba 2f";
  3845. "clr $e";
  3846. "1:";
  3847. "st $d, [$a+$e]";
  3848. "inc 4, $e";
  3849. "2:";
  3850. "cmp $e, $c"
  3851. "bnz 1b";
  3852. "ld [$b+$e], $d";
  3853. free_reg(a);
  3854. free_reg(b);
  3855. free_reg(c);
  3856. free_reg(d);
  3857. free_reg(e);
  3858. }
  3859. }.
  3860. default ==>
  3861. arg_error( "bls", $1).
  3862. narg4(bls)
  3863. C_csa
  3864. $1 == 4 ==>
  3865. Comment( csa , $1 );
  3866. {
  3867. force_alloc_output();
  3868. pop_reg_as(reg_o0);
  3869. pop_reg_as(reg_o1);
  3870. flush_cache();
  3871. free_output();
  3872. "set csa, $reg_tmp";
  3873. "jmp $reg_tmp";
  3874. "nop";
  3875. }.
  3876. default ==>
  3877. arg_error( "csa", $1).
  3878. narg4(csa)
  3879. C_csb
  3880. $1 == 4 ==>
  3881. Comment( csb , $1 );
  3882. {
  3883. force_alloc_output();
  3884. pop_reg_as(reg_o0);
  3885. pop_reg_as(reg_o1);
  3886. flush_cache();
  3887. free_output();
  3888. "set csb, $reg_tmp";
  3889. "jmp $reg_tmp";
  3890. "nop";
  3891. }.
  3892. default ==>
  3893. arg_error( "csb", $1).
  3894. narg4(csb)
  3895. C_dch ==>
  3896. {
  3897. reg_t a;
  3898. reg_t b;
  3899. reg_t c;
  3900. Comment0( dch );
  3901. a= pop_reg(); /* some LB */
  3902. b= alloc_reg();
  3903. c= alloc_reg();
  3904. "ta 3"; /* flush register windows */
  3905. "add $a, 7, $b";
  3906. "andn $b, 7, $c"; /* and it's %fp */
  3907. "ld [$c+4], $b"; /* the previous LB */
  3908. free_reg(a);
  3909. push_reg(b);
  3910. free_reg(c);
  3911. }.
  3912. C_dup ==>
  3913. Comment( dup, $1);
  3914. push_const($1);
  3915. C_dus(EM_WSIZE).
  3916. C_dus
  3917. $1 == 4 ==>
  3918. {
  3919. int n;
  3920. int i;
  3921. const_str_t n_str;
  3922. const_str_t i_str;
  3923. reg_t a;
  3924. reg_t b;
  3925. reg_t c;
  3926. Comment( dus, $1);
  3927. if (type_of_tos() == T_cst && top_const() <= MAX_UNROLL)
  3928. {
  3929. n= pop_const(n_str);
  3930. if (n == 4 || n == 8 || n<=32)
  3931. dup_tos(n/4);
  3932. else if (n<0 || n % 4)
  3933. arg_error ("dup", n);
  3934. else
  3935. {
  3936. flush_cache();
  3937. a= alloc_reg();
  3938. "sub $reg_sp, $n_str, $reg_sp";
  3939. for (i=0; i<n; i += 4)
  3940. {
  3941. sprint(i_str, "%d", i);
  3942. "ld [$reg_sp+$i_str+$n_str], $a";
  3943. "st $a, [$reg_sp+$i_str]";
  3944. }
  3945. free_reg(a);
  3946. }
  3947. }
  3948. else
  3949. {
  3950. a= pop_reg();
  3951. flush_cache();
  3952. b= alloc_reg();
  3953. c= alloc_reg();
  3954. "mov $a, $b";
  3955. "1:";
  3956. "dec STACK_CLICK, $reg_sp";
  3957. "ld [$reg_sp+ $a], $c";
  3958. "deccc 4, $b";
  3959. "bne 1b";
  3960. "st $c, [$reg_sp+ $a]"; /* delay slot */
  3961. free_reg(a);
  3962. free_reg(b);
  3963. free_reg(c);
  3964. }
  3965. }.
  3966. default ==>
  3967. arg_error( "dus", $1).
  3968. narg4(dus)
  3969. C_exg ==>
  3970. Comment( exg, $1 );
  3971. push_const($1);
  3972. C_exg_narg().
  3973. C_exg_narg ==>
  3974. {
  3975. reg_t a;
  3976. reg_t b;
  3977. reg_t c;
  3978. reg_t d;
  3979. int n;
  3980. int i;
  3981. const_str_t i_str;
  3982. const_str_t in_str;
  3983. Comment0( exg_narg );
  3984. if (type_of_tos() == T_cst && top_const() <= MAX_UNROLL)
  3985. {
  3986. n= pop_const(NULL);
  3987. if (n==4)
  3988. {
  3989. a= pop_reg();
  3990. b= pop_reg();
  3991. push_reg(a);
  3992. push_reg(b);
  3993. }
  3994. else if (n==8)
  3995. {
  3996. a= pop_reg();
  3997. b= pop_reg();
  3998. c= pop_reg();
  3999. d= pop_reg();
  4000. push_reg(b);
  4001. push_reg(a);
  4002. push_reg(d);
  4003. push_reg(c);
  4004. }
  4005. else if (n>0 && !(n % 4))
  4006. {
  4007. a= alloc_reg();
  4008. b= alloc_reg();
  4009. flush_cache();
  4010. for (i=0; i<n; i += 4)
  4011. {
  4012. sprint(i_str, "%d", i);
  4013. sprint(in_str, "%d", i+n);
  4014. "ld [$reg_sp+$i_str], $a";
  4015. "ld [$reg_sp+$in_str], $b";
  4016. "st $b, [$reg_sp+$i_str]";
  4017. "st $a, [$reg_sp+$in_str]";
  4018. }
  4019. free_reg(a);
  4020. free_reg(b);
  4021. }
  4022. else
  4023. arg_error ("exg", n);
  4024. }
  4025. else
  4026. {
  4027. a= pop_reg();
  4028. flush_cache();
  4029. b= alloc_reg();
  4030. c= alloc_reg();
  4031. d= alloc_reg();
  4032. "add $reg_sp, $a, $b";
  4033. "1:";
  4034. "dec 4, $b";
  4035. "cmp $reg_sp, $b";
  4036. "ld [$b], $c";
  4037. "ld [$b+$a], $d";
  4038. "st $d, [$b]";
  4039. "bne 1b";
  4040. "st $c, [$b+$a]"; /* delay slot */
  4041. free_reg(a);
  4042. free_reg(b);
  4043. free_reg(c);
  4044. free_reg(d);
  4045. }
  4046. }.
  4047. C_fil.. ==>
  4048. Comment2( fil , $1 , $2);
  4049. #ifdef FAST_LIN_LNI_FIL
  4050. {
  4051. char *lbl = $1;
  4052. int n = $2;
  4053. "set $lbl+$n, $reg_fil"
  4054. }.
  4055. #else
  4056. push_ext($1);
  4057. inc_tos($2);
  4058. push_ext("filn");
  4059. push_const(4);
  4060. C_sts(EM_WSIZE).
  4061. #endif
  4062. C_gto.. ==>
  4063. {
  4064. char *ext;
  4065. reg_t a;
  4066. reg_t b;
  4067. reg_t c;
  4068. reg_t d;
  4069. Comment2( gto , $1 , $2 );
  4070. flush_cache();
  4071. a= reg_g1;
  4072. b= reg_g2;
  4073. c= reg_g3;
  4074. d= reg_g5;
  4075. forced_alloc_reg(a);
  4076. forced_alloc_reg(b);
  4077. forced_alloc_reg(c);
  4078. forced_alloc_reg(d);
  4079. ext= $1;
  4080. push_ext(ext);
  4081. inc_tos($2);
  4082. pop_reg_as(a);
  4083. "ld [$a+8], $b";
  4084. "mov $reg_o0, $c";
  4085. "mov $reg_o1, $d";
  4086. "1:";
  4087. "cmp $b, $reg_lb";
  4088. "bne,a 1b";
  4089. "restore";
  4090. "ld [$a+4], $reg_sp";
  4091. "ld [$a], $b";
  4092. "mov $c, $reg_o0";
  4093. "jmp $b";
  4094. "mov $d, $reg_o1"; /* delay slot */
  4095. free_reg(a);
  4096. free_reg(b);
  4097. free_reg(c);
  4098. free_reg(d);
  4099. }.
  4100. C_lim ==>
  4101. Comment0( lim );
  4102. push_ext("trpim");
  4103. C_loi(4).
  4104. C_lin ==>
  4105. Comment( lin , $1 );
  4106. #ifdef FAST_LIN_LNI_FIL
  4107. {
  4108. const_str_t n_str;
  4109. sprint(n_str, "%d", $1);
  4110. "set $n_str, $reg_fil";
  4111. }.
  4112. #else
  4113. push_const($1);
  4114. push_ext("lino");
  4115. push_const(4);
  4116. C_sts(EM_WSIZE).
  4117. #endif
  4118. C_lni ==>
  4119. #ifdef FAST_LIN_LNI_FIL
  4120. Comment0( lni );
  4121. "inc $reg_fil".
  4122. #else
  4123. {
  4124. reg_t a;
  4125. reg_t b;
  4126. Comment0( lni );
  4127. a = alloc_reg();
  4128. b = alloc_reg();
  4129. "sethi %hi(lino), $a";
  4130. "ld [$a+%lo(lino)], $b";
  4131. "inc $b";
  4132. "st $b, [$a+%lo(lino)]"
  4133. free_reg(a);
  4134. free_reg(b);
  4135. }.
  4136. #endif
  4137. C_lor
  4138. $1 == 0 ==>
  4139. Comment( lor , $1 );
  4140. soft_alloc_reg(reg_lb);
  4141. push_reg(reg_lb).
  4142. $1 == 1 ==>
  4143. {
  4144. reg_t a;
  4145. Comment( lor , $1 );
  4146. a= alloc_reg();
  4147. flush_cache();
  4148. "mov $reg_sp, $a";
  4149. push_reg(a);
  4150. }.
  4151. $1 == 2 ==>
  4152. Comment( lor , $1 );
  4153. {
  4154. reg_t a;
  4155. reg_t b;
  4156. a= alloc_reg();
  4157. b= alloc_reg();
  4158. "set reghp, $a";
  4159. "ld [$a], $b";
  4160. push_reg(b);
  4161. free_reg(a);
  4162. }.
  4163. default ==>
  4164. arg_error( "lor", $1).
  4165. C_lpb ==>
  4166. Comment0( lpb );
  4167. C_adp( (arith)EM_BSIZE).
  4168. C_mon ==>
  4169. Comment0( mon );
  4170. force_alloc_output();
  4171. pop_reg_as(reg_o0);
  4172. "call mon";
  4173. "nop";
  4174. free_output().
  4175. C_nop ==>
  4176. Comment0( nop );
  4177. flush_cache();
  4178. .
  4179. C_rck
  4180. $1 == 4 ==>
  4181. {
  4182. reg_t a;
  4183. reg_t b;
  4184. reg_t c;
  4185. Comment( rck , $1 );
  4186. force_alloc_output();
  4187. a= pop_reg();
  4188. b= pop_reg();
  4189. soft_alloc_reg(b);
  4190. push_reg(b);
  4191. c= alloc_reg();
  4192. "ld [$a], $c";
  4193. "cmp $b, $c";
  4194. "bl 1f";
  4195. "ld [$a+4], $c";
  4196. "cmp $b, $c";
  4197. "ble 2f";
  4198. "nop";
  4199. "1:";
  4200. "set ERANGE, $reg_o0";
  4201. "call trp";
  4202. "nop";
  4203. "2:";
  4204. free_reg(a);
  4205. free_reg(b);
  4206. free_reg(c);
  4207. free_output();
  4208. }.
  4209. default ==>
  4210. arg_error( "rck", $1).
  4211. narg4(rck)
  4212. C_rtt ==>
  4213. Comment0( rtt );
  4214. C_ret( (arith)0).
  4215. C_sig ==>
  4216. Comment0( sig );
  4217. {
  4218. reg_t a;
  4219. reg_t b;
  4220. reg_t c;
  4221. a= pop_reg();
  4222. b= alloc_reg();
  4223. c= alloc_reg();
  4224. "set trppc, $b";
  4225. "ld [$b], $c";
  4226. "st $a, [$b]";
  4227. free_reg(a);
  4228. free_reg(b);
  4229. push_reg(c);
  4230. }.
  4231. C_sim ==>
  4232. Comment0( sim );
  4233. {
  4234. reg_t a;
  4235. reg_t b;
  4236. a= pop_reg();
  4237. b= alloc_reg();
  4238. "set trpim, $b";
  4239. "st $a, [$b]";
  4240. free_reg(a);
  4241. free_reg(b);
  4242. }.
  4243. C_str
  4244. $1 == 0 ==>
  4245. Comment( str , $1 );
  4246. flush_cache();
  4247. "ld [$reg_sp], $reg_lb";
  4248. "add $reg_lb, 4, %fp";
  4249. "and %fp, -8, %fp";
  4250. "inc STACK_CLICK, $reg_sp"
  4251. .
  4252. $1 == 1 ==>
  4253. {
  4254. Comment( str , $1 );
  4255. flush_cache();
  4256. "ld [$reg_sp], $reg_sp";
  4257. }.
  4258. $1 == 2 ==>
  4259. {
  4260. Comment( str , $1 );
  4261. force_alloc_output();
  4262. pop_reg_as(reg_o0);
  4263. "call strhp";
  4264. "nop";
  4265. free_output();
  4266. }.
  4267. default ==>
  4268. arg_error( "str", $1).
  4269. C_trp ==>
  4270. Comment0( trp );
  4271. force_alloc_output();
  4272. pop_reg_as(reg_o0);
  4273. flush_cache();
  4274. "call trp";
  4275. "nop";
  4276. free_output().
  4277. /*****************************************************************************/
  4278. ..icon
  4279. $2 == 1 ==>
  4280. Comment( ..icon , $1 );
  4281. gen1( (ONE_BYTE) atoi( $1)).
  4282. $2 == 2 ==>
  4283. Comment( ..icon , $1 );
  4284. gen2( (TWO_BYTES) atoi( $1)).
  4285. $2 == 4 ==>
  4286. Comment( ..icon , $1 );
  4287. gen4( (FOUR_BYTES) atol( $1)).
  4288. default ==>
  4289. arg_error( "icon", $2).
  4290. ..ucon
  4291. $2 == 1 ==>
  4292. Comment( ..ucon , $1 );
  4293. gen1( (ONE_BYTE) atoi( $1)).
  4294. $2 == 2 ==>
  4295. Comment( ..ucon , $1 );
  4296. gen2( (TWO_BYTES) atoi( $1)).
  4297. $2 == 4 ==>
  4298. Comment( ..ucon , $1 );
  4299. gen4( (FOUR_BYTES) atol( $1)).
  4300. default ==>
  4301. arg_error( "icon", $2).
  4302. ..fcon ==>
  4303. Comment( ..fcon , $1 );
  4304. con_float($1, $2).
  4305. /*****************************************************************************/
  4306. C_prolog ==>
  4307. Comment0( prolog );
  4308. init_cache();
  4309. "sub $reg_sp, (EM_BSIZE-4), %g1";
  4310. "and %g1, -8, %sp";
  4311. "mov $reg_sp, %g1";
  4312. "save %sp, $reg_gap, %sp";
  4313. "st %g0, [%sp+BP_OFFSET]";
  4314. "sub %g1, EM_BSIZE, $reg_lb";
  4315. init_reg_man();
  4316. forced_alloc_reg(reg_sp);
  4317. forced_alloc_reg(reg_lb);
  4318. forced_alloc_reg(reg_gap);
  4319. #ifdef FAST_LIN_LNI_FIL
  4320. reg_lin = alloc_reg();
  4321. reg_fil = alloc_reg();
  4322. #endif
  4323. .
  4324. C_jump ==>
  4325. {
  4326. char *l;
  4327. Comment( jump , $1 );
  4328. l= $1;
  4329. "b $l";
  4330. "nop"; /* delay slot */
  4331. }.
  4332. C_locals ==>
  4333. {
  4334. Comment( locals , $1 );
  4335. soft_alloc_reg(reg_lb);
  4336. push_reg(reg_lb);
  4337. inc_tos(-($1));
  4338. pop_reg_as(reg_sp);
  4339. }.