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
5b735706
Commit
5b735706
authored
May 07, 2011
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use backend types for all type conversions.
From-SVN: r173520
parent
c47d0034
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
56 deletions
+63
-56
gcc/go/gofrontend/expressions.cc
+0
-0
gcc/go/gofrontend/gogo-tree.cc
+22
-15
gcc/go/gofrontend/gogo.cc
+2
-2
gcc/go/gofrontend/statements.cc
+1
-1
gcc/go/gofrontend/types.cc
+0
-0
gcc/go/gofrontend/types.h
+38
-38
No files found.
gcc/go/gofrontend/expressions.cc
View file @
5b735706
This diff is collapsed.
Click to expand it.
gcc/go/gofrontend/gogo-tree.cc
View file @
5b735706
...
...
@@ -909,10 +909,13 @@ Named_object::get_tree(Gogo* gogo, Named_object* function)
Type
*
type
=
named_constant
->
type
();
if
(
type
!=
NULL
&&
!
type
->
is_abstract
())
{
if
(
!
type
->
is_error
())
expr_tree
=
fold_convert
(
type
->
get_tree
(
gogo
),
expr_tree
);
else
if
(
type
->
is_error
())
expr_tree
=
error_mark_node
;
else
{
Btype
*
btype
=
type
->
get_backend
(
gogo
);
expr_tree
=
fold_convert
(
type_to_tree
(
btype
),
expr_tree
);
}
}
if
(
expr_tree
==
error_mark_node
)
decl
=
error_mark_node
;
...
...
@@ -939,7 +942,7 @@ Named_object::get_tree(Gogo* gogo, Named_object* function)
case
NAMED_OBJECT_TYPE
:
{
Named_type
*
named_type
=
this
->
u_
.
type_value
;
tree
type_tree
=
named_type
->
get_tree
(
gogo
);
tree
type_tree
=
type_to_tree
(
named_type
->
get_backend
(
gogo
)
);
if
(
type_tree
==
error_mark_node
)
decl
=
error_mark_node
;
else
...
...
@@ -1104,7 +1107,7 @@ Function::get_or_make_decl(Gogo* gogo, Named_object* no, tree id)
{
if
(
this
->
fndecl_
==
NULL_TREE
)
{
tree
functype
=
t
his
->
type_
->
get_tree
(
gogo
);
tree
functype
=
t
ype_to_tree
(
this
->
type_
->
get_backend
(
gogo
)
);
if
(
functype
==
error_mark_node
)
this
->
fndecl_
=
error_mark_node
;
else
...
...
@@ -1217,7 +1220,7 @@ Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no, tree id)
}
}
tree
functype
=
t
his
->
fntype_
->
get_tree
(
gogo
);
tree
functype
=
t
ype_to_tree
(
this
->
fntype_
->
get_backend
(
gogo
)
);
tree
decl
;
if
(
functype
==
error_mark_node
)
decl
=
error_mark_node
;
...
...
@@ -1424,7 +1427,7 @@ Function::build_tree(Gogo* gogo, Named_object* named_function)
else
{
source_location
loc
=
(
*
p
)
->
location
();
tree
type_tree
=
type
->
get_tree
(
gogo
);
tree
type_tree
=
type
_to_tree
(
type
->
get_backend
(
gogo
)
);
tree
space
=
gogo
->
allocate_memory
(
type
,
TYPE_SIZE_UNIT
(
type_tree
),
loc
);
...
...
@@ -1712,7 +1715,7 @@ go_type_for_size(unsigned int bits, int unsignedp)
return
NULL_TREE
;
}
Type
*
type
=
Type
::
lookup_integer_type
(
name
);
return
type
->
get_tree
(
go_get_gogo
(
));
return
type
_to_tree
(
type
->
get_backend
(
go_get_gogo
()
));
}
// Return the type to use for a mode.
...
...
@@ -1743,7 +1746,7 @@ go_type_for_mode(enum machine_mode mode, int unsignedp)
return
long_double_type_node
;
return
NULL_TREE
;
}
return
type
->
get_tree
(
go_get_gogo
(
));
return
type
_to_tree
(
type
->
get_backend
(
go_get_gogo
()
));
}
else
if
(
mc
==
MODE_COMPLEX_FLOAT
)
{
...
...
@@ -1763,7 +1766,7 @@ go_type_for_mode(enum machine_mode mode, int unsignedp)
return
complex_long_double_type_node
;
return
NULL_TREE
;
}
return
type
->
get_tree
(
go_get_gogo
(
));
return
type
_to_tree
(
type
->
get_backend
(
go_get_gogo
()
));
}
else
return
NULL_TREE
;
...
...
@@ -1887,7 +1890,7 @@ Gogo::string_constant_tree(const std::string& val)
tree
Gogo
::
go_string_constant_tree
(
const
std
::
string
&
val
)
{
tree
string_type
=
Type
::
make_string_type
()
->
get_tree
(
this
);
tree
string_type
=
type_to_tree
(
Type
::
make_string_type
()
->
get_backend
(
this
)
);
VEC
(
constructor_elt
,
gc
)
*
init
=
VEC_alloc
(
constructor_elt
,
gc
,
2
);
...
...
@@ -2016,13 +2019,15 @@ Gogo::map_descriptor(Map_type* maptype)
tree
map_entry_type
=
make_node
(
RECORD_TYPE
);
Btype
*
bkey_type
=
keytype
->
get_backend
(
this
);
Btype
*
bval_type
=
valtype
->
get_backend
(
this
);
map_entry_type
=
Gogo
::
builtin_struct
(
NULL
,
"__map"
,
map_entry_type
,
3
,
"__next"
,
build_pointer_type
(
map_entry_type
),
"__key"
,
keytype
->
get_tree
(
this
),
type_to_tree
(
bkey_type
),
"__val"
,
valtype
->
get_tree
(
this
));
type_to_tree
(
bval_type
));
if
(
map_entry_type
==
error_mark_node
)
{
p
->
second
=
error_mark_node
;
...
...
@@ -2097,7 +2102,8 @@ tree
Gogo
::
map_descriptor_type
()
{
static
tree
struct_type
;
tree
dtype
=
Type
::
make_type_descriptor_type
()
->
get_tree
(
this
);
Type
*
tdt
=
Type
::
make_type_descriptor_type
();
tree
dtype
=
type_to_tree
(
tdt
->
get_backend
(
this
));
dtype
=
build_qualified_type
(
dtype
,
TYPE_QUAL_CONST
);
return
Gogo
::
builtin_struct
(
&
struct_type
,
"__go_map_descriptor"
,
NULL_TREE
,
4
,
...
...
@@ -2238,7 +2244,8 @@ Gogo::build_type_descriptor_decl(const Type* type, Expression* initializer,
decl_name
=
this
->
type_descriptor_decl_name
(
name
->
named_object
(),
name
->
in_function
());
tree
id
=
get_identifier_from_string
(
decl_name
);
tree
descriptor_type_tree
=
initializer
->
type
()
->
get_tree
(
this
);
Type
*
init_type
=
initializer
->
type
();
tree
descriptor_type_tree
=
type_to_tree
(
init_type
->
get_backend
(
this
));
if
(
descriptor_type_tree
==
error_mark_node
)
{
*
pdecl
=
error_mark_node
;
...
...
gcc/go/gofrontend/gogo.cc
View file @
5b735706
...
...
@@ -3703,7 +3703,7 @@ Variable::get_backend_variable(Gogo* gogo, Named_object* function,
}
std
::
string
n
=
Gogo
::
unpack_hidden_name
(
name
);
Btype
*
btype
=
t
ree_to_type
(
type
->
get_tree
(
gogo
)
);
Btype
*
btype
=
t
ype
->
get_backend
(
gogo
);
Bvariable
*
bvar
;
if
(
this
->
is_global_
)
...
...
@@ -3753,7 +3753,7 @@ Result_variable::get_backend_variable(Gogo* gogo, Named_object* function,
{
if
(
this
->
is_in_heap
())
type
=
Type
::
make_pointer_type
(
type
);
Btype
*
btype
=
t
ree_to_type
(
type
->
get_tree
(
gogo
)
);
Btype
*
btype
=
t
ype
->
get_backend
(
gogo
);
tree
fndecl
=
function
->
func_value
()
->
get_decl
();
Bfunction
*
bfunction
=
tree_to_function
(
fndecl
);
std
::
string
n
=
Gogo
::
unpack_hidden_name
(
name
);
...
...
gcc/go/gofrontend/statements.cc
View file @
5b735706
...
...
@@ -375,7 +375,7 @@ Temporary_statement::do_get_backend(Translate_context* context)
else
bfunction
=
tree_to_function
(
function
->
func_value
()
->
get_decl
());
Btype
*
btype
=
t
ree_to_type
(
this
->
type
()
->
get_tree
(
context
->
gogo
()
));
Btype
*
btype
=
t
his
->
type
()
->
get_backend
(
context
->
gogo
(
));
Bexpression
*
binit
;
if
(
this
->
init_
==
NULL
)
...
...
gcc/go/gofrontend/types.cc
View file @
5b735706
This diff is collapsed.
Click to expand it.
gcc/go/gofrontend/types.h
View file @
5b735706
...
...
@@ -821,9 +821,9 @@ class Type
static
void
convert_builtin_named_types
(
Gogo
*
);
// Return
a tree representing
this type.
tree
get_
tree
(
Gogo
*
);
// Return
the backend representation of
this type.
Btype
*
get_
backend
(
Gogo
*
);
// Return a tree representing a zero initialization for this type.
// This will be something like an INTEGER_CST or a CONSTRUCTOR. If
...
...
@@ -892,9 +892,8 @@ class Type
virtual
bool
do_check_make_expression
(
Expression_list
*
args
,
source_location
);
virtual
tree
do_get_tree
(
Gogo
*
)
=
0
;
virtual
Btype
*
do_get_backend
(
Gogo
*
)
=
0
;
virtual
tree
do_get_init_tree
(
Gogo
*
,
tree
,
bool
)
=
0
;
...
...
@@ -1103,20 +1102,21 @@ class Type
Btype
*
get_btype_without_hash
(
Gogo
*
);
// A mapping from Type to
tree, used to ensure that the GIMPLE
// A mapping from Type to
Btype*, used to ensure that the backend
// representation of identical types is identical.
typedef
Unordered_map_hash
(
const
Type
*
,
tree
,
Type_hash_identical
,
Type_identical
)
Type_
tre
es
;
typedef
Unordered_map_hash
(
const
Type
*
,
Btype
*
,
Type_hash_identical
,
Type_identical
)
Type_
btyp
es
;
static
Type_
trees
type_tre
es
;
static
Type_
btypes
type_btyp
es
;
// A list of builtin named types.
static
std
::
vector
<
Named_type
*>
named_builtin_types
;
// The type classification.
Type_classification
classification_
;
// The tree representation of the type, once it has been determined.
tree
tree_
;
// The backend representation of the type, once it has been
// determined.
Btype
*
btype_
;
// The decl for the type descriptor for this type. This starts out
// as NULL and is filled in as needed.
tree
type_descriptor_decl_
;
...
...
@@ -1331,8 +1331,8 @@ class Integer_type : public Type
unsigned
int
do_hash_for_method
(
Gogo
*
)
const
;
tree
do_get_
tree
(
Gogo
*
);
Btype
*
do_get_
backend
(
Gogo
*
);
tree
do_get_init_tree
(
Gogo
*
,
tree
,
bool
);
...
...
@@ -1403,8 +1403,8 @@ class Float_type : public Type
unsigned
int
do_hash_for_method
(
Gogo
*
)
const
;
tree
do_get_
tree
(
Gogo
*
);
Btype
*
do_get_
backend
(
Gogo
*
);
tree
do_get_init_tree
(
Gogo
*
,
tree
,
bool
);
...
...
@@ -1471,8 +1471,8 @@ class Complex_type : public Type
unsigned
int
do_hash_for_method
(
Gogo
*
)
const
;
tree
do_get_
tree
(
Gogo
*
);
Btype
*
do_get_
backend
(
Gogo
*
);
tree
do_get_init_tree
(
Gogo
*
,
tree
,
bool
);
...
...
@@ -1527,8 +1527,8 @@ class String_type : public Type
do_has_pointer
()
const
{
return
true
;
}
tree
do_get_
tree
(
Gogo
*
);
Btype
*
do_get_
backend
(
Gogo
*
);
tree
do_get_init_tree
(
Gogo
*
gogo
,
tree
,
bool
);
...
...
@@ -1643,8 +1643,8 @@ class Function_type : public Type
unsigned
int
do_hash_for_method
(
Gogo
*
)
const
;
tree
do_get_
tree
(
Gogo
*
);
Btype
*
do_get_
backend
(
Gogo
*
);
tree
do_get_init_tree
(
Gogo
*
,
tree
,
bool
);
...
...
@@ -1717,8 +1717,8 @@ class Pointer_type : public Type
unsigned
int
do_hash_for_method
(
Gogo
*
)
const
;
tree
do_get_
tree
(
Gogo
*
);
Btype
*
do_get_
backend
(
Gogo
*
);
tree
do_get_init_tree
(
Gogo
*
,
tree
,
bool
);
...
...
@@ -1971,8 +1971,8 @@ class Struct_type : public Type
unsigned
int
do_hash_for_method
(
Gogo
*
)
const
;
tree
do_get_
tree
(
Gogo
*
);
Btype
*
do_get_
backend
(
Gogo
*
);
tree
do_get_init_tree
(
Gogo
*
,
tree
,
bool
);
...
...
@@ -2088,8 +2088,8 @@ class Array_type : public Type
bool
do_check_make_expression
(
Expression_list
*
,
source_location
);
tree
do_get_
tree
(
Gogo
*
);
Btype
*
do_get_
backend
(
Gogo
*
);
tree
do_get_init_tree
(
Gogo
*
,
tree
,
bool
);
...
...
@@ -2179,8 +2179,8 @@ class Map_type : public Type
bool
do_check_make_expression
(
Expression_list
*
,
source_location
);
tree
do_get_
tree
(
Gogo
*
);
Btype
*
do_get_
backend
(
Gogo
*
);
tree
do_get_init_tree
(
Gogo
*
,
tree
,
bool
);
...
...
@@ -2263,8 +2263,8 @@ class Channel_type : public Type
bool
do_check_make_expression
(
Expression_list
*
,
source_location
);
tree
do_get_
tree
(
Gogo
*
);
Btype
*
do_get_
backend
(
Gogo
*
);
tree
do_get_init_tree
(
Gogo
*
,
tree
,
bool
);
...
...
@@ -2381,8 +2381,8 @@ class Interface_type : public Type
unsigned
int
do_hash_for_method
(
Gogo
*
)
const
;
tree
do_get_
tree
(
Gogo
*
);
Btype
*
do_get_
backend
(
Gogo
*
);
tree
do_get_init_tree
(
Gogo
*
gogo
,
tree
,
bool
);
...
...
@@ -2612,8 +2612,8 @@ class Named_type : public Type
do_check_make_expression
(
Expression_list
*
args
,
source_location
location
)
{
return
this
->
type_
->
check_make_expression
(
args
,
location
);
}
tree
do_get_
tree
(
Gogo
*
);
Btype
*
do_get_
backend
(
Gogo
*
);
tree
do_get_init_tree
(
Gogo
*
gogo
,
tree
type_tree
,
bool
is_clear
)
...
...
@@ -2756,8 +2756,8 @@ class Forward_declaration_type : public Type
do_check_make_expression
(
Expression_list
*
args
,
source_location
location
)
{
return
this
->
base
()
->
check_make_expression
(
args
,
location
);
}
tree
do_get_
tree
(
Gogo
*
gogo
);
Btype
*
do_get_
backend
(
Gogo
*
gogo
);
tree
do_get_init_tree
(
Gogo
*
gogo
,
tree
type_tree
,
bool
is_clear
)
...
...
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