[hackers] [scc] Update IR documentation || Roberto E. Vargas Caballero
commit b54555847db093e24321a8d628e9a2f0f3fdb888
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Sep 23 20:39:05 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Sep 23 20:39:05 2015 +0200
Update IR documentation
diff --git a/cc1/ir.md b/cc1/ir.md
index 1d7630d..c39eabe 100644
--- a/cc1/ir.md
+++ b/cc1/ir.md
_AT_@ -107,11 +107,11 @@ will generate
> G6 F3 printf
> {
> A7 P cmd
-> -
+> \
> }
Again, the front end must ensure that '{' appears only after the
-declaration of a function. The character '-' marks the separation
+declaration of a function. The character '\' marks the separation
between parameters and local variables:
> int printf(register char *cmd) {int i;};
_AT_@ -122,7 +122,7 @@ will generate
> G6 F3 printf
> {
> R7 P cmd
-> -
+> \
> A8 I i
> }
_AT_@ -187,7 +187,7 @@ Constants are introduced by the character '#'. For example 10 is
translated to #IA (all the constants are emitted in hexadecimal),
where I indicates that is an integer constant. Strings represent
a special case because they are represented with the " character.
-The constant "hello" is emiited as "68656C6C6F. Example:
+The constant "hello" is emitted as "68656C6C6F. Example:
> int
> main(void)
_AT_@ -201,15 +201,14 @@ generates:
> F1
> G1 F1 main
> {
-> -
+> \
> A2 I i
> A3 I j
> A2 A3 #I6 +I :I
> }
-A special case of expressions are casts, which are indicated using
-two type descriptors together. For example a cast from char to int
-is indicated with CI.
+Casting are expressed with the letter 'g' followed of the type
+involved in the cast.
### Statements ###
#### Jumps #####
_AT_@ -234,7 +233,7 @@ generates:
> F1
> G1 F1 main
> {
-> -
+> \
> A2 I i
> j L3
> L3
_AT_@ -256,7 +255,7 @@ produces:
> F1
> G1 F1 main
> {
-> -
+> \
> r #I10
> }
_AT_@ -297,7 +296,7 @@ generates:
> G1 F2 func
> {
> A1 I n
-> -
+> \
> s L4 A1 #I1 +
> L5
> L6
_AT_@ -349,7 +348,7 @@ switch.
* L -- label
* { -- end of function body
* } -- end of fucntion body
-* - -- end of function parameters
+* \ -- end of function parameters
* + -- addition
* - -- substraction
* * -- multiplication
_AT_@ -375,6 +374,7 @@ switch.
* , -- comma operator
* ? -- ternary operator
* ' -- take address
+* g -- casting
* a -- logical shortcut and
* o -- logical shortcut or
* _AT_ -- content of pointer
Received on Wed Sep 23 2015 - 20:42:21 CEST
This archive was generated by hypermail 2.3.0
: Wed Sep 23 2015 - 20:48:11 CEST