@@ -14,33 +14,46 @@ bool bpf_ir_value_equal(struct ir_value a, struct ir_value b)
1414 CRITICAL ("Error" );
1515}
1616
17+ static struct ir_value value_base (void )
18+ {
19+ // Create a new value
20+ return (struct ir_value ){ .type = IR_VALUE_UNDEF ,
21+ .raw_pos = { .valid = false },
22+ .const_type = IR_ALU_UNKNOWN ,
23+ .builtin_const = IR_BUILTIN_NONE };
24+ }
25+
1726struct ir_value bpf_ir_value_insn (struct ir_insn * insn )
1827{
19- return (struct ir_value ){ .type = IR_VALUE_INSN ,
20- .data .insn_d = insn ,
21- .raw_pos = { .valid = false } };
28+ struct ir_value v = value_base ();
29+ v .type = IR_VALUE_INSN ;
30+ v .data .insn_d = insn ;
31+ return v ;
2232}
2333
2434struct ir_value bpf_ir_value_undef (void )
2535{
26- return (struct ir_value ){ .type = IR_VALUE_UNDEF ,
27- .raw_pos = { .valid = false } };
36+ struct ir_value v = value_base ();
37+ v .type = IR_VALUE_UNDEF ;
38+ return v ;
2839}
2940
3041struct ir_value bpf_ir_value_const32 (s32 val )
3142{
32- return (struct ir_value ){ .type = IR_VALUE_CONSTANT ,
33- .data .constant_d = val ,
34- .const_type = IR_ALU_32 ,
35- .raw_pos = { .valid = false } };
43+ struct ir_value v = value_base ();
44+ v .type = IR_VALUE_CONSTANT ;
45+ v .data .constant_d = val ;
46+ v .const_type = IR_ALU_32 ;
47+ return v ;
3648}
3749
3850struct ir_value bpf_ir_value_const64 (s64 val )
3951{
40- return (struct ir_value ){ .type = IR_VALUE_CONSTANT ,
41- .data .constant_d = val ,
42- .const_type = IR_ALU_64 ,
43- .raw_pos = { .valid = false } };
52+ struct ir_value v = value_base ();
53+ v .type = IR_VALUE_CONSTANT ;
54+ v .data .constant_d = val ;
55+ v .const_type = IR_ALU_64 ;
56+ return v ;
4457}
4558
4659struct ir_address_value bpf_ir_addr_val (struct ir_value value , s16 offset )
0 commit comments