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
0f10e390
Commit
0f10e390
authored
Dec 25, 2005
by
Michael Beck
Browse files
renamed is_subclass* to is_SubClass*, is_superclass* to is_SuperClass* as is newer libfirm
reorganized calling_convention bits [r7142]
parent
4cf0c5c8
Changes
2
Hide whitespace changes
Inline
Side-by-side
ir/tr/type.c
View file @
0f10e390
...
...
@@ -636,7 +636,7 @@ int smaller_type (type *st, type *lt) {
switch
(
get_type_tpop_code
(
st
))
{
case
tpo_class
:
{
return
is_
s
ub
c
lass_of
(
st
,
lt
);
return
is_
S
ub
C
lass_of
(
st
,
lt
);
}
break
;
case
tpo_struct
:
{
if
(
get_struct_n_members
(
st
)
!=
get_struct_n_members
(
lt
))
return
0
;
...
...
@@ -900,7 +900,7 @@ void add_class_supertype (type *clss, type *supertype) {
assert
(
clss
&&
(
clss
->
type_op
==
type_class
));
assert
(
supertype
&&
(
supertype
->
type_op
==
type_class
));
ARR_APP1
(
type
*
,
clss
->
attr
.
ca
.
supertypes
,
supertype
);
for
(
i
=
0
;
i
<
get_class_n_subtypes
(
supertype
)
;
i
++
)
for
(
i
=
get_class_n_subtypes
(
supertype
)
-
1
;
i
>=
0
;
--
i
)
if
(
get_class_subtype
(
supertype
,
i
)
==
clss
)
/* Class already registered */
return
;
...
...
@@ -1345,16 +1345,20 @@ void (set_method_calling_convention)(type *method, unsigned cc_mask) {
_set_method_calling_convention
(
method
,
cc_mask
);
}
/* Returns the number of register parameters in a fastcall. 0 means default. */
unsigned
get_method_fastcall_n_regs
(
type
*
method
)
{
assert
(
IS_FASTCALL
(
get_method_calling_convention
(
method
))
&&
"not fastcall"
);
return
method
->
attr
.
ma
.
irg_calling_conv
>>
8
;
/* Returns the number of registers parameters, 0 means default. */
unsigned
get_method_n_regparams
(
type
*
method
)
{
unsigned
cc
=
get_method_calling_convention
(
method
);
assert
(
IS_FASTCALL
(
cc
));
return
cc
&
~
cc_bits
;
}
/* Sets the number of register parameters in a fastcall. 0 means default. */
void
set_method_fastcall_n_regs
(
type
*
method
,
unsigned
n_regs
)
{
assert
(
IS_FASTCALL
(
get_method_calling_convention
(
method
))
&&
"not fastcall"
);
method
->
attr
.
ma
.
irg_calling_conv
=
n_regs
<<
8
|
(
method
->
attr
.
ma
.
irg_calling_conv
&
0xFF
);
/* Sets the number of registers parameters, 0 means default. */
void
set_method_n_regparams
(
type
*
method
,
unsigned
n_regs
)
{
unsigned
cc
=
get_method_calling_convention
(
method
);
assert
(
IS_FASTCALL
(
cc
));
set_method_calling_convention
(
method
,
(
cc
&
cc_bits
)
|
(
n_regs
&
~
cc_bits
));
}
/* typecheck */
...
...
ir/tr/type.h
View file @
0f10e390
...
...
@@ -799,25 +799,27 @@ void set_method_additional_properties(type *method, unsigned property_mask);
void
set_method_additional_property
(
type
*
method
,
mtp_additional_property
flag
);
/**
* calling conventions:
the
lower
8
bits are
flags, the upper 24
*
are the number of arguments transmitted in registers.
* calling conventions: lower
24
bits are
the number of register parameters,
*
upper 8 encode the calling conventions
*/
typedef
enum
{
cc_reg_param
=
0x0000000
1
,
/**< Transmit parameters in registers, else the stack is used.
cc_reg_param
=
0x0
1
000000
,
/**< Transmit parameters in registers, else the stack is used.
This flag may be set as default on some architectures. */
cc_last_on_top
=
0x00000002
,
/**< The last non-register parameter is transmitted on top of
the stack. If this flag is not set, the first
non-register parameter is used (cdecl/stdcall convention) */
cc_callee_clear_stk
=
0x00000004
,
/**< The callee clears the stack. This forbids variadic
cc_last_on_top
=
0x02000000
,
/**< The last non-register parameter is transmitted on top of
the stack. This is equivalent to the stdcall or pascal
calling convention. If this flag is not set, the first
non-register parameter is used (cdecl calling convention) */
cc_callee_clear_stk
=
0x04000000
,
/**< The callee clears the stack. This forbids variadic
function calls (stdcall). */
cc_this_call
=
0x0000000
8
,
/**< The first parameter is a this pointer and is transmitted
cc_this_call
=
0x0
8
000000
,
/**< The first parameter is a this pointer and is transmitted
in a special way. */
/*
for easier acces
s */
/*
some ofter used case
s */
cc_cdecl_set
=
0
,
/**< cdecl calling convention */
cc_stdcall_set
=
cc_callee_clear_stk
,
/**< stdcall calling convention */
cc_fastcall_set
=
cc_reg_param
|
cc_callee_clear_stk
,
/**< fastcall calling convention */
cc_defmask
=
cc_reg_param
|
cc_last_on_top
|
cc_callee_clear_stk
cc_bits
=
0xFF000000
/**< the calling convention bits */
}
calling_convention
;
/** return the default calling convention for method types */
...
...
@@ -826,32 +828,32 @@ unsigned get_default_cc_mask(void);
/**
* check for the CDECL calling convention
*/
#define IS_CDECL(cc_mask) (((cc_mask) & cc_
defmask
) == cc_cdecl_set)
#define IS_CDECL(cc_mask) (((cc_mask) & cc_
bits
) == cc_cdecl_set)
/**
* check for the STDCALL calling convention
*/
#define IS_STDCALL(cc_mask) (((cc_mask) & cc_
defmask
) == cc_stdcall_set)
#define IS_STDCALL(cc_mask) (((cc_mask) & cc_
bits
) == cc_stdcall_set)
/**
* check for the FASTCALL calling convention
*/
#define IS_FASTCALL(cc_mask) (((cc_mask) & cc_
defmask
) == cc_fastcall_set)
#define IS_FASTCALL(cc_mask) (((cc_mask) & cc_
bits
) == cc_fastcall_set)
/**
*
add
the CDECL convention bits
*
set
the CDECL convention bits
*/
#define SET_CDECL(cc_mask) (((cc_mask) & ~cc_
defmask
) | cc_cdecl_set)
#define SET_CDECL(cc_mask) (((cc_mask) & ~cc_
bits
) | cc_cdecl_set)
/**
*
add
the STDCALL convention bits
*
set
the STDCALL convention bits
*/
#define SET_STDCALL(cc_mask) (((cc_mask) & ~cc_
defmask
) | cc_stdcall_set)
#define SET_STDCALL(cc_mask) (((cc_mask) & ~cc_
bits
) | cc_stdcall_set)
/**
*
add
the FASTCALL convention bits
*
set
the FASTCALL convention bits
*/
#define SET_FASTCALL(cc_mask) (((cc_mask) & ~cc_
defmask
) | cc_fastcall_set)
#define SET_FASTCALL(cc_mask) (((cc_mask) & ~cc_
bits
) | cc_fastcall_set)
/** Returns the calling convention of an entities graph. */
unsigned
get_method_calling_convention
(
const
type
*
method
);
...
...
@@ -859,11 +861,11 @@ unsigned get_method_calling_convention(const type *method);
/** Sets the calling convention of an entities graph. */
void
set_method_calling_convention
(
type
*
method
,
unsigned
cc_mask
);
/** Returns the number of register parameters
in a fastcall.
0 means default. */
unsigned
get_method_
fastcall_
n_regs
(
type
*
method
);
/** Returns the number of register
s
parameters
,
0 means default. */
unsigned
get_method_n_reg
param
s
(
type
*
method
);
/** Sets the number of register parameters
in a fastcall.
0 means default. */
void
set_method_
fastcall_
n_regs
(
type
*
method
,
unsigned
n_regs
);
/** Sets the number of register
s
parameters
,
0 means default. */
void
set_method_n_reg
param
s
(
type
*
method
,
unsigned
n_regs
);
/** Returns true if a type is a method type. */
int
is_Method_type
(
const
type
*
method
);
...
...
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