fixed warnings
[libfirm] / include / libfirm / archop.h
1 /*
2  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief    Architecture dependand IR operations
23  * @version  $Id$
24  */
25 #ifndef FIRM_ARCH_ARCHOP_H
26 #define FIRM_ARCH_ARCHOP_H
27
28 #include "firm_types.h"
29 #include "dbginfo.h"
30
31 /**
32  * Mask defining which architecture depend
33  * operations are supported.
34  */
35 typedef enum _arch_ops_mask {
36   ARCH_OPS_NONE   = 0,              /**< no additional Operations */
37   ARCH_OPS_MINMAX = 1               /**< use the Min/Max Operation */
38 } arch_ops_mask;
39
40 typedef struct _arch_ops_info {
41   arch_ops_mask  enabled_ops;         /**< a mask of enabled IR-opcodes */
42   unsigned       minmax_handle_NaN:1; /**< if set, Min(a,a) == a, else unknown */
43 } arch_ops_info;
44
45 extern ir_op *op_Min, *op_Max;
46
47 ir_op *get_op_Min(void);
48 ir_op *get_op_Max(void);
49
50 /** construct a Min: Min(a,b) = a < b ? a : b */
51 ir_node *
52 new_rd_Min(dbg_info *db, ir_graph *irg, ir_node *block,
53        ir_node *op1, ir_node *op2, ir_mode *mode);
54
55 /** construct a Max: Max(a,b) = a > b ? a : b */
56 ir_node *
57 new_rd_Max(dbg_info *db, ir_graph *irg, ir_node *block,
58        ir_node *op1, ir_node *op2, ir_mode *mode);
59
60 ir_node *
61 new_r_Min(ir_graph *irg, ir_node *block,
62        ir_node *op1, ir_node *op2, ir_mode *mode);
63
64 ir_node *
65 new_r_Max(ir_graph *irg, ir_node *block,
66        ir_node *op1, ir_node *op2, ir_mode *mode);
67
68 ir_node *
69 new_Min(ir_node *op1, ir_node *op2, ir_mode *mode);
70
71 ir_node *
72 new_Max(ir_node *op1, ir_node *op2, ir_mode *mode);
73
74 /**
75  * Create Min and Mux from Mux nodes
76  */
77 ir_node *arch_transform_node_Mux(ir_node *mux);
78
79 /**
80  * initialize the ops.
81  */
82 void firm_archops_init(const arch_ops_info *info);
83
84 #endif