This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi Jason, Made all the changes and attached patch. Ok to commit? Thanks, -Sri. On Tue, Nov 6, 2012 at 7:52 AM, Jason Merrill <jason@redhat.com> wrote: > On 11/05/2012 09:38 PM, Sriraman Tallam wrote: >> >> + /* For multi-versioned functions, more than one match is just fine. >> >> + Call decls_match to make sure they are different because they are >> + versioned. */ >> + if (DECL_FUNCTION_VERSIONED (fn)) >> + { >> + for (match = TREE_CHAIN (matches); match; match = TREE_CHAIN >> (match)) >> + if (!DECL_FUNCTION_VERSIONED (TREE_PURPOSE (match)) >> + || decls_match (fn, TREE_PURPOSE (match))) >> + break; >> + } > > > I still don't understand what this code is supposed to be doing. Please > remove it and instead modify the other loop to allow mismatches that are > versions of the same function. > >> + /* If the olddecl is a version, so is the newdecl. */ >> + if (TREE_CODE (newdecl) == FUNCTION_DECL >> + && DECL_FUNCTION_VERSIONED (olddecl)) >> + { >> + DECL_FUNCTION_VERSIONED (newdecl) = 1; >> + /* newdecl will be purged and is no longer a version. */ >> + delete_function_version (newdecl); >> + } > > > Please make the comment clearer that the reason we're setting the flag on > the newdecl is so that it'll be copied back into the olddecl; otherwise it > seems odd to say it's a version and then it isn't a version. > >> + /* If a pointer to a function that is multi-versioned is requested, the >> + pointer to the dispatcher function is returned instead. This works >> + well because indirectly calling the function will dispatch the right >> + function version at run-time. */ >> >> + if (DECL_FUNCTION_VERSIONED (fn)) >> + { >> + tree dispatcher_decl = NULL; >> + gcc_assert (targetm.get_function_versions_dispatcher); >> + dispatcher_decl = targetm.get_function_versions_dispatcher (fn); >> + if (!dispatcher_decl) >> + { >> + error_at (input_location, "Pointer to a multiversioned function" >> + " without a default is not allowed"); >> + return error_mark_node; >> + } >> + retrofit_lang_decl (dispatcher_decl); >> + fn = dispatcher_decl; > > > This code should use the get_function_version_dispatcher function in > cp/call.c. > > Jason >
Attachment:
mv_patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |