aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <derodat@adacore.com>2017-09-15 16:20:21 +0000
committerPierre-Marie de Rodat <derodat@adacore.com>2017-09-15 16:20:21 +0000
commit499746f9c0c73081157a71fb7033dc83916b6923 (patch)
tree5622929d75f96b1b8b73f3fb8003a4e7ac7b6f8e /gcc/cgraph.c
parent4a92e837fcea7f2c7ebd5e547990d0a473df68f9 (diff)
Add comments to struct cgraph_thunk_info
This commit adds comments to fields in the cgraph_thunk_info structure declaration from cgraph.h. They will hopefully answer questions that people like myself can ask while discovering the thunk machinery. I also made an assertion stricter in cgraph_node::create_thunk. Bootsrapped and regtested on x86_64-linux. gcc/ * cgraph.h (cgraph_thunk_info): Add comments. * cgraph.c (cgraph_node::create_thunk): Adjust comment, make assert for VIRTUAL_* arguments stricter. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@252828 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 69aa6c5bce2..8bffdec8fb7 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -603,7 +603,7 @@ cgraph_node::create_same_body_alias (tree alias, tree decl)
/* Add thunk alias into callgraph. The alias declaration is ALIAS and it
aliases DECL with an adjustments made into the first parameter.
- See comments in thunk_adjust for detail on the parameters. */
+ See comments in struct cgraph_thunk_info for detail on the parameters. */
cgraph_node *
cgraph_node::create_thunk (tree alias, tree, bool this_adjusting,
@@ -619,13 +619,17 @@ cgraph_node::create_thunk (tree alias, tree, bool this_adjusting,
node->reset ();
else
node = cgraph_node::create (alias);
- gcc_checking_assert (!virtual_offset
- || wi::eq_p (virtual_offset, virtual_value));
+
+ /* Make sure that if VIRTUAL_OFFSET is in sync with VIRTUAL_VALUE. */
+ gcc_checking_assert (virtual_offset
+ ? wi::eq_p (virtual_offset, virtual_value)
+ : virtual_value == 0);
+
node->thunk.fixed_offset = fixed_offset;
- node->thunk.this_adjusting = this_adjusting;
node->thunk.virtual_value = virtual_value;
- node->thunk.virtual_offset_p = virtual_offset != NULL;
node->thunk.alias = real_alias;
+ node->thunk.this_adjusting = this_adjusting;
+ node->thunk.virtual_offset_p = virtual_offset != NULL;
node->thunk.thunk_p = true;
node->definition = true;