2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief Lowering of calls with compound arguments
11 #ifndef FIRM_LOWER_CALLS_H
12 #define FIRM_LOWER_CALLS_H
14 #include "firm_types.h"
17 * Additional flags for the lowering.
19 typedef enum compound_call_lowering_flags {
20 LF_NONE = 0, /**< no additional flags */
21 LF_RETURN_HIDDEN = 1 << 0, /**< return the hidden address instead of void */
22 LF_DONT_LOWER_ARGUMENTS = 1 << 1, /**< don't lower compound call arguments
23 (some backends can handle them themselves) */
24 } compound_call_lowering_flags;
25 ENUM_BITSET(compound_call_lowering_flags)
28 * Lower calls with compound parameter and return types.
29 * This function does the following transformations:
31 * If LF_COMPOUND_PARAM is set:
33 * - Copy compound parameters to a new location on the callers
34 * stack and transmit the address of this new location
36 * If LF_COMPOUND_RETURN is set:
38 * - Adds a new (hidden) pointer parameter for
39 * any return compound type. The return type is replaced by void
40 * or if LOWERING_FLAGS_RETURN_HIDDEN is set by the address.
42 * - Use of the hidden parameters in the function code.
44 * - Change all calls to functions with compound return
45 * by providing space for the hidden parameter on the callers
48 * - Replace a possible block copy after the function call.
52 * - Changes the types of methods and calls to the lowered ones
54 * - lower all method types of existing entities
56 * In pseudo-code, the following transformation is done:
59 struct x ret = func(a, b);
68 * If the function returns only one possible result, the copy-on-return
69 * optimization is done, ie.
81 void func(struct x *ret, a) {
86 void lower_calls_with_compounds(compound_call_lowering_flags flags);