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
92a87cb7
Commit
92a87cb7
authored
May 05, 2014
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Use backend interface for struct field offsets.
From-SVN: r210074
parent
0db74577
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
16 deletions
+15
-16
gcc/go/gofrontend/expressions.cc
+15
-16
No files found.
gcc/go/gofrontend/expressions.cc
View file @
92a87cb7
...
...
@@ -14815,28 +14815,27 @@ class Struct_field_offset_expression : public Expression
tree
Struct_field_offset_expression
::
do_get_tree
(
Translate_context
*
context
)
{
tree
type_tree
=
type_to_tree
(
this
->
type_
->
get_backend
(
context
->
gogo
()));
if
(
type_tree
==
error_mark_node
)
return
error_mark_node
;
tree
val_type_tree
=
type_to_tree
(
this
->
type
()
->
get_backend
(
context
->
gogo
()));
go_assert
(
val_type_tree
!=
error_mark_node
);
const
Struct_field_list
*
fields
=
this
->
type_
->
fields
();
tree
struct_field_tree
=
TYPE_FIELDS
(
type_tree
);
Struct_field_list
::
const_iterator
p
;
unsigned
i
=
0
;
for
(
p
=
fields
->
begin
();
p
!=
fields
->
end
();
++
p
,
struct_field_tree
=
DECL_CHAIN
(
struct_field_tree
))
{
go_assert
(
struct_field_tree
!=
NULL_TREE
);
if
(
&*
p
==
this
->
field_
)
break
;
}
++
p
,
++
i
)
if
(
&*
p
==
this
->
field_
)
break
;
go_assert
(
&*
p
==
this
->
field_
);
return
fold_convert_loc
(
BUILTINS_LOCATION
,
val_type_tree
,
byte_position
(
struct_field_tree
));
Gogo
*
gogo
=
context
->
gogo
();
Btype
*
btype
=
this
->
type_
->
get_backend
(
gogo
);
size_t
offset
=
gogo
->
backend
()
->
type_field_offset
(
btype
,
i
);
mpz_t
offsetval
;
mpz_init_set_ui
(
offsetval
,
offset
);
Type
*
uptr_type
=
Type
::
lookup_integer_type
(
"uintptr"
);
Expression
*
ret
=
Expression
::
make_integer
(
&
offsetval
,
uptr_type
,
Linemap
::
predeclared_location
());
mpz_clear
(
offsetval
);
return
ret
->
get_tree
(
context
);
}
// Dump ast representation for a struct field offset expression.
...
...
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