[M3commit] CVS Update: cm3

Jay K jay.krell at cornell.edu
Thu Jan 13 16:06:37 CET 2011


Hm. I'll try the hashtable instead.

 - Jay

From: jay.krell at cornell.edu
To: jkrell at elego.de; m3commit at elegosoft.com
Subject: RE: [M3commit] CVS Update: cm3
Date: Thu, 13 Jan 2011 15:00:24 +0000








Index: m3-sys/m3front/src/misc/Marker.m3
===================================================================
RCS file: /usr/cvs/cm3/m3-sys/m3front/src/misc/Marker.m3,v
retrieving revision 1.8
diff -u -r1.8 Marker.m3
--- m3-sys/m3front/src/misc/Marker.m3    6 Jan 2011 20:40:16 -0000    1.8
+++ m3-sys/m3front/src/misc/Marker.m3    13 Jan 2011 14:56:53 -0000
@@ -248,7 +248,7 @@
     END;
     (* void* _alloca(size_t); *)
     IF (alloca = NIL) THEN
-      alloca := CG.Import_procedure (M3ID.Add ("_alloca"), 1, CG.Type.Addr,
+      alloca := CG.Import_procedure (M3ID.Add ("m3_alloca"), 1, CG.Type.Addr,
                                      Target.DefaultCall, new);
       IF (new) THEN
         EVAL CG.Declare_param (M3ID.NoID, Target.Word.size, Target.Word.align,
Index: m3-sys/m3cc/gcc/gcc/m3cg/parse.c
===================================================================
RCS file: /usr/cvs/cm3/m3-sys/m3cc/gcc/gcc/m3cg/parse.c,v
retrieving revision 1.477
diff -u -r1.477 parse.c
--- m3-sys/m3cc/gcc/gcc/m3cg/parse.c    5 Jan 2011 14:34:53 -0000    1.477
+++ m3-sys/m3cc/gcc/gcc/m3cg/parse.c    13 Jan 2011 14:56:53 -0000
@@ -473,6 +473,8 @@
 #define t_void void_type_node
 static GTY (()) tree t_set;
 
+static tree m3_alloca;
+
 static const struct { UINT32 type_id; tree* t; } builtin_uids[] = {
   { UID_INTEGER, &t_int },
   { UID_LONGINT, &t_longint },
@@ -1750,6 +1752,7 @@
   bits_per_integer_tree = build_int_cst (t_word, BITS_PER_INTEGER);
   bytes_per_integer_tree = build_int_cst (t_word, BITS_PER_INTEGER / BITS_PER_UNIT);
   tree stdcall = get_identifier_with_length (CONSTANT_STRING_AND_LENGTH ("stdcall"));
+  m3_alloca = get_identifier_with_length (CONSTANT_STRING_AND_LENGTH ("m3_alloca"));
   stdcall_list = build_tree_list (stdcall, NULL);
   t_set = m3_build_pointer_type (t_word);
 
@@ -2979,22 +2982,9 @@
   tree *slot = (tree *)htab_find_slot (builtins, p, NO_INSERT);
 
   if (slot)
-  {
     p = *slot;
-  }
-  else
-  {
-    const char *name = IDENTIFIER_POINTER (DECL_NAME (p));
-    if (name[0] == 'a' || name[0] == '_')
-    {
-      if (strcmp(name, "alloca") == 0
-        || strcmp(name, "_alloca") == 0
-        || strcmp(name, "__builtin_alloca") == 0)
-      {
-        p = built_in_decls[BUILT_IN_ALLOCA];
-      }
-    }
-  }
+  else if (DECL_NAME (p) == m3_alloca)
+    p = built_in_decls[BUILT_IN_ALLOCA];
   return p;
 }
 
 - Jay


> Date: Thu, 13 Jan 2011 15:58:29 +0000
> To: m3commit at elegosoft.com
> From: jkrell at elego.de
> Subject: [M3commit] CVS Update: cm3
> 
> CVSROOT:	/usr/cvs
> Changes by:	jkrell at birch.	11/01/13 15:58:29
> 
> Modified files:
> 	cm3/m3-sys/m3front/src/misc/: Marker.m3 
> 	cm3/m3-sys/m3cc/gcc/gcc/m3cg/: parse.c 
> 
> Log message:
> 	__builtin_alloca didn't work w/o translation
> 	among alloca, _alloca, __builtin_alloca, make up our own name, m3_alloca
> 	and do the comparison by pointer equality (since gcc uses
> 	string interning)
> 	I'd also go for _m3_alloca, __m3_alloca, or alloca, or darn near
> 	anything else.
> 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3commit/attachments/20110113/c4bb0d84/attachment-0002.html>


More information about the M3commit mailing list