Do GDC front end emit C / C ++ intermediate code?

When learning the D language, I came across GDC, the D compiler for GCC. I downloaded the MinGW version from here:

http://sourceforge.net/projects/dgcc/files/

The documentation was almost nonexistent, but it said that most of the command line switches were the same as for the GCC compiler. However, this does not help much, since I usually do not build with GCC.

GDC is described as "GCC front end". This makes me think that at some point it should generate intermediate C ++ or C, which the GCC compiler can actually learn. I believe this is how GCC compiles Objective-C programs.

What I want to know is: is there a way to get GDC to emit C / C ++ intermediate code as files that I can check and compile manually with GCC / MinGW?

+4
source share
3 answers

No.

The fronts for GCC generate a language-independent representation, which is then compiled directly to the assembly. This applies to C, C ++, Obj-C, D, Fortran, Java, Ada, and other interfaces. There is no intermediate representation of C or C ++, and it cannot be generated.

+8
source

The quick answer is no.

From what I know about GCC, it uses abstract syntax trees for language independent code representation, which is passed from the front-end to the background. Theoretically, it may be possible to "decompile" this AST code in C / C ++, but the AFAIK GCC package does not implement this.

+5
source

Basically, you need a gcc back-end that generates C / C ++ as its target platform, not x86. This is entirely possible, but I do not know about the implementation that does this. By the way, if one exists, the output may not be very readable.

+3
source

All Articles