Treehydra: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 7: Line 7:


First configure/build GCC as specified in [[MDC:Dehydra GCC|Dehydra build instructions]]
First configure/build GCC as specified in [[MDC:Dehydra GCC|Dehydra build instructions]]
Then do:
make install
Apply the gty patch:
hg qpush -a


GTY stuff is applied after building because it allows the conversion script to see GTYs as attributes, but it is not recommended to build gcc with it because gengtype hasn't been modified for this yet.
Emacs regexp to convert GTYs to attributes:
^\(typedef \)?\(struct\) \([^ ]+\) \(GTY[^{]+\) -> \1\2 \4 \3)


===treehydra===
===treehydra===

Revision as of 16:36, 18 March 2008

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