Re: [Patch,AVR]: Fix PR 50358
2011/9/12 Georg-Johann Lay : > This patch introduces patterns for multiply-add and multiply-sub. > > On the enhanced core, these operations can be performed with the product in > R0; > there is no need to MOVW it out of that register. The code is smaller and > faster and has lower register pressure. > > Tested without regressions. > > Ok to commit? Ok. Denis.
Re: Initial shrink-wrapping patch
Bernd Schmidt writes: >>> +/* Return true if INSN requires the stack frame to be set up. >>> + PROLOGUE_USED contains the hard registers used in the function >>> + prologue. */ >>> +static bool >>> +requires_stack_frame_p (rtx insn, HARD_REG_SET prologue_used) >>> +{ >>> [...] >>> + if (for_each_rtx (&PATTERN (insn), frame_required_for_rtx, NULL)) >>> +return true; >>> + CLEAR_HARD_REG_SET (hardregs); >>> + note_stores (PATTERN (insn), record_hard_reg_sets, &hardregs); >>> + if (hard_reg_set_intersect_p (hardregs, prologue_used)) >>> +return true; >>> + AND_COMPL_HARD_REG_SET (hardregs, call_used_reg_set); >>> + for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) >>> +if (TEST_HARD_REG_BIT (hardregs, regno) >>> + && df_regs_ever_live_p (regno)) >>> + return true; >> >> ...I suppose this ought to use DF instead. > > Here, I kind of disagree. Most of the new code works on unemitted > sequences, and df doesn't work for that, so we rely on note_stores and > such quite a lot. I've changed the one note_stores call in this function > to use df, but IMO it's not an improvement. As for > frame_required_for_rtx, I'd much rather test for equality with > hard_frame_pointer_rtx than muck about with register numbers and > frame_pointer_needed tests. Seems like checking for HARD_FRAME_POINTER_REGNUM would be OK regardless. Even if it isn't being used as a frame pointer, the hard frame pointer still needs to be saved and restored, so references would still need the protection of the prologue. I don't know off-hand whether targets like AVR ever need to generate QImode parts of the frame pointer (in which case checking for register numbers seems like the right thing). But I agree it's borderline, so I won't insist. > Also, it turns out I need to pretend that trap_if requires the prologue > due to the testcase you also ran across, so a for_each_rtx walk is > required anyway. Why does TRAP_IF inherently need a prologue though? The CFA information should be correct regardless. Do we really want this behaviour for conditional TRAP_IFs, such as you might get to trap division by zero? Seems odd to treat explicit traps (on architectures that need them) differently from a plain div (in cases where that traps). Richard
Re: [2/4] SMS: Use ids to represent ps_insns
Ayal Zaks writes: > So instead of navigating directly from > ps_insn->ddg_node->node_sched_params, we now use indices and lookup > pointees in ddg_node and node_sched_params arrays. A bit of a > nuisance, but it's ok with me. Well, IMO, ps_insn->ddg_node->node_sched_params is the same amount of indirection as node_sched_params[ps_insn->id]. > o One could still achieve the goal of having ps_insn's with > node_sched_params but free of ddg_node's, w/o penalizing the existing > direct access from ddg_node->node_sched_params, and w/o replicating > the interface. If you add an (insn field and an) aux union to ps_insn, > whose info points to your node_sched_params, you could reuse the same > set of macros. Admittedly, it's a space-time tradeoff, where the space > is probably not a major concern, and there are other places to look > for first in sms to save time. I'm not sure what you mean by "replicating the interface". There's still only one interface for getting schedule params: everything still goes through the SCHED_* macros. If anything, I think having a way of going directly from the ps_insn to the sched params _would_ replicate the interface, because some parts of SMS want the scheduling parameters for a ddg node rather than a ps_insn. So some parts would (presumably) still use SCHED_* macros for a node, while the rest would use some other interface for ps_insns. But I'll do that if you think it's better. If we do, I think we should remove the current SCHED_* macros and just have one that goes from a ddg node to the parameters structure itself. So SCHED_TIME (node) becomes SCHED_PARAMS (node)->time, etc. Code that operates on ps_insns could just use pi->sched_params->time. But if we want to keep SCHED_TIME, etc., macros that can be used for everything, then I don't see how changes to ps_insn would help. > o first_reg_move and nreg_moves will be redundant for regmoves, right? > No refactoring is perfect... After the patches, they're only there for debugging. I did wonder whether I should just remove them. > o it could be useful to have a debug version which checks array > bounds, in case one feeds a bad index. FWIW, VEC does this for us. > o and a minor comment below: > >> /* The scheduling parameters held for each node. */ >> typedef struct node_sched_params >> { >> - int asap; /* A lower-bound on the absolute scheduling cycle. */ >> int time; /* The absolute scheduling cycle (time >= asap). */ > > Please fix/remove the "(time >= asap)" comment, as there's no asap > there any more. OK. Richard
Re: [PLUGIN] Fix PLUGIN_FINISH_TYPE
Hi 2011/9/12 Dodji Seketeli : > Romain Geissler a écrit: >> When i recontributed the PLUGIN_FINISH_DECL patch from the original >> Brian Hackett, i didn't exactly checked what may or may not trigger >> this new event. I know for example that declaring a function triggers >> this event, but defining it does not. >> >> I don't really know when those event should be triggered, we should >> clarify the meaning of those. >> >> According to me: >> PLUGIN_FINISH_DECL should be triggered anytime the parser parse a >> declaration (which includes declaration + definition of function, >> typedef definition, namespaces, ..., all DECL_P trees built by the >> parser). > > The general idea sounds sensible, IMHO. However, we must keep in mind > that there are cases like, e.g, 'struct C;' where G++ creates a typedef > 'typedef struct C C;' so that you can name that type 'C' instead of > having to type "struct C' all the time. For these cases, I don't think > the PLUGIN_FINISH_DECL event should be emitted. I agree. > >> For, PLUGIN_FINISH_TYPE i don't really know it means a new type >> declaration (or declaration + definition) or if it means usage of a >> type (in a function prototype, the type of a local variable. > > I'd say it's a definition of a new type, IMHO. Ok, so it only involves struct, unions, enum and class declaration / definitions. > >> I would rather vote for new type definition (including typedefs) > > My understanding is that a typedef declaration doesn't define a new > type. Rather, it declares an alias for an existing type. As such, I > would think that notifying typedef declarations via PLUGIN_FINISH_DECL > would be the way to go. Ok > >> but for special cases of struct, you can declare and use them at the >> same time: > > Just to be sure I understand, do you need to be notified about *uses* of > types and decls as well? If so, maybe a new kind of event should > probably be defined, because PLUGIN_FINISH_DECL and PLUGIN_FINISH_TYPE > seem to have more to do with declaring/defining decls and types than > using them. > Personally i don't need to catch all struct uses, but i need to catch struct declarations. I want to apply some __attributes__ to a given struct type, for example let's say i need to mark *struct my_struct* as deprecated thanks to a plugin. I know how to apply some attributes to a type or a decl. See the plugin (test_plugin.c) and the test files attached. With test_pass.c, my_struct is declared first, then defined after, applying the deprecated attribute works. With test_fail.c, my_struct is declared and defined at the same time, applying the deprecated attribute doesn't work with the current trunk (and also with my patch). I got: test_fail.c:4:1: warning: type attributes ignored after type is already defined [-Wattributes] So i may need a PLUGIN_FINISH_TYPE_DECLARATION triggered when the type is declared but before it is finally defined. Does two different events PLUGIN_FINISH_TYPE_DECLARATION and PLUGIN_FINISH_TYPE_DEFINITION make sens to you ? > -- >Dodji > Romain Geissler struct my_struct { int field_1; int field_2; }; struct my_struct *my_function(); struct my_struct x = {1, 2}; struct my_struct *my_function(){ return &x; } struct my_struct *my_function(); struct my_struct { int field_1; int field_2; }; struct my_struct x = {1, 2}; struct my_struct *my_function(){ return &x; } #include "gcc-plugin.h" #include "plugin-version.h" #include "tree.h" #include "cp/cp-tree.h" #pragma weak cplus_decl_attributes bool my_struct_found = false; void finish_type_callback (void *gcc_data, void *data ATTRIBUTE_UNUSED) { tree type = (tree)gcc_data; const char *type_name; if (my_struct_found || type == error_mark_node || DECL_P (type)) { //current PLUGIN_FINISH_TYPE is buggy in C++ //and my current patch may return TYPE_DECL for typedefs return; } if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) { type_name = IDENTIFIER_POINTER (TYPE_NAME (type)); } else { type_name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))); } if (strcmp (type_name, "my_struct")) { //only affect my_struct type return; } my_struct_found = true; tree deprecated_attribute = tree_cons (get_identifier ("deprecated"), NULL_TREE, NULL_TREE); inform(input_location, "my_struct found"); //apply the deprecated attribute to the my_struct type. if (cplus_decl_attributes) { cplus_decl_attributes (&type, deprecated_attribute, ATTR_FLAG_TYPE_IN_PLACE); } else { decl_attributes (&type, deprecated_attribute, ATTR_FLAG_TYPE_IN_PLACE); } } int plugin_is_GPL_compatible; int plugin_init (struct plugin_name_args *plugin_info, struct plugin_gcc_version *
Re: Initial shrink-wrapping patch
On 09/13/11 10:35, Richard Sandiford wrote: >> Also, it turns out I need to pretend that trap_if requires the prologue >> due to the testcase you also ran across, so a for_each_rtx walk is >> required anyway. > > Why does TRAP_IF inherently need a prologue though? The CFA information > should be correct regardless. It is until you cross-jump the two trap_ifs. So we have to disable either one of the two optimizations for them. Bernd
Re: Initial shrink-wrapping patch
Bernd Schmidt writes: > On 09/13/11 10:35, Richard Sandiford wrote: >>> Also, it turns out I need to pretend that trap_if requires the prologue >>> due to the testcase you also ran across, so a for_each_rtx walk is >>> required anyway. >> >> Why does TRAP_IF inherently need a prologue though? The CFA information >> should be correct regardless. > > It is until you cross-jump the two trap_ifs. So we have to disable > either one of the two optimizations for them. But trap_if seems to be tackling it at the wrong level. AIUI, the problem is that we usually rely on the different return JUMP_LABELs to stop unwrapped blocks from being merged with wrapped blocks, and that that falls down if there is no return. And although it's likely always true in practice, it seems wrong in principle to assume that nothing after prologue/epilogue generation will discover new points of no return. So yeah, maybe trying to disable cross-jumping in this sort of situation (and hopefully only in this sort of situation) is the right way to go. It would be good if we could represent it in the rtl somehow, so that the current analysis code will think that the two blocks aren't equal, without us having to remember to add a special check everywhere that this sort of thing could occur. Not sure how feasible that is though... Richard
Re: Initial shrink-wrapping patch
On 09/13/11 13:37, Richard Sandiford wrote: > Bernd Schmidt writes: >> On 09/13/11 10:35, Richard Sandiford wrote: Also, it turns out I need to pretend that trap_if requires the prologue due to the testcase you also ran across, so a for_each_rtx walk is required anyway. >>> >>> Why does TRAP_IF inherently need a prologue though? The CFA information >>> should be correct regardless. >> >> It is until you cross-jump the two trap_ifs. So we have to disable >> either one of the two optimizations for them. > > But trap_if seems to be tackling it at the wrong level. AIUI, the > problem is that we usually rely on the different return JUMP_LABELs > to stop unwrapped blocks from being merged with wrapped blocks, > and that that falls down if there is no return. And although it's > likely always true in practice, it seems wrong in principle to assume > that nothing after prologue/epilogue generation will discover new > points of no return. Well, I know of nothing that could lead to such a case. Maybe we should worry about it when we get there? At the moment, only if_trap is known to cause us problems and it's easy enough to just deal with it by turning off either shrink-wrapping or crossjumping. I don't much care which... Bernd
Re: Initial shrink-wrapping patch
Bernd Schmidt writes: > On 09/13/11 13:37, Richard Sandiford wrote: >> Bernd Schmidt writes: >>> On 09/13/11 10:35, Richard Sandiford wrote: > Also, it turns out I need to pretend that trap_if requires the prologue > due to the testcase you also ran across, so a for_each_rtx walk is > required anyway. Why does TRAP_IF inherently need a prologue though? The CFA information should be correct regardless. >>> >>> It is until you cross-jump the two trap_ifs. So we have to disable >>> either one of the two optimizations for them. >> >> But trap_if seems to be tackling it at the wrong level. AIUI, the >> problem is that we usually rely on the different return JUMP_LABELs >> to stop unwrapped blocks from being merged with wrapped blocks, >> and that that falls down if there is no return. And although it's >> likely always true in practice, it seems wrong in principle to assume >> that nothing after prologue/epilogue generation will discover new >> points of no return. > > Well, I know of nothing that could lead to such a case. Maybe we should > worry about it when we get there? At the moment, only if_trap is known > to cause us problems and it's easy enough to just deal with it by > turning off either shrink-wrapping or crossjumping. I don't much care > which... It just feels like checking for trap_if or turning off cross-jumping are working around problems in the representation of shrink-wrapped functions. There should be something in the IL to say that those two blocks cannot be merged for CFI reasons. Maybe two flags on the basic block to say whether they start (resp. end) with the "wrapped" version of the CFI? (Which unfortunately would need to be checked explicitly.) OTOH, if another reviewer thinks that's unreasnable, I'll happily defer to them. Richard
Missing SCALAR_INT_MODE_P checks in simplify_subreg
While working on an ARM backend patch, I tripped over a case in which a subreg of a vector zero-extension was wrongly being optimised to zero. This comes from the following code in simplify_subreg: /* Optimize SUBREG truncations of zero and sign extended values. */ if ((GET_CODE (op) == ZERO_EXTEND || GET_CODE (op) == SIGN_EXTEND) && GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode)) { unsigned int bitpos = subreg_lsb_1 (outermode, innermode, byte); /* If we're requesting the lowpart of a zero or sign extension, there are three possibilities. If the outermode is the same as the origmode, we can omit both the extension and the subreg. If the outermode is not larger than the origmode, we can apply the truncation without the extension. Finally, if the outermode is larger than the origmode, but both are integer modes, we can just extend to the appropriate mode. */ if (bitpos == 0) { enum machine_mode origmode = GET_MODE (XEXP (op, 0)); if (outermode == origmode) return XEXP (op, 0); if (GET_MODE_PRECISION (outermode) <= GET_MODE_PRECISION (origmode)) return simplify_gen_subreg (outermode, XEXP (op, 0), origmode, subreg_lowpart_offset (outermode, origmode)); if (SCALAR_INT_MODE_P (outermode)) return simplify_gen_unary (GET_CODE (op), outermode, XEXP (op, 0), origmode); } /* A SUBREG resulting from a zero extension may fold to zero if it extracts higher bits that the ZERO_EXTEND's source bits. */ if (GET_CODE (op) == ZERO_EXTEND && bitpos >= GET_MODE_PRECISION (GET_MODE (XEXP (op, 0 return CONST0_RTX (outermode); } I think all four of the optimisations above are only valid for integer extensions, i.e. for integer innermodes. (Except as already checked, they should be correct regardless of the outermode.) It looks like the same problem applies to several other optimisations in the same function. In all cases, it's the check for inner modes that's missing; the outer one is already checked where necessary. However, for: /* Recognize a word extraction from a multi-word subreg. */ if ((GET_CODE (op) == LSHIFTRT || GET_CODE (op) == ASHIFTRT) && SCALAR_INT_MODE_P (outermode) && GET_MODE_PRECISION (outermode) >= BITS_PER_WORD && GET_MODE_PRECISION (innermode) >= (2 * GET_MODE_PRECISION (outermode)) && CONST_INT_P (XEXP (op, 1)) && (INTVAL (XEXP (op, 1)) & (GET_MODE_PRECISION (outermode) - 1)) == 0 && INTVAL (XEXP (op, 1)) >= 0 && INTVAL (XEXP (op, 1)) < GET_MODE_PRECISION (innermode) && byte == subreg_lowpart_offset (outermode, innermode)) { int shifted_bytes = INTVAL (XEXP (op, 1)) / BITS_PER_UNIT; return simplify_gen_subreg (outermode, XEXP (op, 0), innermode, (WORDS_BIG_ENDIAN ? byte - shifted_bytes : byte + shifted_bytes)); } I don't think the outer mode check is necessary; nothing seems to rely on the outer mode being interpreted as an integer. So in this case, it looks like the right thing is to check innermode instead of, rather than as well as, outermode. Tested on arm-linux-gnueabi and x86_64-linux-gnu. Although I suppose I could self-approve this, I'd appreciate it if someone would double-check. Richard gcc/ * simplify-rtx.c (simplify_subreg): Check that the inner mode is a scalar integer before applying integer-only optimisations to inner arithmetic. Index: gcc/simplify-rtx.c === --- gcc/simplify-rtx.c 2011-09-13 13:33:29.423670877 +0100 +++ gcc/simplify-rtx.c 2011-09-13 13:33:51.748629417 +0100 @@ -5611,6 +5611,7 @@ simplify_subreg (enum machine_mode outer /* Optimize SUBREG truncations of zero and sign extended values. */ if ((GET_CODE (op) == ZERO_EXTEND || GET_CODE (op) == SIGN_EXTEND) + && SCALAR_INT_MODE_P (innermode) && GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode)) { unsigned int bitpos = subreg_lsb_1 (outermode, innermode, byte); @@ -5649,6 +5650,7 @@ simplify_subreg (enum machine_mode outer if ((GET_CODE (op) == LSHIFTRT || GET_CODE (op) == ASHIFTRT) && SCALAR_INT_MODE_P (outermode) + && SCALAR_INT_MODE_P (innermode) /* Ensure that OUTERMODE is at least twice as wide as the INNERMODE to avoid the possibility that an outer LSHIFTRT shifts by more than the sign extension's sign_bit_copies and introduces zeros @@ -5668,6 +5670,7 @@ simplify_subreg (enum machine_mode outer if ((GET_CODE (op) == LSHIFTRT || GET_CODE (op)
reorg.c: fix a linker error if HAVE_return is not defined
Hello, the unique caller of the function `make_return_insns' is not guarded by [HAVE_return], causing a linker error if !HAVE_return. Any comment? Cheers, Giuseppe gcc/ChangeLog 2011-09-13 Giuseppe Scrivano * reorg.c: Always define make_return_insns. diff --git a/gcc/reorg.c b/gcc/reorg.c index 8880545..ce6e142 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -219,9 +219,7 @@ static rtx fill_slots_from_thread (rtx, rtx, rtx, rtx, int *, rtx); static void fill_eager_delay_slots (void); static void relax_delay_slots (rtx); -#ifdef HAVE_return static void make_return_insns (rtx); -#endif /* A wrapper around next_active_insn which takes care to return ret_rtx unchanged. */ @@ -3711,7 +3709,6 @@ relax_delay_slots (rtx first) } } -#ifdef HAVE_return /* Look for filled jumps to the end of function label. We can try to convert them into RETURN insns if the insns in the delay slot are valid for the @@ -3867,7 +3864,7 @@ make_return_insns (rtx first) fill_simple_delay_slots (1); fill_simple_delay_slots (0); } -#endif + /* Try to find insns to place in delay slots. */
Re: [2/4] SMS: Use ids to represent ps_insns
2011/9/13 Richard Sandiford > > Ayal Zaks writes: > > So instead of navigating directly from > > ps_insn->ddg_node->node_sched_params, we now use indices and lookup > > pointees in ddg_node and node_sched_params arrays. A bit of a > > nuisance, but it's ok with me. > > Well, IMO, ps_insn->ddg_node->node_sched_params is the same amount > of indirection as node_sched_params[ps_insn->id]. > Agreed. Both involve one indirection. The difference is in lookup versus using each single direct pointer access. > > > o One could still achieve the goal of having ps_insn's with > > node_sched_params but free of ddg_node's, w/o penalizing the existing > > direct access from ddg_node->node_sched_params, and w/o replicating > > the interface. If you add an (insn field and an) aux union to ps_insn, > > whose info points to your node_sched_params, you could reuse the same > > set of macros. Admittedly, it's a space-time tradeoff, where the space > > is probably not a major concern, and there are other places to look > > for first in sms to save time. > > I'm not sure what you mean by "replicating the interface". There's > still only one interface for getting schedule params: everything still > goes through the SCHED_* macros. > > If anything, I think having a way of going directly from the ps_insn to > the sched params _would_ replicate the interface, because some parts of > SMS want the scheduling parameters for a ddg node rather than a ps_insn. > So some parts would (presumably) still use SCHED_* macros for a node, > while the rest would use some other interface for ps_insns. If we add to ps_insn the same aux structure as ddg_node has, with info pointing to node_sched_params, we could reuse the same set of macros. > > But I'll do that if you think it's better. No need, your solution is fine. Just wanted to clarify the options. > > If we do, I think we > should remove the current SCHED_* macros and just have one that > goes from a ddg node to the parameters structure itself. > So SCHED_TIME (node) becomes SCHED_PARAMS (node)->time, etc. > Code that operates on ps_insns could just use pi->sched_params->time. > > But if we want to keep SCHED_TIME, etc., macros that can be used for > everything, then I don't see how changes to ps_insn would help. > > > o first_reg_move and nreg_moves will be redundant for regmoves, right? > > No refactoring is perfect... > > After the patches, they're only there for debugging. I did wonder > whether I should just remove them. I'd prefer not to keep useless fields around. If left only for debugging, better document and/or rename. > > > o it could be useful to have a debug version which checks array > > bounds, in case one feeds a bad index. > > FWIW, VEC does this for us. > ok, right, in patch [3/4], for node_sched_params and ps_reg_move_info. > > > o and a minor comment below: > > > >> /* The scheduling parameters held for each node. */ > >> typedef struct node_sched_params > >> { > >> - int asap; /* A lower-bound on the absolute scheduling cycle. */ > >> int time; /* The absolute scheduling cycle (time >= asap). */ > > > > Please fix/remove the "(time >= asap)" comment, as there's no asap > > there any more. > > OK. Thanks, Ayal. > > Richard
Prevent inliner from removing aliases of used comdats
Hi, can_remove_node_now_p has two thikos in it that makes it to remove aliases of comdats that eventually may lead to unresolved symbols. Fixed thus. Bootstrapped/regtested x86_64-linux, comitted. Honza Index: ChangeLog === --- ChangeLog (revision 178808) +++ ChangeLog (working copy) @@ -1,3 +1,8 @@ +2011-09-13 Jan Hubicka + + PR other/49533 + * ipa-inline-transform.c (can_remove_node_now_p): Fix thunkos. + 2011-09-13 Paul Brook * config/arm/arm.h (ASM_PREFERRED_EH_DATA_FORMAT): Define. Index: ipa-inline-transform.c === --- ipa-inline-transform.c (revision 178808) +++ ipa-inline-transform.c (working copy) @@ -120,8 +120,8 @@ can_remove_node_now_p (struct cgraph_nod return true; for (next = node->same_comdat_group; next != node; next = next->same_comdat_group) -if (node->callers && node->callers != e - && !can_remove_node_now_p_1 (node)) +if ((next->callers && next->callers != e) + || !can_remove_node_now_p_1 (next)) return false; return true; }
Force aliases to be output when cgraph decides so
Hi, this patch solves second problem seen on libreoffice build. Here cgraph decides to output alias, but because assemble_alias still contains the old alias pair path, it ends up adding the alias pair that is later discarded and alias not output. This will be cleaned up once I turn weakrefs to the new alias infrastructure. Hopefully next week. Honza Bootstrapped/regtested x86_64-linux, comitted. PR other/49533 * cgraphunit.c (assemble_thunks_and_aliases): Force alias to be output. Index: cgraphunit.c === --- cgraphunit.c(revision 178808) +++ cgraphunit.c(working copy) @@ -1772,9 +1772,15 @@ assemble_thunks_and_aliases (struct cgra if (ref->use == IPA_REF_ALIAS) { struct cgraph_node *alias = ipa_ref_refering_node (ref); +bool saved_written = TREE_ASM_WRITTEN (alias->thunk.alias); + + /* Force assemble_alias to really output the alias this time instead + of buffering it in same alias pairs. */ + TREE_ASM_WRITTEN (alias->thunk.alias) = 1; assemble_alias (alias->decl, DECL_ASSEMBLER_NAME (alias->thunk.alias)); assemble_thunks_and_aliases (alias); + TREE_ASM_WRITTEN (alias->thunk.alias) = saved_written; } }
Re: reorg.c: fix a linker error if HAVE_return is not defined
Giuseppe Scrivano writes: > 2011-09-13 Giuseppe Scrivano > > * reorg.c: Always define make_return_insns. Thanks, applied. Richard
Re: [C++-11] User defined literals
On 09/13/2011 10:35 AM, Ed Smith-Rowland wrote: I need to build a TEMPLATE_ID_EXPR whenever I encounter 1234_suffix. I need to construct a call operator"" _suffix<'1','2','3','4'>(); Is make_char_string_pack (const char* str) in cp/parser.c right? The TREE_TYPE of a NONTYPE_ARGUMENT_PACK is not a pack itself, but the type of an element. So char_type_node in this case. Jason
Re: Initial shrink-wrapping patch
On 09/13/11 15:05, Richard Sandiford wrote: > It just feels like checking for trap_if or turning off cross-jumping > are working around problems in the representation of shrink-wrapped > functions. There should be something in the IL to say that those > two blocks cannot be merged for CFI reasons. There is - JUMP_LABELs and such, and the simple_return vs return distinction. This works for essentially all the interesting cases. The problem here is that we don't have a jump as the last insn. So how about the solution in crossjumping as below? > Maybe two flags on > the basic block to say whether they start (resp. end) with the > "wrapped" version of the CFI? (Which unfortunately would need > to be checked explicitly.) I think that's overdesigning it, and it breaks as soon as something discards the bb info (reorg...) or puts a label in the middle of a prologue or epilogue. Keeping that up-to-date would be much more fragile than just manually dealing with the few cases where we can't tell what's going on. > OTOH, if another reviewer thinks that's unreasnable, I'll happily > defer to them. Cc'ing rth for a second opinion... Bernd * cfgcleanup.c (outgoing_edges_match): Nonjump edges to the EXIT_BLOCK_PTR match only if we did not perform shrink-wrapping. Index: gcc/cfgcleanup.c === --- gcc/cfgcleanup.c(revision 178734) +++ gcc/cfgcleanup.c(working copy) @@ -1488,6 +1488,16 @@ outgoing_edges_match (int mode, basic_bl edge e1, e2; edge_iterator ei; + /* If we performed shrink-wrapping, edges to the EXIT_BLOCK_PTR can + only be distinguished for JUMP_INSNs. The two paths may differ in + whether they went through the prologue. Sibcalls are fine, we know + that we either didn't need or inserted an epilogue before them. */ + if (flag_shrink_wrap + && single_succ_p (bb1) && single_succ (bb1) == EXIT_BLOCK_PTR + && !JUMP_P (BB_END (bb1)) + && !(CALL_P (BB_END (bb1)) && SIBLING_CALL_P (BB_END (bb1 +return false; + /* If BB1 has only one successor, we may be looking at either an unconditional jump, or a fake edge to exit. */ if (single_succ_p (bb1)
Re: Vector shuffling
On Fri, 9 Sep 2011, Artem Shinkarov wrote: > Hi, sorry for the delay, I had a lot of other stuff to do. > > In the attachment there is a new patch that fixes all the issues > pointed by Joseph and almost all the issues pointed by Richard. The > issues that are not fixed are explained further. The C front-end parts of this version of the patch are OK with the spurious whitespace change > @@ -6120,7 +6213,7 @@ digest_init (location_t init_loc, tree t > tree value; > bool constant_p = true; > > - /* Iterate through elements and check if all constructor > + /* Iterate through elements and check if all constructor >elements are *_CSTs. */ removed. The original version of this line was correctly indented with a TAB. -- Joseph S. Myers jos...@codesourcery.com
[PATCH] sel-sched: fix merging of LHS reg availability (PR 50340)
Hello, This patches fixes an ICE on an assert that performs a sanity check on target_available field of expr_t, which is tri-state: LHS register is available (1), not available (0) or unknown (-1). The problem is, when merging expr data of separable exprs with differing LHSes, we can't claim we know anything about availability of the target register if the unavailable LHS of the other expr is not the same register. Thus, we should set the field to -1, not 0. Fixed as follows, bootstrapped and regtested on x86_64-linux and ia64-linux (without java, with one recent SRA patch reverted to unbreak bootstrap) with sel-sched enabled at -O2. OK for trunk? (a small testcase is not available at the moment, but I can try to produce one using delta before committing) 2011-09-13 Andrey Belevantsev * sel-sched-ir.c (update_target_availability): LHS register availability is not known if the unavailable LHS of the other expression is a different register. diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index 4878460..b132392 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -1746,7 +1746,13 @@ update_target_availability (expr_t to, expr_t from, insn_t split_point) EXPR_TARGET_AVAILABLE (to) = -1; } else -EXPR_TARGET_AVAILABLE (to) &= EXPR_TARGET_AVAILABLE (from); +if (EXPR_TARGET_AVAILABLE (from) == 0 +&& EXPR_LHS (from) +&& REG_P (EXPR_LHS (from)) +&& REGNO (EXPR_LHS (to)) != REGNO (EXPR_LHS (from))) + EXPR_TARGET_AVAILABLE (to) = -1; +else + EXPR_TARGET_AVAILABLE (to) &= EXPR_TARGET_AVAILABLE (from); } }
Go patch committed: Fix inherited hidden methods
This patch fixes inherited hidden methods which return a struct containing hidden fields. This is a rather brute force approach which just adds a flag saying that hidden fields are OK where needed. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r b64b134fd7ac go/statements.cc --- a/go/statements.cc Fri Sep 09 21:10:35 2011 -0700 +++ b/go/statements.cc Tue Sep 13 09:52:18 2011 -0700 @@ -402,7 +402,13 @@ if (this->type_ != NULL && this->init_ != NULL) { std::string reason; - if (!Type::are_assignable(this->type_, this->init_->type(), &reason)) + bool ok; + if (this->are_hidden_fields_ok_) + ok = Type::are_assignable_hidden_ok(this->type_, this->init_->type(), + &reason); + else + ok = Type::are_assignable(this->type_, this->init_->type(), &reason); + if (!ok) { if (reason.empty()) error_at(this->location(), "incompatible types in assignment"); @@ -504,9 +510,15 @@ Assignment_statement(Expression* lhs, Expression* rhs, source_location location) : Statement(STATEMENT_ASSIGNMENT, location), - lhs_(lhs), rhs_(rhs) + lhs_(lhs), rhs_(rhs), are_hidden_fields_ok_(false) { } + // Note that it is OK for this assignment statement to set hidden + // fields. + void + set_hidden_fields_are_ok() + { this->are_hidden_fields_ok_ = true; } + protected: int do_traverse(Traverse* traverse); @@ -531,6 +543,9 @@ Expression* lhs_; // Right hand side--the rvalue. Expression* rhs_; + // True if this statement may set hidden fields in the assignment + // statement. This is used for generated method stubs. + bool are_hidden_fields_ok_; }; // Traversal. @@ -579,7 +594,12 @@ Type* lhs_type = this->lhs_->type(); Type* rhs_type = this->rhs_->type(); std::string reason; - if (!Type::are_assignable(lhs_type, rhs_type, &reason)) + bool ok; + if (this->are_hidden_fields_ok_) +ok = Type::are_assignable_hidden_ok(lhs_type, rhs_type, &reason); + else +ok = Type::are_assignable(lhs_type, rhs_type, &reason); + if (!ok) { if (reason.empty()) error_at(this->location(), "incompatible types in assignment"); @@ -820,9 +840,15 @@ Tuple_assignment_statement(Expression_list* lhs, Expression_list* rhs, source_location location) : Statement(STATEMENT_TUPLE_ASSIGNMENT, location), - lhs_(lhs), rhs_(rhs) + lhs_(lhs), rhs_(rhs), are_hidden_fields_ok_(false) { } + // Note that it is OK for this assignment statement to set hidden + // fields. + void + set_hidden_fields_are_ok() + { this->are_hidden_fields_ok_ = true; } + protected: int do_traverse(Traverse* traverse); @@ -846,6 +872,9 @@ Expression_list* lhs_; // Right hand side--a list of rvalues. Expression_list* rhs_; + // True if this statement may set hidden fields in the assignment + // statement. This is used for generated method stubs. + bool are_hidden_fields_ok_; }; // Traversal. @@ -901,6 +930,8 @@ Temporary_statement* temp = Statement::make_temporary((*plhs)->type(), *prhs, loc); + if (this->are_hidden_fields_ok_) + temp->set_hidden_fields_are_ok(); b->add_statement(temp); temps.push_back(temp); @@ -924,6 +955,11 @@ Expression* ref = Expression::make_temporary_reference(*ptemp, loc); Statement* s = Statement::make_assignment(*plhs, ref, loc); + if (this->are_hidden_fields_ok_) + { + Assignment_statement* as = static_cast(s); + as->set_hidden_fields_are_ok(); + } b->add_statement(s); ++ptemp; } @@ -2592,7 +2628,12 @@ e->determine_type(&type_context); std::string reason; - if (Type::are_assignable(rvtype, e->type(), &reason)) + bool ok; + if (this->are_hidden_fields_ok_) + ok = Type::are_assignable_hidden_ok(rvtype, e->type(), &reason); + else + ok = Type::are_assignable(rvtype, e->type(), &reason); + if (ok) { Expression* ve = Expression::make_var_reference(rv, e->location()); lhs->push_back(ve); @@ -2614,13 +2655,28 @@ ; else if (lhs->size() == 1) { - b->add_statement(Statement::make_assignment(lhs->front(), rhs->front(), - loc)); + Statement* s = Statement::make_assignment(lhs->front(), rhs->front(), + loc); + if (this->are_hidden_fields_ok_) + { + Assignment_statement* as = static_cast(s); + as->set_hidden_fields_are_ok(); + } + b->add_statement(s); delete lhs; delete rhs; } else -b->add_statement(Statement::make_tuple_assignment(lhs, rhs, loc)); +{ + Statement* s = Statement::make_tuple_assignment(lhs, rhs, loc); + if (this->are_hidden_fields_ok_) + { + Tuple_assignment_statement* tas = + static_cast(s); + tas->set_hidden_fields_are_ok(); + } + b->add_statement(s); +} b->add_statement(this); @@ -2670,7 +2726,7 @@ // Make a return statement. -Statement* +Return_statement* Statemen
[ARM] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building arm-linux-gnueabi, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/arm/arm.md: Use match_test rather than eq/ne symbol_ref throughout file. * config/arm/neon.md: Likewise. * config/arm/vfp.md: Likewise. * config/arm/thumb2.md: Likewise. * config/arm/cortex-m4.md: Likewise. Index: gcc/config/arm/arm.md === --- gcc/config/arm/arm.md 2011-09-12 20:21:45.0 +0100 +++ gcc/config/arm/arm.md 2011-09-13 18:38:08.0 +0100 @@ -211,31 +211,31 @@ (define_attr "arch_enabled" "no,yes" (const_string "yes") (and (eq_attr "arch" "a") - (ne (symbol_ref "TARGET_ARM") (const_int 0))) + (match_test "TARGET_ARM")) (const_string "yes") (and (eq_attr "arch" "t") - (ne (symbol_ref "TARGET_THUMB") (const_int 0))) + (match_test "TARGET_THUMB")) (const_string "yes") (and (eq_attr "arch" "t1") - (ne (symbol_ref "TARGET_THUMB1") (const_int 0))) + (match_test "TARGET_THUMB1")) (const_string "yes") (and (eq_attr "arch" "t2") - (ne (symbol_ref "TARGET_THUMB2") (const_int 0))) + (match_test "TARGET_THUMB2")) (const_string "yes") (and (eq_attr "arch" "32") - (ne (symbol_ref "TARGET_32BIT") (const_int 0))) + (match_test "TARGET_32BIT")) (const_string "yes") (and (eq_attr "arch" "v6") - (ne (symbol_ref "(TARGET_32BIT && arm_arch6)") (const_int 0))) + (match_test "TARGET_32BIT && arm_arch6")) (const_string "yes") (and (eq_attr "arch" "nov6") - (ne (symbol_ref "(TARGET_32BIT && !arm_arch6)") (const_int 0))) + (match_test "TARGET_32BIT && !arm_arch6")) (const_string "yes") (and (eq_attr "arch" "onlya8") @@ -7413,7 +7413,7 @@ (define_insn "*arm_cond_branch" (set_attr "type" "branch") (set (attr "length") (if_then_else - (and (ne (symbol_ref "TARGET_THUMB2") (const_int 0)) + (and (match_test "TARGET_THUMB2") (and (ge (minus (match_dup 0) (pc)) (const_int -250)) (le (minus (match_dup 0) (pc)) (const_int 256 (const_int 2) @@ -7439,7 +7439,7 @@ (define_insn "*arm_cond_branch_reversed" (set_attr "type" "branch") (set (attr "length") (if_then_else - (and (ne (symbol_ref "TARGET_THUMB2") (const_int 0)) + (and (match_test "TARGET_THUMB2") (and (ge (minus (match_dup 0) (pc)) (const_int -250)) (le (minus (match_dup 0) (pc)) (const_int 256 (const_int 2) @@ -7898,7 +7898,7 @@ (define_insn "*arm_jump" [(set_attr "predicable" "yes") (set (attr "length") (if_then_else - (and (ne (symbol_ref "TARGET_THUMB2") (const_int 0)) + (and (match_test "TARGET_THUMB2") (and (ge (minus (match_dup 0) (pc)) (const_int -2044)) (le (minus (match_dup 0) (pc)) (const_int 2048 (const_int 2) Index: gcc/config/arm/neon.md === --- gcc/config/arm/neon.md 2011-09-05 20:35:40.0 +0100 +++ gcc/config/arm/neon.md 2011-09-13 18:38:08.0 +0100 @@ -576,8 +576,8 @@ (define_insn "*add3_neon" "TARGET_NEON && (! || flag_unsafe_math_optimizations)" "vadd.\t%0, %1, %2" [(set (attr "neon_type") - (if_then_else (ne (symbol_ref "") (const_int 0)) -(if_then_else (ne (symbol_ref "") (const_int 0)) + (if_then_else (match_test "") +(if_then_else (match_test "") (const_string "neon_fp_vadd_ddd_vabs_dd") (const_string "neon_fp_vadd_qqq_vabs_qq")) (const_string "neon_int_1")))] @@ -612,8 +612,8 @@ (define_insn "*sub3_neon" "TARGET_NEON && (! || flag_unsafe_math_optimizations)" "vsub.\t%0, %1, %2" [(set (attr "neon_type") - (if_then_else (ne (symbol_ref "") (const_int 0)) -(if_then_else (ne (symbol_ref "") (const_int 0)) + (if_then_else (match_test "") +(if_then_else (match_test "") (const_string "neon_fp_vadd_ddd_vabs_dd") (const_string "neon_fp_vadd_qqq_vabs_qq")) (const_string "neon_int_2")))] @@ -649,16 +649,16 @@ (define_insn "*mul3_neon" "TARGET_NEON && (! || flag_unsafe_math_optimizations)" "vmul.\t%0, %1, %2" [(set (attr "neon_type") - (if_then_else (ne (symbol_ref "") (const_int 0)) -(if_then_else (ne (symbol_ref "") (
[BFIN] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building bfin-elf, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/bfin/bfin.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/bfin/bfin.md === --- gcc/config/bfin/bfin.md 2011-09-13 18:43:40.0 +0100 +++ gcc/config/bfin/bfin.md 2011-09-13 18:47:34.0 +0100 @@ -237,14 +237,12 @@ (define_insn_reservation "dsp32" 1 (define_insn_reservation "dsp32shiftimm" 1 (and (eq_attr "type" "dsp32shiftimm") - (eq (symbol_ref "ENABLE_WA_0574") - (const_int 0))) + (not (match_test "ENABLE_WA_0574"))) "slot0") (define_insn_reservation "dsp32shiftimm_anomaly_0574" 1 (and (eq_attr "type" "dsp32shiftimm") - (ne (symbol_ref "ENABLE_WA_0574") - (const_int 0))) + (match_test "ENABLE_WA_0574")) "slot0+anomaly_0574") (define_insn_reservation "load32" 1 @@ -277,8 +275,7 @@ (define_insn_reservation "storep" 1 (and (eq_attr "type" "mcst") (ior (eq_attr "addrtype" "preg") (eq_attr "addrtype" "spreg" - (ior (eq (symbol_ref "ENABLE_WA_0574") - (const_int 0)) + (ior (not (match_test "ENABLE_WA_0574")) (eq_attr "storereg" "other"))) "slot1+pregs+store") @@ -287,24 +284,21 @@ (define_insn_reservation "storep_anomaly (and (eq_attr "type" "mcst") (ior (eq_attr "addrtype" "preg") (eq_attr "addrtype" "spreg" - (and (ne (symbol_ref "ENABLE_WA_0574") - (const_int 0)) + (and (match_test "ENABLE_WA_0574") (eq_attr "storereg" "preg"))) "slot1+anomaly_0574+pregs+store") (define_insn_reservation "storei" 1 (and (and (not (eq_attr "seq_insns" "multi")) (and (eq_attr "type" "mcst") (eq_attr "addrtype" "ireg"))) - (ior (eq (symbol_ref "ENABLE_WA_0574") - (const_int 0)) + (ior (not (match_test "ENABLE_WA_0574")) (eq_attr "storereg" "other"))) "(slot1|slot2)+store") (define_insn_reservation "storei_anomaly_0574" 1 (and (and (not (eq_attr "seq_insns" "multi")) (and (eq_attr "type" "mcst") (eq_attr "addrtype" "ireg"))) - (and (ne (symbol_ref "ENABLE_WA_0574") - (const_int 0)) + (and (match_test "ENABLE_WA_0574") (eq_attr "storereg" "preg"))) "((slot1+anomaly_0574)|slot2)+store")
[H8300] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building h8300-elf, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/h8300/h8300.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/h8300/h8300.md === --- gcc/config/h8300/h8300.md 2011-09-13 18:43:40.0 +0100 +++ gcc/config/h8300/h8300.md 2011-09-13 18:49:19.0 +0100 @@ -171,9 +171,9 @@ (define_delay (and (eq_attr "delay_slot" (define_asm_attributes [(set (attr "length") - (cond [(ne (symbol_ref "TARGET_H8300") (const_int 0)) (const_int 4) - (ne (symbol_ref "TARGET_H8300H") (const_int 0)) (const_int 10) - (ne (symbol_ref "TARGET_H8300S") (const_int 0)) (const_int 10)] + (cond [(match_test "TARGET_H8300") (const_int 4) + (match_test "TARGET_H8300H") (const_int 10) + (match_test "TARGET_H8300S") (const_int 10)] (const_int 14)))]) (include "predicates.md") @@ -2416,7 +2416,7 @@ (define_insn "jump" }" [(set_attr "type" "branch") (set (attr "delay_slot") - (if_then_else (ne (symbol_ref "TARGET_H8300SX") (const_int 0)) + (if_then_else (match_test "TARGET_H8300SX") (const_string "jump") (const_string "none"))) (set_attr "cc" "none")])
Re: Prevent inliner from removing aliases of used comdats
Jan, Any testcase do can add? Graham
[IA64] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building ia64-linux-gnu, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/ia64/itanium2.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/ia64/itanium2.md === --- gcc/config/ia64/itanium2.md 2011-09-03 10:05:44.0 +0100 +++ gcc/config/ia64/itanium2.md 2011-09-13 18:39:02.0 +0100 @@ -710,294 +710,294 @@ (final_absence_set (define_insn_reservation "2_stop_bit" 0 (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "stop_bit")) - (eq (symbol_ref "bundling_p") (const_int 0))) + (not (match_test "bundling_p"))) "2_stop|2_m0_stop|2_m1_stop|2_mi0_stop|2_mi1_stop") (define_insn_reservation "2_br" 0 (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "br")) - (eq (symbol_ref "bundling_p") (const_int 0))) "2_B") + (not (match_test "bundling_p"))) "2_B") (define_insn_reservation "2_scall" 0 (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "scall")) - (eq (symbol_ref "bundling_p") (const_int 0))) "2_B") + (not (match_test "bundling_p"))) "2_B") (define_insn_reservation "2_fcmp"2 (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "fcmp")) - (eq (symbol_ref "bundling_p") (const_int 0))) "2_F") + (not (match_test "bundling_p"))) "2_F") (define_insn_reservation "2_fcvtfx" 4 (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "fcvtfx")) - (eq (symbol_ref "bundling_p") (const_int 0))) "2_F") + (not (match_test "bundling_p"))) "2_F") (define_insn_reservation "2_fld" 6 (and (and (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "fld")) (eq_attr "data_speculative" "no")) (eq_attr "check_load" "no")) - (eq (symbol_ref "bundling_p") (const_int 0))) + (not (match_test "bundling_p"))) "2_M") (define_insn_reservation "2_flda"6 (and (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "fld")) (eq_attr "data_speculative" "yes")) - (eq (symbol_ref "bundling_p") (const_int 0))) + (not (match_test "bundling_p"))) "2_M_only_um01") (define_insn_reservation "2_fldc"0 (and (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "fld")) (eq_attr "check_load" "yes")) - (eq (symbol_ref "bundling_p") (const_int 0))) + (not (match_test "bundling_p"))) "2_M_only_um01") (define_insn_reservation "2_fldp"6 (and (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "fldp")) (eq_attr "check_load" "no")) - (eq (symbol_ref "bundling_p") (const_int 0))) + (not (match_test "bundling_p"))) "2_M_only_um01") (define_insn_reservation "2_fldpc" 0 (and (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "fldp")) (eq_attr "check_load" "yes")) - (eq (symbol_ref "bundling_p") (const_int 0))) + (not (match_test "bundling_p"))) "2_M_only_um01") (define_insn_reservation "2_fmac"4 (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "fmac")) - (eq (symbol_ref "bundling_p") (const_int 0))) "2_F") + (not (match_test "bundling_p"))) "2_F") (define_insn_reservation "2_fmisc" 4 (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "fmisc")) - (eq (symbol_ref "bundling_p") (const_int 0))) "2_F") + (not (match_test "bundling_p"))) "2_F") ;; There is only one insn `mov = ar.bsp' for frar_i: ;; Latency time ??? (define_insn_reservation "2_frar_i" 13 (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "frar_i")) - (eq (symbol_ref "bundling_p") (const_int 0))) + (not (match_test "bundling_p"))) "2_I+2_only_ui0") ;; There is only two insns `mov = ar.unat' or `mov = ar.ccv' for frar_m: ;; Latency time ??? (define_insn_reservation "2_frar_m" 6 (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "frar_m")) - (eq (symbol_ref "bundling_p") (const_int 0))) + (not (match_test "bundling_p"))) "2_M_only_um2") (define_insn_reservation "2_frbr"2 (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "frbr")) - (eq (symbol_ref "bundling_p") (const_int 0))) + (not (match_test "bundling_p"))) "2_I+2_only_ui0") (define_insn_reservation "2_frfr"5 (and (and (eq_attr "cpu" "itanium2") (eq_attr "itanium_class" "frfr")) - (eq (symbol_ref "bundling_p") (const_int 0))) + (not (match_test "bundling_p"))) "2_M_only_um2") (define_insn_reservat
[IQ2000] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building iq2000-elf, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/iq2000/iq2000.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/iq2000/iq2000.md === --- gcc/config/iq2000/iq2000.md 2011-09-13 18:43:40.0 +0100 +++ gcc/config/iq2000/iq2000.md 2011-09-13 18:52:13.0 +0100 @@ -161,7 +161,7 @@ (define_attr "dslot" "has_dslot,ok_in_ds (define_attr "branch_likely" "no,yes" (const - (if_then_else (ne (symbol_ref "GENERATE_BRANCHLIKELY") (const_int 0)) + (if_then_else (match_test "GENERATE_BRANCHLIKELY") (const_string "yes") (const_string "no"
[M32R] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building m32r-elf, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/m32r/m32r.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/m32r/m32r.md === --- gcc/config/m32r/m32r.md 2011-09-13 18:43:39.0 +0100 +++ gcc/config/m32r/m32r.md 2011-09-13 18:53:40.0 +0100 @@ -69,9 +69,9 @@ (define_attr "insn_size" "short,long" ;; The target CPU we're compiling for. (define_attr "cpu" "m32r,m32r2,m32rx" - (cond [(ne (symbol_ref "TARGET_M32RX") (const_int 0)) + (cond [(match_test "TARGET_M32RX") (const_string "m32rx") -(ne (symbol_ref "TARGET_M32R2") (const_int 0)) +(match_test "TARGET_M32R2") (const_string "m32r2")] (const_string "m32r"))) @@ -2012,8 +2012,7 @@ (define_insn "*call_via_label" }" [(set_attr "type" "call") (set (attr "length") - (if_then_else (eq (symbol_ref "call26_operand (operands[0], FUNCTION_MODE)") - (const_int 0)) + (if_then_else (not (match_test "call26_operand (operands[0], FUNCTION_MODE)")) (const_int 12) ; 10 + 2 for nop filler ; The return address must be on a 4 byte boundary so ; there's no point in using a value of 2 here. A 2 byte @@ -2072,8 +2071,7 @@ (define_insn "*call_value_via_label" }" [(set_attr "type" "call") (set (attr "length") - (if_then_else (eq (symbol_ref "call26_operand (operands[1], FUNCTION_MODE)") - (const_int 0)) + (if_then_else (not (match_test "call26_operand (operands[1], FUNCTION_MODE)")) (const_int 12) ; 10 + 2 for nop filler ; The return address must be on a 4 byte boundary so ; there's no point in using a value of 2 here. A 2 byte
Re: [H8300] Use match_test rather than eq/ne symbol_ref
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/13/11 11:50, Richard Sandiford wrote: > As per the subject. Tested by making sure that there were no new > warnings building h8300-elf, and that there were no changes in the > assembly output for the C and C++ testsuite. OK to install? > > Richard > > > gcc/ * config/h8300/h8300.md: Use match_test rather than eq/ne > symbol_ref throughout file. OK jeff -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOb5kMAAoJEBRtltQi2kC7JhUIAImGzTwx0yllpWVE53L6UZPI UT3IdwgFjBdSfpU5RjXAmOqFUj6xZKHVtajM0e8h28TG43X+iBaqB59NGFUk30d4 38To54t/3cVZYTkg6brunXbre4rGODdvB8UNROIj4WSHeugjvNme4l8W9W7nd/6m pIFrz0msvMOpkj49o9t8DdkVWyQocZr7VOuLtIdevWio3ZWQzs6dVjPV9NmBHBtj Eo4FWi0c8yH5Heoem5INeVncSUH3Pw+EP5JheisEUaRXPU+NtxhtOKJtZU0kQj+9 ODkTVO5JqdwKriKEMAlXwR7nmsQ1YePZgX5wntHzDCI3YW8hEgRo/jysbAwwtwU= =j7YL -END PGP SIGNATURE-
[M68K] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building m68k-linux-gnu, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/m68k/m68k.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/m68k/m68k.md === --- gcc/config/m68k/m68k.md 2011-09-13 18:43:39.0 +0100 +++ gcc/config/m68k/m68k.md 2011-09-13 18:54:58.0 +0100 @@ -250,7 +250,7 @@ (define_attr "ok_for_coldfire" "yes,no" ;; Define 'enabled' attribute. (define_attr "enabled" "" - (cond [(and (ne (symbol_ref "TARGET_COLDFIRE") (const_int 0)) + (cond [(and (match_test "TARGET_COLDFIRE") (eq_attr "ok_for_coldfire" "no")) (const_int 0)] (const_int 1)))
[MEP] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building mep-elf, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/mep/mep.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/mep/mep.md === --- gcc/config/mep/mep.md 2011-09-13 18:43:39.0 +0100 +++ gcc/config/mep/mep.md 2011-09-13 18:56:07.0 +0100 @@ -299,14 +299,14 @@ (define_insn_reservation "h1_store" 1 (define_insn_reservation "h1_ipipe_ldc" 2 (and (eq_attr "stall" "ldc") - (ne (symbol_ref "mep_ipipe_ldc_p(insn)") (const_int 0))) + (match_test "mep_ipipe_ldc_p(insn)")) "core") (define_bypass 1 "h1_ipipe_ldc" "h1_int1,h1_ssarb") (define_bypass 1 "h1_ipipe_ldc" "h1_store" "mep_store_data_bypass_p") (define_insn_reservation "h1_apipe_ldc" 2 (and (eq_attr "stall" "ldc") - (eq (symbol_ref "mep_ipipe_ldc_p(insn)") (const_int 0))) + (not (match_test "mep_ipipe_ldc_p(insn)"))) "core") ;; 2 is correct for stc->ret and stc->fsft. The most important remaining
[MICROBLAZE] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building microblaze-elf, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/microblaze/microblaze.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/microblaze/microblaze.md === --- gcc/config/microblaze/microblaze.md 2011-09-13 18:43:39.0 +0100 +++ gcc/config/microblaze/microblaze.md 2011-09-13 18:57:23.0 +0100 @@ -351,7 +351,7 @@ (automata_option "progress") ;; (define_delay (eq_attr "type" "branch,call,jump") [(and (eq_attr "type" "!branch,call,jump,icmp,multi,no_delay_arith,no_delay_load,no_delay_store,no_delay_imul,no_delay_move,darith") -(ior (eq (symbol_ref "microblaze_no_unsafe_delay") (const_int 0)) +(ior (not (match_test "microblaze_no_unsafe_delay")) (eq_attr "type" "!fadd,frsub,fmul,fdiv,fcmp,store,load") )) (nil) (nil)])
[MN10300] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building mn10300-elf, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/mn10300/mn10300.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/mn10300/mn10300.md === --- gcc/config/mn10300/mn10300.md 2011-09-13 18:43:39.0 +0100 +++ gcc/config/mn10300/mn10300.md 2011-09-13 18:58:33.0 +0100 @@ -63,15 +63,15 @@ (define_attr "enabled" "" (const_int 1) (and (eq_attr "isa" "am33") - (ne (symbol_ref "TARGET_AM33") (const_int 0))) + (match_test "TARGET_AM33")) (const_int 1) (and (eq_attr "isa" "am33_2") - (ne (symbol_ref "TARGET_AM33_2") (const_int 0))) + (match_test "TARGET_AM33_2")) (const_int 1) (and (eq_attr "isa" "am34") - (ne (symbol_ref "TARGET_AM34") (const_int 0))) + (match_test "TARGET_AM34")) (const_int 1) ] (const_int 0))
[HPPA] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building hppa64-hp-hpux11.23, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/pa/pa.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/pa/pa.md === --- gcc/config/pa/pa.md 2011-09-13 18:43:39.0 +0100 +++ gcc/config/pa/pa.md 2011-09-13 19:00:48.0 +0100 @@ -143,8 +143,7 @@ (define_attr "in_call_delay" "false,true (eq_attr "length" "4")) (const_string "true") (eq_attr "type" "uncond_branch") - (if_then_else (ne (symbol_ref "TARGET_JUMP_IN_DELAY") -(const_int 0)) + (if_then_else (match_test "TARGET_JUMP_IN_DELAY") (const_string "true") (const_string "false"))] (const_string "false"))) @@ -181,8 +180,7 @@ (define_delay (eq_attr "type" "cbranch") (attr_flag "backward"))]) (define_delay (and (eq_attr "type" "uncond_branch") - (eq (symbol_ref "following_call (insn)") - (const_int 0))) + (not (match_test "following_call (insn)"))) [(eq_attr "in_branch_delay" "true") (nil) (nil)]) ;; Memory. Disregarding Cache misses, the Mustang memory times are: @@ -1348,9 +1346,9 @@ (define_insn "" (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8 (const_int MAX_17BIT_OFFSET)) (const_int 8) - (ne (symbol_ref "TARGET_PORTABLE_RUNTIME") (const_int 0)) + (match_test "TARGET_PORTABLE_RUNTIME") (const_int 24) - (eq (symbol_ref "flag_pic") (const_int 0)) + (not (match_test "flag_pic")) (const_int 20)] (const_int 28)))]) @@ -1377,9 +1375,9 @@ (define_insn "" (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8 (const_int MAX_17BIT_OFFSET)) (const_int 8) - (ne (symbol_ref "TARGET_PORTABLE_RUNTIME") (const_int 0)) + (match_test "TARGET_PORTABLE_RUNTIME") (const_int 24) - (eq (symbol_ref "flag_pic") (const_int 0)) + (not (match_test "flag_pic")) (const_int 20)] (const_int 28)))]) @@ -1404,9 +1402,9 @@ (define_insn "" (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8 (const_int MAX_17BIT_OFFSET)) (const_int 8) - (ne (symbol_ref "TARGET_PORTABLE_RUNTIME") (const_int 0)) + (match_test "TARGET_PORTABLE_RUNTIME") (const_int 24) - (eq (symbol_ref "flag_pic") (const_int 0)) + (not (match_test "flag_pic")) (const_int 20)] (const_int 28)))]) @@ -1433,9 +1431,9 @@ (define_insn "" (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8 (const_int MAX_17BIT_OFFSET)) (const_int 8) - (ne (symbol_ref "TARGET_PORTABLE_RUNTIME") (const_int 0)) + (match_test "TARGET_PORTABLE_RUNTIME") (const_int 24) - (eq (symbol_ref "flag_pic") (const_int 0)) + (not (match_test "flag_pic")) (const_int 20)] (const_int 28)))]) (define_insn "" @@ -1459,9 +1457,9 @@ (define_insn "" (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8 (const_int MAX_17BIT_OFFSET)) (const_int 8) - (ne (symbol_ref "TARGET_PORTABLE_RUNTIME") (const_int 0)) + (match_test "TARGET_PORTABLE_RUNTIME") (const_int 24) - (eq (symbol_ref "flag_pic") (const_int 0)) + (not (match_test "flag_pic")) (const_int 20)] (const_int 28)))]) @@ -1488,9 +1486,9 @@ (define_insn "" (lt (abs (minus (match_dup 0) (plus (pc) (const_int 8 (const_int MAX_17BIT_OFFSET)) (const_int 8) - (ne (symbol_ref "TARGET_PORTABLE_RUNTIME") (const_int 0)) + (match_test "TARGET_PORTABLE_RUNTIME") (const_int 24) - (eq (symbol_ref "flag_pic") (const_int 0)) + (not (match_test "flag_pic")) (const_int 20)] (const_int 28)))]) @@ -1517,9 +1515,9 @@ (define_insn "" (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8 (const_int MAX_17BIT_OFFSET)) (const_int 8) - (ne (symbol_ref "TARGET_PORTABLE_RUNTIME") (const_int 0)) + (match_test "TARGET_PORTABLE_RUNTIME") (const_int 24) - (eq (symbol_ref "flag_pic") (const_int 0)) + (not (match_test "flag_pic")) (const_int 20)] (const_int 28)))]) @@ -1545,9 +1543,9 @@ (define_insn "" (lt (abs (minus (match_dup 2) (plus (pc) (const_int 8 (const_int MAX_17BIT_OFFSET)) (const_int 8) - (ne (symbol_ref "TARGET_PORTA
Re: [M68K] Use match_test rather than eq/ne symbol_ref
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/13/11 11:56, Richard Sandiford wrote: > As per the subject. Tested by making sure that there were no new > warnings building m68k-linux-gnu, and that there were no changes in > the assembly output for the C and C++ testsuite. OK to install? > > Richard > > > gcc/ * config/m68k/m68k.md: Use match_test rather than eq/ne > symbol_ref throughout file. OK. jeff -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOb5qbAAoJEBRtltQi2kC7fzcH/3ah704wERsynmmjWawUzkdj uGRqSdhQ5LLwcn+Jt/+sMP1kEHWG/GoWOsSQI5baaJ9DWPkli7JZ7nrL8iOYv75R PAfBPIcSICGFLRKJmRWV+ETYDYVe6beI+bqpogXJhUZQ3sYgk5qAhF0kfPWwlz3+ 2dVBbeasyQ5XT/5Z0YUq4q9vsZpWKlCFU+rpJER7IDdaJ3oQ06/Z0GOxkSjQdYjw NLYxa66m3El5tFIOGK4lIL93ja1c1bsSygNPU4781GdgbgbNaosPp2KSjP0ihmWt 2TeEURwbwVHk291tQcyyR+1QwP+VbXRxpFeN3wRw7XjlI6ZiOy5ZntQuRQpsDis= =Q8dC -END PGP SIGNATURE-
Re: [MN10300] Use match_test rather than eq/ne symbol_ref
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/13/11 11:59, Richard Sandiford wrote: > As per the subject. Tested by making sure that there were no new > warnings building mn10300-elf, and that there were no changes in > the assembly output for the C and C++ testsuite. OK to install? > > Richard > > > gcc/ * config/mn10300/mn10300.md: Use match_test rather than eq/ne > symbol_ref throughout file. OK. jeff -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOb5q+AAoJEBRtltQi2kC7J/oIALlSwY1QYVM2kC2SF+o06hcb eAQQ2B8gnH/YCOZr5tlMcsXi5/0bwMnEet5EZUBKzUGIN3BQSLiyOXA8pQnXTVOz kOZwnRh4p1NcxzOQXJSgn+6lkJ52lCCWU9DB4fbTTDu/UXQGLW0L4l7bCgy0pBOr KswfEndyIdA2sUyArYtRqBMP0BQfPstZFWG6R5rpm3Pv2VjEmUru0yCollmwUv6a hBeMEvz4KOk6drrST0NYDY384UM08gExUT4g4MUaEio13fTwey8tLYaiGHefaGWa 2RT5hhbPXdC2Av02Qmojttfrbtk3/adiingmVVPTh47BdQjxf5/1IvB9drtdzwo= =9FGC -END PGP SIGNATURE-
[PPC] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building powerpc-linux-gnu, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/rs6000/rs6000.md: Use match_test rather than eq/ne symbol_ref throughout file. * config/rs6000/constraints.md: Likewise. Index: gcc/config/rs6000/rs6000.md === --- gcc/config/rs6000/rs6000.md 2011-09-13 18:43:39.0 +0100 +++ gcc/config/rs6000/rs6000.md 2011-09-13 19:02:06.0 +0100 @@ -9429,7 +9429,7 @@ (define_insn "*movcc_internal1" (const_string "load") (eq_attr "alternative" "12") (const_string "store") - (ne (symbol_ref "TARGET_MFCRF") (const_int 0)) + (match_test "TARGET_MFCRF") (const_string "mfcrf") ] (const_string "mfcr"))) @@ -10323,7 +10323,7 @@ (define_insn "*movti_string" } }" [(set_attr "type" "store_ux,store_ux,*,load_ux,load_ux,*") - (set (attr "cell_micro") (if_then_else (eq (symbol_ref "TARGET_STRING") (const_int 1)) + (set (attr "cell_micro") (if_then_else (match_test "TARGET_STRING") (const_string "always") (const_string "conditional")))]) @@ -13449,7 +13449,7 @@ (define_insn "" "" "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1" [(set (attr "type") - (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0)) + (cond [(match_test "TARGET_MFCRF") (const_string "mfcrf") ] (const_string "mfcr"))) @@ -13481,7 +13481,7 @@ (define_insn "" "TARGET_POWERPC64" "mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%J1,1" [(set (attr "type") - (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0)) + (cond [(match_test "TARGET_MFCRF") (const_string "mfcrf") ] (const_string "mfcr"))) @@ -13542,7 +13542,7 @@ (define_insn "" return \"mfcr %0%Q2\;{rlinm|rlwinm} %0,%0,%4,%5,%5\"; }" [(set (attr "type") - (cond [(ne (symbol_ref "TARGET_MFCRF") (const_int 0)) + (cond [(match_test "TARGET_MFCRF") (const_string "mfcrf") ] (const_string "mfcr"))) Index: gcc/config/rs6000/constraints.md === --- gcc/config/rs6000/constraints.md2011-09-13 18:43:39.0 +0100 +++ gcc/config/rs6000/constraints.md2011-09-13 19:02:06.0 +0100 @@ -198,4 +198,4 @@ (define_constraint "W" (define_constraint "j" "Zero vector constant" - (match_test "(op == const0_rtx || op == CONST0_RTX (GET_MODE (op)))")) + (match_test "op == const0_rtx || op == CONST0_RTX (GET_MODE (op))"))
[S390] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building s390-linux-gnu, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/s390/s390.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/s390/s390.md === --- gcc/config/s390/s390.md 2011-09-13 18:43:39.0 +0100 +++ gcc/config/s390/s390.md 2011-09-13 19:02:44.0 +0100 @@ -283,31 +283,31 @@ (define_attr "enabled" "" (const_int 1) (and (eq_attr "cpu_facility" "ieee") - (ne (symbol_ref "TARGET_CPU_IEEE_FLOAT") (const_int 0))) + (match_test "TARGET_CPU_IEEE_FLOAT")) (const_int 1) (and (eq_attr "cpu_facility" "zarch") - (ne (symbol_ref "TARGET_ZARCH") (const_int 0))) + (match_test "TARGET_ZARCH")) (const_int 1) (and (eq_attr "cpu_facility" "longdisp") - (ne (symbol_ref "TARGET_LONG_DISPLACEMENT") (const_int 0))) + (match_test "TARGET_LONG_DISPLACEMENT")) (const_int 1) (and (eq_attr "cpu_facility" "extimm") - (ne (symbol_ref "TARGET_EXTIMM") (const_int 0))) + (match_test "TARGET_EXTIMM")) (const_int 1) (and (eq_attr "cpu_facility" "dfp") - (ne (symbol_ref "TARGET_DFP") (const_int 0))) + (match_test "TARGET_DFP")) (const_int 1) (and (eq_attr "cpu_facility" "z10") - (ne (symbol_ref "TARGET_Z10") (const_int 0))) + (match_test "TARGET_Z10")) (const_int 1) (and (eq_attr "cpu_facility" "z196") - (ne (symbol_ref "TARGET_Z196") (const_int 0))) + (match_test "TARGET_Z196")) (const_int 1)] (const_int 0))) @@ -7726,7 +7726,7 @@ (define_insn "*cjump_31" [(set_attr "op_type" "RI") (set_attr "type""branch") (set (attr "length") -(if_then_else (eq (symbol_ref "flag_pic") (const_int 0)) +(if_then_else (not (match_test "flag_pic")) (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 6)) (const_int 4) (const_int 6)) (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 6)) @@ -7789,7 +7789,7 @@ (define_insn "*icjump_31" [(set_attr "op_type" "RI") (set_attr "type""branch") (set (attr "length") -(if_then_else (eq (symbol_ref "flag_pic") (const_int 0)) +(if_then_else (not (match_test "flag_pic")) (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 6)) (const_int 4) (const_int 6)) (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 6)) @@ -8170,7 +8170,7 @@ (define_insn_and_split "doloop_si31" (set_attr "z10prop" "z10_super_E1") (set_attr "type" "branch") (set (attr "length") -(if_then_else (eq (symbol_ref "flag_pic") (const_int 0)) +(if_then_else (not (match_test "flag_pic")) (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 6)) (const_int 4) (const_int 6)) (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 6)) @@ -8282,7 +8282,7 @@ (define_insn "*jump31" [(set_attr "op_type" "RI") (set_attr "type" "branch") (set (attr "length") -(if_then_else (eq (symbol_ref "flag_pic") (const_int 0)) +(if_then_else (not (match_test "flag_pic")) (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 6)) (const_int 4) (const_int 6)) (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 6)) @@ -9102,7 +9102,7 @@ (define_insn "main_pool" gcc_unreachable (); } [(set (attr "type") -(if_then_else (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0)) +(if_then_else (match_test "TARGET_CPU_ZARCH") (const_string "larl") (const_string "la")))]) (define_insn "reload_base_31"
Re: [ARM] Use match_test rather than eq/ne symbol_ref
On 13 Sep 2011, at 18:48, "Richard Sandiford" wrote: > As per the subject. Tested by making sure that there were no new > warnings building arm-linux-gnueabi, and that there were no changes > in the assembly output for the C and C++ testsuite. OK to install? > > Richard > > > gcc/ >* config/arm/arm.md: Use match_test rather than eq/ne symbol_ref >throughout file. >* config/arm/neon.md: Likewise. >* config/arm/vfp.md: Likewise. >* config/arm/thumb2.md: Likewise. >* config/arm/cortex-m4.md: Likewise. > Ok. R.
Re: [HPPA] Use match_test rather than eq/ne symbol_ref
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/13/11 12:01, Richard Sandiford wrote: > As per the subject. Tested by making sure that there were no new > warnings building hppa64-hp-hpux11.23, and that there were no > changes in the assembly output for the C and C++ testsuite. OK to > install? > > Richard > > > gcc/ * config/pa/pa.md: Use match_test rather than eq/ne > symbol_ref throughout file. OK. Though I wonder if we could kill TARGET_PORTABLE_RUNTIME which would simplify some of this stuff. I guess the pa-linux folks probably use this stuff :( jeff -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOb5tGAAoJEBRtltQi2kC7R2MH/09N4lIgbp9+nOcqX17Z7ZY0 YhPzvXxcEQLNabinKdT8EZ0saZfZNOsV+ZrbNt+EN8we1InRE6F4GDcgRVAP71vw jJSY19XBypmEEQAyNJ0fVAdUySOuBJyXbCC7SSD1zcsWuS0w1HDSc8AumLWbwOuU n5Oiv+EjGy1vB09mx2sCuDN0LucApAsgGFuO2bxWGGpZLvrdQWIF6mCh0Pvy+pD9 mlEcjr+3P8gXkbGosfxG4oM9n24Wynv6r+PJvRekgOhRcSCFfY3NMowHe+F8jvBo +aoKyix068rOY1tMjiGEpoG8S15rup9nkpHRQIZZnXWCWdB4k8QhJ3oe3vJ6Dy8= =9LX5 -END PGP SIGNATURE-
[SH] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building sh-linux-gnu, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/sh/sh.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/sh/sh.md === --- gcc/config/sh/sh.md 2011-09-13 18:43:39.0 +0100 +++ gcc/config/sh/sh.md 2011-09-13 19:04:01.0 +0100 @@ -346,11 +346,11 @@ (define_attr "fp_set" "single,double,unk ;; ??? This looks ugly because genattrtab won't allow if_then_else or cond ;; inside an le. (define_attr "short_cbranch_p" "no,yes" - (cond [(ne (symbol_ref "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_int 0)) + (cond [(match_test "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_string "no") (leu (plus (minus (match_dup 0) (pc)) (const_int 252)) (const_int 506)) (const_string "yes") -(ne (symbol_ref "NEXT_INSN (PREV_INSN (insn)) != insn") (const_int 0)) +(match_test "NEXT_INSN (PREV_INSN (insn)) != insn") (const_string "no") (leu (plus (minus (match_dup 0) (pc)) (const_int 252)) (const_int 508)) (const_string "yes") @@ -360,7 +360,7 @@ (define_attr "med_branch_p" "no,yes" (cond [(leu (plus (minus (match_dup 0) (pc)) (const_int 990)) (const_int 1988)) (const_string "yes") -(ne (symbol_ref "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_int 0)) +(match_test "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_string "no") (leu (plus (minus (match_dup 0) (pc)) (const_int 4092)) (const_int 8186)) @@ -371,7 +371,7 @@ (define_attr "med_cbranch_p" "no,yes" (cond [(leu (plus (minus (match_dup 0) (pc)) (const_int 988)) (const_int 1986)) (const_string "yes") -(ne (symbol_ref "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_int 0)) +(match_test "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_string "no") (leu (plus (minus (match_dup 0) (pc)) (const_int 4090)) (const_int 8184)) @@ -379,12 +379,12 @@ (define_attr "med_cbranch_p" "no,yes" ] (const_string "no"))) (define_attr "braf_branch_p" "no,yes" - (cond [(ne (symbol_ref "! TARGET_SH2") (const_int 0)) + (cond [(match_test "! TARGET_SH2") (const_string "no") (leu (plus (minus (match_dup 0) (pc)) (const_int 10330)) (const_int 20660)) (const_string "yes") -(ne (symbol_ref "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_int 0)) +(match_test "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_string "no") (leu (plus (minus (match_dup 0) (pc)) (const_int 32764)) (const_int 65530)) @@ -392,12 +392,12 @@ (define_attr "braf_branch_p" "no,yes" ] (const_string "no"))) (define_attr "braf_cbranch_p" "no,yes" - (cond [(ne (symbol_ref "! TARGET_SH2") (const_int 0)) + (cond [(match_test "! TARGET_SH2") (const_string "no") (leu (plus (minus (match_dup 0) (pc)) (const_int 10328)) (const_int 20658)) (const_string "yes") -(ne (symbol_ref "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_int 0)) +(match_test "mdep_reorg_phase <= SH_FIXUP_PCLOAD") (const_string "no") (leu (plus (minus (match_dup 0) (pc)) (const_int 32762)) (const_int 65528)) @@ -426,39 +426,36 @@ (define_attr "length" "" ;; ??? using pc is not computed transitively. (ne (match_dup 0) (match_dup 0)) (const_int 14) - (ne (symbol_ref ("flag_pic")) (const_int 0)) + (match_test "flag_pic") (const_int 24) ] (const_int 16)) (eq_attr "type" "jump") (cond [(eq_attr "med_branch_p" "yes") (const_int 2) - (and (ne (symbol_ref "prev_nonnote_insn (insn)") -(const_int 0)) -(and (eq (symbol_ref "GET_CODE (prev_nonnote_insn (insn))") - (symbol_ref "INSN")) - (eq (symbol_ref "INSN_CODE (prev_nonnote_insn (insn))") - (symbol_ref "code_for_indirect_jump_scratch" + (and (match_test "prev_nonnote_insn (insn)") +(and (eq (symbol_ref "GET_CODE (prev_nonnote_insn (insn))") (symbol_ref "INSN")) + (eq (symbol_ref "INSN_CODE (prev_nonnote_insn (insn))") (symbol_ref "code_for_indirect_jump_scratch" (cond [(eq_attr "braf_branch_p" "yes") (const_int 6) - (eq (symbol_ref "flag_pic") (const_int 0)) + (not (match_test "flag_pic")) (const_int 10) - (ne (symbol_ref "TARGET_
[SPARC] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building sparc-linux-gnu, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/sparc/sparc.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/sparc/sparc.md === --- gcc/config/sparc/sparc.md 2011-09-13 18:43:39.0 +0100 +++ gcc/config/sparc/sparc.md 2011-09-13 19:05:10.0 +0100 @@ -218,10 +218,10 @@ (define_attr "length" "" (eq_attr "branch_type" "fcc") (if_then_else (match_operand 0 "fcc0_register_operand" "") (if_then_else (eq_attr "empty_delay_slot" "true") - (if_then_else (eq (symbol_ref "TARGET_V9") (const_int 0)) + (if_then_else (not (match_test "TARGET_V9")) (const_int 3) (const_int 2)) - (if_then_else (eq (symbol_ref "TARGET_V9") (const_int 0)) + (if_then_else (not (match_test "TARGET_V9")) (const_int 2) (const_int 1))) (if_then_else (lt (pc) (match_dup 2))
[V850] Use match_test rather than eq/ne symbol_ref
As per the subject. Tested by making sure that there were no new warnings building v850-elf, and that there were no changes in the assembly output for the C and C++ testsuite. OK to install? Richard gcc/ * config/v850/v850.md: Use match_test rather than eq/ne symbol_ref throughout file. Index: gcc/config/v850/v850.md === --- gcc/config/v850/v850.md 2011-09-13 18:43:39.0 +0100 +++ gcc/config/v850/v850.md 2011-09-13 19:06:27.0 +0100 @@ -61,15 +61,15 @@ (define_attr "type" "load,store,bit1,mul (const_string "other")) (define_attr "cpu" "none,v850,v850e,v850e1,v850e2,v850e2v3" - (cond [(ne (symbol_ref "TARGET_V850") (const_int 0)) + (cond [(match_test "TARGET_V850") (const_string "v850") - (ne (symbol_ref "TARGET_V850E") (const_int 0)) + (match_test "TARGET_V850E") (const_string "v850e") - (ne (symbol_ref "TARGET_V850E1") (const_int 0)) + (match_test "TARGET_V850E1") (const_string "v850e1") - (ne (symbol_ref "TARGET_V850E2") (const_int 0)) + (match_test "TARGET_V850E2") (const_string "v850e2") - (ne (symbol_ref "TARGET_V850E2") (const_int 0)) + (match_test "TARGET_V850E2") (const_string "v850e2v3")] (const_string "none"))) @@ -2460,7 +2460,7 @@ (define_insn "save_interrupt" } }" [(set (attr "length") -(if_then_else (ne (symbol_ref "TARGET_LONG_CALLS") (const_int 0)) +(if_then_else (match_test "TARGET_LONG_CALLS") (const_int 10) (const_int 34))) (set_attr "cc" "clobber")]) @@ -2492,7 +2492,7 @@ (define_insn "return_interrupt" } }" [(set (attr "length") -(if_then_else (ne (symbol_ref "TARGET_LONG_CALLS") (const_int 0)) +(if_then_else (match_test "TARGET_LONG_CALLS") (const_int 4) (const_int 24))) (set_attr "cc" "clobber")]) @@ -2586,7 +2586,7 @@ (define_insn "save_all_interrupt" return \"\"; }" [(set (attr "length") -(if_then_else (ne (symbol_ref "TARGET_LONG_CALLS") (const_int 0)) +(if_then_else (match_test "TARGET_LONG_CALLS") (const_int 4) (const_int 62) )) @@ -2685,7 +2685,7 @@ (define_insn "restore_all_interrupt" return \"\"; }" [(set (attr "length") -(if_then_else (ne (symbol_ref "TARGET_LONG_CALLS") (const_int 0)) +(if_then_else (match_test "TARGET_LONG_CALLS") (const_int 4) (const_int 62) ))
Re: [V850] Use match_test rather than eq/ne symbol_ref
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/13/11 12:07, Richard Sandiford wrote: > As per the subject. Tested by making sure that there were no new > warnings building v850-elf, and that there were no changes in the > assembly output for the C and C++ testsuite. OK to install? > > Richard > > > gcc/ * config/v850/v850.md: Use match_test rather than eq/ne > symbol_ref throughout file. OK. jeff -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOb52cAAoJEBRtltQi2kC7ltQH/RpEt6FYhh5SCFpY/AKVrF5n eOENOV8OB7tGF4+2nwgokUF/5bzY3ETLW/LOOD3bNxi6mKTgVUtf5M9NdNzYMHO5 W5quRMSp1cNlgnj/8Yjrp6l4PZlQejz/Tr3HrzHTdTU16Z9rpO4dKTzxDqaj55ih dp9G/nzvrpT9o1zjcpNNt6sN4rlLbmojAPGONRxD2vshQRp0u/9ijZVk4SkNrMn9 Y8BwmvWAM3zpKyoZfPoi4qNWiMRaROz8/cv4uZy0RQMpHWb6xCTWkzdy7/c374kx 8JC3NmpilGGaFcn3wEELJzOQFAJSj4S63Hu2e+62vZhTOK3QJP+iFiHd/Tsy8vE= =q+Gd -END PGP SIGNATURE-
Go patch committed: Fix inherited hidden methods, part 2
Similar to the last patch, this fixes inherited hidden methods with arguments of hidden types. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 4905b2cc2083 go/expressions.cc --- a/go/expressions.cc Tue Sep 13 10:18:45 2011 -0700 +++ b/go/expressions.cc Tue Sep 13 11:21:29 2011 -0700 @@ -9239,7 +9239,13 @@ bool issued_error) { std::string reason; - if (!Type::are_assignable(parameter_type, argument_type, &reason)) + bool ok; + if (this->are_hidden_fields_ok_) +ok = Type::are_assignable_hidden_ok(parameter_type, argument_type, + &reason); + else +ok = Type::are_assignable(parameter_type, argument_type, &reason); + if (!ok) { if (!issued_error) { diff -r 4905b2cc2083 go/expressions.h --- a/go/expressions.h Tue Sep 13 10:18:45 2011 -0700 +++ b/go/expressions.h Tue Sep 13 11:21:29 2011 -0700 @@ -1198,8 +1198,9 @@ source_location location) : Expression(EXPRESSION_CALL, location), fn_(fn), args_(args), type_(NULL), results_(NULL), tree_(NULL), - is_varargs_(is_varargs), varargs_are_lowered_(false), - types_are_determined_(false), is_deferred_(false), issued_error_(false) + is_varargs_(is_varargs), are_hidden_fields_ok_(false), + varargs_are_lowered_(false), types_are_determined_(false), + is_deferred_(false), issued_error_(false) { } // The function to call. @@ -1249,6 +1250,12 @@ set_varargs_are_lowered() { this->varargs_are_lowered_ = true; } + // Note that it is OK for this call to set hidden fields when + // passing arguments. + void + set_hidden_fields_are_ok() + { this->are_hidden_fields_ok_ = true; } + // Whether this call is being deferred. bool is_deferred() const @@ -1350,6 +1357,9 @@ tree tree_; // True if the last argument is a varargs argument (f(a...)). bool is_varargs_; + // True if this statement may pass hidden fields in the arguments. + // This is used for generated method stubs. + bool are_hidden_fields_ok_; // True if varargs have already been lowered. bool varargs_are_lowered_; // True if types have been determined. diff -r 4905b2cc2083 go/statements.h --- a/go/statements.h Tue Sep 13 10:18:45 2011 -0700 +++ b/go/statements.h Tue Sep 13 11:21:29 2011 -0700 @@ -490,8 +490,7 @@ Type* type() const; - // Note that it is OK for this return statement to set hidden - // fields. + // Note that it is OK for this statement to set hidden fields. void set_hidden_fields_are_ok() { this->are_hidden_fields_ok_ = true; } @@ -533,8 +532,8 @@ Expression* init_; // The backend representation of the temporary variable. Bvariable* bvariable_; - // True if this statement may pass hidden fields in the return - // value. This is used for generated method stubs. + // True if this statement may set hidden fields when assigning the + // value to the temporary. This is used for generated method stubs. bool are_hidden_fields_ok_; // True if something takes the address of this temporary variable. bool is_address_taken_; diff -r 4905b2cc2083 go/types.cc --- a/go/types.cc Tue Sep 13 10:18:45 2011 -0700 +++ b/go/types.cc Tue Sep 13 11:21:29 2011 -0700 @@ -7401,6 +7401,7 @@ go_assert(func != NULL); Call_expression* call = Expression::make_call(func, arguments, is_varargs, location); + call->set_hidden_fields_are_ok(); size_t count = call->result_count(); if (count == 0) gogo->add_statement(Statement::make_statement(call));
Re: [HPPA] Use match_test rather than eq/ne symbol_ref
On 9/13/2011 2:04 PM, Jeff Law wrote: Though I wonder if we could kill TARGET_PORTABLE_RUNTIME which would simplify some of this stuff. I guess the pa-linux folks probably use this stuff:( I don't think it is used much if at all. There were a couple of parisc portables (tadpole?) that had somewhat crippled processors. The main linux interest is for servers and the last generation of workstations. Dave -- John David Anglindave.ang...@bell.net
Re: [SPARC] Use match_test rather than eq/ne symbol_ref
From: Richard Sandiford Date: Tue, 13 Sep 2011 19:06:20 +0100 > As per the subject. Tested by making sure that there were no new > warnings building sparc-linux-gnu, and that there were no changes > in the assembly output for the C and C++ testsuite. OK to install? > > Richard > > > gcc/ > * config/sparc/sparc.md: Use match_test rather than eq/ne symbol_ref > throughout file. Looks good to me.
[pph] Add pph_writer_enabled_p (issue5003044)
A small tweak to clarify what we mean when the code reads 'if (pph_out_file)'. For the next patch I'm writing, I'm using this, so I'm flushing it first. Tested on x86_64. Applied. Diego. c-family/ChangeLog.pph * c-opts.c (pph_reader_enabled_p): Rename from query_have_pph_map. Update all users. cp/ChangeLog.pph * Make-lang.in (cp/parser.o): Add dependency on CXX_PPH_STREAMER_H. * parser.c: Include pph-streamer.h * decl.c (cp_rest_of_decl_compilation): Call pph_writer_enabled_p. * pph-streamer-in.c (pph_read_file_1): Likewise. * semantics.c (expand_or_defer_fn_1): Likewise. * pph-streamer.h (pph_writer_enabled_p): New. (pph_enabled_p): Move from pph.h. * pph.c (pph_init): Call pph_writer_enabled_p. * pph.h: Move to pph-streamer.h. diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 6f4dc1c..56dada4 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -584,10 +584,10 @@ extern const char *pch_file; extern const char *pph_out_file; -/* Query if we have any map from INCLUDE to PPH file. */ +/* Return true if we have any map from INCLUDE to PPH file. */ extern bool -query_have_pph_map (void); +pph_reader_enabled_p (void); /* Query for a mapping from an INCLUDE to a PPH file. Return the filename, without ownership. diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 3ee5860..6b63bda 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -129,13 +129,13 @@ static void c_finish_options (void); #endif /* Mappings from include directive to PPH file. */ +static strstrmap_t *include_pph_mapping; -strstrmap_t *include_pph_mapping; -/* Query if we have any map from INCLUDE to PPH file. */ +/* Return true if we have any map from INCLUDE to PPH file. */ bool -query_have_pph_map (void) +pph_reader_enabled_p (void) { return include_pph_mapping != NULL; } diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index a83d5a2..fe2b87e 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -342,7 +342,7 @@ cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) $(REAL_H) \ cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_CORE_H) \ gt-cp-parser.h output.h $(TARGET_H) $(PLUGIN_H) intl.h \ c-family/c-objc.h tree-pretty-print.h $(CXX_PARSER_H) $(TIMEVAR.H) \ - $(CXX_PPH_H) + $(CXX_PPH_H) $(CXX_PPH_STREAMER_H) cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) $(C_COMMON_H) \ $(TM_H) coretypes.h pointer-set.h tree-iterator.h $(SPLAY_TREE_H) cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e10eb88..cd3d0aa 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5906,7 +5906,7 @@ cp_rest_of_decl_compilation (tree decl, int top_level, int at_end) rest_of_decl_compilation (decl, top_level, at_end); /* If we are generating a PPH image, add DECL to its symbol table. */ - if (pph_out_file) + if (pph_writer_enabled_p ()) pph_add_decl_to_symtab (decl, PPH_SYMTAB_DECLARE, top_level, at_end); } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 7253df6..3d476d6 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see #include "timevar.h" #include "cpplib.h" #include "pph.h" +#include "pph-streamer.h" #include "tree.h" #include "cp-tree.h" #include "intl.h" diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c index ea44460..f8238bf 100644 --- a/gcc/cp/pph-streamer-in.c +++ b/gcc/cp/pph-streamer-in.c @@ -1669,7 +1669,7 @@ pph_read_file_1 (pph_stream *stream) /* If we are generating an image, the PPH contents we just read from STREAM will need to be read again the next time we want to read the image we are now generating. */ - if (pph_out_file && !pph_reading_includes) + if (pph_writer_enabled_p () && !pph_reading_includes) pph_add_include (stream); } diff --git a/gcc/cp/pph-streamer.h b/gcc/cp/pph-streamer.h index 7f98764..ce2f379 100644 --- a/gcc/cp/pph-streamer.h +++ b/gcc/cp/pph-streamer.h @@ -281,6 +281,21 @@ extern void pph_in_spec_entry_tables (pph_stream *stream); /* Inline functions. */ +/* Return true if we are generating a PPH image. */ +static inline bool +pph_writer_enabled_p (void) +{ + return pph_out_file != NULL; +} + +/* Return true if PPH has been enabled. */ +static inline bool +pph_enabled_p (void) +{ + return pph_writer_enabled_p () || pph_reader_enabled_p (); +} + + /* Output array A of cardinality C of ASTs to STREAM. */ /* FIXME pph: hold for alternate routine. */ #if 0 diff --git a/gcc/cp/pph.c b/gcc/cp/pph.c index cbd9c24..24744bb 100644 --- a/gcc/cp/pph.c +++ b/gcc/cp/pph.c @@ -186,7 +186,7 @@ pph_init (void) gcc_assert (table == NULL); /* If we are generating a PPH file, initialize the writer. */ - if (pph_out_file != NULL) + if (pph_writer_enabled_p ()) pph_writer_init (); pph_i
Re: [PATCH] check_cfg assert fix
On 9/09/2011, at 6:54 AM, Bernd Schmidt wrote: > On 09/06/11 23:56, Maxim Kuvyrkov wrote: >> I agree. I would rather remove the entirety of haifa-sched.c: >> check_cfg(); scheduler is not the right place for checking >> consistency of CFG. Check_cfg() was useful for debugging scheduler >> patches, but now it is more of maintainance overhead. >> >> Do I have a second vote for removal of check_cfg()? > > I'd be OK with that. Saves me some time adapting it to some scheduler > patches I'll be submitting soon... OK then, attached is the trivial patch that removes haifa-sched.c:check_cfg(). Please let me know if you have strong feelings towards keeping check_cfg(). Tested on x86_64-linux-gnu. Absent any requests to the contrary, I will check in this patch in 2 days. Thank you, -- Maxim Kuvyrkov CodeSourcery / Mentor Graphics fsf-gcc-check-cfg.ChangeLog Description: Binary data fsf-gcc-check-cfg.patch Description: Binary data
Re: [BFIN] Use match_test rather than eq/ne symbol_ref
On 09/13/11 19:49, Richard Sandiford wrote: > As per the subject. Tested by making sure that there were no new > warnings building bfin-elf, and that there were no changes in the > assembly output for the C and C++ testsuite. OK to install? Sure! Bernd
Add new script for validating test results (issue5023041)
This script is the result of the discussion I started last week about having the ability to ignore testsuite failures (http://gcc.gnu.org/ml/gcc/2011-09/msg00044.html). The script is contrib/testsuite-management/validate_failures.py. It is meant to be executed from the top build directory. When executed it will: 1- Determine the target built: TARGET 2- Determine the source directory: SRCDIR 3- Look for a failure manifest file in /contrib/testsuite-management/.xfail 4- Collect all the .sum files from the build tree. 5- Produce a report stating: a- Failures expected in the manifest but not present in the build. b- Failures in the build not expected in the manifest. 6- If all the build failures are expected in the manifest, it exits with exit code 0. Otherwise, it exits with error code 1. Manifests can be generated with the --manifest option. Tests can be marked 'flaky' to be completely ignored. I will also add an expiration date to allow having time-limited failures. The intent of the script is to be used by development and release branches. It provides a central control mechanism to ignore known failures. It does not replace DejaGNU's markers. I committed the script to trunk. I expect to tweak it a little bit over the next few days. Diego. * testsuite-management: New. * testsuite-management/validate_failures.py: New. diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py new file mode 100755 index 000..be2ffce --- /dev/null +++ b/contrib/testsuite-management/validate_failures.py @@ -0,0 +1,337 @@ +#!/usr/bin/python + +# Script to compare testsuite failures against a list of known-to-fail +# tests. + +# Contributed by Diego Novillo +# +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +"""This script provides a coarser XFAILing mechanism that requires no +detailed DejaGNU markings. This is useful in a variety of scenarios: + +- Development branches with many known failures waiting to be fixed. +- Release branches with known failures that are not considered + important for the particular release criteria used in that branch. + +The script must be executed from the toplevel build directory. When +executed it will: + +1- Determine the target built: TARGET +2- Determine the source directory: SRCDIR +3- Look for a failure manifest file in + /contrib/testsuite-management/.xfail +4- Collect all the .sum files from the build tree. +5- Produce a report stating: + a- Failures expected in the manifest but not present in the build. + b- Failures in the build not expected in the manifest. +6- If all the build failures are expected in the manifest, it exits + with exit code 0. Otherwise, it exits with error code 1. +""" + +import optparse +import os +import re +import sys + +# Handled test results. +_VALID_TEST_RESULTS = [ 'FAIL', 'UNRESOLVED', 'XPASS', 'ERROR' ] + +# Pattern for naming manifest files. The first argument should be +# the toplevel GCC source directory. The second argument is the +# target triple used during the build. +_MANIFEST_PATH_PATTERN = '%s/contrib/testsuite-management/%s.xfail' + +def Error(msg): + print >>sys.stderr, '\nerror: %s' % msg + sys.exit(1) + + +class TestResult(object): + """Describes a single DejaGNU test result as emitted in .sum files. + + We are only interested in representing unsuccessful tests. So, only + a subset of all the tests are loaded. + + The summary line used to build the test result should have this format: + + attrlist | XPASS: gcc.dg/unroll_1.c (test for excess errors) + ^ ^ + optional state name description + attributes + + Attributes: +attrlist: A comma separated list of attributes. + Valid values: +flakyIndicates that this test may not always fail. These + tests are reported, but their presence does not affect + the results. + +expire=MMDD After this date, this test will produce an error + whether it is in the manifest or not. + +state: One of UNRESOLVED, XPASS or FAIL. +name: File name for the test. +description:
Re: PING: [ARM] Model automodified addresses in the Cortex A8 and A9 schedulers -- NEON
On 9 September 2011 13:56, Richard Sandiford wrote: > Ping for this patch: >> This is the NEON part of the patch to handle address register writeback >> in the Cortex A8 and A9 schedulers. Although I can find no documentation >> to say exactly how this is handled by the pipelines, a latency of 1 >> does seem to work well in practice, and is much easier to implement. It sounds like this is good enough in practice. > > http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01488.html > > which models address register writeback in the Cortex A8 and A9 NEON > schedulers. (Ramana has already approved the core equivalent, thanks.) I do have a one nit on the ml bit though I must say I'm not an ML expert which is why I resisted for a while. The one comment that I have and I should have realized earlier was that the file had been parameterized by the core in quite a few places and I would like to still retain that capability. This look better ? I have retained your original logic and only parameterized wblatency on the core . Thoughts ? Can someone else also give the ML bits a once-over ? It appears to generate identical descriptions to yours. cheers Ramana gcc/ * config/arm/neon-schedgen.ml (guard): Add Guard_writeback and Guard_writeback_only. (writebackLatency): New function. (collate_bypasses): Split hashtable insertion into a separate function. Add address writeback dependencies for load-store instructions. Use writebackLatency. Sort bypasses in order of decreasing latency. (guard_fn): Handle Guard_writeback and Guard_writeback_only. * config/arm/cortex-a8-neon.md: Regenerated. * config/arm/cortex-a9-neon.md: Likewise. p2 Description: Binary data
Go patch committed: Always dereference receiver in value method
The Go frontend was carefully checking for a nil receiver in a value method, and setting the value to zero in that case. This is wrong: a nil receiver passed to a value method should crash. This patch fixes this, by simply removing the unnecessary generated code. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 1f4ec4d512ee go/gogo-tree.cc --- a/go/gogo-tree.cc Tue Sep 13 11:22:31 2011 -0700 +++ b/go/gogo-tree.cc Tue Sep 13 14:30:19 2011 -0700 @@ -1281,16 +1281,7 @@ DECL_ARG_TYPE(parm_decl) = TREE_TYPE(parm_decl); go_assert(DECL_INITIAL(var_decl) == NULL_TREE); - // The receiver might be passed as a null pointer. - tree check = fold_build2_loc(loc, NE_EXPR, boolean_type_node, parm_decl, - fold_convert_loc(loc, TREE_TYPE(parm_decl), - null_pointer_node)); - tree ind = build_fold_indirect_ref_loc(loc, parm_decl); - TREE_THIS_NOTRAP(ind) = 1; - Btype* btype = no->var_value()->type()->get_backend(gogo); - tree zero_init = expr_to_tree(gogo->backend()->zero_expression(btype)); - tree init = fold_build3_loc(loc, COND_EXPR, TREE_TYPE(ind), - check, ind, zero_init); + tree init = build_fold_indirect_ref_loc(loc, parm_decl); if (is_in_heap) { @@ -1301,18 +1292,9 @@ space = fold_convert(build_pointer_type(val_type), space); tree spaceref = build_fold_indirect_ref_loc(no->location(), space); TREE_THIS_NOTRAP(spaceref) = 1; - tree check = fold_build2_loc(loc, NE_EXPR, boolean_type_node, - parm_decl, - fold_convert_loc(loc, TREE_TYPE(parm_decl), - null_pointer_node)); - tree parmref = build_fold_indirect_ref_loc(no->location(), parm_decl); - TREE_THIS_NOTRAP(parmref) = 1; tree set = fold_build2_loc(loc, MODIFY_EXPR, void_type_node, - spaceref, parmref); - init = fold_build2_loc(loc, COMPOUND_EXPR, TREE_TYPE(space), - build3(COND_EXPR, void_type_node, -check, set, NULL_TREE), - space); + spaceref, init); + init = fold_build2_loc(loc, COMPOUND_EXPR, TREE_TYPE(space), set, space); } DECL_INITIAL(var_decl) = init;
[0/4] Modulo scheduling with haifa-sched for C6X
C6X has some rather nifty hardware support for modulo scheduling. Consider the following loop: .L13: ldh .d1t1 *++A5[1], A7 || add .s1 -1, A0, A0 ldh .d2t1 *B5++[1], A8 nop 1 [A0]b .s1 .L13 nop 2 mpy .m1 A8, A7, A9 nop 1 add .d1 A3, A9, A3 ;; condjump to .L13 occurs This takes 9 cycles per iteration. Note that the back branch is not the last insn in the block, it has five cycles worth of delay slots. A fully optimized version of this making use of the loop pipelining hardware looks like this: [ load ILC register some cycles previously ] sploop 1 .L13: ldh .d1t2 *++A5[1], B6 || ldh .d2t1 *B5++[1], A8 nop 4 ;; load to A8 occurs ;; load to B6 occurs mpy .m1xA8, B6, A9 nop 1 ;; multiplication occurs and stores to A9 spkernel7, 0 || add .s1 A3, A9, A3 The loop is contained between the sploop and spkernel instructions (with one instruction executing in parallel with the spkernel). Instructions are copied to a loop buffer and reexecuted from there, based on the initiation interval which is given as an argument to the sploop instruction. In this case, the II is 1, which means we take one cycle per loop iteration (plus prologue/epilogue costs obviously). Once the loop buffer is full, every iteration of the loop executes in one cycle as follows: ldh .d1t2 *++A5[1], B6 || ldh .d2t1 *B5++[1], A8 || mpy .m1xA8, B6, A9 || add .s1 A3, A9, A3 Note the unit reservations: d1, d2, t1, t2, m1, x1, and s1; no unit is reserved twice. The reason this works is because of the machine's exposed pipeline. It's not only branches that have delay slots, but loads and multiplications as well; really every instruction that takes more than a cycle. The result of a load is ready after five cycles, and in the loop above, it is immediately consumed afterwards. No register value has a lifetime of more than one cycle. This, together with the choice of reservations, allows an optimal initiation interval of 1. (The sploop hardware knows how to deal with interrupts. In general, it's not safe to expose delay slots for anything other than branches outside a sploop/spkernel loop.) I have added support for this to haifa-sched.c. I expect the question "why not use SMS" to come up; there were a number of reasons why I felt that code is unsuitable: There are (or were, when I started) some glaring weaknesses in SMS, such as giving up when the loop contains autoincrement addresses (which is the case in the example above), and by the looks of it fairly poor memory disambiguation compared to sched-ebb with cselib. Correctness is also an issue. The ps_has_conflicts function pretends to verify that it generates a valid schedule, but it ignores half the target hooks, which means it would likely produce incorrect code on C6X. We'd also have to duplicate the delayed-shadow pair mechanism which was added to haifa-sched here as well to cope with load/multiply delay slots. Finally, SMS really runs too early: C6X has an exposed pipeline and requires an exact schedule including unit reservations based on register allocation; it won't do to try to use a schedule that was produced before IRA. Using SMS after register allocation seems tricky at least since it wants to create new pseudos, and using a normal haifa-sched pass later to fix up the schedule may "work" on other targets as it produce a valid straight line schedule (however suboptimal for the original goal of modulo scheduling), but it can only fail on C6X. Making haifa-sched usable for modulo scheduling wasn't actually that hard once I realized that I had already added support for fixed delays between insns, for the C6X delay slot support. All we really need is to extend that to have two different possible reasons for a fixed delay. On top of the existing delay shadow mechanism, we can record a stage. For a given II which we're trying, (II * stage) gives the delay between two insns. The target code unrolls the loop to a factor that seems reasonable and calls record_delay_pair for the new insns. Almost everything else is in place, we just need to accept the possibility that it may not be possible to find a valid schedule for a given II. Backtracking is helpful but must be limited to avoid exponential blow-ups; the param I've chosen seems not to affect performance on any of the benchmarks I've tried and solves the (rare in the first place) compile-time problems I ran across. There will be four patches in the series: 1/4: haifa-sched support 2/4: Make schedule_ebb callable from outside the scheduler 3/4: A hw-doloo
[1/4] Modulo scheduling support for haifa-sched
This makes haifa-sched capable of acting like a modulo-scheduler in cooperation with a caller (expected to be in a port's md_reorg). As explained in [0/4], most of the necessary code is already there in form of the delay slot support that was added for C6X. The main new entry point is set_modulo_params, which informs the scheduler of the II and the maximum number of stages for which the caller has unrolled the loop. The caller must then call record_delay_slot_pair to ensure the proper distances between copies of instructions in different loop iterations. Once the scheduler completes a stage and all instructions from the first iteration of the loop have been scheduled, the scheduler goes into the epilogue mode where it only schedules insns which belong to the loop epilogue. Once this has been successful, a valid schedule has been found. On C6X, we'll then just pick the insns from the first loop iteration and discard the rest; the SPLOOP hardware will automatically execute them. Since the scheduler will not necessarily schedule all insns when in this mode, there is a new function resolve_dependencies which just makes sure that all the data structures are in the state expected at the end of schedule_block. This patch is probably best understood together with the C6X parts in 4/4. Bernd * haifa-sched.c (modulo_ii, modulo_max_states, modulo_n_insns, modulo_insns_scheduled, modulo_iter0_max_uid, modulo_backtracks_left, modulo_last_stage): New static variables. (set_modulo_params, discard_delay_pairs_above): New functions. (struct delay_pair): New member stages. (htab_i2_traverse, htab_i1_traverse): New static functions. (record_delay_slot_pair): New arg stages. All callers changed. Record it. (pair_delay): Take stages into account. (add_delay_dependencies): Don't do so for stage pairs. (struct sched_block_state): New member modulo_epilogue. (save_backtrack_point): Don't set SHADOW_P for stage pairs. (unschedule_insns_until): Decrease modulo_insns_scheduled. Set HARD_DEP without using or. (resolve_dependencies): New static function. (prune_ready_list): New arg modulo_epilogue_p. All callers changed. If it is true, allow only insns with INSN_EXACT_TICK set. (schedule_block): Return bool, always true for normal scheduling, true or false depending on modulo scheduling success otherwise. Add bookkeeping for modulo scheduling, and call resolve_dependencies on everything left over after a modulo schedule. (haifa_sched_init): Remove check_cfg call. Clear modulo_ii. * sched-int.h (schedule_block, record_delay_slot_pair): Adjust declarations. (set_modulo_params, discard_delay_pairs_above): Declare. * params.def (PARAM_MAX_MODULO_BACKTRACK_ATTEMPS): New. * doc/invoke.texi (--param): Document it. Index: doc/invoke.texi === --- doc/invoke.texi (revision 178779) +++ doc/invoke.texi (working copy) @@ -8450,6 +8450,11 @@ before flushing the current state and st with few branches or calls can create excessively large lists which needlessly consume memory and resources. +@item max-modulo-backtrack-attempts +The maximum number of backtrack attempts the scheduler should make +when modulo scheduling a loop. Larger values can exponentially increase +compile time. + @item max-inline-insns-single Several parameters control the tree inliner used in gcc. This number sets the maximum number of instructions (counted in GCC's Index: haifa-sched.c === --- haifa-sched.c (revision 178779) +++ haifa-sched.c (working copy) @@ -163,6 +163,31 @@ int issue_rate; enable a DCE pass. */ bool sched_no_dce; +/* The current initiation interval used when modulo scheduling. */ +static int modulo_ii; + +/* The maximum number of stages we are prepared to handle. */ +static int modulo_max_stages; + +/* The number of insns that exist in each iteration of the loop. We use this + to detect when we've scheduled all insns from the first iteration. */ +static int modulo_n_insns; + +/* The current count of insns in the first iteration of the loop that have + already been scheduled. */ +static int modulo_insns_scheduled; + +/* The maximum uid of insns from the first iteration of the loop. */ +static int modulo_iter0_max_uid; + +/* The number of times we should attempt to backtrack when modulo scheduling. + Decreased each time we have to backtrack. */ +static int modulo_backtracks_left; + +/* The stage in which the last insn from the original loop was + scheduled. */ +static int modulo_last_stage; + /* sched-verbose controls the amount of debugging output the scheduler prints. It is controlled by -fsched-verbose=N: N>0 and no -DSR : the output is directed to s
[2/4] Make schedule_ebb callable from elsewhere
This is just some code rearrangement to make it possible for c6x.c to call schedule_ebbs_init, schedule_ebb and schedule_ebbs_finish. Bernd * sched-ebb.c (schedule_ebb): No longer static. Remove declaration. New arg modulo_scheduling. All callers changed. Move note handling code here from schedule_ebbs. (schedule_ebbs_finish, schedule_ebbs_init): New functions, broken out of schedule_ebbs. (schedule_ebbs): Call them. Remove note handling code moved to schedule_ebb. * sched-int.h (schedule_ebb, schedule_ebbs_init, schedule_ebbs_finish): Declare. Index: sched-ebb.c === --- sched-ebb.c (revision 178779) +++ sched-ebb.c (working copy) @@ -66,7 +66,6 @@ static int rank (rtx, rtx); static int ebb_contributes_to_priority (rtx, rtx); static basic_block earliest_block_with_similiar_load (basic_block, rtx); static void add_deps_for_risky_insns (rtx, rtx); -static basic_block schedule_ebb (rtx, rtx); static void debug_ebb_dependencies (rtx, rtx); static void ebb_add_remove_insn (rtx, int); @@ -476,14 +475,35 @@ add_deps_for_risky_insns (rtx head, rtx } } -/* Schedule a single extended basic block, defined by the boundaries HEAD - and TAIL. */ +/* Schedule a single extended basic block, defined by the boundaries + HEAD and TAIL. -static basic_block -schedule_ebb (rtx head, rtx tail) + We change our expectations about scheduler behaviour depending on + whether MODULO_SCHEDULING is true. If it is, we expect that the + caller has already called set_modulo_params and created delay pairs + as appropriate. If the modulo schedule failed, we return + NULL_RTX. */ + +basic_block +schedule_ebb (rtx head, rtx tail, bool modulo_scheduling) { basic_block first_bb, target_bb; struct deps_desc tmp_deps; + bool success; + + /* Blah. We should fix the rest of the code not to get confused by + a note or two. */ + while (head != tail) +{ + if (NOTE_P (head) || DEBUG_INSN_P (head)) + head = NEXT_INSN (head); + else if (NOTE_P (tail) || DEBUG_INSN_P (tail)) + tail = PREV_INSN (tail); + else if (LABEL_P (head)) + head = NEXT_INSN (head); + else + break; +} first_bb = BLOCK_FOR_INSN (head); last_bb = BLOCK_FOR_INSN (tail); @@ -530,7 +550,9 @@ schedule_ebb (rtx head, rtx tail) /* Make ready list big enough to hold all the instructions from the ebb. */ sched_extend_ready_list (rgn_n_insns); - schedule_block (&target_bb); + success = schedule_block (&target_bb); + gcc_assert (success || modulo_scheduling); + /* Free ready list. */ sched_finish_ready_list (); @@ -538,7 +560,7 @@ schedule_ebb (rtx head, rtx tail) so we may made some of them empty. Can't assert (b == last_bb). */ /* Sanity check: verify that all region insns were scheduled. */ - gcc_assert (sched_rgn_n_insns == rgn_n_insns); + gcc_assert (modulo_scheduling || sched_rgn_n_insns == rgn_n_insns); /* Free dependencies. */ sched_free_deps (current_sched_info->head, current_sched_info->tail, true); @@ -555,29 +577,14 @@ schedule_ebb (rtx head, rtx tail) delete_basic_block (last_bb->next_bb); } - return last_bb; + return success ? last_bb : NULL; } -/* The one entry point in this file. */ - +/* Perform initializations before running schedule_ebbs or a single + schedule_ebb. */ void -schedule_ebbs (void) +schedule_ebbs_init (void) { - basic_block bb; - int probability_cutoff; - rtx tail; - - if (profile_info && flag_branch_probabilities) -probability_cutoff = PARAM_VALUE (TRACER_MIN_BRANCH_PROBABILITY_FEEDBACK); - else -probability_cutoff = PARAM_VALUE (TRACER_MIN_BRANCH_PROBABILITY); - probability_cutoff = REG_BR_PROB_BASE / 100 * probability_cutoff; - - /* Taking care of this degenerate case makes the rest of - this code simpler. */ - if (n_basic_blocks == NUM_FIXED_BLOCKS) -return; - /* Setup infos. */ { memcpy (&ebb_common_sched_info, &haifa_common_sched_info, @@ -599,6 +606,43 @@ schedule_ebbs (void) /* Initialize DONT_CALC_DEPS and ebb-{start, end} markers. */ bitmap_initialize (&dont_calc_deps, 0); bitmap_clear (&dont_calc_deps); +} + +/* Perform cleanups after scheduling using schedules_ebbs or schedule_ebb. */ +void +schedule_ebbs_finish (void) +{ + bitmap_clear (&dont_calc_deps); + + /* Reposition the prologue and epilogue notes in case we moved the + prologue/epilogue insns. */ + if (reload_completed) +reposition_prologue_and_epilogue_notes (); + + haifa_sched_finish (); +} + +/* The one entry point in this file. */ + +void +schedule_ebbs (void) +{ + basic_block bb; + int probability_cutoff; + rtx tail; + + /* Taking care of this degenerate case makes the rest of + this code simpler. */ + if (n_basic_blocks == NUM_FIXED_BLOCKS) +return; + + if (profile_info && flag_branch_probabili
[3/4] Fix debug_insn problem in hw-doloop
This fixes an oversight that led to a compare-debug failure in the testsuite with the other changes applied. We really don't care if a DEBUG_INSN uses the iteration register or not. Will commit soon as obvious. Bernd * hw-doloop.c (scan_loop): Compute register usage only for non-debug insns. Index: hw-doloop.c === --- hw-doloop.c (revision 178779) +++ hw-doloop.c (working copy) @@ -123,7 +123,7 @@ scan_loop (hwloop_info loop) df_ref *def_rec; HARD_REG_SET set_this_insn; - if (!INSN_P (insn)) + if (!NONDEBUG_INSN_P (insn)) continue; if (recog_memoized (insn) < 0
[PRs 34547/50375] Fixes to NULL with MOLD= check
NULL requires a MOLD argument if the mold cannot be determined from the context: a) print *, null() - was ICEing b) call foo(null()) - [implicit interface] was accepted but no dummy is available to get the type c) call generic(null()) - need to reject it, if it would match several specific functions d) null(allocatable) - now allowed (F2003), was rejected before. (c) is PR 50375, the rest is PR 34547; see PR for the quote from the standards. Build and regtested on x86-64-linux. OK for the trunk? Tobias 2011-09-14 Tobias Burnus PR fortran/34547 PR fortran/50375 * check.c (gfc_check_null): Allow allocatables as MOLD to NULL. * resolve.c (resolve_transfer): Reject NULL without MOLD. * interface.c (gfc_procedure_use): Reject NULL without MOLD if no explicit interface is known. (gfc_search_interface): Reject NULL without MOLD if it would lead to ambiguity. 2011-09-14 Tobias Burnus PR fortran/34547 PR fortran/50375 * gfortran.dg/null_5.f90: New. * gfortran.dg/null_6.f90: New. diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 3d4f4c8..1e9e719 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -2732,14 +2732,19 @@ gfc_check_null (gfc_expr *mold) attr = gfc_variable_attr (mold, NULL); - if (!attr.pointer && !attr.proc_pointer) + if (!attr.pointer && !attr.proc_pointer && !attr.allocatable) { - gfc_error ("'%s' argument of '%s' intrinsic at %L must be a POINTER", - gfc_current_intrinsic_arg[0]->name, + gfc_error ("'%s' argument of '%s' intrinsic at %L must be a POINTER or " + "ALLOCATABLE", gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic, &mold->where); return FAILURE; } + if (attr.allocatable + && gfc_notify_std (GFC_STD_F2003, "Fortran 2003: NULL intrinsic with " + "allocatable MOLD at %L", &mold->where) == FAILURE) +return FAILURE; + /* F2008, C1242. */ if (gfc_is_coindexed (mold)) { diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index a9b3d70..7962403 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -2857,6 +2857,13 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) "procedure '%s'", &a->expr->where, sym->name); break; } + + if (a->expr && a->expr->expr_type == EXPR_NULL + && a->expr->ts.type == BT_UNKNOWN) + { + gfc_error ("MOLD argument to NULL required at %L", &a->expr->where); + return; + } } return; @@ -2949,6 +2956,20 @@ gfc_search_interface (gfc_interface *intr, int sub_flag, gfc_actual_arglist **ap) { gfc_symbol *elem_sym = NULL; + gfc_symbol *null_sym = NULL; + locus null_expr_loc; + gfc_actual_arglist *a; + bool has_null_arg = false; + + for (a = *ap; a; a = a->next) +if (a->expr && a->expr->expr_type == EXPR_NULL + && a->expr->ts.type == BT_UNKNOWN) + { + has_null_arg = true; + null_expr_loc = a->expr->where; + break; + } + for (; intr; intr = intr->next) { if (sub_flag && intr->sym->attr.function) @@ -2958,6 +2979,19 @@ gfc_search_interface (gfc_interface *intr, int sub_flag, if (gfc_arglist_matches_symbol (ap, intr->sym)) { + if (has_null_arg && null_sym) + { + gfc_error ("MOLD= required in NULL() argument at %L: Ambiguity " + "between specific functions %s and %s", + &null_expr_loc, null_sym->name, intr->sym->name); + return NULL; + } + else if (has_null_arg) + { + null_sym = intr->sym; + continue; + } + /* Satisfy 12.4.4.1 such that an elemental match has lower weight than a non-elemental match. */ if (intr->sym->attr.elemental) @@ -2969,6 +3003,9 @@ gfc_search_interface (gfc_interface *intr, int sub_flag, } } + if (null_sym) +return null_sym; + return elem_sym ? elem_sym : NULL; } diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index b038402..9aab836 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -8150,6 +8150,13 @@ resolve_transfer (gfc_code *code) && exp->value.op.op == INTRINSIC_PARENTHESES) exp = exp->value.op.op1; + if (exp && exp->expr_type == EXPR_NULL && exp->ts.type == BT_UNKNOWN) +{ + gfc_error ("NULL intrinsic at %L in data transfer statement requires " + "MOLD=", &exp->where); + return; +} + if (exp == NULL || (exp->expr_type != EXPR_VARIABLE && exp->expr_type != EXPR_FUNCTION)) return; --- /dev/null 2011-09-13 08:06:22.075577943 +0200 +++ gcc/gcc/testsuite/gfortran.dg/null_5.f90 2011-09-13 23:58:13.0 +0200 @@ -0,0 +1,43 @@ +! { dg-do compile } +! { dg-options "-std=f95" } +! +! PR fortran/34547 +! PR fortran/50375 + +subroutine test_PR50375_1 () + ! Contributed by Vittorio Zecca + interface gen1 +subroutine s11 (pi) + integer, pointer :: pi +end subroutine +subroutine s12 (pr) + real, pointer :: pr +end subroutine + end interface + call gen1 (null ()) ! { dg-error "MOLD=
[4/4] C6X pieces for modulo scheduling with haifa-sched
This is the final piece that makes use of the new haifa-sched functionality in c6x.c. It also makes use of the hw-doloop code which I adapted from Blackfin a while ago. After finding a candidate loop, the hwloop_optimize function unrolls it to a suitable degree, then tries successive values for II in the hope of finding a valid schedule. If that succeeds, it modifies the schedule it got back so that only the necessary instructions remain; sploop and spkernel are added, and BB_DISABLE_SCHEDULE is set so that the following final scheduling pass doesn't touch the basic block. If no valid schedule is found, the loop is restored to its original state. Bernd * common/config/c6x/c6x-common.c (c6x_option_optimization_table): Enable -fmodulo-sched at -O2 and above. * config/c6x/c6x.md (doloop_end): New expander. (mvilc, sploop, spkernel, loop_end): New patterns. (loop_end with memory destination splitter): New. * config/c6x/c6x.c: Include "hw-doloop.h". (enum unitreqs): New. (unit_req_table): New typedef. (unit_reqs): New static variable. (unit_req_factor, get_unit_reqs, count_unit_reqs, merge_unit_reqs, res_mii, split_delayed_nonbranch, undo_split_delayed_nonbranch, hwloop_pattern_reg, bb_earliest_end_cycle, filter_insns_above, hwloop_optimize, hwloop_fail, c6x_hwloops): New static functions. (struct c6x_sched_context): New member last_scheduled_iter0. (init_sched_state): Initialize it. (c6x_variable_issue): Update it. (sploop_max_uid_iter0): New static variable. (c6x_sched_reorder_1): Be careful about issuing sploop. (c6x_reorg): Call c6x_hwlooops before the final schedule. Index: common/config/c6x/c6x-common.c === --- common/config/c6x/c6x-common.c (revision 178779) +++ common/config/c6x/c6x-common.c (working copy) @@ -33,6 +33,7 @@ static const struct default_options c6x_ { { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_frename_registers, NULL, 1 }, +{ OPT_LEVELS_2_PLUS, OPT_fmodulo_sched, NULL, 1 }, { OPT_LEVELS_ALL, OPT_freciprocal_math, NULL, 1 }, { OPT_LEVELS_NONE, 0, NULL, 0 } }; Index: config/c6x/c6x.md === --- config/c6x/c6x.md (revision 178779) +++ config/c6x/c6x.md (working copy) @@ -1391,6 +1391,106 @@ (define_insn_and_split "eh_return" ) ;; - +;; Doloop +;; - + +; operand 0 is the loop count pseudo register +; operand 1 is the number of loop iterations or 0 if it is unknown +; operand 2 is the maximum number of loop iterations +; operand 3 is the number of levels of enclosed loops +; operand 4 is the label to jump to at the top of the loop +(define_expand "doloop_end" + [(parallel [(set (pc) (if_then_else + (ne (match_operand:SI 0 "" "") + (const_int 1)) + (label_ref (match_operand 4 "" "")) + (pc))) + (set (match_dup 0) + (plus:SI (match_dup 0) + (const_int -1))) + (clobber (match_scratch:SI 5 ""))])] + "TARGET_INSNS_64PLUS && optimize" +{ + /* The loop optimizer doesn't check the predicates... */ + if (GET_MODE (operands[0]) != SImode) +FAIL; +}) + +(define_insn "mvilc" + [(set (reg:SI REG_ILC) + (unspec [(match_operand:SI 0 "register_operand" "a,b")] UNSPEC_MVILC))] + "TARGET_INSNS_64PLUS" + "%|%.\\tmvc\\t%$\\t%0, ILC" + [(set_attr "predicable" "no") + (set_attr "cross" "y,n") + (set_attr "units" "s") + (set_attr "dest_regfile" "b") + (set_attr "type" "mvilc")]) + +(define_insn "sploop" + [(unspec_volatile [(match_operand:SI 0 "const_int_operand" "i") +(reg:SI REG_ILC)] + UNSPECV_SPLOOP)] + "TARGET_INSNS_64PLUS" + "%|%.\\tsploop\t%0" + [(set_attr "predicable" "no") + (set_attr "type" "sploop")]) + +(define_insn "spkernel" + [(set (pc) + (if_then_else +(ne (unspec_volatile:SI + [(match_operand:SI 0 "const_int_operand" "i") + (match_operand:SI 1 "const_int_operand" "i")] + UNSPECV_SPKERNEL) +(const_int 1)) +(label_ref (match_operand 2 "" "")) +(pc)))] + "TARGET_INSNS_64PLUS" + "%|%.\\tspkernel\t%0, %1" + [(set_attr "predicable" "no") + (set_attr "type" "spkernel")]) + +(define_insn "loop_end" + [(set (pc) + (if_then_else (ne (match_operand:SI 3 "nonimmediate_operand" "0,0,0,*r") + (const_int 1)) + (label_ref (match_operand 1 "" "")) + (pc))) + (set (match_operand:SI 0 "nonimmediate_operand" "=AB,*r,m,m")
Re: [2/4] Make schedule_ebb callable from elsewhere
On Wed, Sep 14, 2011 at 12:01 AM, Bernd Schmidt wrote: > This is just some code rearrangement to make it possible for c6x.c to > call schedule_ebbs_init, schedule_ebb and schedule_ebbs_finish. > > +/* The one entry point in this file. */ > + > +void > +schedule_ebbs (void) > +{ Might want to update that comment. Ciao! Steven
[PATCH] [Annotalysis] Fix internal compiler errors in thread safety analysis.
This patch fixes two bugs which cause an internal compiler error in annotalysis. The first change fixes a failure when a variable is typecast from an unknown (forward-defined) type. The second change fixes a case in which an assert was triggered, because subexpressions were not canonicalized correctly. Bootstrapped and passed gcc regression testsuite on x86_64-unknown-linux-gnu. Tested on google core components. Okay for google/gcc-4_6? -DeLesley gcc/Changelog.annotalysis: 2011-9-13 DeLesley Hutchins * gcc/cp/class.c (cp_get_virtual_function_decl) bugfix where type is uknown * gcc/tree-threadsafe-analyze.c (get_canonical_lock_expr) don't remove & on recursive call Index: gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-79.C === --- gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-79.C (revision 178784) +++ gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-79.C (working copy) @@ -75,3 +75,27 @@ void foo3() (new FooDerived)->doSomething(); } +class FooNodef; + +// test case for cast from undefined type +void foo4(FooNodef *f) { + ((Foo*) f)->doSomething(); +} + + +// Regression test for canonicalization of subexpressions that refer to +// lockable objects. +class LOCKABLE Base { +public: + Mutex mu_; + virtual void baseMethod() SHARED_LOCKS_REQUIRED(mu_) = 0; +}; + +class Derived : public Base { +public: + void foo() SHARED_LOCKS_REQUIRED(mu_); +}; + +void Derived::foo() { + baseMethod(); +} Index: gcc/cp/class.c === --- gcc/cp/class.c (revision 178784) +++ gcc/cp/class.c (working copy) @@ -8384,9 +8384,15 @@ cp_get_virtual_function_decl (tree ref, tree known { HOST_WIDE_INT index = tree_low_cst (OBJ_TYPE_REF_TOKEN (ref), 1); HOST_WIDE_INT i = 0; - tree v = BINFO_VIRTUALS (TYPE_BINFO (known_type)); + tree binfo = TYPE_BINFO(known_type); + tree v; tree fndecl; - + + if (!binfo) +return NULL_TREE; + + v = BINFO_VIRTUALS (TYPE_BINFO (known_type)); + while (v && i != index) { i += (TARGET_VTABLE_USES_DESCRIPTORS Index: gcc/tree-threadsafe-analyze.c === --- gcc/tree-threadsafe-analyze.c (revision 178784) +++ gcc/tree-threadsafe-analyze.c (working copy) @@ -884,10 +884,12 @@ get_canonical_lock_expr (tree lock, tree base_obj, { tree base = TREE_OPERAND (lock, 0); tree canon_base; - /* When the expr is a pointer to a lockable type (i.e. mu.Lock() + /* For expressions that denote locks, + When the expr is a pointer to a lockable type (i.e. mu.Lock() or Lock(&mu) internally), we don't need the address-taken operator (&). */ - if (lookup_attribute("lockable", TYPE_ATTRIBUTES (TREE_TYPE (base + if (!is_temp_expr && + lookup_attribute("lockable", TYPE_ATTRIBUTES (TREE_TYPE (base return get_canonical_lock_expr (base, base_obj, false /* is_temp_expr */, new_leftmost_base_var); -- DeLesley Hutchins | Software Engineer | deles...@google.com | 505-206-0315
Re: [PRs 34547/50375] Fixes to NULL with MOLD= check
On Wed, Sep 14, 2011 at 12:12:36AM +0200, Tobias Burnus wrote: > NULL requires a MOLD argument if the mold cannot be determined from the > context: > > a) print *, null() - was ICEing > b) call foo(null()) - [implicit interface] was accepted but no dummy is > available to get the type > c) call generic(null()) - need to reject it, if it would match several > specific functions > d) null(allocatable) - now allowed (F2003), was rejected before. > > (c) is PR 50375, the rest is PR 34547; see PR for the quote from the > standards. > > Build and regtested on x86-64-linux. > OK for the trunk? Yes. I was wondering if we need to change the error message in the following code to include procedure pointer? - if (!attr.pointer && !attr.proc_pointer) + if (!attr.pointer && !attr.proc_pointer && !attr.allocatable) { - gfc_error ("'%s' argument of '%s' intrinsic at %L must be a POINTER", -gfc_current_intrinsic_arg[0]->name, + gfc_error ("'%s' argument of '%s' intrinsic at %L must be a POINTER or " +"ALLOCATABLE", gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic, &mold->where); return FAILURE; } Should this be "... a POINTER, ALLOCATABLE, or PROCEDURE POINTER..."? -- Steve
[PATCH] Fix PR50183
Greetings, The code to build scops (static control parts) for graphite first rewrites loops into canonical loop-closed SSA form. PR50183 identifies a scenario where the results do not fulfill all required invariants of this form. In particular, a value defined inside a loop and used outside that loop must reach exactly one definition, which must be a single-argument PHI node called a close-phi. When nested loops exist, it is possible that, following the rewrite, a definition may reach two close-phis. This patch corrects that problem. The problem arises because loops are processed from outside in. While processing a loop, duplicate close-phis are eliminated. However, eliminating duplicate close-phis for an inner loop can sometimes create duplicate close-phis for an already-processed outer loop. This patch detects when this may have occurred and repeats the removal of duplicate close-phis as necessary. The problem was noted on ibm/4_6-branch and 4_6-branch; it is apparently latent on trunk. The same patch can be applied to all three branches. Bootstrapped and regression-tested on powerpc64-linux. OK to commit to these three branches? Thanks, Bill 2011-09-13 Bill Schmidt * graphite-scop-detection.c (make_close_phi_nodes_unique): New forward declaration. (remove_duplicate_close_phi): Detect and repair creation of duplicate close-phis for a containing loop. Index: gcc/graphite-scop-detection.c === --- gcc/graphite-scop-detection.c (revision 178829) +++ gcc/graphite-scop-detection.c (working copy) @@ -30,6 +30,9 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "sese.h" +/* Forward declarations. */ +static void make_close_phi_nodes_unique (basic_block); + #ifdef HAVE_cloog #include "ppl_c.h" #include "graphite-ppl.h" @@ -1231,6 +1234,13 @@ remove_duplicate_close_phi (gimple phi, gimple_stm SET_USE (use_p, res); update_stmt (use_stmt); + + /* It is possible that we just created a duplicate close-phi +for an already-processed containing loop. Check for this +case and clean it up. */ + if (gimple_code (use_stmt) == GIMPLE_PHI + && gimple_phi_num_args (use_stmt) == 1) + make_close_phi_nodes_unique (gimple_bb (use_stmt)); } remove_phi_node (gsi, true);
Re: [PPC] Use match_test rather than eq/ne symbol_ref
On Tue, Sep 13, 2011 at 2:02 PM, Richard Sandiford wrote: > As per the subject. Tested by making sure that there were no new > warnings building powerpc-linux-gnu, and that there were no changes > in the assembly output for the C and C++ testsuite. OK to install? > > Richard > > > gcc/ > * config/rs6000/rs6000.md: Use match_test rather than eq/ne symbol_ref > throughout file. > * config/rs6000/constraints.md: Likewise. Okay. Thanks, David
Re: [RFC] Split -mrecip
On Sat, Sep 03, 2011 at 02:44:07PM +0200, Uros Bizjak wrote: > On Wed, Aug 31, 2011 at 6:16 PM, Michael Matz wrote: > > > I'd like to have tighter control over the individual situations that > > -mrecip handles, and I think the user might appreciate this too. Hence > > I've introduced four new target options -mrecip-div, -mrecip-sqrt, > > -mrecip-vec-div and -mrecip-vec-sqrt. I've redefined -mrecip to be > > equivalent to using those four options together. In addition one can > > selectively disable some part via -mrecip -mno-recip-vec for instance. > > > > I was split mind about the approach, I could also have done like rs6000 > > (-mrecip=) with the disadvantage of having to write an own > > parser as our opt framework can't deal with comma separated lists of > > masks. With the approach I chose our opt framework gets most of the work > > done. > > > > I've decided to not use four new bits from target_flags, and instead > > created a new mask (recip_mask). Four bits would have fit in target bits > > right now, but in the future we might want to add more specialization, > > like modes for which the reciprocals are active. > > > > What do you think? > > These new flags looks like a nice addition, but I wonder, why we need > separate options to handle vector recip. A vector rsqrt or rdiv is > generated automatically in the same way as scalar rsqrt or rdiv is > generated, so IMO, -mrecip-sqrt and -mrecip-div should be enough. It is possible that the vector recip. might not be optimal. > For the future - could rs6000 and x86 use the same compile options to > handle reciprocals? As long as the current ppc flags continue to work, I think it would be useful to have them use the same standard options, much like we do for fma now. -- Michael Meissner, IBM 5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA meiss...@linux.vnet.ibm.com fax +1 (978) 399-6899
Re: [RFC] Split -mrecip
On Sat, Sep 03, 2011 at 11:11:37PM +0200, Uros Bizjak wrote: > On Sat, Sep 3, 2011 at 5:42 PM, Michael Matz wrote: > > >> > I've decided to not use four new bits from target_flags, and instead > >> > created a new mask (recip_mask). Four bits would have fit in target > >> > bits right now, but in the future we might want to add more > >> > specialization, like modes for which the reciprocals are active. > >> > > >> > What do you think? > >> > >> These new flags looks like a nice addition, but I wonder, why we need > >> separate options to handle vector recip. A vector rsqrt or rdiv is > >> generated automatically in the same way as scalar rsqrt or rdiv is > >> generated, so IMO, -mrecip-sqrt and -mrecip-div should be enough. > > > > No, the difference does matter. Using reciprocal estimates for scalar > > divs often results in errors in benchmarks because those sometimes are > > used to feed integer conversions for either index calculations or > > printouts. The small rounding errors with the reciprocals lead to > > incorrect outputs then. Context where the div can be vectorized often > > don't have this problem (they're then used purely for calculations over > > arrays of float data). For instance spec2006 and polyhedron break with > > -mrecip purely because of the scalar reciprocals, but work with only > > vectorized ones. I.e. users really want to differ between both. > > I agree with your analysis. > > > Also, when this patch goes in I plan to submit another one that activates > > vectorized rcp/rsqrt under -ffast-math already (that's what ICC happens to > > do too). > > Great! In the past, we tried to use -mrecip with -ffast-math. IIRC, > polyhedron broke on scalar rdiv and spec2006 broke on rsqrt. Taking > into account your analysis above, using separate options and > activating vectorized ones for -ffast-math makes much sense. It depends on how accurate the initial guess is and how many fixup passes you need. I would imagine AMD and Intel machines would have slightly different guesses. > >> For the future - could rs6000 and x86 use the same compile options to > >> handle reciprocals? > > > > I'd guess so. rs6000 uses a hand-written comma-splitter, which we could > > reuse. > > Perhaps rs6000 could adopt our approach in addition to its > comma-splitter? OTOH, whatever is more convenient, I don't care that > much. I have CC'd rs6000 maintainer for his opinion. I wrote the comma splitting some time ago, but who knows who is using it now, so we have to keep it on ppc for awhile yet, even if we eventually deprecate it. FWIW, on spec2006, I use -mrecip=rsqrt. Allowing division slows down one of the benchmarks because we ran out of registers. -- Michael Meissner, IBM 5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA meiss...@linux.vnet.ibm.com fax +1 (978) 399-6899
Re: [SH] Use match_test rather than eq/ne symbol_ref
Richard Sandiford wrote: > As per the subject. Tested by making sure that there were no new > warnings building sh-linux-gnu, and that there were no changes > in the assembly output for the C and C++ testsuite. OK to install? OK. Thanks! Regards, kaz
[PATCH, testsuite, ARM] Change to expected failure for g++.dg/abi/local1.C on ARM target
Here comes a patch to change the case g++.dg/abi/local1.C to be expected failure for ARM target. In "C++ ABI for the ARM architecture", it says, This runs contrary to §2.9.1 of [GC++ABI] which states: It is intended that two type_info pointers point to equivalent type descriptions if and only if the pointers are equal. An implementation must satisfy this constraint, e.g. by using symbol preemption, COMDAT sections, or other mechanisms. Fortunately, we can ignore this requirement without violating the C++ standard provided that: * type_info::operator== and type_info::operator!= compare the strings returned by type_info::name(), not just the pointers to the RTTI objects and their names. * No reliance is placed on the address returned by type_info::name(). (That is, t1.name() != t2.name() does not imply that t1 != t2). The patch is, diff --git a/gcc/testsuite/g++.dg/abi/local1.C b/gcc/testsuite/g++.dg/abi/local1.C index 518193c..7f08a8f 100644 --- a/gcc/testsuite/g++.dg/abi/local1.C +++ b/gcc/testsuite/g++.dg/abi/local1.C @@ -1,4 +1,4 @@ -// { dg-do run } +// { dg-do run { xfail { arm*-*-eabi* } } } // { dg-additional-sources "local1-a.cc" } #include ChangeLog: 2011-09-14 Jiangning Liu * g++.dg/abi/local1.C: Change to XFAIL for ARM EABI target. Thanks, -Jiangning
Re: [C++-11] User defined literals
Since we're starting to come up on the end of stage 1, I'll go ahead and review the current patch even though it isn't finished yet. Thanks for all your work on this, it definitely seems to be coming together. On 09/13/2011 10:35 AM, Ed Smith-Rowland wrote: +#define CPP_N_USERDEF 0x100 /* C++0x user-defned literal. */ "defined" -extern unsigned cpp_classify_number (cpp_reader *, const cpp_token *); +extern unsigned cpp_classify_number (cpp_reader *, const cpp_token *, +char **ud_suffix); + +/* Return the classification flags for a float suffix. */ +unsigned int cpp_interpret_float_suffix (const char *s, size_t len); + +/* Return the classification flags for an int suffix. */ +unsigned int cpp_interpret_int_suffix (const char *s, size_t len); /* Evaluate a token classified as category CPP_N_INTEGER. */ extern cpp_num cpp_interpret_integer (cpp_reader *, const cpp_token *, Let's follow the pattern of the existing declarations by adding explicit 'extern' and not naming the parameters. @@ -327,6 +327,10 @@ pp_cxx_constant (cxx_pretty_printer *pp, tree t) +case USERDEF_LITERAL: + pp_c_constant (pp_c_base (pp), USERDEF_LITERAL_VALUE (t)); + break; @@ -1755,6 +1757,11 @@ dump_expr (tree t, int flags) +case USERDEF_LITERAL: + pp_constant (cxx_pp, USERDEF_LITERAL_VALUE (t)); + dump_decl (USERDEF_LITERAL_SUFFIX_ID (t), flags); + break; These should be the same--or just call pp_cxx_constant from dump_expr. +/* Extract the suffix from a user-defined literal string or char. */ +void +cpp_get_userdef_suffix (cpp_string string, char delim, char *suffix) +{ + unsigned int len = string.len; + const char *text = (const char *)string.text; + int i; + for (i = len; i > 0; --i) +{ + if (text[i - 1] == delim) + break; +} + strncpy (suffix, text + i, len - i); + suffix[len - i] = '\0'; +} Since you're just going to be passing the pointer to get_identifier anyway, we don't need to copy the suffix into the pointer. Just return a pointer to the start of the suffix. + if (ud_suffix) + *ud_suffix = xstrdup ((const char *)str); Similarly here. + const char *curr_suffix = NULL; + suffix_id = USERDEF_LITERAL_SUFFIX_ID (tok->u.value); + curr_suffix = IDENTIFIER_POINTER (suffix_id); + if (have_suffix_p == 0) + { + suffix = xstrdup (curr_suffix); + have_suffix_p = 1; + } + else if (have_suffix_p == 1 && strcmp (suffix, curr_suffix) != 0) And here, you can compare the identifiers with ==, since identifiers are unique. + error ("inconsistent user-defined literal suffixes"); Let's print the suffixes involved. + error ("%qD has illegal argument list", decl); Use "invalid" rather than "illegal". + suffix = UDLIT_OP_SUFFIX (DECL_NAME (decl)); + if (long_long_unsigned_p) + { + if (cpp_interpret_int_suffix (suffix, strlen (suffix))) + warning (0, "integer suffix shadowed by implementation"); + } + else if (long_double_p) + { + if (cpp_interpret_float_suffix (suffix, strlen (suffix))) + warning (0, "floating point suffix" + " shadowed by implementation"); + } Let's print the suffix as part of the warning. + if (dname + && TREE_CODE (dname) == IDENTIFIER_NODE + && UDLIT_OPER_P (dname) + && innermost_code != cdk_function + && ! (ctype && !declspecs->any_specifiers_p)) I think we can drop the last check, as it only applies to constructors. +/* User-defined literal operator. +DEF_SIMPLE_OPERATOR ("\"\"", USERDEF_LITERAL_EXPR, "ud", 1) */ Are you planning to use this for something? +/* Parse a user-defined char constant. Returns a call to a user-defined + literal operator taking the character as an argument. */ +static tree +cp_parser_userdef_char_literal (cp_parser *parser) There should be a blank line after the comment here and before the other new functions, at least in gcc/. +make_numeric_string(tree value) This function tries to recreate a printed form for a numeric constant, but that's not right; we need the actual source characters, which are likely to be different, especially for floating-point numbers. So we need to get back to the actual spelling of the token here. I notice that later in cp_parser_userdef_numeric_literal when calling the variadic template version you assume that you have the spelling of the token, which is indeed what we want. +check_literal_operator_args(const_tree decl, Space before (. + tree const_char_ptr_type_node + = build_pointer_type(build_type_variant(char_type_node, 1, 0)); + tree const_wchar_ptr_type_node + = build_pointer_type(build_type_variant(wchar_type_node, 1, 0)
Re: [PRs 34547/50375] Fixes to NULL with MOLD= check
Steve Kargl wrote: I was wondering if we need to change the error message in the following code to include procedure pointer? + gfc_error ("'%s' argument of '%s' intrinsic at %L must be a POINTER or " +"ALLOCATABLE", gfc_current_intrinsic_arg[0]->name, gfc_current_intrinsic,&mold->where); return FAILURE; } Should this be "... a POINTER, ALLOCATABLE, or PROCEDURE POINTER..."? Good suggestion. I have changed it accordingly - except that I wrote procedure pointer in minuscules. Committed as Revs. 178841/178842. Tobias