diff options
author | Marek Olšák <[email protected]> | 2018-07-04 01:11:47 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-07-04 15:48:18 -0400 |
commit | 0075e5fed8ae0e33b29a7b99bcdb0f480846d8b1 (patch) | |
tree | f7f8e26f811d68c26c77c68037d850d3d353ddbd /src/amd/common/ac_binary.h | |
parent | c2ae9b4052701f8fde47947acb9ee47a878e1409 (diff) |
ac: add reusable helpers for direct LLVM compilation
This is basically LLVMTargetMachineEmitToMemoryBuffer inlined and reworked.
struct ac_compiler_passes (opaque type) contains the main pass manager.
ac_create_llvm_passes -- the result can go to thread local storage
ac_destroy_llvm_passes -- can be called by a destructor in TLS
ac_compile_module_to_binary -- from LLVMModuleRef to ac_shader_binary
The motivation is to do the expensive call addPassesToEmitFile once
per context or thread.
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/common/ac_binary.h')
-rw-r--r-- | src/amd/common/ac_binary.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/amd/common/ac_binary.h b/src/amd/common/ac_binary.h index 4bd86b939f1..735e3932055 100644 --- a/src/amd/common/ac_binary.h +++ b/src/amd/common/ac_binary.h @@ -27,6 +27,10 @@ #include <stdint.h> #include <stdbool.h> +#ifdef __cplusplus +extern "C" { +#endif + struct ac_shader_reloc { char name[32]; uint64_t offset; @@ -98,4 +102,8 @@ void ac_shader_binary_read_config(struct ac_shader_binary *binary, bool supports_spill); void ac_shader_binary_clean(struct ac_shader_binary *b); +#ifdef __cplusplus +} +#endif + #endif /* AC_BINARY_H */ |