[llvm-commits] Cost Table, take 2

David Tweed David.Tweed at arm.com
Thu Jan 24 00:59:21 PST 2013


Hi,
I'd prefer to retain the cost table code as C++ rather than have it moved to a "build-time" table-gen file. However, I'm not actively submitting patches in that area at the moment and I'll defer to others' opinions on the issue.

Regards,
Dave

From: Chandler Carruth [mailto:chandlerc at google.com]
Sent: 24 January 2013 08:45
To: Renato Golin Linaro
Cc: LLVM Commits; Nadav Rotem; David Tweed; Evan Cheng
Subject: Re: Cost Table, take 2

At this point, I'm not really seeing the benefit of this patch.

It takes 2 structs and 2 functions, both of which are dead simple, and replaces them with 3 class templates in an inheritance tree plus an inner struct a constructor and one function that is significantly more complex. It doesn't make things more efficient in the process. It doesn't really make this a generic tool for table lookup, because the tables are not in fact generic. I think ultimately I would prefer the original code here. Maybe there is a massive simplification this provides to some future code you're considering that I don't see yet? Dunno...


Sorry for being a bit of a rain cloud here. To try to give some constructive ideas, I looked at the fundamental problem, and I see two designs that seem more workable:

1) A TargetCostTable class template in include/llvm/Target which accepts a T type parameter that can be either MVT, std::pair<MVT, MVT>, or std::tuple<MVT, MVT, ...>. Then the ISD and the cost value can be concrete things.

2) Teach tablegen to produce pre-sorted tables with lookup routines from a .td file in the target.

My suspicion is that #1 will end up being nearly as much code and complexity as the duplication between ARM and X86....

My suspicion is that *if* it is worth abstracting this stuff, we should just do #2 and make it really powerful. Then we can quickly build very large and detailed cost tables, and they will remain efficient and simple to use in each target.

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130124/6c7f4685/attachment.html>


More information about the llvm-commits mailing list