In commit 48bda7573 ("let struct access_data use a single type"), the members result_type & source_type have been replaced by an unique member 'type', mainly because the role of these members and when they needed to be updated was not clear at all. Now that the situation is much clearer, the second member, used to hold the base type of bitfields, can be put back as it avoid to have to call bitfield_base_type() multiple time. Put back this member into struct access_data and use when appropriate (which remove the now unneeded calls to bitfield_base_type()). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- linearize.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/linearize.c b/linearize.c index e8d145a70..9a6fd250a 100644 --- a/linearize.c +++ b/linearize.c @@ -878,6 +878,7 @@ pseudo_t alloc_phi(struct basic_block *source, pseudo_t pseudo, struct symbol *t */ struct access_data { struct symbol *type; // ctype + struct symbol *btype; // base type of bitfields pseudo_t address; // pseudo containing address .. unsigned int offset; // byte offset }; @@ -934,14 +935,13 @@ static int linearize_address_gen(struct entrypoint *ep, static pseudo_t add_load(struct entrypoint *ep, struct access_data *ad) { - struct symbol *btype = bitfield_base_type(ad->type); struct instruction *insn; pseudo_t new; if (!ep->active) return VOID; - insn = alloc_typed_instruction(OP_LOAD, btype); + insn = alloc_typed_instruction(OP_LOAD, ad->btype); new = alloc_pseudo(insn); insn->target = new; @@ -959,7 +959,7 @@ static void add_store(struct entrypoint *ep, struct access_data *ad, pseudo_t va if (!bb) return; - store = alloc_typed_instruction(OP_STORE, bitfield_base_type(ad->type)); + store = alloc_typed_instruction(OP_STORE, ad->btype); store->offset = ad->offset; use_pseudo(store, value, &store->target); use_pseudo(store, ad->address, &store->src); @@ -990,12 +990,13 @@ static pseudo_t linearize_store_gen(struct entrypoint *ep, struct access_data *ad) { struct symbol *ctype = ad->type; - struct symbol *btype = bitfield_base_type(ctype); + struct symbol *btype; pseudo_t store = value; if (!ep->active) return VOID; + btype = ad->btype = bitfield_base_type(ctype); if (type_size(btype) != type_size(ctype)) { pseudo_t orig = add_load(ep, ad); store = linearize_bitfield_insert(ep, orig, value, ctype, btype); @@ -1079,12 +1080,13 @@ static pseudo_t linearize_bitfield_extract(struct entrypoint *ep, static pseudo_t linearize_load_gen(struct entrypoint *ep, struct access_data *ad) { struct symbol *ctype = ad->type; - struct symbol *btype = bitfield_base_type(ctype); + struct symbol *btype; pseudo_t new; if (!ep->active) return VOID; + btype = ad->btype = bitfield_base_type(ctype); new = add_load(ep, ad); if (ctype->bit_size != type_size(btype)) new = linearize_bitfield_extract(ep, new, ctype, btype); -- 2.18.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html