Treehydra

From MozillaWiki
Revision as of 16:36, 18 March 2008 by Tglek (talk | contribs) (→‎GCC)
Jump to navigation Jump to search

Treehydra is a Dehydra_GCC extension to provide a low level view of the AST as it is seen in the GCC middle-end.

Building & Testing

GCC

Treehydra's C->JS conversion routines are generated by following the GCC's garbage collection GTY annotations on structs. Unfortunately, currently GTYs are not implemented as attributes and a separate parser is required for them. I patched GCC to rearrange GTY declarations on structs such that GTY can be defined as an attribute.

First configure/build GCC as specified in Dehydra build instructions

Emacs regexp to convert GTYs to attributes:

^\(typedef \)?\(struct\) \([^ ]+\) \(GTY[^{]+\) -> \1\2 \4 \3)

treehydra

Build treehydra:

make CXX=~/gcc/bin/g++  gcc_treehydra.so  

where CXX is the plugin-enabled compiler. It loads gcc_dehydra.so which generates C->JS conversion routines.

To test do

make PLUGIN=../gcc_treehydra.so tree -C test