On 14/01/14 13:44, Brian Drummond wrote:
There was partial support for nested functions (and taking their
addresses via trampolines) in LLVM 2.2 and 2.4, for x86 and x86_64
targets, according to
http://llvm.org/releases/2.4/docs/ReleaseNotes.html
but I can't find more recent info atm...
Hi Brian,
I'd avoid the use of the LLVM trampoline intrinsics if possible: when I
last looked at them they were a poorly supported hack to make GCC's
nested function extension work with the dragonegg plugin. They're not
particularly portable either: IIRC they require you to allocate an
undocumented and platform-specific sized array on the stack to construct
the trampoline in.
A common way to implement closures, nested functions, etc. in LLVM IR is
to pass an extra argument which is a structure containing pointers to or
copies of the parent's lexical environment. You can then use a chain of
structures for arbitrary levels of function nesting.
Nick
_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss