summaryrefslogtreecommitdiff
path: root/gcc/java/builtins.c
diff options
context:
space:
mode:
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-11 19:55:09 +0000
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-11 19:55:09 +0000
commitb9a1687032fc1afb5f4e9d8dfa775a134abe21ba (patch)
tree304b794b6f6f0af1f79b00f4166b897337141fac /gcc/java/builtins.c
parent74fcb726ed12f7bce6ef94080d91b4e3cac61824 (diff)
downloadgcc-b9a1687032fc1afb5f4e9d8dfa775a134abe21ba.tar.gz
Convert standard builtin functions from being arrays to using a functional interface
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179820 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/builtins.c')
-rw-r--r--gcc/java/builtins.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c
index 1e94bcab4d2..5ab345dc472 100644
--- a/gcc/java/builtins.c
+++ b/gcc/java/builtins.c
@@ -324,13 +324,13 @@ compareAndSwapInt_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|| flag_use_atomic_builtins)
{
tree addr, stmt;
+ enum built_in_function fncode = BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_4;
UNMARSHAL5 (orig_call);
(void) value_type; /* Avoid set but not used warning. */
addr = build_addr_sum (int_type_node, obj_arg, offset_arg);
- stmt = build_call_expr
- (built_in_decls[BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_4],
- 3, addr, expected_arg, value_arg);
+ stmt = build_call_expr (builtin_decl_explicit (fncode),
+ 3, addr, expected_arg, value_arg);
return build_check_this (stmt, this_arg);
}
@@ -351,13 +351,13 @@ compareAndSwapLong_builtin (tree method_return_type ATTRIBUTE_UNUSED,
but not the multi-word versions. */
{
tree addr, stmt;
+ enum built_in_function fncode = BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_8;
UNMARSHAL5 (orig_call);
(void) value_type; /* Avoid set but not used warning. */
addr = build_addr_sum (long_type_node, obj_arg, offset_arg);
- stmt = build_call_expr
- (built_in_decls[BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_8],
- 3, addr, expected_arg, value_arg);
+ stmt = build_call_expr (builtin_decl_explicit (fncode),
+ 3, addr, expected_arg, value_arg);
return build_check_this (stmt, this_arg);
}
@@ -373,7 +373,7 @@ compareAndSwapObject_builtin (tree method_return_type ATTRIBUTE_UNUSED,
|| flag_use_atomic_builtins)
{
tree addr, stmt;
- int builtin;
+ enum built_in_function builtin;
UNMARSHAL5 (orig_call);
builtin = (POINTER_SIZE == 32
@@ -381,7 +381,7 @@ compareAndSwapObject_builtin (tree method_return_type ATTRIBUTE_UNUSED,
: BUILT_IN_SYNC_BOOL_COMPARE_AND_SWAP_8);
addr = build_addr_sum (value_type, obj_arg, offset_arg);
- stmt = build_call_expr (built_in_decls[builtin],
+ stmt = build_call_expr (builtin_decl_explicit (builtin),
3, addr, expected_arg, value_arg);
return build_check_this (stmt, this_arg);
@@ -401,7 +401,7 @@ putVolatile_builtin (tree method_return_type ATTRIBUTE_UNUSED,
= fold_convert (build_pointer_type (build_type_variant (value_type, 0, 1)),
addr);
- stmt = build_call_expr (built_in_decls[BUILT_IN_SYNC_SYNCHRONIZE], 0);
+ stmt = build_call_expr (builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE), 0);
modify_stmt = fold_build2 (MODIFY_EXPR, value_type,
build_java_indirect_ref (value_type, addr,
flag_check_references),
@@ -425,8 +425,7 @@ getVolatile_builtin (tree method_return_type ATTRIBUTE_UNUSED,
= fold_convert (build_pointer_type (build_type_variant
(method_return_type, 0, 1)), addr);
- stmt = build_call_expr (built_in_decls[BUILT_IN_SYNC_SYNCHRONIZE], 0);
-
+ stmt = build_call_expr (builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE), 0);
tmp = build_decl (BUILTINS_LOCATION, VAR_DECL, NULL, method_return_type);
DECL_IGNORED_P (tmp) = 1;
DECL_ARTIFICIAL (tmp) = 1;
@@ -483,8 +482,7 @@ define_builtin (enum built_in_function val,
if (flags & BUILTIN_CONST)
TREE_READONLY (decl) = 1;
- implicit_built_in_decls[val] = decl;
- built_in_decls[val] = decl;
+ set_builtin_decl (val, decl, true);
}
@@ -627,7 +625,7 @@ check_for_builtin (tree method, tree call)
with the BC-ABI. */
if (flag_indirect_dispatch)
return call;
- fn = built_in_decls[java_builtins[i].builtin_code];
+ fn = builtin_decl_explicit (java_builtins[i].builtin_code);
if (fn == NULL_TREE)
return call;
return java_build_function_call_expr (fn, call);