Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
cdc062bb
Commit
cdc062bb
authored
Mar 05, 2006
by
Michael Beck
Browse files
Fully implemented call lowering for methods with compound return values
[r7409]
parent
90c13683
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
ir/lower/lower_calls.c
View file @
cdc062bb
This diff is collapsed.
Click to expand it.
ir/lower/lower_calls.h
View file @
cdc062bb
...
...
@@ -28,11 +28,18 @@ typedef enum add_hidden_params {
ADD_HIDDEN_SMART
=
2
,
/**< add hidden parameters last for non-variadic and first for variadic functions. */
}
add_hidden
;
/**
* A struct containing all control parameters for
* lower_compound_ret_calls().
*/
typedef
struct
{
int
def_ptr_alignment
;
/**<
d
efault alignment for data pointer */
add_hidden
hidden_params
;
/**<
w
here to add hidden params. */
int
def_ptr_alignment
;
/**<
D
efault alignment for data pointer
.
*/
add_hidden
hidden_params
;
/**<
W
here to add hidden param
eter
s. */
/** a function returning a pointer type for a given type */
/**
* A function returning a pointer type for a given type.
* If this pointer is NULL, a new pointer type is always created.
*/
ir_type
*
(
*
find_pointer_type
)(
ir_type
*
e_type
,
ir_mode
*
mode
,
int
alignment
);
}
lower_params_t
;
...
...
@@ -50,6 +57,49 @@ typedef struct {
* stack.
*
* - Replace a possible block copy after the function call.
*
* - Changes the types of methods and calls to the lowered ones
*
* - lower all method types of existing entities
*
* In pseudo-code, the following transformation is done:
*
@code
struct x ret = func(a, b);
@endcode
*
* is translated into
@code
struct x ret;
func(&ret, a, b);
@endcode
*
* If the function returns only one possible result, the copy-on-return
* optimization is done, ie.
@code
struct x func(a) {
struct x ret;
ret.a = a;
return ret;
}
@endcode
*
* is transformed into
*
@code
void func(struct x *ret, a) {
ret->a = a;
}
@endcode
*
* @param params A structure containing the control parameter for this
* transformation.
*
* During the transformation, pointer types must be created or reused.
* The caller can provide params->find_pointer_type for this task to
* reduce the number of created pointer types.
* If params->find_pointer_type is NULL, new pointer types
* are always created automatically.
*/
void
lower_compound_ret_calls
(
const
lower_params_t
*
params
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment