Professional Documents
Culture Documents
.• .'
.,
Rlcha~d L. Slt~~
D.1n~~l ft. h~l<l ~$
•
7~.J.'S - 029
J iltluary, 1<;19
Departm ent of
•
APPLIED PHYSICS
and
INFORMATION SCIENCE
.'
,.
This dOCUD e" t .,uper"ed., the e.rller C5-029 dOCUDent da ted Octobe~,
1976. No GI.jo r ehan,e .. t>;Iv<: bun .. .cit. but ~e t Y?O correct i ons and
dlfln1tl c nd re{1neroent .. h ... e be .. n a dde<l. ChJln,~" a tl,,',. ttun ty ~ ~re
Olarked with vertic.l bars In til t lurlln. If an enUre Se Ctl on 1s "tun,,,O.
the" the vertic il b ar only OIIrks t~" section headlnl. The ch,nllU ;o re
SUe,.,. ,r! :t ed bel o w.
.'
(
A Uo<ode pr OS"_ h re:>r ~".nt~d as , rile of CM.~"ctc .. s_ The rile Is
s,,_ , rft ed int o ll~es or tCI t. Ir~ elc~ line looks like In o .. dlr.f~ Y
uUOl=ly l. n s ~, e st~teQcnt. U-<>ode Is Intended t4 b y rc~ r esen t .d In
•
ASC!!, but other ch.r.c~er seU «WIldn!", it le.st
Gl i a S. 51n,1I qUelte , period • • nO:: b l ank wH I do .
•
•
Th er e are two d itter ent kinds of fi elds In • U-eod c l 1na : ( I ) rl , ld"
wtt h • s.~ .n tt c Interpretati on , . nd (2) f i eld s wh ieh .rc c~pl et.l y
",nln t e rp reted , c%c e pt for n lct ,utcl'l wit h .. ,, \11th .. n .ld on a no t he ,.
. .
li ne. The ti rst kind Dr ri d d in d ud u opeodes , lI ~ory_ and ".e. -typ e
des l ln.to '-5, .nd In t e,ers . Thes e flcl ds eonSlst only o f uppe r -ca. e
lette r s or dtg!t ", The seco" d ~l "J
\ " .. l U1lu "ha ... cte,. string" . 1IDel&,
Ind .. cencnt". Th.~ . fi elds cln usually conta in .n y c h a r a ct e .. I t I l l .
Th~' , ehar.eters outzide the ~pper _ ca ,e ASC I I ,e t May OCCY r only In
vnlnterpreted fhl(!s.
Line, of U-code are e x pect e d ~ be var labl e-le nsth ASCII . deliMited
oy <c r >. (If> . or (crlf> . or wna te~er oatc~e, t he definition o f IOLN I n
c th' .orre'p"r.ding Pued l... plftllen tatlon. rhe(!- len &t ~ ( bl~ n k _~dded)
l i nt' are pos, lbl e. bYt no con t ~n Latlon line conven t:on is su~ported.
Th e upper Oour.d on t he h nlth of I IJ -ccd e Hne t!lO ezsenthll y detRral.n...:l
by t he 51:e o f t he I . r ;:tst possible set or charlcter st r ln,. p i ", tno ,,;:h
charaeter s (or opc"de and del~1II1ter s. O.t IJCSO. IJ-code ~Ines are se;o.rat:<i!
by (e r > • • nd t ~.e lo n;: est pout ble U ne is 255 cnlr~cterz. A ll: l t of 1:'<3
cha r a cte r s 1!lO d efi ni t ely too ~1l1 for char~cter str~nBS and !lO e U. )
li' lthin ~ line, rldds . r t delimited b y one Or ,"O r e blanks. The UStL
Ch ld is first. (oHowd by the OFCOn. (ollo" ed by 'l'e ro o r .. ore OPE~AIIO
(le !ds . f o l!,,,.fl! by a COl'lH[M T rhld. n.. label fi ~ld ," u st ~tar t "I th th,
f 1rst charaet~r o f th~ lin e. 50 • ltn ~ starti n g with a blank hiS no l .be l
t!e l~ . for eaell 5~eeitlc o peed l, tiler ..... I fi xed n.."ber o f o per and5 .
so no ubisui ty UI5t5 about ho .. . any operand Ci~ld, to upo!ct.
follo wing th" ope r ancl5 . tllere is a camoent field " lIieh I , nplJ c !tly
relainej by dl U-code proce ssor •. Th i !lO field nt ends frOCl! t he
• deli:,.I :!ng bl anks on the left t o tnd-of-l1ne On tl'le riiht. Tl'lUl ,
cc~~e nt' c~n~o t cont ain le'd in, blan k!lO . bu~ t h.y ~a y contiin ~O . dd~
.' bl .n k . . The c=tnt rleld ), ;on " es cape v alve" f or Fass ins txtra
unlr.t .r ;:r e t e d Infor"''' tl on I n t tl .. ij-co<:e.
d~T '
(1) pr oc..aun n~ e, {nQtt : In th; , p~p.,r,
q u~ l;fl e~l. (~l v ;trhO le n ~"' u In the SY~b ,, 1 table !nstruc:lon , an<l {3J
the tir ;e t s o f J=~ I nstruc ti ons. utel" hue g lobsl scope ( .. it:"l t ~.e
• possl bh nee I'll"" of 51:1 l~bd. ). SO tile J L1:IP hr,e~ " AI" and the
pr oc~ur e n.III " "A I " are not both .llo~" In th e l ao e progr . ... ~n
par:l" u1 ... , J~ P ta r g.ts must be unique over an .nt: ... U_ code pro§r~, not
• J~t .ntl1in nell procf;f .... e •
The opcode rleld consists of 1__ characters , .nd must con tain UPP E~
ease letters or digits only.
The ce...,;.~ t rt.ld " lIS d escri b ed .bov e. r f pr esent. I t "~y e:," : lI~ ~ .
any char.eters at .11 .
.'
tt. S~que net of Llne~
Ir.fo ,.~'tlon ...ner e v er conveni ent . • nd an opti"!:er Is free t o .. ave ~ll 5ue~
Withi" the cede body o f a procedure, bet~'een the PSTfts and the PlOts.
Instruct!ons .. ay O<:"ur In al..ost ,ny order. so lor., ~ s oper,nds pushe<l on
tht na<:k .... tch Ueir ope r ato rs, 'n~ so toni!, as The S,lel; I S fJ1I'TT AT EAC~
JUMP . This llcpliu tha t the st~k :IIust .130 be ""pt Y at eac h label. jus t
before In !'ST (IIir ~ sU<:k J lnnructl on, just .fbr the PSTRs, and just
befo ~. the PLODs. The stack "'1st also neur un<l erno ". Thus . • • tr aia~t
line piec e cf eO~e ( ba.le block) al""y. be,~o. and ff".i!$ vl th an ,"",pt"/
~tac ~. but "' Y lI"ve ar~itra"Y .tack .... nipuhtion5 ,,!thi n it. inclvd :ni a
nor._~p ty stack 2r ter 2 ~tore . Us e o r the CUP in~ t ryctjon and other
"
op t ,=i;at ~"n~ ",ay have t he effect or ~ut~:~& ," O~e ent, iu on t~e ~tu~
'.
. .'-
.....=..-.,-,,:."- .
-- I!! . Tho U_"'Do! ~ Ha ct.1n~
• aM addl ...r; tht<'l, but It doe. not upl1c1tly re~r~Hnt !.plt".,\ul!on t!',.
of non_local addressing. So .11 ~anlpulatlon of possible displ ay
registers, , t a t ic link., etc. \, under the COver. and "annot be directly
optimized at the U-code level. If done at all. It ..u. t b. done In " .
l1clted ~y by the "Translator' fro= U_cod e to •• ehln. languaGe.
IIl . A. ~ Elore.,lon ~.
The np,e.,len stack Is used f O,. th. evduati on Of III n;ores,, !olls.
It ",un be "'pty at j=p point". 11'1 .. any t",pl~tnt3t!on". It ...111 be an
uttn,{on of th e run_tl ... SUck o f activation reco~d", but this Is
nei th.r up~cted ner r tquirK. lr. thh p.por, the ttn:l "stack" 1JIll
al"ays .. un "uvession sUck" , ~il e the t er .. "r u"-tc<:'l' stack " will be
und t o r efer t o t),.
s Uc~ of act1viiUon records.
(
It.",,, of different datu,.p.s .. ay ~e pu~h.d c" ~o t~. s~ ac k. t~~
op"c anc and dUaty!>"s ,"ust al"a Y5 "lteh in :!l.e U_ c od e . so the
ope~atcr
I",ph",. ~t ation of the stack nHd IlQt \nc lrJd e ta, s. rt Is poulb:'o for
vor,. larE. It ... ,. such Is .n entire re eor~. to be ~u"n~ ontO the s : a c k .
IHhou,h ...... y IJ-<:Od e ,enerators ... 11 try to av oid t~ls by pushbl
addr.ss., instead and usi~... Indirect !n'trucHons such as i'tOV ( .. ov e).
Part o r the .. otivation behind the "empty ~tack ~t a Ju:p" ~nd ~'S;R"
to .,atch pa r.".tus" lc1us ~s th~t the st i ck .,ay t> ~ l..,pleote nte<l I n •
variety of ~rd ~' l re re,hhr~. ror ~;.. .,ple, on an IBI1 310 . the ~tlck lillY
be ~~rtly in the g . n . ~al P""JIO"" re,iste~3 (CP R3), p~rtly in the nOiLin,
point nglsttr3 ( FP~s) •• nd partl y in .. ain ...... cry. IJncl. r these
c lr c ~~st.nces. if the stack cont~ln3 3 objects . but their dati typ es are
nct \<no ...". the n It Is 1<:~u lb lf t~ t ell i f the first cbject is I n ~ GP~
or i n FPI. If th e:e th~~~ cbjec : 3 are to be le rt e n t~. s t i ck ac ro sS ..
J""I'. tht d atlty ~ e ' or all three ob jec ts must be df'~db'd at tile label
"h ie!! Is the j,-",,~ t a r .. e ~. ~o i tr3n sla tor cs n flQur e out "h lC~ rc, is t er,
oro I n ~st at :~. It ls ~eL Th;s is ~,slblf. but ...1< .., , : (o r j~-::s. ror
~ r:c~~ce call~, tt.' nack h nec~ss.r':7 use<:! to 1'1S3 p.r ..... urs. 30
eu c,l y t~e u~uc~ ce of d.tatypes on tne st ack 1s " e~ ~ .~ a t t.~. t ,"r~H
( psn,
,
-,' _.... ., ~ .-- .. .. -. . .... 7.-
tI r. The U_e od e )bc lline
Jter a ~e ar~u 1 1\(le~endeMt o f !IC:> other . A 'Ub-3~ ~i "a t j,on 'feo r:! is
<I,.~~::at~ by t"-e p<lir ( " e!lor1 type, ~lcck n\:fl~.") . ... here m,..,ory t :t~ e is
~"",eec.
IiI. Th. U-coc. M, chlr.~
( ... ce~t fer c=on blockS ~n<I h ~ap tlo~k', ~~ u;l l~!ne-:l IH~r ) . H Q~t
cc;mpller~ ns' ~n unl""e """,,~O!'r3 to U~II prOC~dure. but not ,,11 P_ c(>d e
progr=3 ha ..... t ht~t n..,b"rs r~cQrd~ j~ CQn .... n:.~nt plac~~. CQnsi<l~r ~I'.'
~r Qc.du re str uctu r~ 3h<>~-n below'
d!~t~nc~ P-eace epcQd es in ~any in"le=~tat lons (LCO .S. LOO. Sft~ ~5.
SiRl . r e r t.'"pu r pcs", er opt:",l,;n;cn. it Is .. ere ~ .. ~r:4nt thH c.aCh .
~ped fle dau object '~Y'-1l.ere In , ?r~&~' " hHC , .... ~" l.: ! ~a::Ie. ~O 1~ t~.e
U_~od. statIc ~eHlnii levels an not use-:!. ar.d un!""" bloc k nl.Cl!>~rs . r e.
It ~ U-eodc preST"'" centains :.=. ccn:oon bloc k3, they can be ;:!ve"
n_.S just ~~kc ether s~b_.ct~ v~t! ~n r eoords ~y e~.es;f.i 3=e .. emory ty~e.
say F (rO" f"e~lrar. ~C<:".," ~nl, rer ~C"'"C~ blecks. and usign ~ .~. ,a~!:
n3m edfb!an~ ceo,.""n bloc~ 3 uni"Uf ,lock "=ber. T!:u~. if cc=on b~ock
r~R!-:l.~ !~ as~';;~"d un1:'~c ~lCCI( n=~e- 99. r"rcr'".~~s tc y~r~a01CS in
rH~t~ ,.. :!! u:::" t ~e ~air <;.~~~ . In a si " t!lr ..... y. ',ar;CU$ r~cc r~ t1~u
~ ~ ~!l .. t.up "'~y ~~ ~s sl~" ed ~~lr~ (S.:;;>. (H.97>. t~c. !t... usf er t~.eSf
hnp t1~es ~Q re!ol"~ ~~.f 'ld~ cffec~z or p",' ''t ef - !~~r~~c.s ·. E! bt
d:,cusse<l In .. e r e cctaH ;n section !'J.i;.
..
O r~$et Ind lo" ~ t!l. b ut typ ic all y t::e~~ ... ill h \lOrd s , bytes. or b i t ~. Tr. ..
.. !fut is urc:--orlSln [ .(111 tr.e front o f t he ",,,:,,,"y blOCk. T ~.e h r."ll> o f
• no..::.~ daa obJKt .. ""t be 8r .ater t~.3l'l ~ .. ro: n ro Is reser 'Jr- t o me;"
~unk"o"", hngth", 110 bound ar, .11:;;r:::Ien~ '>r obJe~t patr!n, Is lnher .,, : In
tho U-ccx:e. dtho ... ,h.
sOClle 1.IIplfllenut ions .. ay ,enerata code in ...nit" i ll
obJecu a r e appr oprUte ly dl,ned.
I hnlth of zero lIIe ans ~ unkr.o " n·, "Id "hue th~ .. ""ory tn'• • no .
\llIe n
b1~k nuo~er ~ay rer.r to ~r t or .n ~ctlv~tion record. ~ C~~O n ~lock. or
a hnp r eeorcclns. heh obj~ot luis a uni,<o.:e n!",~ . ,~ this n""e is the
only one used to refe r to that object.
!n &en er,l. two Objects OIJY r efer to ov, r l~pping Storage. For
o eu~ ple . RECA .,.y
be. recor4 co~ tain1r., oX ar.~ R'!. \(nih t~. e ob j ects n:
and ~ r do not overlap. t t:e cbJec~ R(C~ ou r laps beth of th.:>. ~~se. H
RrCl co nains -arhn t subflelds Rll Jo4 RZ:;, rd unces t.O t~.e~e .. ay
C'Otrl.p lien other. ihlS Is al l ea;>tured b1 the appropri Ue offse tS .nc
hnsth S . which Ire crl&indly o a lculn .. d by t t .• cC'IIpiltr U It ;u~s
s,crage.
P.~CA
R!:!. L:
~[CC R D
,
( 0 AS!lIl:-l[
IlIi[G~ a ;
• s o)
,
Varia b le U_c od~
,•
na.~e
•
aEC':' "" "" "• "
1\ ~5
8
"
(lIot, : this r epres~nlatton ""'1\ .
"
not completely una...b11UOIIS
b.c~us, of reCllrslon • • ui tl ph .ct lv a tlo n re cords ulst to' <0, .~,
pr o cedure, and a v lrlabl~ nalll e frCUI an old actlv.tlo n ree<>rd 15 passed
n • reference par_ete. t o a pl!c~ wh ich us ~s tnt sarllt n ..". to r e f e r to a
ne ..... r act ivation record. Th e Opti:nher nandhs this I=billll~y In I
c ons ervat i ve way.)
So 10n; as the s tat ic nestlnl struc t ur e o f prec edures h kno ...". ther~
Is In obvious za pp ing betw~en unique bl oc k n~bers and stat!c nesting
lev ~ls (s e~ the ltl Instr uc t ion In s tet Ion V),
"""e SOI all r~l:".d.nc y bet" een daU ! ]!,c and lengt:. o f ~he ctlJtc t, byt th ts
! I!. The IJ-cod~ I'.;ocnlne Pa ~ e 10
u~e onl y a .Ing!e dnatype. I . ""l1e anOth.r :",pl e.. entatlon ..tllch "'''5 t
actuallY ,e ne r ote co~~ to co n.e r t bet"cen !er~~n.J ( s uch a. la~ ;70 .hor~
• at:d l ong n onln , p;> ,: nt l . . , u.e dlHerent oat a types fnr the vlrieus
hr",th~ . Th ere 13 no t a preferlOCl fo~ In the U-code d.eflnltlon.
The U--rn ;oc htne n"s varl .. ". sUe k-orlenud Instr uction" wh ich are
de~crlbal in d~t~1l In s.ct.lon V. ro~ the tic '" 1I~ln&. t he only poi nt to
be .,I'de Is that tMese Instructions rall Into five bro ad cla ~ses. depe ndh:,
on t heir .r r ec ~ on the V_achlne . Then cl:;s~e5 are:
(1) Jump In. !ructlon ~ • ..tll c h dter tt.e flo " o r control.
(2) Cill I~st~uctlons. whlcb .Iter botM th flo ll or control and the
dlt. ~n.lro"'"tnt.
(3 ) lo~d/Store ln~ t r uctlon$ . .. hich aCC e SS data In ~em cr y .
•
(l ) Stack : ~ struc~ic~., " hlen o::CX:!fy the sue k but non.i~.. else.
(5) Table instruc!!ons. ,""I".len il "/e st~tjc info~.tlor. . bout a
proctd"rt.
•
,
•
h ; t 11
-
IV.'. I'roced .... e Calls.
• U-code proc.d .... e elll Is done by the sequ.nce HST <.,ark sntld.
pus h par .... ter •. call, USe result •. f~r~eter. and results are both
passed on the .tac k. "The HST :lust be don " '11t h an ""'pt y sta c k . Each '
expression which c~lcul~te. a p.r .. eter .,ay optIcnally be roll o l<"" by the
PU 'p,or ~et lr) unary o~ra:or. TIM call~ proc edure .,,,st return ( 1. •• i t
mus t not I%ecute a COTD ou t of Its prccldure body ) .
It is expli ci tly lnUMed that t~e O~t~c !:er wiE c!lan ge SCI"" cal: _ b ~_
r ef~rence par = tter~ t o c all_ by_va!ue_ re, ult. The two are e <:u!vl ~tn t ~ !"
th e re (e r enc. p"r~ f ur t. not ,Iso a C<' e.Std by 'n o t~.tr naJII I i : .t. I S •
.Jl o~al var h bl.e __ pr ~no,t.ber par_ehrl. Co nvertin. to val ue_re~ ult ca n ~ut
do,," On \.ht nll:lber o( object . requ i red t o be In fuln ",,,,,, cr y. In, t ..<1 0;'
•
r eg isttr s. The U-code Imp l ication of .1 1 t~i5 \5 t ha t there ~'Y ~e ~ orf
than ont fLO!) t o re turn ul~es It the end of a proctd\ll'" The .tick
.a t c hing 1. done e • • c ~ly l i ke th e pa ramet t r s.
c.,.,~n ~~ I.I -~o~e ~(;~ l:.e GS~ ~l" ~ .,,,e~ ~ ~ 1;> I~i),l y ;~cl~e ~ .,,:"10 r~r.;.
~~. "" ~ tr. ;. bet",.. t t.e f:n al X~P ins trJc t:"" . To en a" le tr.e Opt~I~~ r t o
• r e":O'a redu~~.n ~ c" ~" k ~ "., !t :s .. ~ar"e~ ~~ C>'n ~h e XJP Itse lf l~ U-co~e .
n .• U-cc~e XJ? don onl y I ",u: : ;-" iH br ~ n c~ . u : ;r.; ~ u,."-or: ,,ir. i~dU on
..
•
The t.o t>;'~ of UJ?, tued ~y .n IJ1' i.s p.-~c""~ by .. ruB (c~"e l .a:>d)
l n~~r",ctl"n In.sLe;ol of t he u.s",1 UB. Thl~ allo"" an U~lIdl c" .. nt of
-
IV.C. Che<:k I nstruc t ion.s.
Th. CHK Instr uction or tar!itr P-codt ' hi.s betn br oke n Into t~
Instr",ctl o~" I n U_c~e: CHKH (ch Kk Min) , and Ol KL tcheek lo .. l. !hl.s
allows lht Opt ill h ... to ...,"ave one or both c h,c k. it the y are .114Y.s tr ue .
A.s ori g inally dul,n~, CHK did .sub,cd pt_ rar.," ,, ~ .c k lnl (or rind-bound.s
.rray.s . ilI!.s No.s b un ex t en(!ed to cheek for nil poin ~ e r s , to che ek slz""
of ~. ·. S. and l r;> c t.tek tag fl~lds In v arllnt r ~eord~ . If a Jusuble-~o u~~ $
Inays ' re f"t" Introdu~~d. CHI{ u lll h;1ve t" bt u:."de~ fur th er.
I t is Im~or~.nt th .. t C~I{ nct be re~l .. e,"" with ncr::oal c=p .rl ~oru ;I •. d
J,,"pl . because such cons~ructs do !\;It hoo ". t~. e p ro~~ r eIII;>hasl~ tt:;lt th.
vs: ~ not fan. In pJrttcul;lr , t he Optbl:.r I~ t r ee t r;> ::lOVe ;1 c:,);
r;>ut r;>f .. loop If it Cln dH.""'in. t .u t c~.eclt:in s out .sl~. t~,. loop " H I
lntreduc~ no t.",i .n at ions " hlch would not . h". h .. ppen~ .. n,. ..... y (I •• , in
FOR ;:: ~1 tr;> N CO A(l] : ~ 0; the ran i ' check on I Dill'll as " d l be done
befc r ~ the l oo p: i f N h t oo lar&e. the unoptl. olzt<l .prO&.aoI would dlt ~ oon
t no"s h In yw .. y). But the Opti., la r I s I\Q t (r ee t.o :oo... e arbitrary
c or,dl ti o n il j<=ps ou ts ide of loo P'"
.. .....--
- - ---
IV . Special Topic s
U-cod c ln3tr u<: e:O"~ ""Y rer~r t o nc~_l cc~ l urUOle~ Oy J"st ".!,,~
• tke appro pri aU un tq..,. ac:lvn!on re co rd n=~er. It h u;> t o t~e
Tr an slat or to sup;> l1 ~~dres 3 101 1!ty for ~uch r . h' l ~cIs. Typi cally , th:s
will be don~ "'Ith sca, 30r ~ of d ispla y ... ec~.a l'li.s:o., b"t all such
• a l n~p"lat!ons ar e Inv i s ib le it the U-cod c . A stvtre con sc q"tnct oT this
Is t h~t the us. o f dls;>l a 1 po i nter. c anl'lot be o ptl ... l1ed at t he U_Codt
l evel, dthouSh the Opti .. 1ter _ i,ht supply to the Translato r I list o f
those Slobd .dd ressll1i levels .. hich I r l heutIy usod In I proctdure .
this i s stt l l an open probl.m. ..
Constant address arH~.... ul., cay have the sld e_eCfe c t t ha t the offset
I~ .n LOA l nstr"c tl o~ b teCCes neSltlve. Consider. r"r ex .. ple . the array
A[I,. 10) aliccHed It ofrS ft O. A fetch o f A( K ] ""'uld IlenlaHy Ip pe ~r In
u_c ,,~ e as:
Cf.Y.L
CHKE , ( chec~
(eh c~k
10". in t e g er)
h! &-. • :"te~er)
" 1
'"
I NO , ,
lU
( ::~ke
("~~r e ss
1 :t-" -od&:n )
" ~(!:!J
{;,{K]: or.e-"crd Sea l :
--
IV. Spee l~l Topi'a
• co. , -,
,
co, , ,, " "
("l nud ortiln or A( all
CHin.
, " " '"
{He .l
,<. , ," ,
e ll;:11
INO
•
Thi~ M, .. Uve ofh~t "il l il"'y~ ~n u lt In I ""n-n~IIt1"e offset a"fte~ t ~e
ad<ir'S3 a~tthmette . but there aU3t be a ,r"e!ful >qy fOI"" •• ch
imple .. enUti o n t.o t.oh~at. neg" Uve offsets. !lote ah.o that the LDA nO
l onger eor~."tly 4.s e~tbe", th~ dlta area whl e h Is potentl,lly used I n the
INO l n str uetl on: t o " .... er thi s <i:>ut>le duty o f sp. elrylni par t Of ,n
address e.lc ul" tl on and .lso 3pe~lry lr. , the dat~ a rf fc t e~. w~ ~uSt spil t
up the ruponslbll1t1u "bi t . In thi s ease. the ..,b1. g uU y en h@
rfso lv~ by Insert:,." • . 00.1. (dat . obj.et .r r.e t e d l Instr ue ti"n:
H 26 _1 0
'"
"'.
U>O ...
11 2ti a 10
Th. 001. Instr uc: t ~on h f urt".,. nph\ned at t ", ~nd of this sec tion.
(
IV.f. S-mbol Tab!e .
The U-eed e S·t:1 ~nstruct:on dce s no Ul in& <r.ore t~an ,ssoeiate its lab,,1
fl~ !d (pr,St.:..,.bly plr~ of a J.Ourcc vari able n"",') " Ilh ; 4'1t. ob; e~~
'!u'n tup le. consis t ing or diUt"!pe. :l e::lo rytyp •. bleclc n""D,r, or~set •• r.~
ler-i th . Any Ito r age re_.pping done by uie Opt blu r .. Ill also r ..... _1' t~.
ope ra ndS of the ·Sft1 !hstruction. lIot. t hat "ultll'l~ SYl'! In~truc:tl c ns
could have tM ~arn e a<!dress bu t ,""."IDl y dlffer,nt d·at~typ. ~ "aM n ;I
variant r.eo r~ .
To n ode l po~n ~ e r ~ ~n~ ~u!at lon'-oore acc u~ ate11, the U-code Yn IC~ ,.
ln~ut t o t h~ Opt! .. ~ ur ,"ust illd ud. ~croe ._ 1 o~ 3p eclfyl.,. th~ recc ~ 1
LO' AJoI2612
,, ,. '" R[C~)
I
""
'"
H 99 0 10 (hnSth 10,hnKth o f
'"
(~edi f !.~ a ~ !,!!eiJl loe ~t~o n H O~ ~ I)
A
""
~ tor' Into 0:. 1 ~U ld .ffec t , di fferen~ ~ rtj!l ci l l obje ct (K ga • 11, $<:.
It will be clu r to the opt~"iar ~t.olt ~ st:re Into one nud ne t :..::,1 ,
c"""on s u bupre3s1en ~~ vohl nB t toe en.e ~.
The s e art , rtelal .. eo.o~y arus (..tIl ch ore rully .qulv a l ence classes
r .presentlr~ ALL re cord3 of type REC~. IIECS . etc . ) . 130 liv" us t~e n e .e,~
.. ec~an 15" t.o ~eecrd the side eHee:s of ~ Pl" OcMu~ e c. ll \/h en t!:a t
~ ~ oee<lur. u s~M$'U scm.. o f t h. r.~o~ds In the h".p . The , ... e "' rchanl.",
can be used to de sc ~ lb. ae~ .. ss to <:.=on bloc~3 acrO ~3 fort,- "n suo ~ oc :: "e
c.J,ls .
is cr e a l l!<! .In t ~.e edl "" ~ r o".dure. ~ny a ~3!g ,.,."nt using lhl" r"re~~~ ~ ..
par 300e lC r ,"u3" be "",,=ed b7 th. Optimize. t o bll . 11 upr t""ion,
Ir.voldng ft e ld$ ot ~ r ecord, unleu c~n rul in fo ,.", ~ tlon b ~ t Pt.
Thl3 Is sufficitn t ly unfor tun He tha t tht Opti",I:;"r \lill at l"nt k" e? on ..
bi t \IlIlch ny! "no r .,., oN:! n,,!d \ s p a ~" e-j as a re(" r"n c e p a r .ru :e,. .-
•
In o pt l .. 1ted cod e, 1t \1111 of Un b e the c as e t ha t the nlue o r 3OI.'Ie
c =o n s ub u pr e"l on needS to I:'t be , eve<! for h t e. rt u se vlthout
dl,t ur b l ng tI:t current u'e o f that iJUb upr usion . In t hi s c::t rc .... ' hnc e.
the NSTR ( no n_de s tr uc tive ,tor t ) in st r ucti on wil l be , e ncrated t o copy the
lOP of $t"c k ul ue to so=e .,,,,,, or y 10000a ti on wUhou t po ooln& I t or r l ~
st ~k . l ate r , . norna l LOO wil l [ e t ch t he value f or re- u~e.
The.e a r e two ".Jor e se , o' val v e' In the U-code. de~!n !t lo:!. both
in t e nded t o allo ll V .e in t rc:4u"tion of n~ " Idea .. in U-code w i~~ut
r eGulrln g "" Jor re_wo r k of .~is t l n g pr oc" .... o r ...
I hl fl r~ t escape valv e I ~ ttl" UN/: ( un kno \ln) Inn ructt on . Aerer rin,
ba" k to t he I nst r uc t io n cl, .... " .. In .. ec t i on III .E., UH K Is a stack
o perater. "Ith no flo", or control .. jde- erhe ~ .. I r.d no (Pasc a l) ,..,,",ory
leeeSS. The '''0 ope rands o r UNK spec if y the n=be r or ope rsr.d5 pOHe'!
o rr t he .uc ..... nd the n,..,b" . of re.u ! ts PUS".1!"l b.ek on . n .c I~tfntion
h th3t any ne .. binar y o r ~n l ry ,Uck o pen:or c~n b" descr~~ e~ i n u_c:x: "
.~ ~n UNK \l i t ~ t~~ ;;~~ro~rl~a Q~ . rlr.ds. ~ ".c ~~.e re~l opecat<:r ~u ~ !" t".e
,O<"..<:: ent 3 fiel~. U:H( i3 :nen p~~;,e th rOU;j.h L"I !~tu;;reu d (a n ~ !lC> t u3ed IS
a e"",:,en .. ~bu pr es~i,") by th" Op t \ai:e ~.
I
Tl:c ,e~,r,~ .. ~c~~, Is tr.• e" "",,,,,:,· ~i e!d of ,.eh u _"e: e
'~ lve
in str," c t: cn. ~ny n<:~·~ t ~n4ard oper~~' us«l ~ , , par ~leul~r 1<I ? I ..:a~!a~ !o~
·.
n."
1" .. behind [XlA Is to add It t o ttl. cod e """never .n ad~r.• ~~jn,
u pre3s101l Is uob!guous and lIIore In fo'''Iutlon Is In (act k nolJl\ , Ttl ..
e =pH er "oul d l"ner a U roll to duerlbe dtfhrent rt<: ord t ypes In
pointer .... nlpuht!ol'l. n .• OpUCI\ur eoul d " ""raU DOAs to desed,be the
actual array when subsc r ipt b.se a<!dre~~in, b chang<'<i . or .men i
,ubscrlpt calculation \nsid" I l oop b entirely r~p hc <"<! with a poi:l ter t e>
the ua<;t data Item (st r en,t h r~duettonl. The Opti .. ln r covld al s o
,enerate OOAs to desc ribe aliases: fo r u"'II~le . to descri be t~.at • store
enc~l'ass 1 r.g two .rray! " Ill keep th~ to,el her • • 1tho us h they ~ay be
~oved to • ~itrer~n t pla ~ e In the ae.or y hler.rchy.
iI'. ~
!:,;P C ~"a~) ir.:~ru~~:cn b l:'Iter.~e~ ' ''::'111 for u;re.u~ g rev"rn
.ubtraction a"': rever:e div i.s!on , bu t 1~ can ocCur In any Q t~ er con~u:
al~o, To r..cuc~ tt.e ;tac~ ~etgh: "" e;:ed :n .. ~r~"lon evalu~tlon , !h.
C;;!::::i:er ,;ill I061c." ~y char-ge
•
• (e' c ) ~_ ...
u" ,• u" c ,
u" co, •
co, c
'" '"
u" •
."
'"' '"'
• n suck hel'ht • 3
----
.n "t ~e k l':el811t • ,
l\lp. SUB uqll elK ~ st.o w rn<! r~ ~ ,ubtractlon. Till" ",.","" •
If ,, ~~
'"
,~
better tunln, ~h an Int ,. cduc l. r.~ ~ e u r 5t ( ., ,.,,.,. o f ill binuy operator". The
O;>tll'llur ~ 'Y ,,""rate S"oI? befo re c=utattv. o~r.tor·". or In par ..,eter
lht " . Fo r c (ml:1l1uthe operators. tM~ u o lds the Optl .. her 1ow"1,,,
euct!y " hl eh b l nu y op er ators .... e c =utative (IIIO t iv . tlon : rlon!n&;- pa l r.t
.",ltl p lyon the tr a y- I I s no t N;nr.ut 4 t l ve ). In ,ene,.. l. • Tr ' ~"lat o r
s ho uld ~ g"n e rau any c od e fo r S''''?; inst u d, 1t s hou ld Jus t
, ' cte rchanll t th e o per a"o. of t he corres po nd I " , nu t o per a ~ o r.
l
-- - -
IV . L. Po s itl" , 01'1 a nd liCO.
I n ver s ion ( 0, 1] o f :I>i " <lee ",""": , po s~ t~·/e _ o ~~r .ar.d _ on!7 fe r.1S of
DIV. 1100. aM ~ O (dl v.... od ) "e n lr.clu~ e<I . so th a t . r,. . n. h t o; " "ui d
, .ner . t~ b . t ~ ec "ode. In par t i c ~lar. gn a two ' s-c om~l~tnt ... ~ ~i~,.
-7/100 a .. ay ,he - 3 IIII.n c dcul it <'<l via • dhillon . and 1 ..h.n Ci lc ullt.d
vi a l ~ 01 n6 gf ~ I II tilt the tllO low-or der b i t s . Un fort un. te l y. th .. PIS ".!
d~ r ~n l tjon dotS not s ptci fy t h. t In ~t,.r di vi s ion mll Sl tr unc a l . to wl rd
.. In" , infi nHy. thus d i olling t r:. - 1 r~su l t! Wors t ye t . s ""' ~
~p h .... nt ltic ns r ec'J lr~ t!lat - 3 be live n . 1 hi~ tH fC tiv el y pr t clud ts
us in g AND for 11)0 b y I po..., r of t wo . and usln, SHI FTHGHT f or OIY by ..
po .. . r o f t '-'O. OI VP. I!COP . and i::f :JP !Jfr t an .tt ..:np t t o "Ikf it usy re r
t he T ran s l ~ t Q r to Ust AHD ar.d S!! IFiiUGiU ,"'t n t:.~ OP"r3n,U were .11
pos i t:·, ~.
Fo,. ucr. ...... o r )' t ~ pe. the .. In"....." .. H~cltion p.. ~";:e!er !ivo. t~.e
( ", 1::::0<=1 "u",b.r ot .torlg. unit. to o • • llcc'~'d ~t on"~ . HI l1!o<:at~~
variables 11\.11 have otrse~. that Ice ::.ult:pl •• of n.!' Xloun t C.nd l'~ne.
will bt I ll in.-;!).
The "u~"'u:I all&f,"'cnl ~.ra::l ett ,. live. the "' . . I::"•..." boundary IUge.::e::!
thH i" Int . ~ .st! ", t o the ~afl.n hard,.. re. \oIh en ',"d.bh" ' ''~
re.llo<:.ud . their l1!i!'"e~ t. U? t.c thi. nl,:lber, wi l l be pre'e!'ved.
"e:c, y) .
., len IIln .n
"
- (,Ineral purpose r~s "
--
IHIEf CO R
,
,Uoc aliin
,
, , --- ~ .- ---
J.eCUCS (~
. .rrays. r e<:or~s ...
(flOltins point re,,)
(dlrec~ .dd,..sH blel
P'l ocr
1
~ CEf 0 " , ,• •
, ""
(, • rr.ys)
J.IIC arreilI .oK L:WOI'QRSiU\-JX':'~
(".1 nl:l ,"",or yl HDE:f
•
1500000 0 ABCDHGii I ~"X!"~~IOPO~STUV'.lX'I' Z
u ","usloll ".IUlIt l"n lUck tOt. SI .. il.rly. Z " h ue I.rt (er the
Trlns htw. ,n" 256 bytu or the ~'C directly .ddrt'.nbl . . . e::>Or1 In an
..,tlvatlon ,. = 0, 01.
"
"
"
,
V. ~ l ~~ ~ b et l cal L t ~t of U-cod c In ~ tr uct j ons
,
!n 't r uc t io n N""~
- S
------------------.
A!lS Ot
------------
v.toe
Ab so l u~e T <- :T :
S ADO <It ~,
T <_T _l .T
S AN D T <_ ! _1 l,T
C
S
nillClle eCI{
' CiiKf'
""
B~ l ln
CheCk r. ln Ir T.r- he th.n pop
, "'K' ht,,,
du blow up
Ir T<=hb then ok
, dsa blow u p
S
' OIKl dt lb
CHIQI
' CHK1'
Check
Che ck
".
~<
Ch ec k t r Ve
,"
1r I b<. T t"hen ok
dse tll ow
Ir T<>n ll
d 3. b l o w ·
lr h~ .. ue t h en
"' th ~ n
"' "'"
..
,, m Ch a r .e ~er
du blnw
T <_ T "'
,,,
· cu.e
'''''''
c ount Cue t a bl e la bel
C""""en t
I count •
•"
en t r :e31
,,
' CS ,"
' eu?
' 0[.1.0 o~ bIlen
po ~
o~f
pu,1I
"".,c pop
,.,
. '"
Ci lL ,U nda r d pr oc
,, DI f
OJ'I
"
0\ r rC;" " C., . , c t $
01 v I ~e
TC-T- l
TC _ T_ l / T
,
' on o
" Di ~ / .. C'd TC- T-l /T . t hb
"". . '"
[..a o f pr OC M " ,. e
n.... · £JIT
" lh,e vel
,, ~
,, '"' f •• n jo.n;o
" ,.
,.,
dse
T=h1 5e t hen PO P,.<:=!;:>
~.
,,
'CO
FLT
Fl oat
noat ,, ,. ,. , !loa t IT-1l
fl oat{ T)
<- ,-,
,, '" "" ''"
'n
' ! [CU
I e;.
Cr C'ter Or
Grca t e r th,n
c ~u . l
, ,- n , ,.• In
T ,- T· , T
' Ie<:o " ''"
Ir><! l r c ct e qu a l _1 1
,,,
S ' Il';:~
• !L[ S "" ! en
1
en ! "cic ~ct le~s o r e ou ~l
l ~ ~ ! r ~ct l ~ ~~ thin
T
T ,.
<- (T - 1 J
(,,_11
"< IT)
IlIe
" ,of!..-- l .,n I~c.~~nt T <. T • o tf '"
,, ,,, •, <- n _1 )
• I ~I D
""
Indir~<:t I OA= IT · o f~ )
' 1:IE '~ :nC : r ~ c ~ n<;l~ ~qu~l <- (T 1
,, I~:;
:n, . l """.~t
In :n T <. T-:
•" ,T
"T
,
I~;
I C~
m h ,
!r. u cs .ctton ', Ut3
!,clus i v e 0'
I •• d e>
,, ,.,.,-
T ~ _1
i _\
T _1 • T Ole n
, ,
• J
,,
Ibl ' u.s
Lo> quote<! 3tr~na lD'~ constant acdress
{count. , o f br.n,,~cs
t o t.J'I.ls l.bell
T (. htrin,
,, LO ..
LOC
lit ~ll<n
dt Y.l~~
ctr len Load acldr~~s
L:>ad ConS t~nt
T (. '<<;u.<:1)
T ( ••• lut
, '"L£S dt len
dt l~n
LUI than or I<:ual
ttSI th an
1 <_;.I<OT
T(-';"-I(T
T ' L!X hve1 bl.:.m L~slcal lcY~l
T ' Ltv"[ at blkn of( :tn Ltv. variable ls) ,
"
, ""
LO'
0"<I t lit bl~n len
Lo<:ation
Lo~
(Orr.nlll "...,bu)
t <_ «quI<:!»
T len
' HDEF Dt .In IIU dtl l :st
,, Mu""...... dtf1n1tlo n
,, '"''
"" l.~
,~
!'oye In.Hr.-<:l
T (. T·' reoo T
(T -l) <- IT)
'"
"" "
Multipl y 1<-1-1 ' J
,,,
levo.1 Kirk stick
,~
Multipl e n t T <_ (T.l:.T)
, ""
.,.,
'" dt litn
IIt,n.
Hot eQu,1
T (. -T
T C·T.l0!
,, ." dt""
II, .. record
." T (. "'.ut'
T <- .,.
,, ' HSTR
CO,
~t blkn ott len Hon_ de s truct tve Slor.
'"
,,,
".", (- T, no
T (_ c<l<l(T)
~p
T '"
' OnN dt ofr
PAR c:t btl<:'! orr
Opt:ons
T (_ 1
l.n
" lit P.r~",ntr (:.o.y stor.
.~t!y.t:O" ~ecoc~.
!n~o c.....
,, '"SQ. dt
S!n,!non u t
S(I",ar"
j
1 (_
<- (1 1
r • 1
S1'O ,n. ott lion Store in<lirl!<:t (1-1o-cf(J <- T
,,,
m o~. Step pre!,. ...
'"
'" "
<It .t blkn off len Store
T n<l2lc ' Sn'. <It ",t bl~n off len S Y"'~ ol taCh
J
,, no
TJ>
'" True ju:lP
1runc.te
tf T. t"",.
d~.
1 <_
~op
tn,"dTl
t~.~~ ;:op. j=p
m 1 <_ T
,,,
• OJ, "'" 1yp". n.... <lat.t)?<'
Un~0'1odl tl on 31 ju:?
un Unton. 5etS T (_ 1 : 1
' U:;i( PCP push Unl<"""" oper,tor
J ' XJ? l~! T!lO". td j1.:'lp
•
C~e~."~ ~:
, ~l;"~ blocl< """ttt' Inu,~r ).1
COI.;nt
O~
'Cc3r.c::u t:>
~~ta: 1~t
.,.,
Ina,,,,.
. ),oJ
dt!~:: ~au l)"l:' 11~ t ll~t or ;ll l o"'f~ ~UJ t,·; • . r.o ~ e!l:l.tf~S.
ir.tt,tr
,
•• Alp~ .~ctleal Ll ~t or IJ-<:oe~ In~lru<:t1on~ Page 2J
".
.lll,""' .. "t
.,", alloc a tion
",,,,,,ory .-,
in tt~~r hO
na '"
'f<
n.", ,, of pro<:
orrnt
ch.rs
integer • •
' popped (,,"try) Inteler hO
'"
pU S!!
vilue
' pusheo (,.,turn)trlte,. " >00
data ulue int.,er. reh., u t ,quoted .trlng
lIote.:
• OHD (dlv/ .. odl r eturns both results rr OCl! • IIlY!,lo". The 1400 "du. h
on t~.e i.op of the $tack (o"Y be (ollowe<! by SW PI .
• LDe II 0 - Lo.d const .nt .l".y~ h'S ~ oper .nd3. for IHI. d .....,.""y
uro ope ra nd .oust M pr ...nt.
• A .. r.oory type of l Is u • .,d In LIVE. OCAO, and 000\ to 'ia"try ".11
IIft'1or y types " , Slmlh dy " :ero b lock " ... ber ",,, .ns " ,11 bloeks',
.nd a neg.tl ye blod: n1.JO>!::er _II .. uns ".11 b loc~ II".
• The """fit on • hbd dh," Tr .n.la t or. to tha t the n o ...
5t~""t ... ~e ts st .. ph: If th~re is euctly one branch to • hbel. In"
tM Tr.nslator hu sue~ • br.nch in Its buffe r. It I~ lu:arant ~ed
th~ t n.tr e are no .,ore '",CS In the rlow ,ra~h. J.. cOunt o f tero .. uns
· ...,I<no\lll" .
• OPT]I s~ec:ir1e5 one of 26 optior., A-l. ar.~ • nU::Iter usochte~ \11th
(
th at op t ~on . l ~ s use i~ net fur~~.• r "e!!ne~. but it ;5 I ntH~e~
for cat.CI:lllcatir,. OP:!C M to var io us U-eoae proce ssl~iI P'=ii~:a",s.
r
VI. O~~n Ou~.t! on~/I •• ue ••
•
Til. euc~ yu of LIVE ~nd D~A~. Ind tile n 11 e o f NX!'.z:I~'tI I<:. ti n&
proo:e<:ure . id~ etre<: ~ . will no t ~~ t1 ~ dc''''' IInt :l ve r.lcn (0 .)1 •
• pproli .. nely l~nl . l'1H .
.
'
.
I ' -'"l:i:";::'~-;::
Ap J) ~ nd h A. Stanfo r o - I P·~ode <__ > U-code
(
Stanford PAIL-1 P~~cal CO<! .. to UCSO On!v~-nl ?~sc .. 1 Code
Tr ... sr" ,,",3t ~on I>oc= ent
•
•
Onlv~rsl~y of California. S.n DI .. &o
C_Ol~
The tr.n~fo .... ation of Stan ford PA!l_3 fuel! Code (P...,od,,) to UC~D
Universal P3~c~1 Ccd" (U_c~de) can be ac~cc'li5r.e:l ~or t~.e :::ost ,.r: on a 1:1:1
by line basis. r<luUy. one ·....,")d lilee to ~:~as5.",bl" a ? -cod . t nst ...:ct ~ on
l~to scverd ' buckets' .nc then ,u","lIh a u-cod"" f",, truct ion frClll the
lnfo .... tlon conUlned in th ese ' buckets'. R"alL>t1cally , w,,";l1 need to
a"!pe nt these our 'b""ket5' with ~e special tr"p'5~ tabies ane: dgorl:r.';Is.
Tl',' t a ble that follows deerfb"s the gene~ al " ; ppl n& cf a P- codt lns t~ cut~on
In t o a U_ cede ins~r"c t~cn alon<l " ith 5~" dat C3~. co,u:~era tl on5 for "'1~~I~g
inforTO.tion,
,
~PP'"d 1>. •• SUl'IfOn:l_1 , .-cOOle (--> U -Co,'', h~. 2~
, '"' "" ,
CHK ~.lb . 1A.>
,"
CI!¥L
CHIG~
"' •
,
C!lR
'" ,
, '" ,;>roc: "" ,
sproe pus~
""
m t.:'I~r:ln . .. proc m bl ~no "proc push ~, flP"""(!
, '" t .off ,
""CET , ."
• hbd DE, lt~
[ ;ID
'.0
up • ...,
01; Di r
OV! DI 'I ,
,
'"or. '" ,
~ uproc t.l ... . ds.ld.l.t.d \/proc E~T
L!:X ,
,
hvel b:kno
bl~
push pop pl,u
..
I>l~
...
PSi3 , • blkno orr "0
'5TH
...
blkno orr "0
, EQU t.ltn
'" ,, "0
(od !ECU "0
en
'"
'LO
h~.l
, to
l~od
Fl. _.
r' '''
, ,-. " . : en
<- c<:~ , Ie"
(or! !et: ~ t
"0
- -.
. . . -.
.'
•• St.nrord_1
..
"' ~p~nd l ~ P- eMe ( ._- ) U-~Od~
n
,
P .~~
• (;. 7 t • l ~n CiT ,, ,
Cod IG"T ,,"
IIIC t ,off ,
, '"011 l en
I!lC
• ! ~l 0
I:i~
t , ofr
- j:tl D
r:1 ~
- In I:fT •
,0< ".
III 011 IU 011
T
label '-',
'-'0 011
CO, ~tr1ng
i _bel '-"
CO.
0
• , 011 , ..
CO< "trlns
T CO, In , o f! CO,
T ,I< I I<
° b)kn o
'" l~"
T UIlI t .o l f , • , oU hn
""
LEe , ltn
5
'" t.l~"
(or ) IL~Q, hr-
, lES t. le" lOS , I,"
,
( or) rL~S I,"
IOC 011
T 1.00 t . h~ ,o tr
'" , •
"0
011
'"
, .. "0
"" ,I,"
"" '"pr
"" 11
•
r~si1..r~siz .
," '" le •.
'" ,levd rc~;z.r::> $I !
( or ) rnD ,
"EO t.J en len
II! ':
• ,'"
11(',1 ,~
!It..' len
IIG; N ~'::; •
SG, :1 ( (0 , l
)10 . :101
. App~r.dix ,. Sta~ f e r C _ l P -COl)<! e <---} U-<I)<!~
PJ'~ 2S
( 000 000
0"'
, '"' ,
'" , '" ,
• '" "-" II bl~"o ef~ lfn
"- on .
• ,
'" UNJI;
, ,""
,
• .--
~- S.U':--. ~
"" • '" 'n
.;
'" ,
'" ''''
'" sua •
,co
'"
'" ". ,
". ". •, ,
7
'" t .ofr sn • ." 1 en
(
" '" , t .pr Qe , ltv , 2.3 . ~.5 UNK 0 o ~ST t .~~Qe .l ~ •. 2.~,~,5
no no
". laDel '" l~bel
, '" '" ,
'" h~~l ell:\!. 7
G;;r. 7
m
Y~lu~
I~Del
•
(
APP<lnd1 . ,A. S ~a nf"c~- 1 P_eOOe <---> U- eode
Sp eeia l Ca su
1. Da ta !H'" ace • • ;>li clt i n U-eC>!e . Ther"for~. P- eode Inst.r uctions suc .~ IS
AB R and t.SI ... ! t t:1"plielt data types ire In'afor:::~ Int:> AD D R and ,, ::0 1
r.sp t eth" l,. Th is , .nc rallut ion ... 111 .110'" tho! Optl.. lt.er to handle " an y
dHferent data t)"l''''' •
Tr an. lltion o f the I'_eo<!. CUI' Inst r yc ticn Is ",c~. dlf rleu!t. The "iui~,
inf~r",nlcn h er~ Is a u:lIque bl c~k n=ee~ for th~ ~roc~d"'T~, par . ",et er'
POP~.-;!. and ; ar...,. tors pushed. An al"ontN!l is described below \Ih! c!1 .. I!l
calcu lnc the tll oel< n=ber. f o r [NT and ..."" er, nf.ren e e i nstruc tions.
Un fort unauly . the nu:e er, rHur ned by thi s Ilt;or itt"" ~o no t "'.t~" t ho ••
o r .ny one pau al aor !t~ (or c~ lcuh tic'K th e blocl< n"""bers en CUI'
I ns tr ue ttons because of rcr " ard r .fe r .ncu · to i proetdur 'i:- ' Yor the t :.ce
bein g tile pr epa s, will h. ye t.o Uk. a 5eecr.d pus .nd rill In t t:ue block
nwobers . In the 1o", run i t .. auld be bett er ror · the cOOIp lltr t o out;>ut
t he bl oc ~ nu:ller \lith the CUP in structlen and a1:.o the LEX ' nnr uctie n •
.. hleh .. II r ef teet the stat,e nesting .ranl~. nt (or eac h pr ocodur e.The
;>op~ed !nfo..",ation .. ,y be r ~o~tructe d bY si ::",lnln g a run- U:1Ie .uc k
and inq uirl fli abo ut It's depth at t M point o f .,.11. The pushed
i nfortnH l o n is eull y obulned by rec.t ling t hJt i t Is syn oncaou s Io1th t he
proeed~r. t ype.
E.~7 In~~ruttlon. In ,)<I~' t ion . t~" s.:!.7 In~ t rac~:on Moult: ~~oba bly ~e
transfor.::e-= onto a U_ccd " U:I1( I ns tcuct!on .lr.o" t~.e ~ T een ~ .: :u
( I t's coc~. n.~ ElIT !."'!ruot~on sig·"ab th~ ~., !nnlr.i of. procedure and
r~ qu lr. s thi t lh~ '-~Cde .u~ply the blcck n"",te r, POPI'~ 1,,(oor::l,,1.:Qn . .and
pu.t>ed In ~oo=at io n .
•
1h. fo11Q"'''& a l ioorit~... " Ill k~ep t ric ~ Qr the . u ti c neH. \nl of ;r ~c~ur.
bled( """,bu. fe r , pa r tlc uliC pr Qcor.ur~. The uray LE;{( J I. !"d.fxed by
the .ta1. \e level .ta rtl "& ....H~ one. The yalua in each Icc&lion I s the
block n"",ber curr e ntly a •• oc:ht.~ ..nth that partlc..,l.r display level.
Th.u' , the bl oc k n .... b.r fOr • n.... procedure Is the ul.,. in U:Z(luel]
. f ter neeut\ng the .1&er1t~"" .
liP :~ I:
liD : ~ I:
HD :. U:VEI.;
•
Unfort unatel y. th'" bloc~ n .... !;I~,., I re d!ffer ent rrao tho,. or the
" ... pil . .. ""en ~ ~roeed ... e 1~ ~ edare" fer ..... rd. The only "~y to o!;luin
unl~u, block n"",!;Iers " nien .. &tch tno,,, o f V .e e""pller 1. to the the
Th~ POI'I'~d
l" f"""' HlOO 13 di fficult to oi>!~,,, 'Ine~ the only plaet i t !s
ua lla ble aft ... uUllnlng ... ..- k ,U<:k call1n; s.~uenee f or the p .. oc..d ur.
in <l.uest1oro. In t he ea.e or fo .. ;.~rd proeed .... c all. th is infom.tlon hi.
r.ot been s u". I n orde,. to avoid. using a t"O-p~s, a li od t ~, i t I . be~t
•
If the ccnopilu .upp ly tl:i~ Infor"'~!I"n ""Ieh \. no .... ally s ,,~plied \n the
[~T Inst .. uc! lor. oy P2 V... tarot Pa~eal C""p :h ....
rollo'<lr.~ :~. !'IT !r.~ tr;Jet!c" u. a .~r,e. of '. EX ~~ue<ic :c.~, cue :~e r •
.. nlC~ refh e t t~.• • t~t~c ~!';>hY f e .. !~.e pr:=eo::u,.~. n.e ~~ ce~ n""'~."
a.s:;".~~ to uch s:~tie h~~l ,,:11 h.v" a\r.,e)" ~e~~ ~o;n~~a ~ Ul!".' :~."
abe'" al,er::~",.
- -
, ·_-:'!."'_"·"T_.
• Page II
!hi! 1'-:0<1" ocr i nstr uction I" trlnsr" ..",,,d In t o .. U-code 0(, in'~ruct!on
and rol!o ~ ed by 1 U_~od. [»D in~tr u~ tlon ~h lc~ $I,nl l$ th~ end of the
pr o~~~ r •.
6. r nt P-CCdt 1:ID u.d SiO Indir .~t t"st r u~ticn. 'Jill 3lsa .. a~. u,. ar t!'.
tabh "'.r.ti one<l to su~ply t~t l.n~t h', I n t ~t ~ase of r~ cercs . se t t i r.s
ene Itr.~ th to : •• 0 'Jill slBUI tht C~ti"'iH" t hat the ~er. ;t ~ !. ",,~na...,...
lho I. a d i splrity In the P·code dtflnition In th e tHD has .n •• soci . to~
of f nt and STO does nat. Fo ..... the point of tht ~repa." the orr~~t ...111
be set t.o the U~Stlr.B orru t for an !lfO t ~.• t~uc't;"~a" .r.d set ta z e~O ror
the SlO Instruc : ion .
1. In U-cO<l., tht only dht:nc:ion b~ t"e~n lccal .t'ld global ",,.,,, ory re rer et'let
lnstr\l~~ ions Is In t he blo ck n .... b er . Thus. tht P-code 10<:.1 instructions
are ~ a p~ea Into U-code instructions \11t h a bloc k n~Der groater !hln one
a~ the ,leba. instr u~ttons ~r e .,appe<l In : o t ho bJoek n""ber Ont itself.
EaCh ::oe:oory rtrertn~tInst r uction can ta in. ~ ""~",,orl Guadr~ple . Tho m.",er y
ty ~e (,. ty~t) wlH 11"~ ys be It ",..tll t ho eCC:>i!.r is ehanae<! te reflect t ~e
o t"t~ "'","or ', Itv t' s. The b :cc~ n=ter can De Inru r td f~= t~•• ,~a::c
Ie"'.' l~d::lte<l in !~e P·ce.t i~':r\;c:;cn ;,;n, t~t infor:-:atiet'l ~lro.;;e1
, ~r tstn! in tt.o UX{ ] arr .. y.7ht off~et :. t~. u,.It an;! t~. ~t"!:~' I.
eons~r\;e~.~ u.l~; t~. C:H~ t'l;t illfor=:at;;.,.
•
8. Th.er~ ~re(our P-C'de l,ulrucUons "h ich ~o .... t .. . p into an y specific
In~tructicns. Acco rdlngl,. thoy are lIIapp.d Into t he UN!: Insuuctlon. The
poppc-:l and pu z!:ed \nfc"""tlon should be lulnUlne:l In a prepS$' table.
"2:"
X5 LAB '" "
X5 L.J.B :
'" '"
£110 :
'" '"
X6 UB 16 U.B
...., "
• "%1 '"
'"'" "" '"
" "" " •
,,
UI! OL" l
12 OH
X3 DEF
"
"" "
'" " ""
"" ""
....,
" "" "
UJP
L:'B "
'"
fht I nt e n~ed transfornaUon 1. to ."k t t!te range checklnC upli c; t. ai:d to u'"
th CL~B In~ tru et1on to 1.not.. the be,inni". aNI ex ":..~t of the ju:::p t ab!e.
At preunt. I prlt t led al,orlthcl Cor pero"'ln& the i nUnde" trallsht:on,
10 stHI un<ler In.,.sUlttlon.
•
A pp~nd! 1 A. Sla n{erd-I 1'''''00' {---} U-cod~ Pa&~ H
3. Supply t~, LEX p~eudo Instruotion l"rore>lti ell fer uch pr oc edur e This
In(ol''lflati on should a ppear ~,rore any ef tht eode {or the procedure.
Q. Supply the PSTR and PLOD Ins~~ uc tl e ns associated with .ac h ~r ee edure .
•
2. Co ns id~r
regl!.ter Il !. oc a tioll alons tht lints dlsc"sse~ In :~.~ CU'[-l
r.,ister allocation.
,
.. .-
Lo~ Al""'''' Fl5e,1 Cc<:le t o UC~:l lJ~i"H5 ~ 1 P~~cal C>:Ide
T r~""fo ,""at:o " Ccc=~,,~
•
UniVel",ity or edifor "I., ~" Dh!o
C-ol~
nl. transCo,.::l s t ion of Los u ..,,~ " Ptscal Code ( P-cueJ to UC:;O Unber- •• l
Puc,) Code (U - COdt) u n ~e ~c ~:;rn ;>l!s~td for th e mo,t ~ar ~ ~n I l;:~" b y 'l Ine
bU t . . Uul!7. one ....,,,1<1 l;:~~ to di.aza"' b l~ a P-<: o~e ln3~' U~ ~ :O " in tJ
.t~er.l 'buckHl' and then a •• e .. bh aU _cDc. In.:ructlon trQ!: t~e infor.:.t !OM
cont'i n~ in t he ... 'buci<ets'. Rn l13ticllly . lie wll l ne!d t o aUgI::""t ~he.e
our 'b""kets' with , croe sped,,} 1"""1"" t .t>I " , and al l 0r-iUns. The ta ble th.~
rollo ~ dec~::bes th e Bt".,,. ,,l !uppin , o f , P-<:Ode in:.trcut ion In t o " U- cOde
•
hge 35
ADO t
.., ,
Co r r ~S:lC r.oin ~ tJ_C.x ~
U)D t
In ~t n'c ti on
•
'" '"
, CUP t blkno " "". puah pcp ~ !!.!!!
, CF? t,l,~el,b l kn o.n.",e ell? t bllm o n,me push pc" ill le~~l
"'" I . I: ~
CI1KT na:lf
CH i( u.n iI<C e
C-<l i: n,,,_Ole
CHR
'"DEr C sl:= ~
I.rnK I I C~ O"
, '"
, CUP t ~lkc.o u~r"e p".1> pOI' le~ ~!
UNK 00 CI S vol""
DEC t, o r~
l DEr 8 ~
• DO= T t
• ~[, :l"
(:ID na =e
-,-
"
~I '1 ~ D!"' , t
UX , :..:;..
~ ... ,, •
I'SH
PS'? •
bl kno
~l ~ r,o
."
o~r
h'
l~~
•
~.!f" ECe ,, h'
''" lor) I£ ~ h'
'" lab.!
'" l lbd •
"" F'"
m m
,hll CZO ,, h,
'" t
lor) 10<:0 h'
on ,,
IGa T ''"
,len
~
(cr) '" h,
'"
val ue
-- ~~ '" ,, , -
IeT va,u"
'"' Loff I HC
."
• !liD , of' h,
'"' l.On
• W" 1:1!I
lH I1li
lOR
'" •
'" of' W
.,"
lab,,!
"'. hbel
"'.
,,.
S
"" "" off ,blkr>O • bl ~ M 'off ,,'
!.C~ ,u:ng st r ins
t,conH
," • 0 rr , bl kno
'" , CQnzt
lit:
'" ,
S ' 00 ~,l!:e,~,ofr,t>lk""
"" '" blkno of' ",
LEO , l en ,, ",
'"
t
•
LE5- ~ ,:~"
lod lEO
''"
• :,,"
I or)
LES
lL£! , :"n
'"
eo,
~ ~~
'" , .
o[ ~
'" 11 P'!
•
'"' leyd
'"'
• "" op, liST Iud
•
"" l.lt" '" - -
o 0 HAM "_.
100
"" "" 10,
' EO • ' EO •
'"
000
NO.
000
,"0 0"'
""
3
'" • a.::T
,
""
sua ,
'" o St,
•
'" •
"" '" ,
"" U)lK
-.
D Sl'1L
, '" • "" •
1,,,
'"' t, ~i:e.," ,orf . ~l ~"" m •• ~lkno orr
• '" t,oU
'" t o rr hn
m S7P
, S7 R t ,;:,:e . n .. s< . ", ,o[[.t 1 "".0 m , .. b l k:;o 0(( ' 00
";aC
'"
·r.~C
I .te'
7~? , 1~? .,
UJP lobe!
'" ! ~b~l
.. . ~;:-----
•
~ ~p~~d"
•• CrOr- 1 P -<O<l~ {- -.> U-<od " P ~g~ 38
r
,
UN !
'"'
0"" ,
W Ia~ 1 < l~~Z, oJ!> .;;U~, tb ,Up
,"
C;! r.;.t
, "'."
!IS-;~ 't~ "p'
'"'" • '.0
W ll~l
• ' t~'"P '
""
oro , en
'"
I Ilub
1
'"
"" ""
, ' hOII"
'"m '"
I .b I
... ••
-,
ta:> 1 OL" st l ~
1.b2 ..... 0
, •
-. - .
</If' SD ~e!i l Ca" ~ s
2. The P-cocle proced".. " c.ll lnsvo c tl on s .r~ us.nttdly the s U.e. foth C£?
.nd Cf? He tran.fared Into lI·cOde cup instr uction, with CtP or CF? lau;ed
Into the ca.ent fIdei of tne CLIP I nst ructi o n. The sUtlc nuti~, leve l
Is .IM) taU.? Into the c=ent fidel. 'repass t.blu "'Y be used to
'quire the Infor .. a tlon ~bcut the tYP~. n.."..Der of para"etor. popped u~on
entry • • nd nu .. ber of p.r, .. et,", push~ upon retUrn fa,.,. t~e proc ~ure.
The P-ccdc OEF in,tructl"" which IPPC", at t~.e end of " pr D~ed""~ Is
tranfo,..,.td (nto , se r i.~. at U_cOd e OEf' innruc : lons. All procedures are
ur .. in"ud by tile £:10 In,.ruet:'on.
If t he I"' "c .~ure Is to ret ... " " ~d"e. an .p~ro~rl.te PLOO Ins truc::on js
.. ecuted . In elt~.er case . • U_c<><le R£T instruction Is then ~Hted .
• Th e P-eO<l . I:lt) ana STO !.,.trcut\o ns arc .. iui"g the hnst~ field. For t~e
tl:o. ~e tr.i! the Pre,.u '.1111 p lace a :.ro Into tt:ese f i eld . "'"1CI'l ,,,111 l n
turn slg"~i t~e O!)~ ,,,,lar t~. at tn~ !.~sth is ""kno ......
• S. Th. "' '''''~·Y .. ne~ ! r.st ~ ":t!"n" ~re cs,<,,,t:al1y t~e ~~:=- •• ee ;>t th~
r~~ .
t.~e dht ~ ~.~ t: e n be~ __ e~n ,! ,,~d il M ICCll iled~!~SI" 6 ~." tn •. u.~.ed ~f!
!~ ~o ~".• ~:c~k r.~"~e •• fer :~.e ~r".e~"r.. "".e 6~atal !>!cc ~ c.....,b~~ !.
, iI~S~""": to !oe en •.
•
A ~pendix B. C.. ~y_l P-<:od. ( _ __ ) U-code
- 6. t ile ("m.t o f ~ U_<: <:d. U P lostru<:t ion sequence .is ~ rar., . e l'leck uquenc:~
which brioch e s If out of ra r. ~e, the lJP Instruc t ion, and the c ~se t abl e.
111t ca3. t;~ le \ S h.a~ ~ ~y ~ c ~ 5 . t ,bel (e LA B) ~h ;ch .x~!!ci~ly s:. t • •
the lenlth of ti,. c~s" U bi" .
•
U_ cod e Scur ce
"''' I ~l ,
IISTR 'tMlP ' ",
I ,ltl "
END:
""
IS' 1 hn
W
,,>0 "
' te::lll'
""
on
I ,uti
I hn
W
""
"
't,,",p'
DEC I ,Ib
'-',
13 u. X3 U, D "
u~ p
XI
'''' "
"" sl :. Xl '" ,"
CLUI
•
"" " '"'" "
u. "
"" U. "
" " 0
-The IntendO<! tr. n. ror.llat. ~on \s to ""h the r ;n, . chK~tng n plte\t ' n~ to us .
lhe CUS In.truct!Qr: t<> cl enat. the bes:nn ln l a nd nunl of the jl." " t l bl ••
At ~r •• • nt, I ;rlct!cll alicr\U", for pefo"" l", tM Int e"et<! tran.ln i on.
I. 5t ill "",de l' Inves t igatIon .
•
. .-
Pa ge ~ I
•
,
.. Supply ttl ..
tn3trUCt1on! .
PST~ Lnror.:latlcn " Met! b assoo1zt..:! wit h ... ell ~~IT
2.
•
,
.'
•
,
5t~nr()r<:l _ 1 Crly.l
,
- - --- -._------- ------- .----------
• 3ddr~~ s addr.ss A_re,s •
,• boolun
"hooT. c t a ,.
bCloha n
ch.oracter
B-re&.,
C - ~""...
,,
D doubh
'"' direct .~
,,
,, Ilalf Int
In te l _· Inte!". •
,
.
I
IDe<lor7 strins "lin mP.II I>aln .,~
",
0
oU
" oU
".
pr""'~II1"' 1""0".<:1.."."
qu arter r ecord
0
,• '"'
do~bl t r eal rol l •• ,ls t e r s
,oC S_ r.~3
'"
,,
T T_r., s
, 'I - ress
• 31n&1. !l~
,
T
N<>t.~ ;
,
-Indu- and -¥.o r t Intt,.,.- ,ene' a ll y ...an ~dr.ss-si~. In t egers cf 2~ . ~2 .
or ;6 bit:;, -11."'"r1- datat1~. Is us e<! fo r arr~ys. str:r_!>:; , a ~d r eco r dS f or
• tr.• S- ;.
•
lPn~rotx 0
SU~"~HY or OptiI'1IZI~IG n~;I SrO RI\I.7IO;IS
COn,tant Ar l ~~.::>et1 ". Repl a"e .n oper,t or " ith con,ant 0Fer.n~' ~y t~.e
COnStan t resul!. E.... pl~; 3. 5 b""o:o.s a.
In addition to t he nOr.lil
•
n":: e!" j~al operate:-s. a lso reduce l' ~:ID rALS~ to ~.\ LS!. a nd
Opera t or SliIopllf tca tlcn. Change one op"rato r to a sl.pl",. on~. Ex_pl~'
A ~ , beccnoes deer~ent ( A) . This t .. ansfo~Itlo n Is dep"nC:ent on
the ".act se t of o~er ators ayall'Ole.
,
Is very snort, .nd put Its code In11n ... I t th" preeNur''' t...,. .ny \o<:al
urhbhs , they lIun b" .. er,"" Into the loc.l varlablts o r tht c.ller.
Activation ft. ""rd Merline. ror '" pro""': ..... ,, vM e h Is ",lIN !Dort tluln on" e.
Its code "an not be put In llne, but Its l ocal var i ab le . Can s t ili be
."rged Into t he activati on rt cor<l s (coll ect ion of 10<:11 u.~lIbl.,,)
or 1 l$ " a lltrs . ~ long as 1:. loc.l s are put at " c o ~ sI 5t t~l addre~$
(""", e offu t) 1~ all ~uch .cU vaH o n r~cor4 s . Aftt~ this
tr.nsfo ..... tlon Is done. t i'll! pro clf<lu r~ lInka.,;' cod. n~~dlf<l re r , cal l
t o th e givcn pl" oc tK!"r~ c.n b. $i"' ;lcll r hd: nO ne .. acti v a ti on ~ ...,ord
net<ls t o be .lloc a t~ . .,-od pfrlups no db ;> by regist~r u!'<!atlnc Is
nt ed ~d . If $Omc l oed Yirl a bles irt kept in fis t r e l ist e rs, thc se
nt Cd r.Qt bt Sivtd/ rC5tor t1 around the "'ll.
For a , ro up or no r._
rtc"~$i"l! pro- " ,dure s . ~ cthatio n Rec o rd IlHiinii; " a n do • "ca plete
sUtl" storag" alloc ation (I. h rnr t ran) . d i.ci n8t;'r., the ne ..:: rnr
r un _t ~ "' t sta c k ," .. n ai~tnt. bu ~ pre servi ng t he <l. ta "" =,, r1 3t.• ri ~g
FOR ! :~ 1 TO M DO
U1] :,2 ' 1 - 1 ;
.
"" ". '" -- ,".
:
2 .~ (Hm it)
•
13 ; h [ 11 : (aldress or A(I])
WHIL! T \ <. T2 DO
(Tjl : :T1 ($tor~ !n<l:r e ct )
T3; : T ) · 1 ;
Tl ;.11 .2;
r :', (Tl_ 1) DTV 2:
•
M ()~:ng Sub"e~ iptranse Ch eck ;",. f M sulacripu whl C ~ are linear
CX ;rtS5:ons . ....... the r an, .. checkin g w t of a l oop. Eum pl,,: In t he
above 1""1> . c hang" th" c h ~k of I In ~[ Il 1",:<1 .. til" loop t.nto a
cllede of 1 and /I j~t beror . "ntulng t~." loop. th i s Uln3(or:utlon
=",st be don" In conjunc~lon " 'th t he Zero I t e r ation Trst
•
tr ansfo,"",.UC)II below. ro r . l eop "" Iel\ \ s tu"utrd at h,,:;t e nc e, "
.ubs<:rip tra" , ,, error ,,,11 occur on san e Iter a tion If .1>4 on ly If o ne
• of ~h" lllO utr ..",,, ul~s o f the l1nur . ub:s.crtpt u;><"ru\on 13 out
or .. 0",,". The,e two ... nl" ChKks "an b• • ,dt b.fore .ntedn, th"
loop . Ir ,ithe r check rau •• th. "r r o r auu8" InvolY~ will b"
Ilye" .oon",. t ~ln ullaptl"t "u d code, b\l t th i s I s usu.ll,
Irreluant , 30 l OIll~s no fizup-.nd-retry .."" h, nl ... u lsts.
Zero l ter.tl on Test. Ch.n,,,. loop with 1.141 n& tt~~ Into. l oop wi:h
_I ..din, ~~. ro 1t., .1l" n~ M un plU3 • trailing ~ eont1 nm' lool>insM
tut. [Umph :
•
Hci s tlr.i; . ~CH ~n:t n;: ren;cn " hid, b ~v ~l uJl~d on ~Il bra",,~.u o f , ~ if
or ns£ to a ;.1,ee J"' ~ beCc re l~e ~rlneh llOin t . Th!s does no t .pt'td
up V ... ~r o s r ~, but It r<!<luces the ar:1ount of toee nude'.
(
Live R&~ ~ ~ S~r:~~~ l e . •~c"e t~.e (lr , t a 'Jil r..;,,".t \0 a Hr:~bh do,"",. Or
t he last U~e up : n a ~re&r~ . "'" tr.at th~ live ran ~e of t~ e . ar\'~lo
is y.",l1c~. ihi s : ran~rC"".~tICn :shou ld only t:le done ir the '"O~""C,,:
dOeS not utend SOllIe o t~c r v .. do b le's lhc ranli e. £' :>'!1 pi cs' an
Ini tializing assl g ""cnt of I =cnHar. t, A ,. '5. can t:>c OI"ved do,," i f!.
a pre;; ..... cIon to tM firs: ~u of the "a,. lIbl .. ; In .",,11=''' < sue::
as A :; Ii • C. ~ nlch I,. the 1•• t "se of both Ii ~ C, ca n be .oycd
Ul' clc.e .. e.G the l.st d'(! ni H"r. Of Ii or C. Shnn ki.' i t"", r ang es
(9 \ C) ca:l~enSUe" (or n;>.r.(1ng ~he r.nif of A. All such .Qv "",e~t
.. u:st be to .. point In the pr O&r:; .. ""'l e ll Is necuted no ", or e
•
fr equently than th e c ril l n. l sUUme nt. Thi s tr .. ":s (o n", t ion pay:s o f f
wil en .. ""'0lrllll has two or lion distinc t poort" udnl distinc t
varl .bles . with .11 .... rllbl as init l a l i z04 It the be& lnnln& of the
.
...
·
~
~ •.. -
entt r e prOlraa . Mevl", th4 laltlll l - . , tlon o f the v. rlab l es ~ . d
only by t h .. se cond p. r t do...,
It pc ~ slble for Ya rhbh~
to the fr()nt o f the ~e<:ond par t .,.,y lIake
rr Ctl t he t wo part~ t o sh.r e storal" . Se.
Storale .I.11 "".t l ol"l bdow.
S t or." (Re gist er) Allocation . Re-map the sto r ale locatio ns of al l variabl es.
bas..:! on fr equency of ,",~e an<! r, oli" of un. SO that fr ,que"tly_used
uriablu ,Tt al l oca t e ': to (1). : U'" r"tes t l e ul of any 1I~"ry h1 ,r.rc~.y.
and (,2) t he .sm aUut Orr~"t3 ... (tMn t hei r respecti ". h ... el. this spud S
up a" c ess to tho n frequent uriables, In creases the l i kel ihood of
,d d r e s~I"~ the:! via s hor~ ,lIdr e" n ll<ls . anll In<:r •• ses the local1 t y
,r of r.ftr . "c" Seen by any =.c~. or !'>II:n; ",""han!s ,". :Ih.~ e t~. 11·'e
r.r. g. , of two v,r l.b les 00 not ov"rlap . '" 'I'
th~ ~,, ~ o the ~ lc c3:!cn.
Thi s p~o="ss i s o ft.n c.l1ed '.,;st . r Al l "ca tl o n, but ," i a~t 2 3 ~~l l be
.ppll..:! to aU l e"ds or s:"r . ;;e. Th i s tr ,nsfo nut j"n Slves st~r a V!
spac e. but e.o~" 1::l1lor t. n t I1 . it ,110..-s lOore ~ar i:o) l e~ ~o be aUoc:;uC
to r .. st locations.
Forced Cepit>. H.. ke ras t _~" ces s c Df'h' o f s"", ,, v ~rhb ! es whi c h ~r. s l o,",
to ac ceU. hample:
, .- ~ . ~ -.--
\Jnre~d'l~~le Code, R=ov~ any ~a~i<' block .. Meh na ~ no pred~ceHor~, rnb
.. ~y in t urn ma ke other ~I O<: k 5 "" rea c h~ble , This transforCl.tion.1S
orten e ffective ",nen In IF test is ~nc"" t o ~e trlJel{alse at optic!!!
tillie, since one of the br.nencs or the IF Is therefore un;e.e~bl.,
Branch lelle. Chaflge ~ll boolean upr!:nlcns In~ohir'i AIID .nd OR to br ~~~~
10l le , so that I{ the Itrt oper2 nd :C:lpl !tely ~ ele~"lnes the v.l~e or
the upruslon, the rllht oper.nd Is nOt evaluated. Do tills ,en11 Ir
t h e rllht operafld has no sl~ e . efhet .. (suc h n • e=on sU'b.. ~ess lon
definition), Also known n s hort_el r eul t udunlon, This 'pplies
to .11 boolean n pr u,si ou , but POlYS orr ,"ostly vitI'! boolnn
ul><'esslons used n t h . op,.....nd of • eondltion.l S"'p. Subs .... ed in
thts t r.nsron. . tlon Is the idn ttl.t NOT lener,tes no code (only .,
revers,l or target br.neh ,~crress.s), This tr.nsfo~.tlon ccmbln,d
with constant .rH~,"etic will turn IF ( A>8) AND /DFlH.r;.SI, whe;.
DEBUG Is the constaflt 6, Into FALSE,
Test o,hlon, I f ' test is leno .... to have t he value T~U£ o r FALSE·(or
If a sp~lrte c.s. Is kno .... for • C~SE brand'), thtn r ... o~. ttle
~st c~ t irtly, and rt-ecnntct ~h t rio .. gnph approprhttly . In
Icne~al . thl~ trlnstor= a tion eln either crtatt In inner Loop or r~ove
..