[LLVMdev] dragon egg + llvm for fortran to c translation

Óscar Fuentes ofv at wanadoo.es
Fri Mar 1 07:58:31 PST 2013

Philipp Schwaha <philipp at schwaha.net> writes:

> I would like to know if it is feasible to use the dragon egg gcc
> plugin to automatically convert fortran code to c. Having found that
> it is possible to output llvm byte code back to c (at least something
> like this gave me this impression/hope: llc -march=c -o test.c) I am
> hoping to use dragon egg to generate the byte code from fortran 90
> which than output to c.

The C backend was removed from LLVM some time ago, so your llc recipe
won't work with a recent or development version. Some people showed
interest on resurrecting the C backend but so far it didn't materialize.

> Does this seem feasible at all?

Feasible? yes. Practical? I don't think so. But that depends on your
specific goals, of course.

> How much in terms of variable names
> etc. could be retained in this manner?

I don't think that the resulting C code would be pleasant to read, and
most of the original Fortran names (except perhaps for function names)
would be lost.

More information about the llvm-dev mailing list