+2019-03-28 Stafford Horne <shorne@gmail.com>
+
+ * Make-common.in (sim-arange_h): Remove sim-arange.c
+ * sim-arange.c: Remove SIM_ARANGE_C.
+ Add ifdef for _SIM_ARANGE_C_.
+ Include "sim-arange.h".
+ Remove include for unused "sim-assert.h".
+ Remove DEFINE_INLINE_P. Remove DEFINE_NON_INLINE_P.
+ (sim_addr_range_add): Declare as INLINE_SIM_ARANGE.
+ (sim_addr_range_delete): Declare as INLINE_SIM_ARANGE.
+ (sim_addr_range_hit_p): Change from SIM_ARANGE_INLINE to
+ INLINE_SIM_ARANGE.
+ * sim-arange.h (sim_addr_range_add): Declare as
+ INLINE_SIM_ARANGE.
+ (sim_addr_range_delete): Declare as INLINE_SIM_ARANGE.
+ (sim_addr_range_hit_p) Declare as INLINE_SIM_ARANGE.
+ Remove definition of SIM_ARANGE_INLINE.
+ Remove [HAVE_INLINE].
+ Wrap include "sim-arange.c" in H_REVEALS_MODULE_P.
+ * sim-base.h: Include "sim-arange.h"
+ * sim-basics.h: Remove include of "sim-arange.h"
+ * sim-inline.c: Include "sim-arange.c"
+ * sim-inline.h: Define INLINE_SIM_ARANGE.
+ Define SIM_ARANGE_INLINE. Define EXTERN_SIM_ARANGE_P.
+ Define STATIC_INLINE_SIM_ARANGE. Define STATIC_SIM_ARANGE.
+
2019-01-26 Tom Tromey <tom@tromey.com>
* Make-common.in (version.c): Use sim's create-version.sh.
$(sim_main_headers)
sim-alu_h = $(srccom)/sim-alu.h
-sim-arange_h = $(srccom)/sim-arange.h \
- $(srccom)/sim-arange.c
+sim-arange_h = $(srccom)/sim-arange.h
sim-assert_h = $(srccom)/sim-assert.h
sim-base_h = $(srccom)/sim-base.h \
$(sim-module_h) \
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-/* Tell sim-arange.h it's us. */
-#define SIM_ARANGE_C
+#ifndef _SIM_ARANGE_C_
+#define _SIM_ARANGE_C_
#include "libiberty.h"
#include "sim-basics.h"
-#include "sim-assert.h"
+#include "sim-arange.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#include <string.h>
#endif
-#ifdef SIM_ARANGE_C_INCLUDED
-
/* Insert a range. */
static void
free (asrtab);
}
-void
+INLINE_SIM_ARANGE\
+(void)
sim_addr_range_add (ADDR_RANGE *ar, address_word start, address_word end)
{
frob_range (ar, start, end, 0);
build_search_tree (ar);
}
-void
+INLINE_SIM_ARANGE\
+(void)
sim_addr_range_delete (ADDR_RANGE *ar, address_word start, address_word end)
{
frob_range (ar, start, end, 1);
build_search_tree (ar);
}
-#else /* SIM_ARANGE_C_INCLUDED */
-
-SIM_ARANGE_INLINE int
+INLINE_SIM_ARANGE\
+(int)
sim_addr_range_hit_p (ADDR_RANGE *ar, address_word addr)
{
ADDR_RANGE_TREE *t = ar->range_tree;
return 0;
}
-#endif /* SIM_ARANGE_C_INCLUDED */
+#endif /* _SIM_ARANGE_C_ */
} ADDR_RANGE;
/* Add address range START,END to AR. */
-extern void sim_addr_range_add (ADDR_RANGE * /*ar*/,
- address_word /*start*/,
- address_word /*end*/);
+INLINE_SIM_ARANGE (void) sim_addr_range_add (ADDR_RANGE * /*ar*/,
+ address_word /*start*/,
+ address_word /*end*/);
/* Delete address range START,END from AR. */
-extern void sim_addr_range_delete (ADDR_RANGE * /*ar*/,
- address_word /*start*/,
- address_word /*end*/);
-
-/* TODO: This should get moved into sim-inline.h. */
-#ifdef HAVE_INLINE
-#ifdef SIM_ARANGE_C
-#define SIM_ARANGE_INLINE INLINE
-#else
-#define SIM_ARANGE_INLINE EXTERN_INLINE
-#endif
-#else
-#define SIM_ARANGE_INLINE extern
-#endif
+INLINE_SIM_ARANGE (void) sim_addr_range_delete (ADDR_RANGE * /*ar*/,
+ address_word /*start*/,
+ address_word /*end*/);
/* Return non-zero if ADDR is in range AR, traversing the entire tree.
If no range is specified, that is defined to mean "everything". */
-SIM_ARANGE_INLINE int
-sim_addr_range_hit_p (ADDR_RANGE * /*ar*/, address_word /*addr*/);
+INLINE_SIM_ARANGE (int) sim_addr_range_hit_p (ADDR_RANGE * /*ar*/,
+ address_word /*addr*/);
#define ADDR_RANGE_HIT_P(ar, addr) \
((ar)->range_tree == NULL || sim_addr_range_hit_p ((ar), (addr)))
-#ifdef HAVE_INLINE
+#if H_REVEALS_MODULE_P (SIM_ARANGE_INLINE)
#include "sim-arange.c"
#endif
-#define SIM_ARANGE_C_INCLUDED
#endif /* SIM_ARANGE_H */
#include "sim-module.h"
+#include "sim-arange.h"
#include "sim-trace.h"
#include "sim-core.h"
#include "sim-events.h"
#include "sim-bits.h"
#include "sim-endian.h"
#include "sim-signal.h"
-#include "sim-arange.h"
#include "sim-utils.h"
#include "sim-inline.h"
#include "sim-main.h"
+#if C_REVEALS_MODULE_P (SIM_ARANGE_INLINE)
+#include "sim-arange.c"
+#endif
+
#if C_REVEALS_MODULE_P (SIM_BITS_INLINE)
#include "sim-bits.c"
#include "sim-main.c"
#endif
-
#if C_REVEALS_MODULE_P (ENGINE_INLINE)
/* #include "engine.c" - handled by generator */
#endif
\f
+
+/* sim_arange */
+
+#if !defined (SIM_ARANGE_INLINE) && (DEFAULT_INLINE)
+# define SIM_ARANGE_INLINE (ALL_H_INLINE)
+#endif
+
+#if ((H_REVEALS_MODULE_P (SIM_ARANGE_INLINE) || defined (SIM_INLINE_C)) \
+ && !defined (SIM_ARANGE_C) \
+ && (REVEAL_MODULE_P (SIM_ARANGE_INLINE)))
+# if (SIM_ARANGE_INLINE & INLINE_GLOBALS)
+# define INLINE_SIM_ARANGE(TYPE) static INLINE TYPE UNUSED
+# define EXTERN_SIM_ARANGE_P 0
+# else
+# define INLINE_SIM_ARANGE(TYPE) static TYPE UNUSED
+# define EXTERN_SIM_ARANGE_P 0
+# endif
+#else
+# define INLINE_SIM_ARANGE(TYPE) TYPE
+# define EXTERN_SIM_ARANGE_P 1
+#endif
+
+#if (SIM_ARANGE_INLINE & INLINE_LOCALS)
+# define STATIC_INLINE_SIM_ARANGE(TYPE) static INLINE TYPE
+#else
+# define STATIC_INLINE_SIM_ARANGE(TYPE) static TYPE
+#endif
+
+#define STATIC_SIM_ARANGE(TYPE) static TYPE
+
+
+
/* *****
sim-bits and sim-endian are treated differently from the rest
of the modules below. Their default value is ALL_H_INLINE.