becopyopt: Use the set of admissible registers from bechordal.
[libfirm] / ir / be / betranshlp.h
index f31f05f..55add85 100644 (file)
@@ -1,20 +1,6 @@
 /*
- * 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.
+ * Copyright (C) 2012 University of Karlsruhe.
  */
 
 /**
  * @brief       be transform helper extracted from the ia32 backend.
  * @author      Matthias Braun, Michael Beck
  * @date        14.06.2007
- * @version     $Id$
  */
 #ifndef FIRM_BE_BETRANSHLP_H
 #define FIRM_BE_BETRANSHLP_H
 
+#include "be_types.h"
 #include "firm_types.h"
-#include "beirg.h"
 
 /**
  * A callback to pre-transform some nodes before the transformation starts.
@@ -48,6 +33,12 @@ ir_node *be_pre_transform_node(ir_node *place);
  */
 ir_node *be_transform_node(ir_node *node);
 
+/**
+ * Creates a new phi (needs some special handling since we can't transform
+ * all predecessors yet).
+ */
+ir_node *be_transform_phi(ir_node *node, const arch_register_req_t *req);
+
 /**
  * Duplicate all dependency edges of a node.
  */
@@ -85,4 +76,20 @@ void be_enqueue_preds(ir_node *node);
  */
 void be_transform_graph(ir_graph *irg, arch_pretrans_nodes *func);
 
+typedef bool (*upper_bits_clean_func)(const ir_node *node, ir_mode *mode);
+
+/**
+ * register a test function for be_upper_bits_clean for a specific node
+ * type.
+ */
+void be_set_upper_bits_clean_function(ir_op *op, upper_bits_clean_func func);
+
+/**
+ * returns true if it is assured, that the upper bits of a node are "clean"
+ * which means for a 16 or 8 bit value, that the upper bits in the register
+ * are 0 for unsigned and a copy of the last significant bit for signed
+ * numbers.
+ */
+bool be_upper_bits_clean(const ir_node *node, ir_mode *mode);
+
 #endif