Partial implementation of does_type_match(). Other fixups.
authorJustin Seyster <jseyster@cs.sunysb.edu>
Fri, 12 Mar 2010 01:53:14 +0000 (20:53 -0500)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Fri, 12 Mar 2010 01:53:14 +0000 (20:53 -0500)
Added const qualifier to some aop_type variables.

Added locale.h include, which is necessary to compile on Ubuntu.

src/aop-main.c
src/aop-pc-assign.c
src/aop-pointcut.h
src/aop-type.c
src/aop-type.h
src/aop-weave.c
src/aop.h

index eb79f191de0250433823a9ae3ac20664adb29ef2..e47de52dd94dfaa34479f101792e3c988c4f7a5f 100644 (file)
@@ -23,6 +23,8 @@
 #undef PACKAGE_TARNAME
 #undef PACKAGE_VERSION
 
+#include <locale.h>
+
 #include <config.h>
 #include <system.h>
 #include <coretypes.h>
index 6e9a25beb3e5bff7a85e9551b2df13cbcd71fa18..9768c76d9f04e07e8c2a9fe1e62ce15540ae9ba9 100644 (file)
@@ -21,6 +21,8 @@
 #undef PACKAGE_TARNAME
 #undef PACKAGE_VERSION
 
+#include <locale.h>
+
 #include <config.h>
 #include <system.h>
 #include <coretypes.h>
@@ -105,7 +107,7 @@ op_join_on_assign (struct aop_pointcut *pc, join_callback cb)
 }
 
 struct aop_pointcut *
-aop_match_assignment_by_type (struct aop_type *type)
+aop_match_assignment_by_type (const struct aop_type *type)
 {
   struct aop_pointcut *pc;
 
@@ -113,5 +115,7 @@ aop_match_assignment_by_type (struct aop_type *type)
   pc->kind = ATP_ASSIGN;
   pc->join_on = op_join_on_assign;
 
+  pc->pc_assign.type = type;
+
   return pc;
 }
index fae1b39d59aa7a16720bc8aa8b5e407f5c7c71dd..f0964858dbe9ff318970209e1f878f16064d175d 100644 (file)
@@ -25,7 +25,7 @@ enum aop_pckind {
 };
 
 struct aop_pc_assign {
-  struct aop_type *type;
+  const struct aop_type *type;
 };
 
 /* An AOP pointcut represents the a set of joinponts: locations in the
index 3c31ae71fec8b887d072355a9c696d763843d27f..f0b4aefd9ebe7316e38591d6fe14069173ce4d84 100644 (file)
 #undef PACKAGE_TARNAME
 #undef PACKAGE_VERSION
 
+#include <locale.h>
 #include <stddef.h>
 
 #include <config.h>
 #include <system.h>
 #include <coretypes.h>
+#include <tm.h>
+#include <tree.h>
 
+#include "aop.h"
 #include "aop-type.h"
 
 static struct aop_type _aop_t_all_signed = {
@@ -79,7 +83,30 @@ aop_t_all_pointer ()
 
 /* Match an actual GCC type with an AOP type specification. */
 bool
-does_type_match (tree gcc_type, struct aop_type *aop_type)
+does_type_match (tree gcc_type, const struct aop_type *aop_type)
 {
-  return true;
+  aop_assert (gcc_type != NULL && aop_type != NULL);
+
+  if (aop_type->kind == ATK_ALL_POINTER)
+    {
+      return (TREE_CODE (gcc_type) == POINTER_TYPE);
+    }
+  else if (aop_type->pointer_levels == 0)
+    {
+      switch (aop_type->kind)
+       {
+       case ATK_ALL_SIGNED:
+         return (TREE_CODE (gcc_type) == INTEGER_TYPE
+                 && !TYPE_UNSIGNED (gcc_type));
+       case ATK_ALL_UNSIGNED:
+         return (TREE_CODE (gcc_type) == INTEGER_TYPE
+                 && TYPE_UNSIGNED (gcc_type));
+       case ATK_ALL_FP:
+         return (TREE_CODE (gcc_type) == REAL_TYPE);
+       default:
+         break;
+       }
+    }
+
+  aop_assert (0);
 }
index 66607fb78f5c34acf5e832137e2629d954cc0396..7b88c8bb70a3f315285326e811d01a825ced4ace 100644 (file)
@@ -35,6 +35,6 @@ struct aop_type {
   const char *tag;
 };
 
-bool does_type_match (tree gcc_type, struct aop_type *aop_type);
+bool does_type_match (tree gcc_type, const struct aop_type *aop_type);
 
 #endif
index 770d4c3e391b9f24c1db07a8bff4e2648c7c5380..fa1db8895c867c51cce66294f3df5101301be536 100644 (file)
@@ -22,6 +22,7 @@
 #undef PACKAGE_TARNAME
 #undef PACKAGE_VERSION
 
+#include <locale.h>
 #include <stdarg.h>
 
 #include <config.h>
index 33a2f56a1aea2c1ddefe8e89c9a274bc89a37ccc..17050e944feca2f07b2c5f6163b7e18530e9c0a9 100644 (file)
--- a/src/aop.h
+++ b/src/aop.h
@@ -54,12 +54,18 @@ struct aop_type;
 typedef unsigned int (*pass_callback) ();
 typedef void (*join_callback) (struct aop_joinpoint *);
 
-extern struct aop_pointcut *aop_match_assignment_by_type (struct aop_type *type);
+extern struct aop_pointcut *aop_match_assignment_by_type (
+  const struct aop_type *type);
 
 extern const char *aop_capture_lhs_name (struct aop_joinpoint *jp);
 
 extern void aop_do_weave (struct aop_joinpoint *jp, const char *name, ...);
 
+extern const struct aop_type *aop_t_all_signed ();
+extern const struct aop_type *aop_t_all_unsigned ();
+extern const struct aop_type *aop_t_all_fp ();
+extern const struct aop_type *aop_t_all_pointer ();
+
 extern void aop_register_pass (const char *pass_name, pass_callback callback);
 extern void aop_join_on (struct aop_pointcut *pc, join_callback callback);
 extern void aop_main ();