[svn:parrot] r44008 - trunk/compilers/pirc/src

bacek at svn.parrot.org bacek at svn.parrot.org
Tue Feb 16 11:11:31 UTC 2010


Author: bacek
Date: Tue Feb 16 11:11:31 2010
New Revision: 44008
URL: https://trac.parrot.org/parrot/changeset/44008

Log:
PIRC: Really use headerizer

Modified:
   trunk/compilers/pirc/src/pirpcc.c
   trunk/compilers/pirc/src/pirpcc.h

Modified: trunk/compilers/pirc/src/pirpcc.c
==============================================================================
--- trunk/compilers/pirc/src/pirpcc.c	Tue Feb 16 11:11:08 2010	(r44007)
+++ trunk/compilers/pirc/src/pirpcc.c	Tue Feb 16 11:11:31 2010	(r44008)
@@ -25,78 +25,122 @@
 
 #include "parrot/oplib/ops.h"
 
-/* HEADERIZER HFILE: none */
+/* HEADERIZER HFILE: compilers/pirc/src/pirpcc.h */
 
 /* HEADERIZER BEGIN: static */
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
 static void add_alias_operand(
-    lexer_state * const lexer,
-    PMC *array,
+    ARGIN(lexer_state * const lexer),
+    ARGIN(PMC *array),
     int index,
-    char const * const alias);
+    ARGIN(char const * const alias))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(4);
 
 static void arguments_to_operands(
-    lexer_state * const lexer,
+    ARGIN(lexer_state * const lexer),
     argument * const args,
-    unsigned num_arguments);
+    unsigned num_arguments)
+        __attribute__nonnull__(1);
 
+static int calculate_pcc_argument_flags(argument * const arg);
+static int calculate_pcc_target_flags(target * const result);
 static void convert_nci_call(
-    lexer_state * const lexer,
-    invocation * const inv);
+    ARGIN(lexer_state * const lexer),
+    invocation * const inv)
+        __attribute__nonnull__(1);
 
 static void convert_pcc_call(
-    lexer_state * const lexer,
-    invocation * const inv);
+    ARGIN(lexer_state * const lexer),
+    invocation * const inv)
+        __attribute__nonnull__(1);
 
 static void convert_pcc_methodcall(
-    lexer_state * const lexer,
-    invocation * const inv);
+    ARGIN(lexer_state * const lexer),
+    invocation * const inv)
+        __attribute__nonnull__(1);
 
 static void convert_pcc_methodtailcall(
-    lexer_state * const lexer,
-    invocation * const inv);
+    ARGIN(lexer_state * const lexer),
+    invocation * const inv)
+        __attribute__nonnull__(1);
 
 static void convert_pcc_return(
-    lexer_state * const lexer,
-    invocation * const inv);
+    ARGIN(lexer_state * const lexer),
+    invocation * const inv)
+        __attribute__nonnull__(1);
 
 static void convert_pcc_tailcall(
-    lexer_state * const lexer,
-    invocation * const inv);
+    ARGIN(lexer_state * const lexer),
+    invocation * const inv)
+        __attribute__nonnull__(1);
 
 static void convert_pcc_yield(
-    lexer_state * const lexer,
-    invocation * const inv);
+    ARGIN(lexer_state * const lexer),
+    invocation * const inv)
+        __attribute__nonnull__(1);
+
+static int generate_signature_pmc(
+    ARGIN(lexer_state * const lexer),
+    unsigned size)
+        __attribute__nonnull__(1);
 
