Move entry_block() into Layout.

The single entry block in a function is simply the first block in the layout.

Remove the 'entry' keyword from the textual IL, the lexer and parser.
This commit is contained in:
Jakob Stoklund Olesen
2016-07-22 10:06:51 -07:00
parent 38815dcca3
commit f116f03327
8 changed files with 29 additions and 37 deletions

View File

@@ -26,7 +26,7 @@ class CretonneLexer(RegexLexer):
(r'[-+]?(\d+\.\d+([eE]\d+)?|[sq]NaN|Inf)', Number.Float),
(r'[-+]?\d+', Number.Integer),
# Reserved words.
(keywords('function', 'entry'), Keyword),
(keywords('function'), Keyword),
# Known attributes.
(keywords('align', 'aligntrap', 'uext', 'sext', 'inreg'), Name.Attribute),
# Well known value types.

View File

@@ -1,7 +1,7 @@
function average(i32, i32) -> f32 {
ss1 = stack_slot 8, align 4 ; Stack slot for ``sum``.
entry ebb1(v1: i32, v2: i32):
ebb1(v1: i32, v2: i32):
v3 = f64const 0x0.0
stack_store v3, ss1
brz v2, ebb3 ; Handle count == 0.

View File

@@ -41,9 +41,9 @@ that can be referenced inside the function. In the example above, the preamble
declares a single local variable, ``ss1``.
After the preamble follows the :term:`function body` which consists of
:term:`extended basic block`\s, one of which is marked as the :term:`entry
block`. Every EBB ends with a :term:`terminator instruction`, so execution can
never fall through to the next EBB without an explicit branch.
:term:`extended basic block`\s, the first of which is the :term:`entry block`.
Every EBB ends with a :term:`terminator instruction`, so execution can never
fall through to the next EBB without an explicit branch.
A ``.cton`` file consists of a sequence of independent function definitions:
@@ -395,7 +395,7 @@ This simple example illustrates direct function calls and signatures::
function gcd(i32 uext, i32 uext) -> i32 uext "C" {
f1 = function divmod(i32 uext, i32 uext) -> i32 uext, i32 uext
entry ebb1(v1: i32, v2: i32):
ebb1(v1: i32, v2: i32):
brz v2, ebb2
v3, v4 = call f1(v1, v2)
br ebb1(v2, v4)
@@ -625,7 +625,7 @@ A small example using heaps::
function vdup(i32, i32) {
h1 = heap "main"
entry ebb1(v1: i32, v2: i32):
ebb1(v1: i32, v2: i32):
v3 = heap_load.i32x4 h1, v1, 0
v4 = heap_addr h1, v2, 32 ; Shared range check for two stores.
store v3, v4, 0
@@ -878,9 +878,9 @@ Glossary
entry block
The :term:`EBB` that is executed first in a function. Currently, a
Cretonne function must have exactly one entry block. The types of the
entry block arguments must match the types of arguments in the function
signature.
Cretonne function must have exactly one entry block which must be the
first block in the function. The types of the entry block arguments must
match the types of arguments in the function signature.
stack slot
A fixed size memory allocation in the current function's activation