GCC Middle and Back End API Reference
auto-inc-dec.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "rtl.h"
#include "tm_p.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "insn-config.h"
#include "regs.h"
#include "flags.h"
#include "function.h"
#include "except.h"
#include "diagnostic-core.h"
#include "recog.h"
#include "expr.h"
#include "tree-pass.h"
#include "df.h"
#include "dbgcnt.h"
#include "target.h"
Include dependency graph for auto-inc-dec.c:

Functions

static unsigned int rest_of_handle_auto_inc_dec ()
static bool gate_auto_inc_dec ()
rtl_opt_passmake_pass_inc_dec ()

Function Documentation

static bool gate_auto_inc_dec ( )
static

Discover auto-inc auto-dec instructions.

rtl_opt_pass* make_pass_inc_dec ( )
static unsigned int rest_of_handle_auto_inc_dec ( )
static

Discovery of auto-inc and auto-dec instructions. Copyright (C) 2006-2013 Free Software Foundation, Inc. Contributed by Kenneth Zadeck zadec.nosp@m.k@na.nosp@m.tural.nosp@m.brid.nosp@m.ge.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/. This pass was originally removed from flow.c. However there is almost nothing that remains of that code.

There are (4) basic forms that are matched:

(1) FORM_PRE_ADD a <- b + c ... *a

becomes

a <- b ... (a += c) pre

(2) FORM_PRE_INC a += c ... *a

becomes

(a += c) pre

(3) FORM_POST_ADD *a ... b <- a + c

(For this case to be true, b must not be assigned or used between the *a and the assignment to b. B must also be a Pmode reg.)

becomes

b <- a ... (b += c) post

(4) FORM_POST_INC *a ... a <- a + c

becomes

(a += c) post

There are three types of values of c.

1) c is a constant equal to the width of the value being accessed by the pointer. This is useful for machines that have HAVE_PRE_INCREMENT, HAVE_POST_INCREMENT, HAVE_PRE_DECREMENT or HAVE_POST_DECREMENT defined.

2) c is a constant not equal to the width of the value being accessed by the pointer. This is useful for machines that have HAVE_PRE_MODIFY_DISP, HAVE_POST_MODIFY_DISP defined.

3) c is a register. This is useful for machines that have HAVE_PRE_MODIFY_REG, HAVE_POST_MODIFY_REG

The is one special case: if a already had an offset equal to it +- its width and that offset is equal to -c when the increment was before the ref or +c if the increment was after the ref, then if we can do the combination but switch the pre/post bit.