-static int generate_signature_pmc(lexer_state * const lexer, unsigned size);
 static target * generate_unique_pir_reg(
-    lexer_state * const lexer,
-    pir_type type);
+    ARGIN(lexer_state * const lexer),
+    pir_type type)
+        __attribute__nonnull__(1);
+
+static target * get_invoked_sub(
+    ARGIN(lexer_state * const lexer),
+    target * const sub)
+        __attribute__nonnull__(1);
 
 static void save_global_reference(
-    lexer_state * const lexer,
+    ARGIN(lexer_state * const lexer),
     instruction * const instr,
-    char const * const label);
+    char const * const label)
+        __attribute__nonnull__(1);
 
 static void targets_to_operands(
-    lexer_state * const lexer,
+    ARGIN(lexer_state * const lexer),
     target * const targets,
-    unsigned num_targets);
+    unsigned num_targets)
+        __attribute__nonnull__(1);
 
-#define ASSERT_ARGS_add_alias_operand __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_arguments_to_operands __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_convert_nci_call __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_convert_pcc_call __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_convert_pcc_methodcall __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_convert_pcc_methodtailcall __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_convert_pcc_return __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_convert_pcc_tailcall __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_convert_pcc_yield __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_generate_signature_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_generate_unique_pir_reg __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_save_global_reference __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_targets_to_operands __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_add_alias_operand __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer) \
+    , PARROT_ASSERT_ARG(array) \
+    , PARROT_ASSERT_ARG(alias))
+#define ASSERT_ARGS_arguments_to_operands __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_calculate_pcc_argument_flags __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_calculate_pcc_target_flags __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_convert_nci_call __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_convert_pcc_call __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_convert_pcc_methodcall __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_convert_pcc_methodtailcall __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_convert_pcc_return __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_convert_pcc_tailcall __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_convert_pcc_yield __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_generate_signature_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_generate_unique_pir_reg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_get_invoked_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_save_global_reference __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_targets_to_operands __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
 
@@ -105,8 +149,7 @@
 
 =over 4
 
-=item C<static int
-calculate_pcc_target_flags(target * const result)>
+=item C<static int calculate_pcc_target_flags(target * const result)>
 
 Calculate Parrot Calling Conventions flags for the target node
 C<result>.
@@ -115,7 +158,8 @@
 
 */
 static int
