Mercurial > hg-old > index.cgi
annotate doc/internals.txt @ 365:6a98cc90c14f
Added resolve passes
author | lost@starbug |
---|---|
date | Wed, 14 Apr 2010 20:49:04 -0600 |
parents | d96c30e60ddf |
children | 34dfc9747f23 |
rev | line source |
---|---|
331 | 1 LWASM Internals |
2 =============== | |
3 | |
4 LWASM is a table-driven assembler that notionally uses two passes. However, | |
5 it implements its assembly in several passes as follows. | |
6 | |
333
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
7 Pass 1 |
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
8 ------ |
331 | 9 |
333
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
10 This pass reads the entire source code and parses each line into an internal |
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
11 representation. Macros, file inclusions, and conditional assembly |
363
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
338
diff
changeset
|
12 instructions are resolved at this point as well. Instructions with known |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
338
diff
changeset
|
13 sizes will have their sizes resolved at this point. |
333
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
14 |
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
15 Pass 2 |
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
16 ------ |
331 | 17 |
363
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
338
diff
changeset
|
18 Check all exported symbols for validity and set them as imports if the |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
338
diff
changeset
|
19 assembler state says so. Also resolve all symbol references in all |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
338
diff
changeset
|
20 expressions to be direct references either to the symbol table or |
d96c30e60ddf
Added pass2 and various supporting logic including symbol lookups
lost@starbug
parents:
338
diff
changeset
|
21 to the import list. |
331 | 22 |
333
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
23 Pass 3 |
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
24 ------ |
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
25 |
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
26 This pass resolves all instruction sizes that can be resolved without |
365 | 27 forcing any instruction sizes. This pass will run repeatedly until no |
28 no new resolution occurs. | |
331 | 29 |
333
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
30 Pass 4 |
ebff3a3e8fa6
Updated internals to describe the multi-pass architecture
lost
parents:
331
diff
changeset
|
31 ------ |
331 | 32 |
365 | 33 Work through all un-resolved instructions and force sizes. After each size |
34 is forced, try re-resolving all other instructions. This is done starting | |
35 at the beginning of the source and working forward. If any instruction does | |
36 not resolve when forced, an error will be thrown. |