190075Sobrien/* Macros to support INSN_ADDRESSES
290075Sobrien   Copyright (C) 2000 Free Software Foundation, Inc.
390075Sobrien
490075SobrienThis file is part of GCC.
590075Sobrien
690075SobrienGCC is free software; you can redistribute it and/or modify it under
790075Sobrienthe terms of the GNU General Public License as published by the Free
890075SobrienSoftware Foundation; either version 2, or (at your option) any later
990075Sobrienversion.
1090075Sobrien
1190075SobrienGCC is distributed in the hope that it will be useful, but WITHOUT ANY
1290075SobrienWARRANTY; without even the implied warranty of MERCHANTABILITY or
1390075SobrienFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1490075Sobrienfor more details.
1590075Sobrien
1690075SobrienYou should have received a copy of the GNU General Public License
1790075Sobrienalong with GCC; see the file COPYING.  If not, write to the Free
18169689SkanSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
19169689Skan02110-1301, USA.  */
2090075Sobrien
2190075Sobrien#ifndef GCC_INSN_ADDR_H
2290075Sobrien#define GCC_INSN_ADDR_H
2390075Sobrien
2490075Sobrien#include "varray.h"
2590075Sobrien
26117395Skanextern GTY(()) varray_type insn_addresses_;
2790075Sobrienextern int insn_current_address;
2890075Sobrien
2990075Sobrien#define INSN_ADDRESSES_DEFN() varray_type insn_addresses_
3090075Sobrien#define INSN_ADDRESSES(id) VARRAY_INT (insn_addresses_, (id))
3190075Sobrien#define INSN_ADDRESSES_ALLOC(size) \
3290075Sobrien  VARRAY_INT_INIT (insn_addresses_, (size), "insn_addresses")
33117395Skan#define INSN_ADDRESSES_FREE() (insn_addresses_ = 0)
3490075Sobrien#define INSN_ADDRESSES_SET_P() (insn_addresses_ != 0)
3590075Sobrien#define INSN_ADDRESSES_SIZE() VARRAY_SIZE (insn_addresses_)
3690075Sobrien#define INSN_ADDRESSES_NEW(insn, addr) do \
3790075Sobrien  {									\
3890075Sobrien    unsigned insn_uid__ = INSN_UID ((insn));				\
3990075Sobrien    int insn_addr__ = (addr);						\
4090075Sobrien									\
4190075Sobrien    if (INSN_ADDRESSES_SET_P ())					\
4290075Sobrien      {									\
4390075Sobrien	if (INSN_ADDRESSES_SIZE () <= insn_uid__)			\
4490075Sobrien	  VARRAY_GROW (insn_addresses_, insn_uid__ + 1);		\
4590075Sobrien	INSN_ADDRESSES (insn_uid__) = insn_addr__;			\
4690075Sobrien      }									\
4790075Sobrien  }									\
4890075Sobrienwhile (0)
4990075Sobrien
5090075Sobrien#endif /* ! GCC_INSN_ADDR_H */
51