Brad Bishop | 0011132 | 2018-04-01 22:23:53 -0400 | [diff] [blame] | 1 | From 3eff2adada2b1667b0e76496fa559e0c248ecd84 Mon Sep 17 00:00:00 2001 |
| 2 | From: uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> |
| 3 | Date: Thu, 25 Jan 2018 19:39:01 +0000 |
| 4 | Subject: [PATCH 09/12] Use INVALID_REGNUM in indirect thunk processing |
| 5 | |
| 6 | Backport from mainline |
| 7 | 2018-01-17 Uros Bizjak <ubizjak@gmail.com> |
| 8 | |
| 9 | * config/i386/i386.c (indirect_thunk_name): Declare regno |
| 10 | as unsigned int. Compare regno with INVALID_REGNUM. |
| 11 | (output_indirect_thunk): Ditto. |
| 12 | (output_indirect_thunk_function): Ditto. |
| 13 | (ix86_code_end): Declare regno as unsigned int. Use INVALID_REGNUM |
| 14 | in the call to output_indirect_thunk_function. |
| 15 | |
| 16 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@257067 138bc75d-0d04-0410-961f-82ee72b054a4 |
| 17 | |
| 18 | Upstream-Status: Pending |
| 19 | |
| 20 | Signed-off-by: Juro Bystricky <juro.bystricky@intel.com> |
| 21 | |
| 22 | --- |
| 23 | gcc/config/i386/i386.c | 30 +++++++++++++++--------------- |
| 24 | 1 file changed, 15 insertions(+), 15 deletions(-) |
| 25 | |
| 26 | diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c |
| 27 | index 9c038be..4012657 100644 |
| 28 | --- a/gcc/config/i386/i386.c |
| 29 | +++ b/gcc/config/i386/i386.c |
| 30 | @@ -11087,16 +11087,16 @@ static int indirect_thunks_bnd_used; |
| 31 | /* Fills in the label name that should be used for the indirect thunk. */ |
| 32 | |
| 33 | static void |
| 34 | -indirect_thunk_name (char name[32], int regno, bool need_bnd_p, |
| 35 | - bool ret_p) |
| 36 | +indirect_thunk_name (char name[32], unsigned int regno, |
| 37 | + bool need_bnd_p, bool ret_p) |
| 38 | { |
| 39 | - if (regno >= 0 && ret_p) |
| 40 | + if (regno != INVALID_REGNUM && ret_p) |
| 41 | gcc_unreachable (); |
| 42 | |
| 43 | if (USE_HIDDEN_LINKONCE) |
| 44 | { |
| 45 | const char *bnd = need_bnd_p ? "_bnd" : ""; |
| 46 | - if (regno >= 0) |
| 47 | + if (regno != INVALID_REGNUM) |
| 48 | { |
| 49 | const char *reg_prefix; |
| 50 | if (LEGACY_INT_REGNO_P (regno)) |
| 51 | @@ -11114,7 +11114,7 @@ indirect_thunk_name (char name[32], int regno, bool need_bnd_p, |
| 52 | } |
| 53 | else |
| 54 | { |
| 55 | - if (regno >= 0) |
| 56 | + if (regno != INVALID_REGNUM) |
| 57 | { |
| 58 | if (need_bnd_p) |
| 59 | ASM_GENERATE_INTERNAL_LABEL (name, "LITBR", regno); |
| 60 | @@ -11166,7 +11166,7 @@ indirect_thunk_name (char name[32], int regno, bool need_bnd_p, |
| 61 | */ |
| 62 | |
| 63 | static void |
| 64 | -output_indirect_thunk (bool need_bnd_p, int regno) |
| 65 | +output_indirect_thunk (bool need_bnd_p, unsigned int regno) |
| 66 | { |
| 67 | char indirectlabel1[32]; |
| 68 | char indirectlabel2[32]; |
| 69 | @@ -11196,7 +11196,7 @@ output_indirect_thunk (bool need_bnd_p, int regno) |
| 70 | |
| 71 | ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2); |
| 72 | |
| 73 | - if (regno >= 0) |
| 74 | + if (regno != INVALID_REGNUM) |
| 75 | { |
| 76 | /* MOV. */ |
| 77 | rtx xops[2]; |
| 78 | @@ -11220,12 +11220,12 @@ output_indirect_thunk (bool need_bnd_p, int regno) |
| 79 | } |
| 80 | |
| 81 | /* Output a funtion with a call and return thunk for indirect branch. |
| 82 | - If BND_P is true, the BND prefix is needed. If REGNO != -1, the |
| 83 | - function address is in REGNO. Otherwise, the function address is |
| 84 | + If BND_P is true, the BND prefix is needed. If REGNO != INVALID_REGNUM, |
| 85 | + the function address is in REGNO. Otherwise, the function address is |
| 86 | on the top of stack. */ |
| 87 | |
| 88 | static void |
| 89 | -output_indirect_thunk_function (bool need_bnd_p, int regno) |
| 90 | +output_indirect_thunk_function (bool need_bnd_p, unsigned int regno) |
| 91 | { |
| 92 | char name[32]; |
| 93 | tree decl; |
| 94 | @@ -11274,7 +11274,7 @@ output_indirect_thunk_function (bool need_bnd_p, int regno) |
| 95 | ASM_OUTPUT_LABEL (asm_out_file, name); |
| 96 | } |
| 97 | |
| 98 | - if (regno < 0) |
| 99 | + if (regno == INVALID_REGNUM) |
| 100 | { |
| 101 | /* Create alias for __x86.return_thunk/__x86.return_thunk_bnd. */ |
| 102 | char alias[32]; |
| 103 | @@ -11348,16 +11348,16 @@ static void |
| 104 | ix86_code_end (void) |
| 105 | { |
| 106 | rtx xops[2]; |
| 107 | - int regno; |
| 108 | + unsigned int regno; |
| 109 | |
| 110 | if (indirect_thunk_needed) |
| 111 | - output_indirect_thunk_function (false, -1); |
| 112 | + output_indirect_thunk_function (false, INVALID_REGNUM); |
| 113 | if (indirect_thunk_bnd_needed) |
| 114 | - output_indirect_thunk_function (true, -1); |
| 115 | + output_indirect_thunk_function (true, INVALID_REGNUM); |
| 116 | |
| 117 | for (regno = FIRST_REX_INT_REG; regno <= LAST_REX_INT_REG; regno++) |
| 118 | { |
| 119 | - int i = regno - FIRST_REX_INT_REG + LAST_INT_REG + 1; |
| 120 | + unsigned int i = regno - FIRST_REX_INT_REG + LAST_INT_REG + 1; |
| 121 | if ((indirect_thunks_used & (1 << i))) |
| 122 | output_indirect_thunk_function (false, regno); |
| 123 | |
| 124 | -- |
| 125 | 2.7.4 |
| 126 | |