Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
18ae7f63
Commit
18ae7f63
authored
May 12, 2001
by
Alexandre Oliva
Committed by
Alexandre Oliva
May 12, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reverted Geoff Keating's 2001-05-03's patch.
From-SVN: r41988
parent
a45b480e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
85 deletions
+61
-85
gcc/cp/ChangeLog
+4
-0
gcc/cp/cp-tree.h
+40
-24
gcc/cp/decl.c
+1
-9
gcc/cp/expr.c
+2
-3
gcc/cp/typeck.c
+14
-49
No files found.
gcc/cp/ChangeLog
View file @
18ae7f63
2001-05-11 Alexandre Oliva <aoliva@redhat.com>
Reverted Geoff Keating's 2001-05-03's patch.
2001-05-11 Ira Ruben <ira@apple.com>
* cp/cp-tree.h (C_EXP_ORIGINAL_CODE): Delete; declared in c-common.h.
...
...
gcc/cp/cp-tree.h
View file @
18ae7f63
...
...
@@ -607,7 +607,6 @@ enum cp_tree_index
CPTI_NELTS_IDENTIFIER
,
CPTI_THIS_IDENTIFIER
,
CPTI_PFN_IDENTIFIER
,
CPTI_PFN_VFLAG_IDENTIFIER
,
CPTI_PFN_OR_DELTA2_IDENTIFIER
,
CPTI_VPTR_IDENTIFIER
,
CPTI_STD_IDENTIFIER
,
...
...
@@ -732,7 +731,6 @@ extern tree cp_global_trees[CPTI_MAX];
#define nelts_identifier cp_global_trees[CPTI_NELTS_IDENTIFIER]
#define this_identifier cp_global_trees[CPTI_THIS_IDENTIFIER]
#define pfn_identifier cp_global_trees[CPTI_PFN_IDENTIFIER]
#define pfn_vflag_identifier cp_global_trees[CPTI_PFN_VFLAG_IDENTIFIER]
#define pfn_or_delta2_identifier cp_global_trees[CPTI_PFN_OR_DELTA2_IDENTIFIER]
#define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
/* The name of the std namespace. */
...
...
@@ -2616,27 +2614,29 @@ extern int flag_new_for_scope;
/* A pointer-to-function member type looks like:
struct {
__P __pfn;
ptrdiff_t __delta;
short __delta;
short __index;
union {
P __pfn;
short __delta2;
} __pfn_or_delta2;
};
where P is either a POINTER_TYPE to a METHOD_TYPE appropriate for
the pointer to member, or one plus twice the index into the vtable;
the two cases are distinguished by looking at the least significant
bit of P. When FUNCTION_BOUNDARY is less than 16 (and so it might
happen that the function pointer might naturally have the low bit
set), the type is instead
where P is a POINTER_TYPE to a METHOD_TYPE appropriate for the
pointer to member. The fields are used as follows:
struct {
__P __pfn;
ptrdiff_t __delta;
char __vflag;
};
If __INDEX is -1, then the function to call is non-virtual, and
is located at the address given by __PFN.
and __pfn is a pointer to a method when __vflag is zero
.
If __INDEX is zero, then this a NULL pointer-to-member
.
In all cases, the value to use for the THIS parameter is the
address of the object plus __DELTA / 2 .
Otherwise, the function to call is virtual. Then, __DELTA2 gives
the offset from an instance of the object to the virtual function
table, and __INDEX - 1 is the index into the vtable to use to
find the function.
The value to use for the THIS parameter is the address of the
object plus __DELTA.
For example, given:
...
...
@@ -2653,9 +2653,27 @@ extern int flag_new_for_scope;
the pointer-to-member for `&S::f' looks like:
{ &f__2B2, 4, 0 };
{ 4, -1, { &f__2B2 } };
The `4' means that given an `S*' you have to add 4 bytes to get to
the address of the `B2*'. Then, the -1 indicates that this is a
non-virtual function. Of course, `&f__2B2' is the name of that
function.
(Of course, the exact values may differ depending on the mangling
scheme, sizes of types, and such.).
Under the new ABI, we do:
struct {
__P __pfn;
ptrdiff_t __delta;
};
*/
(We don't need DELTA2, because the vtable is always the first thing
in the object.) If the function is virtual, then PFN is one plus
twice the index into the vtable; otherwise, it is just a pointer to
the function. */
/* Get the POINTER_TYPE to the METHOD_TYPE associated with this
pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
...
...
@@ -4445,10 +4463,8 @@ extern int cp_type_quals PARAMS ((tree));
extern
int
cp_has_mutable_p
PARAMS
((
tree
));
extern
int
at_least_as_qualified_p
PARAMS
((
tree
,
tree
));
extern
int
more_qualified_p
PARAMS
((
tree
,
tree
));
extern
tree
build_ptrmemfunc1
PARAMS
((
tree
,
tree
,
tree
,
tree
));
extern
void
expand_ptrmemfunc_cst
PARAMS
((
tree
,
tree
*
,
tree
*
,
tree
*
));
extern
tree
build_ptrmemfunc1
PARAMS
((
tree
,
tree
,
tree
));
extern
void
expand_ptrmemfunc_cst
PARAMS
((
tree
,
tree
*
,
tree
*
));
extern
tree
pfn_from_ptrmemfunc
PARAMS
((
tree
));
extern
tree
type_after_usual_arithmetic_conversions
PARAMS
((
tree
,
tree
));
extern
tree
composite_pointer_type
PARAMS
((
tree
,
tree
,
tree
,
tree
,
...
...
gcc/cp/decl.c
View file @
18ae7f63
...
...
@@ -6303,7 +6303,6 @@ initialize_predefined_identifiers ()
{
"nelts"
,
&
nelts_identifier
,
0
},
{
THIS_NAME
,
&
this_identifier
,
0
},
{
VTABLE_PFN_NAME
,
&
pfn_identifier
,
0
},
{
"__vflag"
,
&
pfn_vflag_identifier
,
0
},
{
"__pfn_or_delta2"
,
&
pfn_or_delta2_identifier
,
0
},
{
"_vptr"
,
&
vptr_identifier
,
0
},
{
"__vtt_parm"
,
&
vtt_parm_identifier
,
0
},
...
...
@@ -9157,14 +9156,7 @@ build_ptrmemfunc_type (type)
fields
[
0
]
=
build_decl
(
FIELD_DECL
,
pfn_identifier
,
type
);
fields
[
1
]
=
build_decl
(
FIELD_DECL
,
delta_identifier
,
delta_type_node
);
if
(
FUNCTION_BOUNDARY
<
16
)
{
fields
[
2
]
=
build_decl
(
FIELD_DECL
,
pfn_vflag_identifier
,
char_type_node
);
finish_builtin_type
(
t
,
"__ptrmemfunc_type"
,
fields
,
2
,
ptr_type_node
);
}
else
{
finish_builtin_type
(
t
,
"__ptrmemfunc_type"
,
fields
,
1
,
ptr_type_node
);
}
finish_builtin_type
(
t
,
"__ptrmemfunc_type"
,
fields
,
1
,
ptr_type_node
);
/* Zap out the name so that the back-end will give us the debugging
information for this anonymous RECORD_TYPE. */
...
...
gcc/cp/expr.c
View file @
18ae7f63
...
...
@@ -62,10 +62,9 @@ cplus_expand_constant (cst)
{
tree
delta
;
tree
pfn
;
tree
flag
;
expand_ptrmemfunc_cst
(
cst
,
&
delta
,
&
pfn
,
&
flag
);
cst
=
build_ptrmemfunc1
(
type
,
delta
,
pfn
,
flag
);
expand_ptrmemfunc_cst
(
cst
,
&
delta
,
&
pfn
);
cst
=
build_ptrmemfunc1
(
type
,
delta
,
pfn
);
}
}
break
;
...
...
gcc/cp/typeck.c
View file @
18ae7f63
...
...
@@ -2909,22 +2909,9 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
idx
=
cp_build_binary_op
(
TRUNC_DIV_EXPR
,
build1
(
NOP_EXPR
,
vtable_index_type
,
e3
),
TYPE_SIZE_UNIT
(
vtable_entry_type
));
if
(
FUNCTION_BOUNDARY
<
16
)
{
tree
delta
;
tree
pfn
;
if
(
TREE_CODE
(
function
)
==
PTRMEM_CST
)
expand_ptrmemfunc_cst
(
function
,
&
delta
,
&
pfn
,
&
e1
);
else
e1
=
build_component_ref
(
function
,
pfn_vflag_identifier
,
NULL_TREE
,
0
);
}
else
{
e1
=
cp_build_binary_op
(
BIT_AND_EXPR
,
build1
(
NOP_EXPR
,
vtable_index_type
,
e3
),
integer_one_node
);
}
e1
=
cp_build_binary_op
(
BIT_AND_EXPR
,
build1
(
NOP_EXPR
,
vtable_index_type
,
e3
),
integer_one_node
);
vtbl
=
convert_pointer_to
(
ptr_type_node
,
instance
);
delta
=
cp_convert
(
ptrdiff_type_node
,
...
...
@@ -6008,34 +5995,23 @@ get_delta_difference (from, to, force)
the other components as specified. */
tree
build_ptrmemfunc1
(
type
,
delta
,
pfn
,
flag
)
tree
type
,
delta
,
pfn
,
flag
;
build_ptrmemfunc1
(
type
,
delta
,
pfn
)
tree
type
,
delta
,
pfn
;
{
tree
u
=
NULL_TREE
;
tree
delta_field
;
tree
pfn_field
;
tree
vflag_field
;
/* Pull the FIELD_DECLs out of the type. */
pfn_field
=
TYPE_FIELDS
(
type
);
delta_field
=
TREE_CHAIN
(
pfn_field
);
vflag_field
=
TREE_CHAIN
(
delta_field
);
/* NULL if no such field. */
/* Make sure DELTA has the type we want. */
delta
=
convert_and_check
(
delta_type_node
,
delta
);
/* Finish creating the initializer. */
if
(
FUNCTION_BOUNDARY
<
16
)
{
u
=
tree_cons
(
pfn_field
,
pfn
,
tree_cons
(
delta_field
,
delta
,
build_tree_list
(
vflag_field
,
flag
)));
}
else
{
u
=
tree_cons
(
pfn_field
,
pfn
,
build_tree_list
(
delta_field
,
delta
));
}
u
=
tree_cons
(
pfn_field
,
pfn
,
build_tree_list
(
delta_field
,
delta
));
u
=
build
(
CONSTRUCTOR
,
type
,
NULL_TREE
,
u
);
TREE_CONSTANT
(
u
)
=
TREE_CONSTANT
(
pfn
)
&&
TREE_CONSTANT
(
delta
);
TREE_STATIC
(
u
)
=
(
TREE_CONSTANT
(
u
)
...
...
@@ -6071,7 +6047,6 @@ build_ptrmemfunc (type, pfn, force)
{
tree
delta
=
NULL_TREE
;
tree
npfn
=
NULL_TREE
;
tree
flag
=
NULL_TREE
;
tree
n
;
if
(
!
force
...
...
@@ -6100,21 +6075,18 @@ build_ptrmemfunc (type, pfn, force)
/* Obtain the function pointer and the current DELTA. */
if
(
TREE_CODE
(
pfn
)
==
PTRMEM_CST
)
expand_ptrmemfunc_cst
(
pfn
,
&
delta
,
&
npfn
,
&
flag
);
expand_ptrmemfunc_cst
(
pfn
,
&
delta
,
&
npfn
);
else
{
npfn
=
build_component_ref
(
pfn
,
pfn_identifier
,
NULL_TREE
,
0
);
delta
=
build_component_ref
(
pfn
,
delta_identifier
,
NULL_TREE
,
0
);
if
(
FUNCTION_BOUNDARY
<
16
)
flag
=
build_component_ref
(
pfn
,
pfn_vflag_identifier
,
NULL_TREE
,
0
);
}
/* Under the new ABI, the conversion is easy. Just adjust
the DELTA field. */
delta
=
cp_convert
(
ptrdiff_type_node
,
delta
);
delta
=
cp_build_binary_op
(
PLUS_EXPR
,
delta
,
n
);
return
build_ptrmemfunc1
(
to_type
,
delta
,
npfn
,
flag
);
return
build_ptrmemfunc1
(
to_type
,
delta
,
npfn
);
}
/* Handle null pointer to member function conversions. */
...
...
@@ -6123,8 +6095,7 @@ build_ptrmemfunc (type, pfn, force)
pfn
=
build_c_cast
(
type
,
integer_zero_node
);
return
build_ptrmemfunc1
(
to_type
,
integer_zero_node
,
pfn
,
integer_zero_node
);
pfn
);
}
if
(
type_unknown_p
(
pfn
))
...
...
@@ -6135,7 +6106,7 @@ build_ptrmemfunc (type, pfn, force)
return
make_ptrmem_cst
(
to_type
,
fn
);
}
/* Return the DELTA,
PFN, and FLAG
values for the PTRMEM_CST
/* Return the DELTA,
IDX, PFN, and DELTA2
values for the PTRMEM_CST
given by CST.
??? There is no consistency as to the types returned for the above
...
...
@@ -6143,11 +6114,10 @@ build_ptrmemfunc (type, pfn, force)
integer_type_node. */
void
expand_ptrmemfunc_cst
(
cst
,
delta
,
pfn
,
flag
)
expand_ptrmemfunc_cst
(
cst
,
delta
,
pfn
)
tree
cst
;
tree
*
delta
;
tree
*
pfn
;
tree
*
flag
;
{
tree
type
=
TREE_TYPE
(
cst
);
tree
fn
=
PTRMEM_CST_MEMBER
(
cst
);
...
...
@@ -6165,10 +6135,7 @@ expand_ptrmemfunc_cst (cst, delta, pfn, flag)
*
delta
=
get_delta_difference
(
fn_class
,
ptr_class
,
/*force=*/
0
);
if
(
!
DECL_VIRTUAL_P
(
fn
))
{
*
pfn
=
convert
(
TYPE_PTRMEMFUNC_FN_TYPE
(
type
),
build_addr_func
(
fn
));
*
flag
=
integer_zero_node
;
}
*
pfn
=
convert
(
TYPE_PTRMEMFUNC_FN_TYPE
(
type
),
build_addr_func
(
fn
));
else
{
/* If we're dealing with a virtual function, we have to adjust 'this'
...
...
@@ -6188,7 +6155,6 @@ expand_ptrmemfunc_cst (cst, delta, pfn, flag)
integer_one_node
));
*
pfn
=
fold
(
build1
(
NOP_EXPR
,
TYPE_PTRMEMFUNC_FN_TYPE
(
type
),
*
pfn
));
*
flag
=
integer_one_node
;
}
}
...
...
@@ -6203,9 +6169,8 @@ pfn_from_ptrmemfunc (t)
{
tree
delta
;
tree
pfn
;
tree
flag
;
expand_ptrmemfunc_cst
(
t
,
&
delta
,
&
pfn
,
&
flag
);
expand_ptrmemfunc_cst
(
t
,
&
delta
,
&
pfn
);
if
(
pfn
)
return
pfn
;
}
...
...
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