... | ... | @@ -35,6 +35,11 @@ You can break at a specific traversal or subphase using `-b phaseid:travid` |
|
|
These compiler phases are also numbered.
|
|
|
You can also break at a compiler phase using the number.
|
|
|
|
|
|
You can get debug messages for the entire compiler by using the `-#d` flag.
|
|
|
If you want to only get messages for a certain compiler phase you can specify the debug prefix of the messages you want to see `-#d,EX` for a traversal with `#define DBUG_PREFIX "EX"`.
|
|
|
This will hopefully be more clear in the next section when you actually see the code of a traversal.
|
|
|
|
|
|
|
|
|
# Step 0: Consider at which point your traversal should be added
|
|
|
|
|
|
Look at the already existing traversals.
|
... | ... | @@ -220,7 +225,7 @@ Because this is the minimum amount of code just to test if you did everything co |
|
|
To make this template your own you need to fix to include the correct header instead of `example_traversal.h` and replace the ``EX` traversal id with your traversal id: `:%s/EX/FOO`.
|
|
|
Make sure the functions match up with the functions match up with the functions in the header file.
|
|
|
|
|
|
Once this works you can copy the actual template below:
|
|
|
Once this works you can copy the template below:
|
|
|
There is also a template for your traversal `.c` file, here it is:
|
|
|
|
|
|
```c
|
... | ... | @@ -328,7 +333,7 @@ TEMPmodule (node *arg_node, info *arg_info) |
|
|
{
|
|
|
DBUG_ENTER ();
|
|
|
|
|
|
FUNDEF_NEXT (arg_node) = TRAVopt(FUNDEF_NEXT (arg_node), arg_info);
|
|
|
MODULE_FUNS (arg_node) = TRAVopt (MODULE_FUNS (arg_node), arg_info);
|
|
|
|
|
|
DBUG_RETURN (arg_node);
|
|
|
}
|
... | ... | @@ -340,7 +345,9 @@ node * |
|
|
TEMPfundef (node *arg_node, info *arg_info)
|
|
|
{
|
|
|
DBUG_ENTER ();
|
|
|
|
|
|
|
|
|
DBUG_PRINT("Traversing %s in TEMP\n", FUNDEF_NAME(arg_node));
|
|
|
// FUNDEF_BODY (arg_node) = TRAVopt(FUNDEF_BODY (arg_node), arg_info);
|
|
|
FUNDEF_NEXT (arg_node) = TRAVopt(FUNDEF_NEXT (arg_node), arg_info);
|
|
|
|
|
|
DBUG_RETURN (arg_node);
|
... | ... | |