On 12/7/12 2:52 PM, Chung-Lin Tang wrote: > Alpha parts. Note that now the machine-independent > __builtin_thread_pointer() is now marked as const/readonly, slightly > different from the original alpha backend code.
Alpha patch updated to use MD pattern. * config/alpha/alpha.md (get_thread_pointerdi): Rename from load_tp. (set_thread_pointerdi): Rename from set_tp. * config/alpha/alpha.c (alpha_legitimize_address_1): Change gen_load_tp calls to gen_get_thread_pointerdi. (alpha_builtin): Remove ALPHA_BUILTIN_THREAD_POINTER, ALPHA_BUILTIN_SET_THREAD_POINTER. (code_for_builtin): Remove CODE_FOR_load_tp, CODE_FOR_set_tp. (alpha_init_builtins): Remove __builtin_thread_pointer, __builtin_set_thread_pointer machine-specific builtins. (alpha_expand_builtin_thread_pointer): Add hook function for TARGET_EXPAND_BUILTIN_THREAD_POINTER. (alpha_expand_builtin_set_thread_pointer): Add hook function for TARGET_EXPAND_BUILTIN_SET_THREAD_POINTER. (alpha_fold_builtin): Remove ALPHA_BUILTIN_THREAD_POINTER, ALPHA_BUILTIN_SET_THREAD_POINTER cases.
Index: config/alpha/alpha.md =================================================================== --- config/alpha/alpha.md (revision 190742) +++ config/alpha/alpha.md (working copy) @@ -4365,7 +4365,7 @@ ;; For userland, we load the thread pointer from the TCB. ;; For the kernel, we load the per-cpu private value. -(define_insn "load_tp" +(define_insn "get_thread_pointerdi" [(set (match_operand:DI 0 "register_operand" "=v") (unspec:DI [(const_int 0)] UNSPEC_TP))] "TARGET_ABI_OSF" @@ -4382,7 +4382,7 @@ ;; quantity for CSE, we have to use a volatile unspec, and then there's ;; not much point in creating an R16_REG register class. -(define_expand "set_tp" +(define_expand "set_thread_pointerdi" [(set (reg:DI 16) (match_operand:DI 0 "input_operand" "")) (unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)] "TARGET_ABI_OSF" Index: config/alpha/alpha.c =================================================================== --- config/alpha/alpha.c (revision 190742) +++ config/alpha/alpha.c (working copy) @@ -963,7 +963,7 @@ alpha_legitimize_address_1 (rtx x, rtx scratch, en scratch = gen_reg_rtx (Pmode); dest = gen_reg_rtx (Pmode); - emit_insn (gen_load_tp (tp)); + emit_insn (gen_get_thread_pointerdi (tp)); emit_insn (gen_rtx_SET (VOIDmode, scratch, eqv)); emit_insn (gen_adddi3 (dest, tp, scratch)); return dest; @@ -973,7 +973,7 @@ alpha_legitimize_address_1 (rtx x, rtx scratch, en eqv = gen_rtx_CONST (Pmode, eqv); tp = gen_reg_rtx (Pmode); - emit_insn (gen_load_tp (tp)); + emit_insn (gen_get_thread_pointerdi (tp)); if (alpha_tls_size == 32) { insn = gen_rtx_HIGH (Pmode, eqv); @@ -6327,8 +6327,6 @@ enum alpha_builtin ALPHA_BUILTIN_AMASK, ALPHA_BUILTIN_IMPLVER, ALPHA_BUILTIN_RPCC, - ALPHA_BUILTIN_THREAD_POINTER, - ALPHA_BUILTIN_SET_THREAD_POINTER, ALPHA_BUILTIN_ESTABLISH_VMS_CONDITION_HANDLER, ALPHA_BUILTIN_REVERT_VMS_CONDITION_HANDLER, @@ -6384,8 +6382,6 @@ static enum insn_code const code_for_builtin[ALPHA CODE_FOR_builtin_amask, CODE_FOR_builtin_implver, CODE_FOR_builtin_rpcc, - CODE_FOR_load_tp, - CODE_FOR_set_tp, CODE_FOR_builtin_establish_vms_condition_handler, CODE_FOR_builtin_revert_vms_condition_handler, @@ -6543,14 +6539,6 @@ alpha_init_builtins (void) alpha_dimode_u, NULL_TREE); alpha_add_builtins (two_arg_builtins, ARRAY_SIZE (two_arg_builtins), ftype); - ftype = build_function_type_list (ptr_type_node, NULL_TREE); - alpha_builtin_function ("__builtin_thread_pointer", ftype, - ALPHA_BUILTIN_THREAD_POINTER, ECF_NOTHROW); - - ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); - alpha_builtin_function ("__builtin_set_thread_pointer", ftype, - ALPHA_BUILTIN_SET_THREAD_POINTER, ECF_NOTHROW); - if (TARGET_ABI_OPEN_VMS) { ftype = build_function_type_list (ptr_type_node, ptr_type_node, @@ -7087,8 +7075,6 @@ alpha_fold_builtin (tree fndecl, int n_args, tree case ALPHA_BUILTIN_AMASK: case ALPHA_BUILTIN_IMPLVER: case ALPHA_BUILTIN_RPCC: - case ALPHA_BUILTIN_THREAD_POINTER: - case ALPHA_BUILTIN_SET_THREAD_POINTER: /* None of these are foldable at compile-time. */ default: return NULL;