I've been looking at LLVM as a possible back end for Felix.
Unfortunately it seems too C-centric.

The basic problem is that LLVM abstracts parameter passing conventions,
and provide only one way to transfer control; subroutine call.

The requirement for a decent machine is PDP-11 branch and link instruction.
This puts the "return address" into a register. We also need indirect jump,
or jump to register. This allows control transfer globally without mentioning
the evil stack.

I think this can be "fixed" by a target specific parameter calling convention,
however that means writing a back end for every processor, defeating
the hoped for utility.

C has the same problem. Felix gets around it using assembler jumps,
and hacking up switches in-lieu of computed gotos. Then it returns
the usual way from a procedure to the scheduler which resumes something
else as required.

The problem is that this only works for top level procedures, not functions,
because functions use the machine stack for the return address.
Apart from FFI issues, there's a performance reason for this:
nested function calls form a single expression tree which is easy
to analyse recursively with pattern matching.

Three adress code (all procedures) requires pointers to temporary
store and is required data flow analysis to analyse in general
(even if using single assignments, i.e. linear types). In turn this
is very hard if not impossible in complex code to analyse correctly,
and would also kill the compiler performance since in general
data flow is O(N^3).

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to