This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Help with new builtin
- To: gcc at gcc dot gnu dot org
- Subject: Help with new builtin
- From: Brad Lucier <lucier at math dot purdue dot edu>
- Date: Mon, 29 Jan 2001 16:37:47 -0500 (EST)
- Cc: lucier at math dot purdue dot edu, feeley at iro dot umontreal dot ca
I would like to patch my copy of gcc to add a builtin that
can be exploited by CPar, a parallel version of C developed
by Marc Feeley and his students at the University of Montreal.
CPar can be compiled without this builtin, but supporting it
leads to much smaller task-switching times.
The builtin was originally patched into gcc-2.7.2.3; after looking
at the source and the info files, I realize that although it looks
easy to provide a new patch for the current development compiler,
I have no clue how to do it. Rather than try to mimic other code
that I don't know the purpose of, I'm asking if some kind soul
can show me the few lines of code that will meet how things are
done in the current compiler.
Brad Lucier
The old patches follow:
diff -c gcc-2.7.2.3.before/c-decl.c gcc-2.7.2.3.after/c-decl.c
*** gcc-2.7.2.3.before/c-decl.c Fri Oct 27 05:44:43 1995
--- gcc-2.7.2.3.after/c-decl.c Sat Feb 19 17:06:11 2000
***************
*** 3097,3102 ****
--- 3097,3111 ----
sizetype,
endlink)),
BUILT_IN_ALLOCA, "alloca");
+
+ builtin_function ("_cparMoveSP",
+ build_function_type (ptr_type_node,
+ tree_cons (NULL_TREE,
+ sizetype,
+ endlink)),
+ BUILT_IN_CPAR_MOVESP, NULL_PTR);
+
+
builtin_function ("__builtin_ffs", int_ftype_int, BUILT_IN_FFS, NULL_PTR);
/* Define alloca, ffs as builtins.
Declare _exit just to mark it as volatile. */
Common subdirectories: gcc-2.7.2.3.before/config and gcc-2.7.2.3.after/config
Common subdirectories: gcc-2.7.2.3.before/cp and gcc-2.7.2.3.after/cp
diff -c gcc-2.7.2.3.before/expr.c gcc-2.7.2.3.after/expr.c
*** gcc-2.7.2.3.before/expr.c Sat Jun 29 12:26:15 1996
--- gcc-2.7.2.3.after/expr.c Sat Feb 19 17:06:32 2000
***************
*** 7656,7661 ****
--- 7656,7667 ----
return tem;
}
+ case BUILT_IN_CPAR_MOVESP:
+
+ op0 = expand_expr (TREE_VALUE (arglist), NULL_RTX, VOIDmode, 1);
+ adjust_stack(op0);
+ return target;
+
case BUILT_IN_ALLOCA:
if (arglist == 0
/* Arg could be non-integer if user redeclared this fcn wrong. */
Common subdirectories: gcc-2.7.2.3.before/ginclude and gcc-2.7.2.3.after/ginclude
Common subdirectories: gcc-2.7.2.3.before/objc and gcc-2.7.2.3.after/objc
diff -c gcc-2.7.2.3.before/tree.h gcc-2.7.2.3.after/tree.h
*** gcc-2.7.2.3.before/tree.h Mon Sep 25 17:49:40 1995
--- gcc-2.7.2.3.after/tree.h Sat Feb 19 17:06:06 2000
***************
*** 105,110 ****
--- 105,111 ----
BUILT_IN_VEC_DELETE,
/* Upper bound on non-language-specific builtins. */
+ BUILT_IN_CPAR_MOVESP,
END_BUILTINS
};