be.h 2.79 KB
Newer Older
Christian Würdig's avatar
Christian Würdig committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * 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.
 *
 * 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.
 */

Christian Würdig's avatar
Christian Würdig committed
20
21
22
23
24
25
26
27
/**
 * @file
 * @brief       Generic backend types and interfaces.
 * @author      Sebastian Hack
 * @version     $Id$
 */
#ifndef FIRM_BE_MAIN_H
#define FIRM_BE_MAIN_H
28

Christian Würdig's avatar
Christian Würdig committed
29
#include <stdio.h>
30
31
#include "irarch.h"
#include "archop.h"
32
#include "lowering.h"
33
#include "iroptimize.h"
Christian Würdig's avatar
Christian Würdig committed
34

35
36
#include <libcore/lc_timing.h>

Christian Würdig's avatar
Christian Würdig committed
37
#define LC_STOP_AND_RESET_TIMER(timer) do { lc_timer_stop(timer); lc_timer_reset(timer); } while(0)
38

39
40
41
42
43
/**
 * This structure contains parameters that should be
 * propagated to the libFirm parameter set.
 */
typedef struct backend_params {
44
45
46
47
48
	/** if set, the backend cannot handle DWORD access */
	unsigned do_dw_lowering:1;
	/** if set, the backend supports inline assembly */
	unsigned support_inline_asm:1;

49
50
51
52
53
54
55
56
	/** Additional opcodes settings. */
	const arch_ops_info *arch_op_settings;

	/** Settings for architecture dependent optimizations */
	const arch_dep_params_t *dep_param;

	/** the architecture specific intrinsic function creator */
	create_intrinsic_fkt *arch_create_intrinsic_fkt;
57
58
59
60

	/** the context parameter for the create intrinsic function */
	void *create_intrinsic_ctx;

Christian Würdig's avatar
Christian Würdig committed
61
	/** backend settings for if-conversion */
Christian Würdig's avatar
Christian Würdig committed
62
	const opt_if_conv_info_t *if_conv_info;
63
64
} backend_params;

65
66
67
68
69
70
71
72
73
74
75
76
/**
 * Register the Firm backend command line options.
 */
void be_opt_register(void);

/**
 * Parse one backend argument.
 */
int be_parse_arg(const char *arg);

/**
 * Initialize the Firm backend. Must be run BEFORE init_firm()!
77
78
79
 *
 * @return libFirm configuration parameters for the selected
 *         backend
80
 */
81
const backend_params *be_init(void);
Michael Beck's avatar
Michael Beck committed
82
83
84
85

/**
 * Main interface to the frontend.
 */
Michael Beck's avatar
Michael Beck committed
86
void be_main(FILE *file_handle, const char *cup_name);
87

Michael Beck's avatar
Michael Beck committed
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/** The type of the debug info retriever function. */
typedef const char *(*retrieve_dbg_func)(const dbg_info *dbg, unsigned *line);

/**
 * Sets a debug info retriever.
 *
 * @param func   the debug retriever function.
 */
void be_set_debug_retrieve(retrieve_dbg_func func);

/**
 * Retrieve the debug info.
 */
const char *be_retrieve_dbg_info(const dbg_info *dbg, unsigned *line);

103
104
typedef struct be_main_env_t be_main_env_t;
typedef struct be_options_t  be_options_t;
Sebastian Hack's avatar
Sebastian Hack committed
105

Christian Würdig's avatar
Christian Würdig committed
106
#endif /* FIRM_BE_MAIN_H */