Pass a const rtx_insn * to memory_modified_in_insn_p.
Updates an internal GCC function to accept constant instruction pointers.
This commit refactors the memory_modified_in_insn_p function in GCC’s alias analysis module to accept a const rtx_insn * pointer. This change improves type correctness by indicating that the function does not modify the instruction it inspects. Corresponding adjustments are made in calling functions, including casts to const rtx_insn *, ensuring consistency across the codebase.
In Details
The memory_modified_in_insn_p function, located in alias.cc and used for alias analysis, is updated to accept a const rtx_insn * parameter. This change reflects that the function only inspects the instruction and does not modify it, thereby improving the const-correctness of the compiler's internal API. The function modified_in_p in rtlanal.cc, which calls memory_modified_in_insn_p, is also updated with an appropriate cast. The declaration in rtl.h is similarly updated.
- RTL
- Register Transfer Language, an intermediate representation used by GCC to describe the state of computations between passes, reflecting machine registers and operations.
- rtx_insn
- An internal GCC data structure representing a machine instruction within the RTL representation.
- alias analysis
- A compiler optimization technique that determines whether different memory references might be referring to the same memory location, helping to enable optimizations like reordering or parallelization.
- const-correctness
- A programming practice that uses the
constkeyword to ensure that data is not accidentally modified, improving code safety and clarity.