| 1 |
684 |
jeremybenn |
/* Define regsets.
|
| 2 |
|
|
Copyright (C) 1987, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
| 3 |
|
|
2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
| 4 |
|
|
|
| 5 |
|
|
This file is part of GCC.
|
| 6 |
|
|
|
| 7 |
|
|
GCC is free software; you can redistribute it and/or modify it under
|
| 8 |
|
|
the terms of the GNU General Public License as published by the Free
|
| 9 |
|
|
Software Foundation; either version 3, or (at your option) any later
|
| 10 |
|
|
version.
|
| 11 |
|
|
|
| 12 |
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
| 13 |
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
| 14 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
| 15 |
|
|
for more details.
|
| 16 |
|
|
|
| 17 |
|
|
You should have received a copy of the GNU General Public License
|
| 18 |
|
|
along with GCC; see the file COPYING3. If not see
|
| 19 |
|
|
<http://www.gnu.org/licenses/>. */
|
| 20 |
|
|
|
| 21 |
|
|
#ifndef GCC_REGSET_H
|
| 22 |
|
|
#define GCC_REGSET_H
|
| 23 |
|
|
|
| 24 |
|
|
/* TODO: regset is just a bitmap in its implementation. The compiler does
|
| 25 |
|
|
not consistently use one or the other, i.e. sometimes variables are
|
| 26 |
|
|
declared as bitmap but they are actually regsets and regset accessors
|
| 27 |
|
|
are used, and vice versa, or mixed (see e.g. spilled_regs in IRA).
|
| 28 |
|
|
|
| 29 |
|
|
This should be cleaned up, either by just dropping the regset type, or
|
| 30 |
|
|
by changing all bitmaps that are really regsets to the regset type. For
|
| 31 |
|
|
the latter option, a good start would be to change everything allocated
|
| 32 |
|
|
on the reg_obstack to regset. */
|
| 33 |
|
|
|
| 34 |
|
|
#include "bitmap.h" /* For bitmap_iterator. */
|
| 35 |
|
|
#include "hard-reg-set.h"
|
| 36 |
|
|
|
| 37 |
|
|
/* Head of register set linked list. */
|
| 38 |
|
|
typedef bitmap_head regset_head;
|
| 39 |
|
|
|
| 40 |
|
|
/* A pointer to a regset_head. */
|
| 41 |
|
|
typedef bitmap regset;
|
| 42 |
|
|
|
| 43 |
|
|
/* Allocate a register set with oballoc. */
|
| 44 |
|
|
#define ALLOC_REG_SET(OBSTACK) BITMAP_ALLOC (OBSTACK)
|
| 45 |
|
|
|
| 46 |
|
|
/* Do any cleanup needed on a regset when it is no longer used. */
|
| 47 |
|
|
#define FREE_REG_SET(REGSET) BITMAP_FREE (REGSET)
|
| 48 |
|
|
|
| 49 |
|
|
/* Initialize a new regset. */
|
| 50 |
|
|
#define INIT_REG_SET(HEAD) bitmap_initialize (HEAD, ®_obstack)
|
| 51 |
|
|
|
| 52 |
|
|
/* Clear a register set by freeing up the linked list. */
|
| 53 |
|
|
#define CLEAR_REG_SET(HEAD) bitmap_clear (HEAD)
|
| 54 |
|
|
|
| 55 |
|
|
/* Copy a register set to another register set. */
|
| 56 |
|
|
#define COPY_REG_SET(TO, FROM) bitmap_copy (TO, FROM)
|
| 57 |
|
|
|
| 58 |
|
|
/* Compare two register sets. */
|
| 59 |
|
|
#define REG_SET_EQUAL_P(A, B) bitmap_equal_p (A, B)
|
| 60 |
|
|
|
| 61 |
|
|
/* `and' a register set with a second register set. */
|
| 62 |
|
|
#define AND_REG_SET(TO, FROM) bitmap_and_into (TO, FROM)
|
| 63 |
|
|
|
| 64 |
|
|
/* `and' the complement of a register set with a register set. */
|
| 65 |
|
|
#define AND_COMPL_REG_SET(TO, FROM) bitmap_and_compl_into (TO, FROM)
|
| 66 |
|
|
|
| 67 |
|
|
/* Inclusive or a register set with a second register set. */
|
| 68 |
|
|
#define IOR_REG_SET(TO, FROM) bitmap_ior_into (TO, FROM)
|
| 69 |
|
|
|
| 70 |
|
|
/* Exclusive or a register set with a second register set. */
|
| 71 |
|
|
#define XOR_REG_SET(TO, FROM) bitmap_xor_into (TO, FROM)
|
| 72 |
|
|
|
| 73 |
|
|
/* Or into TO the register set FROM1 `and'ed with the complement of FROM2. */
|
| 74 |
|
|
#define IOR_AND_COMPL_REG_SET(TO, FROM1, FROM2) \
|
| 75 |
|
|
bitmap_ior_and_compl_into (TO, FROM1, FROM2)
|
| 76 |
|
|
|
| 77 |
|
|
/* Clear a single register in a register set. */
|
| 78 |
|
|
#define CLEAR_REGNO_REG_SET(HEAD, REG) bitmap_clear_bit (HEAD, REG)
|
| 79 |
|
|
|
| 80 |
|
|
/* Set a single register in a register set. */
|
| 81 |
|
|
#define SET_REGNO_REG_SET(HEAD, REG) bitmap_set_bit (HEAD, REG)
|
| 82 |
|
|
|
| 83 |
|
|
/* Return true if a register is set in a register set. */
|
| 84 |
|
|
#define REGNO_REG_SET_P(TO, REG) bitmap_bit_p (TO, REG)
|
| 85 |
|
|
|
| 86 |
|
|
/* Copy the hard registers in a register set to the hard register set. */
|
| 87 |
|
|
extern void reg_set_to_hard_reg_set (HARD_REG_SET *, const_bitmap);
|
| 88 |
|
|
#define REG_SET_TO_HARD_REG_SET(TO, FROM) \
|
| 89 |
|
|
do { \
|
| 90 |
|
|
CLEAR_HARD_REG_SET (TO); \
|
| 91 |
|
|
reg_set_to_hard_reg_set (&TO, FROM); \
|
| 92 |
|
|
} while (0)
|
| 93 |
|
|
|
| 94 |
|
|
typedef bitmap_iterator reg_set_iterator;
|
| 95 |
|
|
|
| 96 |
|
|
/* Loop over all registers in REGSET, starting with MIN, setting REGNUM to the
|
| 97 |
|
|
register number and executing CODE for all registers that are set. */
|
| 98 |
|
|
#define EXECUTE_IF_SET_IN_REG_SET(REGSET, MIN, REGNUM, RSI) \
|
| 99 |
|
|
EXECUTE_IF_SET_IN_BITMAP (REGSET, MIN, REGNUM, RSI)
|
| 100 |
|
|
|
| 101 |
|
|
/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting
|
| 102 |
|
|
REGNUM to the register number and executing CODE for all registers that are
|
| 103 |
|
|
set in the first regset and not set in the second. */
|
| 104 |
|
|
#define EXECUTE_IF_AND_COMPL_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, RSI) \
|
| 105 |
|
|
EXECUTE_IF_AND_COMPL_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, RSI)
|
| 106 |
|
|
|
| 107 |
|
|
/* Loop over all registers in REGSET1 and REGSET2, starting with MIN, setting
|
| 108 |
|
|
REGNUM to the register number and executing CODE for all registers that are
|
| 109 |
|
|
set in both regsets. */
|
| 110 |
|
|
#define EXECUTE_IF_AND_IN_REG_SET(REGSET1, REGSET2, MIN, REGNUM, RSI) \
|
| 111 |
|
|
EXECUTE_IF_AND_IN_BITMAP (REGSET1, REGSET2, MIN, REGNUM, RSI) \
|
| 112 |
|
|
|
| 113 |
|
|
/* Same information as REGS_INVALIDATED_BY_CALL but in regset form to be used
|
| 114 |
|
|
in dataflow more conveniently. */
|
| 115 |
|
|
|
| 116 |
|
|
extern regset regs_invalidated_by_call_regset;
|
| 117 |
|
|
|
| 118 |
|
|
/* Same information as FIXED_REG_SET but in regset form. */
|
| 119 |
|
|
extern regset fixed_reg_set_regset;
|
| 120 |
|
|
|
| 121 |
|
|
/* An obstack for regsets. */
|
| 122 |
|
|
extern bitmap_obstack reg_obstack;
|
| 123 |
|
|
|
| 124 |
|
|
/* In cfg.c */
|
| 125 |
|
|
extern void dump_regset (regset, FILE *);
|
| 126 |
|
|
extern void debug_regset (regset);
|
| 127 |
|
|
|
| 128 |
|
|
#endif /* GCC_REGSET_H */
|