@@ -48,12 +48,6 @@ typedef __u64 u64;
4848struct custom_pass_cfg ;
4949struct builtin_pass_cfg ;
5050
51- struct bpf_ir_raw_opts {
52- u32 enable_bpf_ir ;
53- char pass_opt [300 ];
54- char global_opt [200 ];
55- };
56-
5751struct bpf_ir_opts {
5852 // Enable debug mode
5953 bool debug ;
@@ -841,6 +835,22 @@ struct ir_insn *bpf_ir_create_allocarray_insn_bb(struct bpf_ir_env *env,
841835 enum ir_vr_type type , u32 num ,
842836 enum insert_position pos );
843837
838+ struct ir_insn * bpf_ir_create_loadimmextra_insn (
839+ struct bpf_ir_env * env , struct ir_insn * pos_insn ,
840+ enum ir_loadimm_extra_type load_ty , s64 imm , enum insert_position pos );
841+
842+ struct ir_insn * bpf_ir_create_loadimmextra_insn_bb (
843+ struct bpf_ir_env * env , struct ir_basic_block * pos_bb ,
844+ enum ir_loadimm_extra_type load_ty , s64 imm , enum insert_position pos );
845+
846+ struct ir_insn * bpf_ir_create_loadimmextra_insn_cg (
847+ struct bpf_ir_env * env , struct ir_insn * pos_insn ,
848+ enum ir_loadimm_extra_type load_ty , s64 imm , enum insert_position pos );
849+
850+ struct ir_insn * bpf_ir_create_loadimmextra_insn_bb_cg (
851+ struct bpf_ir_env * env , struct ir_basic_block * pos_bb ,
852+ enum ir_loadimm_extra_type load_ty , s64 imm , enum insert_position pos );
853+
844854struct ir_insn * bpf_ir_create_getelemptr_insn (struct bpf_ir_env * env ,
845855 struct ir_insn * pos_insn ,
846856 struct ir_insn * alloca_insn ,
@@ -853,6 +863,17 @@ struct ir_insn *bpf_ir_create_getelemptr_insn_bb(struct bpf_ir_env *env,
853863 struct ir_value offset ,
854864 enum insert_position pos );
855865
866+ struct ir_insn * bpf_ir_create_getelemptr_insn_cg (struct bpf_ir_env * env ,
867+ struct ir_insn * pos_insn ,
868+ struct ir_insn * alloca_insn ,
869+ struct ir_value offset ,
870+ enum insert_position pos );
871+
872+ struct ir_insn * bpf_ir_create_getelemptr_insn_bb_cg (
873+ struct bpf_ir_env * env , struct ir_basic_block * pos_bb ,
874+ struct ir_insn * alloca_insn , struct ir_value offset ,
875+ enum insert_position pos );
876+
856877struct ir_insn * bpf_ir_create_store_insn (struct bpf_ir_env * env ,
857878 struct ir_insn * pos_insn ,
858879 struct ir_insn * insn ,
@@ -1066,6 +1087,7 @@ void remove_trivial_phi(struct bpf_ir_env *env, struct ir_function *fun,
10661087void add_counter (struct bpf_ir_env * env , struct ir_function * fun , void * param );
10671088
10681089extern const struct builtin_pass_cfg bpf_ir_kern_add_counter_pass ;
1090+ extern const struct builtin_pass_cfg bpf_ir_kern_optimization_pass ;
10691091
10701092void translate_throw (struct bpf_ir_env * env , struct ir_function * fun ,
10711093 void * param );
@@ -1074,7 +1096,7 @@ struct function_pass {
10741096 void (* pass )(struct bpf_ir_env * env , struct ir_function * , void * param );
10751097
10761098 bool enabled ;
1077- bool non_overridable ;
1099+ bool force_enable ;
10781100 char name [BPF_IR_MAX_PASS_NAME_SIZE ];
10791101};
10801102
@@ -1119,14 +1141,19 @@ struct builtin_pass_cfg {
11191141 .param_load = param_loadc, \
11201142 .param_unload = param_unloadc }
11211143
1144+ #define DEF_BUILTIN_PASS_ENABLE_CFG (namec , param_loadc , param_unloadc ) \
1145+ { .name = namec, \
1146+ .param = NULL, \
1147+ .enable = true, \
1148+ .enable_cfg = false, \
1149+ .param_load = param_loadc, \
1150+ .param_unload = param_unloadc }
1151+
11221152#define DEF_FUNC_PASS (fun , msg , en_def ) \
1123- { .pass = fun, \
1124- .name = msg, \
1125- .enabled = en_def, \
1126- .non_overridable = false }
1153+ { .pass = fun, .name = msg, .enabled = en_def, .force_enable = false }
11271154
1128- #define DEF_NON_OVERRIDE_FUNC_PASS (fun , msg , en_def ) \
1129- { .pass = fun, .name = msg, .enabled = en_def , .non_overridable = true }
1155+ #define DEF_NON_OVERRIDE_FUNC_PASS (fun , msg ) \
1156+ { .pass = fun, .name = msg, .enabled = true , .force_enable = true }
11301157
11311158/* Passes End */
11321159
@@ -1245,8 +1272,8 @@ void bpr_ir_cg_to_cssa(struct bpf_ir_env *env, struct ir_function *fun,
12451272
12461273/* Kern Utils Start */
12471274
1248- int bpf_ir_init_opts (struct bpf_ir_env * env , const char * pass_opt ,
1249- const char * global_opt );
1275+ int bpf_ir_init_opts (struct bpf_ir_env * env , const char * global_opt ,
1276+ const char * pass_opt );
12501277
12511278bool bpf_ir_builtin_pass_enabled (struct bpf_ir_env * env , const char * pass_name );
12521279
0 commit comments