Professional Documents
Culture Documents
Compiler Design - Unit 5
Compiler Design - Unit 5
Relat T,
fate =DAG Conshuchon >
Gwshuction qf DAG -for a. basic bleek (sax follows
© Trane ts @ node jn the BAG tor each of “the iniiad
val. of tu vernabh appearing, wn Va basic block
@ The is a pode NM axociated loith each steclmont-
& wriin +ho block jhe childwen o N ae those nocles
‘ Cows ponchi fo atebmonts thot ano tho ox ddfinitions,
Wor do a, ef the oferanols wycol by A.
(2 Nece N is obelrel by Hr operertor appliool af 2 are|
*adho crtnched -fo N ae Aik 4 vanables er tsbu'ch
Gk ws the Lost chfinition toithin the block |
Prey sehesences— |
@ wo oxsignmrent gon an arerony [x= atid | Is veprenurl eg
by creacivg % node UW orate Hy and too
childyen rofrarertting ta wnibal value of ona {eo ) anal
index > Venable x becomes the Aotoek co He's
® an conign mart to an avey [afr] -yJ% vopronented
bey at naw ned woth opmats []= ancl three chilolren
“epronetg , J ana y. Shyu th no aaxiobh Aabelivg Yer's
dion > the — creston gf 4A nok Kilp olt currently
constivcteal node who value dsbanca, OW Q,
AGW py vrede Greco oor killeol can nok reCerve
any more Sabels ’ rent
GA-
x= att]
atji=¥
ze aft)
Tiree oddios cocle qos Tlocls &
&B>
® A407
» Ae addr (A) -4
9 t= #14 DAG
y tye & 4h
o jm odo [8] —4+
9 t= Asta] 49;
D teats ¥te
8) Ag = PRod+ 4p
2 fee ars
> “OT = tq
D ig T sro gle 8ex— 2
Sum ied » L=O
*
Sum = Sum +9 i . Lately
whuk ( lo t , )
2 Adol ress Stetmant : (arrume 4 byte/ bord)
') Sum =0
2) t-0
‘ her ati)
ffm 1" saggte aalyos bill inca
9 4 = alt) .
» » La
5) Sumge = Sumstr De ee e
§) sa, i) da abel
2) Ae a4! ' yi
® if t c= losers .
yp vel )
ky ets
ee = Addy Cal ~ +
By - xt4)
e
AL = alt)
Sum = Sam4tan .
Le= 441
y L cele Sobel)
boat’
, a)~Zyulelt: | 1 oi =
consid, the cod fegmanh , Compute, He dot produc
af seas vector A 4 Bq Jonth 20.
Code Frogment 4
ba
PRop t= 0
Viet
do
mn
* PROD i= PROD + ALTIY B12)
p= 2+)
% ensl
lolly BP $20
Biddiess Ahohrunty [ A byhe [mor
t PRop =o
a? =a
rot = oe
ei ® = Paddy (A) - 4
‘s% - TIT)
G Ta = Adar (G)- +
tT = thi)
’
9 Te = 72 ¥ Ts
a PROD = PRD + Ts
leo D =D+\
y ig 2 E26 soto (%)
mL heat”exampl-}) Condtinurs
T= 4#T
Tr = Addr CA) - 4
% =-b(T)
Ty = Adolr CB) +
% = T4lh)J
Tg = Ta¥ Ts
Fro = PROP+ Te
Q=PR+l
dp 620 seto(@
J
Plow , mph ofr Code rnotion :
B
T= AddyCa) - 4
Ta 2 nT
Tg = Tal TJ
Ty = BY TS
= PROD* Te
rey
By
@_ PROD
DAG. 7
re _ el) Ts
it AY
+) “T
Dy odl(n) aololy(t) NZ)
Dp
pag. o 2% |
2)Plots graph of tex ebirinarhiog induchsa variable
[prop =o] B,
Ty '= Addy (A) - 4 Ba
Ty t= hdd (8) - 4
TET,
induchon ®
verily ae
ca beth daberct
FR oon enchotnr T= 144
t% = PCT
Ts = HL B.
Gl = PRD ATE
Ped = Te f
Wo F446 sots Bo
Vy. ace
fox (i= 0; tele: let)
sum =Sum + ay)
7 i Sums = a
Wl=d ) ta> Alt)
Adit 1 Lo Sobol bs) Sdyn = Sum + 3
4) goto (I) 1) get tO
oy vs tl tes Fi
6) gob ®
ry x oleh ie (18)Ay Ladolk (AY
Ay ~ 4 (4)
Sum ao Sam tsexampli- .
Wate down “He & Addves ackedrwet -pe te
Koliovowg brogram degrent,
whe A,B ove away of size 20X20, anel tere
are 4 byte { voove
begin
add + 0,
ie
ey
do
omy agin
add = odd + ACI ¥ BCI) >
Le LPL
fre: fai
eng Fee tere eb Ee!
1) odd = 0 iS) nA > odd + A),
2» L=l By
3) yl WwW aol da
DY 4, = L¥20 ) Ai
9 Att ~) se43.
6) as z4Ar¥ 4 19) Aya? ut)
1) tg = Ady CA) - 34 oe) date
2!) 4 (0 0) gots 2%
) As 2 #4 bts] 8 Se)
Y dy ~ $20 7 Mean goto
i) ty’ = xetd a me. wee
\) #8 = +, ys as am
) Aq = Adel (BD ~ 84 Leadsy- 1, 8
i) Ap - Alte)
) Av = Ae ¥ Ae (715) beJ=
————_
tL =f 4)
ty =p Ve
ka = Aeble (8-84)
ts = 44L42]
te = Je 20
de = Fett
to aay 4
ta = Aclolr( > — 84
typ = Aalto)
dn =, As % Ap
tn > Ade +4y
Addl = ti
Ais = E+!
L~- 4
Aya = dH
a4
, 4
4 Jor sot C4)
@ (5/8)
8,
Bs
baa’‘or AD oway— ah
consicl ADanray 0 Af2JL3]
Jov “boxe adds t8 Crow major oveler) ~
adden of ALTILL] = bore +n (a= low)
) + (j- lew)
coc given exarn ‘Ne
‘ i index don to bee
ACI EA] = bore +Qn¢d-4i-) ¥
= bat (as) (nd HI)
by “A tates) = Ueno
bow =a |
We + Jd . ’
ACL] = aarAerely+
= A
oe - HD 43444
2(a- a4 Sit
thus addres tod,
tor mx 2 loxley W=P Yn) w= sg
dz po
gel | go? \
Ay = OK 5 d= fort
dre Arty : Aue ai
fae 8 Hy tae aed 4
ag = #2 -(88) tae o 0 ,
Mit e% atte | de> Azelts) (s/eReg
Nsidoy the Code dragon
Ce wrtnel an idertrly matrix of
rel ebrwnt take 9 | element -
ancl vetting A Atpreal “Iy row rmaror oroley -
Code tegen ¢- .
dor L gm Jo lo do
gor j tom | fo'lo obo
ory loxlo, sur
aChjlyJ =°;
S feet from 1 lo do |
alrifi}e ly,
2% fddror SBtectrunt o.
N) c=)
2) jal
2) f= bowl
2 Ae Atl 4
da = vt
%) Aq = £5.80 oP
F) alta =o
8) j-d4
® if bee
9 ater ae
0 Pas
{dere goto
13) a5 = fel bt
W) A= 99 ¥te
ID aftsa=l
\6) d= At BS
Dif Lear gor uw “
PS | aft, -1
uals
it TEEN, gototh —“OPH mizing ranadormation 3. { "tS
& Gmmon Sub exp- eliminahon-
r= Gals => aed
we won “seat “he econ dm dey pvt fom
nb wde if rene te Pacem tty ae gadis beh
crerged Ths
% Compile Hme evaluation »
Can inprove the execution affeciency ct a program
by ahiltig execstion ime achons to compile Tin -
exe Folding
ee) Ke a¥ (228/78) Wy
Be Can perform he combrtion
Combily in - :
2 Cretan peo Bagihiine
a verte is aatisnasl a constant value “and
tied in an exp” without my aaignnad other valug
ih. we con ovalmote i da exp:
sig Ye Constant parr . oe bev 4 *b
» of
24 (220 | gaa) al &
are
i >
ye ¥[2d
we may cal evabaste x[23 a 12 4] 2.3 ok
ombile Aime,
Y Peas Code odivainaction:
RY: ceavboy Dead Code ohiminatont
.
> Nrenmalole prabagatiaa -
ewx- 62 avb 2 a¥b
Yea x=a
: 2
a =x ote de arbte
it a venabl is assignel ‘to ancthiy variable , we ere
ue ore in place of oft.
i dhe valun contained ino Veajahle at Yat point ts
not red ENyowre in Ye rogram pubsegquontly 1 then
tate yecrablh ik said to be ot het > place -
af on cutighment 2 mode 40 2% oliaal” Uate'a ble,
hee aignmen ip dace! eosignrenh Qn]
tk con be dayely xermoved / Avorn Who program +
exe
wees carb
@ x-9 yoann duacl perth ment
i > : 5
ie WERE AF da avb +e
Wy
oer gz ab
e °
as a¥b +4
(5/28) oo,4 Code motion:
Past of the program
CEs
a
Q= 200)
wWk Ca>2)
b= Xt)
PLEASE
if Car
evaluation
\ on exp” is moveo| from he
to ansth¥ in such a way tot ibis
evaluated Qe ey freanemtly,
2-6)
pag 2:
WY
Qs 200%
b= x+4;
while Ca >o)
4H Cake =
tho
wort th loop: bot
com WA
sun be execrteol only on .
prank b= xtY ib executed wey tre
iF ia loob invariant: | we,
SA outsicle tre “Web f+ will
=o)
prints (7 Yd ne);
we cm by
sth loo invenanh Atadimunts oat
=~
a tke ecb:
e Anducisn Variable and Shrength Roduch'on :
e- taty feu
thik (i < Jo) oats 24)
> L,
\ .
yal? 4) yd}
fie te Law
§ (sx) #=tt4)
a!Led Urvealling § -
hoof unvvol lig ( dep
—treavafor moction dechnigng thot all
execuhon Abed at
‘les anaolling increas Une piggrams Apel by
obiminatirg clexp conto! fyadaction anol Sop text
\wshuchor, ;
duce vlercttions)
Nemeve or
-
ey
AO ow Geo C6
ant, tells")
yy loop anrolliny
eC p20; L235 (+4)
@ tes (veblet
yrs (" Hello);
&
ys cron! BOR IN I ure eo ned to check
the vetoed ge epok increnert- x over dime Yourc/
Bis she
2
bat
(s/22) °Lud 3 sing Jamin“ CPusion) .
sop {wion ( Loop gammirg) ina @mbiby optima,
ans| ool hramsformochon ich reflec rau less
with a single one -
Mt Ip poss i bl vahon Yeon lochs Posalis, str
Jame "rg and do not xefevenca each ster dota.
gt. Consichy a pasgram egret
int Ly aQioc), bled];
dor (e045 UL doo 40H) a
ati =15
by (te0, £21005 t+)
eC) =)
cn be equirelont to-
int 4; alte], bilo},
es (leo; C