<s>
In	O
compiler	B-Language
construction	I-Language
,	O
a	O
basic	B-Application
block	I-Application
is	O
a	O
straight-line	O
code	O
sequence	O
with	O
no	O
branches	B-General_Concept
in	O
except	O
to	O
the	O
entry	O
and	O
no	O
branches	B-General_Concept
out	O
except	O
at	O
the	O
exit	O
.	O
</s>
<s>
This	O
restricted	O
form	O
makes	O
a	O
basic	B-Application
block	I-Application
highly	O
amenable	O
to	O
analysis	O
.	O
</s>
<s>
Compilers	B-Language
usually	O
decompose	O
programs	O
into	O
their	O
basic	B-Application
blocks	I-Application
as	O
a	O
first	O
step	O
in	O
the	O
analysis	O
process	O
.	O
</s>
<s>
Basic	B-Application
blocks	I-Application
form	O
the	O
vertices	O
or	O
nodes	O
in	O
a	O
control-flow	O
graph	O
.	O
</s>
<s>
The	O
code	O
in	O
a	O
basic	B-Application
block	I-Application
has	O
:	O
</s>
<s>
One	O
entry	B-Language
point	I-Language
,	O
meaning	O
that	O
no	O
code	O
within	O
it	O
is	O
the	O
destination	O
of	O
a	O
jump	O
instruction	O
anywhere	O
in	O
the	O
program	O
.	O
</s>
<s>
One	O
exit	O
point	O
,	O
meaning	O
that	O
only	O
the	O
last	O
instruction	O
can	O
cause	O
the	O
program	O
to	O
begin	O
executing	O
code	O
in	O
a	O
different	O
basic	B-Application
block	I-Application
.	O
</s>
<s>
Under	O
these	O
circumstances	O
,	O
whenever	O
the	O
first	O
instruction	O
in	O
a	O
basic	B-Application
block	I-Application
is	O
executed	O
,	O
the	O
rest	O
of	O
the	O
instructions	O
are	O
necessarily	O
executed	O
exactly	O
once	O
and	O
in	O
order	O
.	O
</s>
<s>
The	O
code	O
may	O
be	O
source	O
code	O
,	O
assembly	B-Language
code	I-Language
,	O
or	O
some	O
other	O
sequence	O
of	O
instructions	O
.	O
</s>
<s>
More	O
formally	O
,	O
a	O
sequence	O
of	O
instructions	O
forms	O
a	O
basic	B-Application
block	I-Application
if	O
:	O
</s>
<s>
The	O
instruction	O
in	O
each	O
position	O
dominates	B-Application
,	O
or	O
always	O
executes	O
before	O
,	O
all	O
those	O
in	O
later	O
positions	O
.	O
</s>
<s>
This	O
definition	O
embodies	O
the	O
properties	O
that	O
make	O
basic	B-Application
blocks	I-Application
easy	O
to	O
work	O
with	O
when	O
constructing	O
an	O
algorithm	O
.	O
</s>
<s>
The	O
start	O
of	O
a	O
basic	B-Application
block	I-Application
may	O
be	O
jumped	O
to	O
from	O
more	O
than	O
one	O
location	O
.	O
</s>
<s>
The	O
algorithm	O
for	O
generating	O
basic	B-Application
blocks	I-Application
from	O
a	O
listing	O
of	O
code	O
is	O
simple	O
:	O
the	O
analyser	O
scans	O
over	O
the	O
code	O
,	O
marking	O
block	O
boundaries	O
,	O
which	O
are	O
instructions	O
that	O
may	O
either	O
begin	O
or	O
end	O
a	O
block	O
because	O
they	O
either	O
transfer	O
control	O
or	O
accept	O
control	O
from	O
another	O
point	O
.	O
</s>
<s>
Then	O
,	O
the	O
listing	O
is	O
simply	O
"	O
cut	O
"	O
at	O
each	O
of	O
these	O
points	O
,	O
and	O
basic	B-Application
blocks	I-Application
remain	O
.	O
</s>
<s>
Note	O
that	O
this	O
method	O
does	O
not	O
always	O
generate	O
maximal	O
basic	B-Application
blocks	I-Application
,	O
by	O
the	O
formal	O
definition	O
,	O
but	O
they	O
are	O
usually	O
sufficient	O
(	O
maximal	O
basic	B-Application
blocks	I-Application
are	O
basic	B-Application
blocks	I-Application
that	O
cannot	O
be	O
extended	O
by	O
including	O
adjacent	O
blocks	O
without	O
violating	O
the	O
definition	O
of	O
a	O
basic	B-Application
block	I-Application
)	O
.	O
</s>
<s>
Input	O
:	O
A	O
sequence	O
of	O
instructions	O
(	O
mostly	O
three-address	B-Application
code	I-Application
)	O
.	O
</s>
<s>
Output	O
:	O
A	O
list	O
of	O
basic	B-Application
blocks	I-Application
with	O
each	O
three-address	O
statement	O
in	O
exactly	O
one	O
block	O
.	O
</s>
<s>
Starting	O
from	O
a	O
leader	O
,	O
the	O
set	O
of	O
all	O
following	O
instructions	O
until	O
and	O
not	O
including	O
the	O
next	O
leader	O
is	O
the	O
basic	B-Application
block	I-Application
corresponding	O
to	O
the	O
starting	O
leader	O
.	O
</s>
<s>
Thus	O
every	O
basic	B-Application
block	I-Application
has	O
a	O
leader	O
.	O
</s>
<s>
Instructions	O
that	O
end	O
a	O
basic	B-Application
block	I-Application
include	O
the	O
following	O
:	O
</s>
<s>
unconditional	O
and	O
conditional	B-General_Concept
branches	I-General_Concept
,	O
both	O
direct	O
and	O
indirect	O
;	O
</s>
<s>
returns	B-Language
to	O
a	O
calling	O
procedure	O
;	O
</s>
<s>
instructions	O
that	O
may	O
throw	O
an	O
exception	B-General_Concept
;	O
</s>
<s>
function	O
calls	O
can	O
be	O
at	O
the	O
end	O
of	O
a	O
basic	B-Application
block	I-Application
if	O
they	O
can	O
not	O
return	O
,	O
such	O
as	O
functions	O
that	O
throw	O
exceptions	O
or	O
special	O
calls	O
like	O
C	B-Language
's	O
longjmp	B-Language
and	O
exit	O
;	O
</s>
<s>
the	O
return	B-Language
instruction	I-Language
itself	O
.	O
</s>
<s>
Instructions	O
that	O
begin	O
a	O
new	O
basic	B-Application
block	I-Application
include	O
the	O
following	O
:	O
</s>
<s>
procedure	O
and	O
function	O
entry	B-Language
points	I-Language
;	O
</s>
<s>
targets	O
of	O
jumps	O
or	O
branches	B-General_Concept
;	O
</s>
<s>
"	O
fall-through	O
"	O
instructions	O
following	O
some	O
conditional	B-General_Concept
branches	I-General_Concept
;	O
</s>
<s>
exception	B-General_Concept
handlers	I-General_Concept
.	O
</s>
<s>
Note	O
that	O
,	O
because	O
control	O
can	O
never	O
pass	O
through	O
the	O
end	O
of	O
a	O
basic	B-Application
block	I-Application
,	O
some	O
block	O
boundaries	O
may	O
have	O
to	O
be	O
modified	O
after	O
finding	O
the	O
basic	B-Application
blocks	I-Application
.	O
</s>
<s>
In	O
particular	O
,	O
fall-through	O
conditional	B-General_Concept
branches	I-General_Concept
must	O
be	O
changed	O
to	O
two-way	O
branches	B-General_Concept
,	O
and	O
function	O
calls	O
throwing	O
exceptions	O
must	O
have	O
unconditional	O
jumps	O
added	O
after	O
them	O
.	O
</s>
