From: Hans-Peter Nilsson Date: Tue, 1 Jan 2002 20:52:28 +0000 (+0000) Subject: mmix.md: Update FIXME to not mention define_constants. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=91312b81c9e4740fc485dc941b77c7085bd9f1e8;p=gcc.git mmix.md: Update FIXME to not mention define_constants. * config/mmix/mmix.md: Update FIXME to not mention define_constants. (MMIX_rJ_REGNUM): New define_constants constant. ("movqi", "movsi", "movdi", "*movdicc_real_foldable", "*movdicc_real"): Adjust contraints formatting. ("*bCC_foldable"): Add %+ for P in output format and delete FIXME for branch prediction. ("*bCC", "*bCC_inverted_foldable", "*bCC_inverted"): Add %+ in output template. ("*call_real", "*call_value_real", "nonlocal_goto_receiver", "*nonlocal_goto_receiver_expanded"): Use MMIX_rJ_REGNUM instead of number. Delete related FIXMEs. * config/mmix/mmix.h (MMIX_INCOMING_RETURN_ADDRESS_REGNUM): Change from number to MMIX_rJ_REGNUM. (TARGET_MASK_BRANCH_PREDICT): New. (TARGET_DEFAULT): Change to TARGET_MASK_BRANCH_PREDICT. (TARGET_SWITCHES): Update comment. Correct -mno-toplevel-symbols value. Add -mbranch-predict and -mno-branch-predict. (TARGET_VERSION): Drop date. (ADDITIONAL_REGISTER_NAMES): Use MMIX_rJ_REGNUM, not number. * config/mmix/mmix.c (mmix_encode_section_info): Correct condition for finding out global symbols. (mmix_asm_output_labelref): Revert condition for global symbol. (mmix_print_operand): : Emit P for a likely branch. (mmix_print_operand_punct_valid_p): A '+' is valid. From-SVN: r48448 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7502386aa0c..2f809926801 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,31 @@ +2002-01-01 Hans-Peter Nilsson + + * config/mmix/mmix.md: Update FIXME to not mention + define_constants. + (MMIX_rJ_REGNUM): New define_constants constant. + ("movqi", "movsi", "movdi", "*movdicc_real_foldable", + "*movdicc_real"): Adjust contraints formatting. + ("*bCC_foldable"): Add %+ for P in output format and delete FIXME + for branch prediction. + ("*bCC", "*bCC_inverted_foldable", "*bCC_inverted"): Add %+ in + output template. + ("*call_real", "*call_value_real", "nonlocal_goto_receiver", + "*nonlocal_goto_receiver_expanded"): Use MMIX_rJ_REGNUM instead of + number. Delete related FIXMEs. + * config/mmix/mmix.h (MMIX_INCOMING_RETURN_ADDRESS_REGNUM): Change + from number to MMIX_rJ_REGNUM. + (TARGET_MASK_BRANCH_PREDICT): New. + (TARGET_DEFAULT): Change to TARGET_MASK_BRANCH_PREDICT. + (TARGET_SWITCHES): Update comment. Correct -mno-toplevel-symbols + value. Add -mbranch-predict and -mno-branch-predict. + (TARGET_VERSION): Drop date. + (ADDITIONAL_REGISTER_NAMES): Use MMIX_rJ_REGNUM, not number. + * config/mmix/mmix.c (mmix_encode_section_info): Correct condition + for finding out global symbols. + (mmix_asm_output_labelref): Revert condition for global symbol. + (mmix_print_operand): : Emit P for a likely branch. + (mmix_print_operand_punct_valid_p): A '+' is valid. + 2001-12-31 Richard Henderson * config/ia64/ia64.c (mark_reg_gr_used_mask): Mind HARD_REGNO_NREGS. diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 5227270e448..e60a690107e 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -1683,10 +1683,8 @@ mmix_encode_section_info (decl) { /* Test for an external declaration, and do nothing if it is one. */ if ((TREE_CODE (decl) == VAR_DECL - && (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl)) - && ! TREE_STATIC (decl)) - || (TREE_CODE (decl) == FUNCTION_DECL - && (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl)))) + && (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl))) + || (TREE_CODE (decl) == FUNCTION_DECL && TREE_PUBLIC (decl))) ; else if (DECL_P (decl)) { @@ -1697,8 +1695,8 @@ mmix_encode_section_info (decl) Note that this does not work for data that is declared extern and later defined as static. If there's code in between, that code will refer to the extern declaration. And vice versa. Until we - can get rid of mmixal, we have to assume that code is well-behaved - or come up with a contorted scheme to work around bad code. */ + can get rid of mmixal, we have to assume that code is + well-behaved. */ const char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0); int len = strlen (str); @@ -2043,11 +2041,11 @@ mmix_asm_output_labelref (stream, name) FILE *stream; const char *name; { - int is_extern = 0; + int is_extern = 1; for (; (*name == '@' || *name == '*'); name++) if (*name == '@') - is_extern = 1; + is_extern = 0; asm_fprintf (stream, "%s%U%s", is_extern && TARGET_TOPLEVEL_SYMBOLS ? ":" : "", @@ -2112,6 +2110,16 @@ mmix_print_operand (stream, x, code) { /* Unrelated codes are in alphabetic order. */ + case '+': + /* For conditional branches, output "P" for a probable branch. */ + if (TARGET_BRANCH_PREDICT) + { + x = find_reg_note (current_output_insn, REG_BR_PROB, 0); + if (x && INTVAL (XEXP (x, 0)) > REG_BR_PROB_BASE / 2) + putc ('P', stream); + } + return; + case 'B': if (GET_CODE (x) != CONST_INT) fatal_insn ("MMIX Internal: Expected a CONST_INT, not this", x); @@ -2319,8 +2327,8 @@ int mmix_print_operand_punct_valid_p (code) int code ATTRIBUTE_UNUSED; { - /* None at the moment. */ - return 0; + /* A '+' is used for branch prediction, similar to other ports. */ + return code == '+'; } /* PRINT_OPERAND_ADDRESS. */ diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index 1c552d7f8cd..b709d2d5751 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -45,7 +45,7 @@ Boston, MA 02111-1307, USA. */ #define MMIX_FRAME_POINTER_REGNUM 253 #define MMIX_STACK_POINTER_REGNUM 254 #define MMIX_LAST_GENERAL_REGISTER 255 -#define MMIX_INCOMING_RETURN_ADDRESS_REGNUM 259 +#define MMIX_INCOMING_RETURN_ADDRESS_REGNUM MMIX_rJ_REGNUM #define MMIX_HIMULT_REGNUM 258 #define MMIX_REMAINDER_REGNUM 260 #define MMIX_ARG_POINTER_REGNUM 261 @@ -156,6 +156,7 @@ extern int target_flags; #define TARGET_MASK_ZERO_EXTEND 8 #define TARGET_MASK_KNUTH_DIVISION 16 #define TARGET_MASK_TOPLEVEL_SYMBOLS 32 +#define TARGET_MASK_BRANCH_PREDICT 64 /* FIXME: Get rid of this one. */ #define TARGET_LIBFUNC (target_flags & TARGET_MASK_LIBFUNCS) @@ -164,11 +165,11 @@ extern int target_flags; #define TARGET_ZERO_EXTEND (target_flags & TARGET_MASK_ZERO_EXTEND) #define TARGET_KNUTH_DIVISION (target_flags & TARGET_MASK_KNUTH_DIVISION) #define TARGET_TOPLEVEL_SYMBOLS (target_flags & TARGET_MASK_TOPLEVEL_SYMBOLS) +#define TARGET_BRANCH_PREDICT (target_flags & TARGET_MASK_BRANCH_PREDICT) -#define TARGET_DEFAULT 0 +#define TARGET_DEFAULT TARGET_MASK_BRANCH_PREDICT -/* FIXME: Provide a way to *load* the epsilon register. - Kill some of these; preferrably the -mint=* ones. */ +/* FIXME: Provide a way to *load* the epsilon register. */ #define TARGET_SWITCHES \ {{"libfuncs", TARGET_MASK_LIBFUNCS, \ N_("For intrinsics library: pass all parameters in registers")}, \ @@ -189,15 +190,19 @@ extern int target_flags; {"no-knuthdiv", -TARGET_MASK_KNUTH_DIVISION, ""}, \ {"toplevel-symbols", TARGET_MASK_TOPLEVEL_SYMBOLS, \ N_("Prepend global symbols with \":\" (for use with PREFIX)")}, \ - {"no-toplevel-symbols", 0, \ + {"no-toplevel-symbols", -TARGET_MASK_TOPLEVEL_SYMBOLS, \ N_("Do not provide a default start-address 0x100 of the program")}, \ {"elf", 0, \ N_("Link to emit program in ELF format (rather than mmo)")}, \ + {"branch-predict", TARGET_MASK_BRANCH_PREDICT, \ + N_("Use P-mnemonics for branches statically predicted as taken")}, \ + {"no-branch-predict", -TARGET_MASK_BRANCH_PREDICT, \ + N_("Don't use P-mnemonics for branches")}, \ {"", TARGET_DEFAULT, ""}} /* Unfortunately, this must not reference anything in "mmix.c". */ #define TARGET_VERSION \ - fprintf (stderr, " (MMIX) 2001-09-01") + fprintf (stderr, " (MMIX)") #define OVERRIDE_OPTIONS mmix_override_options () @@ -1074,7 +1079,7 @@ const_section () \ #define ADDITIONAL_REGISTER_NAMES \ {{"sp", 254}, {":sp", 254}, {"rD", 256}, {"rE", 257}, \ - {"rH", 258}, {"rJ", 259}} + {"rH", 258}, {"rJ", MMIX_rJ_REGNUM}} #define PRINT_OPERAND(STREAM, X, CODE) \ mmix_print_operand (STREAM, X, CODE) diff --git a/gcc/config/mmix/mmix.md b/gcc/config/mmix/mmix.md index cdc43cd1c8b..3998bf4edbf 100644 --- a/gcc/config/mmix/mmix.md +++ b/gcc/config/mmix/mmix.md @@ -36,13 +36,16 @@ ;; FIXME:s ;; - Use new formats; e.g. '{' not '"*{'. -;; - define_constants. + +(define_constants + [(MMIX_rJ_REGNUM 259)] +) ;; FIXME: Can we remove the reg-to-reg for smaller modes? Shouldn't they ;; be synthesized ok? (define_insn "movqi" - [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r ,r ,x ,r,r,m,??r") - (match_operand:QI 1 "general_operand" "r,LS,K,rI ,x,m,r,n"))] + [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r ,r,x ,r,r,m,??r") + (match_operand:QI 1 "general_operand" "r,LS,K,rI,x,m,r,n"))] "" "@ SET %0,%1 @@ -70,7 +73,7 @@ ;; gcc.c-torture/compile/920428-2.c fails if there's no "n". (define_insn "movsi" - [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r ,r ,x,r,r,m,??r") + [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r ,r,x,r,r,m,??r") (match_operand:SI 1 "general_operand" "r,LS,K,r,x,m,r,n"))] "" "@ @@ -85,7 +88,7 @@ ;; We assume all "s" are addresses. Does that hold? (define_insn "movdi" - [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r ,r ,x,r,m ,r,m,r,??r") + [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r ,r,x,r,m,r,m,r,??r") (match_operand:DI 1 "general_operand" "r,LS,K,r,x,I,m,r,s,n"))] "" "@ @@ -692,8 +695,8 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") (match_operator 2 "mmix_foldable_comparison_operator" [(match_operand 3 "register_operand" "r,r,r,r") (const_int 0)]) - (match_operand:DI 1 "mmix_reg_or_8bit_operand" "rI, 0 ,rI,GM") - (match_operand:DI 4 "mmix_reg_or_8bit_operand" "0 ,rI,GM ,rI")))] + (match_operand:DI 1 "mmix_reg_or_8bit_operand" "rI,0 ,rI,GM") + (match_operand:DI 4 "mmix_reg_or_8bit_operand" "0 ,rI,GM,rI")))] "" "@ CS%d2 %0,%3,%1 @@ -703,14 +706,14 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") (define_insn "*movdicc_real" [(set - (match_operand:DI 0 "register_operand" "=r ,r ,r ,r") + (match_operand:DI 0 "register_operand" "=r ,r ,r ,r") (if_then_else:DI (match_operator 2 "mmix_comparison_operator" - [(match_operand 3 "mmix_reg_cc_operand" "r ,r ,r ,r") + [(match_operand 3 "mmix_reg_cc_operand" "r ,r ,r ,r") (const_int 0)]) - (match_operand:DI 1 "mmix_reg_or_8bit_operand" "rI, 0 ,rI, GM") - (match_operand:DI 4 "mmix_reg_or_8bit_operand" "0 ,rI,GM ,rI")))] + (match_operand:DI 1 "mmix_reg_or_8bit_operand" "rI,0 ,rI,GM") + (match_operand:DI 4 "mmix_reg_or_8bit_operand" "0 ,rI,GM,rI")))] "" "@ CS%d2 %0,%3,%1 @@ -925,8 +928,6 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") ;; FIXME: we can emit an unordered-or-*not*-equal compare in one insn, but ;; there's no RTL code for it. Maybe revisit in future. -;; FIXME: Non/probable branches? Check for REG_BR_PROB note on the jump -;; insn and emit 'P' where suitable *and measure*. ;; FIXME: Odd/Even matchers? (define_insn "*bCC_foldable" [(set (pc) @@ -937,7 +938,7 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") (label_ref (match_operand 0 "" "")) (pc)))] "" - "B%d1 %2,%0") + "%+B%d1 %2,%0") (define_insn "*bCC" [(set (pc) @@ -948,7 +949,7 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") (label_ref (match_operand 0 "" "")) (pc)))] "" - "B%d1 %2,%0") + "%+B%d1 %2,%0") (define_insn "*bCC_inverted_foldable" [(set (pc) @@ -960,7 +961,7 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") (label_ref (match_operand 0 "" ""))))] ;; REVERSIBLE_CC_MODE is checked by mmix_foldable_comparison_operator. "" - "B%D1 %2,%0") + "%+B%D1 %2,%0") (define_insn "*bCC_inverted" [(set (pc) @@ -971,7 +972,7 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") (pc) (label_ref (match_operand 0 "" ""))))] "REVERSIBLE_CC_MODE (GET_MODE (operands[2]))" - "B%D1 %2,%0") + "%+B%D1 %2,%0") (define_expand "call" [(parallel [(call (match_operand:QI 0 "memory_operand" "") @@ -1044,8 +1045,7 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") (match_operand:DI 0 "mmix_symbolic_or_address_operand" "s,rU")) (match_operand 1 "" "")) (use (match_operand 2 "" "")) - ;; 259 is rJ (We can't use the symbolic name here. FIXME: Yes we can.) - (clobber (reg:DI 259))] + (clobber (reg:DI MMIX_rJ_REGNUM))] "" "@ PUSHJ $%p2,%0 @@ -1057,8 +1057,7 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") (match_operand:DI 1 "mmix_symbolic_or_address_operand" "s,rU")) (match_operand 2 "" ""))) (use (match_operand 3 "" "")) - ;; 259 is rJ (We can't use the symbolic name here. FIXME: Yes we can.) - (clobber (reg:DI 259))] + (clobber (reg:DI MMIX_rJ_REGNUM))] "" "@ PUSHJ $%p3,%1 @@ -1103,8 +1102,8 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") (define_expand "nonlocal_goto_receiver" [(parallel [(unspec_volatile [(match_dup 0)] 1) (clobber (scratch:DI)) - (clobber (reg:DI 259))]) - (set (reg:DI 259) (match_dup 1))] + (clobber (reg:DI MMIX_rJ_REGNUM))]) + (set (reg:DI MMIX_rJ_REGNUM) (match_dup 1))] "" " { @@ -1126,7 +1125,7 @@ DIVU %1,%1,%2\;GET %0,:rR\;NEGU %2,0,%0\;CSNN %0,$255,%2") (define_insn "*nonlocal_goto_receiver_expanded" [(unspec_volatile [(match_operand:DI 0 "address_operand" "p")] 1) (clobber (match_scratch:DI 1 "=&r")) - (clobber (reg:DI 259))] + (clobber (reg:DI MMIX_rJ_REGNUM))] "" "GETA $255,0f\;PUT rJ,$255\;LDOU $255,%a0\n\ 0: GET %1,rO\;CMPU %1,%1,$255\;BNP %1,1f\;POP 0,0\n1:")