Fix gimple guide

This commit is contained in:
Guillaume Gomez 2023-09-06 15:20:08 +02:00 committed by GitHub
parent b6ccb55f56
commit d214df291c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,7 @@ also add the calls we need to generate the GIMPLE:
int main() { int main() {
gcc_jit_context *ctxt = gcc_jit_context_acquire(); gcc_jit_context *ctxt = gcc_jit_context_acquire();
create_code(ctxt, NULL); create_code(ctxt, NULL);
gcc_jit_context_compile_to_file(ctxt, GCC_JIT_OUTPUT_KIND_DYNAMIC_LIBRARY, "tmp"); gcc_jit_context_dump_to_file(ctxt, "tmp.gimple", 1);
return 0; return 0;
} }
``` ```
@ -42,16 +42,16 @@ int main() {
Then we can compile it by using: Then we can compile it by using:
```console ```console
gcc const.c -I `pwd`/gcc/gcc/jit/ -L `pwd`/gcc-build/gcc -lgccjit -o out gcc local.c -I `pwd`/gcc/gcc/jit/ -L `pwd`/gcc-build/gcc -lgccjit -o out
``` ```
And finally when you run it: And finally when you run it:
```console ```console
LD_LIBRARY_PATH=`pwd`/gcc-build/gcc ./out LD_LIBRARY_PATH=`pwd`/gcc-build/gcc LIBRARY_PATH=`pwd`/gcc-build/gcc ./out
``` ```
It should display: You should now have a file named `tmp.gimple` which contains:
```c ```c
__attribute__((const)) __attribute__((const))