]>
Commit | Line | Data |
---|---|---|
9d98a694 | 1 | /* Macros to support INSN_ADDRESSES |
5624e564 | 2 | Copyright (C) 2000-2015 Free Software Foundation, Inc. |
9d98a694 | 3 | |
1322177d | 4 | This file is part of GCC. |
9d98a694 | 5 | |
1322177d LB |
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 | |
9dcd6f09 | 8 | Software Foundation; either version 3, or (at your option) any later |
1322177d | 9 | version. |
9d98a694 | 10 | |
1322177d LB |
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. | |
9d98a694 AO |
15 | |
16 | You should have received a copy of the GNU General Public License | |
9dcd6f09 NC |
17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ | |
9d98a694 | 19 | |
88657302 | 20 | #ifndef GCC_INSN_ADDR_H |
294340bf | 21 | #define GCC_INSN_ADDR_H |
9d98a694 | 22 | |
9771b263 | 23 | extern vec<int> insn_addresses_; |
9d98a694 AO |
24 | extern int insn_current_address; |
25 | ||
9771b263 | 26 | #define INSN_ADDRESSES(id) (insn_addresses_[id]) |
294340bf KH |
27 | #define INSN_ADDRESSES_ALLOC(size) \ |
28 | do \ | |
29 | { \ | |
9771b263 DN |
30 | insn_addresses_.create (size); \ |
31 | insn_addresses_.safe_grow_cleared (size); \ | |
32 | memset (insn_addresses_.address (), \ | |
294340bf KH |
33 | 0, sizeof (int) * size); \ |
34 | } \ | |
35 | while (0) | |
9771b263 DN |
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 ()) | |
294340bf KH |
39 | |
40 | static inline void | |
17f385d8 | 41 | insn_addresses_new (rtx_insn *insn, int insn_addr) |
294340bf KH |
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; | |
9771b263 DN |
51 | insn_addresses_.safe_grow (insn_uid + 1); |
52 | p = insn_addresses_.address (); | |
294340bf KH |
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)) | |
9d98a694 | 62 | |
88657302 | 63 | #endif /* ! GCC_INSN_ADDR_H */ |