Add is_Conv().
[libfirm] / ir / ir / irreflect.h
index c9b556e..8e303f5 100644 (file)
@@ -1,20 +1,36 @@
-/**
- * @file irreflect.h
- * @date 9.9.2004
- * @author Sebastian Hack
- * @brief Reflection for Firm operations.
+/*
+ * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
  *
- * $Id$
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
  */
 
-#ifndef _FIRM_REFLECT_H
-#define _FIRM_REFLECT_H
+/**
+ * @file
+ * @brief   Reflection for Firm operations.
+ * @author  Sebastian Hack
+ * @date    9.9.2004
+ * @version $Id$
+ */
+#ifndef FIRM_IR_REFLECT_H
+#define FIRM_IR_REFLECT_H
 
 #include <limits.h>
-#include <stdbool.h>
 
+#include "firm_types.h"
 #include "irop.h"
-#include "irnode.h"
 
 #define RFLCT_MC(m) rflct_ms_ ## m
 typedef enum {
@@ -47,7 +63,7 @@ typedef enum {
 typedef struct _rflct_arg_t {
   const char *name;  /**< The name of the argument (just a description). */
 
-  bool is_variadic; /**< True, if this argument can have multiple parameters. */
+  int is_variadic; /**< non-zero, if this argument can have multiple parameters. */
   rflct_mode_class_t accepted_modes; /**< The set of accepted modes. */
 
   int mode_equals; /**< If not variadic: You can specify the index of
@@ -85,7 +101,7 @@ rflct_mode_class_t rflct_get_mode_class(const ir_mode *mode);
  * @param opc The opcode.
  * @return The number of signatures for this opcode.
  */
-int rflct_get_signature_count(opcode opc);
+int rflct_get_signature_count(ir_opcode opc);
 
 /**
  * Try to get the signature, that matches to a given instance
@@ -102,7 +118,7 @@ int rflct_get_signature(const ir_node *irn);
  * @param sig The signature you are refering to.
  * @return The number of arguments.
  */
-int rflct_get_in_args_count(opcode opc, int sig);
+int rflct_get_in_args_count(ir_opcode opc, int sig);
 
 /**
  * Get the number of out arguments.
@@ -111,7 +127,7 @@ int rflct_get_in_args_count(opcode opc, int sig);
  * @param sig The signature you are refering to.
  * @return The number of arguments.
  */
-int rflct_get_out_args_count(opcode opc, int sig);
+int rflct_get_out_args_count(ir_opcode opc, int sig);
 
 #define rflct_get_args_count(opc, sig, use) \
   ((use) ? rflct_get_in_args_count(opc, sig) : rflct_get_out_args_count(opc, sig))
@@ -125,7 +141,7 @@ int rflct_get_out_args_count(opcode opc, int sig);
  * 0 and the signature count).
  * @return The array.
  */
-const rflct_arg_t *rflct_get_in_args(opcode opc, int sig);
+const rflct_arg_t *rflct_get_in_args(ir_opcode opc, int sig);
 
 /**
  * Get the array of def args.
@@ -136,7 +152,7 @@ const rflct_arg_t *rflct_get_in_args(opcode opc, int sig);
  * 0 and the signature count).
  * @return The array.
  */
-const rflct_arg_t *rflct_get_out_args(opcode opc, int sig);
+const rflct_arg_t *rflct_get_out_args(ir_opcode opc, int sig);
 
 #define rflct_get_args(opc, sig, use) \
   ((use) ? rflct_get_in_args(opc, sig) : rflct_get_out_args(opc, sig))
@@ -149,7 +165,7 @@ const rflct_arg_t *rflct_get_out_args(opcode opc, int sig);
  * @param sig The signature.
  * @return buf.
  */
-char *rflct_to_string(char *buf, int n, opcode opc, int sig);
+char *rflct_to_string(char *buf, int n, ir_opcode opc, int sig);
 
 /**
  * Get a string representation of a mode class.
@@ -162,20 +178,20 @@ char *rflct_mode_class_name(char *str, int n, rflct_mode_class_t mc);
 
 /**
  * Create a new opcode.
- * @param opc The Firm opcode.
- * @param name A name.
- * @param commutative True, if the opcode is commuatative.
+ * @param opc         The Firm opcode.
+ * @param name        A name.
+ * @param commutative non-zero, if the opcode is commutative.
  */
-void rflct_new_opcode(opcode opc, const char *name, bool commutative);
+void rflct_new_opcode(ir_opcode opc, const char *name, int commutative);
 
 /**
  * Add a signature to the opcode.
- * @param opc The opcode.
- * @param args The signature.
- * @return true, if the signature was added sucessfully, false if no
+ * @param opc  The opcode.
+ * @param sig  The signature.
+ * @return non-zero, if the signature was added successfully, false if no
  * more signatures can be added to the opcode.
  */
-bool rflct_opcode_add_signature(opcode opc, rflct_sig_t *sig);
+int rflct_opcode_add_signature(ir_opcode opc, rflct_sig_t *sig);
 
 /**
  * Allocate a new signature.
@@ -187,13 +203,14 @@ rflct_sig_t *rflct_signature_allocate(int defs, int uses);
 
 /**
  * Set an argument in a signature.
- * @param sig The signature.
- * @param is_use true, if the argument is a use, else it is considered a
- * def.
- * @param num The index of the argument.
- * @param name The name of the argument.
- * @param mc The mode class of the argument.
- * @param is_variadic true, if the argument is variadic.
+ *
+ * @param sig         The signature.
+ * @param is_use      non-zero, if the argument is a use, else it is
+ *                    considered a def.
+ * @param num         The index of the argument.
+ * @param name        The name of the argument.
+ * @param mc          The mode class of the argument.
+ * @param is_variadic non-zero, if the argument is variadic.
  * @param mode_equals This variable has following meaning: If the
  * argument is variadic, a 1 indicates that all operands binding to this
  * argument must have the same mode. A 0 indicates, that their mode must
@@ -205,17 +222,16 @@ rflct_sig_t *rflct_signature_allocate(int defs, int uses);
  * @return The index of the argument. Only use this index in mode_equals
  * parameters of other arguments.
  */
-int rflct_signature_set_arg(rflct_sig_t *sig, bool is_use, int num,
-               const char *name, rflct_mode_class_t mc, bool is_variadic, int mode_equals);
+int rflct_signature_set_arg(rflct_sig_t *sig, int is_use, int num,
+               const char *name, rflct_mode_class_t mc, int is_variadic, int mode_equals);
 
 /**
  * Get the arguments array index for an argument.
- * @param sig The signature.
- * @param is_use True, if the argument indicates a use or def argument.
- * @param num The number of the argument.
+ * @param sig    The signature.
+ * @param is_use non-zero, if the argument indicates a use or def argument.
+ * @param num    The number of the argument.
  * @return The index into the arguments array.
  */
-int rflct_signature_get_index(const rflct_sig_t *sig, bool is_use, int num);
-
+int rflct_signature_get_index(const rflct_sig_t *sig, int is_use, int num);
 
-#endif /* _FIRM_REFLECT_H */
+#endif