GCC Middle and Back End API Reference
elim_table Struct Reference
Collaboration diagram for elim_table:

Data Fields

int from
int to
HOST_WIDE_INT previous_offset
HOST_WIDE_INT offset
bool can_eliminate
bool prev_can_eliminate
rtx from_rtx
rtx to_rtx
HOST_WIDE_INT initial_offset
int can_eliminate
int can_eliminate_previous
int ref_outside_mem

Detailed Description

Code for RTL register eliminations. Copyright (C) 2010-2013 Free Software Foundation, Inc. Contributed by Vladimir Makarov vmaka.nosp@m.rov@.nosp@m.redha.nosp@m.t.co.nosp@m.m.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. Eliminable registers (like a soft argument or frame pointer) are widely used in RTL. These eliminable registers should be replaced by real hard registers (like the stack pointer or hard frame pointer) plus some offset. The offsets usually change whenever the stack is expanded. We know the final offsets only at the very end of LRA.

Within LRA, we usually keep the RTL in such a state that the eliminable registers can be replaced by just the corresponding hard register (without any offset). To achieve this we should add the initial elimination offset at the beginning of LRA and update the offsets whenever the stack is expanded. We need to do this before every constraint pass because the choice of offset often affects whether a particular address or memory constraint is satisfied.

We keep RTL code at most time in such state that the virtual registers can be changed by just the corresponding hard registers (with zero offsets) and we have the right RTL code. To achieve this we should add initial offset at the beginning of LRA work and update offsets after each stack expanding. But actually we update virtual registers to the same virtual registers + corresponding offsets before every constraint pass because it affects constraint satisfaction (e.g. an address displacement became too big for some target).

The final change of eliminable registers to the corresponding hard registers are done at the very end of LRA when there were no change in offsets anymore:

              fp + 42     =>     sp + 42

This structure is used to record information about hard register eliminations.

This structure is used to record information about register eliminations. Each array entry describes one possible way of eliminating a register in favor of another. If there is more than one way of eliminating a particular register, the most preferred should be specified first.


Field Documentation

bool elim_table::can_eliminate

Nonzero if this elimination can be done.

Referenced by alter_reg(), remove_reg_equal_offset_note(), set_label_offsets(), spill_pseudos(), and update_eliminable_offsets().

int elim_table::can_eliminate
int elim_table::can_eliminate_previous
int elim_table::from

Hard register number to be eliminated.

Referenced by remove_reg_equal_offset_note(), spill_pseudos(), and update_eliminable_offsets().

rtx elim_table::from_rtx

REG rtx for the register to be eliminated. We cannot simply compare the number since we might then spuriously replace a hard register corresponding to a pseudo assigned to the reg to be eliminated.

Referenced by lra_eliminate_regs_1(), remove_reg_equal_offset_note(), set_label_offsets(), and update_eliminable_offsets().

HOST_WIDE_INT elim_table::initial_offset

Referenced by alter_reg().

HOST_WIDE_INT elim_table::offset

Difference between the values on the current iteration.

Referenced by alter_reg(), lra_eliminate_regs_1(), and spill_pseudos().

bool elim_table::prev_can_eliminate

CAN_ELIMINATE since the last check.

HOST_WIDE_INT elim_table::previous_offset

Difference between values of the two hard registers above on previous iteration.

Referenced by lra_eliminate_regs_1(), note_reg_elim_costly(), set_label_offsets(), and spill_pseudos().

int elim_table::ref_outside_mem

Referenced by note_reg_elim_costly().

int elim_table::to

Hard register number used as replacement.

Referenced by lra_eliminate_regs_1(), remove_reg_equal_offset_note(), spill_pseudos(), and update_eliminable_offsets().


The documentation for this struct was generated from the following files: