0
|
1 /* Macros to support INSN_ADDRESSES
|
145
|
2 Copyright (C) 2000-2020 Free Software Foundation, Inc.
|
0
|
3
|
|
4 This file is part of GCC.
|
|
5
|
|
6 GCC is free software; you can redistribute it and/or modify it under
|
|
7 the terms of the GNU General Public License as published by the Free
|
|
8 Software Foundation; either version 3, or (at your option) any later
|
|
9 version.
|
|
10
|
|
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with GCC; see the file COPYING3. If not see
|
|
18 <http://www.gnu.org/licenses/>. */
|
|
19
|
|
20 #ifndef GCC_INSN_ADDR_H
|
|
21 #define GCC_INSN_ADDR_H
|
|
22
|
111
|
23 extern vec<int> insn_addresses_;
|
0
|
24 extern int insn_current_address;
|
|
25
|
111
|
26 #define INSN_ADDRESSES(id) (insn_addresses_[id])
|
0
|
27 #define INSN_ADDRESSES_ALLOC(size) \
|
|
28 do \
|
|
29 { \
|
111
|
30 insn_addresses_.create (size); \
|
|
31 insn_addresses_.safe_grow_cleared (size); \
|
|
32 memset (insn_addresses_.address (), \
|
0
|
33 0, sizeof (int) * size); \
|
|
34 } \
|
|
35 while (0)
|
111
|
36 #define INSN_ADDRESSES_FREE() (insn_addresses_.release ())
|
|
37 #define INSN_ADDRESSES_SET_P() (insn_addresses_.exists ())
|
|
38 #define INSN_ADDRESSES_SIZE() (insn_addresses_.length ())
|
0
|
39
|
|
40 static inline void
|
111
|
41 insn_addresses_new (rtx_insn *insn, int insn_addr)
|
0
|
42 {
|
|
43 unsigned insn_uid = INSN_UID ((insn));
|
|
44
|
|
45 if (INSN_ADDRESSES_SET_P ())
|
|
46 {
|
|
47 size_t size = INSN_ADDRESSES_SIZE ();
|
|
48 if (size <= insn_uid)
|
|
49 {
|
|
50 int *p;
|
111
|
51 insn_addresses_.safe_grow (insn_uid + 1);
|
|
52 p = insn_addresses_.address ();
|
0
|
53 memset (&p[size],
|
|
54 0, sizeof (int) * (insn_uid + 1 - size));
|
|
55 }
|
|
56 INSN_ADDRESSES (insn_uid) = insn_addr;
|
|
57 }
|
|
58 }
|
|
59
|
|
60 #define INSN_ADDRESSES_NEW(insn, addr) \
|
|
61 (insn_addresses_new (insn, addr))
|
|
62
|
|
63 #endif /* ! GCC_INSN_ADDR_H */
|