1

This question is a bit quaint, but I'm having difficulty finding the answer in this section of the manual.

If I dump the SSA of a C program into a file, like:

~$ gcc -fdump-tree-ssa program_name.c

How do I execute from the ssa intermediate representation directly? If this can't be done through gcc, then I would be curious how to compile the .ssa dump. I presume it can't be done through LLVM because gcc uses a different IR.


For comparison, it can be done in clang/llvm simply enough with:

~$ lli program_name_clangbit

...assuming one compiles with something like:

~$ clang program_name.c -S -emit-llvm -o program_name_clangbit

d0rmLife
  • 4,112
  • 7
  • 24
  • 33
  • Did you just answer your own question? Or do you mean to use gcc to run the intermediate version? – Jesus Ramos Mar 21 '13 at 20:40
  • LLVM does not interpret `.c.????.ssa` file extensions as far as I know, so no. In other words, `~$ lli program_name.c.????.ssa` outputs an error. – d0rmLife Mar 21 '13 at 20:43
  • Then your last sentence is misleading. You ask how to do it and then you say for comparison it can be done in llvm this way. You may want to clear that up. – Jesus Ramos Mar 21 '13 at 20:44
  • I doubt that is possible with gcc; the intermediate representation of gcc was never meant to be an executable bytecode, as opposed to llvm bytecode which was designed with the ability to be interpreted by a virtual machine in mind. – fuz Mar 21 '13 at 20:48
  • @JesusRamos Okay, I clarified it, thanks! But fyi `~$ gcc -fdump...` wouldn't output a file with a blank extension! :) – d0rmLife Mar 21 '13 at 20:49
  • @FUZxxl But doesn't gcc generates code from its IR? Therefore it seems possible – d0rmLife Mar 21 '13 at 20:50
  • 1
    @d0rmLife You said "execute [...] directly". You did not say "compile to native code, then execute". – fuz Mar 21 '13 at 20:51
  • @FUZxxl Touche... I suppose if it is *actually impossible*, then that is an alright alternative. My wording lacks precision, it seems. Apologies. – d0rmLife Mar 21 '13 at 20:53
  • @d0rmLife I'm sorry if that appears to be nitpicking. It's just hard as hell to answer a question that is vague or does not represent what the OP actually wants to know. If you want to have a good answer, the best question is to ask how to do what you want, not how to do something that might (over several indirections) archieve what you want. – fuz Mar 21 '13 at 20:59
  • @FUZxxl No worries, I clarified it again. – d0rmLife Mar 21 '13 at 21:02

0 Answers0