This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patches] Code cleanup - remove unused variables - part 3
- From: Reichelt <reichelt at igpm dot rwth-aachen dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: rth at redhat dot com
- Date: Fri, 13 Sep 2002 16:03:01 +0200
- Subject: [Patches] Code cleanup - remove unused variables - part 3
Hi,
the following patches mainly remove unused variables.
The patch for jump.c removes the return value and its computation
from the function init_label_info, since it isn't used anywhere.
(The patch mainly consists of indentation changes.)
The patch for cse.c moves the variable prev_insn between
#ifdef HAVE_cc0 ... #endif directives, since it is only used if
HAVE_cc0 is defined.
The patches for loop.c and jump.c were suggested by Richard Henderson in
http://gcc.gnu.org/ml/gcc-patches/2002-09/msg00699.html
The patches apply to the basic-improvements-branch.
With them applied the compiler was bootstrapped successfully on
i686-pc-linux-gnu.
Greetings,
Volker Reichelt
2002-09-13 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* jargrep.c (chk_wrd): Remove unused variable(s).
* jartool.c (main, create_central_header, list_jar): Likewise.
2002-09-13 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* jvspec.c (lang_specific_driver): Remove unused variable.
2002-09-13 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* mips.c (save_restore_insns): Remove unused variable.
2002-09-13 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* gcc.c (make_relative_prefix): Remove unused variable.
* loop.c (check_final_value): Likewise.
* jump.c (init_label_info): Remove return value.
* cse.c (prev_insn): Move variable between #ifdef HAVE_cc0 ... #endif.
===============================================================================
diff -up gcc/fastjar/jargrep.c gcc-new/fastjar/jargrep.c
--- gcc/fastjar/jargrep.c Thu Jan 10 00:22:20 2002
+++ gcc-new/fastjar/jargrep.c Fri Sep 13 11:32:53 2002
@@ -373,7 +373,6 @@ returns: TRUE if it is a word, FALSE of
static int chk_wrd(regex_t *exp, const char *str) {
int wrd_fnd = FALSE;
- int regflag;
int frnt_ok;
int bck_ok;
const char *str2;
@@ -381,7 +380,7 @@ static int chk_wrd(regex_t *exp, const c
str2 = str;
frnt_ok = bck_ok = FALSE;
- while(!wrd_fnd && !(regflag = regexec(exp, str2, 1, &match, 0))) {
+ while(!wrd_fnd && !regexec(exp, str2, 1, &match, 0)) {
if(!match.rm_so && (str2 == str)) frnt_ok = TRUE;
else if(!isalnum((unsigned char)str2[match.rm_so - 1])
&& str2[match.rm_so - 1] != '_')
===============================================================================
diff -up gcc/fastjar/jartool.c gcc-new/fastjar/jartool.c
--- gcc/fastjar/jartool.c Thu Sep 12 10:45:36 2002
+++ gcc-new/fastjar/jartool.c Fri Sep 13 11:30:47 2002
@@ -321,7 +321,6 @@ int main(int argc, char **argv){
int manifest = TRUE;
int opt;
- int j;
int jarfd = -1;
/* These are used to collect file names and `-C' options for the
@@ -339,8 +338,6 @@ int main(int argc, char **argv){
if(argc < 2)
usage(argv[0]);
- j = strlen(argv[1]);
-
new_argc = 0;
new_argv = (char **) malloc (argc * sizeof (char *));
===============================================================================
diff -up gcc/fastjar/jartool.c gcc-new/fastjar/jartool.c
--- gcc/fastjar/jartool.c Thu Sep 12 10:45:36 2002
+++ gcc-new/fastjar/jartool.c Fri Sep 13 11:30:47 2002
@@ -1115,13 +1112,10 @@ int create_central_header(int fd){
ub1 end_header[22];
int start_offset;
int dir_size;
- int *iheader;
int total_in = 0, total_out = 22;
zipentry *ze;
- iheader = (int*)header;
-
/* magic number */
header[0] = 'P';
header[1] = 'K';
===============================================================================
diff -up gcc/fastjar/jartool.c gcc-new/fastjar/jartool.c
--- gcc/fastjar/jartool.c Thu Sep 12 10:45:36 2002
+++ gcc-new/fastjar/jartool.c Fri Sep 13 11:30:47 2002
@@ -1544,7 +1538,6 @@ int extract_jar(int fd, char **files, in
}
int list_jar(int fd, char **files, int file_num){
- int rdamt;
ub4 signature;
ub4 csize;
ub4 usize;
@@ -1706,7 +1699,7 @@ int list_jar(int fd, char **files, int f
init_inflation();
for(;;){
- if((rdamt = pb_read(&pbf, scratch, 4)) != 4){
+ if(pb_read(&pbf, scratch, 4) != 4){
perror("read");
break;
}
@@ -1735,7 +1728,7 @@ int list_jar(int fd, char **files, int f
break;
}
- if((rdamt = pb_read(&pbf, (file_header + 4), 26)) != 26){
+ if(pb_read(&pbf, (file_header + 4), 26) != 26){
perror("read");
break;
}
===============================================================================
diff -up gcc/gcc/java/jvspec.c gcc-new/gcc/java/jvspec.c
--- gcc/gcc/java/jvspec.c Wed Apr 24 00:58:09 2002
+++ gcc-new/gcc/java/jvspec.c Fri Sep 13 11:20:10 2002
@@ -161,9 +161,6 @@ lang_specific_driver (in_argc, in_argv,
should be passed to a single jc1 invocation. */
int combine_inputs = 0;
- /* Index of last .java or .class argument. */
- int last_input_index;
-
/* Number of .java and .class source file arguments seen. */
int java_files_count = 0;
int class_files_count = 0;
@@ -384,7 +381,6 @@ lang_specific_driver (in_argc, in_argv,
if (saw_resource)
{
args[i] |= RESOURCE_FILE_ARG;
- last_input_index = i;
added += 2; /* for -xjava and -xnone */
}
@@ -400,13 +396,11 @@ lang_specific_driver (in_argc, in_argv,
{
args[i] |= JAVA_FILE_ARG;
java_files_count++;
- last_input_index = i;
}
if (len > 6 && strcmp (argv[i] + len - 6, ".class") == 0)
{
args[i] |= CLASS_FILE_ARG;
class_files_count++;
- last_input_index = i;
}
if (len > 4
&& (strcmp (argv[i] + len - 4, ".zip") == 0
@@ -414,7 +408,6 @@ lang_specific_driver (in_argc, in_argv,
{
args[i] |= ZIP_FILE_ARG;
zip_files_count++;
- last_input_index = i;
}
}
}
===============================================================================
diff -up gcc/gcc/config/mips/mips.c gcc-new/gcc/config/mips/mips.c
--- gcc/gcc/config/mips/mips.c Thu Sep 12 10:46:01 2002
+++ gcc-new/gcc/config/mips/mips.c Fri Sep 13 11:14:16 2002
@@ -6897,7 +6897,6 @@ save_restore_insns (store_p, large_reg,
HOST_WIDE_INT gp_offset;
HOST_WIDE_INT fp_offset;
HOST_WIDE_INT end_offset;
- rtx insn;
if (frame_pointer_needed
&& ! BITSET_P (mask, HARD_FRAME_POINTER_REGNUM - GP_REG_FIRST))
@@ -6951,11 +6950,9 @@ save_restore_insns (store_p, large_reg,
base_reg_rtx = gen_rtx_REG (Pmode, MIPS_TEMP2_REGNUM);
base_offset = large_offset;
if (Pmode == DImode)
- insn = emit_insn (gen_adddi3 (base_reg_rtx, large_reg,
- stack_pointer_rtx));
+ emit_insn (gen_adddi3 (base_reg_rtx, large_reg, stack_pointer_rtx));
else
- insn = emit_insn (gen_addsi3 (base_reg_rtx, large_reg,
- stack_pointer_rtx));
+ emit_insn (gen_addsi3 (base_reg_rtx, large_reg, stack_pointer_rtx));
}
else
{
@@ -7060,11 +7057,9 @@ save_restore_insns (store_p, large_reg,
base_reg_rtx = gen_rtx_REG (Pmode, MIPS_TEMP2_REGNUM);
base_offset = large_offset;
if (Pmode == DImode)
- insn = emit_insn (gen_adddi3 (base_reg_rtx, large_reg,
- stack_pointer_rtx));
+ emit_insn (gen_adddi3 (base_reg_rtx, large_reg, stack_pointer_rtx));
else
- insn = emit_insn (gen_addsi3 (base_reg_rtx, large_reg,
- stack_pointer_rtx));
+ emit_insn (gen_addsi3 (base_reg_rtx, large_reg, stack_pointer_rtx));
}
else
{
===============================================================================
diff -up gcc/gcc/gcc.c gcc-new/gcc/gcc.c
--- gcc/gcc/gcc.c Sat Aug 10 22:58:43 2002
+++ gcc-new/gcc/gcc.c Fri Sep 13 11:15:57 2002
@@ -2330,7 +2330,7 @@ make_relative_prefix (progname, bin_pref
const char *prefix;
{
char **prog_dirs, **bin_dirs, **prefix_dirs;
- int prog_num, bin_num, prefix_num, std_loc_p;
+ int prog_num, bin_num, prefix_num;
int i, n, common;
prog_dirs = split_directories (progname, &prog_num);
@@ -2403,7 +2403,6 @@ make_relative_prefix (progname, bin_pref
/* Determine if the compiler is installed in the standard location, and if
so, we don't need to specify relative directories. Also, if argv[0]
doesn't contain any directory specifiers, there is not much we can do. */
- std_loc_p = 0;
if (prog_num == bin_num)
{
for (i = 0; i < bin_num; i++)
@@ -2414,7 +2413,6 @@ make_relative_prefix (progname, bin_pref
if (prog_num <= 0 || i == bin_num)
{
- std_loc_p = 1;
free_split_directories (prog_dirs);
free_split_directories (bin_dirs);
prog_dirs = bin_dirs = (char **) 0;
===============================================================================
diff -up gcc/gcc/loop.c gcc-new/gcc/loop.c
--- gcc/gcc/loop.c Thu Sep 12 10:45:47 2002
+++ gcc-new/gcc/loop.c Fri Sep 13 10:42:24 2002
@@ -5927,7 +5927,6 @@ check_final_value (loop, v)
const struct loop *loop;
struct induction *v;
{
- struct loop_ivs *ivs = LOOP_IVS (loop);
rtx final_value = 0;
/* DEST_ADDR givs will never reach here, because they are always marked
===============================================================================
diff -up gcc/gcc/jump.c gcc-new/gcc/jump.c
--- gcc/gcc/jump.c Thu Sep 12 10:45:47 2002
+++ gcc-new/gcc/jump.c Fri Sep 13 10:42:24 2002
@@ -59,7 +59,7 @@ Software Foundation, 59 Temple Place - S
or even change what is live at any point.
So perhaps let combiner do it. */
-static int init_label_info PARAMS ((rtx));
+static void init_label_info PARAMS ((rtx));
static void mark_all_labels PARAMS ((rtx));
static int duplicate_loop_exit_test PARAMS ((rtx));
static void delete_computation PARAMS ((rtx));
@@ -184,36 +184,29 @@ purge_line_number_notes (f)
/* Initialize LABEL_NUSES and JUMP_LABEL fields. Delete any REG_LABEL
notes whose labels don't occur in the insn any more. Returns the
largest INSN_UID found. */
-static int
+static void
init_label_info (f)
rtx f;
{
- int largest_uid = 0;
rtx insn;
for (insn = f; insn; insn = NEXT_INSN (insn))
- {
- if (GET_CODE (insn) == CODE_LABEL)
- LABEL_NUSES (insn) = (LABEL_PRESERVE_P (insn) != 0);
- else if (GET_CODE (insn) == JUMP_INSN)
- JUMP_LABEL (insn) = 0;
- else if (GET_CODE (insn) == INSN || GET_CODE (insn) == CALL_INSN)
- {
- rtx note, next;
-
- for (note = REG_NOTES (insn); note; note = next)
- {
- next = XEXP (note, 1);
- if (REG_NOTE_KIND (note) == REG_LABEL
- && ! reg_mentioned_p (XEXP (note, 0), PATTERN (insn)))
- remove_note (insn, note);
- }
- }
- if (INSN_UID (insn) > largest_uid)
- largest_uid = INSN_UID (insn);
- }
+ if (GET_CODE (insn) == CODE_LABEL)
+ LABEL_NUSES (insn) = (LABEL_PRESERVE_P (insn) != 0);
+ else if (GET_CODE (insn) == JUMP_INSN)
+ JUMP_LABEL (insn) = 0;
+ else if (GET_CODE (insn) == INSN || GET_CODE (insn) == CALL_INSN)
+ {
+ rtx note, next;
- return largest_uid;
+ for (note = REG_NOTES (insn); note; note = next)
+ {
+ next = XEXP (note, 1);
+ if (REG_NOTE_KIND (note) == REG_LABEL
+ && ! reg_mentioned_p (XEXP (note, 0), PATTERN (insn)))
+ remove_note (insn, note);
+ }
+ }
}
/* Mark the label each jump jumps to.
===============================================================================
diff -up gcc/gcc/cse.c gcc-new/gcc/cse.c
--- gcc/gcc/cse.c Thu Sep 12 10:45:43 2002
+++ gcc-new/gcc/cse.c Fri Sep 13 10:42:24 2002
@@ -266,11 +266,11 @@ static struct qty_table_elem *qty_table;
static rtx prev_insn_cc0;
static enum machine_mode prev_insn_cc0_mode;
-#endif
/* Previous actual insn. 0 if at first insn of basic block. */
static rtx prev_insn;
+#endif
/* Insn being scanned. */
@@ -1022,9 +1022,8 @@ new_basic_block ()
}
}
- prev_insn = 0;
-
#ifdef HAVE_cc0
+ prev_insn = 0;
prev_insn_cc0 = 0;
#endif
}
@@ -6364,9 +6363,8 @@ cse_insn (insn, libcall_insn)
prev_insn_cc0 = this_insn_cc0;
prev_insn_cc0_mode = this_insn_cc0_mode;
-#endif
-
prev_insn = insn;
+#endif
}
/* Remove from the hash table all expressions that reference memory. */
@@ -7266,8 +7264,8 @@ cse_basic_block (from, to, next_branch,
Then follow this branch. */
#ifdef HAVE_cc0
prev_insn_cc0 = 0;
-#endif
prev_insn = insn;
+#endif
insn = JUMP_LABEL (insn);
continue;
}
===============================================================================