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
eabef690
Commit
eabef690
authored
Aug 16, 2009
by
Michael Beck
Browse files
- add pass for lower_intrinsics()
[r26345]
parent
3646e58f
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/libfirm/lowering.h
View file @
eabef690
...
@@ -310,6 +310,22 @@ typedef union _i_record {
...
@@ -310,6 +310,22 @@ typedef union _i_record {
*/
*/
unsigned
lower_intrinsics
(
i_record
*
list
,
int
length
,
int
part_block_used
);
unsigned
lower_intrinsics
(
i_record
*
list
,
int
length
,
int
part_block_used
);
/**
* Creates an irprog pass for lower_intrinsics.
*
* @param name the name of this pass or NULL
* @param verify should this pass be verified?
* @param dump should this pass result be dumped?
* @param list an array of intrinsic map records
* @param length the length of the array
* @param part_block_used set to true if part_block() must be using during lowering
*/
ir_prog_pass_t
*
lower_intrinsics_pass
(
const
char
*
name
,
int
verify
,
int
dump
,
i_record
*
list
,
int
length
);
/**
/**
* A mapper for the integer/float absolute value: type abs(type v).
* A mapper for the integer/float absolute value: type abs(type v).
* Replaces the call by a Abs node.
* Replaces the call by a Abs node.
...
...
ir/lower/lower_intrinsics.c
View file @
eabef690
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include
"irvrfy.h"
#include
"irvrfy.h"
#include
"pmap.h"
#include
"pmap.h"
#include
"array_t.h"
#include
"array_t.h"
#include
"irpass_t.h"
#include
"iropt_dbg.h"
#include
"iropt_dbg.h"
#include
"error.h"
#include
"error.h"
...
@@ -158,6 +159,56 @@ unsigned lower_intrinsics(i_record *list, int length, int part_block_used) {
...
@@ -158,6 +159,56 @@ unsigned lower_intrinsics(i_record *list, int length, int part_block_used) {
return
nr_of_intrinsics
;
return
nr_of_intrinsics
;
}
/* lower_intrinsics */
}
/* lower_intrinsics */
struct
pass_t
{
ir_prog_pass_t
pass
;
int
part_block_used
;
int
length
;
i_record
list
[
1
];
};
/**
* Wrapper for running lower_intrinsics() as an irprog pass.
*/
static
int
pass_wrapper
(
ir_prog
*
irp
,
void
*
context
)
{
struct
pass_t
*
pass
=
context
;
lower_intrinsics
(
pass
->
list
,
pass
->
length
,
pass
->
part_block_used
);
/* probably this pass should not run again */
return
0
;
}
/* pass_wrapper */
/**
* Creates an irprog pass for lower_intrinsics.
*
* @param name the name of this pass or NULL
* @param verify should this pass be verified?
* @param dump should this pass result be dumped?
* @param list an array of intrinsic map records
* @param length the length of the array
* @param part_block_used set to true if part_block() must be using during lowering
*/
ir_prog_pass_t
*
lower_intrinsics_pass
(
const
char
*
name
,
int
verify
,
int
dump
,
i_record
*
list
,
int
length
)
{
struct
pass_t
*
pass
=
xmalloc
(
sizeof
(
*
pass
)
+
(
length
-
1
)
*
sizeof
(
pass
->
list
[
0
]));
memset
(
&
pass
->
pass
,
0
,
sizeof
(
pass
->
pass
));
pass
->
pass
.
kind
=
k_ir_prog_pass
;
pass
->
pass
.
run_on_irprog
=
pass_wrapper
;
pass
->
pass
.
context
=
pass
;
pass
->
pass
.
name
=
name
?
name
:
"lower_intrinsics"
;
pass
->
pass
.
verify
=
verify
!=
0
;
pass
->
pass
.
dump
=
dump
!=
0
;
INIT_LIST_HEAD
(
&
pass
->
pass
.
list
);
return
&
pass
->
pass
;
}
/* lower_intrinsics_pass*/
/**
/**
* Helper function, replace the call by the given node.
* Helper function, replace the call by the given node.
*
*
...
...
Write
Preview
Supports
Markdown
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