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
fdef2b39
Commit
fdef2b39
authored
May 23, 2008
by
Michael Beck
Browse files
Removed the arch_irn_handler_t. This was just an additional redirection without
greater function... [r19732]
parent
a14bf5bb
Changes
13
Hide whitespace changes
Inline
Side-by-side
ir/be/TEMPLATE/bearch_TEMPLATE.c
View file @
fdef2b39
...
...
@@ -589,22 +589,16 @@ void TEMPLATE_get_call_abi(const void *self, ir_type *method_type,
}
}
static
const
void
*
TEMPLATE_get_irn_ops
(
const
arch_irn_handler_t
*
self
,
const
ir_node
*
irn
)
static
const
void
*
TEMPLATE_get_irn_ops
(
const
ir_node
*
irn
)
{
(
void
)
self
;
(
void
)
irn
;
return
&
TEMPLATE_irn_ops
;
}
const
arch_irn_handler_t
TEMPLATE_irn_handler
=
{
TEMPLATE_get_irn_ops
};
const
arch_irn_handler_t
*
TEMPLATE_get_irn_handler
(
const
void
*
self
)
arch_get_irn_ops_t
*
TEMPLATE_get_irn_handler
(
const
void
*
self
)
{
(
void
)
self
;
return
&
TEMPLATE_
irn_handler
;
return
&
TEMPLATE_
get_irn_ops
;
}
int
TEMPLATE_to_appear_in_schedule
(
void
*
block_env
,
const
ir_node
*
irn
)
...
...
ir/be/TEMPLATE/bearch_TEMPLATE_t.h
View file @
fdef2b39
...
...
@@ -22,8 +22,8 @@
* @brief declarations for TEMPALTE backend -- private header
* @version $Id$
*/
#ifndef FIRM_BE_
IA32
_BEARCH_TEMPLATE_T_H
#define FIRM_BE_
IA32
_BEARCH_TEMPLATE_T_H
#ifndef FIRM_BE_
TEMPLATE
_BEARCH_TEMPLATE_T_H
#define FIRM_BE_
TEMPLATE
_BEARCH_TEMPLATE_T_H
#include "debug.h"
#include "bearch_TEMPLATE.h"
...
...
ir/be/arm/bearch_arm.c
View file @
fdef2b39
...
...
@@ -1088,19 +1088,14 @@ void arm_get_call_abi(const void *self, ir_type *method_type, be_abi_call_t *abi
}
}
static
const
void
*
arm_get_irn_ops
(
const
arch_irn_handler_t
*
self
,
const
ir_node
*
irn
)
{
(
void
)
self
;
static
const
void
*
arm_get_irn_ops
(
const
ir_node
*
irn
)
{
(
void
)
irn
;
return
&
arm_irn_ops
;
}
const
arch_irn_handler_t
arm_irn_handler
=
{
arm_get_irn_ops
};
const
arch_irn_handler_t
*
arm_get_irn_handler
(
const
void
*
self
)
{
arch_get_irn_ops_t
*
arm_get_irn_handler
(
const
void
*
self
)
{
(
void
)
self
;
return
&
arm_
irn_handler
;
return
&
arm_
get_irn_ops
;
}
int
arm_to_appear_in_schedule
(
void
*
block_env
,
const
ir_node
*
irn
)
{
...
...
ir/be/be_t.h
View file @
fdef2b39
...
...
@@ -80,7 +80,7 @@ struct be_options_t {
};
typedef
struct
{
arch_
irn_handler_t
irn_handler
;
arch_
get_irn_ops_t
*
get_irn_ops
;
arch_irn_ops_t
irn_ops
;
const
arch_env_t
*
arch_env
;
pmap
*
phi_attrs
;
...
...
ir/be/bearch.c
View file @
fdef2b39
...
...
@@ -50,14 +50,14 @@ arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa_if, FILE *fi
}
arch_env_t
*
arch_env_push_irn_handler
(
arch_env_t
*
env
,
const
arch_irn_handler
_t
*
handler
)
arch_get_irn_ops
_t
*
handler
)
{
assert
(
env
->
handlers_tos
<
ARCH_MAX_HANDLERS
);
env
->
handlers
[
env
->
handlers_tos
++
]
=
handler
;
return
env
;
}
const
arch_irn_handler
_t
*
arch_env_pop_irn_handler
(
arch_env_t
*
env
)
arch_get_irn_ops
_t
*
arch_env_pop_irn_handler
(
arch_env_t
*
env
)
{
assert
(
env
->
handlers_tos
>
0
&&
env
->
handlers_tos
<=
ARCH_MAX_HANDLERS
);
return
env
->
handlers
[
--
env
->
handlers_tos
];
...
...
@@ -85,16 +85,32 @@ int arch_register_class_put(const arch_register_class_t *cls, bitset_t *bs)
static
INLINE
const
arch_irn_ops_t
*
get_irn_ops
(
const
arch_env_t
*
env
,
const
ir_node
*
irn
)
{
#if 1
int
i
;
for
(
i
=
env
->
handlers_tos
-
1
;
i
>=
0
;
--
i
)
{
const
arch_irn_handler_t
*
handler
=
env
->
handlers
[
i
];
const
arch_irn_ops_t
*
ops
=
handler
->
get_irn_ops
(
handler
,
irn
);
arch_get_irn_ops_t
*
get_irn_ops
=
env
->
handlers
[
i
];
const
arch_irn_ops_t
*
ops
=
get_irn_ops
(
irn
);
if
(
ops
)
return
ops
;
}
#else
if
(
is_Phi
(
irn
)
&&
!
mode_is_datab
(
get_irn_mode
(
irn
)))
{
const
phi_handler_t
*
h
;
return
&
h
->
irn_ops
;
}
if
(
is_Proj
(
irn
))
{
irn
=
get_Proj_pred
(
irn
);
if
(
is_Proj
(
irn
))
{
assert
(
get_irn_mode
(
irn
)
==
mode_T
);
irn
=
get_Proj_pred
(
irn
);
}
}
if
(
is_be_node
(
irn
))
return
&
be_node_irn_ops
;
#endif
return
fallback_irn_ops
;
}
...
...
ir/be/bearch.h
View file @
fdef2b39
...
...
@@ -41,7 +41,6 @@ typedef struct arch_isa_t arch_isa_t;
typedef
struct
arch_env_t
arch_env_t
;
typedef
struct
arch_irn_ops_if_t
arch_irn_ops_if_t
;
typedef
struct
arch_irn_ops_t
arch_irn_ops_t
;
typedef
struct
arch_irn_handler_t
arch_irn_handler_t
;
typedef
struct
arch_code_generator_t
arch_code_generator_t
;
typedef
struct
arch_code_generator_if_t
arch_code_generator_if_t
;
...
...
@@ -273,6 +272,14 @@ extern arch_irn_flags_t arch_irn_get_flags(const arch_env_t *env, const ir_node
#define arch_irn_consider_in_reg_alloc(env, cls, irn) \
(arch_irn_has_reg_class(env, irn, -1, cls) && !arch_irn_is(env, irn, ignore))
/**
* Get the operations of an irn.
* @param self The handler from which the method is invoked.
* @param irn Some node.
* @return Operations for that irn.
*/
typedef
const
void
*
(
arch_get_irn_ops_t
)(
const
ir_node
*
irn
);
/**
* Initialize the architecture environment struct.
* @param isa The isa which shall be put into the environment.
...
...
@@ -288,14 +295,14 @@ extern arch_env_t *arch_env_init(arch_env_t *env, const arch_isa_if_t *isa,
* @param handler A node handler.
* @return The environment itself.
*/
extern
arch_env_t
*
arch_env_push_irn_handler
(
arch_env_t
*
env
,
const
arch_irn_handler
_t
*
handler
);
extern
arch_env_t
*
arch_env_push_irn_handler
(
arch_env_t
*
env
,
arch_get_irn_ops
_t
*
handler
);
/**
* Remove a node handler from the handler stack.
* @param env The architecture environment.
* @return The popped handler.
*/
extern
const
arch_irn_handler
_t
*
arch_env_pop_irn_handler
(
arch_env_t
*
env
);
extern
arch_get_irn_ops
_t
*
arch_env_pop_irn_handler
(
arch_env_t
*
env
);
/**
* Register an instruction set architecture
...
...
ir/be/bearch_t.h
View file @
fdef2b39
...
...
@@ -318,21 +318,6 @@ struct arch_irn_ops_t {
const
arch_irn_ops_if_t
*
impl
;
};
/**
* Somebody who can be asked about IR nodes.
*/
struct
arch_irn_handler_t
{
/**
* Get the operations of an irn.
* @param self The handler from which the method is invoked.
* @param irn Some node.
* @return Operations for that irn.
*/
const
void
*
(
*
get_irn_ops
)(
const
arch_irn_handler_t
*
handler
,
const
ir_node
*
irn
);
};
/**
* The code generator interface.
*/
...
...
@@ -497,9 +482,8 @@ struct arch_isa_if_t {
* The irn handler for this architecture.
* The irn handler is registered by the Firm back end
* when the architecture is initialized.
* (May be NULL).
*/
const
arch_irn_handler
_t
*
(
*
get_irn_handler
)(
const
void
*
self
);
arch_get_irn_ops
_t
*
(
*
get_irn_handler
)(
const
void
*
self
);
/**
* Get the code generator interface.
...
...
@@ -593,7 +577,7 @@ struct arch_isa_if_t {
struct
arch_env_t
{
arch_isa_t
*
isa
;
/**< The isa about which everything is. */
arch_
irn_handler_t
cons
t
*
handlers
[
ARCH_MAX_HANDLERS
];
/**< The handlers are organized as
arch_
get_irn_ops_
t
*
handlers
[
ARCH_MAX_HANDLERS
];
/**< The handlers are organized as
a stack. */
int
handlers_tos
;
/**< The stack pointer of the handler
...
...
ir/be/bemain.c
View file @
fdef2b39
...
...
@@ -250,7 +250,7 @@ const backend_params *be_init(void)
*/
static
be_main_env_t
*
be_init_env
(
be_main_env_t
*
env
,
FILE
*
file_handle
)
{
const
arch_irn_handler
_t
*
handler
;
arch_get_irn_ops
_t
*
handler
;
memset
(
env
,
0
,
sizeof
(
*
env
));
env
->
options
=
&
be_options
;
...
...
@@ -275,9 +275,9 @@ static be_main_env_t *be_init_env(be_main_env_t *env, FILE *file_handle)
* This irn handler takes care of the platform independent
* spill, reload and perm nodes.
*/
arch_env_push_irn_handler
(
&
env
->
arch_env
,
&
be_node_
irn_handler
);
arch_env_push_irn_handler
(
&
env
->
arch_env
,
be_node_
get_irn_ops
);
be_phi_handler_new
(
env
);
arch_env_push_irn_handler
(
&
env
->
arch_env
,
&
env
->
phi_handler
.
irn_handler
);
arch_env_push_irn_handler
(
&
env
->
arch_env
,
env
->
phi_handler
.
get_irn_ops
);
be_dbg_open
();
return
env
;
...
...
ir/be/benode.c
View file @
fdef2b39
...
...
@@ -66,6 +66,9 @@
static
unsigned
be_node_tag
=
FOURCC
(
'B'
,
'E'
,
'N'
,
'O'
);
/** The current phi handler */
static
const
phi_handler_t
*
curr_phi_handler
;
typedef
struct
{
arch_register_req_t
req
;
arch_irn_flags_t
flags
;
...
...
@@ -1337,7 +1340,7 @@ static const arch_irn_ops_t be_node_irn_ops = {
&
be_node_irn_ops_if
};
const
void
*
be_node_get_irn_ops
(
const
arch_irn_handler_t
*
self
,
const
ir_node
*
irn
)
const
void
*
be_node_get_irn_ops
(
const
ir_node
*
irn
)
{
if
(
is_Proj
(
irn
))
{
irn
=
get_Proj_pred
(
irn
);
...
...
@@ -1346,14 +1349,9 @@ const void *be_node_get_irn_ops(const arch_irn_handler_t *self, const ir_node *i
irn
=
get_Proj_pred
(
irn
);
}
}
(
void
)
self
;
return
is_be_node
(
irn
)
?
&
be_node_irn_ops
:
NULL
;
}
const
arch_irn_handler_t
be_node_irn_handler
=
{
be_node_get_irn_ops
};
/*
____ _ _ ___ ____ _ _ _ _ _ _
| _ \| |__ (_) |_ _| _ \| \ | | | | | | __ _ _ __ __| | | ___ _ __
...
...
@@ -1373,15 +1371,12 @@ typedef struct {
#define get_phi_handler_from_ops(h) container_of(h, phi_handler_t, irn_ops)
static
const
void
*
phi_get_irn_ops
(
const
arch_irn_handler_t
*
handler
,
const
ir_node
*
irn
)
const
void
*
phi_get_irn_ops
(
const
ir_node
*
irn
)
{
const
phi_handler_t
*
h
;
if
(
!
is_Phi
(
irn
)
||
!
mode_is_datab
(
get_irn_mode
(
irn
)))
if
(
!
is_Phi
(
irn
)
||
!
mode_is_datab
(
get_irn_mode
(
irn
)))
return
NULL
;
h
=
get_phi_handler_from_handler
(
handler
);
return
&
h
->
irn_ops
;
return
&
curr_phi_handler
->
irn_ops
;
}
static
INLINE
...
...
@@ -1584,18 +1579,20 @@ const arch_irn_ops_if_t phi_irn_ops = {
void
be_phi_handler_new
(
be_main_env_t
*
env
)
{
phi_handler_t
*
h
=
&
env
->
phi_handler
;
h
->
irn_handler
.
get_irn_ops
=
phi_get_irn_ops
;
h
->
irn_ops
.
impl
=
&
phi_irn_ops
;
h
->
arch_env
=
&
env
->
arch_env
;
h
->
phi_attrs
=
pmap_create
();
phi_handler_t
*
h
=
&
env
->
phi_handler
;
h
->
get_irn_ops
=
phi_get_irn_ops
;
h
->
irn_ops
.
impl
=
&
phi_irn_ops
;
h
->
arch_env
=
&
env
->
arch_env
;
h
->
phi_attrs
=
pmap_create
();
curr_phi_handler
=
h
;
}
void
be_phi_handler_free
(
be_main_env_t
*
env
)
{
phi_handler_t
*
h
=
&
env
->
phi_handler
;
pmap_destroy
(
h
->
phi_attrs
);
h
->
phi_attrs
=
NULL
;
h
->
phi_attrs
=
NULL
;
curr_phi_handler
=
NULL
;
}
void
be_phi_handler_reset
(
be_main_env_t
*
env
)
...
...
ir/be/benode_t.h
View file @
fdef2b39
...
...
@@ -537,7 +537,7 @@ void be_set_phi_flags(const arch_env_t *arch_env, ir_node *phi,
/**
* irn handler for common be nodes.
*/
extern
const
arch_irn_handler_t
be_node_irn_handler
;
const
void
*
be_node_get_irn_ops
(
const
ir_node
*
irn
)
;
static
INLINE
int
be_is_Spill
(
const
ir_node
*
irn
)
{
return
get_irn_opcode
(
irn
)
==
beo_Spill
;
}
static
INLINE
int
be_is_Reload
(
const
ir_node
*
irn
)
{
return
get_irn_opcode
(
irn
)
==
beo_Reload
;
}
...
...
ir/be/ia32/bearch_ia32.c
View file @
fdef2b39
...
...
@@ -1896,22 +1896,16 @@ static void ia32_get_call_abi(const void *self, ir_type *method_type,
}
static
const
void
*
ia32_get_irn_ops
(
const
arch_irn_handler_t
*
self
,
const
ir_node
*
irn
)
static
const
void
*
ia32_get_irn_ops
(
const
ir_node
*
irn
)
{
(
void
)
self
;
(
void
)
irn
;
return
&
ia32_irn_ops
;
}
const
arch_irn_handler_t
ia32_irn_handler
=
{
ia32_get_irn_ops
};
const
arch_irn_handler_t
*
ia32_get_irn_handler
(
const
void
*
self
)
arch_get_irn_ops_t
*
ia32_get_irn_handler
(
const
void
*
self
)
{
(
void
)
self
;
return
&
ia32_
irn_handler
;
return
&
ia32_
get_irn_ops
;
}
int
ia32_to_appear_in_schedule
(
void
*
block_env
,
const
ir_node
*
irn
)
...
...
ir/be/mips/bearch_mips.c
View file @
fdef2b39
...
...
@@ -947,22 +947,16 @@ static void mips_get_call_abi(const void *self, ir_type *method_type,
}
}
static
const
void
*
mips_get_irn_ops
(
const
arch_irn_handler_t
*
self
,
const
ir_node
*
irn
)
static
const
void
*
mips_get_irn_ops
(
const
ir_node
*
irn
)
{
(
void
)
self
;
(
void
)
irn
;
return
&
mips_irn_ops
;
}
const
arch_irn_handler_t
mips_irn_handler
=
{
mips_get_irn_ops
};
const
arch_irn_handler_t
*
mips_get_irn_handler
(
const
void
*
self
)
arch_get_irn_ops_t
*
mips_get_irn_handler
(
const
void
*
self
)
{
(
void
)
self
;
return
&
mips_
irn_handler
;
return
&
mips_
get_irn_ops
;
}
/**
...
...
ir/be/ppc32/bearch_ppc32.c
View file @
fdef2b39
...
...
@@ -848,19 +848,14 @@ static void ppc32_get_call_abi(const void *self, ir_type *method_type, be_abi_ca
}
}
static
const
void
*
ppc32_get_irn_ops
(
const
arch_irn_handler_t
*
self
,
const
ir_node
*
irn
)
{
(
void
)
self
;
static
const
void
*
ppc32_get_irn_ops
(
const
ir_node
*
irn
)
{
(
void
)
irn
;
return
&
ppc32_irn_ops
;
}
const
arch_irn_handler_t
ppc32_irn_handler
=
{
ppc32_get_irn_ops
};
const
arch_irn_handler_t
*
ppc32_get_irn_handler
(
const
void
*
self
)
{
arch_get_irn_ops_t
*
ppc32_get_irn_handler
(
const
void
*
self
)
{
(
void
)
self
;
return
&
ppc32_
irn_handler
;
return
&
ppc32_
get_irn_ops
;
}
int
ppc32_to_appear_in_schedule
(
void
*
block_env
,
const
ir_node
*
irn
)
{
...
...
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