crossbridge-community / crossbridge

C/C++ Compiler for the ActionScript Virtual Machine (AVM2)
http://sourceforge.net/projects/crossbridge-community/
Other
151 stars 35 forks source link

[Master] --save-temps on -O0 #47

Closed JoeDupuis closed 10 years ago

JoeDupuis commented 10 years ago

--save-temps successfully output the as3 code on -O4, but doesn't seem to do so on -O0. There is a --emit-as3 flag too, but it seems to be the counter part to --emit-llvm. It does not seem to output any as3. I can see as3 file being generated in /tmp. If I kill the compilation process mid way I can access those, else they get deleted.

I think the --save-temps should output the action script code that was use to generate the final action script bytecode since it is very valuable when debugging.

vpmedia commented 10 years ago

I take a look at this issue, i think the internal tool execution if different when using O4 vs O0, so it's not handled in both parts

vpmedia commented 10 years ago

Some information about how the compiler works: https://github.com/adobe-flash/crossbridge/blob/futures/overview_of_compiler_stages.md (Its for futures clang version but its helpful for gcc/master too)

vpmedia commented 10 years ago

I've checked and the following example produces the debug .as sources (you can check it in the makefile):

# Assembling BitCode Output (BC)
cd $(BUILD)/test_hello_c && $(SDK_CC) -c -g -O0 $(SRCROOT)/test/hello.c -emit-llvm -o hello.bc
# Assembling ABC Output (OBJ)
cd $(BUILD)/test_hello_c && $(SDK)/usr/bin/llc -jvm="$(JAVA)" hello.bc -o hello.abc -filetype=obj
# Assembling AS3 Output (ASM)
cd $(BUILD)/test_hello_c && $(SDK)/usr/bin/llc -jvm="$(JAVA)" hello.bc -o hello.as -filetype=asm
# Assembling SWF Output
cd $(BUILD)/test_hello_c && $(SDK_CC) -save-temps -emit-swf -swf-size=320x240 -O0 -g hello.abc -o hello.swf
JoeDupuis commented 10 years ago

By reading the blog I saw that there is a -S flag for gcc that allow the output of assembly code (in this case, the AS3 file I needed).

I am not sure if we should modify --save-temps to output assembly (AS3) on -o0, or just let it be and close the issue, since we can get the information needed anyway.

vpmedia commented 10 years ago

I'm closing this. I'll try to put some examples together using save-temps.