| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
#ifndef LP_BLD_IR_COMMON_H |
| 30 |
#define LP_BLD_IR_COMMON_H |
| 31 |
|
| 32 |
#ifdef __cplusplus |
| 33 |
extern "C" { |
| 34 |
#endif |
| 35 |
|
| 36 |
#include <llvm-c/Core.h> |
| 37 |
#include "gallivm/lp_bld_limits.h" |
| 38 |
|
| 39 |
struct gallivm_state; |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
#define LP_MAX_NUM_FUNCS 33 |
| 44 |
|
| 45 |
enum lp_exec_mask_break_type { |
| 46 |
LP_EXEC_MASK_BREAK_TYPE_LOOP, |
| 47 |
LP_EXEC_MASK_BREAK_TYPE_SWITCH |
| 48 |
}; |
| 49 |
|
| 50 |
struct lp_exec_mask { |
| 51 |
struct lp_build_context *bld; |
| 52 |
|
| 53 |
bool has_mask; |
| 54 |
bool ret_in_main; |
| 55 |
|
| 56 |
LLVMTypeRef int_vec_type; |
| 57 |
|
| 58 |
LLVMValueRef exec_mask; |
| 59 |
|
| 60 |
LLVMValueRef ret_mask; |
| 61 |
LLVMValueRef cond_mask; |
| 62 |
LLVMValueRef switch_mask; |
| 63 |
LLVMValueRef cont_mask; |
| 64 |
LLVMValueRef break_mask; |
| 65 |
|
| 66 |
struct function_ctx { |
| 67 |
int pc; |
| 68 |
LLVMValueRef ret_mask; |
| 69 |
|
| 70 |
LLVMValueRef cond_stack[LP_MAX_TGSI_NESTING]; |
| 71 |
int cond_stack_size; |
| 72 |
|
| 73 |
|
| 74 |
enum lp_exec_mask_break_type break_type_stack[LP_MAX_TGSI_NESTING]; |
| 75 |
enum lp_exec_mask_break_type break_type; |
| 76 |
|
| 77 |
struct { |
| 78 |
LLVMValueRef switch_val; |
| 79 |
LLVMValueRef switch_mask; |
| 80 |
LLVMValueRef switch_mask_default; |
| 81 |
bool switch_in_default; |
| 82 |
unsigned switch_pc; |
| 83 |
} switch_stack[LP_MAX_TGSI_NESTING]; |
| 84 |
int switch_stack_size; |
| 85 |
LLVMValueRef switch_val; |
| 86 |
LLVMValueRef switch_mask_default; |
| 87 |
bool switch_in_default; |
| 88 |
unsigned switch_pc; |
| 89 |
|
| 90 |
LLVMBasicBlockRef loop_block; |
| 91 |
LLVMValueRef break_var; |
| 92 |
struct { |
| 93 |
LLVMBasicBlockRef loop_block; |
| 94 |
LLVMValueRef cont_mask; |
| 95 |
LLVMValueRef break_mask; |
| 96 |
LLVMValueRef break_var; |
| 97 |
} loop_stack[LP_MAX_TGSI_NESTING]; |
| 98 |
int loop_stack_size; |
| 99 |
int bgnloop_stack_size; |
| 100 |
|
| 101 |
} *function_stack; |
| 102 |
int function_stack_size; |
| 103 |
}; |
| 104 |
|
| 105 |
struct lp_build_mask_context; |
| 106 |
|
| 107 |
void lp_exec_mask_function_init(struct lp_exec_mask *mask, int function_idx); |
| 108 |
void lp_exec_mask_init(struct lp_exec_mask *mask, struct lp_build_context *bld); |
| 109 |
void lp_exec_mask_fini(struct lp_exec_mask *mask); |
| 110 |
void lp_exec_mask_store(struct lp_exec_mask *mask, |
| 111 |
struct lp_build_context *bld_store, |
| 112 |
LLVMValueRef val, |
| 113 |
LLVMValueRef dst_ptr); |
| 114 |
void lp_exec_mask_update(struct lp_exec_mask *mask); |
| 115 |
void lp_exec_bgnloop_post_phi(struct lp_exec_mask *mask); |
| 116 |
void lp_exec_bgnloop(struct lp_exec_mask *mask, bool load_mask); |
| 117 |
void lp_exec_endloop(struct gallivm_state *gallivm, |
| 118 |
struct lp_exec_mask *exec_mask, |
| 119 |
struct lp_build_mask_context *mask); |
| 120 |
void lp_exec_mask_cond_push(struct lp_exec_mask *mask, |
| 121 |
LLVMValueRef val); |
| 122 |
void lp_exec_mask_cond_invert(struct lp_exec_mask *mask); |
| 123 |
void lp_exec_mask_cond_pop(struct lp_exec_mask *mask); |
| 124 |
void lp_exec_continue(struct lp_exec_mask *mask); |
| 125 |
|
| 126 |
void lp_exec_break(struct lp_exec_mask *mask, int *pc, bool break_always); |
| 127 |
|
| 128 |
#ifdef __cplusplus |
| 129 |
} |
| 130 |
#endif |
| 131 |
|
| 132 |
#endif |