On July 25, 2020 7:30:48 AM GMT+02:00, Gary Oblock via Gcc <gcc@gcc.gnu.org> 
wrote:
>If you've followed what I've been up to via my questions
>on the mailing list, I finally traced my latest big problem
>back to to my own code. In a nut shell here is what
>I'm doing.
>
>I'm creating a new type exaactly like this:
>
>    tree pointer_rep =
>      make_signed_type ( TYPE_PRECISION ( pointer_sized_int_node));
>    TYPE_MAIN_VARIANT ( pointer_rep) =
>      TYPE_MAIN_VARIANT ( pointer_sized_int_node);
>    const char *gcc_name =
>identifier_to_locale ( IDENTIFIER_POINTER ( TYPE_NAME (
>ri->gcc_type)));
>    size_t len =
>      strlen ( REORG_SP_PTR_PREFIX) + strlen ( gcc_name);
>    char *name = ( char *)alloca(len + 1);
>    strcpy ( name, REORG_SP_PTR_PREFIX);
>    strcat ( name, gcc_name);
>    TYPE_NAME ( pointer_rep) = get_identifier ( name);
>
>I detect an ssa_name that I want to change to have this type
>and change it thusly. Note, this particular ssa_name is a
>default def which I seems to be very pertinent (since it's
>the only case that fails.)
>
>    modify_ssa_name_type ( an_ssa_name, pointer_rep);
>
>void
>modify_ssa_name_type ( tree ssa_name, tree type)
>{
>  // This rips off the code in make_ssa_name_fn with a
>  // modification or two.
>
>  if ( TYPE_P ( type) )
>    {
>       TREE_TYPE ( ssa_name) = TYPE_MAIN_VARIANT ( type);
>       if ( ssa_defined_default_def_p ( ssa_name) )
>          {
>             // I guessing which I know is a terrible thing to do...
> SET_SSA_NAME_VAR_OR_IDENTIFIER ( ssa_name, TYPE_MAIN_VARIANT ( type));
>           }
>         else
>           {
>           // The following breaks defaults defs hence the check above.
>             SET_SSA_NAME_VAR_OR_IDENTIFIER ( ssa_name, NULL_TREE);
>           }
>        }
>     else
>        {
>          TREE_TYPE ( ssa_name) = TREE_TYPE ( type);
>          SET_SSA_NAME_VAR_OR_IDENTIFIER ( ssa_name, type);
>        }
>}
>
>After this it dies when trying to call print_generic_expr with the ssa
>name.
>
>Here's the bottom most complaint from the internal error:
>
>tree check: expected tree that contains ‘decl minimal’ structure, have
>‘integer_type’ in dump_generic_node, at tree-pretty-print.c:3154
>
>Can anybody tell what I'm doing wrong?

Do not modify existing SSA names, instead create a new one and replace uses of 
the old. 

Richard. 

>Thank,
>
>Gary
>
>
>
>
>CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,
>is for the sole use of the intended recipient(s) and contains
>information that is confidential and proprietary to Ampere Computing or
>its subsidiaries. It is to be used solely for the purpose of furthering
>the parties' business relationship. Any review, copying, or
>distribution of this email (or any attachments thereto) is strictly
>prohibited. If you are not the intended recipient, please contact the
>sender immediately and permanently delete the original and any copies
>of this email and any attachments thereto.

Reply via email to