1 /* 2 * Copyright © 2024 Imagination Technologies Ltd. 3 * 4 * SPDX-License-Identifier: MIT 5 */ 6 7 #ifndef PCO_H 8 #define PCO_H 9 10 /** 11 * \file pco.h 12 * 13 * \brief Main compiler interface header. 14 */ 15 16 #include "compiler/nir/nir.h" 17 18 /* Defines. */ 19 #define PCO_REG_UNUSED (~0U) 20 21 /* Driver-specific forward-declarations. */ 22 struct pvr_device_info; 23 24 /* Compiler-specific forward-declarations. */ 25 typedef struct _pco_shader pco_shader; 26 typedef struct _pco_ctx pco_ctx; 27 typedef struct _pco_data pco_data; 28 29 pco_ctx *pco_ctx_create(const struct pvr_device_info *dev_info, void *mem_ctx); 30 const struct spirv_to_nir_options *pco_spirv_options(pco_ctx *ctx); 31 const nir_shader_compiler_options *pco_nir_options(pco_ctx *ctx); 32 33 void pco_preprocess_nir(pco_ctx *ctx, nir_shader *nir); 34 void pco_link_nir(pco_ctx *ctx, nir_shader *producer, nir_shader *consumer); 35 void pco_rev_link_nir(pco_ctx *ctx, nir_shader *producer, nir_shader *consumer); 36 void pco_lower_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data); 37 void pco_postprocess_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data); 38 39 pco_shader * 40 pco_trans_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data, void *mem_ctx); 41 void pco_process_ir(pco_ctx *ctx, pco_shader *shader); 42 43 void pco_encode_ir(pco_ctx *ctx, pco_shader *shader); 44 void pco_shader_finalize(pco_ctx *ctx, pco_shader *shader); 45 46 pco_data *pco_shader_data(pco_shader *shader); 47 48 unsigned pco_shader_binary_size(pco_shader *shader); 49 const void *pco_shader_binary_data(pco_shader *shader); 50 51 void pco_validate_shader(pco_shader *shader, const char *when); 52 53 void pco_print_shader(pco_shader *shader, FILE *fp, const char *when); 54 void pco_print_binary(pco_shader *shader, FILE *fp, const char *when); 55 #endif /* PCO_H */ 56