diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-01-06 21:47:49 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-01-06 21:47:49 +0000 |
commit | f9f96987536295eb79dafb3274ad578679a2eaee (patch) | |
tree | 7ff2e7efed850e645b91f841d36c555604c40441 /gcc/go/gofrontend/gogo-tree.cc | |
parent | 4b6aaa996e0d8f5abac818315b6f77cb3596db98 (diff) | |
download | gcc-f9f96987536295eb79dafb3274ad578679a2eaee.zip gcc-f9f96987536295eb79dafb3274ad578679a2eaee.tar.gz gcc-f9f96987536295eb79dafb3274ad578679a2eaee.tar.bz2 |
compiler, runtime: Implement struct and array comparisons.
From-SVN: r182971
Diffstat (limited to 'gcc/go/gofrontend/gogo-tree.cc')
-rw-r--r-- | gcc/go/gofrontend/gogo-tree.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc index dd66a7f..0a7cd56 100644 --- a/gcc/go/gofrontend/gogo-tree.cc +++ b/gcc/go/gofrontend/gogo-tree.cc @@ -116,10 +116,10 @@ Gogo::define_builtin_function_trees() NULL_TREE), true); - // We use __builtin_memmove for the predeclared copy function. - define_builtin(BUILT_IN_MEMMOVE, "__builtin_memmove", "memmove", - build_function_type_list(ptr_type_node, - ptr_type_node, + // We use __builtin_memcmp for struct comparisons. + define_builtin(BUILT_IN_MEMCMP, "__builtin_memcmp", "memcmp", + build_function_type_list(integer_type_node, + const_ptr_type_node, const_ptr_type_node, size_type_node, NULL_TREE), @@ -647,7 +647,8 @@ Gogo::write_globals() this->build_interface_method_tables(); Bindings* bindings = this->current_bindings(); - size_t count = bindings->size_definitions(); + size_t count_definitions = bindings->size_definitions(); + size_t count = count_definitions; tree* vec = new tree[count]; @@ -822,6 +823,10 @@ Gogo::write_globals() || this->is_main_package()) this->write_initialization_function(init_fndecl, init_stmt_list); + // We should not have seen any new bindings created during the + // conversion. + go_assert(count_definitions == this->current_bindings()->size_definitions()); + // Pass everything back to the middle-end. wrapup_global_declarations(vec, count); |