2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
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.
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.
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
22 * @brief Dumps global variables and constants as gas assembler.
23 * @author Christian Wuerdig, Matthias Braun
27 #ifndef FIRM_BE_BEGNUAS_H
28 #define FIRM_BE_BEGNUAS_H
31 #include "beemitter.h"
36 typedef enum section_t {
37 GAS_SECTION_TEXT, /**< text section */
38 GAS_SECTION_DATA, /**< data section */
39 GAS_SECTION_RODATA, /**< rodata section */
40 GAS_SECTION_COMMON, /**< common section */
41 GAS_SECTION_TLS, /**< thread local storage section */
42 GAS_SECTION_CTOR, /**< ctor section for instrumentation code init */
43 GAS_SECTION_CSTRING, /**< section for constant strings */
44 GAS_SECTION_LAST = GAS_SECTION_CSTRING
48 * Support for some GAS "dialects".
50 typedef enum asm_flavour_t {
51 GAS_FLAVOUR_ELF, /**< ELF variant */
52 GAS_FLAVOUR_MINGW, /**< MinGW variant (no-ELF) */
53 GAS_FLAVOUR_YASM, /**< YASM GNU parser */
54 GAS_FLAVOUR_MACH_O, /**< Mach-O variant (as found on darwin, OS/X) */
55 GAS_FLAVOUR_LAST = GAS_FLAVOUR_MACH_O
58 /** The variable where the GAS dialect is stored. */
59 extern be_gas_flavour_t be_gas_flavour;
62 * Generate all entities.
63 * @param main_env the main backend environment
64 * @param emit_commons if non-zero, emit commons (non-local uninitialized entities)
65 * @param only_emit_marked if non-zero, external allocated entities that do not have
66 * its visited flag set are ignored
68 void be_gas_emit_decls(const be_main_env_t *main_env,
69 int only_emit_marked_entities);
72 * Switch the current output section to the given out.
74 * @param section the new output section
76 void be_gas_emit_switch_section(be_gas_section_t section);
79 * emit assembler instructions necessary before starting function code
81 void be_gas_emit_function_prolog(ir_entity *entity, unsigned alignment);
83 void be_gas_emit_function_epilog(ir_entity *entity);
86 * Return the label prefix for labeled blocks.
88 const char *be_gas_label_prefix(void);