> Apart from the MEM construction where I simply trust you this looks
> ok. Mind adding MEM_REF support for this case as well?
Do you mean MEM_REF <INTEGER_CST, INTEGER_CST>? Is that possible?
> Btw, why's simply output_constant_def (TREE_OPERAND (target, 0), 1);
> not correct?
If you do that, you get a symbol in the constant pool whose value (address) is
arbitrary; here what we want is a fixed value. That being said, given that
the contents of the contant pool is hashed, there is very likely not much
difference in the end, although that would be conceptually incorrect.
> Isn't this about &*0x1?
Yes, it's not the address of a constant, it's the address of an object whose
base address is absolute, so &(abs_address)->field[index]. This kind of thing
is not folded by build_fold_addr_expr.