bearch: Remove unnecessary indirection to access arch_no_register_req.
[libfirm] / ir / common / firm_common.c
index ddb17c1..98cf5d0 100644 (file)
@@ -1,43 +1,40 @@
 /*
- * Project:     libFIRM
- * File name:   ir/common/firm_common.c
- * Purpose:
- * Author:      Martin Trapp, Christian Schaefer
- * Modified by: Goetz Lindenmaier
- * Created:
- * CVS-ID:      $Id$
- * Copyright:   (c) 1998-2003 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2008 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.
+ *
+ * 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.
  */
 
+/**
+ * @file
+ * @author    Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
+ */
+#include "config.h"
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include "firm_common_t.h"
 #include "irgraph.h"
+#include "irloop.h"
+#include "tv.h"
 
-/* returns the kind of the thing */
-firm_kind
-get_kind (const void *firm_thing) {
-  assert (firm_thing);
-  return *(firm_kind *)firm_thing;
-}
-
+/**
+ * Ideally, this macro would check if size bytes could be read at
+ * pointer p. No generic solution.
+ */
+#define POINTER_READ(p, size) (p)
 
-const char* print_firm_kind(void *firm_thing) {
-  assert (firm_thing);
-  switch (*(firm_kind *)firm_thing) {
-    case k_entity  : { return "k_entity"  ;} break;
-    case k_type    : { return "k_type"    ;} break;
-    case k_ir_graph: { return "k_ir_graph";} break;
-    case k_ir_node : { return "k_ir_node" ;} break;
-    case k_ir_mode : { return "k_ir_mode" ;} break;
-    case k_ir_op   : { return "k_ir_op"   ;} break;
-    case k_tarval  : { return "k_tarval"  ;} break;
-    case k_ir_loop : { return "k_ir_loop" ;} break;
-  default: break;
-  }
-  return "";
+/* returns the kind of the thing */
+firm_kind get_kind(const void *firm_thing)
+{
+       return POINTER_READ(firm_thing, sizeof(firm_kind)) ? *(firm_kind *)firm_thing : k_BAD;
 }