Added float and void ptr params for weave func
authorKetan Dixit <ketan.dixit@gmail.com>
Fri, 9 Jul 2010 00:04:35 +0000 (20:04 -0400)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Fri, 9 Jul 2010 00:45:27 +0000 (20:45 -0400)
src/aop-weave.c
src/aop.h

index 6ee9d6dad60ae33adc0c697e7a59590dc979029d..e0a2127bbd3da434f13bea827dd842949de13ce0 100644 (file)
@@ -32,6 +32,7 @@
 #include <tree.h>
 #include <gimple.h>
 #include <toplev.h>
+#include <real.h>
 
 #include "aop.h"
 #include "aop-dynval.h"
@@ -113,6 +114,11 @@ build_gcc_call (const char *func_name, tree return_type,
     {
       tree new_arg;
       const char *str_cst;
+      int int_cst;
+      float float_cst;
+      char float_buf[25] = {0};
+      REAL_VALUE_TYPE r;
+      void *ptr_cst;
       struct aop_dynval *dv;
 
       switch (kind)
@@ -122,6 +128,23 @@ build_gcc_call (const char *func_name, tree return_type,
          new_arg = build_string_ptr (str_cst);
          VEC_safe_push (tree, heap, arg_list, new_arg);
          break;
+       case ATA_INT_CST:
+         int_cst = va_arg (argp, int);
+         new_arg = build_int_cst (integer_type_node, int_cst);
+         VEC_safe_push (tree, heap, arg_list, new_arg);
+         break;
+       case ATA_FLOAT_CST:
+         float_cst = va_arg (argp, double);
+         snprintf (float_buf, sizeof(float_buf), "%A", float_cst);
+         real_from_string (&r, (const char *)float_buf);
+         new_arg = build_real (float_type_node, r);
+         VEC_safe_push (tree, heap, arg_list, new_arg);
+         break;
+       case ATA_VOIDP_CST:
+         ptr_cst = va_arg (argp, void *);
+         new_arg = build_int_cst (build_pointer_type (void_type_node), (int)ptr_cst);
+         VEC_safe_push (tree, heap, arg_list, new_arg);
+         break;
        case ATA_DYNVAL:
          dv = va_arg (argp, struct aop_dynval *);
 
index 35e6e126319c5136c26276831ff25b61cedbf66a..b74f0800f974786af0fb41e895c36a833f3ffbdd 100644 (file)
--- a/src/aop.h
+++ b/src/aop.h
@@ -179,6 +179,9 @@ extern void aop_abort (const char *filename, int lineno, const char *function)
 
 enum aop_argkind {
   ATA_STR_CST,
+  ATA_INT_CST,
+  ATA_FLOAT_CST,
+  ATA_VOIDP_CST,
   ATA_DYNVAL,
   AOP_TERM_ARG,
 };
@@ -192,6 +195,30 @@ enum aop_argkind {
  */
 #define AOP_STR_CST(VAL) ATA_STR_CST, VAL
 
+/**
+ * \brief Mark an advice argument as an integer constant (int).
+ *
+ * Use this macro when passing an integer constant (int)
+ * argument to aop_insert_advice().
+ */
+#define AOP_INT_CST(VAL) ATA_INT_CST, VAL
+
+/**
+ * \brief Mark an advice argument as a float constant (float)
+ *
+ * Use this macro when passing a float constant (float)
+ * argument to aop_insert_advice().
+ */
+#define AOP_FLOAT_CST(VAL) ATA_FLOAT_CST, VAL
+
+/**
+ * \brief Mark an advice argument as an void pointer constant (void *).
+ *
+ * Use this macro when passing an void pointer constant (void *)
+ * argument to aop_insert_advice().
+ */
+#define AOP_VOIDP_CST(VAL) ATA_VOIDP_CST, VAL
+
 /**
  * \brief Mark an advice argument as an runtime value
  * (struct aop_dynval *).