diff mbox

extending constants in rtl

Message ID F29A57A4-9C17-4169-B772-7CA7E94D94B8@comcast.net
State New
Headers show

Commit Message

Mike Stump March 18, 2014, 3:36 a.m. UTC
So, to support things like this:

(define_constants
   (C1_TEMP_REGNUM              PROLOGUE_SCRATCH_1)
   (C1_TEMP2_REGNUM             PROLOGUE_SCRATCH_2)

I need the rtl reader to do less checking.  We we turn off int validation, this then works, and we get:

  #define C1_TEMP_REGNUM PROLOGUE_SCRATCH_1

in insn-constants.h, which is what I wanted.  The problem is that I choose different scratch register based upon the cpu and this is then used in a clobber in the rtl of a define_insn.

I’d be happy to do this some other way, but, I didn’t see a way to do this, otherwise.

Absent a better solution, I’d like to pursue this.  The only question I have, remove the checking, or allow the target to explain that we don’t want the checking?

Comments

Richard Biener March 18, 2014, 9:06 a.m. UTC | #1
On Tue, Mar 18, 2014 at 4:36 AM, Mike Stump <mikestump@comcast.net> wrote:
> So, to support things like this:
>
> (define_constants
>    (C1_TEMP_REGNUM              PROLOGUE_SCRATCH_1)
>    (C1_TEMP2_REGNUM             PROLOGUE_SCRATCH_2)
>
> I need the rtl reader to do less checking.  We we turn off int validation, this then works, and we get:
>
>   #define C1_TEMP_REGNUM PROLOGUE_SCRATCH_1
>
> in insn-constants.h, which is what I wanted.  The problem is that I choose different scratch register based upon the cpu and this is then used in a clobber in the rtl of a define_insn.
>
> I'd be happy to do this some other way, but, I didn't see a way to do this, otherwise.
>
> Absent a better solution, I'd like to pursue this.  The only question I have, remove the checking, or allow the target to explain that we don't want the checking?

Make it

(define_symbolic_constant
   (C1_TEMP_REGNUM              PROLOGUE_SCRATCH_1)
?

>
> diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c
> index c198b5b..ceef96c 100644
> --- a/gcc/read-rtl.c
> +++ b/gcc/read-rtl.c
> @@ -807,8 +807,12 @@ validate_const_int (const char *string)
>          valid = 0;
>         break;
>        }
> +#if 0
> +  /* In order to support defining the md constants in terms of CPP constants from tm.h, we
> +     can't check this.  */
>    if (!valid)
>      fatal_with_file_and_line ("invalid decimal constant \"%s\"\n", string);
> +#endif
>  }
>
>  static void
>
Mike Stump March 20, 2014, 6:09 p.m. UTC | #2
On Mar 17, 2014, at 8:36 PM, Mike Stump <mikestump@comcast.net> wrote:
> So, to support things like this:
> 
> (define_constants
>   (C1_TEMP_REGNUM              PROLOGUE_SCRATCH_1)
>   (C1_TEMP2_REGNUM             PROLOGUE_SCRATCH_2)


> Absent a better solution, I’d like to pursue this.

So, it turns out the patch won’t do what I really wanted to do and the amount of extending the .md language would be more extensive that I had hoped for, so I’m withdrawing it. I can generate some .md content early on with a .c program and just use the generated content directly.  This bridges the gap nicely and is easy to implement.
diff mbox

Patch

diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c
index c198b5b..ceef96c 100644
--- a/gcc/read-rtl.c
+++ b/gcc/read-rtl.c
@@ -807,8 +807,12 @@  validate_const_int (const char *string)
         valid = 0;
        break;
       }
+#if 0
+  /* In order to support defining the md constants in terms of CPP constants from tm.h, we
+     can't check this.  */
   if (!valid)
     fatal_with_file_and_line ("invalid decimal constant \"%s\"\n", string);
+#endif
 }
 
 static void