public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* proposed sco5.h patch
@ 1998-02-17 16:32 Robert Lipe
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Lipe @ 1998-02-17 16:32 UTC (permalink / raw)
  To: egcs

This was exposed by -Wall exercise.  I kept trying to figure out what
all the special casing in here really accomplished, then I decided
the best optimization was to make it go away.

Any time we can lose 60 lines of wierd code that can only be attributed
to working around assembler bugs we don't have, I say we go for it.

This change caused no regressions in any of the provided test cases.




Tue Feb 17 18:26:52 1998  Robert Lipe  <robertl@dgii.com>
	* sco5.h ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT, 
	ASM_OUTPUT_LONG_DOUBLE): Delete.   Use the ones from i386.h 
	instead.


Index: sco5.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i386/sco5.h,v
retrieving revision 1.12
diff -u -p -r1.12 sco5.h
--- sco5.h	1998/02/13 05:30:56	1.12
+++ sco5.h	1998/02/18 00:25:54
@@ -428,65 +428,6 @@ do {									\
   } while (0)
 
 
-#undef ASM_OUTPUT_DOUBLE
-#define ASM_OUTPUT_DOUBLE(FILE,VALUE)					\
-do {									\
-  long value[2];							\
-  REAL_VALUE_TO_TARGET_DOUBLE ((VALUE), value);				\
-  if (TARGET_ELF) {							\
-     if (sizeof (int) == sizeof (long))					\
-       {								\
-         fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[0]);		\
-         fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value[1]);		\
-       }								\
-     else								\
-       {								\
-         fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[0]);		\
-         fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value[1]);		\
-       }								\
-  } else {								\
-     if (sizeof (int) == sizeof (long))					\
-       fprintf (FILE, "%s 0x%x,0x%x\n", ASM_LONG, value[0], value[1]);	\
-     else								\
-       fprintf (FILE, "%s 0x%lx,0x%lx\n", ASM_LONG,value[0],value[1]);}	\
-} while (0)
-
-#undef ASM_OUTPUT_FLOAT
-#define ASM_OUTPUT_FLOAT(FILE,VALUE)					\
-do {									\
-  long value;								\
-  REAL_VALUE_TO_TARGET_SINGLE ((VALUE), value);				\
-  if (sizeof (int) == sizeof (long))					\
-     fprintf((FILE), "%s\t0x%x\n", ASM_LONG, value);			\
-  else									\
-     fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, value);			\
-} while (0)
-
-#undef ASM_OUTPUT_LONG_DOUBLE
-#define ASM_OUTPUT_LONG_DOUBLE(FILE,VALUE)				\
-do {									\
-  long l[3];								\
-  REAL_VALUE_TO_TARGET_LONG_DOUBLE ((VALUE), l);			\
-  if (TARGET_ELF) {							\
-     if (sizeof (int) == sizeof (long))					\
-       {								\
-         fprintf((FILE), "%s\t0x%x\n", ASM_LONG, l[0]);			\
-         fprintf((FILE), "%s\t0x%x\n", ASM_LONG, l[1]);			\
-         fprintf((FILE), "%s\t0x%x\n", ASM_LONG, l[2]);			\
-       }								\
-     else								\
-       {								\
-         fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, l[0]);		\
-         fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, l[1]);		\
-         fprintf((FILE), "%s\t0x%lx\n", ASM_LONG, l[2]);		\
-       }								\
-  } else {								\
-     if (sizeof (int) == sizeof (long))					\
-       fprintf (FILE, "%s 0x%x,0x%x,0x%x\n", ASM_LONG, l[0], l[1], l[2]); \
-     else								\
-       fprintf (FILE, "%s 0x%lx,0x%lx,0x%lx\n", ASM_LONG,l[0],l[1],l[2]);} \
-} while (0)
-
 #undef ASM_OUTPUT_IDENT
 #define ASM_OUTPUT_IDENT(FILE, NAME) \
   fprintf (FILE, "%s\t\"%s\"\n", IDENT_ASM_OP, NAME);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: proposed sco5.h patch
  1998-01-13  4:52 Robert Lipe
@ 1998-01-14  4:17 ` Jeffrey A Law
  0 siblings, 0 replies; 3+ messages in thread
From: Jeffrey A Law @ 1998-01-14  4:17 UTC (permalink / raw)
  To: Robert Lipe; +Cc: egcs

  In message < 19980113015526.63378@dgii.com >you write:
  > The attached patch doesn't seem to cause regressions from the
  > current version.   It does pave the way for Bruno Haible's 
  > patch to make exception handling less large.    There are still
  > issues that Bruno and I are working out, but I think this is 
  > going to be required regardless of what else we decide.
  > 
  > 
  > Tue Jan 13 01:51:45 1998  Robert Lipe   (robertl@dgii.com)
  > 
  > 	* sco5.h:  (ASM_OUTPUT_SECTION_NAME) Refresh from ../svr4.h.
Thanks.  Installed.

jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* proposed sco5.h patch
@ 1998-01-13  4:52 Robert Lipe
  1998-01-14  4:17 ` Jeffrey A Law
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Lipe @ 1998-01-13  4:52 UTC (permalink / raw)
  To: egcs

