tm.texi.in 328 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225
  1. @c Copyright (C) 1988-2015 Free Software Foundation, Inc.
  2. @c This is part of the GCC manual.
  3. @c For copying conditions, see the file gcc.texi.
  4. @node Target Macros
  5. @chapter Target Description Macros and Functions
  6. @cindex machine description macros
  7. @cindex target description macros
  8. @cindex macros, target description
  9. @cindex @file{tm.h} macros
  10. In addition to the file @file{@var{machine}.md}, a machine description
  11. includes a C header file conventionally given the name
  12. @file{@var{machine}.h} and a C source file named @file{@var{machine}.c}.
  13. The header file defines numerous macros that convey the information
  14. about the target machine that does not fit into the scheme of the
  15. @file{.md} file. The file @file{tm.h} should be a link to
  16. @file{@var{machine}.h}. The header file @file{config.h} includes
  17. @file{tm.h} and most compiler source files include @file{config.h}. The
  18. source file defines a variable @code{targetm}, which is a structure
  19. containing pointers to functions and data relating to the target
  20. machine. @file{@var{machine}.c} should also contain their definitions,
  21. if they are not defined elsewhere in GCC, and other functions called
  22. through the macros defined in the @file{.h} file.
  23. @menu
  24. * Target Structure:: The @code{targetm} variable.
  25. * Driver:: Controlling how the driver runs the compilation passes.
  26. * Run-time Target:: Defining @samp{-m} options like @option{-m68000} and @option{-m68020}.
  27. * Per-Function Data:: Defining data structures for per-function information.
  28. * Storage Layout:: Defining sizes and alignments of data.
  29. * Type Layout:: Defining sizes and properties of basic user data types.
  30. * Registers:: Naming and describing the hardware registers.
  31. * Register Classes:: Defining the classes of hardware registers.
  32. * Stack and Calling:: Defining which way the stack grows and by how much.
  33. * Varargs:: Defining the varargs macros.
  34. * Trampolines:: Code set up at run time to enter a nested function.
  35. * Library Calls:: Controlling how library routines are implicitly called.
  36. * Addressing Modes:: Defining addressing modes valid for memory operands.
  37. * Anchored Addresses:: Defining how @option{-fsection-anchors} should work.
  38. * Condition Code:: Defining how insns update the condition code.
  39. * Costs:: Defining relative costs of different operations.
  40. * Scheduling:: Adjusting the behavior of the instruction scheduler.
  41. * Sections:: Dividing storage into text, data, and other sections.
  42. * PIC:: Macros for position independent code.
  43. * Assembler Format:: Defining how to write insns and pseudo-ops to output.
  44. * Debugging Info:: Defining the format of debugging output.
  45. * Floating Point:: Handling floating point for cross-compilers.
  46. * Mode Switching:: Insertion of mode-switching instructions.
  47. * Target Attributes:: Defining target-specific uses of @code{__attribute__}.
  48. * Emulated TLS:: Emulated TLS support.
  49. * MIPS Coprocessors:: MIPS coprocessor support and how to customize it.
  50. * PCH Target:: Validity checking for precompiled headers.
  51. * C++ ABI:: Controlling C++ ABI changes.
  52. * Named Address Spaces:: Adding support for named address spaces
  53. * Misc:: Everything else.
  54. @end menu
  55. @node Target Structure
  56. @section The Global @code{targetm} Variable
  57. @cindex target hooks
  58. @cindex target functions
  59. @deftypevar {struct gcc_target} targetm
  60. The target @file{.c} file must define the global @code{targetm} variable
  61. which contains pointers to functions and data relating to the target
  62. machine. The variable is declared in @file{target.h};
  63. @file{target-def.h} defines the macro @code{TARGET_INITIALIZER} which is
  64. used to initialize the variable, and macros for the default initializers
  65. for elements of the structure. The @file{.c} file should override those
  66. macros for which the default definition is inappropriate. For example:
  67. @smallexample
  68. #include "target.h"
  69. #include "target-def.h"
  70. /* @r{Initialize the GCC target structure.} */
  71. #undef TARGET_COMP_TYPE_ATTRIBUTES
  72. #define TARGET_COMP_TYPE_ATTRIBUTES @var{machine}_comp_type_attributes
  73. struct gcc_target targetm = TARGET_INITIALIZER;
  74. @end smallexample
  75. @end deftypevar
  76. Where a macro should be defined in the @file{.c} file in this manner to
  77. form part of the @code{targetm} structure, it is documented below as a
  78. ``Target Hook'' with a prototype. Many macros will change in future
  79. from being defined in the @file{.h} file to being part of the
  80. @code{targetm} structure.
  81. Similarly, there is a @code{targetcm} variable for hooks that are
  82. specific to front ends for C-family languages, documented as ``C
  83. Target Hook''. This is declared in @file{c-family/c-target.h}, the
  84. initializer @code{TARGETCM_INITIALIZER} in
  85. @file{c-family/c-target-def.h}. If targets initialize @code{targetcm}
  86. themselves, they should set @code{target_has_targetcm=yes} in
  87. @file{config.gcc}; otherwise a default definition is used.
  88. Similarly, there is a @code{targetm_common} variable for hooks that
  89. are shared between the compiler driver and the compilers proper,
  90. documented as ``Common Target Hook''. This is declared in
  91. @file{common/common-target.h}, the initializer
  92. @code{TARGETM_COMMON_INITIALIZER} in
  93. @file{common/common-target-def.h}. If targets initialize
  94. @code{targetm_common} themselves, they should set
  95. @code{target_has_targetm_common=yes} in @file{config.gcc}; otherwise a
  96. default definition is used.
  97. @node Driver
  98. @section Controlling the Compilation Driver, @file{gcc}
  99. @cindex driver
  100. @cindex controlling the compilation driver
  101. @c prevent bad page break with this line
  102. You can control the compilation driver.
  103. @defmac DRIVER_SELF_SPECS
  104. A list of specs for the driver itself. It should be a suitable
  105. initializer for an array of strings, with no surrounding braces.
  106. The driver applies these specs to its own command line between loading
  107. default @file{specs} files (but not command-line specified ones) and
  108. choosing the multilib directory or running any subcommands. It
  109. applies them in the order given, so each spec can depend on the
  110. options added by earlier ones. It is also possible to remove options
  111. using @samp{%<@var{option}} in the usual way.
  112. This macro can be useful when a port has several interdependent target
  113. options. It provides a way of standardizing the command line so
  114. that the other specs are easier to write.
  115. Do not define this macro if it does not need to do anything.
  116. @end defmac
  117. @defmac OPTION_DEFAULT_SPECS
  118. A list of specs used to support configure-time default options (i.e.@:
  119. @option{--with} options) in the driver. It should be a suitable initializer
  120. for an array of structures, each containing two strings, without the
  121. outermost pair of surrounding braces.
  122. The first item in the pair is the name of the default. This must match
  123. the code in @file{config.gcc} for the target. The second item is a spec
  124. to apply if a default with this name was specified. The string
  125. @samp{%(VALUE)} in the spec will be replaced by the value of the default
  126. everywhere it occurs.
  127. The driver will apply these specs to its own command line between loading
  128. default @file{specs} files and processing @code{DRIVER_SELF_SPECS}, using
  129. the same mechanism as @code{DRIVER_SELF_SPECS}.
  130. Do not define this macro if it does not need to do anything.
  131. @end defmac
  132. @defmac CPP_SPEC
  133. A C string constant that tells the GCC driver program options to
  134. pass to CPP@. It can also specify how to translate options you
  135. give to GCC into options for GCC to pass to the CPP@.
  136. Do not define this macro if it does not need to do anything.
  137. @end defmac
  138. @defmac CPLUSPLUS_CPP_SPEC
  139. This macro is just like @code{CPP_SPEC}, but is used for C++, rather
  140. than C@. If you do not define this macro, then the value of
  141. @code{CPP_SPEC} (if any) will be used instead.
  142. @end defmac
  143. @defmac CC1_SPEC
  144. A C string constant that tells the GCC driver program options to
  145. pass to @code{cc1}, @code{cc1plus}, @code{f771}, and the other language
  146. front ends.
  147. It can also specify how to translate options you give to GCC into options
  148. for GCC to pass to front ends.
  149. Do not define this macro if it does not need to do anything.
  150. @end defmac
  151. @defmac CC1PLUS_SPEC
  152. A C string constant that tells the GCC driver program options to
  153. pass to @code{cc1plus}. It can also specify how to translate options you
  154. give to GCC into options for GCC to pass to the @code{cc1plus}.
  155. Do not define this macro if it does not need to do anything.
  156. Note that everything defined in CC1_SPEC is already passed to
  157. @code{cc1plus} so there is no need to duplicate the contents of
  158. CC1_SPEC in CC1PLUS_SPEC@.
  159. @end defmac
  160. @defmac ASM_SPEC
  161. A C string constant that tells the GCC driver program options to
  162. pass to the assembler. It can also specify how to translate options
  163. you give to GCC into options for GCC to pass to the assembler.
  164. See the file @file{sun3.h} for an example of this.
  165. Do not define this macro if it does not need to do anything.
  166. @end defmac
  167. @defmac ASM_FINAL_SPEC
  168. A C string constant that tells the GCC driver program how to
  169. run any programs which cleanup after the normal assembler.
  170. Normally, this is not needed. See the file @file{mips.h} for
  171. an example of this.
  172. Do not define this macro if it does not need to do anything.
  173. @end defmac
  174. @defmac AS_NEEDS_DASH_FOR_PIPED_INPUT
  175. Define this macro, with no value, if the driver should give the assembler
  176. an argument consisting of a single dash, @option{-}, to instruct it to
  177. read from its standard input (which will be a pipe connected to the
  178. output of the compiler proper). This argument is given after any
  179. @option{-o} option specifying the name of the output file.
  180. If you do not define this macro, the assembler is assumed to read its
  181. standard input if given no non-option arguments. If your assembler
  182. cannot read standard input at all, use a @samp{%@{pipe:%e@}} construct;
  183. see @file{mips.h} for instance.
  184. @end defmac
  185. @defmac LINK_SPEC
  186. A C string constant that tells the GCC driver program options to
  187. pass to the linker. It can also specify how to translate options you
  188. give to GCC into options for GCC to pass to the linker.
  189. Do not define this macro if it does not need to do anything.
  190. @end defmac
  191. @defmac LIB_SPEC
  192. Another C string constant used much like @code{LINK_SPEC}. The difference
  193. between the two is that @code{LIB_SPEC} is used at the end of the
  194. command given to the linker.
  195. If this macro is not defined, a default is provided that
  196. loads the standard C library from the usual place. See @file{gcc.c}.
  197. @end defmac
  198. @defmac LIBGCC_SPEC
  199. Another C string constant that tells the GCC driver program
  200. how and when to place a reference to @file{libgcc.a} into the
  201. linker command line. This constant is placed both before and after
  202. the value of @code{LIB_SPEC}.
  203. If this macro is not defined, the GCC driver provides a default that
  204. passes the string @option{-lgcc} to the linker.
  205. @end defmac
  206. @defmac REAL_LIBGCC_SPEC
  207. By default, if @code{ENABLE_SHARED_LIBGCC} is defined, the
  208. @code{LIBGCC_SPEC} is not directly used by the driver program but is
  209. instead modified to refer to different versions of @file{libgcc.a}
  210. depending on the values of the command line flags @option{-static},
  211. @option{-shared}, @option{-static-libgcc}, and @option{-shared-libgcc}. On
  212. targets where these modifications are inappropriate, define
  213. @code{REAL_LIBGCC_SPEC} instead. @code{REAL_LIBGCC_SPEC} tells the
  214. driver how to place a reference to @file{libgcc} on the link command
  215. line, but, unlike @code{LIBGCC_SPEC}, it is used unmodified.
  216. @end defmac
  217. @defmac USE_LD_AS_NEEDED
  218. A macro that controls the modifications to @code{LIBGCC_SPEC}
  219. mentioned in @code{REAL_LIBGCC_SPEC}. If nonzero, a spec will be
  220. generated that uses @option{--as-needed} or equivalent options and the
  221. shared @file{libgcc} in place of the
  222. static exception handler library, when linking without any of
  223. @code{-static}, @code{-static-libgcc}, or @code{-shared-libgcc}.
  224. @end defmac
  225. @defmac LINK_EH_SPEC
  226. If defined, this C string constant is added to @code{LINK_SPEC}.
  227. When @code{USE_LD_AS_NEEDED} is zero or undefined, it also affects
  228. the modifications to @code{LIBGCC_SPEC} mentioned in
  229. @code{REAL_LIBGCC_SPEC}.
  230. @end defmac
  231. @defmac STARTFILE_SPEC
  232. Another C string constant used much like @code{LINK_SPEC}. The
  233. difference between the two is that @code{STARTFILE_SPEC} is used at
  234. the very beginning of the command given to the linker.
  235. If this macro is not defined, a default is provided that loads the
  236. standard C startup file from the usual place. See @file{gcc.c}.
  237. @end defmac
  238. @defmac ENDFILE_SPEC
  239. Another C string constant used much like @code{LINK_SPEC}. The
  240. difference between the two is that @code{ENDFILE_SPEC} is used at
  241. the very end of the command given to the linker.
  242. Do not define this macro if it does not need to do anything.
  243. @end defmac
  244. @defmac THREAD_MODEL_SPEC
  245. GCC @code{-v} will print the thread model GCC was configured to use.
  246. However, this doesn't work on platforms that are multilibbed on thread
  247. models, such as AIX 4.3. On such platforms, define
  248. @code{THREAD_MODEL_SPEC} such that it evaluates to a string without
  249. blanks that names one of the recognized thread models. @code{%*}, the
  250. default value of this macro, will expand to the value of
  251. @code{thread_file} set in @file{config.gcc}.
  252. @end defmac
  253. @defmac SYSROOT_SUFFIX_SPEC
  254. Define this macro to add a suffix to the target sysroot when GCC is
  255. configured with a sysroot. This will cause GCC to search for usr/lib,
  256. et al, within sysroot+suffix.
  257. @end defmac
  258. @defmac SYSROOT_HEADERS_SUFFIX_SPEC
  259. Define this macro to add a headers_suffix to the target sysroot when
  260. GCC is configured with a sysroot. This will cause GCC to pass the
  261. updated sysroot+headers_suffix to CPP, causing it to search for
  262. usr/include, et al, within sysroot+headers_suffix.
  263. @end defmac
  264. @defmac EXTRA_SPECS
  265. Define this macro to provide additional specifications to put in the
  266. @file{specs} file that can be used in various specifications like
  267. @code{CC1_SPEC}.
  268. The definition should be an initializer for an array of structures,
  269. containing a string constant, that defines the specification name, and a
  270. string constant that provides the specification.
  271. Do not define this macro if it does not need to do anything.
  272. @code{EXTRA_SPECS} is useful when an architecture contains several
  273. related targets, which have various @code{@dots{}_SPECS} which are similar
  274. to each other, and the maintainer would like one central place to keep
  275. these definitions.
  276. For example, the PowerPC System V.4 targets use @code{EXTRA_SPECS} to
  277. define either @code{_CALL_SYSV} when the System V calling sequence is
  278. used or @code{_CALL_AIX} when the older AIX-based calling sequence is
  279. used.
  280. The @file{config/rs6000/rs6000.h} target file defines:
  281. @smallexample
  282. #define EXTRA_SPECS \
  283. @{ "cpp_sysv_default", CPP_SYSV_DEFAULT @},
  284. #define CPP_SYS_DEFAULT ""
  285. @end smallexample
  286. The @file{config/rs6000/sysv.h} target file defines:
  287. @smallexample
  288. #undef CPP_SPEC
  289. #define CPP_SPEC \
  290. "%@{posix: -D_POSIX_SOURCE @} \
  291. %@{mcall-sysv: -D_CALL_SYSV @} \
  292. %@{!mcall-sysv: %(cpp_sysv_default) @} \
  293. %@{msoft-float: -D_SOFT_FLOAT@} %@{mcpu=403: -D_SOFT_FLOAT@}"
  294. #undef CPP_SYSV_DEFAULT
  295. #define CPP_SYSV_DEFAULT "-D_CALL_SYSV"
  296. @end smallexample
  297. while the @file{config/rs6000/eabiaix.h} target file defines
  298. @code{CPP_SYSV_DEFAULT} as:
  299. @smallexample
  300. #undef CPP_SYSV_DEFAULT
  301. #define CPP_SYSV_DEFAULT "-D_CALL_AIX"
  302. @end smallexample
  303. @end defmac
  304. @defmac LINK_LIBGCC_SPECIAL_1
  305. Define this macro if the driver program should find the library
  306. @file{libgcc.a}. If you do not define this macro, the driver program will pass
  307. the argument @option{-lgcc} to tell the linker to do the search.
  308. @end defmac
  309. @defmac LINK_GCC_C_SEQUENCE_SPEC
  310. The sequence in which libgcc and libc are specified to the linker.
  311. By default this is @code{%G %L %G}.
  312. @end defmac
  313. @defmac LINK_COMMAND_SPEC
  314. A C string constant giving the complete command line need to execute the
  315. linker. When you do this, you will need to update your port each time a
  316. change is made to the link command line within @file{gcc.c}. Therefore,
  317. define this macro only if you need to completely redefine the command
  318. line for invoking the linker and there is no other way to accomplish
  319. the effect you need. Overriding this macro may be avoidable by overriding
  320. @code{LINK_GCC_C_SEQUENCE_SPEC} instead.
  321. @end defmac
  322. @hook TARGET_ALWAYS_STRIP_DOTDOT
  323. @defmac MULTILIB_DEFAULTS
  324. Define this macro as a C expression for the initializer of an array of
  325. string to tell the driver program which options are defaults for this
  326. target and thus do not need to be handled specially when using
  327. @code{MULTILIB_OPTIONS}.
  328. Do not define this macro if @code{MULTILIB_OPTIONS} is not defined in
  329. the target makefile fragment or if none of the options listed in
  330. @code{MULTILIB_OPTIONS} are set by default.
  331. @xref{Target Fragment}.
  332. @end defmac
  333. @defmac RELATIVE_PREFIX_NOT_LINKDIR
  334. Define this macro to tell @command{gcc} that it should only translate
  335. a @option{-B} prefix into a @option{-L} linker option if the prefix
  336. indicates an absolute file name.
  337. @end defmac
  338. @defmac MD_EXEC_PREFIX
  339. If defined, this macro is an additional prefix to try after
  340. @code{STANDARD_EXEC_PREFIX}. @code{MD_EXEC_PREFIX} is not searched
  341. when the compiler is built as a cross
  342. compiler. If you define @code{MD_EXEC_PREFIX}, then be sure to add it
  343. to the list of directories used to find the assembler in @file{configure.in}.
  344. @end defmac
  345. @defmac STANDARD_STARTFILE_PREFIX
  346. Define this macro as a C string constant if you wish to override the
  347. standard choice of @code{libdir} as the default prefix to
  348. try when searching for startup files such as @file{crt0.o}.
  349. @code{STANDARD_STARTFILE_PREFIX} is not searched when the compiler
  350. is built as a cross compiler.
  351. @end defmac
  352. @defmac STANDARD_STARTFILE_PREFIX_1
  353. Define this macro as a C string constant if you wish to override the
  354. standard choice of @code{/lib} as a prefix to try after the default prefix
  355. when searching for startup files such as @file{crt0.o}.
  356. @code{STANDARD_STARTFILE_PREFIX_1} is not searched when the compiler
  357. is built as a cross compiler.
  358. @end defmac
  359. @defmac STANDARD_STARTFILE_PREFIX_2
  360. Define this macro as a C string constant if you wish to override the
  361. standard choice of @code{/lib} as yet another prefix to try after the
  362. default prefix when searching for startup files such as @file{crt0.o}.
  363. @code{STANDARD_STARTFILE_PREFIX_2} is not searched when the compiler
  364. is built as a cross compiler.
  365. @end defmac
  366. @defmac MD_STARTFILE_PREFIX
  367. If defined, this macro supplies an additional prefix to try after the
  368. standard prefixes. @code{MD_EXEC_PREFIX} is not searched when the
  369. compiler is built as a cross compiler.
  370. @end defmac
  371. @defmac MD_STARTFILE_PREFIX_1
  372. If defined, this macro supplies yet another prefix to try after the
  373. standard prefixes. It is not searched when the compiler is built as a
  374. cross compiler.
  375. @end defmac
  376. @defmac INIT_ENVIRONMENT
  377. Define this macro as a C string constant if you wish to set environment
  378. variables for programs called by the driver, such as the assembler and
  379. loader. The driver passes the value of this macro to @code{putenv} to
  380. initialize the necessary environment variables.
  381. @end defmac
  382. @defmac LOCAL_INCLUDE_DIR
  383. Define this macro as a C string constant if you wish to override the
  384. standard choice of @file{/usr/local/include} as the default prefix to
  385. try when searching for local header files. @code{LOCAL_INCLUDE_DIR}
  386. comes before @code{NATIVE_SYSTEM_HEADER_DIR} (set in
  387. @file{config.gcc}, normally @file{/usr/include}) in the search order.
  388. Cross compilers do not search either @file{/usr/local/include} or its
  389. replacement.
  390. @end defmac
  391. @defmac NATIVE_SYSTEM_HEADER_COMPONENT
  392. The ``component'' corresponding to @code{NATIVE_SYSTEM_HEADER_DIR}.
  393. See @code{INCLUDE_DEFAULTS}, below, for the description of components.
  394. If you do not define this macro, no component is used.
  395. @end defmac
  396. @defmac INCLUDE_DEFAULTS
  397. Define this macro if you wish to override the entire default search path
  398. for include files. For a native compiler, the default search path
  399. usually consists of @code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR},
  400. @code{GPLUSPLUS_INCLUDE_DIR}, and
  401. @code{NATIVE_SYSTEM_HEADER_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR}
  402. and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile},
  403. and specify private search areas for GCC@. The directory
  404. @code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs.
  405. The definition should be an initializer for an array of structures.
  406. Each array element should have four elements: the directory name (a
  407. string constant), the component name (also a string constant), a flag
  408. for C++-only directories,
  409. and a flag showing that the includes in the directory don't need to be
  410. wrapped in @code{extern @samp{C}} when compiling C++. Mark the end of
  411. the array with a null element.
  412. The component name denotes what GNU package the include file is part of,
  413. if any, in all uppercase letters. For example, it might be @samp{GCC}
  414. or @samp{BINUTILS}. If the package is part of a vendor-supplied
  415. operating system, code the component name as @samp{0}.
  416. For example, here is the definition used for VAX/VMS:
  417. @smallexample
  418. #define INCLUDE_DEFAULTS \
  419. @{ \
  420. @{ "GNU_GXX_INCLUDE:", "G++", 1, 1@}, \
  421. @{ "GNU_CC_INCLUDE:", "GCC", 0, 0@}, \
  422. @{ "SYS$SYSROOT:[SYSLIB.]", 0, 0, 0@}, \
  423. @{ ".", 0, 0, 0@}, \
  424. @{ 0, 0, 0, 0@} \
  425. @}
  426. @end smallexample
  427. @end defmac
  428. Here is the order of prefixes tried for exec files:
  429. @enumerate
  430. @item
  431. Any prefixes specified by the user with @option{-B}.
  432. @item
  433. The environment variable @code{GCC_EXEC_PREFIX} or, if @code{GCC_EXEC_PREFIX}
  434. is not set and the compiler has not been installed in the configure-time
  435. @var{prefix}, the location in which the compiler has actually been installed.
  436. @item
  437. The directories specified by the environment variable @code{COMPILER_PATH}.
  438. @item
  439. The macro @code{STANDARD_EXEC_PREFIX}, if the compiler has been installed
  440. in the configured-time @var{prefix}.
  441. @item
  442. The location @file{/usr/libexec/gcc/}, but only if this is a native compiler.
  443. @item
  444. The location @file{/usr/lib/gcc/}, but only if this is a native compiler.
  445. @item
  446. The macro @code{MD_EXEC_PREFIX}, if defined, but only if this is a native
  447. compiler.
  448. @end enumerate
  449. Here is the order of prefixes tried for startfiles:
  450. @enumerate
  451. @item
  452. Any prefixes specified by the user with @option{-B}.
  453. @item
  454. The environment variable @code{GCC_EXEC_PREFIX} or its automatically determined
  455. value based on the installed toolchain location.
  456. @item
  457. The directories specified by the environment variable @code{LIBRARY_PATH}
  458. (or port-specific name; native only, cross compilers do not use this).
  459. @item
  460. The macro @code{STANDARD_EXEC_PREFIX}, but only if the toolchain is installed
  461. in the configured @var{prefix} or this is a native compiler.
  462. @item
  463. The location @file{/usr/lib/gcc/}, but only if this is a native compiler.
  464. @item
  465. The macro @code{MD_EXEC_PREFIX}, if defined, but only if this is a native
  466. compiler.
  467. @item
  468. The macro @code{MD_STARTFILE_PREFIX}, if defined, but only if this is a
  469. native compiler, or we have a target system root.
  470. @item
  471. The macro @code{MD_STARTFILE_PREFIX_1}, if defined, but only if this is a
  472. native compiler, or we have a target system root.
  473. @item
  474. The macro @code{STANDARD_STARTFILE_PREFIX}, with any sysroot modifications.
  475. If this path is relative it will be prefixed by @code{GCC_EXEC_PREFIX} and
  476. the machine suffix or @code{STANDARD_EXEC_PREFIX} and the machine suffix.
  477. @item
  478. The macro @code{STANDARD_STARTFILE_PREFIX_1}, but only if this is a native
  479. compiler, or we have a target system root. The default for this macro is
  480. @file{/lib/}.
  481. @item
  482. The macro @code{STANDARD_STARTFILE_PREFIX_2}, but only if this is a native
  483. compiler, or we have a target system root. The default for this macro is
  484. @file{/usr/lib/}.
  485. @end enumerate
  486. @node Run-time Target
  487. @section Run-time Target Specification
  488. @cindex run-time target specification
  489. @cindex predefined macros
  490. @cindex target specifications
  491. @c prevent bad page break with this line
  492. Here are run-time target specifications.
  493. @defmac TARGET_CPU_CPP_BUILTINS ()
  494. This function-like macro expands to a block of code that defines
  495. built-in preprocessor macros and assertions for the target CPU, using
  496. the functions @code{builtin_define}, @code{builtin_define_std} and
  497. @code{builtin_assert}. When the front end
  498. calls this macro it provides a trailing semicolon, and since it has
  499. finished command line option processing your code can use those
  500. results freely.
  501. @code{builtin_assert} takes a string in the form you pass to the
  502. command-line option @option{-A}, such as @code{cpu=mips}, and creates
  503. the assertion. @code{builtin_define} takes a string in the form
  504. accepted by option @option{-D} and unconditionally defines the macro.
  505. @code{builtin_define_std} takes a string representing the name of an
  506. object-like macro. If it doesn't lie in the user's namespace,
  507. @code{builtin_define_std} defines it unconditionally. Otherwise, it
  508. defines a version with two leading underscores, and another version
  509. with two leading and trailing underscores, and defines the original
  510. only if an ISO standard was not requested on the command line. For
  511. example, passing @code{unix} defines @code{__unix}, @code{__unix__}
  512. and possibly @code{unix}; passing @code{_mips} defines @code{__mips},
  513. @code{__mips__} and possibly @code{_mips}, and passing @code{_ABI64}
  514. defines only @code{_ABI64}.
  515. You can also test for the C dialect being compiled. The variable
  516. @code{c_language} is set to one of @code{clk_c}, @code{clk_cplusplus}
  517. or @code{clk_objective_c}. Note that if we are preprocessing
  518. assembler, this variable will be @code{clk_c} but the function-like
  519. macro @code{preprocessing_asm_p()} will return true, so you might want
  520. to check for that first. If you need to check for strict ANSI, the
  521. variable @code{flag_iso} can be used. The function-like macro
  522. @code{preprocessing_trad_p()} can be used to check for traditional
  523. preprocessing.
  524. @end defmac
  525. @defmac TARGET_OS_CPP_BUILTINS ()
  526. Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional
  527. and is used for the target operating system instead.
  528. @end defmac
  529. @defmac TARGET_OBJFMT_CPP_BUILTINS ()
  530. Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional
  531. and is used for the target object format. @file{elfos.h} uses this
  532. macro to define @code{__ELF__}, so you probably do not need to define
  533. it yourself.
  534. @end defmac
  535. @deftypevar {extern int} target_flags
  536. This variable is declared in @file{options.h}, which is included before
  537. any target-specific headers.
  538. @end deftypevar
  539. @hook TARGET_DEFAULT_TARGET_FLAGS
  540. This variable specifies the initial value of @code{target_flags}.
  541. Its default setting is 0.
  542. @end deftypevr
  543. @cindex optional hardware or system features
  544. @cindex features, optional, in system conventions
  545. @hook TARGET_HANDLE_OPTION
  546. This hook is called whenever the user specifies one of the
  547. target-specific options described by the @file{.opt} definition files
  548. (@pxref{Options}). It has the opportunity to do some option-specific
  549. processing and should return true if the option is valid. The default
  550. definition does nothing but return true.
  551. @var{decoded} specifies the option and its arguments. @var{opts} and
  552. @var{opts_set} are the @code{gcc_options} structures to be used for
  553. storing option state, and @var{loc} is the location at which the
  554. option was passed (@code{UNKNOWN_LOCATION} except for options passed
  555. via attributes).
  556. @end deftypefn
  557. @hook TARGET_HANDLE_C_OPTION
  558. This target hook is called whenever the user specifies one of the
  559. target-specific C language family options described by the @file{.opt}
  560. definition files(@pxref{Options}). It has the opportunity to do some
  561. option-specific processing and should return true if the option is
  562. valid. The arguments are like for @code{TARGET_HANDLE_OPTION}. The
  563. default definition does nothing but return false.
  564. In general, you should use @code{TARGET_HANDLE_OPTION} to handle
  565. options. However, if processing an option requires routines that are
  566. only available in the C (and related language) front ends, then you
  567. should use @code{TARGET_HANDLE_C_OPTION} instead.
  568. @end deftypefn
  569. @hook TARGET_OBJC_CONSTRUCT_STRING_OBJECT
  570. @hook TARGET_OBJC_DECLARE_UNRESOLVED_CLASS_REFERENCE
  571. @hook TARGET_OBJC_DECLARE_CLASS_DEFINITION
  572. @hook TARGET_STRING_OBJECT_REF_TYPE_P
  573. @hook TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
  574. @hook TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE
  575. @defmac C_COMMON_OVERRIDE_OPTIONS
  576. This is similar to the @code{TARGET_OPTION_OVERRIDE} hook
  577. but is only used in the C
  578. language frontends (C, Objective-C, C++, Objective-C++) and so can be
  579. used to alter option flag variables which only exist in those
  580. frontends.
  581. @end defmac
  582. @hook TARGET_OPTION_OPTIMIZATION_TABLE
  583. Some machines may desire to change what optimizations are performed for
  584. various optimization levels. This variable, if defined, describes
  585. options to enable at particular sets of optimization levels. These
  586. options are processed once
  587. just after the optimization level is determined and before the remainder
  588. of the command options have been parsed, so may be overridden by other
  589. options passed explicitly.
  590. This processing is run once at program startup and when the optimization
  591. options are changed via @code{#pragma GCC optimize} or by using the
  592. @code{optimize} attribute.
  593. @end deftypevr
  594. @hook TARGET_OPTION_INIT_STRUCT
  595. @hook TARGET_OPTION_DEFAULT_PARAMS
  596. @defmac SWITCHABLE_TARGET
  597. Some targets need to switch between substantially different subtargets
  598. during compilation. For example, the MIPS target has one subtarget for
  599. the traditional MIPS architecture and another for MIPS16. Source code
  600. can switch between these two subarchitectures using the @code{mips16}
  601. and @code{nomips16} attributes.
  602. Such subtargets can differ in things like the set of available
  603. registers, the set of available instructions, the costs of various
  604. operations, and so on. GCC caches a lot of this type of information
  605. in global variables, and recomputing them for each subtarget takes a
  606. significant amount of time. The compiler therefore provides a facility
  607. for maintaining several versions of the global variables and quickly
  608. switching between them; see @file{target-globals.h} for details.
  609. Define this macro to 1 if your target needs this facility. The default
  610. is 0.
  611. @end defmac
  612. @hook TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
  613. @node Per-Function Data
  614. @section Defining data structures for per-function information.
  615. @cindex per-function data
  616. @cindex data structures
  617. If the target needs to store information on a per-function basis, GCC
  618. provides a macro and a couple of variables to allow this. Note, just
  619. using statics to store the information is a bad idea, since GCC supports
  620. nested functions, so you can be halfway through encoding one function
  621. when another one comes along.
  622. GCC defines a data structure called @code{struct function} which
  623. contains all of the data specific to an individual function. This
  624. structure contains a field called @code{machine} whose type is
  625. @code{struct machine_function *}, which can be used by targets to point
  626. to their own specific data.
  627. If a target needs per-function specific data it should define the type
  628. @code{struct machine_function} and also the macro @code{INIT_EXPANDERS}.
  629. This macro should be used to initialize the function pointer
  630. @code{init_machine_status}. This pointer is explained below.
  631. One typical use of per-function, target specific data is to create an
  632. RTX to hold the register containing the function's return address. This
  633. RTX can then be used to implement the @code{__builtin_return_address}
  634. function, for level 0.
  635. Note---earlier implementations of GCC used a single data area to hold
  636. all of the per-function information. Thus when processing of a nested
  637. function began the old per-function data had to be pushed onto a
  638. stack, and when the processing was finished, it had to be popped off the
  639. stack. GCC used to provide function pointers called
  640. @code{save_machine_status} and @code{restore_machine_status} to handle
  641. the saving and restoring of the target specific information. Since the
  642. single data area approach is no longer used, these pointers are no
  643. longer supported.
  644. @defmac INIT_EXPANDERS
  645. Macro called to initialize any target specific information. This macro
  646. is called once per function, before generation of any RTL has begun.
  647. The intention of this macro is to allow the initialization of the
  648. function pointer @code{init_machine_status}.
  649. @end defmac
  650. @deftypevar {void (*)(struct function *)} init_machine_status
  651. If this function pointer is non-@code{NULL} it will be called once per
  652. function, before function compilation starts, in order to allow the
  653. target to perform any target specific initialization of the
  654. @code{struct function} structure. It is intended that this would be
  655. used to initialize the @code{machine} of that structure.
  656. @code{struct machine_function} structures are expected to be freed by GC@.
  657. Generally, any memory that they reference must be allocated by using
  658. GC allocation, including the structure itself.
  659. @end deftypevar
  660. @node Storage Layout
  661. @section Storage Layout
  662. @cindex storage layout
  663. Note that the definitions of the macros in this table which are sizes or
  664. alignments measured in bits do not need to be constant. They can be C
  665. expressions that refer to static variables, such as the @code{target_flags}.
  666. @xref{Run-time Target}.
  667. @defmac BITS_BIG_ENDIAN
  668. Define this macro to have the value 1 if the most significant bit in a
  669. byte has the lowest number; otherwise define it to have the value zero.
  670. This means that bit-field instructions count from the most significant
  671. bit. If the machine has no bit-field instructions, then this must still
  672. be defined, but it doesn't matter which value it is defined to. This
  673. macro need not be a constant.
  674. This macro does not affect the way structure fields are packed into
  675. bytes or words; that is controlled by @code{BYTES_BIG_ENDIAN}.
  676. @end defmac
  677. @defmac BYTES_BIG_ENDIAN
  678. Define this macro to have the value 1 if the most significant byte in a
  679. word has the lowest number. This macro need not be a constant.
  680. @end defmac
  681. @defmac WORDS_BIG_ENDIAN
  682. Define this macro to have the value 1 if, in a multiword object, the
  683. most significant word has the lowest number. This applies to both
  684. memory locations and registers; see @code{REG_WORDS_BIG_ENDIAN} if the
  685. order of words in memory is not the same as the order in registers. This
  686. macro need not be a constant.
  687. @end defmac
  688. @defmac REG_WORDS_BIG_ENDIAN
  689. On some machines, the order of words in a multiword object differs between
  690. registers in memory. In such a situation, define this macro to describe
  691. the order of words in a register. The macro @code{WORDS_BIG_ENDIAN} controls
  692. the order of words in memory.
  693. @end defmac
  694. @defmac FLOAT_WORDS_BIG_ENDIAN
  695. Define this macro to have the value 1 if @code{DFmode}, @code{XFmode} or
  696. @code{TFmode} floating point numbers are stored in memory with the word
  697. containing the sign bit at the lowest address; otherwise define it to
  698. have the value 0. This macro need not be a constant.
  699. You need not define this macro if the ordering is the same as for
  700. multi-word integers.
  701. @end defmac
  702. @defmac BITS_PER_WORD
  703. Number of bits in a word. If you do not define this macro, the default
  704. is @code{BITS_PER_UNIT * UNITS_PER_WORD}.
  705. @end defmac
  706. @defmac MAX_BITS_PER_WORD
  707. Maximum number of bits in a word. If this is undefined, the default is
  708. @code{BITS_PER_WORD}. Otherwise, it is the constant value that is the
  709. largest value that @code{BITS_PER_WORD} can have at run-time.
  710. @end defmac
  711. @defmac UNITS_PER_WORD
  712. Number of storage units in a word; normally the size of a general-purpose
  713. register, a power of two from 1 or 8.
  714. @end defmac
  715. @defmac MIN_UNITS_PER_WORD
  716. Minimum number of units in a word. If this is undefined, the default is
  717. @code{UNITS_PER_WORD}. Otherwise, it is the constant value that is the
  718. smallest value that @code{UNITS_PER_WORD} can have at run-time.
  719. @end defmac
  720. @defmac POINTER_SIZE
  721. Width of a pointer, in bits. You must specify a value no wider than the
  722. width of @code{Pmode}. If it is not equal to the width of @code{Pmode},
  723. you must define @code{POINTERS_EXTEND_UNSIGNED}. If you do not specify
  724. a value the default is @code{BITS_PER_WORD}.
  725. @end defmac
  726. @defmac POINTERS_EXTEND_UNSIGNED
  727. A C expression that determines how pointers should be extended from
  728. @code{ptr_mode} to either @code{Pmode} or @code{word_mode}. It is
  729. greater than zero if pointers should be zero-extended, zero if they
  730. should be sign-extended, and negative if some other sort of conversion
  731. is needed. In the last case, the extension is done by the target's
  732. @code{ptr_extend} instruction.
  733. You need not define this macro if the @code{ptr_mode}, @code{Pmode}
  734. and @code{word_mode} are all the same width.
  735. @end defmac
  736. @defmac PROMOTE_MODE (@var{m}, @var{unsignedp}, @var{type})
  737. A macro to update @var{m} and @var{unsignedp} when an object whose type
  738. is @var{type} and which has the specified mode and signedness is to be
  739. stored in a register. This macro is only called when @var{type} is a
  740. scalar type.
  741. On most RISC machines, which only have operations that operate on a full
  742. register, define this macro to set @var{m} to @code{word_mode} if
  743. @var{m} is an integer mode narrower than @code{BITS_PER_WORD}. In most
  744. cases, only integer modes should be widened because wider-precision
  745. floating-point operations are usually more expensive than their narrower
  746. counterparts.
  747. For most machines, the macro definition does not change @var{unsignedp}.
  748. However, some machines, have instructions that preferentially handle
  749. either signed or unsigned quantities of certain modes. For example, on
  750. the DEC Alpha, 32-bit loads from memory and 32-bit add instructions
  751. sign-extend the result to 64 bits. On such machines, set
  752. @var{unsignedp} according to which kind of extension is more efficient.
  753. Do not define this macro if it would never modify @var{m}.
  754. @end defmac
  755. @hook TARGET_PROMOTE_FUNCTION_MODE
  756. @defmac PARM_BOUNDARY
  757. Normal alignment required for function parameters on the stack, in
  758. bits. All stack parameters receive at least this much alignment
  759. regardless of data type. On most machines, this is the same as the
  760. size of an integer.
  761. @end defmac
  762. @defmac STACK_BOUNDARY
  763. Define this macro to the minimum alignment enforced by hardware for the
  764. stack pointer on this machine. The definition is a C expression for the
  765. desired alignment (measured in bits). This value is used as a default
  766. if @code{PREFERRED_STACK_BOUNDARY} is not defined. On most machines,
  767. this should be the same as @code{PARM_BOUNDARY}.
  768. @end defmac
  769. @defmac PREFERRED_STACK_BOUNDARY
  770. Define this macro if you wish to preserve a certain alignment for the
  771. stack pointer, greater than what the hardware enforces. The definition
  772. is a C expression for the desired alignment (measured in bits). This
  773. macro must evaluate to a value equal to or larger than
  774. @code{STACK_BOUNDARY}.
  775. @end defmac
  776. @defmac INCOMING_STACK_BOUNDARY
  777. Define this macro if the incoming stack boundary may be different
  778. from @code{PREFERRED_STACK_BOUNDARY}. This macro must evaluate
  779. to a value equal to or larger than @code{STACK_BOUNDARY}.
  780. @end defmac
  781. @defmac FUNCTION_BOUNDARY
  782. Alignment required for a function entry point, in bits.
  783. @end defmac
  784. @defmac BIGGEST_ALIGNMENT
  785. Biggest alignment that any data type can require on this machine, in
  786. bits. Note that this is not the biggest alignment that is supported,
  787. just the biggest alignment that, when violated, may cause a fault.
  788. @end defmac
  789. @hook TARGET_ABSOLUTE_BIGGEST_ALIGNMENT
  790. @defmac MALLOC_ABI_ALIGNMENT
  791. Alignment, in bits, a C conformant malloc implementation has to
  792. provide. If not defined, the default value is @code{BITS_PER_WORD}.
  793. @end defmac
  794. @defmac ATTRIBUTE_ALIGNED_VALUE
  795. Alignment used by the @code{__attribute__ ((aligned))} construct. If
  796. not defined, the default value is @code{BIGGEST_ALIGNMENT}.
  797. @end defmac
  798. @defmac MINIMUM_ATOMIC_ALIGNMENT
  799. If defined, the smallest alignment, in bits, that can be given to an
  800. object that can be referenced in one operation, without disturbing any
  801. nearby object. Normally, this is @code{BITS_PER_UNIT}, but may be larger
  802. on machines that don't have byte or half-word store operations.
  803. @end defmac
  804. @defmac BIGGEST_FIELD_ALIGNMENT
  805. Biggest alignment that any structure or union field can require on this
  806. machine, in bits. If defined, this overrides @code{BIGGEST_ALIGNMENT} for
  807. structure and union fields only, unless the field alignment has been set
  808. by the @code{__attribute__ ((aligned (@var{n})))} construct.
  809. @end defmac
  810. @defmac ADJUST_FIELD_ALIGN (@var{field}, @var{computed})
  811. An expression for the alignment of a structure field @var{field} if the
  812. alignment computed in the usual way (including applying of
  813. @code{BIGGEST_ALIGNMENT} and @code{BIGGEST_FIELD_ALIGNMENT} to the
  814. alignment) is @var{computed}. It overrides alignment only if the
  815. field alignment has not been set by the
  816. @code{__attribute__ ((aligned (@var{n})))} construct.
  817. @end defmac
  818. @defmac MAX_STACK_ALIGNMENT
  819. Biggest stack alignment guaranteed by the backend. Use this macro
  820. to specify the maximum alignment of a variable on stack.
  821. If not defined, the default value is @code{STACK_BOUNDARY}.
  822. @c FIXME: The default should be @code{PREFERRED_STACK_BOUNDARY}.
  823. @c But the fix for PR 32893 indicates that we can only guarantee
  824. @c maximum stack alignment on stack up to @code{STACK_BOUNDARY}, not
  825. @c @code{PREFERRED_STACK_BOUNDARY}, if stack alignment isn't supported.
  826. @end defmac
  827. @defmac MAX_OFILE_ALIGNMENT
  828. Biggest alignment supported by the object file format of this machine.
  829. Use this macro to limit the alignment which can be specified using the
  830. @code{__attribute__ ((aligned (@var{n})))} construct. If not defined,
  831. the default value is @code{BIGGEST_ALIGNMENT}.
  832. On systems that use ELF, the default (in @file{config/elfos.h}) is
  833. the largest supported 32-bit ELF section alignment representable on
  834. a 32-bit host e.g. @samp{(((uint64_t) 1 << 28) * 8)}.
  835. On 32-bit ELF the largest supported section alignment in bits is
  836. @samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts.
  837. @end defmac
  838. @defmac DATA_ALIGNMENT (@var{type}, @var{basic-align})
  839. If defined, a C expression to compute the alignment for a variable in
  840. the static store. @var{type} is the data type, and @var{basic-align} is
  841. the alignment that the object would ordinarily have. The value of this
  842. macro is used instead of that alignment to align the object.
  843. If this macro is not defined, then @var{basic-align} is used.
  844. @findex strcpy
  845. One use of this macro is to increase alignment of medium-size data to
  846. make it all fit in fewer cache lines. Another is to cause character
  847. arrays to be word-aligned so that @code{strcpy} calls that copy
  848. constants to character arrays can be done inline.
  849. @end defmac
  850. @defmac DATA_ABI_ALIGNMENT (@var{type}, @var{basic-align})
  851. Similar to @code{DATA_ALIGNMENT}, but for the cases where the ABI mandates
  852. some alignment increase, instead of optimization only purposes. E.g.@
  853. AMD x86-64 psABI says that variables with array type larger than 15 bytes
  854. must be aligned to 16 byte boundaries.
  855. If this macro is not defined, then @var{basic-align} is used.
  856. @end defmac
  857. @defmac CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align})
  858. If defined, a C expression to compute the alignment given to a constant
  859. that is being placed in memory. @var{constant} is the constant and
  860. @var{basic-align} is the alignment that the object would ordinarily
  861. have. The value of this macro is used instead of that alignment to
  862. align the object.
  863. If this macro is not defined, then @var{basic-align} is used.
  864. The typical use of this macro is to increase alignment for string
  865. constants to be word aligned so that @code{strcpy} calls that copy
  866. constants can be done inline.
  867. @end defmac
  868. @defmac LOCAL_ALIGNMENT (@var{type}, @var{basic-align})
  869. If defined, a C expression to compute the alignment for a variable in
  870. the local store. @var{type} is the data type, and @var{basic-align} is
  871. the alignment that the object would ordinarily have. The value of this
  872. macro is used instead of that alignment to align the object.
  873. If this macro is not defined, then @var{basic-align} is used.
  874. One use of this macro is to increase alignment of medium-size data to
  875. make it all fit in fewer cache lines.
  876. If the value of this macro has a type, it should be an unsigned type.
  877. @end defmac
  878. @hook TARGET_VECTOR_ALIGNMENT
  879. @defmac STACK_SLOT_ALIGNMENT (@var{type}, @var{mode}, @var{basic-align})
  880. If defined, a C expression to compute the alignment for stack slot.
  881. @var{type} is the data type, @var{mode} is the widest mode available,
  882. and @var{basic-align} is the alignment that the slot would ordinarily
  883. have. The value of this macro is used instead of that alignment to
  884. align the slot.
  885. If this macro is not defined, then @var{basic-align} is used when
  886. @var{type} is @code{NULL}. Otherwise, @code{LOCAL_ALIGNMENT} will
  887. be used.
  888. This macro is to set alignment of stack slot to the maximum alignment
  889. of all possible modes which the slot may have.
  890. If the value of this macro has a type, it should be an unsigned type.
  891. @end defmac
  892. @defmac LOCAL_DECL_ALIGNMENT (@var{decl})
  893. If defined, a C expression to compute the alignment for a local
  894. variable @var{decl}.
  895. If this macro is not defined, then
  896. @code{LOCAL_ALIGNMENT (TREE_TYPE (@var{decl}), DECL_ALIGN (@var{decl}))}
  897. is used.
  898. One use of this macro is to increase alignment of medium-size data to
  899. make it all fit in fewer cache lines.
  900. If the value of this macro has a type, it should be an unsigned type.
  901. @end defmac
  902. @defmac MINIMUM_ALIGNMENT (@var{exp}, @var{mode}, @var{align})
  903. If defined, a C expression to compute the minimum required alignment
  904. for dynamic stack realignment purposes for @var{exp} (a type or decl),
  905. @var{mode}, assuming normal alignment @var{align}.
  906. If this macro is not defined, then @var{align} will be used.
  907. @end defmac
  908. @defmac EMPTY_FIELD_BOUNDARY
  909. Alignment in bits to be given to a structure bit-field that follows an
  910. empty field such as @code{int : 0;}.
  911. If @code{PCC_BITFIELD_TYPE_MATTERS} is true, it overrides this macro.
  912. @end defmac
  913. @defmac STRUCTURE_SIZE_BOUNDARY
  914. Number of bits which any structure or union's size must be a multiple of.
  915. Each structure or union's size is rounded up to a multiple of this.
  916. If you do not define this macro, the default is the same as
  917. @code{BITS_PER_UNIT}.
  918. @end defmac
  919. @defmac STRICT_ALIGNMENT
  920. Define this macro to be the value 1 if instructions will fail to work
  921. if given data not on the nominal alignment. If instructions will merely
  922. go slower in that case, define this macro as 0.
  923. @end defmac
  924. @defmac PCC_BITFIELD_TYPE_MATTERS
  925. Define this if you wish to imitate the way many other C compilers handle
  926. alignment of bit-fields and the structures that contain them.
  927. The behavior is that the type written for a named bit-field (@code{int},
  928. @code{short}, or other integer type) imposes an alignment for the entire
  929. structure, as if the structure really did contain an ordinary field of
  930. that type. In addition, the bit-field is placed within the structure so
  931. that it would fit within such a field, not crossing a boundary for it.
  932. Thus, on most machines, a named bit-field whose type is written as
  933. @code{int} would not cross a four-byte boundary, and would force
  934. four-byte alignment for the whole structure. (The alignment used may
  935. not be four bytes; it is controlled by the other alignment parameters.)
  936. An unnamed bit-field will not affect the alignment of the containing
  937. structure.
  938. If the macro is defined, its definition should be a C expression;
  939. a nonzero value for the expression enables this behavior.
  940. Note that if this macro is not defined, or its value is zero, some
  941. bit-fields may cross more than one alignment boundary. The compiler can
  942. support such references if there are @samp{insv}, @samp{extv}, and
  943. @samp{extzv} insns that can directly reference memory.
  944. The other known way of making bit-fields work is to define
  945. @code{STRUCTURE_SIZE_BOUNDARY} as large as @code{BIGGEST_ALIGNMENT}.
  946. Then every structure can be accessed with fullwords.
  947. Unless the machine has bit-field instructions or you define
  948. @code{STRUCTURE_SIZE_BOUNDARY} that way, you must define
  949. @code{PCC_BITFIELD_TYPE_MATTERS} to have a nonzero value.
  950. If your aim is to make GCC use the same conventions for laying out
  951. bit-fields as are used by another compiler, here is how to investigate
  952. what the other compiler does. Compile and run this program:
  953. @smallexample
  954. struct foo1
  955. @{
  956. char x;
  957. char :0;
  958. char y;
  959. @};
  960. struct foo2
  961. @{
  962. char x;
  963. int :0;
  964. char y;
  965. @};
  966. main ()
  967. @{
  968. printf ("Size of foo1 is %d\n",
  969. sizeof (struct foo1));
  970. printf ("Size of foo2 is %d\n",
  971. sizeof (struct foo2));
  972. exit (0);
  973. @}
  974. @end smallexample
  975. If this prints 2 and 5, then the compiler's behavior is what you would
  976. get from @code{PCC_BITFIELD_TYPE_MATTERS}.
  977. @end defmac
  978. @defmac BITFIELD_NBYTES_LIMITED
  979. Like @code{PCC_BITFIELD_TYPE_MATTERS} except that its effect is limited
  980. to aligning a bit-field within the structure.
  981. @end defmac
  982. @hook TARGET_ALIGN_ANON_BITFIELD
  983. @hook TARGET_NARROW_VOLATILE_BITFIELD
  984. @hook TARGET_MEMBER_TYPE_FORCES_BLK
  985. @defmac ROUND_TYPE_ALIGN (@var{type}, @var{computed}, @var{specified})
  986. Define this macro as an expression for the alignment of a type (given
  987. by @var{type} as a tree node) if the alignment computed in the usual
  988. way is @var{computed} and the alignment explicitly specified was
  989. @var{specified}.
  990. The default is to use @var{specified} if it is larger; otherwise, use
  991. the smaller of @var{computed} and @code{BIGGEST_ALIGNMENT}
  992. @end defmac
  993. @defmac MAX_FIXED_MODE_SIZE
  994. An integer expression for the size in bits of the largest integer
  995. machine mode that should actually be used. All integer machine modes of
  996. this size or smaller can be used for structures and unions with the
  997. appropriate sizes. If this macro is undefined, @code{GET_MODE_BITSIZE
  998. (DImode)} is assumed.
  999. @end defmac
  1000. @defmac STACK_SAVEAREA_MODE (@var{save_level})
  1001. If defined, an expression of type @code{machine_mode} that
  1002. specifies the mode of the save area operand of a
  1003. @code{save_stack_@var{level}} named pattern (@pxref{Standard Names}).
  1004. @var{save_level} is one of @code{SAVE_BLOCK}, @code{SAVE_FUNCTION}, or
  1005. @code{SAVE_NONLOCAL} and selects which of the three named patterns is
  1006. having its mode specified.
  1007. You need not define this macro if it always returns @code{Pmode}. You
  1008. would most commonly define this macro if the
  1009. @code{save_stack_@var{level}} patterns need to support both a 32- and a
  1010. 64-bit mode.
  1011. @end defmac
  1012. @defmac STACK_SIZE_MODE
  1013. If defined, an expression of type @code{machine_mode} that
  1014. specifies the mode of the size increment operand of an
  1015. @code{allocate_stack} named pattern (@pxref{Standard Names}).
  1016. You need not define this macro if it always returns @code{word_mode}.
  1017. You would most commonly define this macro if the @code{allocate_stack}
  1018. pattern needs to support both a 32- and a 64-bit mode.
  1019. @end defmac
  1020. @hook TARGET_LIBGCC_CMP_RETURN_MODE
  1021. @hook TARGET_LIBGCC_SHIFT_COUNT_MODE
  1022. @hook TARGET_UNWIND_WORD_MODE
  1023. @hook TARGET_MS_BITFIELD_LAYOUT_P
  1024. @hook TARGET_DECIMAL_FLOAT_SUPPORTED_P
  1025. @hook TARGET_FIXED_POINT_SUPPORTED_P
  1026. @hook TARGET_EXPAND_TO_RTL_HOOK
  1027. @hook TARGET_INSTANTIATE_DECLS
  1028. @hook TARGET_MANGLE_TYPE
  1029. @node Type Layout
  1030. @section Layout of Source Language Data Types
  1031. These macros define the sizes and other characteristics of the standard
  1032. basic data types used in programs being compiled. Unlike the macros in
  1033. the previous section, these apply to specific features of C and related
  1034. languages, rather than to fundamental aspects of storage layout.
  1035. @defmac INT_TYPE_SIZE
  1036. A C expression for the size in bits of the type @code{int} on the
  1037. target machine. If you don't define this, the default is one word.
  1038. @end defmac
  1039. @defmac SHORT_TYPE_SIZE
  1040. A C expression for the size in bits of the type @code{short} on the
  1041. target machine. If you don't define this, the default is half a word.
  1042. (If this would be less than one storage unit, it is rounded up to one
  1043. unit.)
  1044. @end defmac
  1045. @defmac LONG_TYPE_SIZE
  1046. A C expression for the size in bits of the type @code{long} on the
  1047. target machine. If you don't define this, the default is one word.
  1048. @end defmac
  1049. @defmac ADA_LONG_TYPE_SIZE
  1050. On some machines, the size used for the Ada equivalent of the type
  1051. @code{long} by a native Ada compiler differs from that used by C@. In
  1052. that situation, define this macro to be a C expression to be used for
  1053. the size of that type. If you don't define this, the default is the
  1054. value of @code{LONG_TYPE_SIZE}.
  1055. @end defmac
  1056. @defmac LONG_LONG_TYPE_SIZE
  1057. A C expression for the size in bits of the type @code{long long} on the
  1058. target machine. If you don't define this, the default is two
  1059. words. If you want to support GNU Ada on your machine, the value of this
  1060. macro must be at least 64.
  1061. @end defmac
  1062. @defmac CHAR_TYPE_SIZE
  1063. A C expression for the size in bits of the type @code{char} on the
  1064. target machine. If you don't define this, the default is
  1065. @code{BITS_PER_UNIT}.
  1066. @end defmac
  1067. @defmac BOOL_TYPE_SIZE
  1068. A C expression for the size in bits of the C++ type @code{bool} and
  1069. C99 type @code{_Bool} on the target machine. If you don't define
  1070. this, and you probably shouldn't, the default is @code{CHAR_TYPE_SIZE}.
  1071. @end defmac
  1072. @defmac FLOAT_TYPE_SIZE
  1073. A C expression for the size in bits of the type @code{float} on the
  1074. target machine. If you don't define this, the default is one word.
  1075. @end defmac
  1076. @defmac DOUBLE_TYPE_SIZE
  1077. A C expression for the size in bits of the type @code{double} on the
  1078. target machine. If you don't define this, the default is two
  1079. words.
  1080. @end defmac
  1081. @defmac LONG_DOUBLE_TYPE_SIZE
  1082. A C expression for the size in bits of the type @code{long double} on
  1083. the target machine. If you don't define this, the default is two
  1084. words.
  1085. @end defmac
  1086. @defmac SHORT_FRACT_TYPE_SIZE
  1087. A C expression for the size in bits of the type @code{short _Fract} on
  1088. the target machine. If you don't define this, the default is
  1089. @code{BITS_PER_UNIT}.
  1090. @end defmac
  1091. @defmac FRACT_TYPE_SIZE
  1092. A C expression for the size in bits of the type @code{_Fract} on
  1093. the target machine. If you don't define this, the default is
  1094. @code{BITS_PER_UNIT * 2}.
  1095. @end defmac
  1096. @defmac LONG_FRACT_TYPE_SIZE
  1097. A C expression for the size in bits of the type @code{long _Fract} on
  1098. the target machine. If you don't define this, the default is
  1099. @code{BITS_PER_UNIT * 4}.
  1100. @end defmac
  1101. @defmac LONG_LONG_FRACT_TYPE_SIZE
  1102. A C expression for the size in bits of the type @code{long long _Fract} on
  1103. the target machine. If you don't define this, the default is
  1104. @code{BITS_PER_UNIT * 8}.
  1105. @end defmac
  1106. @defmac SHORT_ACCUM_TYPE_SIZE
  1107. A C expression for the size in bits of the type @code{short _Accum} on
  1108. the target machine. If you don't define this, the default is
  1109. @code{BITS_PER_UNIT * 2}.
  1110. @end defmac
  1111. @defmac ACCUM_TYPE_SIZE
  1112. A C expression for the size in bits of the type @code{_Accum} on
  1113. the target machine. If you don't define this, the default is
  1114. @code{BITS_PER_UNIT * 4}.
  1115. @end defmac
  1116. @defmac LONG_ACCUM_TYPE_SIZE
  1117. A C expression for the size in bits of the type @code{long _Accum} on
  1118. the target machine. If you don't define this, the default is
  1119. @code{BITS_PER_UNIT * 8}.
  1120. @end defmac
  1121. @defmac LONG_LONG_ACCUM_TYPE_SIZE
  1122. A C expression for the size in bits of the type @code{long long _Accum} on
  1123. the target machine. If you don't define this, the default is
  1124. @code{BITS_PER_UNIT * 16}.
  1125. @end defmac
  1126. @defmac LIBGCC2_GNU_PREFIX
  1127. This macro corresponds to the @code{TARGET_LIBFUNC_GNU_PREFIX} target
  1128. hook and should be defined if that hook is overriden to be true. It
  1129. causes function names in libgcc to be changed to use a @code{__gnu_}
  1130. prefix for their name rather than the default @code{__}. A port which
  1131. uses this macro should also arrange to use @file{t-gnu-prefix} in
  1132. the libgcc @file{config.host}.
  1133. @end defmac
  1134. @defmac TARGET_FLT_EVAL_METHOD
  1135. A C expression for the value for @code{FLT_EVAL_METHOD} in @file{float.h},
  1136. assuming, if applicable, that the floating-point control word is in its
  1137. default state. If you do not define this macro the value of
  1138. @code{FLT_EVAL_METHOD} will be zero.
  1139. @end defmac
  1140. @defmac WIDEST_HARDWARE_FP_SIZE
  1141. A C expression for the size in bits of the widest floating-point format
  1142. supported by the hardware. If you define this macro, you must specify a
  1143. value less than or equal to the value of @code{LONG_DOUBLE_TYPE_SIZE}.
  1144. If you do not define this macro, the value of @code{LONG_DOUBLE_TYPE_SIZE}
  1145. is the default.
  1146. @end defmac
  1147. @defmac DEFAULT_SIGNED_CHAR
  1148. An expression whose value is 1 or 0, according to whether the type
  1149. @code{char} should be signed or unsigned by default. The user can
  1150. always override this default with the options @option{-fsigned-char}
  1151. and @option{-funsigned-char}.
  1152. @end defmac
  1153. @hook TARGET_DEFAULT_SHORT_ENUMS
  1154. @defmac SIZE_TYPE
  1155. A C expression for a string describing the name of the data type to use
  1156. for size values. The typedef name @code{size_t} is defined using the
  1157. contents of the string.
  1158. The string can contain more than one keyword. If so, separate them with
  1159. spaces, and write first any length keyword, then @code{unsigned} if
  1160. appropriate, and finally @code{int}. The string must exactly match one
  1161. of the data type names defined in the function
  1162. @code{c_common_nodes_and_builtins} in the file @file{c-family/c-common.c}.
  1163. You may not omit @code{int} or change the order---that would cause the
  1164. compiler to crash on startup.
  1165. If you don't define this macro, the default is @code{"long unsigned
  1166. int"}.
  1167. @end defmac
  1168. @defmac SIZETYPE
  1169. GCC defines internal types (@code{sizetype}, @code{ssizetype},
  1170. @code{bitsizetype} and @code{sbitsizetype}) for expressions
  1171. dealing with size. This macro is a C expression for a string describing
  1172. the name of the data type from which the precision of @code{sizetype}
  1173. is extracted.
  1174. The string has the same restrictions as @code{SIZE_TYPE} string.
  1175. If you don't define this macro, the default is @code{SIZE_TYPE}.
  1176. @end defmac
  1177. @defmac PTRDIFF_TYPE
  1178. A C expression for a string describing the name of the data type to use
  1179. for the result of subtracting two pointers. The typedef name
  1180. @code{ptrdiff_t} is defined using the contents of the string. See
  1181. @code{SIZE_TYPE} above for more information.
  1182. If you don't define this macro, the default is @code{"long int"}.
  1183. @end defmac
  1184. @defmac WCHAR_TYPE
  1185. A C expression for a string describing the name of the data type to use
  1186. for wide characters. The typedef name @code{wchar_t} is defined using
  1187. the contents of the string. See @code{SIZE_TYPE} above for more
  1188. information.
  1189. If you don't define this macro, the default is @code{"int"}.
  1190. @end defmac
  1191. @defmac WCHAR_TYPE_SIZE
  1192. A C expression for the size in bits of the data type for wide
  1193. characters. This is used in @code{cpp}, which cannot make use of
  1194. @code{WCHAR_TYPE}.
  1195. @end defmac
  1196. @defmac WINT_TYPE
  1197. A C expression for a string describing the name of the data type to
  1198. use for wide characters passed to @code{printf} and returned from
  1199. @code{getwc}. The typedef name @code{wint_t} is defined using the
  1200. contents of the string. See @code{SIZE_TYPE} above for more
  1201. information.
  1202. If you don't define this macro, the default is @code{"unsigned int"}.
  1203. @end defmac
  1204. @defmac INTMAX_TYPE
  1205. A C expression for a string describing the name of the data type that
  1206. can represent any value of any standard or extended signed integer type.
  1207. The typedef name @code{intmax_t} is defined using the contents of the
  1208. string. See @code{SIZE_TYPE} above for more information.
  1209. If you don't define this macro, the default is the first of
  1210. @code{"int"}, @code{"long int"}, or @code{"long long int"} that has as
  1211. much precision as @code{long long int}.
  1212. @end defmac
  1213. @defmac UINTMAX_TYPE
  1214. A C expression for a string describing the name of the data type that
  1215. can represent any value of any standard or extended unsigned integer
  1216. type. The typedef name @code{uintmax_t} is defined using the contents
  1217. of the string. See @code{SIZE_TYPE} above for more information.
  1218. If you don't define this macro, the default is the first of
  1219. @code{"unsigned int"}, @code{"long unsigned int"}, or @code{"long long
  1220. unsigned int"} that has as much precision as @code{long long unsigned
  1221. int}.
  1222. @end defmac
  1223. @defmac SIG_ATOMIC_TYPE
  1224. @defmacx INT8_TYPE
  1225. @defmacx INT16_TYPE
  1226. @defmacx INT32_TYPE
  1227. @defmacx INT64_TYPE
  1228. @defmacx UINT8_TYPE
  1229. @defmacx UINT16_TYPE
  1230. @defmacx UINT32_TYPE
  1231. @defmacx UINT64_TYPE
  1232. @defmacx INT_LEAST8_TYPE
  1233. @defmacx INT_LEAST16_TYPE
  1234. @defmacx INT_LEAST32_TYPE
  1235. @defmacx INT_LEAST64_TYPE
  1236. @defmacx UINT_LEAST8_TYPE
  1237. @defmacx UINT_LEAST16_TYPE
  1238. @defmacx UINT_LEAST32_TYPE
  1239. @defmacx UINT_LEAST64_TYPE
  1240. @defmacx INT_FAST8_TYPE
  1241. @defmacx INT_FAST16_TYPE
  1242. @defmacx INT_FAST32_TYPE
  1243. @defmacx INT_FAST64_TYPE
  1244. @defmacx UINT_FAST8_TYPE
  1245. @defmacx UINT_FAST16_TYPE
  1246. @defmacx UINT_FAST32_TYPE
  1247. @defmacx UINT_FAST64_TYPE
  1248. @defmacx INTPTR_TYPE
  1249. @defmacx UINTPTR_TYPE
  1250. C expressions for the standard types @code{sig_atomic_t},
  1251. @code{int8_t}, @code{int16_t}, @code{int32_t}, @code{int64_t},
  1252. @code{uint8_t}, @code{uint16_t}, @code{uint32_t}, @code{uint64_t},
  1253. @code{int_least8_t}, @code{int_least16_t}, @code{int_least32_t},
  1254. @code{int_least64_t}, @code{uint_least8_t}, @code{uint_least16_t},
  1255. @code{uint_least32_t}, @code{uint_least64_t}, @code{int_fast8_t},
  1256. @code{int_fast16_t}, @code{int_fast32_t}, @code{int_fast64_t},
  1257. @code{uint_fast8_t}, @code{uint_fast16_t}, @code{uint_fast32_t},
  1258. @code{uint_fast64_t}, @code{intptr_t}, and @code{uintptr_t}. See
  1259. @code{SIZE_TYPE} above for more information.
  1260. If any of these macros evaluates to a null pointer, the corresponding
  1261. type is not supported; if GCC is configured to provide
  1262. @code{<stdint.h>} in such a case, the header provided may not conform
  1263. to C99, depending on the type in question. The defaults for all of
  1264. these macros are null pointers.
  1265. @end defmac
  1266. @defmac TARGET_PTRMEMFUNC_VBIT_LOCATION
  1267. The C++ compiler represents a pointer-to-member-function with a struct
  1268. that looks like:
  1269. @smallexample
  1270. struct @{
  1271. union @{
  1272. void (*fn)();
  1273. ptrdiff_t vtable_index;
  1274. @};
  1275. ptrdiff_t delta;
  1276. @};
  1277. @end smallexample
  1278. @noindent
  1279. The C++ compiler must use one bit to indicate whether the function that
  1280. will be called through a pointer-to-member-function is virtual.
  1281. Normally, we assume that the low-order bit of a function pointer must
  1282. always be zero. Then, by ensuring that the vtable_index is odd, we can
  1283. distinguish which variant of the union is in use. But, on some
  1284. platforms function pointers can be odd, and so this doesn't work. In
  1285. that case, we use the low-order bit of the @code{delta} field, and shift
  1286. the remainder of the @code{delta} field to the left.
  1287. GCC will automatically make the right selection about where to store
  1288. this bit using the @code{FUNCTION_BOUNDARY} setting for your platform.
  1289. However, some platforms such as ARM/Thumb have @code{FUNCTION_BOUNDARY}
  1290. set such that functions always start at even addresses, but the lowest
  1291. bit of pointers to functions indicate whether the function at that
  1292. address is in ARM or Thumb mode. If this is the case of your
  1293. architecture, you should define this macro to
  1294. @code{ptrmemfunc_vbit_in_delta}.
  1295. In general, you should not have to define this macro. On architectures
  1296. in which function addresses are always even, according to
  1297. @code{FUNCTION_BOUNDARY}, GCC will automatically define this macro to
  1298. @code{ptrmemfunc_vbit_in_pfn}.
  1299. @end defmac
  1300. @defmac TARGET_VTABLE_USES_DESCRIPTORS
  1301. Normally, the C++ compiler uses function pointers in vtables. This
  1302. macro allows the target to change to use ``function descriptors''
  1303. instead. Function descriptors are found on targets for whom a
  1304. function pointer is actually a small data structure. Normally the
  1305. data structure consists of the actual code address plus a data
  1306. pointer to which the function's data is relative.
  1307. If vtables are used, the value of this macro should be the number
  1308. of words that the function descriptor occupies.
  1309. @end defmac
  1310. @defmac TARGET_VTABLE_ENTRY_ALIGN
  1311. By default, the vtable entries are void pointers, the so the alignment
  1312. is the same as pointer alignment. The value of this macro specifies
  1313. the alignment of the vtable entry in bits. It should be defined only
  1314. when special alignment is necessary. */
  1315. @end defmac
  1316. @defmac TARGET_VTABLE_DATA_ENTRY_DISTANCE
  1317. There are a few non-descriptor entries in the vtable at offsets below
  1318. zero. If these entries must be padded (say, to preserve the alignment
  1319. specified by @code{TARGET_VTABLE_ENTRY_ALIGN}), set this to the number
  1320. of words in each data entry.
  1321. @end defmac
  1322. @node Registers
  1323. @section Register Usage
  1324. @cindex register usage
  1325. This section explains how to describe what registers the target machine
  1326. has, and how (in general) they can be used.
  1327. The description of which registers a specific instruction can use is
  1328. done with register classes; see @ref{Register Classes}. For information
  1329. on using registers to access a stack frame, see @ref{Frame Registers}.
  1330. For passing values in registers, see @ref{Register Arguments}.
  1331. For returning values in registers, see @ref{Scalar Return}.
  1332. @menu
  1333. * Register Basics:: Number and kinds of registers.
  1334. * Allocation Order:: Order in which registers are allocated.
  1335. * Values in Registers:: What kinds of values each reg can hold.
  1336. * Leaf Functions:: Renumbering registers for leaf functions.
  1337. * Stack Registers:: Handling a register stack such as 80387.
  1338. @end menu
  1339. @node Register Basics
  1340. @subsection Basic Characteristics of Registers
  1341. @c prevent bad page break with this line
  1342. Registers have various characteristics.
  1343. @defmac FIRST_PSEUDO_REGISTER
  1344. Number of hardware registers known to the compiler. They receive
  1345. numbers 0 through @code{FIRST_PSEUDO_REGISTER-1}; thus, the first
  1346. pseudo register's number really is assigned the number
  1347. @code{FIRST_PSEUDO_REGISTER}.
  1348. @end defmac
  1349. @defmac FIXED_REGISTERS
  1350. @cindex fixed register
  1351. An initializer that says which registers are used for fixed purposes
  1352. all throughout the compiled code and are therefore not available for
  1353. general allocation. These would include the stack pointer, the frame
  1354. pointer (except on machines where that can be used as a general
  1355. register when no frame pointer is needed), the program counter on
  1356. machines where that is considered one of the addressable registers,
  1357. and any other numbered register with a standard use.
  1358. This information is expressed as a sequence of numbers, separated by
  1359. commas and surrounded by braces. The @var{n}th number is 1 if
  1360. register @var{n} is fixed, 0 otherwise.
  1361. The table initialized from this macro, and the table initialized by
  1362. the following one, may be overridden at run time either automatically,
  1363. by the actions of the macro @code{CONDITIONAL_REGISTER_USAGE}, or by
  1364. the user with the command options @option{-ffixed-@var{reg}},
  1365. @option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}}.
  1366. @end defmac
  1367. @defmac CALL_USED_REGISTERS
  1368. @cindex call-used register
  1369. @cindex call-clobbered register
  1370. @cindex call-saved register
  1371. Like @code{FIXED_REGISTERS} but has 1 for each register that is
  1372. clobbered (in general) by function calls as well as for fixed
  1373. registers. This macro therefore identifies the registers that are not
  1374. available for general allocation of values that must live across
  1375. function calls.
  1376. If a register has 0 in @code{CALL_USED_REGISTERS}, the compiler
  1377. automatically saves it on function entry and restores it on function
  1378. exit, if the register is used within the function.
  1379. @end defmac
  1380. @defmac CALL_REALLY_USED_REGISTERS
  1381. @cindex call-used register
  1382. @cindex call-clobbered register
  1383. @cindex call-saved register
  1384. Like @code{CALL_USED_REGISTERS} except this macro doesn't require
  1385. that the entire set of @code{FIXED_REGISTERS} be included.
  1386. (@code{CALL_USED_REGISTERS} must be a superset of @code{FIXED_REGISTERS}).
  1387. This macro is optional. If not specified, it defaults to the value
  1388. of @code{CALL_USED_REGISTERS}.
  1389. @end defmac
  1390. @defmac HARD_REGNO_CALL_PART_CLOBBERED (@var{regno}, @var{mode})
  1391. @cindex call-used register
  1392. @cindex call-clobbered register
  1393. @cindex call-saved register
  1394. A C expression that is nonzero if it is not permissible to store a
  1395. value of mode @var{mode} in hard register number @var{regno} across a
  1396. call without some part of it being clobbered. For most machines this
  1397. macro need not be defined. It is only required for machines that do not
  1398. preserve the entire contents of a register across a call.
  1399. @end defmac
  1400. @findex fixed_regs
  1401. @findex call_used_regs
  1402. @findex global_regs
  1403. @findex reg_names
  1404. @findex reg_class_contents
  1405. @hook TARGET_CONDITIONAL_REGISTER_USAGE
  1406. @defmac INCOMING_REGNO (@var{out})
  1407. Define this macro if the target machine has register windows. This C
  1408. expression returns the register number as seen by the called function
  1409. corresponding to the register number @var{out} as seen by the calling
  1410. function. Return @var{out} if register number @var{out} is not an
  1411. outbound register.
  1412. @end defmac
  1413. @defmac OUTGOING_REGNO (@var{in})
  1414. Define this macro if the target machine has register windows. This C
  1415. expression returns the register number as seen by the calling function
  1416. corresponding to the register number @var{in} as seen by the called
  1417. function. Return @var{in} if register number @var{in} is not an inbound
  1418. register.
  1419. @end defmac
  1420. @defmac LOCAL_REGNO (@var{regno})
  1421. Define this macro if the target machine has register windows. This C
  1422. expression returns true if the register is call-saved but is in the
  1423. register window. Unlike most call-saved registers, such registers
  1424. need not be explicitly restored on function exit or during non-local
  1425. gotos.
  1426. @end defmac
  1427. @defmac PC_REGNUM
  1428. If the program counter has a register number, define this as that
  1429. register number. Otherwise, do not define it.
  1430. @end defmac
  1431. @node Allocation Order
  1432. @subsection Order of Allocation of Registers
  1433. @cindex order of register allocation
  1434. @cindex register allocation order
  1435. @c prevent bad page break with this line
  1436. Registers are allocated in order.
  1437. @defmac REG_ALLOC_ORDER
  1438. If defined, an initializer for a vector of integers, containing the
  1439. numbers of hard registers in the order in which GCC should prefer
  1440. to use them (from most preferred to least).
  1441. If this macro is not defined, registers are used lowest numbered first
  1442. (all else being equal).
  1443. One use of this macro is on machines where the highest numbered
  1444. registers must always be saved and the save-multiple-registers
  1445. instruction supports only sequences of consecutive registers. On such
  1446. machines, define @code{REG_ALLOC_ORDER} to be an initializer that lists
  1447. the highest numbered allocable register first.
  1448. @end defmac
  1449. @defmac ADJUST_REG_ALLOC_ORDER
  1450. A C statement (sans semicolon) to choose the order in which to allocate
  1451. hard registers for pseudo-registers local to a basic block.
  1452. Store the desired register order in the array @code{reg_alloc_order}.
  1453. Element 0 should be the register to allocate first; element 1, the next
  1454. register; and so on.
  1455. The macro body should not assume anything about the contents of
  1456. @code{reg_alloc_order} before execution of the macro.
  1457. On most machines, it is not necessary to define this macro.
  1458. @end defmac
  1459. @defmac HONOR_REG_ALLOC_ORDER
  1460. Normally, IRA tries to estimate the costs for saving a register in the
  1461. prologue and restoring it in the epilogue. This discourages it from
  1462. using call-saved registers. If a machine wants to ensure that IRA
  1463. allocates registers in the order given by REG_ALLOC_ORDER even if some
  1464. call-saved registers appear earlier than call-used ones, then define this
  1465. macro as a C expression to nonzero. Default is 0.
  1466. @end defmac
  1467. @defmac IRA_HARD_REGNO_ADD_COST_MULTIPLIER (@var{regno})
  1468. In some case register allocation order is not enough for the
  1469. Integrated Register Allocator (@acronym{IRA}) to generate a good code.
  1470. If this macro is defined, it should return a floating point value
  1471. based on @var{regno}. The cost of using @var{regno} for a pseudo will
  1472. be increased by approximately the pseudo's usage frequency times the
  1473. value returned by this macro. Not defining this macro is equivalent
  1474. to having it always return @code{0.0}.
  1475. On most machines, it is not necessary to define this macro.
  1476. @end defmac
  1477. @node Values in Registers
  1478. @subsection How Values Fit in Registers
  1479. This section discusses the macros that describe which kinds of values
  1480. (specifically, which machine modes) each register can hold, and how many
  1481. consecutive registers are needed for a given mode.
  1482. @defmac HARD_REGNO_NREGS (@var{regno}, @var{mode})
  1483. A C expression for the number of consecutive hard registers, starting
  1484. at register number @var{regno}, required to hold a value of mode
  1485. @var{mode}. This macro must never return zero, even if a register
  1486. cannot hold the requested mode - indicate that with HARD_REGNO_MODE_OK
  1487. and/or CANNOT_CHANGE_MODE_CLASS instead.
  1488. On a machine where all registers are exactly one word, a suitable
  1489. definition of this macro is
  1490. @smallexample
  1491. #define HARD_REGNO_NREGS(REGNO, MODE) \
  1492. ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
  1493. / UNITS_PER_WORD)
  1494. @end smallexample
  1495. @end defmac
  1496. @defmac HARD_REGNO_NREGS_HAS_PADDING (@var{regno}, @var{mode})
  1497. A C expression that is nonzero if a value of mode @var{mode}, stored
  1498. in memory, ends with padding that causes it to take up more space than
  1499. in registers starting at register number @var{regno} (as determined by
  1500. multiplying GCC's notion of the size of the register when containing
  1501. this mode by the number of registers returned by
  1502. @code{HARD_REGNO_NREGS}). By default this is zero.
  1503. For example, if a floating-point value is stored in three 32-bit
  1504. registers but takes up 128 bits in memory, then this would be
  1505. nonzero.
  1506. This macros only needs to be defined if there are cases where
  1507. @code{subreg_get_info}
  1508. would otherwise wrongly determine that a @code{subreg} can be
  1509. represented by an offset to the register number, when in fact such a
  1510. @code{subreg} would contain some of the padding not stored in
  1511. registers and so not be representable.
  1512. @end defmac
  1513. @defmac HARD_REGNO_NREGS_WITH_PADDING (@var{regno}, @var{mode})
  1514. For values of @var{regno} and @var{mode} for which
  1515. @code{HARD_REGNO_NREGS_HAS_PADDING} returns nonzero, a C expression
  1516. returning the greater number of registers required to hold the value
  1517. including any padding. In the example above, the value would be four.
  1518. @end defmac
  1519. @defmac REGMODE_NATURAL_SIZE (@var{mode})
  1520. Define this macro if the natural size of registers that hold values
  1521. of mode @var{mode} is not the word size. It is a C expression that
  1522. should give the natural size in bytes for the specified mode. It is
  1523. used by the register allocator to try to optimize its results. This
  1524. happens for example on SPARC 64-bit where the natural size of
  1525. floating-point registers is still 32-bit.
  1526. @end defmac
  1527. @defmac HARD_REGNO_MODE_OK (@var{regno}, @var{mode})
  1528. A C expression that is nonzero if it is permissible to store a value
  1529. of mode @var{mode} in hard register number @var{regno} (or in several
  1530. registers starting with that one). For a machine where all registers
  1531. are equivalent, a suitable definition is
  1532. @smallexample
  1533. #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
  1534. @end smallexample
  1535. You need not include code to check for the numbers of fixed registers,
  1536. because the allocation mechanism considers them to be always occupied.
  1537. @cindex register pairs
  1538. On some machines, double-precision values must be kept in even/odd
  1539. register pairs. You can implement that by defining this macro to reject
  1540. odd register numbers for such modes.
  1541. The minimum requirement for a mode to be OK in a register is that the
  1542. @samp{mov@var{mode}} instruction pattern support moves between the
  1543. register and other hard register in the same class and that moving a
  1544. value into the register and back out not alter it.
  1545. Since the same instruction used to move @code{word_mode} will work for
  1546. all narrower integer modes, it is not necessary on any machine for
  1547. @code{HARD_REGNO_MODE_OK} to distinguish between these modes, provided
  1548. you define patterns @samp{movhi}, etc., to take advantage of this. This
  1549. is useful because of the interaction between @code{HARD_REGNO_MODE_OK}
  1550. and @code{MODES_TIEABLE_P}; it is very desirable for all integer modes
  1551. to be tieable.
  1552. Many machines have special registers for floating point arithmetic.
  1553. Often people assume that floating point machine modes are allowed only
  1554. in floating point registers. This is not true. Any registers that
  1555. can hold integers can safely @emph{hold} a floating point machine
  1556. mode, whether or not floating arithmetic can be done on it in those
  1557. registers. Integer move instructions can be used to move the values.
  1558. On some machines, though, the converse is true: fixed-point machine
  1559. modes may not go in floating registers. This is true if the floating
  1560. registers normalize any value stored in them, because storing a
  1561. non-floating value there would garble it. In this case,
  1562. @code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes in
  1563. floating registers. But if the floating registers do not automatically
  1564. normalize, if you can store any bit pattern in one and retrieve it
  1565. unchanged without a trap, then any machine mode may go in a floating
  1566. register, so you can define this macro to say so.
  1567. The primary significance of special floating registers is rather that
  1568. they are the registers acceptable in floating point arithmetic
  1569. instructions. However, this is of no concern to
  1570. @code{HARD_REGNO_MODE_OK}. You handle it by writing the proper
  1571. constraints for those instructions.
  1572. On some machines, the floating registers are especially slow to access,
  1573. so that it is better to store a value in a stack frame than in such a
  1574. register if floating point arithmetic is not being done. As long as the
  1575. floating registers are not in class @code{GENERAL_REGS}, they will not
  1576. be used unless some pattern's constraint asks for one.
  1577. @end defmac
  1578. @defmac HARD_REGNO_RENAME_OK (@var{from}, @var{to})
  1579. A C expression that is nonzero if it is OK to rename a hard register
  1580. @var{from} to another hard register @var{to}.
  1581. One common use of this macro is to prevent renaming of a register to
  1582. another register that is not saved by a prologue in an interrupt
  1583. handler.
  1584. The default is always nonzero.
  1585. @end defmac
  1586. @defmac MODES_TIEABLE_P (@var{mode1}, @var{mode2})
  1587. A C expression that is nonzero if a value of mode
  1588. @var{mode1} is accessible in mode @var{mode2} without copying.
  1589. If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
  1590. @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are always the same for
  1591. any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1}, @var{mode2})}
  1592. should be nonzero. If they differ for any @var{r}, you should define
  1593. this macro to return zero unless some other mechanism ensures the
  1594. accessibility of the value in a narrower mode.
  1595. You should define this macro to return nonzero in as many cases as
  1596. possible since doing so will allow GCC to perform better register
  1597. allocation.
  1598. @end defmac
  1599. @hook TARGET_HARD_REGNO_SCRATCH_OK
  1600. @defmac AVOID_CCMODE_COPIES
  1601. Define this macro if the compiler should avoid copies to/from @code{CCmode}
  1602. registers. You should only define this macro if support for copying to/from
  1603. @code{CCmode} is incomplete.
  1604. @end defmac
  1605. @node Leaf Functions
  1606. @subsection Handling Leaf Functions
  1607. @cindex leaf functions
  1608. @cindex functions, leaf
  1609. On some machines, a leaf function (i.e., one which makes no calls) can run
  1610. more efficiently if it does not make its own register window. Often this
  1611. means it is required to receive its arguments in the registers where they
  1612. are passed by the caller, instead of the registers where they would
  1613. normally arrive.
  1614. The special treatment for leaf functions generally applies only when
  1615. other conditions are met; for example, often they may use only those
  1616. registers for its own variables and temporaries. We use the term ``leaf
  1617. function'' to mean a function that is suitable for this special
  1618. handling, so that functions with no calls are not necessarily ``leaf
  1619. functions''.
  1620. GCC assigns register numbers before it knows whether the function is
  1621. suitable for leaf function treatment. So it needs to renumber the
  1622. registers in order to output a leaf function. The following macros
  1623. accomplish this.
  1624. @defmac LEAF_REGISTERS
  1625. Name of a char vector, indexed by hard register number, which
  1626. contains 1 for a register that is allowable in a candidate for leaf
  1627. function treatment.
  1628. If leaf function treatment involves renumbering the registers, then the
  1629. registers marked here should be the ones before renumbering---those that
  1630. GCC would ordinarily allocate. The registers which will actually be
  1631. used in the assembler code, after renumbering, should not be marked with 1
  1632. in this vector.
  1633. Define this macro only if the target machine offers a way to optimize
  1634. the treatment of leaf functions.
  1635. @end defmac
  1636. @defmac LEAF_REG_REMAP (@var{regno})
  1637. A C expression whose value is the register number to which @var{regno}
  1638. should be renumbered, when a function is treated as a leaf function.
  1639. If @var{regno} is a register number which should not appear in a leaf
  1640. function before renumbering, then the expression should yield @minus{}1, which
  1641. will cause the compiler to abort.
  1642. Define this macro only if the target machine offers a way to optimize the
  1643. treatment of leaf functions, and registers need to be renumbered to do
  1644. this.
  1645. @end defmac
  1646. @findex current_function_is_leaf
  1647. @findex current_function_uses_only_leaf_regs
  1648. @code{TARGET_ASM_FUNCTION_PROLOGUE} and
  1649. @code{TARGET_ASM_FUNCTION_EPILOGUE} must usually treat leaf functions
  1650. specially. They can test the C variable @code{current_function_is_leaf}
  1651. which is nonzero for leaf functions. @code{current_function_is_leaf} is
  1652. set prior to local register allocation and is valid for the remaining
  1653. compiler passes. They can also test the C variable
  1654. @code{current_function_uses_only_leaf_regs} which is nonzero for leaf
  1655. functions which only use leaf registers.
  1656. @code{current_function_uses_only_leaf_regs} is valid after all passes
  1657. that modify the instructions have been run and is only useful if
  1658. @code{LEAF_REGISTERS} is defined.
  1659. @c changed this to fix overfull. ALSO: why the "it" at the beginning
  1660. @c of the next paragraph?! --mew 2feb93
  1661. @node Stack Registers
  1662. @subsection Registers That Form a Stack
  1663. There are special features to handle computers where some of the
  1664. ``registers'' form a stack. Stack registers are normally written by
  1665. pushing onto the stack, and are numbered relative to the top of the
  1666. stack.
  1667. Currently, GCC can only handle one group of stack-like registers, and
  1668. they must be consecutively numbered. Furthermore, the existing
  1669. support for stack-like registers is specific to the 80387 floating
  1670. point coprocessor. If you have a new architecture that uses
  1671. stack-like registers, you will need to do substantial work on
  1672. @file{reg-stack.c} and write your machine description to cooperate
  1673. with it, as well as defining these macros.
  1674. @defmac STACK_REGS
  1675. Define this if the machine has any stack-like registers.
  1676. @end defmac
  1677. @defmac STACK_REG_COVER_CLASS
  1678. This is a cover class containing the stack registers. Define this if
  1679. the machine has any stack-like registers.
  1680. @end defmac
  1681. @defmac FIRST_STACK_REG
  1682. The number of the first stack-like register. This one is the top
  1683. of the stack.
  1684. @end defmac
  1685. @defmac LAST_STACK_REG
  1686. The number of the last stack-like register. This one is the bottom of
  1687. the stack.
  1688. @end defmac
  1689. @node Register Classes
  1690. @section Register Classes
  1691. @cindex register class definitions
  1692. @cindex class definitions, register
  1693. On many machines, the numbered registers are not all equivalent.
  1694. For example, certain registers may not be allowed for indexed addressing;
  1695. certain registers may not be allowed in some instructions. These machine
  1696. restrictions are described to the compiler using @dfn{register classes}.
  1697. You define a number of register classes, giving each one a name and saying
  1698. which of the registers belong to it. Then you can specify register classes
  1699. that are allowed as operands to particular instruction patterns.
  1700. @findex ALL_REGS
  1701. @findex NO_REGS
  1702. In general, each register will belong to several classes. In fact, one
  1703. class must be named @code{ALL_REGS} and contain all the registers. Another
  1704. class must be named @code{NO_REGS} and contain no registers. Often the
  1705. union of two classes will be another class; however, this is not required.
  1706. @findex GENERAL_REGS
  1707. One of the classes must be named @code{GENERAL_REGS}. There is nothing
  1708. terribly special about the name, but the operand constraint letters
  1709. @samp{r} and @samp{g} specify this class. If @code{GENERAL_REGS} is
  1710. the same as @code{ALL_REGS}, just define it as a macro which expands
  1711. to @code{ALL_REGS}.
  1712. Order the classes so that if class @var{x} is contained in class @var{y}
  1713. then @var{x} has a lower class number than @var{y}.
  1714. The way classes other than @code{GENERAL_REGS} are specified in operand
  1715. constraints is through machine-dependent operand constraint letters.
  1716. You can define such letters to correspond to various classes, then use
  1717. them in operand constraints.
  1718. You must define the narrowest register classes for allocatable
  1719. registers, so that each class either has no subclasses, or that for
  1720. some mode, the move cost between registers within the class is
  1721. cheaper than moving a register in the class to or from memory
  1722. (@pxref{Costs}).
  1723. You should define a class for the union of two classes whenever some
  1724. instruction allows both classes. For example, if an instruction allows
  1725. either a floating point (coprocessor) register or a general register for a
  1726. certain operand, you should define a class @code{FLOAT_OR_GENERAL_REGS}
  1727. which includes both of them. Otherwise you will get suboptimal code,
  1728. or even internal compiler errors when reload cannot find a register in the
  1729. class computed via @code{reg_class_subunion}.
  1730. You must also specify certain redundant information about the register
  1731. classes: for each class, which classes contain it and which ones are
  1732. contained in it; for each pair of classes, the largest class contained
  1733. in their union.
  1734. When a value occupying several consecutive registers is expected in a
  1735. certain class, all the registers used must belong to that class.
  1736. Therefore, register classes cannot be used to enforce a requirement for
  1737. a register pair to start with an even-numbered register. The way to
  1738. specify this requirement is with @code{HARD_REGNO_MODE_OK}.
  1739. Register classes used for input-operands of bitwise-and or shift
  1740. instructions have a special requirement: each such class must have, for
  1741. each fixed-point machine mode, a subclass whose registers can transfer that
  1742. mode to or from memory. For example, on some machines, the operations for
  1743. single-byte values (@code{QImode}) are limited to certain registers. When
  1744. this is so, each register class that is used in a bitwise-and or shift
  1745. instruction must have a subclass consisting of registers from which
  1746. single-byte values can be loaded or stored. This is so that
  1747. @code{PREFERRED_RELOAD_CLASS} can always have a possible value to return.
  1748. @deftp {Data type} {enum reg_class}
  1749. An enumerated type that must be defined with all the register class names
  1750. as enumerated values. @code{NO_REGS} must be first. @code{ALL_REGS}
  1751. must be the last register class, followed by one more enumerated value,
  1752. @code{LIM_REG_CLASSES}, which is not a register class but rather
  1753. tells how many classes there are.
  1754. Each register class has a number, which is the value of casting
  1755. the class name to type @code{int}. The number serves as an index
  1756. in many of the tables described below.
  1757. @end deftp
  1758. @defmac N_REG_CLASSES
  1759. The number of distinct register classes, defined as follows:
  1760. @smallexample
  1761. #define N_REG_CLASSES (int) LIM_REG_CLASSES
  1762. @end smallexample
  1763. @end defmac
  1764. @defmac REG_CLASS_NAMES
  1765. An initializer containing the names of the register classes as C string
  1766. constants. These names are used in writing some of the debugging dumps.
  1767. @end defmac
  1768. @defmac REG_CLASS_CONTENTS
  1769. An initializer containing the contents of the register classes, as integers
  1770. which are bit masks. The @var{n}th integer specifies the contents of class
  1771. @var{n}. The way the integer @var{mask} is interpreted is that
  1772. register @var{r} is in the class if @code{@var{mask} & (1 << @var{r})} is 1.
  1773. When the machine has more than 32 registers, an integer does not suffice.
  1774. Then the integers are replaced by sub-initializers, braced groupings containing
  1775. several integers. Each sub-initializer must be suitable as an initializer
  1776. for the type @code{HARD_REG_SET} which is defined in @file{hard-reg-set.h}.
  1777. In this situation, the first integer in each sub-initializer corresponds to
  1778. registers 0 through 31, the second integer to registers 32 through 63, and
  1779. so on.
  1780. @end defmac
  1781. @defmac REGNO_REG_CLASS (@var{regno})
  1782. A C expression whose value is a register class containing hard register
  1783. @var{regno}. In general there is more than one such class; choose a class
  1784. which is @dfn{minimal}, meaning that no smaller class also contains the
  1785. register.
  1786. @end defmac
  1787. @defmac BASE_REG_CLASS
  1788. A macro whose definition is the name of the class to which a valid
  1789. base register must belong. A base register is one used in an address
  1790. which is the register value plus a displacement.
  1791. @end defmac
  1792. @defmac MODE_BASE_REG_CLASS (@var{mode})
  1793. This is a variation of the @code{BASE_REG_CLASS} macro which allows
  1794. the selection of a base register in a mode dependent manner. If
  1795. @var{mode} is VOIDmode then it should return the same value as
  1796. @code{BASE_REG_CLASS}.
  1797. @end defmac
  1798. @defmac MODE_BASE_REG_REG_CLASS (@var{mode})
  1799. A C expression whose value is the register class to which a valid
  1800. base register must belong in order to be used in a base plus index
  1801. register address. You should define this macro if base plus index
  1802. addresses have different requirements than other base register uses.
  1803. @end defmac
  1804. @defmac MODE_CODE_BASE_REG_CLASS (@var{mode}, @var{address_space}, @var{outer_code}, @var{index_code})
  1805. A C expression whose value is the register class to which a valid
  1806. base register for a memory reference in mode @var{mode} to address
  1807. space @var{address_space} must belong. @var{outer_code} and @var{index_code}
  1808. define the context in which the base register occurs. @var{outer_code} is
  1809. the code of the immediately enclosing expression (@code{MEM} for the top level
  1810. of an address, @code{ADDRESS} for something that occurs in an
  1811. @code{address_operand}). @var{index_code} is the code of the corresponding
  1812. index expression if @var{outer_code} is @code{PLUS}; @code{SCRATCH} otherwise.
  1813. @end defmac
  1814. @defmac INDEX_REG_CLASS
  1815. A macro whose definition is the name of the class to which a valid
  1816. index register must belong. An index register is one used in an
  1817. address where its value is either multiplied by a scale factor or
  1818. added to another register (as well as added to a displacement).
  1819. @end defmac
  1820. @defmac REGNO_OK_FOR_BASE_P (@var{num})
  1821. A C expression which is nonzero if register number @var{num} is
  1822. suitable for use as a base register in operand addresses.
  1823. @end defmac
  1824. @defmac REGNO_MODE_OK_FOR_BASE_P (@var{num}, @var{mode})
  1825. A C expression that is just like @code{REGNO_OK_FOR_BASE_P}, except that
  1826. that expression may examine the mode of the memory reference in
  1827. @var{mode}. You should define this macro if the mode of the memory
  1828. reference affects whether a register may be used as a base register. If
  1829. you define this macro, the compiler will use it instead of
  1830. @code{REGNO_OK_FOR_BASE_P}. The mode may be @code{VOIDmode} for
  1831. addresses that appear outside a @code{MEM}, i.e., as an
  1832. @code{address_operand}.
  1833. @end defmac
  1834. @defmac REGNO_MODE_OK_FOR_REG_BASE_P (@var{num}, @var{mode})
  1835. A C expression which is nonzero if register number @var{num} is suitable for
  1836. use as a base register in base plus index operand addresses, accessing
  1837. memory in mode @var{mode}. It may be either a suitable hard register or a
  1838. pseudo register that has been allocated such a hard register. You should
  1839. define this macro if base plus index addresses have different requirements
  1840. than other base register uses.
  1841. Use of this macro is deprecated; please use the more general
  1842. @code{REGNO_MODE_CODE_OK_FOR_BASE_P}.
  1843. @end defmac
  1844. @defmac REGNO_MODE_CODE_OK_FOR_BASE_P (@var{num}, @var{mode}, @var{address_space}, @var{outer_code}, @var{index_code})
  1845. A C expression which is nonzero if register number @var{num} is
  1846. suitable for use as a base register in operand addresses, accessing
  1847. memory in mode @var{mode} in address space @var{address_space}.
  1848. This is similar to @code{REGNO_MODE_OK_FOR_BASE_P}, except
  1849. that that expression may examine the context in which the register
  1850. appears in the memory reference. @var{outer_code} is the code of the
  1851. immediately enclosing expression (@code{MEM} if at the top level of the
  1852. address, @code{ADDRESS} for something that occurs in an
  1853. @code{address_operand}). @var{index_code} is the code of the
  1854. corresponding index expression if @var{outer_code} is @code{PLUS};
  1855. @code{SCRATCH} otherwise. The mode may be @code{VOIDmode} for addresses
  1856. that appear outside a @code{MEM}, i.e., as an @code{address_operand}.
  1857. @end defmac
  1858. @defmac REGNO_OK_FOR_INDEX_P (@var{num})
  1859. A C expression which is nonzero if register number @var{num} is
  1860. suitable for use as an index register in operand addresses. It may be
  1861. either a suitable hard register or a pseudo register that has been
  1862. allocated such a hard register.
  1863. The difference between an index register and a base register is that
  1864. the index register may be scaled. If an address involves the sum of
  1865. two registers, neither one of them scaled, then either one may be
  1866. labeled the ``base'' and the other the ``index''; but whichever
  1867. labeling is used must fit the machine's constraints of which registers
  1868. may serve in each capacity. The compiler will try both labelings,
  1869. looking for one that is valid, and will reload one or both registers
  1870. only if neither labeling works.
  1871. @end defmac
  1872. @hook TARGET_PREFERRED_RENAME_CLASS
  1873. @hook TARGET_PREFERRED_RELOAD_CLASS
  1874. @defmac PREFERRED_RELOAD_CLASS (@var{x}, @var{class})
  1875. A C expression that places additional restrictions on the register class
  1876. to use when it is necessary to copy value @var{x} into a register in class
  1877. @var{class}. The value is a register class; perhaps @var{class}, or perhaps
  1878. another, smaller class. On many machines, the following definition is
  1879. safe:
  1880. @smallexample
  1881. #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
  1882. @end smallexample
  1883. Sometimes returning a more restrictive class makes better code. For
  1884. example, on the 68000, when @var{x} is an integer constant that is in range
  1885. for a @samp{moveq} instruction, the value of this macro is always
  1886. @code{DATA_REGS} as long as @var{class} includes the data registers.
  1887. Requiring a data register guarantees that a @samp{moveq} will be used.
  1888. One case where @code{PREFERRED_RELOAD_CLASS} must not return
  1889. @var{class} is if @var{x} is a legitimate constant which cannot be
  1890. loaded into some register class. By returning @code{NO_REGS} you can
  1891. force @var{x} into a memory location. For example, rs6000 can load
  1892. immediate values into general-purpose registers, but does not have an
  1893. instruction for loading an immediate value into a floating-point
  1894. register, so @code{PREFERRED_RELOAD_CLASS} returns @code{NO_REGS} when
  1895. @var{x} is a floating-point constant. If the constant can't be loaded
  1896. into any kind of register, code generation will be better if
  1897. @code{TARGET_LEGITIMATE_CONSTANT_P} makes the constant illegitimate instead
  1898. of using @code{TARGET_PREFERRED_RELOAD_CLASS}.
  1899. If an insn has pseudos in it after register allocation, reload will go
  1900. through the alternatives and call repeatedly @code{PREFERRED_RELOAD_CLASS}
  1901. to find the best one. Returning @code{NO_REGS}, in this case, makes
  1902. reload add a @code{!} in front of the constraint: the x86 back-end uses
  1903. this feature to discourage usage of 387 registers when math is done in
  1904. the SSE registers (and vice versa).
  1905. @end defmac
  1906. @hook TARGET_PREFERRED_OUTPUT_RELOAD_CLASS
  1907. @defmac LIMIT_RELOAD_CLASS (@var{mode}, @var{class})
  1908. A C expression that places additional restrictions on the register class
  1909. to use when it is necessary to be able to hold a value of mode
  1910. @var{mode} in a reload register for which class @var{class} would
  1911. ordinarily be used.
  1912. Unlike @code{PREFERRED_RELOAD_CLASS}, this macro should be used when
  1913. there are certain modes that simply can't go in certain reload classes.
  1914. The value is a register class; perhaps @var{class}, or perhaps another,
  1915. smaller class.
  1916. Don't define this macro unless the target machine has limitations which
  1917. require the macro to do something nontrivial.
  1918. @end defmac
  1919. @hook TARGET_SECONDARY_RELOAD
  1920. @defmac SECONDARY_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
  1921. @defmacx SECONDARY_INPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
  1922. @defmacx SECONDARY_OUTPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
  1923. These macros are obsolete, new ports should use the target hook
  1924. @code{TARGET_SECONDARY_RELOAD} instead.
  1925. These are obsolete macros, replaced by the @code{TARGET_SECONDARY_RELOAD}
  1926. target hook. Older ports still define these macros to indicate to the
  1927. reload phase that it may
  1928. need to allocate at least one register for a reload in addition to the
  1929. register to contain the data. Specifically, if copying @var{x} to a
  1930. register @var{class} in @var{mode} requires an intermediate register,
  1931. you were supposed to define @code{SECONDARY_INPUT_RELOAD_CLASS} to return the
  1932. largest register class all of whose registers can be used as
  1933. intermediate registers or scratch registers.
  1934. If copying a register @var{class} in @var{mode} to @var{x} requires an
  1935. intermediate or scratch register, @code{SECONDARY_OUTPUT_RELOAD_CLASS}
  1936. was supposed to be defined be defined to return the largest register
  1937. class required. If the
  1938. requirements for input and output reloads were the same, the macro
  1939. @code{SECONDARY_RELOAD_CLASS} should have been used instead of defining both
  1940. macros identically.
  1941. The values returned by these macros are often @code{GENERAL_REGS}.
  1942. Return @code{NO_REGS} if no spare register is needed; i.e., if @var{x}
  1943. can be directly copied to or from a register of @var{class} in
  1944. @var{mode} without requiring a scratch register. Do not define this
  1945. macro if it would always return @code{NO_REGS}.
  1946. If a scratch register is required (either with or without an
  1947. intermediate register), you were supposed to define patterns for
  1948. @samp{reload_in@var{m}} or @samp{reload_out@var{m}}, as required
  1949. (@pxref{Standard Names}. These patterns, which were normally
  1950. implemented with a @code{define_expand}, should be similar to the
  1951. @samp{mov@var{m}} patterns, except that operand 2 is the scratch
  1952. register.
  1953. These patterns need constraints for the reload register and scratch
  1954. register that
  1955. contain a single register class. If the original reload register (whose
  1956. class is @var{class}) can meet the constraint given in the pattern, the
  1957. value returned by these macros is used for the class of the scratch
  1958. register. Otherwise, two additional reload registers are required.
  1959. Their classes are obtained from the constraints in the insn pattern.
  1960. @var{x} might be a pseudo-register or a @code{subreg} of a
  1961. pseudo-register, which could either be in a hard register or in memory.
  1962. Use @code{true_regnum} to find out; it will return @minus{}1 if the pseudo is
  1963. in memory and the hard register number if it is in a register.
  1964. These macros should not be used in the case where a particular class of
  1965. registers can only be copied to memory and not to another class of
  1966. registers. In that case, secondary reload registers are not needed and
  1967. would not be helpful. Instead, a stack location must be used to perform
  1968. the copy and the @code{mov@var{m}} pattern should use memory as an
  1969. intermediate storage. This case often occurs between floating-point and
  1970. general registers.
  1971. @end defmac
  1972. @defmac SECONDARY_MEMORY_NEEDED (@var{class1}, @var{class2}, @var{m})
  1973. Certain machines have the property that some registers cannot be copied
  1974. to some other registers without using memory. Define this macro on
  1975. those machines to be a C expression that is nonzero if objects of mode
  1976. @var{m} in registers of @var{class1} can only be copied to registers of
  1977. class @var{class2} by storing a register of @var{class1} into memory
  1978. and loading that memory location into a register of @var{class2}.
  1979. Do not define this macro if its value would always be zero.
  1980. @end defmac
  1981. @defmac SECONDARY_MEMORY_NEEDED_RTX (@var{mode})
  1982. Normally when @code{SECONDARY_MEMORY_NEEDED} is defined, the compiler
  1983. allocates a stack slot for a memory location needed for register copies.
  1984. If this macro is defined, the compiler instead uses the memory location
  1985. defined by this macro.
  1986. Do not define this macro if you do not define
  1987. @code{SECONDARY_MEMORY_NEEDED}.
  1988. @end defmac
  1989. @defmac SECONDARY_MEMORY_NEEDED_MODE (@var{mode})
  1990. When the compiler needs a secondary memory location to copy between two
  1991. registers of mode @var{mode}, it normally allocates sufficient memory to
  1992. hold a quantity of @code{BITS_PER_WORD} bits and performs the store and
  1993. load operations in a mode that many bits wide and whose class is the
  1994. same as that of @var{mode}.
  1995. This is right thing to do on most machines because it ensures that all
  1996. bits of the register are copied and prevents accesses to the registers
  1997. in a narrower mode, which some machines prohibit for floating-point
  1998. registers.
  1999. However, this default behavior is not correct on some machines, such as
  2000. the DEC Alpha, that store short integers in floating-point registers
  2001. differently than in integer registers. On those machines, the default
  2002. widening will not work correctly and you must define this macro to
  2003. suppress that widening in some cases. See the file @file{alpha.h} for
  2004. details.
  2005. Do not define this macro if you do not define
  2006. @code{SECONDARY_MEMORY_NEEDED} or if widening @var{mode} to a mode that
  2007. is @code{BITS_PER_WORD} bits wide is correct for your machine.
  2008. @end defmac
  2009. @hook TARGET_CLASS_LIKELY_SPILLED_P
  2010. @hook TARGET_CLASS_MAX_NREGS
  2011. @defmac CLASS_MAX_NREGS (@var{class}, @var{mode})
  2012. A C expression for the maximum number of consecutive registers
  2013. of class @var{class} needed to hold a value of mode @var{mode}.
  2014. This is closely related to the macro @code{HARD_REGNO_NREGS}. In fact,
  2015. the value of the macro @code{CLASS_MAX_NREGS (@var{class}, @var{mode})}
  2016. should be the maximum value of @code{HARD_REGNO_NREGS (@var{regno},
  2017. @var{mode})} for all @var{regno} values in the class @var{class}.
  2018. This macro helps control the handling of multiple-word values
  2019. in the reload pass.
  2020. @end defmac
  2021. @defmac CANNOT_CHANGE_MODE_CLASS (@var{from}, @var{to}, @var{class})
  2022. If defined, a C expression that returns nonzero for a @var{class} for which
  2023. a change from mode @var{from} to mode @var{to} is invalid.
  2024. For the example, loading 32-bit integer or floating-point objects into
  2025. floating-point registers on the Alpha extends them to 64 bits.
  2026. Therefore loading a 64-bit object and then storing it as a 32-bit object
  2027. does not store the low-order 32 bits, as would be the case for a normal
  2028. register. Therefore, @file{alpha.h} defines @code{CANNOT_CHANGE_MODE_CLASS}
  2029. as below:
  2030. @smallexample
  2031. #define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
  2032. (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \
  2033. ? reg_classes_intersect_p (FLOAT_REGS, (CLASS)) : 0)
  2034. @end smallexample
  2035. @end defmac
  2036. @hook TARGET_LRA_P
  2037. @hook TARGET_REGISTER_PRIORITY
  2038. @hook TARGET_REGISTER_USAGE_LEVELING_P
  2039. @hook TARGET_DIFFERENT_ADDR_DISPLACEMENT_P
  2040. @hook TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P
  2041. @hook TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT
  2042. @hook TARGET_SPILL_CLASS
  2043. @hook TARGET_CSTORE_MODE
  2044. @node Stack and Calling
  2045. @section Stack Layout and Calling Conventions
  2046. @cindex calling conventions
  2047. @c prevent bad page break with this line
  2048. This describes the stack layout and calling conventions.
  2049. @menu
  2050. * Frame Layout::
  2051. * Exception Handling::
  2052. * Stack Checking::
  2053. * Frame Registers::
  2054. * Elimination::
  2055. * Stack Arguments::
  2056. * Register Arguments::
  2057. * Scalar Return::
  2058. * Aggregate Return::
  2059. * Caller Saves::
  2060. * Function Entry::
  2061. * Profiling::
  2062. * Tail Calls::
  2063. * Stack Smashing Protection::
  2064. * Miscellaneous Register Hooks::
  2065. @end menu
  2066. @node Frame Layout
  2067. @subsection Basic Stack Layout
  2068. @cindex stack frame layout
  2069. @cindex frame layout
  2070. @c prevent bad page break with this line
  2071. Here is the basic stack layout.
  2072. @defmac STACK_GROWS_DOWNWARD
  2073. Define this macro if pushing a word onto the stack moves the stack
  2074. pointer to a smaller address.
  2075. When we say, ``define this macro if @dots{}'', it means that the
  2076. compiler checks this macro only with @code{#ifdef} so the precise
  2077. definition used does not matter.
  2078. @end defmac
  2079. @defmac STACK_PUSH_CODE
  2080. This macro defines the operation used when something is pushed
  2081. on the stack. In RTL, a push operation will be
  2082. @code{(set (mem (STACK_PUSH_CODE (reg sp))) @dots{})}
  2083. The choices are @code{PRE_DEC}, @code{POST_DEC}, @code{PRE_INC},
  2084. and @code{POST_INC}. Which of these is correct depends on
  2085. the stack direction and on whether the stack pointer points
  2086. to the last item on the stack or whether it points to the
  2087. space for the next item on the stack.
  2088. The default is @code{PRE_DEC} when @code{STACK_GROWS_DOWNWARD} is
  2089. defined, which is almost always right, and @code{PRE_INC} otherwise,
  2090. which is often wrong.
  2091. @end defmac
  2092. @defmac FRAME_GROWS_DOWNWARD
  2093. Define this macro to nonzero value if the addresses of local variable slots
  2094. are at negative offsets from the frame pointer.
  2095. @end defmac
  2096. @defmac ARGS_GROW_DOWNWARD
  2097. Define this macro if successive arguments to a function occupy decreasing
  2098. addresses on the stack.
  2099. @end defmac
  2100. @defmac STARTING_FRAME_OFFSET
  2101. Offset from the frame pointer to the first local variable slot to be allocated.
  2102. If @code{FRAME_GROWS_DOWNWARD}, find the next slot's offset by
  2103. subtracting the first slot's length from @code{STARTING_FRAME_OFFSET}.
  2104. Otherwise, it is found by adding the length of the first slot to the
  2105. value @code{STARTING_FRAME_OFFSET}.
  2106. @c i'm not sure if the above is still correct.. had to change it to get
  2107. @c rid of an overfull. --mew 2feb93
  2108. @end defmac
  2109. @defmac STACK_ALIGNMENT_NEEDED
  2110. Define to zero to disable final alignment of the stack during reload.
  2111. The nonzero default for this macro is suitable for most ports.
  2112. On ports where @code{STARTING_FRAME_OFFSET} is nonzero or where there
  2113. is a register save block following the local block that doesn't require
  2114. alignment to @code{STACK_BOUNDARY}, it may be beneficial to disable
  2115. stack alignment and do it in the backend.
  2116. @end defmac
  2117. @defmac STACK_POINTER_OFFSET
  2118. Offset from the stack pointer register to the first location at which
  2119. outgoing arguments are placed. If not specified, the default value of
  2120. zero is used. This is the proper value for most machines.
  2121. If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
  2122. the first location at which outgoing arguments are placed.
  2123. @end defmac
  2124. @defmac FIRST_PARM_OFFSET (@var{fundecl})
  2125. Offset from the argument pointer register to the first argument's
  2126. address. On some machines it may depend on the data type of the
  2127. function.
  2128. If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
  2129. the first argument's address.
  2130. @end defmac
  2131. @defmac STACK_DYNAMIC_OFFSET (@var{fundecl})
  2132. Offset from the stack pointer register to an item dynamically allocated
  2133. on the stack, e.g., by @code{alloca}.
  2134. The default value for this macro is @code{STACK_POINTER_OFFSET} plus the
  2135. length of the outgoing arguments. The default is correct for most
  2136. machines. See @file{function.c} for details.
  2137. @end defmac
  2138. @defmac INITIAL_FRAME_ADDRESS_RTX
  2139. A C expression whose value is RTL representing the address of the initial
  2140. stack frame. This address is passed to @code{RETURN_ADDR_RTX} and
  2141. @code{DYNAMIC_CHAIN_ADDRESS}. If you don't define this macro, a reasonable
  2142. default value will be used. Define this macro in order to make frame pointer
  2143. elimination work in the presence of @code{__builtin_frame_address (count)} and
  2144. @code{__builtin_return_address (count)} for @code{count} not equal to zero.
  2145. @end defmac
  2146. @defmac DYNAMIC_CHAIN_ADDRESS (@var{frameaddr})
  2147. A C expression whose value is RTL representing the address in a stack
  2148. frame where the pointer to the caller's frame is stored. Assume that
  2149. @var{frameaddr} is an RTL expression for the address of the stack frame
  2150. itself.
  2151. If you don't define this macro, the default is to return the value
  2152. of @var{frameaddr}---that is, the stack frame address is also the
  2153. address of the stack word that points to the previous frame.
  2154. @end defmac
  2155. @defmac SETUP_FRAME_ADDRESSES
  2156. If defined, a C expression that produces the machine-specific code to
  2157. setup the stack so that arbitrary frames can be accessed. For example,
  2158. on the SPARC, we must flush all of the register windows to the stack
  2159. before we can access arbitrary stack frames. You will seldom need to
  2160. define this macro.
  2161. @end defmac
  2162. @hook TARGET_BUILTIN_SETJMP_FRAME_VALUE
  2163. @defmac FRAME_ADDR_RTX (@var{frameaddr})
  2164. A C expression whose value is RTL representing the value of the frame
  2165. address for the current frame. @var{frameaddr} is the frame pointer
  2166. of the current frame. This is used for __builtin_frame_address.
  2167. You need only define this macro if the frame address is not the same
  2168. as the frame pointer. Most machines do not need to define it.
  2169. @end defmac
  2170. @defmac RETURN_ADDR_RTX (@var{count}, @var{frameaddr})
  2171. A C expression whose value is RTL representing the value of the return
  2172. address for the frame @var{count} steps up from the current frame, after
  2173. the prologue. @var{frameaddr} is the frame pointer of the @var{count}
  2174. frame, or the frame pointer of the @var{count} @minus{} 1 frame if
  2175. @code{RETURN_ADDR_IN_PREVIOUS_FRAME} is nonzero.
  2176. The value of the expression must always be the correct address when
  2177. @var{count} is zero, but may be @code{NULL_RTX} if there is no way to
  2178. determine the return address of other frames.
  2179. @end defmac
  2180. @defmac RETURN_ADDR_IN_PREVIOUS_FRAME
  2181. Define this macro to nonzero value if the return address of a particular
  2182. stack frame is accessed from the frame pointer of the previous stack
  2183. frame. The zero default for this macro is suitable for most ports.
  2184. @end defmac
  2185. @defmac INCOMING_RETURN_ADDR_RTX
  2186. A C expression whose value is RTL representing the location of the
  2187. incoming return address at the beginning of any function, before the
  2188. prologue. This RTL is either a @code{REG}, indicating that the return
  2189. value is saved in @samp{REG}, or a @code{MEM} representing a location in
  2190. the stack.
  2191. You only need to define this macro if you want to support call frame
  2192. debugging information like that provided by DWARF 2.
  2193. If this RTL is a @code{REG}, you should also define
  2194. @code{DWARF_FRAME_RETURN_COLUMN} to @code{DWARF_FRAME_REGNUM (REGNO)}.
  2195. @end defmac
  2196. @defmac DWARF_ALT_FRAME_RETURN_COLUMN
  2197. A C expression whose value is an integer giving a DWARF 2 column
  2198. number that may be used as an alternative return column. The column
  2199. must not correspond to any gcc hard register (that is, it must not
  2200. be in the range of @code{DWARF_FRAME_REGNUM}).
  2201. This macro can be useful if @code{DWARF_FRAME_RETURN_COLUMN} is set to a
  2202. general register, but an alternative column needs to be used for signal
  2203. frames. Some targets have also used different frame return columns
  2204. over time.
  2205. @end defmac
  2206. @defmac DWARF_ZERO_REG
  2207. A C expression whose value is an integer giving a DWARF 2 register
  2208. number that is considered to always have the value zero. This should
  2209. only be defined if the target has an architected zero register, and
  2210. someone decided it was a good idea to use that register number to
  2211. terminate the stack backtrace. New ports should avoid this.
  2212. @end defmac
  2213. @hook TARGET_DWARF_HANDLE_FRAME_UNSPEC
  2214. @defmac INCOMING_FRAME_SP_OFFSET
  2215. A C expression whose value is an integer giving the offset, in bytes,
  2216. from the value of the stack pointer register to the top of the stack
  2217. frame at the beginning of any function, before the prologue. The top of
  2218. the frame is defined to be the value of the stack pointer in the
  2219. previous frame, just before the call instruction.
  2220. You only need to define this macro if you want to support call frame
  2221. debugging information like that provided by DWARF 2.
  2222. @end defmac
  2223. @defmac ARG_POINTER_CFA_OFFSET (@var{fundecl})
  2224. A C expression whose value is an integer giving the offset, in bytes,
  2225. from the argument pointer to the canonical frame address (cfa). The
  2226. final value should coincide with that calculated by
  2227. @code{INCOMING_FRAME_SP_OFFSET}. Which is unfortunately not usable
  2228. during virtual register instantiation.
  2229. The default value for this macro is
  2230. @code{FIRST_PARM_OFFSET (fundecl) + crtl->args.pretend_args_size},
  2231. which is correct for most machines; in general, the arguments are found
  2232. immediately before the stack frame. Note that this is not the case on
  2233. some targets that save registers into the caller's frame, such as SPARC
  2234. and rs6000, and so such targets need to define this macro.
  2235. You only need to define this macro if the default is incorrect, and you
  2236. want to support call frame debugging information like that provided by
  2237. DWARF 2.
  2238. @end defmac
  2239. @defmac FRAME_POINTER_CFA_OFFSET (@var{fundecl})
  2240. If defined, a C expression whose value is an integer giving the offset
  2241. in bytes from the frame pointer to the canonical frame address (cfa).
  2242. The final value should coincide with that calculated by
  2243. @code{INCOMING_FRAME_SP_OFFSET}.
  2244. Normally the CFA is calculated as an offset from the argument pointer,
  2245. via @code{ARG_POINTER_CFA_OFFSET}, but if the argument pointer is
  2246. variable due to the ABI, this may not be possible. If this macro is
  2247. defined, it implies that the virtual register instantiation should be
  2248. based on the frame pointer instead of the argument pointer. Only one
  2249. of @code{FRAME_POINTER_CFA_OFFSET} and @code{ARG_POINTER_CFA_OFFSET}
  2250. should be defined.
  2251. @end defmac
  2252. @defmac CFA_FRAME_BASE_OFFSET (@var{fundecl})
  2253. If defined, a C expression whose value is an integer giving the offset
  2254. in bytes from the canonical frame address (cfa) to the frame base used
  2255. in DWARF 2 debug information. The default is zero. A different value
  2256. may reduce the size of debug information on some ports.
  2257. @end defmac
  2258. @node Exception Handling
  2259. @subsection Exception Handling Support
  2260. @cindex exception handling
  2261. @defmac EH_RETURN_DATA_REGNO (@var{N})
  2262. A C expression whose value is the @var{N}th register number used for
  2263. data by exception handlers, or @code{INVALID_REGNUM} if fewer than
  2264. @var{N} registers are usable.
  2265. The exception handling library routines communicate with the exception
  2266. handlers via a set of agreed upon registers. Ideally these registers
  2267. should be call-clobbered; it is possible to use call-saved registers,
  2268. but may negatively impact code size. The target must support at least
  2269. 2 data registers, but should define 4 if there are enough free registers.
  2270. You must define this macro if you want to support call frame exception
  2271. handling like that provided by DWARF 2.
  2272. @end defmac
  2273. @defmac EH_RETURN_STACKADJ_RTX
  2274. A C expression whose value is RTL representing a location in which
  2275. to store a stack adjustment to be applied before function return.
  2276. This is used to unwind the stack to an exception handler's call frame.
  2277. It will be assigned zero on code paths that return normally.
  2278. Typically this is a call-clobbered hard register that is otherwise
  2279. untouched by the epilogue, but could also be a stack slot.
  2280. Do not define this macro if the stack pointer is saved and restored
  2281. by the regular prolog and epilog code in the call frame itself; in
  2282. this case, the exception handling library routines will update the
  2283. stack location to be restored in place. Otherwise, you must define
  2284. this macro if you want to support call frame exception handling like
  2285. that provided by DWARF 2.
  2286. @end defmac
  2287. @defmac EH_RETURN_HANDLER_RTX
  2288. A C expression whose value is RTL representing a location in which
  2289. to store the address of an exception handler to which we should
  2290. return. It will not be assigned on code paths that return normally.
  2291. Typically this is the location in the call frame at which the normal
  2292. return address is stored. For targets that return by popping an
  2293. address off the stack, this might be a memory address just below
  2294. the @emph{target} call frame rather than inside the current call
  2295. frame. If defined, @code{EH_RETURN_STACKADJ_RTX} will have already
  2296. been assigned, so it may be used to calculate the location of the
  2297. target call frame.
  2298. Some targets have more complex requirements than storing to an
  2299. address calculable during initial code generation. In that case
  2300. the @code{eh_return} instruction pattern should be used instead.
  2301. If you want to support call frame exception handling, you must
  2302. define either this macro or the @code{eh_return} instruction pattern.
  2303. @end defmac
  2304. @defmac RETURN_ADDR_OFFSET
  2305. If defined, an integer-valued C expression for which rtl will be generated
  2306. to add it to the exception handler address before it is searched in the
  2307. exception handling tables, and to subtract it again from the address before
  2308. using it to return to the exception handler.
  2309. @end defmac
  2310. @defmac ASM_PREFERRED_EH_DATA_FORMAT (@var{code}, @var{global})
  2311. This macro chooses the encoding of pointers embedded in the exception
  2312. handling sections. If at all possible, this should be defined such
  2313. that the exception handling section will not require dynamic relocations,
  2314. and so may be read-only.
  2315. @var{code} is 0 for data, 1 for code labels, 2 for function pointers.
  2316. @var{global} is true if the symbol may be affected by dynamic relocations.
  2317. The macro should return a combination of the @code{DW_EH_PE_*} defines
  2318. as found in @file{dwarf2.h}.
  2319. If this macro is not defined, pointers will not be encoded but
  2320. represented directly.
  2321. @end defmac
  2322. @defmac ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX (@var{file}, @var{encoding}, @var{size}, @var{addr}, @var{done})
  2323. This macro allows the target to emit whatever special magic is required
  2324. to represent the encoding chosen by @code{ASM_PREFERRED_EH_DATA_FORMAT}.
  2325. Generic code takes care of pc-relative and indirect encodings; this must
  2326. be defined if the target uses text-relative or data-relative encodings.
  2327. This is a C statement that branches to @var{done} if the format was
  2328. handled. @var{encoding} is the format chosen, @var{size} is the number
  2329. of bytes that the format occupies, @var{addr} is the @code{SYMBOL_REF}
  2330. to be emitted.
  2331. @end defmac
  2332. @defmac MD_FALLBACK_FRAME_STATE_FOR (@var{context}, @var{fs})
  2333. This macro allows the target to add CPU and operating system specific
  2334. code to the call-frame unwinder for use when there is no unwind data
  2335. available. The most common reason to implement this macro is to unwind
  2336. through signal frames.
  2337. This macro is called from @code{uw_frame_state_for} in
  2338. @file{unwind-dw2.c}, @file{unwind-dw2-xtensa.c} and
  2339. @file{unwind-ia64.c}. @var{context} is an @code{_Unwind_Context};
  2340. @var{fs} is an @code{_Unwind_FrameState}. Examine @code{context->ra}
  2341. for the address of the code being executed and @code{context->cfa} for
  2342. the stack pointer value. If the frame can be decoded, the register
  2343. save addresses should be updated in @var{fs} and the macro should
  2344. evaluate to @code{_URC_NO_REASON}. If the frame cannot be decoded,
  2345. the macro should evaluate to @code{_URC_END_OF_STACK}.
  2346. For proper signal handling in Java this macro is accompanied by
  2347. @code{MAKE_THROW_FRAME}, defined in @file{libjava/include/*-signal.h} headers.
  2348. @end defmac
  2349. @defmac MD_HANDLE_UNWABI (@var{context}, @var{fs})
  2350. This macro allows the target to add operating system specific code to the
  2351. call-frame unwinder to handle the IA-64 @code{.unwabi} unwinding directive,
  2352. usually used for signal or interrupt frames.
  2353. This macro is called from @code{uw_update_context} in libgcc's
  2354. @file{unwind-ia64.c}. @var{context} is an @code{_Unwind_Context};
  2355. @var{fs} is an @code{_Unwind_FrameState}. Examine @code{fs->unwabi}
  2356. for the abi and context in the @code{.unwabi} directive. If the
  2357. @code{.unwabi} directive can be handled, the register save addresses should
  2358. be updated in @var{fs}.
  2359. @end defmac
  2360. @defmac TARGET_USES_WEAK_UNWIND_INFO
  2361. A C expression that evaluates to true if the target requires unwind
  2362. info to be given comdat linkage. Define it to be @code{1} if comdat
  2363. linkage is necessary. The default is @code{0}.
  2364. @end defmac
  2365. @node Stack Checking
  2366. @subsection Specifying How Stack Checking is Done
  2367. GCC will check that stack references are within the boundaries of the
  2368. stack, if the option @option{-fstack-check} is specified, in one of
  2369. three ways:
  2370. @enumerate
  2371. @item
  2372. If the value of the @code{STACK_CHECK_BUILTIN} macro is nonzero, GCC
  2373. will assume that you have arranged for full stack checking to be done
  2374. at appropriate places in the configuration files. GCC will not do
  2375. other special processing.
  2376. @item
  2377. If @code{STACK_CHECK_BUILTIN} is zero and the value of the
  2378. @code{STACK_CHECK_STATIC_BUILTIN} macro is nonzero, GCC will assume
  2379. that you have arranged for static stack checking (checking of the
  2380. static stack frame of functions) to be done at appropriate places
  2381. in the configuration files. GCC will only emit code to do dynamic
  2382. stack checking (checking on dynamic stack allocations) using the third
  2383. approach below.
  2384. @item
  2385. If neither of the above are true, GCC will generate code to periodically
  2386. ``probe'' the stack pointer using the values of the macros defined below.
  2387. @end enumerate
  2388. If neither STACK_CHECK_BUILTIN nor STACK_CHECK_STATIC_BUILTIN is defined,
  2389. GCC will change its allocation strategy for large objects if the option
  2390. @option{-fstack-check} is specified: they will always be allocated
  2391. dynamically if their size exceeds @code{STACK_CHECK_MAX_VAR_SIZE} bytes.
  2392. @defmac STACK_CHECK_BUILTIN
  2393. A nonzero value if stack checking is done by the configuration files in a
  2394. machine-dependent manner. You should define this macro if stack checking
  2395. is required by the ABI of your machine or if you would like to do stack
  2396. checking in some more efficient way than the generic approach. The default
  2397. value of this macro is zero.
  2398. @end defmac
  2399. @defmac STACK_CHECK_STATIC_BUILTIN
  2400. A nonzero value if static stack checking is done by the configuration files
  2401. in a machine-dependent manner. You should define this macro if you would
  2402. like to do static stack checking in some more efficient way than the generic
  2403. approach. The default value of this macro is zero.
  2404. @end defmac
  2405. @defmac STACK_CHECK_PROBE_INTERVAL_EXP
  2406. An integer specifying the interval at which GCC must generate stack probe
  2407. instructions, defined as 2 raised to this integer. You will normally
  2408. define this macro so that the interval be no larger than the size of
  2409. the ``guard pages'' at the end of a stack area. The default value
  2410. of 12 (4096-byte interval) is suitable for most systems.
  2411. @end defmac
  2412. @defmac STACK_CHECK_MOVING_SP
  2413. An integer which is nonzero if GCC should move the stack pointer page by page
  2414. when doing probes. This can be necessary on systems where the stack pointer
  2415. contains the bottom address of the memory area accessible to the executing
  2416. thread at any point in time. In this situation an alternate signal stack
  2417. is required in order to be able to recover from a stack overflow. The
  2418. default value of this macro is zero.
  2419. @end defmac
  2420. @defmac STACK_CHECK_PROTECT
  2421. The number of bytes of stack needed to recover from a stack overflow, for
  2422. languages where such a recovery is supported. The default value of 75 words
  2423. with the @code{setjmp}/@code{longjmp}-based exception handling mechanism and
  2424. 8192 bytes with other exception handling mechanisms should be adequate for
  2425. most machines.
  2426. @end defmac
  2427. The following macros are relevant only if neither STACK_CHECK_BUILTIN
  2428. nor STACK_CHECK_STATIC_BUILTIN is defined; you can omit them altogether
  2429. in the opposite case.
  2430. @defmac STACK_CHECK_MAX_FRAME_SIZE
  2431. The maximum size of a stack frame, in bytes. GCC will generate probe
  2432. instructions in non-leaf functions to ensure at least this many bytes of
  2433. stack are available. If a stack frame is larger than this size, stack
  2434. checking will not be reliable and GCC will issue a warning. The
  2435. default is chosen so that GCC only generates one instruction on most
  2436. systems. You should normally not change the default value of this macro.
  2437. @end defmac
  2438. @defmac STACK_CHECK_FIXED_FRAME_SIZE
  2439. GCC uses this value to generate the above warning message. It
  2440. represents the amount of fixed frame used by a function, not including
  2441. space for any callee-saved registers, temporaries and user variables.
  2442. You need only specify an upper bound for this amount and will normally
  2443. use the default of four words.
  2444. @end defmac
  2445. @defmac STACK_CHECK_MAX_VAR_SIZE
  2446. The maximum size, in bytes, of an object that GCC will place in the
  2447. fixed area of the stack frame when the user specifies
  2448. @option{-fstack-check}.
  2449. GCC computed the default from the values of the above macros and you will
  2450. normally not need to override that default.
  2451. @end defmac
  2452. @need 2000
  2453. @node Frame Registers
  2454. @subsection Registers That Address the Stack Frame
  2455. @c prevent bad page break with this line
  2456. This discusses registers that address the stack frame.
  2457. @defmac STACK_POINTER_REGNUM
  2458. The register number of the stack pointer register, which must also be a
  2459. fixed register according to @code{FIXED_REGISTERS}. On most machines,
  2460. the hardware determines which register this is.
  2461. @end defmac
  2462. @defmac FRAME_POINTER_REGNUM
  2463. The register number of the frame pointer register, which is used to
  2464. access automatic variables in the stack frame. On some machines, the
  2465. hardware determines which register this is. On other machines, you can
  2466. choose any register you wish for this purpose.
  2467. @end defmac
  2468. @defmac HARD_FRAME_POINTER_REGNUM
  2469. On some machines the offset between the frame pointer and starting
  2470. offset of the automatic variables is not known until after register
  2471. allocation has been done (for example, because the saved registers are
  2472. between these two locations). On those machines, define
  2473. @code{FRAME_POINTER_REGNUM} the number of a special, fixed register to
  2474. be used internally until the offset is known, and define
  2475. @code{HARD_FRAME_POINTER_REGNUM} to be the actual hard register number
  2476. used for the frame pointer.
  2477. You should define this macro only in the very rare circumstances when it
  2478. is not possible to calculate the offset between the frame pointer and
  2479. the automatic variables until after register allocation has been
  2480. completed. When this macro is defined, you must also indicate in your
  2481. definition of @code{ELIMINABLE_REGS} how to eliminate
  2482. @code{FRAME_POINTER_REGNUM} into either @code{HARD_FRAME_POINTER_REGNUM}
  2483. or @code{STACK_POINTER_REGNUM}.
  2484. Do not define this macro if it would be the same as
  2485. @code{FRAME_POINTER_REGNUM}.
  2486. @end defmac
  2487. @defmac ARG_POINTER_REGNUM
  2488. The register number of the arg pointer register, which is used to access
  2489. the function's argument list. On some machines, this is the same as the
  2490. frame pointer register. On some machines, the hardware determines which
  2491. register this is. On other machines, you can choose any register you
  2492. wish for this purpose. If this is not the same register as the frame
  2493. pointer register, then you must mark it as a fixed register according to
  2494. @code{FIXED_REGISTERS}, or arrange to be able to eliminate it
  2495. (@pxref{Elimination}).
  2496. @end defmac
  2497. @defmac HARD_FRAME_POINTER_IS_FRAME_POINTER
  2498. Define this to a preprocessor constant that is nonzero if
  2499. @code{hard_frame_pointer_rtx} and @code{frame_pointer_rtx} should be
  2500. the same. The default definition is @samp{(HARD_FRAME_POINTER_REGNUM
  2501. == FRAME_POINTER_REGNUM)}; you only need to define this macro if that
  2502. definition is not suitable for use in preprocessor conditionals.
  2503. @end defmac
  2504. @defmac HARD_FRAME_POINTER_IS_ARG_POINTER
  2505. Define this to a preprocessor constant that is nonzero if
  2506. @code{hard_frame_pointer_rtx} and @code{arg_pointer_rtx} should be the
  2507. same. The default definition is @samp{(HARD_FRAME_POINTER_REGNUM ==
  2508. ARG_POINTER_REGNUM)}; you only need to define this macro if that
  2509. definition is not suitable for use in preprocessor conditionals.
  2510. @end defmac
  2511. @defmac RETURN_ADDRESS_POINTER_REGNUM
  2512. The register number of the return address pointer register, which is used to
  2513. access the current function's return address from the stack. On some
  2514. machines, the return address is not at a fixed offset from the frame
  2515. pointer or stack pointer or argument pointer. This register can be defined
  2516. to point to the return address on the stack, and then be converted by
  2517. @code{ELIMINABLE_REGS} into either the frame pointer or stack pointer.
  2518. Do not define this macro unless there is no other way to get the return
  2519. address from the stack.
  2520. @end defmac
  2521. @defmac STATIC_CHAIN_REGNUM
  2522. @defmacx STATIC_CHAIN_INCOMING_REGNUM
  2523. Register numbers used for passing a function's static chain pointer. If
  2524. register windows are used, the register number as seen by the called
  2525. function is @code{STATIC_CHAIN_INCOMING_REGNUM}, while the register
  2526. number as seen by the calling function is @code{STATIC_CHAIN_REGNUM}. If
  2527. these registers are the same, @code{STATIC_CHAIN_INCOMING_REGNUM} need
  2528. not be defined.
  2529. The static chain register need not be a fixed register.
  2530. If the static chain is passed in memory, these macros should not be
  2531. defined; instead, the @code{TARGET_STATIC_CHAIN} hook should be used.
  2532. @end defmac
  2533. @hook TARGET_STATIC_CHAIN
  2534. @defmac DWARF_FRAME_REGISTERS
  2535. This macro specifies the maximum number of hard registers that can be
  2536. saved in a call frame. This is used to size data structures used in
  2537. DWARF2 exception handling.
  2538. Prior to GCC 3.0, this macro was needed in order to establish a stable
  2539. exception handling ABI in the face of adding new hard registers for ISA
  2540. extensions. In GCC 3.0 and later, the EH ABI is insulated from changes
  2541. in the number of hard registers. Nevertheless, this macro can still be
  2542. used to reduce the runtime memory requirements of the exception handling
  2543. routines, which can be substantial if the ISA contains a lot of
  2544. registers that are not call-saved.
  2545. If this macro is not defined, it defaults to
  2546. @code{FIRST_PSEUDO_REGISTER}.
  2547. @end defmac
  2548. @defmac PRE_GCC3_DWARF_FRAME_REGISTERS
  2549. This macro is similar to @code{DWARF_FRAME_REGISTERS}, but is provided
  2550. for backward compatibility in pre GCC 3.0 compiled code.
  2551. If this macro is not defined, it defaults to
  2552. @code{DWARF_FRAME_REGISTERS}.
  2553. @end defmac
  2554. @defmac DWARF_REG_TO_UNWIND_COLUMN (@var{regno})
  2555. Define this macro if the target's representation for dwarf registers
  2556. is different than the internal representation for unwind column.
  2557. Given a dwarf register, this macro should return the internal unwind
  2558. column number to use instead.
  2559. See the PowerPC's SPE target for an example.
  2560. @end defmac
  2561. @defmac DWARF_FRAME_REGNUM (@var{regno})
  2562. Define this macro if the target's representation for dwarf registers
  2563. used in .eh_frame or .debug_frame is different from that used in other
  2564. debug info sections. Given a GCC hard register number, this macro
  2565. should return the .eh_frame register number. The default is
  2566. @code{DBX_REGISTER_NUMBER (@var{regno})}.
  2567. @end defmac
  2568. @defmac DWARF2_FRAME_REG_OUT (@var{regno}, @var{for_eh})
  2569. Define this macro to map register numbers held in the call frame info
  2570. that GCC has collected using @code{DWARF_FRAME_REGNUM} to those that
  2571. should be output in .debug_frame (@code{@var{for_eh}} is zero) and
  2572. .eh_frame (@code{@var{for_eh}} is nonzero). The default is to
  2573. return @code{@var{regno}}.
  2574. @end defmac
  2575. @defmac REG_VALUE_IN_UNWIND_CONTEXT
  2576. Define this macro if the target stores register values as
  2577. @code{_Unwind_Word} type in unwind context. It should be defined if
  2578. target register size is larger than the size of @code{void *}. The
  2579. default is to store register values as @code{void *} type.
  2580. @end defmac
  2581. @defmac ASSUME_EXTENDED_UNWIND_CONTEXT
  2582. Define this macro to be 1 if the target always uses extended unwind
  2583. context with version, args_size and by_value fields. If it is undefined,
  2584. it will be defined to 1 when @code{REG_VALUE_IN_UNWIND_CONTEXT} is
  2585. defined and 0 otherwise.
  2586. @end defmac
  2587. @node Elimination
  2588. @subsection Eliminating Frame Pointer and Arg Pointer
  2589. @c prevent bad page break with this line
  2590. This is about eliminating the frame pointer and arg pointer.
  2591. @hook TARGET_FRAME_POINTER_REQUIRED
  2592. @findex get_frame_size
  2593. @defmac INITIAL_FRAME_POINTER_OFFSET (@var{depth-var})
  2594. A C statement to store in the variable @var{depth-var} the difference
  2595. between the frame pointer and the stack pointer values immediately after
  2596. the function prologue. The value would be computed from information
  2597. such as the result of @code{get_frame_size ()} and the tables of
  2598. registers @code{regs_ever_live} and @code{call_used_regs}.
  2599. If @code{ELIMINABLE_REGS} is defined, this macro will be not be used and
  2600. need not be defined. Otherwise, it must be defined even if
  2601. @code{TARGET_FRAME_POINTER_REQUIRED} always returns true; in that
  2602. case, you may set @var{depth-var} to anything.
  2603. @end defmac
  2604. @defmac ELIMINABLE_REGS
  2605. If defined, this macro specifies a table of register pairs used to
  2606. eliminate unneeded registers that point into the stack frame. If it is not
  2607. defined, the only elimination attempted by the compiler is to replace
  2608. references to the frame pointer with references to the stack pointer.
  2609. The definition of this macro is a list of structure initializations, each
  2610. of which specifies an original and replacement register.
  2611. On some machines, the position of the argument pointer is not known until
  2612. the compilation is completed. In such a case, a separate hard register
  2613. must be used for the argument pointer. This register can be eliminated by
  2614. replacing it with either the frame pointer or the argument pointer,
  2615. depending on whether or not the frame pointer has been eliminated.
  2616. In this case, you might specify:
  2617. @smallexample
  2618. #define ELIMINABLE_REGS \
  2619. @{@{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM@}, \
  2620. @{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM@}, \
  2621. @{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM@}@}
  2622. @end smallexample
  2623. Note that the elimination of the argument pointer with the stack pointer is
  2624. specified first since that is the preferred elimination.
  2625. @end defmac
  2626. @hook TARGET_CAN_ELIMINATE
  2627. @defmac INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var})
  2628. This macro is similar to @code{INITIAL_FRAME_POINTER_OFFSET}. It
  2629. specifies the initial difference between the specified pair of
  2630. registers. This macro must be defined if @code{ELIMINABLE_REGS} is
  2631. defined.
  2632. @end defmac
  2633. @node Stack Arguments
  2634. @subsection Passing Function Arguments on the Stack
  2635. @cindex arguments on stack
  2636. @cindex stack arguments
  2637. The macros in this section control how arguments are passed
  2638. on the stack. See the following section for other macros that
  2639. control passing certain arguments in registers.
  2640. @hook TARGET_PROMOTE_PROTOTYPES
  2641. @defmac PUSH_ARGS
  2642. A C expression. If nonzero, push insns will be used to pass
  2643. outgoing arguments.
  2644. If the target machine does not have a push instruction, set it to zero.
  2645. That directs GCC to use an alternate strategy: to
  2646. allocate the entire argument block and then store the arguments into
  2647. it. When @code{PUSH_ARGS} is nonzero, @code{PUSH_ROUNDING} must be defined too.
  2648. @end defmac
  2649. @defmac PUSH_ARGS_REVERSED
  2650. A C expression. If nonzero, function arguments will be evaluated from
  2651. last to first, rather than from first to last. If this macro is not
  2652. defined, it defaults to @code{PUSH_ARGS} on targets where the stack
  2653. and args grow in opposite directions, and 0 otherwise.
  2654. @end defmac
  2655. @defmac PUSH_ROUNDING (@var{npushed})
  2656. A C expression that is the number of bytes actually pushed onto the
  2657. stack when an instruction attempts to push @var{npushed} bytes.
  2658. On some machines, the definition
  2659. @smallexample
  2660. #define PUSH_ROUNDING(BYTES) (BYTES)
  2661. @end smallexample
  2662. @noindent
  2663. will suffice. But on other machines, instructions that appear
  2664. to push one byte actually push two bytes in an attempt to maintain
  2665. alignment. Then the definition should be
  2666. @smallexample
  2667. #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
  2668. @end smallexample
  2669. If the value of this macro has a type, it should be an unsigned type.
  2670. @end defmac
  2671. @findex outgoing_args_size
  2672. @findex crtl->outgoing_args_size
  2673. @defmac ACCUMULATE_OUTGOING_ARGS
  2674. A C expression. If nonzero, the maximum amount of space required for outgoing arguments
  2675. will be computed and placed into
  2676. @code{crtl->outgoing_args_size}. No space will be pushed
  2677. onto the stack for each call; instead, the function prologue should
  2678. increase the stack frame size by this amount.
  2679. Setting both @code{PUSH_ARGS} and @code{ACCUMULATE_OUTGOING_ARGS}
  2680. is not proper.
  2681. @end defmac
  2682. @defmac REG_PARM_STACK_SPACE (@var{fndecl})
  2683. Define this macro if functions should assume that stack space has been
  2684. allocated for arguments even when their values are passed in
  2685. registers.
  2686. The value of this macro is the size, in bytes, of the area reserved for
  2687. arguments passed in registers for the function represented by @var{fndecl},
  2688. which can be zero if GCC is calling a library function.
  2689. The argument @var{fndecl} can be the FUNCTION_DECL, or the type itself
  2690. of the function.
  2691. This space can be allocated by the caller, or be a part of the
  2692. machine-dependent stack frame: @code{OUTGOING_REG_PARM_STACK_SPACE} says
  2693. which.
  2694. @end defmac
  2695. @c above is overfull. not sure what to do. --mew 5feb93 did
  2696. @c something, not sure if it looks good. --mew 10feb93
  2697. @defmac INCOMING_REG_PARM_STACK_SPACE (@var{fndecl})
  2698. Like @code{REG_PARM_STACK_SPACE}, but for incoming register arguments.
  2699. Define this macro if space guaranteed when compiling a function body
  2700. is different to space required when making a call, a situation that
  2701. can arise with K&R style function definitions.
  2702. @end defmac
  2703. @defmac OUTGOING_REG_PARM_STACK_SPACE (@var{fntype})
  2704. Define this to a nonzero value if it is the responsibility of the
  2705. caller to allocate the area reserved for arguments passed in registers
  2706. when calling a function of @var{fntype}. @var{fntype} may be NULL
  2707. if the function called is a library function.
  2708. If @code{ACCUMULATE_OUTGOING_ARGS} is defined, this macro controls
  2709. whether the space for these arguments counts in the value of
  2710. @code{crtl->outgoing_args_size}.
  2711. @end defmac
  2712. @defmac STACK_PARMS_IN_REG_PARM_AREA
  2713. Define this macro if @code{REG_PARM_STACK_SPACE} is defined, but the
  2714. stack parameters don't skip the area specified by it.
  2715. @c i changed this, makes more sens and it should have taken care of the
  2716. @c overfull.. not as specific, tho. --mew 5feb93
  2717. Normally, when a parameter is not passed in registers, it is placed on the
  2718. stack beyond the @code{REG_PARM_STACK_SPACE} area. Defining this macro
  2719. suppresses this behavior and causes the parameter to be passed on the
  2720. stack in its natural location.
  2721. @end defmac
  2722. @hook TARGET_RETURN_POPS_ARGS
  2723. @defmac CALL_POPS_ARGS (@var{cum})
  2724. A C expression that should indicate the number of bytes a call sequence
  2725. pops off the stack. It is added to the value of @code{RETURN_POPS_ARGS}
  2726. when compiling a function call.
  2727. @var{cum} is the variable in which all arguments to the called function
  2728. have been accumulated.
  2729. On certain architectures, such as the SH5, a call trampoline is used
  2730. that pops certain registers off the stack, depending on the arguments
  2731. that have been passed to the function. Since this is a property of the
  2732. call site, not of the called function, @code{RETURN_POPS_ARGS} is not
  2733. appropriate.
  2734. @end defmac
  2735. @node Register Arguments
  2736. @subsection Passing Arguments in Registers
  2737. @cindex arguments in registers
  2738. @cindex registers arguments
  2739. This section describes the macros which let you control how various
  2740. types of arguments are passed in registers or how they are arranged in
  2741. the stack.
  2742. @hook TARGET_FUNCTION_ARG
  2743. @hook TARGET_MUST_PASS_IN_STACK
  2744. @hook TARGET_FUNCTION_INCOMING_ARG
  2745. @hook TARGET_USE_PSEUDO_PIC_REG
  2746. @hook TARGET_INIT_PIC_REG
  2747. @hook TARGET_ARG_PARTIAL_BYTES
  2748. @hook TARGET_PASS_BY_REFERENCE
  2749. @hook TARGET_CALLEE_COPIES
  2750. @defmac CUMULATIVE_ARGS
  2751. A C type for declaring a variable that is used as the first argument
  2752. of @code{TARGET_FUNCTION_ARG} and other related values. For some
  2753. target machines, the type @code{int} suffices and can hold the number
  2754. of bytes of argument so far.
  2755. There is no need to record in @code{CUMULATIVE_ARGS} anything about the
  2756. arguments that have been passed on the stack. The compiler has other
  2757. variables to keep track of that. For target machines on which all
  2758. arguments are passed on the stack, there is no need to store anything in
  2759. @code{CUMULATIVE_ARGS}; however, the data structure must exist and
  2760. should not be empty, so use @code{int}.
  2761. @end defmac
  2762. @defmac OVERRIDE_ABI_FORMAT (@var{fndecl})
  2763. If defined, this macro is called before generating any code for a
  2764. function, but after the @var{cfun} descriptor for the function has been
  2765. created. The back end may use this macro to update @var{cfun} to
  2766. reflect an ABI other than that which would normally be used by default.
  2767. If the compiler is generating code for a compiler-generated function,
  2768. @var{fndecl} may be @code{NULL}.
  2769. @end defmac
  2770. @defmac INIT_CUMULATIVE_ARGS (@var{cum}, @var{fntype}, @var{libname}, @var{fndecl}, @var{n_named_args})
  2771. A C statement (sans semicolon) for initializing the variable
  2772. @var{cum} for the state at the beginning of the argument list. The
  2773. variable has type @code{CUMULATIVE_ARGS}. The value of @var{fntype}
  2774. is the tree node for the data type of the function which will receive
  2775. the args, or 0 if the args are to a compiler support library function.
  2776. For direct calls that are not libcalls, @var{fndecl} contain the
  2777. declaration node of the function. @var{fndecl} is also set when
  2778. @code{INIT_CUMULATIVE_ARGS} is used to find arguments for the function
  2779. being compiled. @var{n_named_args} is set to the number of named
  2780. arguments, including a structure return address if it is passed as a
  2781. parameter, when making a call. When processing incoming arguments,
  2782. @var{n_named_args} is set to @minus{}1.
  2783. When processing a call to a compiler support library function,
  2784. @var{libname} identifies which one. It is a @code{symbol_ref} rtx which
  2785. contains the name of the function, as a string. @var{libname} is 0 when
  2786. an ordinary C function call is being processed. Thus, each time this
  2787. macro is called, either @var{libname} or @var{fntype} is nonzero, but
  2788. never both of them at once.
  2789. @end defmac
  2790. @defmac INIT_CUMULATIVE_LIBCALL_ARGS (@var{cum}, @var{mode}, @var{libname})
  2791. Like @code{INIT_CUMULATIVE_ARGS} but only used for outgoing libcalls,
  2792. it gets a @code{MODE} argument instead of @var{fntype}, that would be
  2793. @code{NULL}. @var{indirect} would always be zero, too. If this macro
  2794. is not defined, @code{INIT_CUMULATIVE_ARGS (cum, NULL_RTX, libname,
  2795. 0)} is used instead.
  2796. @end defmac
  2797. @defmac INIT_CUMULATIVE_INCOMING_ARGS (@var{cum}, @var{fntype}, @var{libname})
  2798. Like @code{INIT_CUMULATIVE_ARGS} but overrides it for the purposes of
  2799. finding the arguments for the function being compiled. If this macro is
  2800. undefined, @code{INIT_CUMULATIVE_ARGS} is used instead.
  2801. The value passed for @var{libname} is always 0, since library routines
  2802. with special calling conventions are never compiled with GCC@. The
  2803. argument @var{libname} exists for symmetry with
  2804. @code{INIT_CUMULATIVE_ARGS}.
  2805. @c could use "this macro" in place of @code{INIT_CUMULATIVE_ARGS}, maybe.
  2806. @c --mew 5feb93 i switched the order of the sentences. --mew 10feb93
  2807. @end defmac
  2808. @hook TARGET_FUNCTION_ARG_ADVANCE
  2809. @defmac FUNCTION_ARG_OFFSET (@var{mode}, @var{type})
  2810. If defined, a C expression that is the number of bytes to add to the
  2811. offset of the argument passed in memory. This is needed for the SPU,
  2812. which passes @code{char} and @code{short} arguments in the preferred
  2813. slot that is in the middle of the quad word instead of starting at the
  2814. top.
  2815. @end defmac
  2816. @defmac FUNCTION_ARG_PADDING (@var{mode}, @var{type})
  2817. If defined, a C expression which determines whether, and in which direction,
  2818. to pad out an argument with extra space. The value should be of type
  2819. @code{enum direction}: either @code{upward} to pad above the argument,
  2820. @code{downward} to pad below, or @code{none} to inhibit padding.
  2821. The @emph{amount} of padding is not controlled by this macro, but by the
  2822. target hook @code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}. It is
  2823. always just enough to reach the next multiple of that boundary.
  2824. This macro has a default definition which is right for most systems.
  2825. For little-endian machines, the default is to pad upward. For
  2826. big-endian machines, the default is to pad downward for an argument of
  2827. constant size shorter than an @code{int}, and upward otherwise.
  2828. @end defmac
  2829. @defmac PAD_VARARGS_DOWN
  2830. If defined, a C expression which determines whether the default
  2831. implementation of va_arg will attempt to pad down before reading the
  2832. next argument, if that argument is smaller than its aligned space as
  2833. controlled by @code{PARM_BOUNDARY}. If this macro is not defined, all such
  2834. arguments are padded down if @code{BYTES_BIG_ENDIAN} is true.
  2835. @end defmac
  2836. @defmac BLOCK_REG_PADDING (@var{mode}, @var{type}, @var{first})
  2837. Specify padding for the last element of a block move between registers and
  2838. memory. @var{first} is nonzero if this is the only element. Defining this
  2839. macro allows better control of register function parameters on big-endian
  2840. machines, without using @code{PARALLEL} rtl. In particular,
  2841. @code{MUST_PASS_IN_STACK} need not test padding and mode of types in
  2842. registers, as there is no longer a "wrong" part of a register; For example,
  2843. a three byte aggregate may be passed in the high part of a register if so
  2844. required.
  2845. @end defmac
  2846. @hook TARGET_FUNCTION_ARG_BOUNDARY
  2847. @hook TARGET_FUNCTION_ARG_ROUND_BOUNDARY
  2848. @defmac FUNCTION_ARG_REGNO_P (@var{regno})
  2849. A C expression that is nonzero if @var{regno} is the number of a hard
  2850. register in which function arguments are sometimes passed. This does
  2851. @emph{not} include implicit arguments such as the static chain and
  2852. the structure-value address. On many machines, no registers can be
  2853. used for this purpose since all function arguments are pushed on the
  2854. stack.
  2855. @end defmac
  2856. @hook TARGET_SPLIT_COMPLEX_ARG
  2857. @hook TARGET_BUILD_BUILTIN_VA_LIST
  2858. @hook TARGET_ENUM_VA_LIST_P
  2859. @hook TARGET_FN_ABI_VA_LIST
  2860. @hook TARGET_CANONICAL_VA_LIST_TYPE
  2861. @hook TARGET_GIMPLIFY_VA_ARG_EXPR
  2862. @hook TARGET_VALID_POINTER_MODE
  2863. @hook TARGET_REF_MAY_ALIAS_ERRNO
  2864. @hook TARGET_SCALAR_MODE_SUPPORTED_P
  2865. @hook TARGET_VECTOR_MODE_SUPPORTED_P
  2866. @hook TARGET_ARRAY_MODE_SUPPORTED_P
  2867. @hook TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P
  2868. @hook TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P
  2869. @node Scalar Return
  2870. @subsection How Scalar Function Values Are Returned
  2871. @cindex return values in registers
  2872. @cindex values, returned by functions
  2873. @cindex scalars, returned as values
  2874. This section discusses the macros that control returning scalars as
  2875. values---values that can fit in registers.
  2876. @hook TARGET_FUNCTION_VALUE
  2877. @defmac FUNCTION_VALUE (@var{valtype}, @var{func})
  2878. This macro has been deprecated. Use @code{TARGET_FUNCTION_VALUE} for
  2879. a new target instead.
  2880. @end defmac
  2881. @defmac LIBCALL_VALUE (@var{mode})
  2882. A C expression to create an RTX representing the place where a library
  2883. function returns a value of mode @var{mode}.
  2884. Note that ``library function'' in this context means a compiler
  2885. support routine, used to perform arithmetic, whose name is known
  2886. specially by the compiler and was not mentioned in the C code being
  2887. compiled.
  2888. @end defmac
  2889. @hook TARGET_LIBCALL_VALUE
  2890. @defmac FUNCTION_VALUE_REGNO_P (@var{regno})
  2891. A C expression that is nonzero if @var{regno} is the number of a hard
  2892. register in which the values of called function may come back.
  2893. A register whose use for returning values is limited to serving as the
  2894. second of a pair (for a value of type @code{double}, say) need not be
  2895. recognized by this macro. So for most machines, this definition
  2896. suffices:
  2897. @smallexample
  2898. #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
  2899. @end smallexample
  2900. If the machine has register windows, so that the caller and the called
  2901. function use different registers for the return value, this macro
  2902. should recognize only the caller's register numbers.
  2903. This macro has been deprecated. Use @code{TARGET_FUNCTION_VALUE_REGNO_P}
  2904. for a new target instead.
  2905. @end defmac
  2906. @hook TARGET_FUNCTION_VALUE_REGNO_P
  2907. @defmac APPLY_RESULT_SIZE
  2908. Define this macro if @samp{untyped_call} and @samp{untyped_return}
  2909. need more space than is implied by @code{FUNCTION_VALUE_REGNO_P} for
  2910. saving and restoring an arbitrary return value.
  2911. @end defmac
  2912. @hook TARGET_OMIT_STRUCT_RETURN_REG
  2913. @hook TARGET_RETURN_IN_MSB
  2914. @node Aggregate Return
  2915. @subsection How Large Values Are Returned
  2916. @cindex aggregates as return values
  2917. @cindex large return values
  2918. @cindex returning aggregate values
  2919. @cindex structure value address
  2920. When a function value's mode is @code{BLKmode} (and in some other
  2921. cases), the value is not returned according to
  2922. @code{TARGET_FUNCTION_VALUE} (@pxref{Scalar Return}). Instead, the
  2923. caller passes the address of a block of memory in which the value
  2924. should be stored. This address is called the @dfn{structure value
  2925. address}.
  2926. This section describes how to control returning structure values in
  2927. memory.
  2928. @hook TARGET_RETURN_IN_MEMORY
  2929. @defmac DEFAULT_PCC_STRUCT_RETURN
  2930. Define this macro to be 1 if all structure and union return values must be
  2931. in memory. Since this results in slower code, this should be defined
  2932. only if needed for compatibility with other compilers or with an ABI@.
  2933. If you define this macro to be 0, then the conventions used for structure
  2934. and union return values are decided by the @code{TARGET_RETURN_IN_MEMORY}
  2935. target hook.
  2936. If not defined, this defaults to the value 1.
  2937. @end defmac
  2938. @hook TARGET_STRUCT_VALUE_RTX
  2939. @defmac PCC_STATIC_STRUCT_RETURN
  2940. Define this macro if the usual system convention on the target machine
  2941. for returning structures and unions is for the called function to return
  2942. the address of a static variable containing the value.
  2943. Do not define this if the usual system convention is for the caller to
  2944. pass an address to the subroutine.
  2945. This macro has effect in @option{-fpcc-struct-return} mode, but it does
  2946. nothing when you use @option{-freg-struct-return} mode.
  2947. @end defmac
  2948. @hook TARGET_GET_RAW_RESULT_MODE
  2949. @hook TARGET_GET_RAW_ARG_MODE
  2950. @node Caller Saves
  2951. @subsection Caller-Saves Register Allocation
  2952. If you enable it, GCC can save registers around function calls. This
  2953. makes it possible to use call-clobbered registers to hold variables that
  2954. must live across calls.
  2955. @defmac HARD_REGNO_CALLER_SAVE_MODE (@var{regno}, @var{nregs})
  2956. A C expression specifying which mode is required for saving @var{nregs}
  2957. of a pseudo-register in call-clobbered hard register @var{regno}. If
  2958. @var{regno} is unsuitable for caller save, @code{VOIDmode} should be
  2959. returned. For most machines this macro need not be defined since GCC
  2960. will select the smallest suitable mode.
  2961. @end defmac
  2962. @node Function Entry
  2963. @subsection Function Entry and Exit
  2964. @cindex function entry and exit
  2965. @cindex prologue
  2966. @cindex epilogue
  2967. This section describes the macros that output function entry
  2968. (@dfn{prologue}) and exit (@dfn{epilogue}) code.
  2969. @hook TARGET_ASM_FUNCTION_PROLOGUE
  2970. @hook TARGET_ASM_FUNCTION_END_PROLOGUE
  2971. @hook TARGET_ASM_FUNCTION_BEGIN_EPILOGUE
  2972. @hook TARGET_ASM_FUNCTION_EPILOGUE
  2973. @itemize @bullet
  2974. @item
  2975. @findex pretend_args_size
  2976. @findex crtl->args.pretend_args_size
  2977. A region of @code{crtl->args.pretend_args_size} bytes of
  2978. uninitialized space just underneath the first argument arriving on the
  2979. stack. (This may not be at the very start of the allocated stack region
  2980. if the calling sequence has pushed anything else since pushing the stack
  2981. arguments. But usually, on such machines, nothing else has been pushed
  2982. yet, because the function prologue itself does all the pushing.) This
  2983. region is used on machines where an argument may be passed partly in
  2984. registers and partly in memory, and, in some cases to support the
  2985. features in @code{<stdarg.h>}.
  2986. @item
  2987. An area of memory used to save certain registers used by the function.
  2988. The size of this area, which may also include space for such things as
  2989. the return address and pointers to previous stack frames, is
  2990. machine-specific and usually depends on which registers have been used
  2991. in the function. Machines with register windows often do not require
  2992. a save area.
  2993. @item
  2994. A region of at least @var{size} bytes, possibly rounded up to an allocation
  2995. boundary, to contain the local variables of the function. On some machines,
  2996. this region and the save area may occur in the opposite order, with the
  2997. save area closer to the top of the stack.
  2998. @item
  2999. @cindex @code{ACCUMULATE_OUTGOING_ARGS} and stack frames
  3000. Optionally, when @code{ACCUMULATE_OUTGOING_ARGS} is defined, a region of
  3001. @code{crtl->outgoing_args_size} bytes to be used for outgoing
  3002. argument lists of the function. @xref{Stack Arguments}.
  3003. @end itemize
  3004. @defmac EXIT_IGNORE_STACK
  3005. Define this macro as a C expression that is nonzero if the return
  3006. instruction or the function epilogue ignores the value of the stack
  3007. pointer; in other words, if it is safe to delete an instruction to
  3008. adjust the stack pointer before a return from the function. The
  3009. default is 0.
  3010. Note that this macro's value is relevant only for functions for which
  3011. frame pointers are maintained. It is never safe to delete a final
  3012. stack adjustment in a function that has no frame pointer, and the
  3013. compiler knows this regardless of @code{EXIT_IGNORE_STACK}.
  3014. @end defmac
  3015. @defmac EPILOGUE_USES (@var{regno})
  3016. Define this macro as a C expression that is nonzero for registers that are
  3017. used by the epilogue or the @samp{return} pattern. The stack and frame
  3018. pointer registers are already assumed to be used as needed.
  3019. @end defmac
  3020. @defmac EH_USES (@var{regno})
  3021. Define this macro as a C expression that is nonzero for registers that are
  3022. used by the exception handling mechanism, and so should be considered live
  3023. on entry to an exception edge.
  3024. @end defmac
  3025. @hook TARGET_ASM_OUTPUT_MI_THUNK
  3026. @hook TARGET_ASM_CAN_OUTPUT_MI_THUNK
  3027. @node Profiling
  3028. @subsection Generating Code for Profiling
  3029. @cindex profiling, code generation
  3030. These macros will help you generate code for profiling.
  3031. @defmac FUNCTION_PROFILER (@var{file}, @var{labelno})
  3032. A C statement or compound statement to output to @var{file} some
  3033. assembler code to call the profiling subroutine @code{mcount}.
  3034. @findex mcount
  3035. The details of how @code{mcount} expects to be called are determined by
  3036. your operating system environment, not by GCC@. To figure them out,
  3037. compile a small program for profiling using the system's installed C
  3038. compiler and look at the assembler code that results.
  3039. Older implementations of @code{mcount} expect the address of a counter
  3040. variable to be loaded into some register. The name of this variable is
  3041. @samp{LP} followed by the number @var{labelno}, so you would generate
  3042. the name using @samp{LP%d} in a @code{fprintf}.
  3043. @end defmac
  3044. @defmac PROFILE_HOOK
  3045. A C statement or compound statement to output to @var{file} some assembly
  3046. code to call the profiling subroutine @code{mcount} even the target does
  3047. not support profiling.
  3048. @end defmac
  3049. @defmac NO_PROFILE_COUNTERS
  3050. Define this macro to be an expression with a nonzero value if the
  3051. @code{mcount} subroutine on your system does not need a counter variable
  3052. allocated for each function. This is true for almost all modern
  3053. implementations. If you define this macro, you must not use the
  3054. @var{labelno} argument to @code{FUNCTION_PROFILER}.
  3055. @end defmac
  3056. @defmac PROFILE_BEFORE_PROLOGUE
  3057. Define this macro if the code for function profiling should come before
  3058. the function prologue. Normally, the profiling code comes after.
  3059. @end defmac
  3060. @hook TARGET_KEEP_LEAF_WHEN_PROFILED
  3061. @node Tail Calls
  3062. @subsection Permitting tail calls
  3063. @cindex tail calls
  3064. @hook TARGET_FUNCTION_OK_FOR_SIBCALL
  3065. @hook TARGET_EXTRA_LIVE_ON_ENTRY
  3066. @hook TARGET_SET_UP_BY_PROLOGUE
  3067. @hook TARGET_WARN_FUNC_RETURN
  3068. @node Stack Smashing Protection
  3069. @subsection Stack smashing protection
  3070. @cindex stack smashing protection
  3071. @hook TARGET_STACK_PROTECT_GUARD
  3072. @hook TARGET_STACK_PROTECT_FAIL
  3073. @hook TARGET_SUPPORTS_SPLIT_STACK
  3074. @node Miscellaneous Register Hooks
  3075. @subsection Miscellaneous register hooks
  3076. @cindex miscellaneous register hooks
  3077. @hook TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS
  3078. @node Varargs
  3079. @section Implementing the Varargs Macros
  3080. @cindex varargs implementation
  3081. GCC comes with an implementation of @code{<varargs.h>} and
  3082. @code{<stdarg.h>} that work without change on machines that pass arguments
  3083. on the stack. Other machines require their own implementations of
  3084. varargs, and the two machine independent header files must have
  3085. conditionals to include it.
  3086. ISO @code{<stdarg.h>} differs from traditional @code{<varargs.h>} mainly in
  3087. the calling convention for @code{va_start}. The traditional
  3088. implementation takes just one argument, which is the variable in which
  3089. to store the argument pointer. The ISO implementation of
  3090. @code{va_start} takes an additional second argument. The user is
  3091. supposed to write the last named argument of the function here.
  3092. However, @code{va_start} should not use this argument. The way to find
  3093. the end of the named arguments is with the built-in functions described
  3094. below.
  3095. @defmac __builtin_saveregs ()
  3096. Use this built-in function to save the argument registers in memory so
  3097. that the varargs mechanism can access them. Both ISO and traditional
  3098. versions of @code{va_start} must use @code{__builtin_saveregs}, unless
  3099. you use @code{TARGET_SETUP_INCOMING_VARARGS} (see below) instead.
  3100. On some machines, @code{__builtin_saveregs} is open-coded under the
  3101. control of the target hook @code{TARGET_EXPAND_BUILTIN_SAVEREGS}. On
  3102. other machines, it calls a routine written in assembler language,
  3103. found in @file{libgcc2.c}.
  3104. Code generated for the call to @code{__builtin_saveregs} appears at the
  3105. beginning of the function, as opposed to where the call to
  3106. @code{__builtin_saveregs} is written, regardless of what the code is.
  3107. This is because the registers must be saved before the function starts
  3108. to use them for its own purposes.
  3109. @c i rewrote the first sentence above to fix an overfull hbox. --mew
  3110. @c 10feb93
  3111. @end defmac
  3112. @defmac __builtin_next_arg (@var{lastarg})
  3113. This builtin returns the address of the first anonymous stack
  3114. argument, as type @code{void *}. If @code{ARGS_GROW_DOWNWARD}, it
  3115. returns the address of the location above the first anonymous stack
  3116. argument. Use it in @code{va_start} to initialize the pointer for
  3117. fetching arguments from the stack. Also use it in @code{va_start} to
  3118. verify that the second parameter @var{lastarg} is the last named argument
  3119. of the current function.
  3120. @end defmac
  3121. @defmac __builtin_classify_type (@var{object})
  3122. Since each machine has its own conventions for which data types are
  3123. passed in which kind of register, your implementation of @code{va_arg}
  3124. has to embody these conventions. The easiest way to categorize the
  3125. specified data type is to use @code{__builtin_classify_type} together
  3126. with @code{sizeof} and @code{__alignof__}.
  3127. @code{__builtin_classify_type} ignores the value of @var{object},
  3128. considering only its data type. It returns an integer describing what
  3129. kind of type that is---integer, floating, pointer, structure, and so on.
  3130. The file @file{typeclass.h} defines an enumeration that you can use to
  3131. interpret the values of @code{__builtin_classify_type}.
  3132. @end defmac
  3133. These machine description macros help implement varargs:
  3134. @hook TARGET_EXPAND_BUILTIN_SAVEREGS
  3135. @hook TARGET_SETUP_INCOMING_VARARGS
  3136. @hook TARGET_STRICT_ARGUMENT_NAMING
  3137. @hook TARGET_CALL_ARGS
  3138. @hook TARGET_END_CALL_ARGS
  3139. @hook TARGET_PRETEND_OUTGOING_VARARGS_NAMED
  3140. @hook TARGET_LOAD_BOUNDS_FOR_ARG
  3141. @hook TARGET_STORE_BOUNDS_FOR_ARG
  3142. @hook TARGET_LOAD_RETURNED_BOUNDS
  3143. @hook TARGET_STORE_RETURNED_BOUNDS
  3144. @hook TARGET_CHKP_FUNCTION_VALUE_BOUNDS
  3145. @hook TARGET_SETUP_INCOMING_VARARG_BOUNDS
  3146. @node Trampolines
  3147. @section Trampolines for Nested Functions
  3148. @cindex trampolines for nested functions
  3149. @cindex nested functions, trampolines for
  3150. A @dfn{trampoline} is a small piece of code that is created at run time
  3151. when the address of a nested function is taken. It normally resides on
  3152. the stack, in the stack frame of the containing function. These macros
  3153. tell GCC how to generate code to allocate and initialize a
  3154. trampoline.
  3155. The instructions in the trampoline must do two things: load a constant
  3156. address into the static chain register, and jump to the real address of
  3157. the nested function. On CISC machines such as the m68k, this requires
  3158. two instructions, a move immediate and a jump. Then the two addresses
  3159. exist in the trampoline as word-long immediate operands. On RISC
  3160. machines, it is often necessary to load each address into a register in
  3161. two parts. Then pieces of each address form separate immediate
  3162. operands.
  3163. The code generated to initialize the trampoline must store the variable
  3164. parts---the static chain value and the function address---into the
  3165. immediate operands of the instructions. On a CISC machine, this is
  3166. simply a matter of copying each address to a memory reference at the
  3167. proper offset from the start of the trampoline. On a RISC machine, it
  3168. may be necessary to take out pieces of the address and store them
  3169. separately.
  3170. @hook TARGET_ASM_TRAMPOLINE_TEMPLATE
  3171. @defmac TRAMPOLINE_SECTION
  3172. Return the section into which the trampoline template is to be placed
  3173. (@pxref{Sections}). The default value is @code{readonly_data_section}.
  3174. @end defmac
  3175. @defmac TRAMPOLINE_SIZE
  3176. A C expression for the size in bytes of the trampoline, as an integer.
  3177. @end defmac
  3178. @defmac TRAMPOLINE_ALIGNMENT
  3179. Alignment required for trampolines, in bits.
  3180. If you don't define this macro, the value of @code{FUNCTION_ALIGNMENT}
  3181. is used for aligning trampolines.
  3182. @end defmac
  3183. @hook TARGET_TRAMPOLINE_INIT
  3184. @hook TARGET_TRAMPOLINE_ADJUST_ADDRESS
  3185. Implementing trampolines is difficult on many machines because they have
  3186. separate instruction and data caches. Writing into a stack location
  3187. fails to clear the memory in the instruction cache, so when the program
  3188. jumps to that location, it executes the old contents.
  3189. Here are two possible solutions. One is to clear the relevant parts of
  3190. the instruction cache whenever a trampoline is set up. The other is to
  3191. make all trampolines identical, by having them jump to a standard
  3192. subroutine. The former technique makes trampoline execution faster; the
  3193. latter makes initialization faster.
  3194. To clear the instruction cache when a trampoline is initialized, define
  3195. the following macro.
  3196. @defmac CLEAR_INSN_CACHE (@var{beg}, @var{end})
  3197. If defined, expands to a C expression clearing the @emph{instruction
  3198. cache} in the specified interval. The definition of this macro would
  3199. typically be a series of @code{asm} statements. Both @var{beg} and
  3200. @var{end} are both pointer expressions.
  3201. @end defmac
  3202. To use a standard subroutine, define the following macro. In addition,
  3203. you must make sure that the instructions in a trampoline fill an entire
  3204. cache line with identical instructions, or else ensure that the
  3205. beginning of the trampoline code is always aligned at the same point in
  3206. its cache line. Look in @file{m68k.h} as a guide.
  3207. @defmac TRANSFER_FROM_TRAMPOLINE
  3208. Define this macro if trampolines need a special subroutine to do their
  3209. work. The macro should expand to a series of @code{asm} statements
  3210. which will be compiled with GCC@. They go in a library function named
  3211. @code{__transfer_from_trampoline}.
  3212. If you need to avoid executing the ordinary prologue code of a compiled
  3213. C function when you jump to the subroutine, you can do so by placing a
  3214. special label of your own in the assembler code. Use one @code{asm}
  3215. statement to generate an assembler label, and another to make the label
  3216. global. Then trampolines can use that label to jump directly to your
  3217. special assembler code.
  3218. @end defmac
  3219. @node Library Calls
  3220. @section Implicit Calls to Library Routines
  3221. @cindex library subroutine names
  3222. @cindex @file{libgcc.a}
  3223. @c prevent bad page break with this line
  3224. Here is an explanation of implicit calls to library routines.
  3225. @defmac DECLARE_LIBRARY_RENAMES
  3226. This macro, if defined, should expand to a piece of C code that will get
  3227. expanded when compiling functions for libgcc.a. It can be used to
  3228. provide alternate names for GCC's internal library functions if there
  3229. are ABI-mandated names that the compiler should provide.
  3230. @end defmac
  3231. @findex set_optab_libfunc
  3232. @findex init_one_libfunc
  3233. @hook TARGET_INIT_LIBFUNCS
  3234. @hook TARGET_LIBFUNC_GNU_PREFIX
  3235. @defmac FLOAT_LIB_COMPARE_RETURNS_BOOL (@var{mode}, @var{comparison})
  3236. This macro should return @code{true} if the library routine that
  3237. implements the floating point comparison operator @var{comparison} in
  3238. mode @var{mode} will return a boolean, and @var{false} if it will
  3239. return a tristate.
  3240. GCC's own floating point libraries return tristates from the
  3241. comparison operators, so the default returns false always. Most ports
  3242. don't need to define this macro.
  3243. @end defmac
  3244. @defmac TARGET_LIB_INT_CMP_BIASED
  3245. This macro should evaluate to @code{true} if the integer comparison
  3246. functions (like @code{__cmpdi2}) return 0 to indicate that the first
  3247. operand is smaller than the second, 1 to indicate that they are equal,
  3248. and 2 to indicate that the first operand is greater than the second.
  3249. If this macro evaluates to @code{false} the comparison functions return
  3250. @minus{}1, 0, and 1 instead of 0, 1, and 2. If the target uses the routines
  3251. in @file{libgcc.a}, you do not need to define this macro.
  3252. @end defmac
  3253. @defmac TARGET_HAS_NO_HW_DIVIDE
  3254. This macro should be defined if the target has no hardware divide
  3255. instructions. If this macro is defined, GCC will use an algorithm which
  3256. make use of simple logical and arithmetic operations for 64-bit
  3257. division. If the macro is not defined, GCC will use an algorithm which
  3258. make use of a 64-bit by 32-bit divide primitive.
  3259. @end defmac
  3260. @cindex @code{EDOM}, implicit usage
  3261. @findex matherr
  3262. @defmac TARGET_EDOM
  3263. The value of @code{EDOM} on the target machine, as a C integer constant
  3264. expression. If you don't define this macro, GCC does not attempt to
  3265. deposit the value of @code{EDOM} into @code{errno} directly. Look in
  3266. @file{/usr/include/errno.h} to find the value of @code{EDOM} on your
  3267. system.
  3268. If you do not define @code{TARGET_EDOM}, then compiled code reports
  3269. domain errors by calling the library function and letting it report the
  3270. error. If mathematical functions on your system use @code{matherr} when
  3271. there is an error, then you should leave @code{TARGET_EDOM} undefined so
  3272. that @code{matherr} is used normally.
  3273. @end defmac
  3274. @cindex @code{errno}, implicit usage
  3275. @defmac GEN_ERRNO_RTX
  3276. Define this macro as a C expression to create an rtl expression that
  3277. refers to the global ``variable'' @code{errno}. (On certain systems,
  3278. @code{errno} may not actually be a variable.) If you don't define this
  3279. macro, a reasonable default is used.
  3280. @end defmac
  3281. @hook TARGET_LIBC_HAS_FUNCTION
  3282. @defmac NEXT_OBJC_RUNTIME
  3283. Set this macro to 1 to use the "NeXT" Objective-C message sending conventions
  3284. by default. This calling convention involves passing the object, the selector
  3285. and the method arguments all at once to the method-lookup library function.
  3286. This is the usual setting when targeting Darwin/Mac OS X systems, which have
  3287. the NeXT runtime installed.
  3288. If the macro is set to 0, the "GNU" Objective-C message sending convention
  3289. will be used by default. This convention passes just the object and the
  3290. selector to the method-lookup function, which returns a pointer to the method.
  3291. In either case, it remains possible to select code-generation for the alternate
  3292. scheme, by means of compiler command line switches.
  3293. @end defmac
  3294. @node Addressing Modes
  3295. @section Addressing Modes
  3296. @cindex addressing modes
  3297. @c prevent bad page break with this line
  3298. This is about addressing modes.
  3299. @defmac HAVE_PRE_INCREMENT
  3300. @defmacx HAVE_PRE_DECREMENT
  3301. @defmacx HAVE_POST_INCREMENT
  3302. @defmacx HAVE_POST_DECREMENT
  3303. A C expression that is nonzero if the machine supports pre-increment,
  3304. pre-decrement, post-increment, or post-decrement addressing respectively.
  3305. @end defmac
  3306. @defmac HAVE_PRE_MODIFY_DISP
  3307. @defmacx HAVE_POST_MODIFY_DISP
  3308. A C expression that is nonzero if the machine supports pre- or
  3309. post-address side-effect generation involving constants other than
  3310. the size of the memory operand.
  3311. @end defmac
  3312. @defmac HAVE_PRE_MODIFY_REG
  3313. @defmacx HAVE_POST_MODIFY_REG
  3314. A C expression that is nonzero if the machine supports pre- or
  3315. post-address side-effect generation involving a register displacement.
  3316. @end defmac
  3317. @defmac CONSTANT_ADDRESS_P (@var{x})
  3318. A C expression that is 1 if the RTX @var{x} is a constant which
  3319. is a valid address. On most machines the default definition of
  3320. @code{(CONSTANT_P (@var{x}) && GET_CODE (@var{x}) != CONST_DOUBLE)}
  3321. is acceptable, but a few machines are more restrictive as to which
  3322. constant addresses are supported.
  3323. @end defmac
  3324. @defmac CONSTANT_P (@var{x})
  3325. @code{CONSTANT_P}, which is defined by target-independent code,
  3326. accepts integer-values expressions whose values are not explicitly
  3327. known, such as @code{symbol_ref}, @code{label_ref}, and @code{high}
  3328. expressions and @code{const} arithmetic expressions, in addition to
  3329. @code{const_int} and @code{const_double} expressions.
  3330. @end defmac
  3331. @defmac MAX_REGS_PER_ADDRESS
  3332. A number, the maximum number of registers that can appear in a valid
  3333. memory address. Note that it is up to you to specify a value equal to
  3334. the maximum number that @code{TARGET_LEGITIMATE_ADDRESS_P} would ever
  3335. accept.
  3336. @end defmac
  3337. @hook TARGET_LEGITIMATE_ADDRESS_P
  3338. @defmac TARGET_MEM_CONSTRAINT
  3339. A single character to be used instead of the default @code{'m'}
  3340. character for general memory addresses. This defines the constraint
  3341. letter which matches the memory addresses accepted by
  3342. @code{TARGET_LEGITIMATE_ADDRESS_P}. Define this macro if you want to
  3343. support new address formats in your back end without changing the
  3344. semantics of the @code{'m'} constraint. This is necessary in order to
  3345. preserve functionality of inline assembly constructs using the
  3346. @code{'m'} constraint.
  3347. @end defmac
  3348. @defmac FIND_BASE_TERM (@var{x})
  3349. A C expression to determine the base term of address @var{x},
  3350. or to provide a simplified version of @var{x} from which @file{alias.c}
  3351. can easily find the base term. This macro is used in only two places:
  3352. @code{find_base_value} and @code{find_base_term} in @file{alias.c}.
  3353. It is always safe for this macro to not be defined. It exists so
  3354. that alias analysis can understand machine-dependent addresses.
  3355. The typical use of this macro is to handle addresses containing
  3356. a label_ref or symbol_ref within an UNSPEC@.
  3357. @end defmac
  3358. @hook TARGET_LEGITIMIZE_ADDRESS
  3359. @defmac LEGITIMIZE_RELOAD_ADDRESS (@var{x}, @var{mode}, @var{opnum}, @var{type}, @var{ind_levels}, @var{win})
  3360. A C compound statement that attempts to replace @var{x}, which is an address
  3361. that needs reloading, with a valid memory address for an operand of mode
  3362. @var{mode}. @var{win} will be a C statement label elsewhere in the code.
  3363. It is not necessary to define this macro, but it might be useful for
  3364. performance reasons.
  3365. For example, on the i386, it is sometimes possible to use a single
  3366. reload register instead of two by reloading a sum of two pseudo
  3367. registers into a register. On the other hand, for number of RISC
  3368. processors offsets are limited so that often an intermediate address
  3369. needs to be generated in order to address a stack slot. By defining
  3370. @code{LEGITIMIZE_RELOAD_ADDRESS} appropriately, the intermediate addresses
  3371. generated for adjacent some stack slots can be made identical, and thus
  3372. be shared.
  3373. @emph{Note}: This macro should be used with caution. It is necessary
  3374. to know something of how reload works in order to effectively use this,
  3375. and it is quite easy to produce macros that build in too much knowledge
  3376. of reload internals.
  3377. @emph{Note}: This macro must be able to reload an address created by a
  3378. previous invocation of this macro. If it fails to handle such addresses
  3379. then the compiler may generate incorrect code or abort.
  3380. @findex push_reload
  3381. The macro definition should use @code{push_reload} to indicate parts that
  3382. need reloading; @var{opnum}, @var{type} and @var{ind_levels} are usually
  3383. suitable to be passed unaltered to @code{push_reload}.
  3384. The code generated by this macro must not alter the substructure of
  3385. @var{x}. If it transforms @var{x} into a more legitimate form, it
  3386. should assign @var{x} (which will always be a C variable) a new value.
  3387. This also applies to parts that you change indirectly by calling
  3388. @code{push_reload}.
  3389. @findex strict_memory_address_p
  3390. The macro definition may use @code{strict_memory_address_p} to test if
  3391. the address has become legitimate.
  3392. @findex copy_rtx
  3393. If you want to change only a part of @var{x}, one standard way of doing
  3394. this is to use @code{copy_rtx}. Note, however, that it unshares only a
  3395. single level of rtl. Thus, if the part to be changed is not at the
  3396. top level, you'll need to replace first the top level.
  3397. It is not necessary for this macro to come up with a legitimate
  3398. address; but often a machine-dependent strategy can generate better code.
  3399. @end defmac
  3400. @hook TARGET_MODE_DEPENDENT_ADDRESS_P
  3401. @hook TARGET_LEGITIMATE_CONSTANT_P
  3402. @hook TARGET_DELEGITIMIZE_ADDRESS
  3403. @hook TARGET_CONST_NOT_OK_FOR_DEBUG_P
  3404. @hook TARGET_CANNOT_FORCE_CONST_MEM
  3405. @hook TARGET_USE_BLOCKS_FOR_CONSTANT_P
  3406. @hook TARGET_USE_BLOCKS_FOR_DECL_P
  3407. @hook TARGET_BUILTIN_RECIPROCAL
  3408. @hook TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD
  3409. @hook TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST
  3410. @hook TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE
  3411. @hook TARGET_VECTORIZE_VEC_PERM_CONST_OK
  3412. @hook TARGET_VECTORIZE_BUILTIN_CONVERSION
  3413. @hook TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION
  3414. @hook TARGET_VECTORIZE_SUPPORT_VECTOR_MISALIGNMENT
  3415. @hook TARGET_VECTORIZE_PREFERRED_SIMD_MODE
  3416. @hook TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES
  3417. @hook TARGET_VECTORIZE_INIT_COST
  3418. @hook TARGET_VECTORIZE_ADD_STMT_COST
  3419. @hook TARGET_VECTORIZE_FINISH_COST
  3420. @hook TARGET_VECTORIZE_DESTROY_COST_DATA
  3421. @hook TARGET_VECTORIZE_BUILTIN_TM_LOAD
  3422. @hook TARGET_VECTORIZE_BUILTIN_TM_STORE
  3423. @hook TARGET_VECTORIZE_BUILTIN_GATHER
  3424. @hook TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN
  3425. @hook TARGET_SIMD_CLONE_ADJUST
  3426. @hook TARGET_SIMD_CLONE_USABLE
  3427. @node Anchored Addresses
  3428. @section Anchored Addresses
  3429. @cindex anchored addresses
  3430. @cindex @option{-fsection-anchors}
  3431. GCC usually addresses every static object as a separate entity.
  3432. For example, if we have:
  3433. @smallexample
  3434. static int a, b, c;
  3435. int foo (void) @{ return a + b + c; @}
  3436. @end smallexample
  3437. the code for @code{foo} will usually calculate three separate symbolic
  3438. addresses: those of @code{a}, @code{b} and @code{c}. On some targets,
  3439. it would be better to calculate just one symbolic address and access
  3440. the three variables relative to it. The equivalent pseudocode would
  3441. be something like:
  3442. @smallexample
  3443. int foo (void)
  3444. @{
  3445. register int *xr = &x;
  3446. return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
  3447. @}
  3448. @end smallexample
  3449. (which isn't valid C). We refer to shared addresses like @code{x} as
  3450. ``section anchors''. Their use is controlled by @option{-fsection-anchors}.
  3451. The hooks below describe the target properties that GCC needs to know
  3452. in order to make effective use of section anchors. It won't use
  3453. section anchors at all unless either @code{TARGET_MIN_ANCHOR_OFFSET}
  3454. or @code{TARGET_MAX_ANCHOR_OFFSET} is set to a nonzero value.
  3455. @hook TARGET_MIN_ANCHOR_OFFSET
  3456. @hook TARGET_MAX_ANCHOR_OFFSET
  3457. @hook TARGET_ASM_OUTPUT_ANCHOR
  3458. @hook TARGET_USE_ANCHORS_FOR_SYMBOL_P
  3459. @node Condition Code
  3460. @section Condition Code Status
  3461. @cindex condition code status
  3462. The macros in this section can be split in two families, according to the
  3463. two ways of representing condition codes in GCC.
  3464. The first representation is the so called @code{(cc0)} representation
  3465. (@pxref{Jump Patterns}), where all instructions can have an implicit
  3466. clobber of the condition codes. The second is the condition code
  3467. register representation, which provides better schedulability for
  3468. architectures that do have a condition code register, but on which
  3469. most instructions do not affect it. The latter category includes
  3470. most RISC machines.
  3471. The implicit clobbering poses a strong restriction on the placement of
  3472. the definition and use of the condition code. In the past the definition
  3473. and use were always adjacent. However, recent changes to support trapping
  3474. arithmatic may result in the definition and user being in different blocks.
  3475. Thus, there may be a @code{NOTE_INSN_BASIC_BLOCK} between them. Additionally,
  3476. the definition may be the source of exception handling edges.
  3477. These restrictions can prevent important
  3478. optimizations on some machines. For example, on the IBM RS/6000, there
  3479. is a delay for taken branches unless the condition code register is set
  3480. three instructions earlier than the conditional branch. The instruction
  3481. scheduler cannot perform this optimization if it is not permitted to
  3482. separate the definition and use of the condition code register.
  3483. For this reason, it is possible and suggested to use a register to
  3484. represent the condition code for new ports. If there is a specific
  3485. condition code register in the machine, use a hard register. If the
  3486. condition code or comparison result can be placed in any general register,
  3487. or if there are multiple condition registers, use a pseudo register.
  3488. Registers used to store the condition code value will usually have a mode
  3489. that is in class @code{MODE_CC}.
  3490. Alternatively, you can use @code{BImode} if the comparison operator is
  3491. specified already in the compare instruction. In this case, you are not
  3492. interested in most macros in this section.
  3493. @menu
  3494. * CC0 Condition Codes:: Old style representation of condition codes.
  3495. * MODE_CC Condition Codes:: Modern representation of condition codes.
  3496. @end menu
  3497. @node CC0 Condition Codes
  3498. @subsection Representation of condition codes using @code{(cc0)}
  3499. @findex cc0
  3500. @findex cc_status
  3501. The file @file{conditions.h} defines a variable @code{cc_status} to
  3502. describe how the condition code was computed (in case the interpretation of
  3503. the condition code depends on the instruction that it was set by). This
  3504. variable contains the RTL expressions on which the condition code is
  3505. currently based, and several standard flags.
  3506. Sometimes additional machine-specific flags must be defined in the machine
  3507. description header file. It can also add additional machine-specific
  3508. information by defining @code{CC_STATUS_MDEP}.
  3509. @defmac CC_STATUS_MDEP
  3510. C code for a data type which is used for declaring the @code{mdep}
  3511. component of @code{cc_status}. It defaults to @code{int}.
  3512. This macro is not used on machines that do not use @code{cc0}.
  3513. @end defmac
  3514. @defmac CC_STATUS_MDEP_INIT
  3515. A C expression to initialize the @code{mdep} field to ``empty''.
  3516. The default definition does nothing, since most machines don't use
  3517. the field anyway. If you want to use the field, you should probably
  3518. define this macro to initialize it.
  3519. This macro is not used on machines that do not use @code{cc0}.
  3520. @end defmac
  3521. @defmac NOTICE_UPDATE_CC (@var{exp}, @var{insn})
  3522. A C compound statement to set the components of @code{cc_status}
  3523. appropriately for an insn @var{insn} whose body is @var{exp}. It is
  3524. this macro's responsibility to recognize insns that set the condition
  3525. code as a byproduct of other activity as well as those that explicitly
  3526. set @code{(cc0)}.
  3527. This macro is not used on machines that do not use @code{cc0}.
  3528. If there are insns that do not set the condition code but do alter
  3529. other machine registers, this macro must check to see whether they
  3530. invalidate the expressions that the condition code is recorded as
  3531. reflecting. For example, on the 68000, insns that store in address
  3532. registers do not set the condition code, which means that usually
  3533. @code{NOTICE_UPDATE_CC} can leave @code{cc_status} unaltered for such
  3534. insns. But suppose that the previous insn set the condition code
  3535. based on location @samp{a4@@(102)} and the current insn stores a new
  3536. value in @samp{a4}. Although the condition code is not changed by
  3537. this, it will no longer be true that it reflects the contents of
  3538. @samp{a4@@(102)}. Therefore, @code{NOTICE_UPDATE_CC} must alter
  3539. @code{cc_status} in this case to say that nothing is known about the
  3540. condition code value.
  3541. The definition of @code{NOTICE_UPDATE_CC} must be prepared to deal
  3542. with the results of peephole optimization: insns whose patterns are
  3543. @code{parallel} RTXs containing various @code{reg}, @code{mem} or
  3544. constants which are just the operands. The RTL structure of these
  3545. insns is not sufficient to indicate what the insns actually do. What
  3546. @code{NOTICE_UPDATE_CC} should do when it sees one is just to run
  3547. @code{CC_STATUS_INIT}.
  3548. A possible definition of @code{NOTICE_UPDATE_CC} is to call a function
  3549. that looks at an attribute (@pxref{Insn Attributes}) named, for example,
  3550. @samp{cc}. This avoids having detailed information about patterns in
  3551. two places, the @file{md} file and in @code{NOTICE_UPDATE_CC}.
  3552. @end defmac
  3553. @node MODE_CC Condition Codes
  3554. @subsection Representation of condition codes using registers
  3555. @findex CCmode
  3556. @findex MODE_CC
  3557. @defmac SELECT_CC_MODE (@var{op}, @var{x}, @var{y})
  3558. On many machines, the condition code may be produced by other instructions
  3559. than compares, for example the branch can use directly the condition
  3560. code set by a subtract instruction. However, on some machines
  3561. when the condition code is set this way some bits (such as the overflow
  3562. bit) are not set in the same way as a test instruction, so that a different
  3563. branch instruction must be used for some conditional branches. When
  3564. this happens, use the machine mode of the condition code register to
  3565. record different formats of the condition code register. Modes can
  3566. also be used to record which compare instruction (e.g. a signed or an
  3567. unsigned comparison) produced the condition codes.
  3568. If other modes than @code{CCmode} are required, add them to
  3569. @file{@var{machine}-modes.def} and define @code{SELECT_CC_MODE} to choose
  3570. a mode given an operand of a compare. This is needed because the modes
  3571. have to be chosen not only during RTL generation but also, for example,
  3572. by instruction combination. The result of @code{SELECT_CC_MODE} should
  3573. be consistent with the mode used in the patterns; for example to support
  3574. the case of the add on the SPARC discussed above, we have the pattern
  3575. @smallexample
  3576. (define_insn ""
  3577. [(set (reg:CC_NOOV 0)
  3578. (compare:CC_NOOV
  3579. (plus:SI (match_operand:SI 0 "register_operand" "%r")
  3580. (match_operand:SI 1 "arith_operand" "rI"))
  3581. (const_int 0)))]
  3582. ""
  3583. "@dots{}")
  3584. @end smallexample
  3585. @noindent
  3586. together with a @code{SELECT_CC_MODE} that returns @code{CC_NOOVmode}
  3587. for comparisons whose argument is a @code{plus}:
  3588. @smallexample
  3589. #define SELECT_CC_MODE(OP,X,Y) \
  3590. (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \
  3591. ? ((OP == LT || OP == LE || OP == GT || OP == GE) \
  3592. ? CCFPEmode : CCFPmode) \
  3593. : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS \
  3594. || GET_CODE (X) == NEG || GET_CODE (x) == ASHIFT) \
  3595. ? CC_NOOVmode : CCmode))
  3596. @end smallexample
  3597. Another reason to use modes is to retain information on which operands
  3598. were used by the comparison; see @code{REVERSIBLE_CC_MODE} later in
  3599. this section.
  3600. You should define this macro if and only if you define extra CC modes
  3601. in @file{@var{machine}-modes.def}.
  3602. @end defmac
  3603. @hook TARGET_CANONICALIZE_COMPARISON
  3604. @defmac REVERSIBLE_CC_MODE (@var{mode})
  3605. A C expression whose value is one if it is always safe to reverse a
  3606. comparison whose mode is @var{mode}. If @code{SELECT_CC_MODE}
  3607. can ever return @var{mode} for a floating-point inequality comparison,
  3608. then @code{REVERSIBLE_CC_MODE (@var{mode})} must be zero.
  3609. You need not define this macro if it would always returns zero or if the
  3610. floating-point format is anything other than @code{IEEE_FLOAT_FORMAT}.
  3611. For example, here is the definition used on the SPARC, where floating-point
  3612. inequality comparisons are given either @code{CCFPEmode} or @code{CCFPmode}:
  3613. @smallexample
  3614. #define REVERSIBLE_CC_MODE(MODE) \
  3615. ((MODE) != CCFPEmode && (MODE) != CCFPmode)
  3616. @end smallexample
  3617. @end defmac
  3618. @defmac REVERSE_CONDITION (@var{code}, @var{mode})
  3619. A C expression whose value is reversed condition code of the @var{code} for
  3620. comparison done in CC_MODE @var{mode}. The macro is used only in case
  3621. @code{REVERSIBLE_CC_MODE (@var{mode})} is nonzero. Define this macro in case
  3622. machine has some non-standard way how to reverse certain conditionals. For
  3623. instance in case all floating point conditions are non-trapping, compiler may
  3624. freely convert unordered compares to ordered ones. Then definition may look
  3625. like:
  3626. @smallexample
  3627. #define REVERSE_CONDITION(CODE, MODE) \
  3628. ((MODE) != CCFPmode ? reverse_condition (CODE) \
  3629. : reverse_condition_maybe_unordered (CODE))
  3630. @end smallexample
  3631. @end defmac
  3632. @hook TARGET_FIXED_CONDITION_CODE_REGS
  3633. @hook TARGET_CC_MODES_COMPATIBLE
  3634. @hook TARGET_FLAGS_REGNUM
  3635. @node Costs
  3636. @section Describing Relative Costs of Operations
  3637. @cindex costs of instructions
  3638. @cindex relative costs
  3639. @cindex speed of instructions
  3640. These macros let you describe the relative speed of various operations
  3641. on the target machine.
  3642. @defmac REGISTER_MOVE_COST (@var{mode}, @var{from}, @var{to})
  3643. A C expression for the cost of moving data of mode @var{mode} from a
  3644. register in class @var{from} to one in class @var{to}. The classes are
  3645. expressed using the enumeration values such as @code{GENERAL_REGS}. A
  3646. value of 2 is the default; other values are interpreted relative to
  3647. that.
  3648. It is not required that the cost always equal 2 when @var{from} is the
  3649. same as @var{to}; on some machines it is expensive to move between
  3650. registers if they are not general registers.
  3651. If reload sees an insn consisting of a single @code{set} between two
  3652. hard registers, and if @code{REGISTER_MOVE_COST} applied to their
  3653. classes returns a value of 2, reload does not check to ensure that the
  3654. constraints of the insn are met. Setting a cost of other than 2 will
  3655. allow reload to verify that the constraints are met. You should do this
  3656. if the @samp{mov@var{m}} pattern's constraints do not allow such copying.
  3657. These macros are obsolete, new ports should use the target hook
  3658. @code{TARGET_REGISTER_MOVE_COST} instead.
  3659. @end defmac
  3660. @hook TARGET_REGISTER_MOVE_COST
  3661. @defmac MEMORY_MOVE_COST (@var{mode}, @var{class}, @var{in})
  3662. A C expression for the cost of moving data of mode @var{mode} between a
  3663. register of class @var{class} and memory; @var{in} is zero if the value
  3664. is to be written to memory, nonzero if it is to be read in. This cost
  3665. is relative to those in @code{REGISTER_MOVE_COST}. If moving between
  3666. registers and memory is more expensive than between two registers, you
  3667. should define this macro to express the relative cost.
  3668. If you do not define this macro, GCC uses a default cost of 4 plus
  3669. the cost of copying via a secondary reload register, if one is
  3670. needed. If your machine requires a secondary reload register to copy
  3671. between memory and a register of @var{class} but the reload mechanism is
  3672. more complex than copying via an intermediate, define this macro to
  3673. reflect the actual cost of the move.
  3674. GCC defines the function @code{memory_move_secondary_cost} if
  3675. secondary reloads are needed. It computes the costs due to copying via
  3676. a secondary register. If your machine copies from memory using a
  3677. secondary register in the conventional way but the default base value of
  3678. 4 is not correct for your machine, define this macro to add some other
  3679. value to the result of that function. The arguments to that function
  3680. are the same as to this macro.
  3681. These macros are obsolete, new ports should use the target hook
  3682. @code{TARGET_MEMORY_MOVE_COST} instead.
  3683. @end defmac
  3684. @hook TARGET_MEMORY_MOVE_COST
  3685. @defmac BRANCH_COST (@var{speed_p}, @var{predictable_p})
  3686. A C expression for the cost of a branch instruction. A value of 1 is
  3687. the default; other values are interpreted relative to that. Parameter
  3688. @var{speed_p} is true when the branch in question should be optimized
  3689. for speed. When it is false, @code{BRANCH_COST} should return a value
  3690. optimal for code size rather than performance. @var{predictable_p} is
  3691. true for well-predicted branches. On many architectures the
  3692. @code{BRANCH_COST} can be reduced then.
  3693. @end defmac
  3694. Here are additional macros which do not specify precise relative costs,
  3695. but only that certain actions are more expensive than GCC would
  3696. ordinarily expect.
  3697. @defmac SLOW_BYTE_ACCESS
  3698. Define this macro as a C expression which is nonzero if accessing less
  3699. than a word of memory (i.e.@: a @code{char} or a @code{short}) is no
  3700. faster than accessing a word of memory, i.e., if such access
  3701. require more than one instruction or if there is no difference in cost
  3702. between byte and (aligned) word loads.
  3703. When this macro is not defined, the compiler will access a field by
  3704. finding the smallest containing object; when it is defined, a fullword
  3705. load will be used if alignment permits. Unless bytes accesses are
  3706. faster than word accesses, using word accesses is preferable since it
  3707. may eliminate subsequent memory access if subsequent accesses occur to
  3708. other fields in the same word of the structure, but to different bytes.
  3709. @end defmac
  3710. @defmac SLOW_UNALIGNED_ACCESS (@var{mode}, @var{alignment})
  3711. Define this macro to be the value 1 if memory accesses described by the
  3712. @var{mode} and @var{alignment} parameters have a cost many times greater
  3713. than aligned accesses, for example if they are emulated in a trap
  3714. handler.
  3715. When this macro is nonzero, the compiler will act as if
  3716. @code{STRICT_ALIGNMENT} were nonzero when generating code for block
  3717. moves. This can cause significantly more instructions to be produced.
  3718. Therefore, do not set this macro nonzero if unaligned accesses only add a
  3719. cycle or two to the time for a memory access.
  3720. If the value of this macro is always zero, it need not be defined. If
  3721. this macro is defined, it should produce a nonzero value when
  3722. @code{STRICT_ALIGNMENT} is nonzero.
  3723. @end defmac
  3724. @defmac MOVE_RATIO (@var{speed})
  3725. The threshold of number of scalar memory-to-memory move insns, @emph{below}
  3726. which a sequence of insns should be generated instead of a
  3727. string move insn or a library call. Increasing the value will always
  3728. make code faster, but eventually incurs high cost in increased code size.
  3729. Note that on machines where the corresponding move insn is a
  3730. @code{define_expand} that emits a sequence of insns, this macro counts
  3731. the number of such sequences.
  3732. The parameter @var{speed} is true if the code is currently being
  3733. optimized for speed rather than size.
  3734. If you don't define this, a reasonable default is used.
  3735. @end defmac
  3736. @hook TARGET_USE_BY_PIECES_INFRASTRUCTURE_P
  3737. @defmac MOVE_MAX_PIECES
  3738. A C expression used by @code{move_by_pieces} to determine the largest unit
  3739. a load or store used to copy memory is. Defaults to @code{MOVE_MAX}.
  3740. @end defmac
  3741. @defmac CLEAR_RATIO (@var{speed})
  3742. The threshold of number of scalar move insns, @emph{below} which a sequence
  3743. of insns should be generated to clear memory instead of a string clear insn
  3744. or a library call. Increasing the value will always make code faster, but
  3745. eventually incurs high cost in increased code size.
  3746. The parameter @var{speed} is true if the code is currently being
  3747. optimized for speed rather than size.
  3748. If you don't define this, a reasonable default is used.
  3749. @end defmac
  3750. @defmac SET_RATIO (@var{speed})
  3751. The threshold of number of scalar move insns, @emph{below} which a sequence
  3752. of insns should be generated to set memory to a constant value, instead of
  3753. a block set insn or a library call.
  3754. Increasing the value will always make code faster, but
  3755. eventually incurs high cost in increased code size.
  3756. The parameter @var{speed} is true if the code is currently being
  3757. optimized for speed rather than size.
  3758. If you don't define this, it defaults to the value of @code{MOVE_RATIO}.
  3759. @end defmac
  3760. @defmac USE_LOAD_POST_INCREMENT (@var{mode})
  3761. A C expression used to determine whether a load postincrement is a good
  3762. thing to use for a given mode. Defaults to the value of
  3763. @code{HAVE_POST_INCREMENT}.
  3764. @end defmac
  3765. @defmac USE_LOAD_POST_DECREMENT (@var{mode})
  3766. A C expression used to determine whether a load postdecrement is a good
  3767. thing to use for a given mode. Defaults to the value of
  3768. @code{HAVE_POST_DECREMENT}.
  3769. @end defmac
  3770. @defmac USE_LOAD_PRE_INCREMENT (@var{mode})
  3771. A C expression used to determine whether a load preincrement is a good
  3772. thing to use for a given mode. Defaults to the value of
  3773. @code{HAVE_PRE_INCREMENT}.
  3774. @end defmac
  3775. @defmac USE_LOAD_PRE_DECREMENT (@var{mode})
  3776. A C expression used to determine whether a load predecrement is a good
  3777. thing to use for a given mode. Defaults to the value of
  3778. @code{HAVE_PRE_DECREMENT}.
  3779. @end defmac
  3780. @defmac USE_STORE_POST_INCREMENT (@var{mode})
  3781. A C expression used to determine whether a store postincrement is a good
  3782. thing to use for a given mode. Defaults to the value of
  3783. @code{HAVE_POST_INCREMENT}.
  3784. @end defmac
  3785. @defmac USE_STORE_POST_DECREMENT (@var{mode})
  3786. A C expression used to determine whether a store postdecrement is a good
  3787. thing to use for a given mode. Defaults to the value of
  3788. @code{HAVE_POST_DECREMENT}.
  3789. @end defmac
  3790. @defmac USE_STORE_PRE_INCREMENT (@var{mode})
  3791. This macro is used to determine whether a store preincrement is a good
  3792. thing to use for a given mode. Defaults to the value of
  3793. @code{HAVE_PRE_INCREMENT}.
  3794. @end defmac
  3795. @defmac USE_STORE_PRE_DECREMENT (@var{mode})
  3796. This macro is used to determine whether a store predecrement is a good
  3797. thing to use for a given mode. Defaults to the value of
  3798. @code{HAVE_PRE_DECREMENT}.
  3799. @end defmac
  3800. @defmac NO_FUNCTION_CSE
  3801. Define this macro if it is as good or better to call a constant
  3802. function address than to call an address kept in a register.
  3803. @end defmac
  3804. @defmac LOGICAL_OP_NON_SHORT_CIRCUIT
  3805. Define this macro if a non-short-circuit operation produced by
  3806. @samp{fold_range_test ()} is optimal. This macro defaults to true if
  3807. @code{BRANCH_COST} is greater than or equal to the value 2.
  3808. @end defmac
  3809. @hook TARGET_RTX_COSTS
  3810. @hook TARGET_ADDRESS_COST
  3811. @node Scheduling
  3812. @section Adjusting the Instruction Scheduler
  3813. The instruction scheduler may need a fair amount of machine-specific
  3814. adjustment in order to produce good code. GCC provides several target
  3815. hooks for this purpose. It is usually enough to define just a few of
  3816. them: try the first ones in this list first.
  3817. @hook TARGET_SCHED_ISSUE_RATE
  3818. @hook TARGET_SCHED_VARIABLE_ISSUE
  3819. @hook TARGET_SCHED_ADJUST_COST
  3820. @hook TARGET_SCHED_ADJUST_PRIORITY
  3821. @hook TARGET_SCHED_REORDER
  3822. @hook TARGET_SCHED_REORDER2
  3823. @hook TARGET_SCHED_MACRO_FUSION_P
  3824. @hook TARGET_SCHED_MACRO_FUSION_PAIR_P
  3825. @hook TARGET_SCHED_DEPENDENCIES_EVALUATION_HOOK
  3826. @hook TARGET_SCHED_INIT
  3827. @hook TARGET_SCHED_FINISH
  3828. @hook TARGET_SCHED_INIT_GLOBAL
  3829. @hook TARGET_SCHED_FINISH_GLOBAL
  3830. @hook TARGET_SCHED_DFA_PRE_CYCLE_INSN
  3831. @hook TARGET_SCHED_INIT_DFA_PRE_CYCLE_INSN
  3832. @hook TARGET_SCHED_DFA_POST_CYCLE_INSN
  3833. @hook TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN
  3834. @hook TARGET_SCHED_DFA_PRE_ADVANCE_CYCLE
  3835. @hook TARGET_SCHED_DFA_POST_ADVANCE_CYCLE
  3836. @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD
  3837. @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD_GUARD
  3838. @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_BEGIN
  3839. @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_ISSUE
  3840. @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_BACKTRACK
  3841. @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_END
  3842. @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_INIT
  3843. @hook TARGET_SCHED_FIRST_CYCLE_MULTIPASS_FINI
  3844. @hook TARGET_SCHED_DFA_NEW_CYCLE
  3845. @hook TARGET_SCHED_IS_COSTLY_DEPENDENCE
  3846. @hook TARGET_SCHED_H_I_D_EXTENDED
  3847. @hook TARGET_SCHED_ALLOC_SCHED_CONTEXT
  3848. @hook TARGET_SCHED_INIT_SCHED_CONTEXT
  3849. @hook TARGET_SCHED_SET_SCHED_CONTEXT
  3850. @hook TARGET_SCHED_CLEAR_SCHED_CONTEXT
  3851. @hook TARGET_SCHED_FREE_SCHED_CONTEXT
  3852. @hook TARGET_SCHED_SPECULATE_INSN
  3853. @hook TARGET_SCHED_NEEDS_BLOCK_P
  3854. @hook TARGET_SCHED_GEN_SPEC_CHECK
  3855. @hook TARGET_SCHED_SET_SCHED_FLAGS
  3856. @hook TARGET_SCHED_SMS_RES_MII
  3857. @hook TARGET_SCHED_DISPATCH
  3858. @hook TARGET_SCHED_DISPATCH_DO
  3859. @hook TARGET_SCHED_EXPOSED_PIPELINE
  3860. @hook TARGET_SCHED_REASSOCIATION_WIDTH
  3861. @hook TARGET_SCHED_FUSION_PRIORITY
  3862. @node Sections
  3863. @section Dividing the Output into Sections (Texts, Data, @dots{})
  3864. @c the above section title is WAY too long. maybe cut the part between
  3865. @c the (...)? --mew 10feb93
  3866. An object file is divided into sections containing different types of
  3867. data. In the most common case, there are three sections: the @dfn{text
  3868. section}, which holds instructions and read-only data; the @dfn{data
  3869. section}, which holds initialized writable data; and the @dfn{bss
  3870. section}, which holds uninitialized data. Some systems have other kinds
  3871. of sections.
  3872. @file{varasm.c} provides several well-known sections, such as
  3873. @code{text_section}, @code{data_section} and @code{bss_section}.
  3874. The normal way of controlling a @code{@var{foo}_section} variable
  3875. is to define the associated @code{@var{FOO}_SECTION_ASM_OP} macro,
  3876. as described below. The macros are only read once, when @file{varasm.c}
  3877. initializes itself, so their values must be run-time constants.
  3878. They may however depend on command-line flags.
  3879. @emph{Note:} Some run-time files, such @file{crtstuff.c}, also make
  3880. use of the @code{@var{FOO}_SECTION_ASM_OP} macros, and expect them
  3881. to be string literals.
  3882. Some assemblers require a different string to be written every time a
  3883. section is selected. If your assembler falls into this category, you
  3884. should define the @code{TARGET_ASM_INIT_SECTIONS} hook and use
  3885. @code{get_unnamed_section} to set up the sections.
  3886. You must always create a @code{text_section}, either by defining
  3887. @code{TEXT_SECTION_ASM_OP} or by initializing @code{text_section}
  3888. in @code{TARGET_ASM_INIT_SECTIONS}. The same is true of
  3889. @code{data_section} and @code{DATA_SECTION_ASM_OP}. If you do not
  3890. create a distinct @code{readonly_data_section}, the default is to
  3891. reuse @code{text_section}.
  3892. All the other @file{varasm.c} sections are optional, and are null
  3893. if the target does not provide them.
  3894. @defmac TEXT_SECTION_ASM_OP
  3895. A C expression whose value is a string, including spacing, containing the
  3896. assembler operation that should precede instructions and read-only data.
  3897. Normally @code{"\t.text"} is right.
  3898. @end defmac
  3899. @defmac HOT_TEXT_SECTION_NAME
  3900. If defined, a C string constant for the name of the section containing most
  3901. frequently executed functions of the program. If not defined, GCC will provide
  3902. a default definition if the target supports named sections.
  3903. @end defmac
  3904. @defmac UNLIKELY_EXECUTED_TEXT_SECTION_NAME
  3905. If defined, a C string constant for the name of the section containing unlikely
  3906. executed functions in the program.
  3907. @end defmac
  3908. @defmac DATA_SECTION_ASM_OP
  3909. A C expression whose value is a string, including spacing, containing the
  3910. assembler operation to identify the following data as writable initialized
  3911. data. Normally @code{"\t.data"} is right.
  3912. @end defmac
  3913. @defmac SDATA_SECTION_ASM_OP
  3914. If defined, a C expression whose value is a string, including spacing,
  3915. containing the assembler operation to identify the following data as
  3916. initialized, writable small data.
  3917. @end defmac
  3918. @defmac READONLY_DATA_SECTION_ASM_OP
  3919. A C expression whose value is a string, including spacing, containing the
  3920. assembler operation to identify the following data as read-only initialized
  3921. data.
  3922. @end defmac
  3923. @defmac BSS_SECTION_ASM_OP
  3924. If defined, a C expression whose value is a string, including spacing,
  3925. containing the assembler operation to identify the following data as
  3926. uninitialized global data. If not defined, and
  3927. @code{ASM_OUTPUT_ALIGNED_BSS} not defined,
  3928. uninitialized global data will be output in the data section if
  3929. @option{-fno-common} is passed, otherwise @code{ASM_OUTPUT_COMMON} will be
  3930. used.
  3931. @end defmac
  3932. @defmac SBSS_SECTION_ASM_OP
  3933. If defined, a C expression whose value is a string, including spacing,
  3934. containing the assembler operation to identify the following data as
  3935. uninitialized, writable small data.
  3936. @end defmac
  3937. @defmac TLS_COMMON_ASM_OP
  3938. If defined, a C expression whose value is a string containing the
  3939. assembler operation to identify the following data as thread-local
  3940. common data. The default is @code{".tls_common"}.
  3941. @end defmac
  3942. @defmac TLS_SECTION_ASM_FLAG
  3943. If defined, a C expression whose value is a character constant
  3944. containing the flag used to mark a section as a TLS section. The
  3945. default is @code{'T'}.
  3946. @end defmac
  3947. @defmac INIT_SECTION_ASM_OP
  3948. If defined, a C expression whose value is a string, including spacing,
  3949. containing the assembler operation to identify the following data as
  3950. initialization code. If not defined, GCC will assume such a section does
  3951. not exist. This section has no corresponding @code{init_section}
  3952. variable; it is used entirely in runtime code.
  3953. @end defmac
  3954. @defmac FINI_SECTION_ASM_OP
  3955. If defined, a C expression whose value is a string, including spacing,
  3956. containing the assembler operation to identify the following data as
  3957. finalization code. If not defined, GCC will assume such a section does
  3958. not exist. This section has no corresponding @code{fini_section}
  3959. variable; it is used entirely in runtime code.
  3960. @end defmac
  3961. @defmac INIT_ARRAY_SECTION_ASM_OP
  3962. If defined, a C expression whose value is a string, including spacing,
  3963. containing the assembler operation to identify the following data as
  3964. part of the @code{.init_array} (or equivalent) section. If not
  3965. defined, GCC will assume such a section does not exist. Do not define
  3966. both this macro and @code{INIT_SECTION_ASM_OP}.
  3967. @end defmac
  3968. @defmac FINI_ARRAY_SECTION_ASM_OP
  3969. If defined, a C expression whose value is a string, including spacing,
  3970. containing the assembler operation to identify the following data as
  3971. part of the @code{.fini_array} (or equivalent) section. If not
  3972. defined, GCC will assume such a section does not exist. Do not define
  3973. both this macro and @code{FINI_SECTION_ASM_OP}.
  3974. @end defmac
  3975. @defmac CRT_CALL_STATIC_FUNCTION (@var{section_op}, @var{function})
  3976. If defined, an ASM statement that switches to a different section
  3977. via @var{section_op}, calls @var{function}, and switches back to
  3978. the text section. This is used in @file{crtstuff.c} if
  3979. @code{INIT_SECTION_ASM_OP} or @code{FINI_SECTION_ASM_OP} to calls
  3980. to initialization and finalization functions from the init and fini
  3981. sections. By default, this macro uses a simple function call. Some
  3982. ports need hand-crafted assembly code to avoid dependencies on
  3983. registers initialized in the function prologue or to ensure that
  3984. constant pools don't end up too far way in the text section.
  3985. @end defmac
  3986. @defmac TARGET_LIBGCC_SDATA_SECTION
  3987. If defined, a string which names the section into which small
  3988. variables defined in crtstuff and libgcc should go. This is useful
  3989. when the target has options for optimizing access to small data, and
  3990. you want the crtstuff and libgcc routines to be conservative in what
  3991. they expect of your application yet liberal in what your application
  3992. expects. For example, for targets with a @code{.sdata} section (like
  3993. MIPS), you could compile crtstuff with @code{-G 0} so that it doesn't
  3994. require small data support from your application, but use this macro
  3995. to put small data into @code{.sdata} so that your application can
  3996. access these variables whether it uses small data or not.
  3997. @end defmac
  3998. @defmac FORCE_CODE_SECTION_ALIGN
  3999. If defined, an ASM statement that aligns a code section to some
  4000. arbitrary boundary. This is used to force all fragments of the
  4001. @code{.init} and @code{.fini} sections to have to same alignment
  4002. and thus prevent the linker from having to add any padding.
  4003. @end defmac
  4004. @defmac JUMP_TABLES_IN_TEXT_SECTION
  4005. Define this macro to be an expression with a nonzero value if jump
  4006. tables (for @code{tablejump} insns) should be output in the text
  4007. section, along with the assembler instructions. Otherwise, the
  4008. readonly data section is used.
  4009. This macro is irrelevant if there is no separate readonly data section.
  4010. @end defmac
  4011. @hook TARGET_ASM_INIT_SECTIONS
  4012. @hook TARGET_ASM_RELOC_RW_MASK
  4013. @hook TARGET_ASM_SELECT_SECTION
  4014. @defmac USE_SELECT_SECTION_FOR_FUNCTIONS
  4015. Define this macro if you wish TARGET_ASM_SELECT_SECTION to be called
  4016. for @code{FUNCTION_DECL}s as well as for variables and constants.
  4017. In the case of a @code{FUNCTION_DECL}, @var{reloc} will be zero if the
  4018. function has been determined to be likely to be called, and nonzero if
  4019. it is unlikely to be called.
  4020. @end defmac
  4021. @hook TARGET_ASM_UNIQUE_SECTION
  4022. @hook TARGET_ASM_FUNCTION_RODATA_SECTION
  4023. @hook TARGET_ASM_MERGEABLE_RODATA_PREFIX
  4024. @hook TARGET_ASM_TM_CLONE_TABLE_SECTION
  4025. @hook TARGET_ASM_SELECT_RTX_SECTION
  4026. @hook TARGET_MANGLE_DECL_ASSEMBLER_NAME
  4027. @hook TARGET_ENCODE_SECTION_INFO
  4028. @hook TARGET_STRIP_NAME_ENCODING
  4029. @hook TARGET_IN_SMALL_DATA_P
  4030. @hook TARGET_HAVE_SRODATA_SECTION
  4031. @hook TARGET_PROFILE_BEFORE_PROLOGUE
  4032. @hook TARGET_BINDS_LOCAL_P
  4033. @hook TARGET_HAVE_TLS
  4034. @node PIC
  4035. @section Position Independent Code
  4036. @cindex position independent code
  4037. @cindex PIC
  4038. This section describes macros that help implement generation of position
  4039. independent code. Simply defining these macros is not enough to
  4040. generate valid PIC; you must also add support to the hook
  4041. @code{TARGET_LEGITIMATE_ADDRESS_P} and to the macro
  4042. @code{PRINT_OPERAND_ADDRESS}, as well as @code{LEGITIMIZE_ADDRESS}. You
  4043. must modify the definition of @samp{movsi} to do something appropriate
  4044. when the source operand contains a symbolic address. You may also
  4045. need to alter the handling of switch statements so that they use
  4046. relative addresses.
  4047. @c i rearranged the order of the macros above to try to force one of
  4048. @c them to the next line, to eliminate an overfull hbox. --mew 10feb93
  4049. @defmac PIC_OFFSET_TABLE_REGNUM
  4050. The register number of the register used to address a table of static
  4051. data addresses in memory. In some cases this register is defined by a
  4052. processor's ``application binary interface'' (ABI)@. When this macro
  4053. is defined, RTL is generated for this register once, as with the stack
  4054. pointer and frame pointer registers. If this macro is not defined, it
  4055. is up to the machine-dependent files to allocate such a register (if
  4056. necessary). Note that this register must be fixed when in use (e.g.@:
  4057. when @code{flag_pic} is true).
  4058. @end defmac
  4059. @defmac PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
  4060. A C expression that is nonzero if the register defined by
  4061. @code{PIC_OFFSET_TABLE_REGNUM} is clobbered by calls. If not defined,
  4062. the default is zero. Do not define
  4063. this macro if @code{PIC_OFFSET_TABLE_REGNUM} is not defined.
  4064. @end defmac
  4065. @defmac LEGITIMATE_PIC_OPERAND_P (@var{x})
  4066. A C expression that is nonzero if @var{x} is a legitimate immediate
  4067. operand on the target machine when generating position independent code.
  4068. You can assume that @var{x} satisfies @code{CONSTANT_P}, so you need not
  4069. check this. You can also assume @var{flag_pic} is true, so you need not
  4070. check it either. You need not define this macro if all constants
  4071. (including @code{SYMBOL_REF}) can be immediate operands when generating
  4072. position independent code.
  4073. @end defmac
  4074. @node Assembler Format
  4075. @section Defining the Output Assembler Language
  4076. This section describes macros whose principal purpose is to describe how
  4077. to write instructions in assembler language---rather than what the
  4078. instructions do.
  4079. @menu
  4080. * File Framework:: Structural information for the assembler file.
  4081. * Data Output:: Output of constants (numbers, strings, addresses).
  4082. * Uninitialized Data:: Output of uninitialized variables.
  4083. * Label Output:: Output and generation of labels.
  4084. * Initialization:: General principles of initialization
  4085. and termination routines.
  4086. * Macros for Initialization::
  4087. Specific macros that control the handling of
  4088. initialization and termination routines.
  4089. * Instruction Output:: Output of actual instructions.
  4090. * Dispatch Tables:: Output of jump tables.
  4091. * Exception Region Output:: Output of exception region code.
  4092. * Alignment Output:: Pseudo ops for alignment and skipping data.
  4093. @end menu
  4094. @node File Framework
  4095. @subsection The Overall Framework of an Assembler File
  4096. @cindex assembler format
  4097. @cindex output of assembler code
  4098. @c prevent bad page break with this line
  4099. This describes the overall framework of an assembly file.
  4100. @findex default_file_start
  4101. @hook TARGET_ASM_FILE_START
  4102. @hook TARGET_ASM_FILE_START_APP_OFF
  4103. @hook TARGET_ASM_FILE_START_FILE_DIRECTIVE
  4104. @hook TARGET_ASM_FILE_END
  4105. @deftypefun void file_end_indicate_exec_stack ()
  4106. Some systems use a common convention, the @samp{.note.GNU-stack}
  4107. special section, to indicate whether or not an object file relies on
  4108. the stack being executable. If your system uses this convention, you
  4109. should define @code{TARGET_ASM_FILE_END} to this function. If you
  4110. need to do other things in that hook, have your hook function call
  4111. this function.
  4112. @end deftypefun
  4113. @hook TARGET_ASM_LTO_START
  4114. @hook TARGET_ASM_LTO_END
  4115. @hook TARGET_ASM_CODE_END
  4116. @defmac ASM_COMMENT_START
  4117. A C string constant describing how to begin a comment in the target
  4118. assembler language. The compiler assumes that the comment will end at
  4119. the end of the line.
  4120. @end defmac
  4121. @defmac ASM_APP_ON
  4122. A C string constant for text to be output before each @code{asm}
  4123. statement or group of consecutive ones. Normally this is
  4124. @code{"#APP"}, which is a comment that has no effect on most
  4125. assemblers but tells the GNU assembler that it must check the lines
  4126. that follow for all valid assembler constructs.
  4127. @end defmac
  4128. @defmac ASM_APP_OFF
  4129. A C string constant for text to be output after each @code{asm}
  4130. statement or group of consecutive ones. Normally this is
  4131. @code{"#NO_APP"}, which tells the GNU assembler to resume making the
  4132. time-saving assumptions that are valid for ordinary compiler output.
  4133. @end defmac
  4134. @defmac ASM_OUTPUT_SOURCE_FILENAME (@var{stream}, @var{name})
  4135. A C statement to output COFF information or DWARF debugging information
  4136. which indicates that filename @var{name} is the current source file to
  4137. the stdio stream @var{stream}.
  4138. This macro need not be defined if the standard form of output
  4139. for the file format in use is appropriate.
  4140. @end defmac
  4141. @hook TARGET_ASM_OUTPUT_SOURCE_FILENAME
  4142. @hook TARGET_ASM_OUTPUT_IDENT
  4143. @defmac OUTPUT_QUOTED_STRING (@var{stream}, @var{string})
  4144. A C statement to output the string @var{string} to the stdio stream
  4145. @var{stream}. If you do not call the function @code{output_quoted_string}
  4146. in your config files, GCC will only call it to output filenames to
  4147. the assembler source. So you can use it to canonicalize the format
  4148. of the filename using this macro.
  4149. @end defmac
  4150. @hook TARGET_ASM_NAMED_SECTION
  4151. @hook TARGET_ASM_FUNCTION_SECTION
  4152. @hook TARGET_ASM_FUNCTION_SWITCHED_TEXT_SECTIONS
  4153. @hook TARGET_HAVE_NAMED_SECTIONS
  4154. This flag is true if the target supports @code{TARGET_ASM_NAMED_SECTION}.
  4155. It must not be modified by command-line option processing.
  4156. @end deftypevr
  4157. @anchor{TARGET_HAVE_SWITCHABLE_BSS_SECTIONS}
  4158. @hook TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
  4159. @hook TARGET_SECTION_TYPE_FLAGS
  4160. @hook TARGET_ASM_RECORD_GCC_SWITCHES
  4161. @hook TARGET_ASM_RECORD_GCC_SWITCHES_SECTION
  4162. @need 2000
  4163. @node Data Output
  4164. @subsection Output of Data
  4165. @hook TARGET_ASM_BYTE_OP
  4166. @hook TARGET_ASM_INTEGER
  4167. @hook TARGET_ASM_DECL_END
  4168. @hook TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
  4169. @defmac ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len})
  4170. A C statement to output to the stdio stream @var{stream} an assembler
  4171. instruction to assemble a string constant containing the @var{len}
  4172. bytes at @var{ptr}. @var{ptr} will be a C expression of type
  4173. @code{char *} and @var{len} a C expression of type @code{int}.
  4174. If the assembler has a @code{.ascii} pseudo-op as found in the
  4175. Berkeley Unix assembler, do not define the macro
  4176. @code{ASM_OUTPUT_ASCII}.
  4177. @end defmac
  4178. @defmac ASM_OUTPUT_FDESC (@var{stream}, @var{decl}, @var{n})
  4179. A C statement to output word @var{n} of a function descriptor for
  4180. @var{decl}. This must be defined if @code{TARGET_VTABLE_USES_DESCRIPTORS}
  4181. is defined, and is otherwise unused.
  4182. @end defmac
  4183. @defmac CONSTANT_POOL_BEFORE_FUNCTION
  4184. You may define this macro as a C expression. You should define the
  4185. expression to have a nonzero value if GCC should output the constant
  4186. pool for a function before the code for the function, or a zero value if
  4187. GCC should output the constant pool after the function. If you do
  4188. not define this macro, the usual case, GCC will output the constant
  4189. pool before the function.
  4190. @end defmac
  4191. @defmac ASM_OUTPUT_POOL_PROLOGUE (@var{file}, @var{funname}, @var{fundecl}, @var{size})
  4192. A C statement to output assembler commands to define the start of the
  4193. constant pool for a function. @var{funname} is a string giving
  4194. the name of the function. Should the return type of the function
  4195. be required, it can be obtained via @var{fundecl}. @var{size}
  4196. is the size, in bytes, of the constant pool that will be written
  4197. immediately after this call.
  4198. If no constant-pool prefix is required, the usual case, this macro need
  4199. not be defined.
  4200. @end defmac
  4201. @defmac ASM_OUTPUT_SPECIAL_POOL_ENTRY (@var{file}, @var{x}, @var{mode}, @var{align}, @var{labelno}, @var{jumpto})
  4202. A C statement (with or without semicolon) to output a constant in the
  4203. constant pool, if it needs special treatment. (This macro need not do
  4204. anything for RTL expressions that can be output normally.)
  4205. The argument @var{file} is the standard I/O stream to output the
  4206. assembler code on. @var{x} is the RTL expression for the constant to
  4207. output, and @var{mode} is the machine mode (in case @var{x} is a
  4208. @samp{const_int}). @var{align} is the required alignment for the value
  4209. @var{x}; you should output an assembler directive to force this much
  4210. alignment.
  4211. The argument @var{labelno} is a number to use in an internal label for
  4212. the address of this pool entry. The definition of this macro is
  4213. responsible for outputting the label definition at the proper place.
  4214. Here is how to do this:
  4215. @smallexample
  4216. @code{(*targetm.asm_out.internal_label)} (@var{file}, "LC", @var{labelno});
  4217. @end smallexample
  4218. When you output a pool entry specially, you should end with a
  4219. @code{goto} to the label @var{jumpto}. This will prevent the same pool
  4220. entry from being output a second time in the usual manner.
  4221. You need not define this macro if it would do nothing.
  4222. @end defmac
  4223. @defmac ASM_OUTPUT_POOL_EPILOGUE (@var{file} @var{funname} @var{fundecl} @var{size})
  4224. A C statement to output assembler commands to at the end of the constant
  4225. pool for a function. @var{funname} is a string giving the name of the
  4226. function. Should the return type of the function be required, you can
  4227. obtain it via @var{fundecl}. @var{size} is the size, in bytes, of the
  4228. constant pool that GCC wrote immediately before this call.
  4229. If no constant-pool epilogue is required, the usual case, you need not
  4230. define this macro.
  4231. @end defmac
  4232. @defmac IS_ASM_LOGICAL_LINE_SEPARATOR (@var{C}, @var{STR})
  4233. Define this macro as a C expression which is nonzero if @var{C} is
  4234. used as a logical line separator by the assembler. @var{STR} points
  4235. to the position in the string where @var{C} was found; this can be used if
  4236. a line separator uses multiple characters.
  4237. If you do not define this macro, the default is that only
  4238. the character @samp{;} is treated as a logical line separator.
  4239. @end defmac
  4240. @hook TARGET_ASM_OPEN_PAREN
  4241. These macros are provided by @file{real.h} for writing the definitions
  4242. of @code{ASM_OUTPUT_DOUBLE} and the like:
  4243. @defmac REAL_VALUE_TO_TARGET_SINGLE (@var{x}, @var{l})
  4244. @defmacx REAL_VALUE_TO_TARGET_DOUBLE (@var{x}, @var{l})
  4245. @defmacx REAL_VALUE_TO_TARGET_LONG_DOUBLE (@var{x}, @var{l})
  4246. @defmacx REAL_VALUE_TO_TARGET_DECIMAL32 (@var{x}, @var{l})
  4247. @defmacx REAL_VALUE_TO_TARGET_DECIMAL64 (@var{x}, @var{l})
  4248. @defmacx REAL_VALUE_TO_TARGET_DECIMAL128 (@var{x}, @var{l})
  4249. These translate @var{x}, of type @code{REAL_VALUE_TYPE}, to the
  4250. target's floating point representation, and store its bit pattern in
  4251. the variable @var{l}. For @code{REAL_VALUE_TO_TARGET_SINGLE} and
  4252. @code{REAL_VALUE_TO_TARGET_DECIMAL32}, this variable should be a
  4253. simple @code{long int}. For the others, it should be an array of
  4254. @code{long int}. The number of elements in this array is determined
  4255. by the size of the desired target floating point data type: 32 bits of
  4256. it go in each @code{long int} array element. Each array element holds
  4257. 32 bits of the result, even if @code{long int} is wider than 32 bits
  4258. on the host machine.
  4259. The array element values are designed so that you can print them out
  4260. using @code{fprintf} in the order they should appear in the target
  4261. machine's memory.
  4262. @end defmac
  4263. @node Uninitialized Data
  4264. @subsection Output of Uninitialized Variables
  4265. Each of the macros in this section is used to do the whole job of
  4266. outputting a single uninitialized variable.
  4267. @defmac ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded})
  4268. A C statement (sans semicolon) to output to the stdio stream
  4269. @var{stream} the assembler definition of a common-label named
  4270. @var{name} whose size is @var{size} bytes. The variable @var{rounded}
  4271. is the size rounded up to whatever alignment the caller wants. It is
  4272. possible that @var{size} may be zero, for instance if a struct with no
  4273. other member than a zero-length array is defined. In this case, the
  4274. backend must output a symbol definition that allocates at least one
  4275. byte, both so that the address of the resulting object does not compare
  4276. equal to any other, and because some object formats cannot even express
  4277. the concept of a zero-sized common symbol, as that is how they represent
  4278. an ordinary undefined external.
  4279. Use the expression @code{assemble_name (@var{stream}, @var{name})} to
  4280. output the name itself; before and after that, output the additional
  4281. assembler syntax for defining the name, and a newline.
  4282. This macro controls how the assembler definitions of uninitialized
  4283. common global variables are output.
  4284. @end defmac
  4285. @defmac ASM_OUTPUT_ALIGNED_COMMON (@var{stream}, @var{name}, @var{size}, @var{alignment})
  4286. Like @code{ASM_OUTPUT_COMMON} except takes the required alignment as a
  4287. separate, explicit argument. If you define this macro, it is used in
  4288. place of @code{ASM_OUTPUT_COMMON}, and gives you more flexibility in
  4289. handling the required alignment of the variable. The alignment is specified
  4290. as the number of bits.
  4291. @end defmac
  4292. @defmac ASM_OUTPUT_ALIGNED_DECL_COMMON (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
  4293. Like @code{ASM_OUTPUT_ALIGNED_COMMON} except that @var{decl} of the
  4294. variable to be output, if there is one, or @code{NULL_TREE} if there
  4295. is no corresponding variable. If you define this macro, GCC will use it
  4296. in place of both @code{ASM_OUTPUT_COMMON} and
  4297. @code{ASM_OUTPUT_ALIGNED_COMMON}. Define this macro when you need to see
  4298. the variable's decl in order to chose what to output.
  4299. @end defmac
  4300. @defmac ASM_OUTPUT_ALIGNED_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
  4301. A C statement (sans semicolon) to output to the stdio stream
  4302. @var{stream} the assembler definition of uninitialized global @var{decl} named
  4303. @var{name} whose size is @var{size} bytes. The variable @var{alignment}
  4304. is the alignment specified as the number of bits.
  4305. Try to use function @code{asm_output_aligned_bss} defined in file
  4306. @file{varasm.c} when defining this macro. If unable, use the expression
  4307. @code{assemble_name (@var{stream}, @var{name})} to output the name itself;
  4308. before and after that, output the additional assembler syntax for defining
  4309. the name, and a newline.
  4310. There are two ways of handling global BSS@. One is to define this macro.
  4311. The other is to have @code{TARGET_ASM_SELECT_SECTION} return a
  4312. switchable BSS section (@pxref{TARGET_HAVE_SWITCHABLE_BSS_SECTIONS}).
  4313. You do not need to do both.
  4314. Some languages do not have @code{common} data, and require a
  4315. non-common form of global BSS in order to handle uninitialized globals
  4316. efficiently. C++ is one example of this. However, if the target does
  4317. not support global BSS, the front end may choose to make globals
  4318. common in order to save space in the object file.
  4319. @end defmac
  4320. @defmac ASM_OUTPUT_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded})
  4321. A C statement (sans semicolon) to output to the stdio stream
  4322. @var{stream} the assembler definition of a local-common-label named
  4323. @var{name} whose size is @var{size} bytes. The variable @var{rounded}
  4324. is the size rounded up to whatever alignment the caller wants.
  4325. Use the expression @code{assemble_name (@var{stream}, @var{name})} to
  4326. output the name itself; before and after that, output the additional
  4327. assembler syntax for defining the name, and a newline.
  4328. This macro controls how the assembler definitions of uninitialized
  4329. static variables are output.
  4330. @end defmac
  4331. @defmac ASM_OUTPUT_ALIGNED_LOCAL (@var{stream}, @var{name}, @var{size}, @var{alignment})
  4332. Like @code{ASM_OUTPUT_LOCAL} except takes the required alignment as a
  4333. separate, explicit argument. If you define this macro, it is used in
  4334. place of @code{ASM_OUTPUT_LOCAL}, and gives you more flexibility in
  4335. handling the required alignment of the variable. The alignment is specified
  4336. as the number of bits.
  4337. @end defmac
  4338. @defmac ASM_OUTPUT_ALIGNED_DECL_LOCAL (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
  4339. Like @code{ASM_OUTPUT_ALIGNED_DECL} except that @var{decl} of the
  4340. variable to be output, if there is one, or @code{NULL_TREE} if there
  4341. is no corresponding variable. If you define this macro, GCC will use it
  4342. in place of both @code{ASM_OUTPUT_DECL} and
  4343. @code{ASM_OUTPUT_ALIGNED_DECL}. Define this macro when you need to see
  4344. the variable's decl in order to chose what to output.
  4345. @end defmac
  4346. @node Label Output
  4347. @subsection Output and Generation of Labels
  4348. @c prevent bad page break with this line
  4349. This is about outputting labels.
  4350. @findex assemble_name
  4351. @defmac ASM_OUTPUT_LABEL (@var{stream}, @var{name})
  4352. A C statement (sans semicolon) to output to the stdio stream
  4353. @var{stream} the assembler definition of a label named @var{name}.
  4354. Use the expression @code{assemble_name (@var{stream}, @var{name})} to
  4355. output the name itself; before and after that, output the additional
  4356. assembler syntax for defining the name, and a newline. A default
  4357. definition of this macro is provided which is correct for most systems.
  4358. @end defmac
  4359. @defmac ASM_OUTPUT_FUNCTION_LABEL (@var{stream}, @var{name}, @var{decl})
  4360. A C statement (sans semicolon) to output to the stdio stream
  4361. @var{stream} the assembler definition of a label named @var{name} of
  4362. a function.
  4363. Use the expression @code{assemble_name (@var{stream}, @var{name})} to
  4364. output the name itself; before and after that, output the additional
  4365. assembler syntax for defining the name, and a newline. A default
  4366. definition of this macro is provided which is correct for most systems.
  4367. If this macro is not defined, then the function name is defined in the
  4368. usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
  4369. @end defmac
  4370. @findex assemble_name_raw
  4371. @defmac ASM_OUTPUT_INTERNAL_LABEL (@var{stream}, @var{name})
  4372. Identical to @code{ASM_OUTPUT_LABEL}, except that @var{name} is known
  4373. to refer to a compiler-generated label. The default definition uses
  4374. @code{assemble_name_raw}, which is like @code{assemble_name} except
  4375. that it is more efficient.
  4376. @end defmac
  4377. @defmac SIZE_ASM_OP
  4378. A C string containing the appropriate assembler directive to specify the
  4379. size of a symbol, without any arguments. On systems that use ELF, the
  4380. default (in @file{config/elfos.h}) is @samp{"\t.size\t"}; on other
  4381. systems, the default is not to define this macro.
  4382. Define this macro only if it is correct to use the default definitions
  4383. of @code{ASM_OUTPUT_SIZE_DIRECTIVE} and @code{ASM_OUTPUT_MEASURED_SIZE}
  4384. for your system. If you need your own custom definitions of those
  4385. macros, or if you do not need explicit symbol sizes at all, do not
  4386. define this macro.
  4387. @end defmac
  4388. @defmac ASM_OUTPUT_SIZE_DIRECTIVE (@var{stream}, @var{name}, @var{size})
  4389. A C statement (sans semicolon) to output to the stdio stream
  4390. @var{stream} a directive telling the assembler that the size of the
  4391. symbol @var{name} is @var{size}. @var{size} is a @code{HOST_WIDE_INT}.
  4392. If you define @code{SIZE_ASM_OP}, a default definition of this macro is
  4393. provided.
  4394. @end defmac
  4395. @defmac ASM_OUTPUT_MEASURED_SIZE (@var{stream}, @var{name})
  4396. A C statement (sans semicolon) to output to the stdio stream
  4397. @var{stream} a directive telling the assembler to calculate the size of
  4398. the symbol @var{name} by subtracting its address from the current
  4399. address.
  4400. If you define @code{SIZE_ASM_OP}, a default definition of this macro is
  4401. provided. The default assumes that the assembler recognizes a special
  4402. @samp{.} symbol as referring to the current address, and can calculate
  4403. the difference between this and another symbol. If your assembler does
  4404. not recognize @samp{.} or cannot do calculations with it, you will need
  4405. to redefine @code{ASM_OUTPUT_MEASURED_SIZE} to use some other technique.
  4406. @end defmac
  4407. @defmac NO_DOLLAR_IN_LABEL
  4408. Define this macro if the assembler does not accept the character
  4409. @samp{$} in label names. By default constructors and destructors in
  4410. G++ have @samp{$} in the identifiers. If this macro is defined,
  4411. @samp{.} is used instead.
  4412. @end defmac
  4413. @defmac NO_DOT_IN_LABEL
  4414. Define this macro if the assembler does not accept the character
  4415. @samp{.} in label names. By default constructors and destructors in G++
  4416. have names that use @samp{.}. If this macro is defined, these names
  4417. are rewritten to avoid @samp{.}.
  4418. @end defmac
  4419. @defmac TYPE_ASM_OP
  4420. A C string containing the appropriate assembler directive to specify the
  4421. type of a symbol, without any arguments. On systems that use ELF, the
  4422. default (in @file{config/elfos.h}) is @samp{"\t.type\t"}; on other
  4423. systems, the default is not to define this macro.
  4424. Define this macro only if it is correct to use the default definition of
  4425. @code{ASM_OUTPUT_TYPE_DIRECTIVE} for your system. If you need your own
  4426. custom definition of this macro, or if you do not need explicit symbol
  4427. types at all, do not define this macro.
  4428. @end defmac
  4429. @defmac TYPE_OPERAND_FMT
  4430. A C string which specifies (using @code{printf} syntax) the format of
  4431. the second operand to @code{TYPE_ASM_OP}. On systems that use ELF, the
  4432. default (in @file{config/elfos.h}) is @samp{"@@%s"}; on other systems,
  4433. the default is not to define this macro.
  4434. Define this macro only if it is correct to use the default definition of
  4435. @code{ASM_OUTPUT_TYPE_DIRECTIVE} for your system. If you need your own
  4436. custom definition of this macro, or if you do not need explicit symbol
  4437. types at all, do not define this macro.
  4438. @end defmac
  4439. @defmac ASM_OUTPUT_TYPE_DIRECTIVE (@var{stream}, @var{type})
  4440. A C statement (sans semicolon) to output to the stdio stream
  4441. @var{stream} a directive telling the assembler that the type of the
  4442. symbol @var{name} is @var{type}. @var{type} is a C string; currently,
  4443. that string is always either @samp{"function"} or @samp{"object"}, but
  4444. you should not count on this.
  4445. If you define @code{TYPE_ASM_OP} and @code{TYPE_OPERAND_FMT}, a default
  4446. definition of this macro is provided.
  4447. @end defmac
  4448. @defmac ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl})
  4449. A C statement (sans semicolon) to output to the stdio stream
  4450. @var{stream} any text necessary for declaring the name @var{name} of a
  4451. function which is being defined. This macro is responsible for
  4452. outputting the label definition (perhaps using
  4453. @code{ASM_OUTPUT_FUNCTION_LABEL}). The argument @var{decl} is the
  4454. @code{FUNCTION_DECL} tree node representing the function.
  4455. If this macro is not defined, then the function name is defined in the
  4456. usual manner as a label (by means of @code{ASM_OUTPUT_FUNCTION_LABEL}).
  4457. You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in the definition
  4458. of this macro.
  4459. @end defmac
  4460. @defmac ASM_DECLARE_FUNCTION_SIZE (@var{stream}, @var{name}, @var{decl})
  4461. A C statement (sans semicolon) to output to the stdio stream
  4462. @var{stream} any text necessary for declaring the size of a function
  4463. which is being defined. The argument @var{name} is the name of the
  4464. function. The argument @var{decl} is the @code{FUNCTION_DECL} tree node
  4465. representing the function.
  4466. If this macro is not defined, then the function size is not defined.
  4467. You may wish to use @code{ASM_OUTPUT_MEASURED_SIZE} in the definition
  4468. of this macro.
  4469. @end defmac
  4470. @defmac ASM_DECLARE_OBJECT_NAME (@var{stream}, @var{name}, @var{decl})
  4471. A C statement (sans semicolon) to output to the stdio stream
  4472. @var{stream} any text necessary for declaring the name @var{name} of an
  4473. initialized variable which is being defined. This macro must output the
  4474. label definition (perhaps using @code{ASM_OUTPUT_LABEL}). The argument
  4475. @var{decl} is the @code{VAR_DECL} tree node representing the variable.
  4476. If this macro is not defined, then the variable name is defined in the
  4477. usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
  4478. You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} and/or
  4479. @code{ASM_OUTPUT_SIZE_DIRECTIVE} in the definition of this macro.
  4480. @end defmac
  4481. @hook TARGET_ASM_DECLARE_CONSTANT_NAME
  4482. @defmac ASM_DECLARE_REGISTER_GLOBAL (@var{stream}, @var{decl}, @var{regno}, @var{name})
  4483. A C statement (sans semicolon) to output to the stdio stream
  4484. @var{stream} any text necessary for claiming a register @var{regno}
  4485. for a global variable @var{decl} with name @var{name}.
  4486. If you don't define this macro, that is equivalent to defining it to do
  4487. nothing.
  4488. @end defmac
  4489. @defmac ASM_FINISH_DECLARE_OBJECT (@var{stream}, @var{decl}, @var{toplevel}, @var{atend})
  4490. A C statement (sans semicolon) to finish up declaring a variable name
  4491. once the compiler has processed its initializer fully and thus has had a
  4492. chance to determine the size of an array when controlled by an
  4493. initializer. This is used on systems where it's necessary to declare
  4494. something about the size of the object.
  4495. If you don't define this macro, that is equivalent to defining it to do
  4496. nothing.
  4497. You may wish to use @code{ASM_OUTPUT_SIZE_DIRECTIVE} and/or
  4498. @code{ASM_OUTPUT_MEASURED_SIZE} in the definition of this macro.
  4499. @end defmac
  4500. @hook TARGET_ASM_GLOBALIZE_LABEL
  4501. @hook TARGET_ASM_GLOBALIZE_DECL_NAME
  4502. @hook TARGET_ASM_ASSEMBLE_UNDEFINED_DECL
  4503. @defmac ASM_WEAKEN_LABEL (@var{stream}, @var{name})
  4504. A C statement (sans semicolon) to output to the stdio stream
  4505. @var{stream} some commands that will make the label @var{name} weak;
  4506. that is, available for reference from other files but only used if
  4507. no other definition is available. Use the expression
  4508. @code{assemble_name (@var{stream}, @var{name})} to output the name
  4509. itself; before and after that, output the additional assembler syntax
  4510. for making that name weak, and a newline.
  4511. If you don't define this macro or @code{ASM_WEAKEN_DECL}, GCC will not
  4512. support weak symbols and you should not define the @code{SUPPORTS_WEAK}
  4513. macro.
  4514. @end defmac
  4515. @defmac ASM_WEAKEN_DECL (@var{stream}, @var{decl}, @var{name}, @var{value})
  4516. Combines (and replaces) the function of @code{ASM_WEAKEN_LABEL} and
  4517. @code{ASM_OUTPUT_WEAK_ALIAS}, allowing access to the associated function
  4518. or variable decl. If @var{value} is not @code{NULL}, this C statement
  4519. should output to the stdio stream @var{stream} assembler code which
  4520. defines (equates) the weak symbol @var{name} to have the value
  4521. @var{value}. If @var{value} is @code{NULL}, it should output commands
  4522. to make @var{name} weak.
  4523. @end defmac
  4524. @defmac ASM_OUTPUT_WEAKREF (@var{stream}, @var{decl}, @var{name}, @var{value})
  4525. Outputs a directive that enables @var{name} to be used to refer to
  4526. symbol @var{value} with weak-symbol semantics. @code{decl} is the
  4527. declaration of @code{name}.
  4528. @end defmac
  4529. @defmac SUPPORTS_WEAK
  4530. A preprocessor constant expression which evaluates to true if the target
  4531. supports weak symbols.
  4532. If you don't define this macro, @file{defaults.h} provides a default
  4533. definition. If either @code{ASM_WEAKEN_LABEL} or @code{ASM_WEAKEN_DECL}
  4534. is defined, the default definition is @samp{1}; otherwise, it is @samp{0}.
  4535. @end defmac
  4536. @defmac TARGET_SUPPORTS_WEAK
  4537. A C expression which evaluates to true if the target supports weak symbols.
  4538. If you don't define this macro, @file{defaults.h} provides a default
  4539. definition. The default definition is @samp{(SUPPORTS_WEAK)}. Define
  4540. this macro if you want to control weak symbol support with a compiler
  4541. flag such as @option{-melf}.
  4542. @end defmac
  4543. @defmac MAKE_DECL_ONE_ONLY (@var{decl})
  4544. A C statement (sans semicolon) to mark @var{decl} to be emitted as a
  4545. public symbol such that extra copies in multiple translation units will
  4546. be discarded by the linker. Define this macro if your object file
  4547. format provides support for this concept, such as the @samp{COMDAT}
  4548. section flags in the Microsoft Windows PE/COFF format, and this support
  4549. requires changes to @var{decl}, such as putting it in a separate section.
  4550. @end defmac
  4551. @defmac SUPPORTS_ONE_ONLY
  4552. A C expression which evaluates to true if the target supports one-only
  4553. semantics.
  4554. If you don't define this macro, @file{varasm.c} provides a default
  4555. definition. If @code{MAKE_DECL_ONE_ONLY} is defined, the default
  4556. definition is @samp{1}; otherwise, it is @samp{0}. Define this macro if
  4557. you want to control one-only symbol support with a compiler flag, or if
  4558. setting the @code{DECL_ONE_ONLY} flag is enough to mark a declaration to
  4559. be emitted as one-only.
  4560. @end defmac
  4561. @hook TARGET_ASM_ASSEMBLE_VISIBILITY
  4562. @defmac TARGET_WEAK_NOT_IN_ARCHIVE_TOC
  4563. A C expression that evaluates to true if the target's linker expects
  4564. that weak symbols do not appear in a static archive's table of contents.
  4565. The default is @code{0}.
  4566. Leaving weak symbols out of an archive's table of contents means that,
  4567. if a symbol will only have a definition in one translation unit and
  4568. will have undefined references from other translation units, that
  4569. symbol should not be weak. Defining this macro to be nonzero will
  4570. thus have the effect that certain symbols that would normally be weak
  4571. (explicit template instantiations, and vtables for polymorphic classes
  4572. with noninline key methods) will instead be nonweak.
  4573. The C++ ABI requires this macro to be zero. Define this macro for
  4574. targets where full C++ ABI compliance is impossible and where linker
  4575. restrictions require weak symbols to be left out of a static archive's
  4576. table of contents.
  4577. @end defmac
  4578. @defmac ASM_OUTPUT_EXTERNAL (@var{stream}, @var{decl}, @var{name})
  4579. A C statement (sans semicolon) to output to the stdio stream
  4580. @var{stream} any text necessary for declaring the name of an external
  4581. symbol named @var{name} which is referenced in this compilation but
  4582. not defined. The value of @var{decl} is the tree node for the
  4583. declaration.
  4584. This macro need not be defined if it does not need to output anything.
  4585. The GNU assembler and most Unix assemblers don't require anything.
  4586. @end defmac
  4587. @hook TARGET_ASM_EXTERNAL_LIBCALL
  4588. @hook TARGET_ASM_MARK_DECL_PRESERVED
  4589. @defmac ASM_OUTPUT_LABELREF (@var{stream}, @var{name})
  4590. A C statement (sans semicolon) to output to the stdio stream
  4591. @var{stream} a reference in assembler syntax to a label named
  4592. @var{name}. This should add @samp{_} to the front of the name, if that
  4593. is customary on your operating system, as it is in most Berkeley Unix
  4594. systems. This macro is used in @code{assemble_name}.
  4595. @end defmac
  4596. @hook TARGET_MANGLE_ASSEMBLER_NAME
  4597. @defmac ASM_OUTPUT_SYMBOL_REF (@var{stream}, @var{sym})
  4598. A C statement (sans semicolon) to output a reference to
  4599. @code{SYMBOL_REF} @var{sym}. If not defined, @code{assemble_name}
  4600. will be used to output the name of the symbol. This macro may be used
  4601. to modify the way a symbol is referenced depending on information
  4602. encoded by @code{TARGET_ENCODE_SECTION_INFO}.
  4603. @end defmac
  4604. @defmac ASM_OUTPUT_LABEL_REF (@var{stream}, @var{buf})
  4605. A C statement (sans semicolon) to output a reference to @var{buf}, the
  4606. result of @code{ASM_GENERATE_INTERNAL_LABEL}. If not defined,
  4607. @code{assemble_name} will be used to output the name of the symbol.
  4608. This macro is not used by @code{output_asm_label}, or the @code{%l}
  4609. specifier that calls it; the intention is that this macro should be set
  4610. when it is necessary to output a label differently when its address is
  4611. being taken.
  4612. @end defmac
  4613. @hook TARGET_ASM_INTERNAL_LABEL
  4614. @defmac ASM_OUTPUT_DEBUG_LABEL (@var{stream}, @var{prefix}, @var{num})
  4615. A C statement to output to the stdio stream @var{stream} a debug info
  4616. label whose name is made from the string @var{prefix} and the number
  4617. @var{num}. This is useful for VLIW targets, where debug info labels
  4618. may need to be treated differently than branch target labels. On some
  4619. systems, branch target labels must be at the beginning of instruction
  4620. bundles, but debug info labels can occur in the middle of instruction
  4621. bundles.
  4622. If this macro is not defined, then @code{(*targetm.asm_out.internal_label)} will be
  4623. used.
  4624. @end defmac
  4625. @defmac ASM_GENERATE_INTERNAL_LABEL (@var{string}, @var{prefix}, @var{num})
  4626. A C statement to store into the string @var{string} a label whose name
  4627. is made from the string @var{prefix} and the number @var{num}.
  4628. This string, when output subsequently by @code{assemble_name}, should
  4629. produce the output that @code{(*targetm.asm_out.internal_label)} would produce
  4630. with the same @var{prefix} and @var{num}.
  4631. If the string begins with @samp{*}, then @code{assemble_name} will
  4632. output the rest of the string unchanged. It is often convenient for
  4633. @code{ASM_GENERATE_INTERNAL_LABEL} to use @samp{*} in this way. If the
  4634. string doesn't start with @samp{*}, then @code{ASM_OUTPUT_LABELREF} gets
  4635. to output the string, and may change it. (Of course,
  4636. @code{ASM_OUTPUT_LABELREF} is also part of your machine description, so
  4637. you should know what it does on your machine.)
  4638. @end defmac
  4639. @defmac ASM_FORMAT_PRIVATE_NAME (@var{outvar}, @var{name}, @var{number})
  4640. A C expression to assign to @var{outvar} (which is a variable of type
  4641. @code{char *}) a newly allocated string made from the string
  4642. @var{name} and the number @var{number}, with some suitable punctuation
  4643. added. Use @code{alloca} to get space for the string.
  4644. The string will be used as an argument to @code{ASM_OUTPUT_LABELREF} to
  4645. produce an assembler label for an internal static variable whose name is
  4646. @var{name}. Therefore, the string must be such as to result in valid
  4647. assembler code. The argument @var{number} is different each time this
  4648. macro is executed; it prevents conflicts between similarly-named
  4649. internal static variables in different scopes.
  4650. Ideally this string should not be a valid C identifier, to prevent any
  4651. conflict with the user's own symbols. Most assemblers allow periods
  4652. or percent signs in assembler symbols; putting at least one of these
  4653. between the name and the number will suffice.
  4654. If this macro is not defined, a default definition will be provided
  4655. which is correct for most systems.
  4656. @end defmac
  4657. @defmac ASM_OUTPUT_DEF (@var{stream}, @var{name}, @var{value})
  4658. A C statement to output to the stdio stream @var{stream} assembler code
  4659. which defines (equates) the symbol @var{name} to have the value @var{value}.
  4660. @findex SET_ASM_OP
  4661. If @code{SET_ASM_OP} is defined, a default definition is provided which is
  4662. correct for most systems.
  4663. @end defmac
  4664. @defmac ASM_OUTPUT_DEF_FROM_DECLS (@var{stream}, @var{decl_of_name}, @var{decl_of_value})
  4665. A C statement to output to the stdio stream @var{stream} assembler code
  4666. which defines (equates) the symbol whose tree node is @var{decl_of_name}
  4667. to have the value of the tree node @var{decl_of_value}. This macro will
  4668. be used in preference to @samp{ASM_OUTPUT_DEF} if it is defined and if
  4669. the tree nodes are available.
  4670. @findex SET_ASM_OP
  4671. If @code{SET_ASM_OP} is defined, a default definition is provided which is
  4672. correct for most systems.
  4673. @end defmac
  4674. @defmac TARGET_DEFERRED_OUTPUT_DEFS (@var{decl_of_name}, @var{decl_of_value})
  4675. A C statement that evaluates to true if the assembler code which defines
  4676. (equates) the symbol whose tree node is @var{decl_of_name} to have the value
  4677. of the tree node @var{decl_of_value} should be emitted near the end of the
  4678. current compilation unit. The default is to not defer output of defines.
  4679. This macro affects defines output by @samp{ASM_OUTPUT_DEF} and
  4680. @samp{ASM_OUTPUT_DEF_FROM_DECLS}.
  4681. @end defmac
  4682. @defmac ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value})
  4683. A C statement to output to the stdio stream @var{stream} assembler code
  4684. which defines (equates) the weak symbol @var{name} to have the value
  4685. @var{value}. If @var{value} is @code{NULL}, it defines @var{name} as
  4686. an undefined weak symbol.
  4687. Define this macro if the target only supports weak aliases; define
  4688. @code{ASM_OUTPUT_DEF} instead if possible.
  4689. @end defmac
  4690. @defmac OBJC_GEN_METHOD_LABEL (@var{buf}, @var{is_inst}, @var{class_name}, @var{cat_name}, @var{sel_name})
  4691. Define this macro to override the default assembler names used for
  4692. Objective-C methods.
  4693. The default name is a unique method number followed by the name of the
  4694. class (e.g.@: @samp{_1_Foo}). For methods in categories, the name of
  4695. the category is also included in the assembler name (e.g.@:
  4696. @samp{_1_Foo_Bar}).
  4697. These names are safe on most systems, but make debugging difficult since
  4698. the method's selector is not present in the name. Therefore, particular
  4699. systems define other ways of computing names.
  4700. @var{buf} is an expression of type @code{char *} which gives you a
  4701. buffer in which to store the name; its length is as long as
  4702. @var{class_name}, @var{cat_name} and @var{sel_name} put together, plus
  4703. 50 characters extra.
  4704. The argument @var{is_inst} specifies whether the method is an instance
  4705. method or a class method; @var{class_name} is the name of the class;
  4706. @var{cat_name} is the name of the category (or @code{NULL} if the method is not
  4707. in a category); and @var{sel_name} is the name of the selector.
  4708. On systems where the assembler can handle quoted names, you can use this
  4709. macro to provide more human-readable names.
  4710. @end defmac
  4711. @node Initialization
  4712. @subsection How Initialization Functions Are Handled
  4713. @cindex initialization routines
  4714. @cindex termination routines
  4715. @cindex constructors, output of
  4716. @cindex destructors, output of
  4717. The compiled code for certain languages includes @dfn{constructors}
  4718. (also called @dfn{initialization routines})---functions to initialize
  4719. data in the program when the program is started. These functions need
  4720. to be called before the program is ``started''---that is to say, before
  4721. @code{main} is called.
  4722. Compiling some languages generates @dfn{destructors} (also called
  4723. @dfn{termination routines}) that should be called when the program
  4724. terminates.
  4725. To make the initialization and termination functions work, the compiler
  4726. must output something in the assembler code to cause those functions to
  4727. be called at the appropriate time. When you port the compiler to a new
  4728. system, you need to specify how to do this.
  4729. There are two major ways that GCC currently supports the execution of
  4730. initialization and termination functions. Each way has two variants.
  4731. Much of the structure is common to all four variations.
  4732. @findex __CTOR_LIST__
  4733. @findex __DTOR_LIST__
  4734. The linker must build two lists of these functions---a list of
  4735. initialization functions, called @code{__CTOR_LIST__}, and a list of
  4736. termination functions, called @code{__DTOR_LIST__}.
  4737. Each list always begins with an ignored function pointer (which may hold
  4738. 0, @minus{}1, or a count of the function pointers after it, depending on
  4739. the environment). This is followed by a series of zero or more function
  4740. pointers to constructors (or destructors), followed by a function
  4741. pointer containing zero.
  4742. Depending on the operating system and its executable file format, either
  4743. @file{crtstuff.c} or @file{libgcc2.c} traverses these lists at startup
  4744. time and exit time. Constructors are called in reverse order of the
  4745. list; destructors in forward order.
  4746. The best way to handle static constructors works only for object file
  4747. formats which provide arbitrarily-named sections. A section is set
  4748. aside for a list of constructors, and another for a list of destructors.
  4749. Traditionally these are called @samp{.ctors} and @samp{.dtors}. Each
  4750. object file that defines an initialization function also puts a word in
  4751. the constructor section to point to that function. The linker
  4752. accumulates all these words into one contiguous @samp{.ctors} section.
  4753. Termination functions are handled similarly.
  4754. This method will be chosen as the default by @file{target-def.h} if
  4755. @code{TARGET_ASM_NAMED_SECTION} is defined. A target that does not
  4756. support arbitrary sections, but does support special designated
  4757. constructor and destructor sections may define @code{CTORS_SECTION_ASM_OP}
  4758. and @code{DTORS_SECTION_ASM_OP} to achieve the same effect.
  4759. When arbitrary sections are available, there are two variants, depending
  4760. upon how the code in @file{crtstuff.c} is called. On systems that
  4761. support a @dfn{.init} section which is executed at program startup,
  4762. parts of @file{crtstuff.c} are compiled into that section. The
  4763. program is linked by the @command{gcc} driver like this:
  4764. @smallexample
  4765. ld -o @var{output_file} crti.o crtbegin.o @dots{} -lgcc crtend.o crtn.o
  4766. @end smallexample
  4767. The prologue of a function (@code{__init}) appears in the @code{.init}
  4768. section of @file{crti.o}; the epilogue appears in @file{crtn.o}. Likewise
  4769. for the function @code{__fini} in the @dfn{.fini} section. Normally these
  4770. files are provided by the operating system or by the GNU C library, but
  4771. are provided by GCC for a few targets.
  4772. The objects @file{crtbegin.o} and @file{crtend.o} are (for most targets)
  4773. compiled from @file{crtstuff.c}. They contain, among other things, code
  4774. fragments within the @code{.init} and @code{.fini} sections that branch
  4775. to routines in the @code{.text} section. The linker will pull all parts
  4776. of a section together, which results in a complete @code{__init} function
  4777. that invokes the routines we need at startup.
  4778. To use this variant, you must define the @code{INIT_SECTION_ASM_OP}
  4779. macro properly.
  4780. If no init section is available, when GCC compiles any function called
  4781. @code{main} (or more accurately, any function designated as a program
  4782. entry point by the language front end calling @code{expand_main_function}),
  4783. it inserts a procedure call to @code{__main} as the first executable code
  4784. after the function prologue. The @code{__main} function is defined
  4785. in @file{libgcc2.c} and runs the global constructors.
  4786. In file formats that don't support arbitrary sections, there are again
  4787. two variants. In the simplest variant, the GNU linker (GNU @code{ld})
  4788. and an `a.out' format must be used. In this case,
  4789. @code{TARGET_ASM_CONSTRUCTOR} is defined to produce a @code{.stabs}
  4790. entry of type @samp{N_SETT}, referencing the name @code{__CTOR_LIST__},
  4791. and with the address of the void function containing the initialization
  4792. code as its value. The GNU linker recognizes this as a request to add
  4793. the value to a @dfn{set}; the values are accumulated, and are eventually
  4794. placed in the executable as a vector in the format described above, with
  4795. a leading (ignored) count and a trailing zero element.
  4796. @code{TARGET_ASM_DESTRUCTOR} is handled similarly. Since no init
  4797. section is available, the absence of @code{INIT_SECTION_ASM_OP} causes
  4798. the compilation of @code{main} to call @code{__main} as above, starting
  4799. the initialization process.
  4800. The last variant uses neither arbitrary sections nor the GNU linker.
  4801. This is preferable when you want to do dynamic linking and when using
  4802. file formats which the GNU linker does not support, such as `ECOFF'@. In
  4803. this case, @code{TARGET_HAVE_CTORS_DTORS} is false, initialization and
  4804. termination functions are recognized simply by their names. This requires
  4805. an extra program in the linkage step, called @command{collect2}. This program
  4806. pretends to be the linker, for use with GCC; it does its job by running
  4807. the ordinary linker, but also arranges to include the vectors of
  4808. initialization and termination functions. These functions are called
  4809. via @code{__main} as described above. In order to use this method,
  4810. @code{use_collect2} must be defined in the target in @file{config.gcc}.
  4811. @ifinfo
  4812. The following section describes the specific macros that control and
  4813. customize the handling of initialization and termination functions.
  4814. @end ifinfo
  4815. @node Macros for Initialization
  4816. @subsection Macros Controlling Initialization Routines
  4817. Here are the macros that control how the compiler handles initialization
  4818. and termination functions:
  4819. @defmac INIT_SECTION_ASM_OP
  4820. If defined, a C string constant, including spacing, for the assembler
  4821. operation to identify the following data as initialization code. If not
  4822. defined, GCC will assume such a section does not exist. When you are
  4823. using special sections for initialization and termination functions, this
  4824. macro also controls how @file{crtstuff.c} and @file{libgcc2.c} arrange to
  4825. run the initialization functions.
  4826. @end defmac
  4827. @defmac HAS_INIT_SECTION
  4828. If defined, @code{main} will not call @code{__main} as described above.
  4829. This macro should be defined for systems that control start-up code
  4830. on a symbol-by-symbol basis, such as OSF/1, and should not
  4831. be defined explicitly for systems that support @code{INIT_SECTION_ASM_OP}.
  4832. @end defmac
  4833. @defmac LD_INIT_SWITCH
  4834. If defined, a C string constant for a switch that tells the linker that
  4835. the following symbol is an initialization routine.
  4836. @end defmac
  4837. @defmac LD_FINI_SWITCH
  4838. If defined, a C string constant for a switch that tells the linker that
  4839. the following symbol is a finalization routine.
  4840. @end defmac
  4841. @defmac COLLECT_SHARED_INIT_FUNC (@var{stream}, @var{func})
  4842. If defined, a C statement that will write a function that can be
  4843. automatically called when a shared library is loaded. The function
  4844. should call @var{func}, which takes no arguments. If not defined, and
  4845. the object format requires an explicit initialization function, then a
  4846. function called @code{_GLOBAL__DI} will be generated.
  4847. This function and the following one are used by collect2 when linking a
  4848. shared library that needs constructors or destructors, or has DWARF2
  4849. exception tables embedded in the code.
  4850. @end defmac
  4851. @defmac COLLECT_SHARED_FINI_FUNC (@var{stream}, @var{func})
  4852. If defined, a C statement that will write a function that can be
  4853. automatically called when a shared library is unloaded. The function
  4854. should call @var{func}, which takes no arguments. If not defined, and
  4855. the object format requires an explicit finalization function, then a
  4856. function called @code{_GLOBAL__DD} will be generated.
  4857. @end defmac
  4858. @defmac INVOKE__main
  4859. If defined, @code{main} will call @code{__main} despite the presence of
  4860. @code{INIT_SECTION_ASM_OP}. This macro should be defined for systems
  4861. where the init section is not actually run automatically, but is still
  4862. useful for collecting the lists of constructors and destructors.
  4863. @end defmac
  4864. @defmac SUPPORTS_INIT_PRIORITY
  4865. If nonzero, the C++ @code{init_priority} attribute is supported and the
  4866. compiler should emit instructions to control the order of initialization
  4867. of objects. If zero, the compiler will issue an error message upon
  4868. encountering an @code{init_priority} attribute.
  4869. @end defmac
  4870. @hook TARGET_HAVE_CTORS_DTORS
  4871. @hook TARGET_ASM_CONSTRUCTOR
  4872. @hook TARGET_ASM_DESTRUCTOR
  4873. If @code{TARGET_HAVE_CTORS_DTORS} is true, the initialization routine
  4874. generated for the generated object file will have static linkage.
  4875. If your system uses @command{collect2} as the means of processing
  4876. constructors, then that program normally uses @command{nm} to scan
  4877. an object file for constructor functions to be called.
  4878. On certain kinds of systems, you can define this macro to make
  4879. @command{collect2} work faster (and, in some cases, make it work at all):
  4880. @defmac OBJECT_FORMAT_COFF
  4881. Define this macro if the system uses COFF (Common Object File Format)
  4882. object files, so that @command{collect2} can assume this format and scan
  4883. object files directly for dynamic constructor/destructor functions.
  4884. This macro is effective only in a native compiler; @command{collect2} as
  4885. part of a cross compiler always uses @command{nm} for the target machine.
  4886. @end defmac
  4887. @defmac REAL_NM_FILE_NAME
  4888. Define this macro as a C string constant containing the file name to use
  4889. to execute @command{nm}. The default is to search the path normally for
  4890. @command{nm}.
  4891. @end defmac
  4892. @defmac NM_FLAGS
  4893. @command{collect2} calls @command{nm} to scan object files for static
  4894. constructors and destructors and LTO info. By default, @option{-n} is
  4895. passed. Define @code{NM_FLAGS} to a C string constant if other options
  4896. are needed to get the same output format as GNU @command{nm -n}
  4897. produces.
  4898. @end defmac
  4899. If your system supports shared libraries and has a program to list the
  4900. dynamic dependencies of a given library or executable, you can define
  4901. these macros to enable support for running initialization and
  4902. termination functions in shared libraries:
  4903. @defmac LDD_SUFFIX
  4904. Define this macro to a C string constant containing the name of the program
  4905. which lists dynamic dependencies, like @command{ldd} under SunOS 4.
  4906. @end defmac
  4907. @defmac PARSE_LDD_OUTPUT (@var{ptr})
  4908. Define this macro to be C code that extracts filenames from the output
  4909. of the program denoted by @code{LDD_SUFFIX}. @var{ptr} is a variable
  4910. of type @code{char *} that points to the beginning of a line of output
  4911. from @code{LDD_SUFFIX}. If the line lists a dynamic dependency, the
  4912. code must advance @var{ptr} to the beginning of the filename on that
  4913. line. Otherwise, it must set @var{ptr} to @code{NULL}.
  4914. @end defmac
  4915. @defmac SHLIB_SUFFIX
  4916. Define this macro to a C string constant containing the default shared
  4917. library extension of the target (e.g., @samp{".so"}). @command{collect2}
  4918. strips version information after this suffix when generating global
  4919. constructor and destructor names. This define is only needed on targets
  4920. that use @command{collect2} to process constructors and destructors.
  4921. @end defmac
  4922. @node Instruction Output
  4923. @subsection Output of Assembler Instructions
  4924. @c prevent bad page break with this line
  4925. This describes assembler instruction output.
  4926. @defmac REGISTER_NAMES
  4927. A C initializer containing the assembler's names for the machine
  4928. registers, each one as a C string constant. This is what translates
  4929. register numbers in the compiler into assembler language.
  4930. @end defmac
  4931. @defmac ADDITIONAL_REGISTER_NAMES
  4932. If defined, a C initializer for an array of structures containing a name
  4933. and a register number. This macro defines additional names for hard
  4934. registers, thus allowing the @code{asm} option in declarations to refer
  4935. to registers using alternate names.
  4936. @end defmac
  4937. @defmac OVERLAPPING_REGISTER_NAMES
  4938. If defined, a C initializer for an array of structures containing a
  4939. name, a register number and a count of the number of consecutive
  4940. machine registers the name overlaps. This macro defines additional
  4941. names for hard registers, thus allowing the @code{asm} option in
  4942. declarations to refer to registers using alternate names. Unlike
  4943. @code{ADDITIONAL_REGISTER_NAMES}, this macro should be used when the
  4944. register name implies multiple underlying registers.
  4945. This macro should be used when it is important that a clobber in an
  4946. @code{asm} statement clobbers all the underlying values implied by the
  4947. register name. For example, on ARM, clobbering the double-precision
  4948. VFP register ``d0'' implies clobbering both single-precision registers
  4949. ``s0'' and ``s1''.
  4950. @end defmac
  4951. @defmac ASM_OUTPUT_OPCODE (@var{stream}, @var{ptr})
  4952. Define this macro if you are using an unusual assembler that
  4953. requires different names for the machine instructions.
  4954. The definition is a C statement or statements which output an
  4955. assembler instruction opcode to the stdio stream @var{stream}. The
  4956. macro-operand @var{ptr} is a variable of type @code{char *} which
  4957. points to the opcode name in its ``internal'' form---the form that is
  4958. written in the machine description. The definition should output the
  4959. opcode name to @var{stream}, performing any translation you desire, and
  4960. increment the variable @var{ptr} to point at the end of the opcode
  4961. so that it will not be output twice.
  4962. In fact, your macro definition may process less than the entire opcode
  4963. name, or more than the opcode name; but if you want to process text
  4964. that includes @samp{%}-sequences to substitute operands, you must take
  4965. care of the substitution yourself. Just be sure to increment
  4966. @var{ptr} over whatever text should not be output normally.
  4967. @findex recog_data.operand
  4968. If you need to look at the operand values, they can be found as the
  4969. elements of @code{recog_data.operand}.
  4970. If the macro definition does nothing, the instruction is output
  4971. in the usual way.
  4972. @end defmac
  4973. @defmac FINAL_PRESCAN_INSN (@var{insn}, @var{opvec}, @var{noperands})
  4974. If defined, a C statement to be executed just prior to the output of
  4975. assembler code for @var{insn}, to modify the extracted operands so
  4976. they will be output differently.
  4977. Here the argument @var{opvec} is the vector containing the operands
  4978. extracted from @var{insn}, and @var{noperands} is the number of
  4979. elements of the vector which contain meaningful data for this insn.
  4980. The contents of this vector are what will be used to convert the insn
  4981. template into assembler code, so you can change the assembler output
  4982. by changing the contents of the vector.
  4983. This macro is useful when various assembler syntaxes share a single
  4984. file of instruction patterns; by defining this macro differently, you
  4985. can cause a large class of instructions to be output differently (such
  4986. as with rearranged operands). Naturally, variations in assembler
  4987. syntax affecting individual insn patterns ought to be handled by
  4988. writing conditional output routines in those patterns.
  4989. If this macro is not defined, it is equivalent to a null statement.
  4990. @end defmac
  4991. @hook TARGET_ASM_FINAL_POSTSCAN_INSN
  4992. @defmac PRINT_OPERAND (@var{stream}, @var{x}, @var{code})
  4993. A C compound statement to output to stdio stream @var{stream} the
  4994. assembler syntax for an instruction operand @var{x}. @var{x} is an
  4995. RTL expression.
  4996. @var{code} is a value that can be used to specify one of several ways
  4997. of printing the operand. It is used when identical operands must be
  4998. printed differently depending on the context. @var{code} comes from
  4999. the @samp{%} specification that was used to request printing of the
  5000. operand. If the specification was just @samp{%@var{digit}} then
  5001. @var{code} is 0; if the specification was @samp{%@var{ltr}
  5002. @var{digit}} then @var{code} is the ASCII code for @var{ltr}.
  5003. @findex reg_names
  5004. If @var{x} is a register, this macro should print the register's name.
  5005. The names can be found in an array @code{reg_names} whose type is
  5006. @code{char *[]}. @code{reg_names} is initialized from
  5007. @code{REGISTER_NAMES}.
  5008. When the machine description has a specification @samp{%@var{punct}}
  5009. (a @samp{%} followed by a punctuation character), this macro is called
  5010. with a null pointer for @var{x} and the punctuation character for
  5011. @var{code}.
  5012. @end defmac
  5013. @defmac PRINT_OPERAND_PUNCT_VALID_P (@var{code})
  5014. A C expression which evaluates to true if @var{code} is a valid
  5015. punctuation character for use in the @code{PRINT_OPERAND} macro. If
  5016. @code{PRINT_OPERAND_PUNCT_VALID_P} is not defined, it means that no
  5017. punctuation characters (except for the standard one, @samp{%}) are used
  5018. in this way.
  5019. @end defmac
  5020. @defmac PRINT_OPERAND_ADDRESS (@var{stream}, @var{x})
  5021. A C compound statement to output to stdio stream @var{stream} the
  5022. assembler syntax for an instruction operand that is a memory reference
  5023. whose address is @var{x}. @var{x} is an RTL expression.
  5024. @cindex @code{TARGET_ENCODE_SECTION_INFO} usage
  5025. On some machines, the syntax for a symbolic address depends on the
  5026. section that the address refers to. On these machines, define the hook
  5027. @code{TARGET_ENCODE_SECTION_INFO} to store the information into the
  5028. @code{symbol_ref}, and then check for it here. @xref{Assembler
  5029. Format}.
  5030. @end defmac
  5031. @findex dbr_sequence_length
  5032. @defmac DBR_OUTPUT_SEQEND (@var{file})
  5033. A C statement, to be executed after all slot-filler instructions have
  5034. been output. If necessary, call @code{dbr_sequence_length} to
  5035. determine the number of slots filled in a sequence (zero if not
  5036. currently outputting a sequence), to decide how many no-ops to output,
  5037. or whatever.
  5038. Don't define this macro if it has nothing to do, but it is helpful in
  5039. reading assembly output if the extent of the delay sequence is made
  5040. explicit (e.g.@: with white space).
  5041. @end defmac
  5042. @findex final_sequence
  5043. Note that output routines for instructions with delay slots must be
  5044. prepared to deal with not being output as part of a sequence
  5045. (i.e.@: when the scheduling pass is not run, or when no slot fillers could be
  5046. found.) The variable @code{final_sequence} is null when not
  5047. processing a sequence, otherwise it contains the @code{sequence} rtx
  5048. being output.
  5049. @findex asm_fprintf
  5050. @defmac REGISTER_PREFIX
  5051. @defmacx LOCAL_LABEL_PREFIX
  5052. @defmacx USER_LABEL_PREFIX
  5053. @defmacx IMMEDIATE_PREFIX
  5054. If defined, C string expressions to be used for the @samp{%R}, @samp{%L},
  5055. @samp{%U}, and @samp{%I} options of @code{asm_fprintf} (see
  5056. @file{final.c}). These are useful when a single @file{md} file must
  5057. support multiple assembler formats. In that case, the various @file{tm.h}
  5058. files can define these macros differently.
  5059. @end defmac
  5060. @defmac ASM_FPRINTF_EXTENSIONS (@var{file}, @var{argptr}, @var{format})
  5061. If defined this macro should expand to a series of @code{case}
  5062. statements which will be parsed inside the @code{switch} statement of
  5063. the @code{asm_fprintf} function. This allows targets to define extra
  5064. printf formats which may useful when generating their assembler
  5065. statements. Note that uppercase letters are reserved for future
  5066. generic extensions to asm_fprintf, and so are not available to target
  5067. specific code. The output file is given by the parameter @var{file}.
  5068. The varargs input pointer is @var{argptr} and the rest of the format
  5069. string, starting the character after the one that is being switched
  5070. upon, is pointed to by @var{format}.
  5071. @end defmac
  5072. @defmac ASSEMBLER_DIALECT
  5073. If your target supports multiple dialects of assembler language (such as
  5074. different opcodes), define this macro as a C expression that gives the
  5075. numeric index of the assembler language dialect to use, with zero as the
  5076. first variant.
  5077. If this macro is defined, you may use constructs of the form
  5078. @smallexample
  5079. @samp{@{option0|option1|option2@dots{}@}}
  5080. @end smallexample
  5081. @noindent
  5082. in the output templates of patterns (@pxref{Output Template}) or in the
  5083. first argument of @code{asm_fprintf}. This construct outputs
  5084. @samp{option0}, @samp{option1}, @samp{option2}, etc., if the value of
  5085. @code{ASSEMBLER_DIALECT} is zero, one, two, etc. Any special characters
  5086. within these strings retain their usual meaning. If there are fewer
  5087. alternatives within the braces than the value of
  5088. @code{ASSEMBLER_DIALECT}, the construct outputs nothing. If it's needed
  5089. to print curly braces or @samp{|} character in assembler output directly,
  5090. @samp{%@{}, @samp{%@}} and @samp{%|} can be used.
  5091. If you do not define this macro, the characters @samp{@{}, @samp{|} and
  5092. @samp{@}} do not have any special meaning when used in templates or
  5093. operands to @code{asm_fprintf}.
  5094. Define the macros @code{REGISTER_PREFIX}, @code{LOCAL_LABEL_PREFIX},
  5095. @code{USER_LABEL_PREFIX} and @code{IMMEDIATE_PREFIX} if you can express
  5096. the variations in assembler language syntax with that mechanism. Define
  5097. @code{ASSEMBLER_DIALECT} and use the @samp{@{option0|option1@}} syntax
  5098. if the syntax variant are larger and involve such things as different
  5099. opcodes or operand order.
  5100. @end defmac
  5101. @defmac ASM_OUTPUT_REG_PUSH (@var{stream}, @var{regno})
  5102. A C expression to output to @var{stream} some assembler code
  5103. which will push hard register number @var{regno} onto the stack.
  5104. The code need not be optimal, since this macro is used only when
  5105. profiling.
  5106. @end defmac
  5107. @defmac ASM_OUTPUT_REG_POP (@var{stream}, @var{regno})
  5108. A C expression to output to @var{stream} some assembler code
  5109. which will pop hard register number @var{regno} off of the stack.
  5110. The code need not be optimal, since this macro is used only when
  5111. profiling.
  5112. @end defmac
  5113. @node Dispatch Tables
  5114. @subsection Output of Dispatch Tables
  5115. @c prevent bad page break with this line
  5116. This concerns dispatch tables.
  5117. @cindex dispatch table
  5118. @defmac ASM_OUTPUT_ADDR_DIFF_ELT (@var{stream}, @var{body}, @var{value}, @var{rel})
  5119. A C statement to output to the stdio stream @var{stream} an assembler
  5120. pseudo-instruction to generate a difference between two labels.
  5121. @var{value} and @var{rel} are the numbers of two internal labels. The
  5122. definitions of these labels are output using
  5123. @code{(*targetm.asm_out.internal_label)}, and they must be printed in the same
  5124. way here. For example,
  5125. @smallexample
  5126. fprintf (@var{stream}, "\t.word L%d-L%d\n",
  5127. @var{value}, @var{rel})
  5128. @end smallexample
  5129. You must provide this macro on machines where the addresses in a
  5130. dispatch table are relative to the table's own address. If defined, GCC
  5131. will also use this macro on all machines when producing PIC@.
  5132. @var{body} is the body of the @code{ADDR_DIFF_VEC}; it is provided so that the
  5133. mode and flags can be read.
  5134. @end defmac
  5135. @defmac ASM_OUTPUT_ADDR_VEC_ELT (@var{stream}, @var{value})
  5136. This macro should be provided on machines where the addresses
  5137. in a dispatch table are absolute.
  5138. The definition should be a C statement to output to the stdio stream
  5139. @var{stream} an assembler pseudo-instruction to generate a reference to
  5140. a label. @var{value} is the number of an internal label whose
  5141. definition is output using @code{(*targetm.asm_out.internal_label)}.
  5142. For example,
  5143. @smallexample
  5144. fprintf (@var{stream}, "\t.word L%d\n", @var{value})
  5145. @end smallexample
  5146. @end defmac
  5147. @defmac ASM_OUTPUT_CASE_LABEL (@var{stream}, @var{prefix}, @var{num}, @var{table})
  5148. Define this if the label before a jump-table needs to be output
  5149. specially. The first three arguments are the same as for
  5150. @code{(*targetm.asm_out.internal_label)}; the fourth argument is the
  5151. jump-table which follows (a @code{jump_table_data} containing an
  5152. @code{addr_vec} or @code{addr_diff_vec}).
  5153. This feature is used on system V to output a @code{swbeg} statement
  5154. for the table.
  5155. If this macro is not defined, these labels are output with
  5156. @code{(*targetm.asm_out.internal_label)}.
  5157. @end defmac
  5158. @defmac ASM_OUTPUT_CASE_END (@var{stream}, @var{num}, @var{table})
  5159. Define this if something special must be output at the end of a
  5160. jump-table. The definition should be a C statement to be executed
  5161. after the assembler code for the table is written. It should write
  5162. the appropriate code to stdio stream @var{stream}. The argument
  5163. @var{table} is the jump-table insn, and @var{num} is the label-number
  5164. of the preceding label.
  5165. If this macro is not defined, nothing special is output at the end of
  5166. the jump-table.
  5167. @end defmac
  5168. @hook TARGET_ASM_EMIT_UNWIND_LABEL
  5169. @hook TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL
  5170. @hook TARGET_ASM_EMIT_EXCEPT_PERSONALITY
  5171. @hook TARGET_ASM_UNWIND_EMIT
  5172. @hook TARGET_ASM_UNWIND_EMIT_BEFORE_INSN
  5173. @node Exception Region Output
  5174. @subsection Assembler Commands for Exception Regions
  5175. @c prevent bad page break with this line
  5176. This describes commands marking the start and the end of an exception
  5177. region.
  5178. @defmac EH_FRAME_SECTION_NAME
  5179. If defined, a C string constant for the name of the section containing
  5180. exception handling frame unwind information. If not defined, GCC will
  5181. provide a default definition if the target supports named sections.
  5182. @file{crtstuff.c} uses this macro to switch to the appropriate section.
  5183. You should define this symbol if your target supports DWARF 2 frame
  5184. unwind information and the default definition does not work.
  5185. @end defmac
  5186. @defmac EH_FRAME_IN_DATA_SECTION
  5187. If defined, DWARF 2 frame unwind information will be placed in the
  5188. data section even though the target supports named sections. This
  5189. might be necessary, for instance, if the system linker does garbage
  5190. collection and sections cannot be marked as not to be collected.
  5191. Do not define this macro unless @code{TARGET_ASM_NAMED_SECTION} is
  5192. also defined.
  5193. @end defmac
  5194. @defmac EH_TABLES_CAN_BE_READ_ONLY
  5195. Define this macro to 1 if your target is such that no frame unwind
  5196. information encoding used with non-PIC code will ever require a
  5197. runtime relocation, but the linker may not support merging read-only
  5198. and read-write sections into a single read-write section.
  5199. @end defmac
  5200. @defmac MASK_RETURN_ADDR
  5201. An rtx used to mask the return address found via @code{RETURN_ADDR_RTX}, so
  5202. that it does not contain any extraneous set bits in it.
  5203. @end defmac
  5204. @defmac DWARF2_UNWIND_INFO
  5205. Define this macro to 0 if your target supports DWARF 2 frame unwind
  5206. information, but it does not yet work with exception handling.
  5207. Otherwise, if your target supports this information (if it defines
  5208. @code{INCOMING_RETURN_ADDR_RTX} and @code{OBJECT_FORMAT_ELF}),
  5209. GCC will provide a default definition of 1.
  5210. @end defmac
  5211. @hook TARGET_EXCEPT_UNWIND_INFO
  5212. This hook defines the mechanism that will be used for exception handling
  5213. by the target. If the target has ABI specified unwind tables, the hook
  5214. should return @code{UI_TARGET}. If the target is to use the
  5215. @code{setjmp}/@code{longjmp}-based exception handling scheme, the hook
  5216. should return @code{UI_SJLJ}. If the target supports DWARF 2 frame unwind
  5217. information, the hook should return @code{UI_DWARF2}.
  5218. A target may, if exceptions are disabled, choose to return @code{UI_NONE}.
  5219. This may end up simplifying other parts of target-specific code. The
  5220. default implementation of this hook never returns @code{UI_NONE}.
  5221. Note that the value returned by this hook should be constant. It should
  5222. not depend on anything except the command-line switches described by
  5223. @var{opts}. In particular, the
  5224. setting @code{UI_SJLJ} must be fixed at compiler start-up as C pre-processor
  5225. macros and builtin functions related to exception handling are set up
  5226. depending on this setting.
  5227. The default implementation of the hook first honors the
  5228. @option{--enable-sjlj-exceptions} configure option, then
  5229. @code{DWARF2_UNWIND_INFO}, and finally defaults to @code{UI_SJLJ}. If
  5230. @code{DWARF2_UNWIND_INFO} depends on command-line options, the target
  5231. must define this hook so that @var{opts} is used correctly.
  5232. @end deftypefn
  5233. @hook TARGET_UNWIND_TABLES_DEFAULT
  5234. This variable should be set to @code{true} if the target ABI requires unwinding
  5235. tables even when exceptions are not used. It must not be modified by
  5236. command-line option processing.
  5237. @end deftypevr
  5238. @defmac DONT_USE_BUILTIN_SETJMP
  5239. Define this macro to 1 if the @code{setjmp}/@code{longjmp}-based scheme
  5240. should use the @code{setjmp}/@code{longjmp} functions from the C library
  5241. instead of the @code{__builtin_setjmp}/@code{__builtin_longjmp} machinery.
  5242. @end defmac
  5243. @defmac JMP_BUF_SIZE
  5244. This macro has no effect unless @code{DONT_USE_BUILTIN_SETJMP} is also
  5245. defined. Define this macro if the default size of @code{jmp_buf} buffer
  5246. for the @code{setjmp}/@code{longjmp}-based exception handling mechanism
  5247. is not large enough, or if it is much too large.
  5248. The default size is @code{FIRST_PSEUDO_REGISTER * sizeof(void *)}.
  5249. @end defmac
  5250. @defmac DWARF_CIE_DATA_ALIGNMENT
  5251. This macro need only be defined if the target might save registers in the
  5252. function prologue at an offset to the stack pointer that is not aligned to
  5253. @code{UNITS_PER_WORD}. The definition should be the negative minimum
  5254. alignment if @code{STACK_GROWS_DOWNWARD} is defined, and the positive
  5255. minimum alignment otherwise. @xref{SDB and DWARF}. Only applicable if
  5256. the target supports DWARF 2 frame unwind information.
  5257. @end defmac
  5258. @hook TARGET_TERMINATE_DW2_EH_FRAME_INFO
  5259. @hook TARGET_DWARF_REGISTER_SPAN
  5260. @hook TARGET_DWARF_FRAME_REG_MODE
  5261. @hook TARGET_INIT_DWARF_REG_SIZES_EXTRA
  5262. @hook TARGET_ASM_TTYPE
  5263. @hook TARGET_ARM_EABI_UNWINDER
  5264. @node Alignment Output
  5265. @subsection Assembler Commands for Alignment
  5266. @c prevent bad page break with this line
  5267. This describes commands for alignment.
  5268. @defmac JUMP_ALIGN (@var{label})
  5269. The alignment (log base 2) to put in front of @var{label}, which is
  5270. a common destination of jumps and has no fallthru incoming edge.
  5271. This macro need not be defined if you don't want any special alignment
  5272. to be done at such a time. Most machine descriptions do not currently
  5273. define the macro.
  5274. Unless it's necessary to inspect the @var{label} parameter, it is better
  5275. to set the variable @var{align_jumps} in the target's
  5276. @code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's
  5277. selection in @var{align_jumps} in a @code{JUMP_ALIGN} implementation.
  5278. @end defmac
  5279. @hook TARGET_ASM_JUMP_ALIGN_MAX_SKIP
  5280. @defmac LABEL_ALIGN_AFTER_BARRIER (@var{label})
  5281. The alignment (log base 2) to put in front of @var{label}, which follows
  5282. a @code{BARRIER}.
  5283. This macro need not be defined if you don't want any special alignment
  5284. to be done at such a time. Most machine descriptions do not currently
  5285. define the macro.
  5286. @end defmac
  5287. @hook TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
  5288. @defmac LOOP_ALIGN (@var{label})
  5289. The alignment (log base 2) to put in front of @var{label} that heads
  5290. a frequently executed basic block (usually the header of a loop).
  5291. This macro need not be defined if you don't want any special alignment
  5292. to be done at such a time. Most machine descriptions do not currently
  5293. define the macro.
  5294. Unless it's necessary to inspect the @var{label} parameter, it is better
  5295. to set the variable @code{align_loops} in the target's
  5296. @code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's
  5297. selection in @code{align_loops} in a @code{LOOP_ALIGN} implementation.
  5298. @end defmac
  5299. @hook TARGET_ASM_LOOP_ALIGN_MAX_SKIP
  5300. @defmac LABEL_ALIGN (@var{label})
  5301. The alignment (log base 2) to put in front of @var{label}.
  5302. If @code{LABEL_ALIGN_AFTER_BARRIER} / @code{LOOP_ALIGN} specify a different alignment,
  5303. the maximum of the specified values is used.
  5304. Unless it's necessary to inspect the @var{label} parameter, it is better
  5305. to set the variable @code{align_labels} in the target's
  5306. @code{TARGET_OPTION_OVERRIDE}. Otherwise, you should try to honor the user's
  5307. selection in @code{align_labels} in a @code{LABEL_ALIGN} implementation.
  5308. @end defmac
  5309. @hook TARGET_ASM_LABEL_ALIGN_MAX_SKIP
  5310. @defmac ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes})
  5311. A C statement to output to the stdio stream @var{stream} an assembler
  5312. instruction to advance the location counter by @var{nbytes} bytes.
  5313. Those bytes should be zero when loaded. @var{nbytes} will be a C
  5314. expression of type @code{unsigned HOST_WIDE_INT}.
  5315. @end defmac
  5316. @defmac ASM_NO_SKIP_IN_TEXT
  5317. Define this macro if @code{ASM_OUTPUT_SKIP} should not be used in the
  5318. text section because it fails to put zeros in the bytes that are skipped.
  5319. This is true on many Unix systems, where the pseudo--op to skip bytes
  5320. produces no-op instructions rather than zeros when used in the text
  5321. section.
  5322. @end defmac
  5323. @defmac ASM_OUTPUT_ALIGN (@var{stream}, @var{power})
  5324. A C statement to output to the stdio stream @var{stream} an assembler
  5325. command to advance the location counter to a multiple of 2 to the
  5326. @var{power} bytes. @var{power} will be a C expression of type @code{int}.
  5327. @end defmac
  5328. @defmac ASM_OUTPUT_ALIGN_WITH_NOP (@var{stream}, @var{power})
  5329. Like @code{ASM_OUTPUT_ALIGN}, except that the ``nop'' instruction is used
  5330. for padding, if necessary.
  5331. @end defmac
  5332. @defmac ASM_OUTPUT_MAX_SKIP_ALIGN (@var{stream}, @var{power}, @var{max_skip})
  5333. A C statement to output to the stdio stream @var{stream} an assembler
  5334. command to advance the location counter to a multiple of 2 to the
  5335. @var{power} bytes, but only if @var{max_skip} or fewer bytes are needed to
  5336. satisfy the alignment request. @var{power} and @var{max_skip} will be
  5337. a C expression of type @code{int}.
  5338. @end defmac
  5339. @need 3000
  5340. @node Debugging Info
  5341. @section Controlling Debugging Information Format
  5342. @c prevent bad page break with this line
  5343. This describes how to specify debugging information.
  5344. @menu
  5345. * All Debuggers:: Macros that affect all debugging formats uniformly.
  5346. * DBX Options:: Macros enabling specific options in DBX format.
  5347. * DBX Hooks:: Hook macros for varying DBX format.
  5348. * File Names and DBX:: Macros controlling output of file names in DBX format.
  5349. * SDB and DWARF:: Macros for SDB (COFF) and DWARF formats.
  5350. * VMS Debug:: Macros for VMS debug format.
  5351. @end menu
  5352. @node All Debuggers
  5353. @subsection Macros Affecting All Debugging Formats
  5354. @c prevent bad page break with this line
  5355. These macros affect all debugging formats.
  5356. @defmac DBX_REGISTER_NUMBER (@var{regno})
  5357. A C expression that returns the DBX register number for the compiler
  5358. register number @var{regno}. In the default macro provided, the value
  5359. of this expression will be @var{regno} itself. But sometimes there are
  5360. some registers that the compiler knows about and DBX does not, or vice
  5361. versa. In such cases, some register may need to have one number in the
  5362. compiler and another for DBX@.
  5363. If two registers have consecutive numbers inside GCC, and they can be
  5364. used as a pair to hold a multiword value, then they @emph{must} have
  5365. consecutive numbers after renumbering with @code{DBX_REGISTER_NUMBER}.
  5366. Otherwise, debuggers will be unable to access such a pair, because they
  5367. expect register pairs to be consecutive in their own numbering scheme.
  5368. If you find yourself defining @code{DBX_REGISTER_NUMBER} in way that
  5369. does not preserve register pairs, then what you must do instead is
  5370. redefine the actual register numbering scheme.
  5371. @end defmac
  5372. @defmac DEBUGGER_AUTO_OFFSET (@var{x})
  5373. A C expression that returns the integer offset value for an automatic
  5374. variable having address @var{x} (an RTL expression). The default
  5375. computation assumes that @var{x} is based on the frame-pointer and
  5376. gives the offset from the frame-pointer. This is required for targets
  5377. that produce debugging output for DBX or COFF-style debugging output
  5378. for SDB and allow the frame-pointer to be eliminated when the
  5379. @option{-g} options is used.
  5380. @end defmac
  5381. @defmac DEBUGGER_ARG_OFFSET (@var{offset}, @var{x})
  5382. A C expression that returns the integer offset value for an argument
  5383. having address @var{x} (an RTL expression). The nominal offset is
  5384. @var{offset}.
  5385. @end defmac
  5386. @defmac PREFERRED_DEBUGGING_TYPE
  5387. A C expression that returns the type of debugging output GCC should
  5388. produce when the user specifies just @option{-g}. Define
  5389. this if you have arranged for GCC to support more than one format of
  5390. debugging output. Currently, the allowable values are @code{DBX_DEBUG},
  5391. @code{SDB_DEBUG}, @code{DWARF_DEBUG}, @code{DWARF2_DEBUG},
  5392. @code{XCOFF_DEBUG}, @code{VMS_DEBUG}, and @code{VMS_AND_DWARF2_DEBUG}.
  5393. When the user specifies @option{-ggdb}, GCC normally also uses the
  5394. value of this macro to select the debugging output format, but with two
  5395. exceptions. If @code{DWARF2_DEBUGGING_INFO} is defined, GCC uses the
  5396. value @code{DWARF2_DEBUG}. Otherwise, if @code{DBX_DEBUGGING_INFO} is
  5397. defined, GCC uses @code{DBX_DEBUG}.
  5398. The value of this macro only affects the default debugging output; the
  5399. user can always get a specific type of output by using @option{-gstabs},
  5400. @option{-gcoff}, @option{-gdwarf-2}, @option{-gxcoff}, or @option{-gvms}.
  5401. @end defmac
  5402. @node DBX Options
  5403. @subsection Specific Options for DBX Output
  5404. @c prevent bad page break with this line
  5405. These are specific options for DBX output.
  5406. @defmac DBX_DEBUGGING_INFO
  5407. Define this macro if GCC should produce debugging output for DBX
  5408. in response to the @option{-g} option.
  5409. @end defmac
  5410. @defmac XCOFF_DEBUGGING_INFO
  5411. Define this macro if GCC should produce XCOFF format debugging output
  5412. in response to the @option{-g} option. This is a variant of DBX format.
  5413. @end defmac
  5414. @defmac DEFAULT_GDB_EXTENSIONS
  5415. Define this macro to control whether GCC should by default generate
  5416. GDB's extended version of DBX debugging information (assuming DBX-format
  5417. debugging information is enabled at all). If you don't define the
  5418. macro, the default is 1: always generate the extended information
  5419. if there is any occasion to.
  5420. @end defmac
  5421. @defmac DEBUG_SYMS_TEXT
  5422. Define this macro if all @code{.stabs} commands should be output while
  5423. in the text section.
  5424. @end defmac
  5425. @defmac ASM_STABS_OP
  5426. A C string constant, including spacing, naming the assembler pseudo op to
  5427. use instead of @code{"\t.stabs\t"} to define an ordinary debugging symbol.
  5428. If you don't define this macro, @code{"\t.stabs\t"} is used. This macro
  5429. applies only to DBX debugging information format.
  5430. @end defmac
  5431. @defmac ASM_STABD_OP
  5432. A C string constant, including spacing, naming the assembler pseudo op to
  5433. use instead of @code{"\t.stabd\t"} to define a debugging symbol whose
  5434. value is the current location. If you don't define this macro,
  5435. @code{"\t.stabd\t"} is used. This macro applies only to DBX debugging
  5436. information format.
  5437. @end defmac
  5438. @defmac ASM_STABN_OP
  5439. A C string constant, including spacing, naming the assembler pseudo op to
  5440. use instead of @code{"\t.stabn\t"} to define a debugging symbol with no
  5441. name. If you don't define this macro, @code{"\t.stabn\t"} is used. This
  5442. macro applies only to DBX debugging information format.
  5443. @end defmac
  5444. @defmac DBX_NO_XREFS
  5445. Define this macro if DBX on your system does not support the construct
  5446. @samp{xs@var{tagname}}. On some systems, this construct is used to
  5447. describe a forward reference to a structure named @var{tagname}.
  5448. On other systems, this construct is not supported at all.
  5449. @end defmac
  5450. @defmac DBX_CONTIN_LENGTH
  5451. A symbol name in DBX-format debugging information is normally
  5452. continued (split into two separate @code{.stabs} directives) when it
  5453. exceeds a certain length (by default, 80 characters). On some
  5454. operating systems, DBX requires this splitting; on others, splitting
  5455. must not be done. You can inhibit splitting by defining this macro
  5456. with the value zero. You can override the default splitting-length by
  5457. defining this macro as an expression for the length you desire.
  5458. @end defmac
  5459. @defmac DBX_CONTIN_CHAR
  5460. Normally continuation is indicated by adding a @samp{\} character to
  5461. the end of a @code{.stabs} string when a continuation follows. To use
  5462. a different character instead, define this macro as a character
  5463. constant for the character you want to use. Do not define this macro
  5464. if backslash is correct for your system.
  5465. @end defmac
  5466. @defmac DBX_STATIC_STAB_DATA_SECTION
  5467. Define this macro if it is necessary to go to the data section before
  5468. outputting the @samp{.stabs} pseudo-op for a non-global static
  5469. variable.
  5470. @end defmac
  5471. @defmac DBX_TYPE_DECL_STABS_CODE
  5472. The value to use in the ``code'' field of the @code{.stabs} directive
  5473. for a typedef. The default is @code{N_LSYM}.
  5474. @end defmac
  5475. @defmac DBX_STATIC_CONST_VAR_CODE
  5476. The value to use in the ``code'' field of the @code{.stabs} directive
  5477. for a static variable located in the text section. DBX format does not
  5478. provide any ``right'' way to do this. The default is @code{N_FUN}.
  5479. @end defmac
  5480. @defmac DBX_REGPARM_STABS_CODE
  5481. The value to use in the ``code'' field of the @code{.stabs} directive
  5482. for a parameter passed in registers. DBX format does not provide any
  5483. ``right'' way to do this. The default is @code{N_RSYM}.
  5484. @end defmac
  5485. @defmac DBX_REGPARM_STABS_LETTER
  5486. The letter to use in DBX symbol data to identify a symbol as a parameter
  5487. passed in registers. DBX format does not customarily provide any way to
  5488. do this. The default is @code{'P'}.
  5489. @end defmac
  5490. @defmac DBX_FUNCTION_FIRST
  5491. Define this macro if the DBX information for a function and its
  5492. arguments should precede the assembler code for the function. Normally,
  5493. in DBX format, the debugging information entirely follows the assembler
  5494. code.
  5495. @end defmac
  5496. @defmac DBX_BLOCKS_FUNCTION_RELATIVE
  5497. Define this macro, with value 1, if the value of a symbol describing
  5498. the scope of a block (@code{N_LBRAC} or @code{N_RBRAC}) should be
  5499. relative to the start of the enclosing function. Normally, GCC uses
  5500. an absolute address.
  5501. @end defmac
  5502. @defmac DBX_LINES_FUNCTION_RELATIVE
  5503. Define this macro, with value 1, if the value of a symbol indicating
  5504. the current line number (@code{N_SLINE}) should be relative to the
  5505. start of the enclosing function. Normally, GCC uses an absolute address.
  5506. @end defmac
  5507. @defmac DBX_USE_BINCL
  5508. Define this macro if GCC should generate @code{N_BINCL} and
  5509. @code{N_EINCL} stabs for included header files, as on Sun systems. This
  5510. macro also directs GCC to output a type number as a pair of a file
  5511. number and a type number within the file. Normally, GCC does not
  5512. generate @code{N_BINCL} or @code{N_EINCL} stabs, and it outputs a single
  5513. number for a type number.
  5514. @end defmac
  5515. @node DBX Hooks
  5516. @subsection Open-Ended Hooks for DBX Format
  5517. @c prevent bad page break with this line
  5518. These are hooks for DBX format.
  5519. @defmac DBX_OUTPUT_SOURCE_LINE (@var{stream}, @var{line}, @var{counter})
  5520. A C statement to output DBX debugging information before code for line
  5521. number @var{line} of the current source file to the stdio stream
  5522. @var{stream}. @var{counter} is the number of time the macro was
  5523. invoked, including the current invocation; it is intended to generate
  5524. unique labels in the assembly output.
  5525. This macro should not be defined if the default output is correct, or
  5526. if it can be made correct by defining @code{DBX_LINES_FUNCTION_RELATIVE}.
  5527. @end defmac
  5528. @defmac NO_DBX_FUNCTION_END
  5529. Some stabs encapsulation formats (in particular ECOFF), cannot handle the
  5530. @code{.stabs "",N_FUN,,0,0,Lscope-function-1} gdb dbx extension construct.
  5531. On those machines, define this macro to turn this feature off without
  5532. disturbing the rest of the gdb extensions.
  5533. @end defmac
  5534. @defmac NO_DBX_BNSYM_ENSYM
  5535. Some assemblers cannot handle the @code{.stabd BNSYM/ENSYM,0,0} gdb dbx
  5536. extension construct. On those machines, define this macro to turn this
  5537. feature off without disturbing the rest of the gdb extensions.
  5538. @end defmac
  5539. @node File Names and DBX
  5540. @subsection File Names in DBX Format
  5541. @c prevent bad page break with this line
  5542. This describes file names in DBX format.
  5543. @defmac DBX_OUTPUT_MAIN_SOURCE_FILENAME (@var{stream}, @var{name})
  5544. A C statement to output DBX debugging information to the stdio stream
  5545. @var{stream}, which indicates that file @var{name} is the main source
  5546. file---the file specified as the input file for compilation.
  5547. This macro is called only once, at the beginning of compilation.
  5548. This macro need not be defined if the standard form of output
  5549. for DBX debugging information is appropriate.
  5550. It may be necessary to refer to a label equal to the beginning of the
  5551. text section. You can use @samp{assemble_name (stream, ltext_label_name)}
  5552. to do so. If you do this, you must also set the variable
  5553. @var{used_ltext_label_name} to @code{true}.
  5554. @end defmac
  5555. @defmac NO_DBX_MAIN_SOURCE_DIRECTORY
  5556. Define this macro, with value 1, if GCC should not emit an indication
  5557. of the current directory for compilation and current source language at
  5558. the beginning of the file.
  5559. @end defmac
  5560. @defmac NO_DBX_GCC_MARKER
  5561. Define this macro, with value 1, if GCC should not emit an indication
  5562. that this object file was compiled by GCC@. The default is to emit
  5563. an @code{N_OPT} stab at the beginning of every source file, with
  5564. @samp{gcc2_compiled.} for the string and value 0.
  5565. @end defmac
  5566. @defmac DBX_OUTPUT_MAIN_SOURCE_FILE_END (@var{stream}, @var{name})
  5567. A C statement to output DBX debugging information at the end of
  5568. compilation of the main source file @var{name}. Output should be
  5569. written to the stdio stream @var{stream}.
  5570. If you don't define this macro, nothing special is output at the end
  5571. of compilation, which is correct for most machines.
  5572. @end defmac
  5573. @defmac DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
  5574. Define this macro @emph{instead of} defining
  5575. @code{DBX_OUTPUT_MAIN_SOURCE_FILE_END}, if what needs to be output at
  5576. the end of compilation is an @code{N_SO} stab with an empty string,
  5577. whose value is the highest absolute text address in the file.
  5578. @end defmac
  5579. @need 2000
  5580. @node SDB and DWARF
  5581. @subsection Macros for SDB and DWARF Output
  5582. @c prevent bad page break with this line
  5583. Here are macros for SDB and DWARF output.
  5584. @defmac SDB_DEBUGGING_INFO
  5585. Define this macro if GCC should produce COFF-style debugging output
  5586. for SDB in response to the @option{-g} option.
  5587. @end defmac
  5588. @defmac DWARF2_DEBUGGING_INFO
  5589. Define this macro if GCC should produce dwarf version 2 format
  5590. debugging output in response to the @option{-g} option.
  5591. @hook TARGET_DWARF_CALLING_CONVENTION
  5592. To support optional call frame debugging information, you must also
  5593. define @code{INCOMING_RETURN_ADDR_RTX} and either set
  5594. @code{RTX_FRAME_RELATED_P} on the prologue insns if you use RTL for the
  5595. prologue, or call @code{dwarf2out_def_cfa} and @code{dwarf2out_reg_save}
  5596. as appropriate from @code{TARGET_ASM_FUNCTION_PROLOGUE} if you don't.
  5597. @end defmac
  5598. @defmac DWARF2_FRAME_INFO
  5599. Define this macro to a nonzero value if GCC should always output
  5600. Dwarf 2 frame information. If @code{TARGET_EXCEPT_UNWIND_INFO}
  5601. (@pxref{Exception Region Output}) returns @code{UI_DWARF2}, and
  5602. exceptions are enabled, GCC will output this information not matter
  5603. how you define @code{DWARF2_FRAME_INFO}.
  5604. @end defmac
  5605. @hook TARGET_DEBUG_UNWIND_INFO
  5606. @defmac DWARF2_ASM_LINE_DEBUG_INFO
  5607. Define this macro to be a nonzero value if the assembler can generate Dwarf 2
  5608. line debug info sections. This will result in much more compact line number
  5609. tables, and hence is desirable if it works.
  5610. @end defmac
  5611. @hook TARGET_WANT_DEBUG_PUB_SECTIONS
  5612. @hook TARGET_FORCE_AT_COMP_DIR
  5613. @hook TARGET_DELAY_SCHED2
  5614. @hook TARGET_DELAY_VARTRACK
  5615. @hook TARGET_NO_REGISTER_ALLOCATION
  5616. @defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2})
  5617. A C statement to issue assembly directives that create a difference
  5618. @var{lab1} minus @var{lab2}, using an integer of the given @var{size}.
  5619. @end defmac
  5620. @defmac ASM_OUTPUT_DWARF_VMS_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2})
  5621. A C statement to issue assembly directives that create a difference
  5622. between the two given labels in system defined units, e.g. instruction
  5623. slots on IA64 VMS, using an integer of the given size.
  5624. @end defmac
  5625. @defmac ASM_OUTPUT_DWARF_OFFSET (@var{stream}, @var{size}, @var{label}, @var{section})
  5626. A C statement to issue assembly directives that create a
  5627. section-relative reference to the given @var{label}, using an integer of the
  5628. given @var{size}. The label is known to be defined in the given @var{section}.
  5629. @end defmac
  5630. @defmac ASM_OUTPUT_DWARF_PCREL (@var{stream}, @var{size}, @var{label})
  5631. A C statement to issue assembly directives that create a self-relative
  5632. reference to the given @var{label}, using an integer of the given @var{size}.
  5633. @end defmac
  5634. @defmac ASM_OUTPUT_DWARF_TABLE_REF (@var{label})
  5635. A C statement to issue assembly directives that create a reference to
  5636. the DWARF table identifier @var{label} from the current section. This
  5637. is used on some systems to avoid garbage collecting a DWARF table which
  5638. is referenced by a function.
  5639. @end defmac
  5640. @hook TARGET_ASM_OUTPUT_DWARF_DTPREL
  5641. @defmac PUT_SDB_@dots{}
  5642. Define these macros to override the assembler syntax for the special
  5643. SDB assembler directives. See @file{sdbout.c} for a list of these
  5644. macros and their arguments. If the standard syntax is used, you need
  5645. not define them yourself.
  5646. @end defmac
  5647. @defmac SDB_DELIM
  5648. Some assemblers do not support a semicolon as a delimiter, even between
  5649. SDB assembler directives. In that case, define this macro to be the
  5650. delimiter to use (usually @samp{\n}). It is not necessary to define
  5651. a new set of @code{PUT_SDB_@var{op}} macros if this is the only change
  5652. required.
  5653. @end defmac
  5654. @defmac SDB_ALLOW_UNKNOWN_REFERENCES
  5655. Define this macro to allow references to unknown structure,
  5656. union, or enumeration tags to be emitted. Standard COFF does not
  5657. allow handling of unknown references, MIPS ECOFF has support for
  5658. it.
  5659. @end defmac
  5660. @defmac SDB_ALLOW_FORWARD_REFERENCES
  5661. Define this macro to allow references to structure, union, or
  5662. enumeration tags that have not yet been seen to be handled. Some
  5663. assemblers choke if forward tags are used, while some require it.
  5664. @end defmac
  5665. @defmac SDB_OUTPUT_SOURCE_LINE (@var{stream}, @var{line})
  5666. A C statement to output SDB debugging information before code for line
  5667. number @var{line} of the current source file to the stdio stream
  5668. @var{stream}. The default is to emit an @code{.ln} directive.
  5669. @end defmac
  5670. @need 2000
  5671. @node VMS Debug
  5672. @subsection Macros for VMS Debug Format
  5673. @c prevent bad page break with this line
  5674. Here are macros for VMS debug format.
  5675. @defmac VMS_DEBUGGING_INFO
  5676. Define this macro if GCC should produce debugging output for VMS
  5677. in response to the @option{-g} option. The default behavior for VMS
  5678. is to generate minimal debug info for a traceback in the absence of
  5679. @option{-g} unless explicitly overridden with @option{-g0}. This
  5680. behavior is controlled by @code{TARGET_OPTION_OPTIMIZATION} and
  5681. @code{TARGET_OPTION_OVERRIDE}.
  5682. @end defmac
  5683. @node Floating Point
  5684. @section Cross Compilation and Floating Point
  5685. @cindex cross compilation and floating point
  5686. @cindex floating point and cross compilation
  5687. While all modern machines use twos-complement representation for integers,
  5688. there are a variety of representations for floating point numbers. This
  5689. means that in a cross-compiler the representation of floating point numbers
  5690. in the compiled program may be different from that used in the machine
  5691. doing the compilation.
  5692. Because different representation systems may offer different amounts of
  5693. range and precision, all floating point constants must be represented in
  5694. the target machine's format. Therefore, the cross compiler cannot
  5695. safely use the host machine's floating point arithmetic; it must emulate
  5696. the target's arithmetic. To ensure consistency, GCC always uses
  5697. emulation to work with floating point values, even when the host and
  5698. target floating point formats are identical.
  5699. The following macros are provided by @file{real.h} for the compiler to
  5700. use. All parts of the compiler which generate or optimize
  5701. floating-point calculations must use these macros. They may evaluate
  5702. their operands more than once, so operands must not have side effects.
  5703. @defmac REAL_VALUE_TYPE
  5704. The C data type to be used to hold a floating point value in the target
  5705. machine's format. Typically this is a @code{struct} containing an
  5706. array of @code{HOST_WIDE_INT}, but all code should treat it as an opaque
  5707. quantity.
  5708. @end defmac
  5709. @deftypefn Macro int REAL_VALUES_EQUAL (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
  5710. Compares for equality the two values, @var{x} and @var{y}. If the target
  5711. floating point format supports negative zeroes and/or NaNs,
  5712. @samp{REAL_VALUES_EQUAL (-0.0, 0.0)} is true, and
  5713. @samp{REAL_VALUES_EQUAL (NaN, NaN)} is false.
  5714. @end deftypefn
  5715. @deftypefn Macro int REAL_VALUES_LESS (REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
  5716. Tests whether @var{x} is less than @var{y}.
  5717. @end deftypefn
  5718. @deftypefn Macro HOST_WIDE_INT REAL_VALUE_FIX (REAL_VALUE_TYPE @var{x})
  5719. Truncates @var{x} to a signed integer, rounding toward zero.
  5720. @end deftypefn
  5721. @deftypefn Macro {unsigned HOST_WIDE_INT} REAL_VALUE_UNSIGNED_FIX (REAL_VALUE_TYPE @var{x})
  5722. Truncates @var{x} to an unsigned integer, rounding toward zero. If
  5723. @var{x} is negative, returns zero.
  5724. @end deftypefn
  5725. @deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_ATOF (const char *@var{string}, machine_mode @var{mode})
  5726. Converts @var{string} into a floating point number in the target machine's
  5727. representation for mode @var{mode}. This routine can handle both
  5728. decimal and hexadecimal floating point constants, using the syntax
  5729. defined by the C language for both.
  5730. @end deftypefn
  5731. @deftypefn Macro int REAL_VALUE_NEGATIVE (REAL_VALUE_TYPE @var{x})
  5732. Returns 1 if @var{x} is negative (including negative zero), 0 otherwise.
  5733. @end deftypefn
  5734. @deftypefn Macro int REAL_VALUE_ISINF (REAL_VALUE_TYPE @var{x})
  5735. Determines whether @var{x} represents infinity (positive or negative).
  5736. @end deftypefn
  5737. @deftypefn Macro int REAL_VALUE_ISNAN (REAL_VALUE_TYPE @var{x})
  5738. Determines whether @var{x} represents a ``NaN'' (not-a-number).
  5739. @end deftypefn
  5740. @deftypefn Macro void REAL_ARITHMETIC (REAL_VALUE_TYPE @var{output}, enum tree_code @var{code}, REAL_VALUE_TYPE @var{x}, REAL_VALUE_TYPE @var{y})
  5741. Calculates an arithmetic operation on the two floating point values
  5742. @var{x} and @var{y}, storing the result in @var{output} (which must be a
  5743. variable).
  5744. The operation to be performed is specified by @var{code}. Only the
  5745. following codes are supported: @code{PLUS_EXPR}, @code{MINUS_EXPR},
  5746. @code{MULT_EXPR}, @code{RDIV_EXPR}, @code{MAX_EXPR}, @code{MIN_EXPR}.
  5747. If @code{REAL_ARITHMETIC} is asked to evaluate division by zero and the
  5748. target's floating point format cannot represent infinity, it will call
  5749. @code{abort}. Callers should check for this situation first, using
  5750. @code{MODE_HAS_INFINITIES}. @xref{Storage Layout}.
  5751. @end deftypefn
  5752. @deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_NEGATE (REAL_VALUE_TYPE @var{x})
  5753. Returns the negative of the floating point value @var{x}.
  5754. @end deftypefn
  5755. @deftypefn Macro REAL_VALUE_TYPE REAL_VALUE_ABS (REAL_VALUE_TYPE @var{x})
  5756. Returns the absolute value of @var{x}.
  5757. @end deftypefn
  5758. @node Mode Switching
  5759. @section Mode Switching Instructions
  5760. @cindex mode switching
  5761. The following macros control mode switching optimizations:
  5762. @defmac OPTIMIZE_MODE_SWITCHING (@var{entity})
  5763. Define this macro if the port needs extra instructions inserted for mode
  5764. switching in an optimizing compilation.
  5765. For an example, the SH4 can perform both single and double precision
  5766. floating point operations, but to perform a single precision operation,
  5767. the FPSCR PR bit has to be cleared, while for a double precision
  5768. operation, this bit has to be set. Changing the PR bit requires a general
  5769. purpose register as a scratch register, hence these FPSCR sets have to
  5770. be inserted before reload, i.e.@: you can't put this into instruction emitting
  5771. or @code{TARGET_MACHINE_DEPENDENT_REORG}.
  5772. You can have multiple entities that are mode-switched, and select at run time
  5773. which entities actually need it. @code{OPTIMIZE_MODE_SWITCHING} should
  5774. return nonzero for any @var{entity} that needs mode-switching.
  5775. If you define this macro, you also have to define
  5776. @code{NUM_MODES_FOR_MODE_SWITCHING}, @code{TARGET_MODE_NEEDED},
  5777. @code{TARGET_MODE_PRIORITY} and @code{TARGET_MODE_EMIT}.
  5778. @code{TARGET_MODE_AFTER}, @code{TARGET_MODE_ENTRY}, and @code{TARGET_MODE_EXIT}
  5779. are optional.
  5780. @end defmac
  5781. @defmac NUM_MODES_FOR_MODE_SWITCHING
  5782. If you define @code{OPTIMIZE_MODE_SWITCHING}, you have to define this as
  5783. initializer for an array of integers. Each initializer element
  5784. N refers to an entity that needs mode switching, and specifies the number
  5785. of different modes that might need to be set for this entity.
  5786. The position of the initializer in the initializer---starting counting at
  5787. zero---determines the integer that is used to refer to the mode-switched
  5788. entity in question.
  5789. In macros that take mode arguments / yield a mode result, modes are
  5790. represented as numbers 0 @dots{} N @minus{} 1. N is used to specify that no mode
  5791. switch is needed / supplied.
  5792. @end defmac
  5793. @hook TARGET_MODE_EMIT
  5794. @hook TARGET_MODE_NEEDED
  5795. @hook TARGET_MODE_AFTER
  5796. @hook TARGET_MODE_ENTRY
  5797. @hook TARGET_MODE_EXIT
  5798. @hook TARGET_MODE_PRIORITY
  5799. @node Target Attributes
  5800. @section Defining target-specific uses of @code{__attribute__}
  5801. @cindex target attributes
  5802. @cindex machine attributes
  5803. @cindex attributes, target-specific
  5804. Target-specific attributes may be defined for functions, data and types.
  5805. These are described using the following target hooks; they also need to
  5806. be documented in @file{extend.texi}.
  5807. @hook TARGET_ATTRIBUTE_TABLE
  5808. @hook TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P
  5809. @hook TARGET_COMP_TYPE_ATTRIBUTES
  5810. @hook TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
  5811. @hook TARGET_MERGE_TYPE_ATTRIBUTES
  5812. @hook TARGET_MERGE_DECL_ATTRIBUTES
  5813. @hook TARGET_VALID_DLLIMPORT_ATTRIBUTE_P
  5814. @defmac TARGET_DECLSPEC
  5815. Define this macro to a nonzero value if you want to treat
  5816. @code{__declspec(X)} as equivalent to @code{__attribute((X))}. By
  5817. default, this behavior is enabled only for targets that define
  5818. @code{TARGET_DLLIMPORT_DECL_ATTRIBUTES}. The current implementation
  5819. of @code{__declspec} is via a built-in macro, but you should not rely
  5820. on this implementation detail.
  5821. @end defmac
  5822. @hook TARGET_INSERT_ATTRIBUTES
  5823. @hook TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P
  5824. @hook TARGET_OPTION_VALID_ATTRIBUTE_P
  5825. @hook TARGET_OPTION_SAVE
  5826. @hook TARGET_OPTION_RESTORE
  5827. @hook TARGET_OPTION_POST_STREAM_IN
  5828. @hook TARGET_OPTION_PRINT
  5829. @hook TARGET_OPTION_PRAGMA_PARSE
  5830. @hook TARGET_OPTION_OVERRIDE
  5831. @hook TARGET_OPTION_FUNCTION_VERSIONS
  5832. @hook TARGET_CAN_INLINE_P
  5833. @node Emulated TLS
  5834. @section Emulating TLS
  5835. @cindex Emulated TLS
  5836. For targets whose psABI does not provide Thread Local Storage via
  5837. specific relocations and instruction sequences, an emulation layer is
  5838. used. A set of target hooks allows this emulation layer to be
  5839. configured for the requirements of a particular target. For instance
  5840. the psABI may in fact specify TLS support in terms of an emulation
  5841. layer.
  5842. The emulation layer works by creating a control object for every TLS
  5843. object. To access the TLS object, a lookup function is provided
  5844. which, when given the address of the control object, will return the
  5845. address of the current thread's instance of the TLS object.
  5846. @hook TARGET_EMUTLS_GET_ADDRESS
  5847. @hook TARGET_EMUTLS_REGISTER_COMMON
  5848. @hook TARGET_EMUTLS_VAR_SECTION
  5849. @hook TARGET_EMUTLS_TMPL_SECTION
  5850. @hook TARGET_EMUTLS_VAR_PREFIX
  5851. @hook TARGET_EMUTLS_TMPL_PREFIX
  5852. @hook TARGET_EMUTLS_VAR_FIELDS
  5853. @hook TARGET_EMUTLS_VAR_INIT
  5854. @hook TARGET_EMUTLS_VAR_ALIGN_FIXED
  5855. @hook TARGET_EMUTLS_DEBUG_FORM_TLS_ADDRESS
  5856. @node MIPS Coprocessors
  5857. @section Defining coprocessor specifics for MIPS targets.
  5858. @cindex MIPS coprocessor-definition macros
  5859. The MIPS specification allows MIPS implementations to have as many as 4
  5860. coprocessors, each with as many as 32 private registers. GCC supports
  5861. accessing these registers and transferring values between the registers
  5862. and memory using asm-ized variables. For example:
  5863. @smallexample
  5864. register unsigned int cp0count asm ("c0r1");
  5865. unsigned int d;
  5866. d = cp0count + 3;
  5867. @end smallexample
  5868. (``c0r1'' is the default name of register 1 in coprocessor 0; alternate
  5869. names may be added as described below, or the default names may be
  5870. overridden entirely in @code{SUBTARGET_CONDITIONAL_REGISTER_USAGE}.)
  5871. Coprocessor registers are assumed to be epilogue-used; sets to them will
  5872. be preserved even if it does not appear that the register is used again
  5873. later in the function.
  5874. Another note: according to the MIPS spec, coprocessor 1 (if present) is
  5875. the FPU@. One accesses COP1 registers through standard mips
  5876. floating-point support; they are not included in this mechanism.
  5877. @node PCH Target
  5878. @section Parameters for Precompiled Header Validity Checking
  5879. @cindex parameters, precompiled headers
  5880. @hook TARGET_GET_PCH_VALIDITY
  5881. @hook TARGET_PCH_VALID_P
  5882. @hook TARGET_CHECK_PCH_TARGET_FLAGS
  5883. @hook TARGET_PREPARE_PCH_SAVE
  5884. @node C++ ABI
  5885. @section C++ ABI parameters
  5886. @cindex parameters, c++ abi
  5887. @hook TARGET_CXX_GUARD_TYPE
  5888. @hook TARGET_CXX_GUARD_MASK_BIT
  5889. @hook TARGET_CXX_GET_COOKIE_SIZE
  5890. @hook TARGET_CXX_COOKIE_HAS_SIZE
  5891. @hook TARGET_CXX_IMPORT_EXPORT_CLASS
  5892. @hook TARGET_CXX_CDTOR_RETURNS_THIS
  5893. @hook TARGET_CXX_KEY_METHOD_MAY_BE_INLINE
  5894. @hook TARGET_CXX_DETERMINE_CLASS_DATA_VISIBILITY
  5895. @hook TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT
  5896. @hook TARGET_CXX_LIBRARY_RTTI_COMDAT
  5897. @hook TARGET_CXX_USE_AEABI_ATEXIT
  5898. @hook TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT
  5899. @hook TARGET_CXX_ADJUST_CLASS_AT_DEFINITION
  5900. @hook TARGET_CXX_DECL_MANGLING_CONTEXT
  5901. @node Named Address Spaces
  5902. @section Adding support for named address spaces
  5903. @cindex named address spaces
  5904. The draft technical report of the ISO/IEC JTC1 S22 WG14 N1275
  5905. standards committee, @cite{Programming Languages - C - Extensions to
  5906. support embedded processors}, specifies a syntax for embedded
  5907. processors to specify alternate address spaces. You can configure a
  5908. GCC port to support section 5.1 of the draft report to add support for
  5909. address spaces other than the default address space. These address
  5910. spaces are new keywords that are similar to the @code{volatile} and
  5911. @code{const} type attributes.
  5912. Pointers to named address spaces can have a different size than
  5913. pointers to the generic address space.
  5914. For example, the SPU port uses the @code{__ea} address space to refer
  5915. to memory in the host processor, rather than memory local to the SPU
  5916. processor. Access to memory in the @code{__ea} address space involves
  5917. issuing DMA operations to move data between the host processor and the
  5918. local processor memory address space. Pointers in the @code{__ea}
  5919. address space are either 32 bits or 64 bits based on the
  5920. @option{-mea32} or @option{-mea64} switches (native SPU pointers are
  5921. always 32 bits).
  5922. Internally, address spaces are represented as a small integer in the
  5923. range 0 to 15 with address space 0 being reserved for the generic
  5924. address space.
  5925. To register a named address space qualifier keyword with the C front end,
  5926. the target may call the @code{c_register_addr_space} routine. For example,
  5927. the SPU port uses the following to declare @code{__ea} as the keyword for
  5928. named address space #1:
  5929. @smallexample
  5930. #define ADDR_SPACE_EA 1
  5931. c_register_addr_space ("__ea", ADDR_SPACE_EA);
  5932. @end smallexample
  5933. @hook TARGET_ADDR_SPACE_POINTER_MODE
  5934. @hook TARGET_ADDR_SPACE_ADDRESS_MODE
  5935. @hook TARGET_ADDR_SPACE_VALID_POINTER_MODE
  5936. @hook TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P
  5937. @hook TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS
  5938. @hook TARGET_ADDR_SPACE_SUBSET_P
  5939. @hook TARGET_ADDR_SPACE_CONVERT
  5940. @node Misc
  5941. @section Miscellaneous Parameters
  5942. @cindex parameters, miscellaneous
  5943. @c prevent bad page break with this line
  5944. Here are several miscellaneous parameters.
  5945. @defmac HAS_LONG_COND_BRANCH
  5946. Define this boolean macro to indicate whether or not your architecture
  5947. has conditional branches that can span all of memory. It is used in
  5948. conjunction with an optimization that partitions hot and cold basic
  5949. blocks into separate sections of the executable. If this macro is
  5950. set to false, gcc will convert any conditional branches that attempt
  5951. to cross between sections into unconditional branches or indirect jumps.
  5952. @end defmac
  5953. @defmac HAS_LONG_UNCOND_BRANCH
  5954. Define this boolean macro to indicate whether or not your architecture
  5955. has unconditional branches that can span all of memory. It is used in
  5956. conjunction with an optimization that partitions hot and cold basic
  5957. blocks into separate sections of the executable. If this macro is
  5958. set to false, gcc will convert any unconditional branches that attempt
  5959. to cross between sections into indirect jumps.
  5960. @end defmac
  5961. @defmac CASE_VECTOR_MODE
  5962. An alias for a machine mode name. This is the machine mode that
  5963. elements of a jump-table should have.
  5964. @end defmac
  5965. @defmac CASE_VECTOR_SHORTEN_MODE (@var{min_offset}, @var{max_offset}, @var{body})
  5966. Optional: return the preferred mode for an @code{addr_diff_vec}
  5967. when the minimum and maximum offset are known. If you define this,
  5968. it enables extra code in branch shortening to deal with @code{addr_diff_vec}.
  5969. To make this work, you also have to define @code{INSN_ALIGN} and
  5970. make the alignment for @code{addr_diff_vec} explicit.
  5971. The @var{body} argument is provided so that the offset_unsigned and scale
  5972. flags can be updated.
  5973. @end defmac
  5974. @defmac CASE_VECTOR_PC_RELATIVE
  5975. Define this macro to be a C expression to indicate when jump-tables
  5976. should contain relative addresses. You need not define this macro if
  5977. jump-tables never contain relative addresses, or jump-tables should
  5978. contain relative addresses only when @option{-fPIC} or @option{-fPIC}
  5979. is in effect.
  5980. @end defmac
  5981. @hook TARGET_CASE_VALUES_THRESHOLD
  5982. @defmac WORD_REGISTER_OPERATIONS
  5983. Define this macro if operations between registers with integral mode
  5984. smaller than a word are always performed on the entire register.
  5985. Most RISC machines have this property and most CISC machines do not.
  5986. @end defmac
  5987. @defmac LOAD_EXTEND_OP (@var{mem_mode})
  5988. Define this macro to be a C expression indicating when insns that read
  5989. memory in @var{mem_mode}, an integral mode narrower than a word, set the
  5990. bits outside of @var{mem_mode} to be either the sign-extension or the
  5991. zero-extension of the data read. Return @code{SIGN_EXTEND} for values
  5992. of @var{mem_mode} for which the
  5993. insn sign-extends, @code{ZERO_EXTEND} for which it zero-extends, and
  5994. @code{UNKNOWN} for other modes.
  5995. This macro is not called with @var{mem_mode} non-integral or with a width
  5996. greater than or equal to @code{BITS_PER_WORD}, so you may return any
  5997. value in this case. Do not define this macro if it would always return
  5998. @code{UNKNOWN}. On machines where this macro is defined, you will normally
  5999. define it as the constant @code{SIGN_EXTEND} or @code{ZERO_EXTEND}.
  6000. You may return a non-@code{UNKNOWN} value even if for some hard registers
  6001. the sign extension is not performed, if for the @code{REGNO_REG_CLASS}
  6002. of these hard registers @code{CANNOT_CHANGE_MODE_CLASS} returns nonzero
  6003. when the @var{from} mode is @var{mem_mode} and the @var{to} mode is any
  6004. integral mode larger than this but not larger than @code{word_mode}.
  6005. You must return @code{UNKNOWN} if for some hard registers that allow this
  6006. mode, @code{CANNOT_CHANGE_MODE_CLASS} says that they cannot change to
  6007. @code{word_mode}, but that they can change to another integral mode that
  6008. is larger then @var{mem_mode} but still smaller than @code{word_mode}.
  6009. @end defmac
  6010. @defmac SHORT_IMMEDIATES_SIGN_EXTEND
  6011. Define this macro if loading short immediate values into registers sign
  6012. extends.
  6013. @end defmac
  6014. @hook TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
  6015. @defmac MOVE_MAX
  6016. The maximum number of bytes that a single instruction can move quickly
  6017. between memory and registers or between two memory locations.
  6018. @end defmac
  6019. @defmac MAX_MOVE_MAX
  6020. The maximum number of bytes that a single instruction can move quickly
  6021. between memory and registers or between two memory locations. If this
  6022. is undefined, the default is @code{MOVE_MAX}. Otherwise, it is the
  6023. constant value that is the largest value that @code{MOVE_MAX} can have
  6024. at run-time.
  6025. @end defmac
  6026. @defmac SHIFT_COUNT_TRUNCATED
  6027. A C expression that is nonzero if on this machine the number of bits
  6028. actually used for the count of a shift operation is equal to the number
  6029. of bits needed to represent the size of the object being shifted. When
  6030. this macro is nonzero, the compiler will assume that it is safe to omit
  6031. a sign-extend, zero-extend, and certain bitwise `and' instructions that
  6032. truncates the count of a shift operation. On machines that have
  6033. instructions that act on bit-fields at variable positions, which may
  6034. include `bit test' instructions, a nonzero @code{SHIFT_COUNT_TRUNCATED}
  6035. also enables deletion of truncations of the values that serve as
  6036. arguments to bit-field instructions.
  6037. If both types of instructions truncate the count (for shifts) and
  6038. position (for bit-field operations), or if no variable-position bit-field
  6039. instructions exist, you should define this macro.
  6040. However, on some machines, such as the 80386 and the 680x0, truncation
  6041. only applies to shift operations and not the (real or pretended)
  6042. bit-field operations. Define @code{SHIFT_COUNT_TRUNCATED} to be zero on
  6043. such machines. Instead, add patterns to the @file{md} file that include
  6044. the implied truncation of the shift instructions.
  6045. You need not define this macro if it would always have the value of zero.
  6046. @end defmac
  6047. @anchor{TARGET_SHIFT_TRUNCATION_MASK}
  6048. @hook TARGET_SHIFT_TRUNCATION_MASK
  6049. @defmac TRULY_NOOP_TRUNCATION (@var{outprec}, @var{inprec})
  6050. A C expression which is nonzero if on this machine it is safe to
  6051. ``convert'' an integer of @var{inprec} bits to one of @var{outprec}
  6052. bits (where @var{outprec} is smaller than @var{inprec}) by merely
  6053. operating on it as if it had only @var{outprec} bits.
  6054. On many machines, this expression can be 1.
  6055. @c rearranged this, removed the phrase "it is reported that". this was
  6056. @c to fix an overfull hbox. --mew 10feb93
  6057. When @code{TRULY_NOOP_TRUNCATION} returns 1 for a pair of sizes for
  6058. modes for which @code{MODES_TIEABLE_P} is 0, suboptimal code can result.
  6059. If this is the case, making @code{TRULY_NOOP_TRUNCATION} return 0 in
  6060. such cases may improve things.
  6061. @end defmac
  6062. @hook TARGET_MODE_REP_EXTENDED
  6063. @defmac STORE_FLAG_VALUE
  6064. A C expression describing the value returned by a comparison operator
  6065. with an integral mode and stored by a store-flag instruction
  6066. (@samp{cstore@var{mode}4}) when the condition is true. This description must
  6067. apply to @emph{all} the @samp{cstore@var{mode}4} patterns and all the
  6068. comparison operators whose results have a @code{MODE_INT} mode.
  6069. A value of 1 or @minus{}1 means that the instruction implementing the
  6070. comparison operator returns exactly 1 or @minus{}1 when the comparison is true
  6071. and 0 when the comparison is false. Otherwise, the value indicates
  6072. which bits of the result are guaranteed to be 1 when the comparison is
  6073. true. This value is interpreted in the mode of the comparison
  6074. operation, which is given by the mode of the first operand in the
  6075. @samp{cstore@var{mode}4} pattern. Either the low bit or the sign bit of
  6076. @code{STORE_FLAG_VALUE} be on. Presently, only those bits are used by
  6077. the compiler.
  6078. If @code{STORE_FLAG_VALUE} is neither 1 or @minus{}1, the compiler will
  6079. generate code that depends only on the specified bits. It can also
  6080. replace comparison operators with equivalent operations if they cause
  6081. the required bits to be set, even if the remaining bits are undefined.
  6082. For example, on a machine whose comparison operators return an
  6083. @code{SImode} value and where @code{STORE_FLAG_VALUE} is defined as
  6084. @samp{0x80000000}, saying that just the sign bit is relevant, the
  6085. expression
  6086. @smallexample
  6087. (ne:SI (and:SI @var{x} (const_int @var{power-of-2})) (const_int 0))
  6088. @end smallexample
  6089. @noindent
  6090. can be converted to
  6091. @smallexample
  6092. (ashift:SI @var{x} (const_int @var{n}))
  6093. @end smallexample
  6094. @noindent
  6095. where @var{n} is the appropriate shift count to move the bit being
  6096. tested into the sign bit.
  6097. There is no way to describe a machine that always sets the low-order bit
  6098. for a true value, but does not guarantee the value of any other bits,
  6099. but we do not know of any machine that has such an instruction. If you
  6100. are trying to port GCC to such a machine, include an instruction to
  6101. perform a logical-and of the result with 1 in the pattern for the
  6102. comparison operators and let us know at @email{gcc@@gcc.gnu.org}.
  6103. Often, a machine will have multiple instructions that obtain a value
  6104. from a comparison (or the condition codes). Here are rules to guide the
  6105. choice of value for @code{STORE_FLAG_VALUE}, and hence the instructions
  6106. to be used:
  6107. @itemize @bullet
  6108. @item
  6109. Use the shortest sequence that yields a valid definition for
  6110. @code{STORE_FLAG_VALUE}. It is more efficient for the compiler to
  6111. ``normalize'' the value (convert it to, e.g., 1 or 0) than for the
  6112. comparison operators to do so because there may be opportunities to
  6113. combine the normalization with other operations.
  6114. @item
  6115. For equal-length sequences, use a value of 1 or @minus{}1, with @minus{}1 being
  6116. slightly preferred on machines with expensive jumps and 1 preferred on
  6117. other machines.
  6118. @item
  6119. As a second choice, choose a value of @samp{0x80000001} if instructions
  6120. exist that set both the sign and low-order bits but do not define the
  6121. others.
  6122. @item
  6123. Otherwise, use a value of @samp{0x80000000}.
  6124. @end itemize
  6125. Many machines can produce both the value chosen for
  6126. @code{STORE_FLAG_VALUE} and its negation in the same number of
  6127. instructions. On those machines, you should also define a pattern for
  6128. those cases, e.g., one matching
  6129. @smallexample
  6130. (set @var{A} (neg:@var{m} (ne:@var{m} @var{B} @var{C})))
  6131. @end smallexample
  6132. Some machines can also perform @code{and} or @code{plus} operations on
  6133. condition code values with less instructions than the corresponding
  6134. @samp{cstore@var{mode}4} insn followed by @code{and} or @code{plus}. On those
  6135. machines, define the appropriate patterns. Use the names @code{incscc}
  6136. and @code{decscc}, respectively, for the patterns which perform
  6137. @code{plus} or @code{minus} operations on condition code values. See
  6138. @file{rs6000.md} for some examples. The GNU Superoptimizer can be used to
  6139. find such instruction sequences on other machines.
  6140. If this macro is not defined, the default value, 1, is used. You need
  6141. not define @code{STORE_FLAG_VALUE} if the machine has no store-flag
  6142. instructions, or if the value generated by these instructions is 1.
  6143. @end defmac
  6144. @defmac FLOAT_STORE_FLAG_VALUE (@var{mode})
  6145. A C expression that gives a nonzero @code{REAL_VALUE_TYPE} value that is
  6146. returned when comparison operators with floating-point results are true.
  6147. Define this macro on machines that have comparison operations that return
  6148. floating-point values. If there are no such operations, do not define
  6149. this macro.
  6150. @end defmac
  6151. @defmac VECTOR_STORE_FLAG_VALUE (@var{mode})
  6152. A C expression that gives a rtx representing the nonzero true element
  6153. for vector comparisons. The returned rtx should be valid for the inner
  6154. mode of @var{mode} which is guaranteed to be a vector mode. Define
  6155. this macro on machines that have vector comparison operations that
  6156. return a vector result. If there are no such operations, do not define
  6157. this macro. Typically, this macro is defined as @code{const1_rtx} or
  6158. @code{constm1_rtx}. This macro may return @code{NULL_RTX} to prevent
  6159. the compiler optimizing such vector comparison operations for the
  6160. given mode.
  6161. @end defmac
  6162. @defmac CLZ_DEFINED_VALUE_AT_ZERO (@var{mode}, @var{value})
  6163. @defmacx CTZ_DEFINED_VALUE_AT_ZERO (@var{mode}, @var{value})
  6164. A C expression that indicates whether the architecture defines a value
  6165. for @code{clz} or @code{ctz} with a zero operand.
  6166. A result of @code{0} indicates the value is undefined.
  6167. If the value is defined for only the RTL expression, the macro should
  6168. evaluate to @code{1}; if the value applies also to the corresponding optab
  6169. entry (which is normally the case if it expands directly into
  6170. the corresponding RTL), then the macro should evaluate to @code{2}.
  6171. In the cases where the value is defined, @var{value} should be set to
  6172. this value.
  6173. If this macro is not defined, the value of @code{clz} or
  6174. @code{ctz} at zero is assumed to be undefined.
  6175. This macro must be defined if the target's expansion for @code{ffs}
  6176. relies on a particular value to get correct results. Otherwise it
  6177. is not necessary, though it may be used to optimize some corner cases, and
  6178. to provide a default expansion for the @code{ffs} optab.
  6179. Note that regardless of this macro the ``definedness'' of @code{clz}
  6180. and @code{ctz} at zero do @emph{not} extend to the builtin functions
  6181. visible to the user. Thus one may be free to adjust the value at will
  6182. to match the target expansion of these operations without fear of
  6183. breaking the API@.
  6184. @end defmac
  6185. @defmac Pmode
  6186. An alias for the machine mode for pointers. On most machines, define
  6187. this to be the integer mode corresponding to the width of a hardware
  6188. pointer; @code{SImode} on 32-bit machine or @code{DImode} on 64-bit machines.
  6189. On some machines you must define this to be one of the partial integer
  6190. modes, such as @code{PSImode}.
  6191. The width of @code{Pmode} must be at least as large as the value of
  6192. @code{POINTER_SIZE}. If it is not equal, you must define the macro
  6193. @code{POINTERS_EXTEND_UNSIGNED} to specify how pointers are extended
  6194. to @code{Pmode}.
  6195. @end defmac
  6196. @defmac FUNCTION_MODE
  6197. An alias for the machine mode used for memory references to functions
  6198. being called, in @code{call} RTL expressions. On most CISC machines,
  6199. where an instruction can begin at any byte address, this should be
  6200. @code{QImode}. On most RISC machines, where all instructions have fixed
  6201. size and alignment, this should be a mode with the same size and alignment
  6202. as the machine instruction words - typically @code{SImode} or @code{HImode}.
  6203. @end defmac
  6204. @defmac STDC_0_IN_SYSTEM_HEADERS
  6205. In normal operation, the preprocessor expands @code{__STDC__} to the
  6206. constant 1, to signify that GCC conforms to ISO Standard C@. On some
  6207. hosts, like Solaris, the system compiler uses a different convention,
  6208. where @code{__STDC__} is normally 0, but is 1 if the user specifies
  6209. strict conformance to the C Standard.
  6210. Defining @code{STDC_0_IN_SYSTEM_HEADERS} makes GNU CPP follows the host
  6211. convention when processing system header files, but when processing user
  6212. files @code{__STDC__} will always expand to 1.
  6213. @end defmac
  6214. @hook TARGET_C_PREINCLUDE
  6215. @hook TARGET_CXX_IMPLICIT_EXTERN_C
  6216. @defmac NO_IMPLICIT_EXTERN_C
  6217. Define this macro if the system header files support C++ as well as C@.
  6218. This macro inhibits the usual method of using system header files in
  6219. C++, which is to pretend that the file's contents are enclosed in
  6220. @samp{extern "C" @{@dots{}@}}.
  6221. @end defmac
  6222. @findex #pragma
  6223. @findex pragma
  6224. @defmac REGISTER_TARGET_PRAGMAS ()
  6225. Define this macro if you want to implement any target-specific pragmas.
  6226. If defined, it is a C expression which makes a series of calls to
  6227. @code{c_register_pragma} or @code{c_register_pragma_with_expansion}
  6228. for each pragma. The macro may also do any
  6229. setup required for the pragmas.
  6230. The primary reason to define this macro is to provide compatibility with
  6231. other compilers for the same target. In general, we discourage
  6232. definition of target-specific pragmas for GCC@.
  6233. If the pragma can be implemented by attributes then you should consider
  6234. defining the target hook @samp{TARGET_INSERT_ATTRIBUTES} as well.
  6235. Preprocessor macros that appear on pragma lines are not expanded. All
  6236. @samp{#pragma} directives that do not match any registered pragma are
  6237. silently ignored, unless the user specifies @option{-Wunknown-pragmas}.
  6238. @end defmac
  6239. @deftypefun void c_register_pragma (const char *@var{space}, const char *@var{name}, void (*@var{callback}) (struct cpp_reader *))
  6240. @deftypefunx void c_register_pragma_with_expansion (const char *@var{space}, const char *@var{name}, void (*@var{callback}) (struct cpp_reader *))
  6241. Each call to @code{c_register_pragma} or
  6242. @code{c_register_pragma_with_expansion} establishes one pragma. The
  6243. @var{callback} routine will be called when the preprocessor encounters a
  6244. pragma of the form
  6245. @smallexample
  6246. #pragma [@var{space}] @var{name} @dots{}
  6247. @end smallexample
  6248. @var{space} is the case-sensitive namespace of the pragma, or
  6249. @code{NULL} to put the pragma in the global namespace. The callback
  6250. routine receives @var{pfile} as its first argument, which can be passed
  6251. on to cpplib's functions if necessary. You can lex tokens after the
  6252. @var{name} by calling @code{pragma_lex}. Tokens that are not read by the
  6253. callback will be silently ignored. The end of the line is indicated by
  6254. a token of type @code{CPP_EOF}. Macro expansion occurs on the
  6255. arguments of pragmas registered with
  6256. @code{c_register_pragma_with_expansion} but not on the arguments of
  6257. pragmas registered with @code{c_register_pragma}.
  6258. Note that the use of @code{pragma_lex} is specific to the C and C++
  6259. compilers. It will not work in the Java or Fortran compilers, or any
  6260. other language compilers for that matter. Thus if @code{pragma_lex} is going
  6261. to be called from target-specific code, it must only be done so when
  6262. building the C and C++ compilers. This can be done by defining the
  6263. variables @code{c_target_objs} and @code{cxx_target_objs} in the
  6264. target entry in the @file{config.gcc} file. These variables should name
  6265. the target-specific, language-specific object file which contains the
  6266. code that uses @code{pragma_lex}. Note it will also be necessary to add a
  6267. rule to the makefile fragment pointed to by @code{tmake_file} that shows
  6268. how to build this object file.
  6269. @end deftypefun
  6270. @defmac HANDLE_PRAGMA_PACK_WITH_EXPANSION
  6271. Define this macro if macros should be expanded in the
  6272. arguments of @samp{#pragma pack}.
  6273. @end defmac
  6274. @defmac TARGET_DEFAULT_PACK_STRUCT
  6275. If your target requires a structure packing default other than 0 (meaning
  6276. the machine default), define this macro to the necessary value (in bytes).
  6277. This must be a value that would also be valid to use with
  6278. @samp{#pragma pack()} (that is, a small power of two).
  6279. @end defmac
  6280. @defmac DOLLARS_IN_IDENTIFIERS
  6281. Define this macro to control use of the character @samp{$} in
  6282. identifier names for the C family of languages. 0 means @samp{$} is
  6283. not allowed by default; 1 means it is allowed. 1 is the default;
  6284. there is no need to define this macro in that case.
  6285. @end defmac
  6286. @defmac INSN_SETS_ARE_DELAYED (@var{insn})
  6287. Define this macro as a C expression that is nonzero if it is safe for the
  6288. delay slot scheduler to place instructions in the delay slot of @var{insn},
  6289. even if they appear to use a resource set or clobbered in @var{insn}.
  6290. @var{insn} is always a @code{jump_insn} or an @code{insn}; GCC knows that
  6291. every @code{call_insn} has this behavior. On machines where some @code{insn}
  6292. or @code{jump_insn} is really a function call and hence has this behavior,
  6293. you should define this macro.
  6294. You need not define this macro if it would always return zero.
  6295. @end defmac
  6296. @defmac INSN_REFERENCES_ARE_DELAYED (@var{insn})
  6297. Define this macro as a C expression that is nonzero if it is safe for the
  6298. delay slot scheduler to place instructions in the delay slot of @var{insn},
  6299. even if they appear to set or clobber a resource referenced in @var{insn}.
  6300. @var{insn} is always a @code{jump_insn} or an @code{insn}. On machines where
  6301. some @code{insn} or @code{jump_insn} is really a function call and its operands
  6302. are registers whose use is actually in the subroutine it calls, you should
  6303. define this macro. Doing so allows the delay slot scheduler to move
  6304. instructions which copy arguments into the argument registers into the delay
  6305. slot of @var{insn}.
  6306. You need not define this macro if it would always return zero.
  6307. @end defmac
  6308. @defmac MULTIPLE_SYMBOL_SPACES
  6309. Define this macro as a C expression that is nonzero if, in some cases,
  6310. global symbols from one translation unit may not be bound to undefined
  6311. symbols in another translation unit without user intervention. For
  6312. instance, under Microsoft Windows symbols must be explicitly imported
  6313. from shared libraries (DLLs).
  6314. You need not define this macro if it would always evaluate to zero.
  6315. @end defmac
  6316. @hook TARGET_MD_ASM_CLOBBERS
  6317. @defmac MATH_LIBRARY
  6318. Define this macro as a C string constant for the linker argument to link
  6319. in the system math library, minus the initial @samp{"-l"}, or
  6320. @samp{""} if the target does not have a
  6321. separate math library.
  6322. You need only define this macro if the default of @samp{"m"} is wrong.
  6323. @end defmac
  6324. @defmac LIBRARY_PATH_ENV
  6325. Define this macro as a C string constant for the environment variable that
  6326. specifies where the linker should look for libraries.
  6327. You need only define this macro if the default of @samp{"LIBRARY_PATH"}
  6328. is wrong.
  6329. @end defmac
  6330. @defmac TARGET_POSIX_IO
  6331. Define this macro if the target supports the following POSIX@ file
  6332. functions, access, mkdir and file locking with fcntl / F_SETLKW@.
  6333. Defining @code{TARGET_POSIX_IO} will enable the test coverage code
  6334. to use file locking when exiting a program, which avoids race conditions
  6335. if the program has forked. It will also create directories at run-time
  6336. for cross-profiling.
  6337. @end defmac
  6338. @defmac MAX_CONDITIONAL_EXECUTE
  6339. A C expression for the maximum number of instructions to execute via
  6340. conditional execution instructions instead of a branch. A value of
  6341. @code{BRANCH_COST}+1 is the default if the machine does not use cc0, and
  6342. 1 if it does use cc0.
  6343. @end defmac
  6344. @defmac IFCVT_MODIFY_TESTS (@var{ce_info}, @var{true_expr}, @var{false_expr})
  6345. Used if the target needs to perform machine-dependent modifications on the
  6346. conditionals used for turning basic blocks into conditionally executed code.
  6347. @var{ce_info} points to a data structure, @code{struct ce_if_block}, which
  6348. contains information about the currently processed blocks. @var{true_expr}
  6349. and @var{false_expr} are the tests that are used for converting the
  6350. then-block and the else-block, respectively. Set either @var{true_expr} or
  6351. @var{false_expr} to a null pointer if the tests cannot be converted.
  6352. @end defmac
  6353. @defmac IFCVT_MODIFY_MULTIPLE_TESTS (@var{ce_info}, @var{bb}, @var{true_expr}, @var{false_expr})
  6354. Like @code{IFCVT_MODIFY_TESTS}, but used when converting more complicated
  6355. if-statements into conditions combined by @code{and} and @code{or} operations.
  6356. @var{bb} contains the basic block that contains the test that is currently
  6357. being processed and about to be turned into a condition.
  6358. @end defmac
  6359. @defmac IFCVT_MODIFY_INSN (@var{ce_info}, @var{pattern}, @var{insn})
  6360. A C expression to modify the @var{PATTERN} of an @var{INSN} that is to
  6361. be converted to conditional execution format. @var{ce_info} points to
  6362. a data structure, @code{struct ce_if_block}, which contains information
  6363. about the currently processed blocks.
  6364. @end defmac
  6365. @defmac IFCVT_MODIFY_FINAL (@var{ce_info})
  6366. A C expression to perform any final machine dependent modifications in
  6367. converting code to conditional execution. The involved basic blocks
  6368. can be found in the @code{struct ce_if_block} structure that is pointed
  6369. to by @var{ce_info}.
  6370. @end defmac
  6371. @defmac IFCVT_MODIFY_CANCEL (@var{ce_info})
  6372. A C expression to cancel any machine dependent modifications in
  6373. converting code to conditional execution. The involved basic blocks
  6374. can be found in the @code{struct ce_if_block} structure that is pointed
  6375. to by @var{ce_info}.
  6376. @end defmac
  6377. @defmac IFCVT_MACHDEP_INIT (@var{ce_info})
  6378. A C expression to initialize any machine specific data for if-conversion
  6379. of the if-block in the @code{struct ce_if_block} structure that is pointed
  6380. to by @var{ce_info}.
  6381. @end defmac
  6382. @hook TARGET_MACHINE_DEPENDENT_REORG
  6383. @hook TARGET_INIT_BUILTINS
  6384. @hook TARGET_BUILTIN_DECL
  6385. @hook TARGET_EXPAND_BUILTIN
  6386. @hook TARGET_BUILTIN_CHKP_FUNCTION
  6387. @hook TARGET_CHKP_BOUND_TYPE
  6388. @hook TARGET_CHKP_BOUND_MODE
  6389. @hook TARGET_CHKP_MAKE_BOUNDS_CONSTANT
  6390. @hook TARGET_CHKP_INITIALIZE_BOUNDS
  6391. @hook TARGET_RESOLVE_OVERLOADED_BUILTIN
  6392. @hook TARGET_FOLD_BUILTIN
  6393. @hook TARGET_GIMPLE_FOLD_BUILTIN
  6394. @hook TARGET_COMPARE_VERSION_PRIORITY
  6395. @hook TARGET_GET_FUNCTION_VERSIONS_DISPATCHER
  6396. @hook TARGET_GENERATE_VERSION_DISPATCHER_BODY
  6397. @hook TARGET_CAN_USE_DOLOOP_P
  6398. @hook TARGET_INVALID_WITHIN_DOLOOP
  6399. @hook TARGET_LEGITIMATE_COMBINED_INSN
  6400. @hook TARGET_CAN_FOLLOW_JUMP
  6401. @hook TARGET_COMMUTATIVE_P
  6402. @hook TARGET_ALLOCATE_INITIAL_VALUE
  6403. @hook TARGET_UNSPEC_MAY_TRAP_P
  6404. @hook TARGET_SET_CURRENT_FUNCTION
  6405. @defmac TARGET_OBJECT_SUFFIX
  6406. Define this macro to be a C string representing the suffix for object
  6407. files on your target machine. If you do not define this macro, GCC will
  6408. use @samp{.o} as the suffix for object files.
  6409. @end defmac
  6410. @defmac TARGET_EXECUTABLE_SUFFIX
  6411. Define this macro to be a C string representing the suffix to be
  6412. automatically added to executable files on your target machine. If you
  6413. do not define this macro, GCC will use the null string as the suffix for
  6414. executable files.
  6415. @end defmac
  6416. @defmac COLLECT_EXPORT_LIST
  6417. If defined, @code{collect2} will scan the individual object files
  6418. specified on its command line and create an export list for the linker.
  6419. Define this macro for systems like AIX, where the linker discards
  6420. object files that are not referenced from @code{main} and uses export
  6421. lists.
  6422. @end defmac
  6423. @defmac MODIFY_JNI_METHOD_CALL (@var{mdecl})
  6424. Define this macro to a C expression representing a variant of the
  6425. method call @var{mdecl}, if Java Native Interface (JNI) methods
  6426. must be invoked differently from other methods on your target.
  6427. For example, on 32-bit Microsoft Windows, JNI methods must be invoked using
  6428. the @code{stdcall} calling convention and this macro is then
  6429. defined as this expression:
  6430. @smallexample
  6431. build_type_attribute_variant (@var{mdecl},
  6432. build_tree_list
  6433. (get_identifier ("stdcall"),
  6434. NULL))
  6435. @end smallexample
  6436. @end defmac
  6437. @hook TARGET_CANNOT_MODIFY_JUMPS_P
  6438. @hook TARGET_BRANCH_TARGET_REGISTER_CLASS
  6439. @hook TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED
  6440. @hook TARGET_HAVE_CONDITIONAL_EXECUTION
  6441. @hook TARGET_GEN_CCMP_FIRST
  6442. @hook TARGET_GEN_CCMP_NEXT
  6443. @hook TARGET_LOOP_UNROLL_ADJUST
  6444. @defmac POWI_MAX_MULTS
  6445. If defined, this macro is interpreted as a signed integer C expression
  6446. that specifies the maximum number of floating point multiplications
  6447. that should be emitted when expanding exponentiation by an integer
  6448. constant inline. When this value is defined, exponentiation requiring
  6449. more than this number of multiplications is implemented by calling the
  6450. system library's @code{pow}, @code{powf} or @code{powl} routines.
  6451. The default value places no upper bound on the multiplication count.
  6452. @end defmac
  6453. @deftypefn Macro void TARGET_EXTRA_INCLUDES (const char *@var{sysroot}, const char *@var{iprefix}, int @var{stdinc})
  6454. This target hook should register any extra include files for the
  6455. target. The parameter @var{stdinc} indicates if normal include files
  6456. are present. The parameter @var{sysroot} is the system root directory.
  6457. The parameter @var{iprefix} is the prefix for the gcc directory.
  6458. @end deftypefn
  6459. @deftypefn Macro void TARGET_EXTRA_PRE_INCLUDES (const char *@var{sysroot}, const char *@var{iprefix}, int @var{stdinc})
  6460. This target hook should register any extra include files for the
  6461. target before any standard headers. The parameter @var{stdinc}
  6462. indicates if normal include files are present. The parameter
  6463. @var{sysroot} is the system root directory. The parameter
  6464. @var{iprefix} is the prefix for the gcc directory.
  6465. @end deftypefn
  6466. @deftypefn Macro void TARGET_OPTF (char *@var{path})
  6467. This target hook should register special include paths for the target.
  6468. The parameter @var{path} is the include to register. On Darwin
  6469. systems, this is used for Framework includes, which have semantics
  6470. that are different from @option{-I}.
  6471. @end deftypefn
  6472. @defmac bool TARGET_USE_LOCAL_THUNK_ALIAS_P (tree @var{fndecl})
  6473. This target macro returns @code{true} if it is safe to use a local alias
  6474. for a virtual function @var{fndecl} when constructing thunks,
  6475. @code{false} otherwise. By default, the macro returns @code{true} for all
  6476. functions, if a target supports aliases (i.e.@: defines
  6477. @code{ASM_OUTPUT_DEF}), @code{false} otherwise,
  6478. @end defmac
  6479. @defmac TARGET_FORMAT_TYPES
  6480. If defined, this macro is the name of a global variable containing
  6481. target-specific format checking information for the @option{-Wformat}
  6482. option. The default is to have no target-specific format checks.
  6483. @end defmac
  6484. @defmac TARGET_N_FORMAT_TYPES
  6485. If defined, this macro is the number of entries in
  6486. @code{TARGET_FORMAT_TYPES}.
  6487. @end defmac
  6488. @defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES
  6489. If defined, this macro is the name of a global variable containing
  6490. target-specific format overrides for the @option{-Wformat} option. The
  6491. default is to have no target-specific format overrides. If defined,
  6492. @code{TARGET_FORMAT_TYPES} must be defined, too.
  6493. @end defmac
  6494. @defmac TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT
  6495. If defined, this macro specifies the number of entries in
  6496. @code{TARGET_OVERRIDES_FORMAT_ATTRIBUTES}.
  6497. @end defmac
  6498. @defmac TARGET_OVERRIDES_FORMAT_INIT
  6499. If defined, this macro specifies the optional initialization
  6500. routine for target specific customizations of the system printf
  6501. and scanf formatter settings.
  6502. @end defmac
  6503. @hook TARGET_RELAXED_ORDERING
  6504. @hook TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN
  6505. @hook TARGET_INVALID_CONVERSION
  6506. @hook TARGET_INVALID_UNARY_OP
  6507. @hook TARGET_INVALID_BINARY_OP
  6508. @hook TARGET_INVALID_PARAMETER_TYPE
  6509. @hook TARGET_INVALID_RETURN_TYPE
  6510. @hook TARGET_PROMOTED_TYPE
  6511. @hook TARGET_CONVERT_TO_TYPE
  6512. @defmac TARGET_USE_JCR_SECTION
  6513. This macro determines whether to use the JCR section to register Java
  6514. classes. By default, TARGET_USE_JCR_SECTION is defined to 1 if both
  6515. SUPPORTS_WEAK and TARGET_HAVE_NAMED_SECTIONS are true, else 0.
  6516. @end defmac
  6517. @defmac OBJC_JBLEN
  6518. This macro determines the size of the objective C jump buffer for the
  6519. NeXT runtime. By default, OBJC_JBLEN is defined to an innocuous value.
  6520. @end defmac
  6521. @defmac LIBGCC2_UNWIND_ATTRIBUTE
  6522. Define this macro if any target-specific attributes need to be attached
  6523. to the functions in @file{libgcc} that provide low-level support for
  6524. call stack unwinding. It is used in declarations in @file{unwind-generic.h}
  6525. and the associated definitions of those functions.
  6526. @end defmac
  6527. @hook TARGET_UPDATE_STACK_BOUNDARY
  6528. @hook TARGET_GET_DRAP_RTX
  6529. @hook TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
  6530. @hook TARGET_CONST_ANCHOR
  6531. @hook TARGET_ASAN_SHADOW_OFFSET
  6532. @hook TARGET_MEMMODEL_CHECK
  6533. @hook TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
  6534. @hook TARGET_HAS_IFUNC_P
  6535. @hook TARGET_ATOMIC_ALIGN_FOR_MODE
  6536. @hook TARGET_ATOMIC_ASSIGN_EXPAND_FENV
  6537. @hook TARGET_RECORD_OFFLOAD_SYMBOL
  6538. @hook TARGET_OFFLOAD_OPTIONS
  6539. @defmac TARGET_SUPPORTS_WIDE_INT
  6540. On older ports, large integers are stored in @code{CONST_DOUBLE} rtl
  6541. objects. Newer ports define @code{TARGET_SUPPORTS_WIDE_INT} to be nonzero
  6542. to indicate that large integers are stored in
  6543. @code{CONST_WIDE_INT} rtl objects. The @code{CONST_WIDE_INT} allows
  6544. very large integer constants to be represented. @code{CONST_DOUBLE}
  6545. is limited to twice the size of the host's @code{HOST_WIDE_INT}
  6546. representation.
  6547. Converting a port mostly requires looking for the places where
  6548. @code{CONST_DOUBLE}s are used with @code{VOIDmode} and replacing that
  6549. code with code that accesses @code{CONST_WIDE_INT}s. @samp{"grep -i
  6550. const_double"} at the port level gets you to 95% of the changes that
  6551. need to be made. There are a few places that require a deeper look.
  6552. @itemize @bullet
  6553. @item
  6554. There is no equivalent to @code{hval} and @code{lval} for
  6555. @code{CONST_WIDE_INT}s. This would be difficult to express in the md
  6556. language since there are a variable number of elements.
  6557. Most ports only check that @code{hval} is either 0 or -1 to see if the
  6558. value is small. As mentioned above, this will no longer be necessary
  6559. since small constants are always @code{CONST_INT}. Of course there
  6560. are still a few exceptions, the alpha's constraint used by the zap
  6561. instruction certainly requires careful examination by C code.
  6562. However, all the current code does is pass the hval and lval to C
  6563. code, so evolving the c code to look at the @code{CONST_WIDE_INT} is
  6564. not really a large change.
  6565. @item
  6566. Because there is no standard template that ports use to materialize
  6567. constants, there is likely to be some futzing that is unique to each
  6568. port in this code.
  6569. @item
  6570. The rtx costs may have to be adjusted to properly account for larger
  6571. constants that are represented as @code{CONST_WIDE_INT}.
  6572. @end itemize
  6573. All and all it does not take long to convert ports that the
  6574. maintainer is familiar with.
  6575. @end defmac