On 12/7/12 下午2:52, Chung-Lin Tang wrote: > xtensa parts. No other notes. > > Thanks, > Chung-Lin > > * config/xtensa/xtensa.c > (xtensa_expand_builtin_thread_pointer): Add hook function for > TARGET_EXPAND_BUILTIN_THREAD_POINTER. > (xtensa_expand_builtin_set_thread_pointer): Add hook function > for TARGET_EXPAND_BUILTIN_SET_THREAD_POINTER. > (xtensa_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER and > XTENSA_BUILTIN_SET_THREAD_POINTER. > (xtensa_init_builtins): Remove __builtin_thread_pointer, > __builtin_set_thread_pointer machine-specific builtins. > (xtensa_fold_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER, > XTENSA_BUILTIN_SET_THREAD_POINTER cases. > (xtensa_expand_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER, > XTENSA_BUILTIN_SET_THREAD_POINTER cases. >
Xtensa parts updated to use MD pattern. Thanks, Chung-Lin * config/xtensa/xtensa.md (get_thread_pointersi): Renamed from load_tp. (set_thread_pointersi): Renamed from set_tp. * config/xtensa/xtensa.c (xtensa_legitimize_tls_address): Change gen_load_tp calls to gen_get_thread_pointersi. (xtensa_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER and XTENSA_BUILTIN_SET_THREAD_POINTER. (xtensa_init_builtins): Remove __builtin_thread_pointer, __builtin_set_thread_pointer machine-specific builtins. (xtensa_fold_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER, XTENSA_BUILTIN_SET_THREAD_POINTER cases. (xtensa_expand_builtin): Remove XTENSA_BUILTIN_THREAD_POINTER, XTENSA_BUILTIN_SET_THREAD_POINTER cases.
Index: config/xtensa/xtensa.md =================================================================== --- config/xtensa/xtensa.md (revision 190742) +++ config/xtensa/xtensa.md (working copy) @@ -1714,7 +1714,7 @@ "" "") -(define_insn "load_tp" +(define_insn "get_thread_pointersi" [(set (match_operand:SI 0 "register_operand" "=a") (unspec:SI [(const_int 0)] UNSPEC_TP))] "TARGET_THREADPTR" @@ -1723,7 +1723,7 @@ (set_attr "mode" "SI") (set_attr "length" "3")]) -(define_insn "set_tp" +(define_insn "set_thread_pointersi" [(unspec_volatile [(match_operand:SI 0 "register_operand" "r")] UNSPECV_SET_TP)] "TARGET_THREADPTR" Index: config/xtensa/xtensa.c =================================================================== --- config/xtensa/xtensa.c (revision 190742) +++ config/xtensa/xtensa.c (working copy) @@ -1899,7 +1899,7 @@ xtensa_legitimize_tls_address (rtx x) case TLS_MODEL_INITIAL_EXEC: case TLS_MODEL_LOCAL_EXEC: tp = gen_reg_rtx (SImode); - emit_insn (gen_load_tp (tp)); + emit_insn (gen_get_thread_pointersi (tp)); addend = force_reg (SImode, gen_sym_TPOFF (x)); emit_insn (gen_addsi3 (dest, tp, addend)); break; @@ -3075,8 +3075,6 @@ xtensa_gimplify_va_arg_expr (tree valist, tree typ enum xtensa_builtin { XTENSA_BUILTIN_UMULSIDI3, - XTENSA_BUILTIN_THREAD_POINTER, - XTENSA_BUILTIN_SET_THREAD_POINTER, XTENSA_BUILTIN_max }; @@ -3095,23 +3093,6 @@ xtensa_init_builtins (void) "__umulsidi3", NULL_TREE); TREE_NOTHROW (decl) = 1; TREE_READONLY (decl) = 1; - - if (TARGET_THREADPTR) - { - ftype = build_function_type_list (ptr_type_node, NULL_TREE); - decl = add_builtin_function ("__builtin_thread_pointer", ftype, - XTENSA_BUILTIN_THREAD_POINTER, BUILT_IN_MD, - NULL, NULL_TREE); - TREE_READONLY (decl) = 1; - TREE_NOTHROW (decl) = 1; - - ftype = build_function_type_list (void_type_node, ptr_type_node, - NULL_TREE); - decl = add_builtin_function ("__builtin_set_thread_pointer", ftype, - XTENSA_BUILTIN_SET_THREAD_POINTER, - BUILT_IN_MD, NULL, NULL_TREE); - TREE_NOTHROW (decl) = 1; - } } @@ -3134,10 +3115,6 @@ xtensa_fold_builtin (tree fndecl, int n_args ATTRI fold_convert (unsigned_intDI_type_node, arg1)); break; - case XTENSA_BUILTIN_THREAD_POINTER: - case XTENSA_BUILTIN_SET_THREAD_POINTER: - break; - default: internal_error ("bad builtin code"); break; @@ -3165,19 +3142,6 @@ xtensa_expand_builtin (tree exp, rtx target, implement it. If not, just call the function. */ return expand_call (exp, target, ignore); - case XTENSA_BUILTIN_THREAD_POINTER: - if (!target || !register_operand (target, Pmode)) - target = gen_reg_rtx (Pmode); - emit_insn (gen_load_tp (target)); - return target; - - case XTENSA_BUILTIN_SET_THREAD_POINTER: - arg = expand_normal (CALL_EXPR_ARG (exp, 0)); - if (!register_operand (arg, Pmode)) - arg = copy_to_mode_reg (Pmode, arg); - emit_insn (gen_set_tp (arg)); - return const0_rtx; - default: internal_error ("bad builtin code"); }