- is_tarval() added
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Thu, 24 Jul 2008 12:27:11 +0000 (12:27 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Thu, 24 Jul 2008 12:27:11 +0000 (12:27 +0000)
[r20664]

include/libfirm/tv.h
ir/tv/tv.c
ir/tv/tv_t.h

index 4538e39..70f9654 100644 (file)
@@ -686,4 +686,14 @@ int tarval_is_minus_inf(tarval *tv);
  */
 int tarval_is_finite(tarval *tv);
 
+/**
+ *   Checks whether a pointer points to a tarval.
+ *
+ *   @param thing     an arbitrary pointer
+ *
+ *   @return
+ *       true if the thing is a tarval, else false
+ */
+int is_tarval(const void *thing);
+
 #endif  /* FIRM_TV_TV_H */
index 1afb4a5..127ce68 100644 (file)
@@ -1836,6 +1836,10 @@ void finish_tarval(void) {
        del_set(values);  values = NULL;
 }
 
+int (is_tarval)(const void *thing) {
+       return _is_tarval(thing);
+}
+
 /****************************************************************************
  *   end of tv.c
  ****************************************************************************/
index 86b2cf4..77503fd 100644 (file)
@@ -29,6 +29,7 @@
 #define FIRM_TV_TV_T_H
 
 #include "firm_config.h"
+#include "firm_common.h"
 
 #include <assert.h>
 #include "irmode.h"
@@ -113,11 +114,17 @@ _get_tarval_b_true(void) {
   return tarval_b_true;
 }
 
+static INLINE int
+_is_tarval(const void *thing) {
+       return get_kind(thing) == k_tarval;
+}
+
 #define get_tarval_mode(tv)     _get_tarval_mode(tv)
 #define get_tarval_bad()        _get_tarval_bad()
 #define get_tarval_undefined()  _get_tarval_undefined()
 #define get_tarval_b_false()    _get_tarval_b_false()
 #define get_tarval_b_true()     _get_tarval_b_true()
 #define get_tarval_P_void()     _get_tarval_P_void()
+#define is_tarval(thing)        _is_tarval(thing)
 
 #endif /* FIRM_TV_TV_T_H */