-calculate_pcc_target_flags(target * const result) {
+calculate_pcc_target_flags(target * const result)
+{
     int flag = 0;
 
 
@@ -140,8 +184,7 @@
 
 /*
 
-=item C<static int
-calculate_pcc_argument_flags(argument * const arg)>
+=item C<static int calculate_pcc_argument_flags(argument * const arg)>
 
 Calculate the Parrot Calling Conventions flags for the
 argument C<arg>. An int encoding the flags is returned.
@@ -150,7 +193,8 @@
 
 */
 static int
-calculate_pcc_argument_flags(argument * const arg) {
+calculate_pcc_argument_flags(argument * const arg)
+{
     int flag = 0;
 
     switch (arg->value->type) {
@@ -198,7 +242,8 @@
 
 */
 static target *
-generate_unique_pir_reg(lexer_state * const lexer, pir_type type) {
+generate_unique_pir_reg(ARGIN(lexer_state * const lexer), pir_type type)
+{
     ASSERT_ARGS(generate_unique_pir_reg)
 
     return new_reg(lexer, type, --lexer->pir_reg_generator);
@@ -218,7 +263,8 @@
 
 */
 static int
-generate_signature_pmc(lexer_state * const lexer, unsigned size) {
+generate_signature_pmc(ARGIN(lexer_state * const lexer), unsigned size)
+{
     ASSERT_ARGS(generate_signature_pmc)
 
     PMC *fixed_int_array;
@@ -249,7 +295,8 @@
 
 */
 void
-emit_sub_epilogue(lexer_state * const lexer) {
+emit_sub_epilogue(ARGIN(lexer_state * const lexer))
+{
 
     if (TEST_FLAG(lexer->subs->flags, PIRC_SUB_FLAG_MAIN))
         new_sub_instr(lexer, PARROT_OP_end, "end", 0);
@@ -276,10 +323,11 @@
 
 */
 static void
-add_alias_operand(lexer_state * const lexer, PMC *array, int index, char const * const alias) {
+add_alias_operand(ARGIN(lexer_state * const lexer),
+        ARGIN(PMC *array), int index,
+        ARGIN(char const * const alias))
+{
     ASSERT_ARGS(add_alias_operand)
-
-    PARROT_ASSERT(alias);
     /* set flags for being a string constant, and being a :named operand. */
     VTABLE_set_integer_keyed_int(lexer->interp, array, index, PARROT_ARG_NAME | PARROT_ARG_SC);
     push_operand(lexer, expr_from_string(lexer, alias));
@@ -310,7 +358,8 @@
 
 */
 static void
-targets_to_operands(lexer_state * const lexer, target * const targets, unsigned num_targets) {
+targets_to_operands(ARGIN(lexer_state * const lexer), target * const targets, unsigned num_targets)
+{
     ASSERT_ARGS(targets_to_operands)
 
     target  *iter;
@@ -384,7 +433,8 @@
 
 */
 static void
-arguments_to_operands(lexer_state * const lexer, argument * const args, unsigned num_arguments) {
+arguments_to_operands(ARGIN(lexer_state * const lexer), argument * const args, unsigned num_arguments)
+{
     ASSERT_ARGS(arguments_to_operands)
 
     argument *argiter;
@@ -440,7 +490,8 @@
 
 */
 void
-generate_parameters_instr(lexer_state * const lexer, unsigned num_parameters) {
+generate_parameters_instr(ARGIN(lexer_state * const lexer), unsigned num_parameters)
+{
     if (TEST_FLAG(CURRENT_SUB(lexer)->flags , (PIRC_SUB_FLAG_METHOD | PIRC_SUB_FLAG_VTABLE))) {
         ++num_parameters; /* didn't count implicit "self" parameter yet. */
     }
@@ -464,7 +515,8 @@
 
 */
 void
-generate_getresults_instr(lexer_state * const lexer, target * const targetlist) {
+generate_getresults_instr(ARGIN(lexer_state * const lexer), target * const targetlist)
+{
     /* add this point we know that there's only 1 target, as that's the convention for
      * exception handlers:
      *
@@ -491,7 +543,7 @@
 
 */
 static void
-save_global_reference(lexer_state * const lexer, instruction * const instr,
+save_global_reference(ARGIN(lexer_state * const lexer), instruction * const instr,
                       char const * const label)
 {
     ASSERT_ARGS(save_global_reference)
@@ -508,8 +560,8 @@
 
 /*
 
-=item C<static target *
-get_invoked_sub(lexer_state * const lexer, target * const sub)>
+=item C<static target * get_invoked_sub(lexer_state * const lexer, target *
+const sub)>
 
 Return a C<target> node that represents the sub to invoke.
 If C<sub> is a register, that is returned. If it's a declared C<.local>,
@@ -523,7 +575,8 @@
 
 */
 static target *
-get_invoked_sub(lexer_state * const lexer, target * const sub) {
+get_invoked_sub(ARGIN(lexer_state * const lexer), target * const sub)
+{
     target       *subreg = NULL;
     symbol       *sym    = NULL;
     global_label *glob   = NULL;
@@ -600,7 +653,8 @@
 
 */
 static void
-convert_pcc_call(lexer_state * const lexer, invocation * const inv) {
+convert_pcc_call(ARGIN(lexer_state * const lexer), invocation * const inv)
+{
     ASSERT_ARGS(convert_pcc_call)
 
     target *sub;
@@ -639,7 +693,8 @@
 
 */
 static void
-convert_pcc_tailcall(lexer_state * const lexer, invocation * const inv) {
+convert_pcc_tailcall(ARGIN(lexer_state * const lexer), invocation * const inv)
+{
     ASSERT_ARGS(convert_pcc_tailcall)
 
     target *sub;
@@ -668,7 +723,8 @@
 
 */
 static void
-convert_pcc_return(lexer_state * const lexer, invocation * const inv) {
+convert_pcc_return(ARGIN(lexer_state * const lexer), invocation * const inv)
+{
     ASSERT_ARGS(convert_pcc_return)
 
     new_sub_instr(lexer, PARROT_OP_set_returns_pc, "set_returns_pc", inv->num_arguments);
@@ -692,7 +748,8 @@
 
 */
 static void
-convert_nci_call(lexer_state * const lexer, invocation * const inv) {
+convert_nci_call(ARGIN(lexer_state * const lexer), invocation * const inv)
+{
     ASSERT_ARGS(convert_nci_call)
 
     target *sub;
@@ -724,7 +781,8 @@
 
 */
 static void
-convert_pcc_yield(lexer_state * const lexer, invocation * const inv) {
+convert_pcc_yield(ARGIN(lexer_state * const lexer), invocation * const inv)
+{
     ASSERT_ARGS(convert_pcc_yield)
 
     new_sub_instr(lexer, PARROT_OP_set_returns_pc, "set_returns_pc", inv->num_arguments);
@@ -749,7 +807,8 @@
 
 */
 static void
-convert_pcc_methodcall(lexer_state * const lexer, invocation * const inv) {
+convert_pcc_methodcall(ARGIN(lexer_state * const lexer), invocation * const inv)
+{
     ASSERT_ARGS(convert_pcc_methodcall)
 
     /* in a methodcall, the invocant object is passed as the first argument */
@@ -781,7 +840,8 @@
 
 */
 static void
-convert_pcc_methodtailcall(lexer_state * const lexer, invocation * const inv) {
+convert_pcc_methodtailcall(ARGIN(lexer_state * const lexer), invocation * const inv)
+{
     ASSERT_ARGS(convert_pcc_methodtailcall)
 
     unshift_arg(inv, new_argument(lexer, expr_from_target(lexer, inv->sub)));
@@ -820,7 +880,8 @@
 
 */
 void
-convert_inv_to_instr(lexer_state * const lexer, invocation * const inv) {
+convert_inv_to_instr(ARGIN(lexer_state * const lexer), invocation * const inv)
+{
     switch (inv->type) {
       case CALL_PCC:
         convert_pcc_call(lexer, inv);

Modified: trunk/compilers/pirc/src/pirpcc.h
==============================================================================
--- trunk/compilers/pirc/src/pirpcc.h	Tue Feb 16 11:11:08 2010	(r44007)
+++ trunk/compilers/pirc/src/pirpcc.h	Tue Feb 16 11:11:31 2010	(r44008)
@@ -9,10 +9,37 @@
 #include "pircompunit.h"
 #include "pircompiler.h"
 
-void convert_inv_to_instr(struct lexer_state * const lexer, invocation * const inv);
-void generate_parameters_instr(struct lexer_state * const lexer, unsigned num_parameters);
-void generate_getresults_instr(struct lexer_state * const lexer, target * const targetlist);
-void emit_sub_epilogue(struct lexer_state * const lexer);
+/* HEADERIZER BEGIN: compilers/pirc/src/pirpcc.c */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
+
+void convert_inv_to_instr(
+    ARGIN(lexer_state * const lexer),
+    invocation * const inv)
+        __attribute__nonnull__(1);
+
+void emit_sub_epilogue(ARGIN(lexer_state * const lexer))
+        __attribute__nonnull__(1);
+
+void generate_getresults_instr(
+    ARGIN(lexer_state * const lexer),
+    target * const targetlist)
+        __attribute__nonnull__(1);
+
+void generate_parameters_instr(
+    ARGIN(lexer_state * const lexer),
+    unsigned num_parameters)
+        __attribute__nonnull__(1);
+
+#define ASSERT_ARGS_convert_inv_to_instr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_emit_sub_epilogue __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_generate_getresults_instr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+#define ASSERT_ARGS_generate_parameters_instr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(lexer))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
+/* HEADERIZER END: compilers/pirc/src/pirpcc.c */
 
 #endif /* PARROT_PIR_PIRPCC_H_GUARD */
 


More information about the parrot-commits mailing list