Attached is a patch to implement an !eq() operator in TableGen. We use this for the AVX specification to allow the user to control what kind of pattern should be used for a particular instruction def. For example, we use it for reg-mem instructions to let the user choose between a built-in generic reg-mem pattern, the same pattern that was used for the reg-reg variant of the instruction or a custom pattern provided by the user. It only operates on strings. An alternative to this would be to implement named parameters in TableGen but that seems like overkill for this case. Named parameters could be useful in other areas to reduce template complexity but implementing it is non-trivial given the widespread assumption in the TableGen sources that template parameters exactly match up with template arguments. Comments? Ok to commit? -Dave -------------- next part -------------- A non-text attachment was scrubbed... Name: eq.patch Type: text/x-diff Size: 4569 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100105/01e01702/attachment.patch>
On Jan 5, 2010, at 9:59 AM, David Greene wrote:> Attached is a patch to implement an !eq() operator in TableGen. We > use this > for the AVX specification to allow the user to control what kind of > pattern > should be used for a particular instruction def. For example, we > use it for > reg-mem instructions to let the user choose between a built-in > generic reg-mem > pattern, the same pattern that was used for the reg-reg variant of the > instruction or a custom pattern provided by the user. > > It only operates on strings. > > An alternative to this would be to implement named parameters in > TableGen but > that seems like overkill for this case. Named parameters could be > useful in > other areas to reduce template complexity but implementing it is non- > trivial > given the widespread assumption in the TableGen sources that template > parameters exactly match up with template arguments.I can't say if this is really the best answer for AVX, but independently of that the patch looks great, please commit. -Chris
On Tuesday 05 January 2010 12:31, Chris Lattner wrote:> I can't say if this is really the best answer for AVX, but > independently of that the patch looks great, please commit.Ok. I'm sure we'll iterate on the AVX stuff quite a bit. -Dave
Reasonably Related Threads
- [LLVMdev] TableGen !eq() Operator Patch
- [LLVMdev] Recursion in TableGen
- [LLVMdev] Patch to synthesize x86 hadd instructions; need help with the tablegen bits
- [LLVMdev] Patch to synthesize x86 hadd instructions; need help with the tablegen bits
- [LLVMdev] Patch to synthesize x86 hadd instructions; need help with the tablegen bits