regtest: add check for -Wl,--no-warn-execstack
[valgrind.git] / VEX / priv / ir_match.h
blob9c34dfe321218c9c95c275024b3589c057db87c2
2 /*---------------------------------------------------------------*/
3 /*--- begin ir_match.h ---*/
4 /*---------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2004-2017 OpenWorks LLP
11 info@open-works.net
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see <http://www.gnu.org/licenses/>.
26 The GNU General Public License is contained in the file COPYING.
28 Neither the names of the U.S. Department of Energy nor the
29 University of California nor the names of its contributors may be
30 used to endorse or promote products derived from this software
31 without prior written permission.
34 /* Provides a facility for doing IR tree matching. */
36 #ifndef __VEX_IR_MATCH_H
37 #define __VEX_IR_MATCH_H
39 #include "libvex_basictypes.h"
40 #include "libvex_ir.h"
41 #include "main_util.h" // NULL
43 /* Patterns are simply IRExpr* trees, with IRExpr_Binder nodes at the
44 leaves, indicating binding points. Use these magic macros to
45 declare and define patterns. */
47 #define DECLARE_PATTERN(_patt) \
48 static IRExpr* _patt = NULL
50 #define DEFINE_PATTERN(_patt,_expr) \
51 do { \
52 if (!(_patt)) { \
53 vassert(vexGetAllocMode() == VexAllocModeTEMP); \
54 vexSetAllocMode(VexAllocModePERM); \
55 _patt = (_expr); \
56 vexSetAllocMode(VexAllocModeTEMP); \
57 vassert(vexGetAllocMode() == VexAllocModeTEMP); \
58 } \
59 } while (0)
62 /* This type returns the result of a match -- it records what
63 the binders got instantiated to. */
65 #define N_IRMATCH_BINDERS 4
67 typedef
68 struct {
69 const IRExpr* bindee[N_IRMATCH_BINDERS];
71 MatchInfo;
74 /* The matching function. p is expected to have zero or more
75 IRExpr_Binds in it, numbered 0, 1, 2 ... Returns True if a match
76 succeeded. */
78 extern
79 Bool matchIRExpr ( MatchInfo* mi, const IRExpr* p/*attern*/,
80 const IRExpr* e/*xpr*/ );
83 #endif /* ndef __VEX_IR_MATCH_H */
85 /*---------------------------------------------------------------*/
86 /*--- end ir_match.h ---*/
87 /*---------------------------------------------------------------*/