The attached patch doesn't seem to cause regressions from the
current version.   It does pave the way for Bruno Haible's 
patch to make exception handling less large.    There are still
issues that Bruno and I are working out, but I think this is 
going to be required regardless of what else we decide.


Tue Jan 13 01:51:45 1998  Robert Lipe   (robertl@dgii.com)

	* sco5.h:  (ASM_OUTPUT_SECTION_NAME) Refresh from ../svr4.h.
		

--- sco5.h__	Mon Jan 12 14:30:15 1998
+++ sco5.h	Mon Jan 12 17:26:59 1998
@@ -508,19 +508,56 @@
 #undef USER_LABEL_PREFIX
 #define USER_LABEL_PREFIX ""
 
+/* 
+ * Compensate for the difference between ELF and COFF assembler syntax.
+ * Otherwise, this is cribbed from ../svr4.h.
+ * We rename 'gcc_except_table' to the shorter name in preparation
+ * for the day when we're ready to do DWARF2 eh unwinding under COFF 
+ */
 #undef ASM_OUTPUT_SECTION_NAME
 #define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME, RELOC) \
 do {									\
-  char *snam = NAME ;							\
-  if (strcmp(NAME, ".gcc_except_table") == 0) snam = ".gccexc" ;	\
-  if (TARGET_ELF)							\
-    fprintf (FILE, ".section\t%s,\"%s\",@progbits\n", NAME, 		\
-	   (DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "ax" : 	\
-	   (DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "aw");	\
-  else									\
-    fprintf (FILE, ".section\t%s,\"%s\"\n", snam,			\
-	(DECL) && TREE_CODE (DECL) == FUNCTION_DECL ? "x" : 		\
-	(DECL) && DECL_READONLY_SECTION (DECL, RELOC) ? "a" : "w");	\
+  static struct section_info                                            \
+    {                                                                   \
+      struct section_info *next;                                        \
+      char *name;                                                       \
+      enum sect_enum {SECT_RW, SECT_RO, SECT_EXEC} type;                \
+    } *sections;                                                        \
+  struct section_info *s;                                               \
+  char *mode;                                                           \
+  enum sect_enum type;                                                  \
+  char *sname = NAME ;							\
+  if (strcmp(NAME, ".gcc_except_table") == 0) sname = ".gccexc" ;	\
+                                                                        \
+  for (s = sections; s; s = s->next)                                    \
+    if (!strcmp (NAME, s->name))                                        \
+      break;                                                            \
+                                                                        \
+  if (DECL && TREE_CODE (DECL) == FUNCTION_DECL)                        \
+    type = SECT_EXEC, mode = (TARGET_ELF) ? "ax" : "x" ;                \
+  else if (DECL && DECL_READONLY_SECTION (DECL, RELOC))                 \
+    type = SECT_RO, mode = "a";                                         \
+  else                                                                  \
+    type = SECT_RW, mode = (TARGET_ELF) ? "aw" : "w" ;                  \
+                                                                        \
+  if (s == 0)                                                           \
+    {                                                                   \
+      s = (struct section_info *) xmalloc (sizeof (struct section_info));  \
+      s->name = xmalloc ((strlen (NAME) + 1) * sizeof (*NAME));         \
+      strcpy (s->name, NAME);                                           \
+      s->type = type;                                                   \
+      s->next = sections;                                               \
+      sections = s;                                                     \
+      fprintf (FILE, ".section\t%s,\"%s\"%s\n", sname, mode,		\
+		(TARGET_ELF) ? ",@progbits" : "" );    			\
+    }                                                                   \
+  else                                                                  \
+    {                                                                   \
+      if (DECL && s->type != type)                                      \
+        error_with_decl (DECL, "%s causes a section type conflict");    \
+                                                                        \
+      fprintf (FILE, ".section\t%s\n", sname);                          \
+    }                                                                   \
 } while (0)
 
 #undef ASM_OUTPUT_SKIP


-- 
Robert Lipe       http://www.dgii.com/people/robertl       robertl@dgii.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-02-17 16:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-02-17 16:32 proposed sco5.h patch Robert Lipe
  -- strict thread matches above, loose matches on Subject: below --
1998-01-13  4:52 Robert Lipe
1998-01-14  4:17 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).