Dan,> In general, it's a design goal to structure CodeGen features as > target-independent code parameterized with target-specific data. > The degree to which this goal is met in LLVM CodeGen features today > varies, but features that have been implemented using TableGen have > been relatively successful.Can you give an example of a relatively successful instance where Tablegen was used to implement something specific for a target? Manjunath
On Jun 8, 2009, at 1:25 PM, Manjunath Kudlur wrote:> Dan, > > >> In general, it's a design goal to structure CodeGen features as >> >> target-independent code parameterized with target-specific data. >> >> The degree to which this goal is met in LLVM CodeGen features today >> >> varies, but features that have been implemented using TableGen have >> >> been relatively successful. >> > > Can you give an example of a relatively successful instance where > Tablegen was used to implement something specific for a target?All of the tablegen backends work this way. As you mentioned, there are no target-specific tablegen backends at present. The underlying observation here is that features are never fundamentally "specific for a target". For example, a mapping between vector opcodes and associated scalar opcodes could reasonably be made on many architectures. Even load-balancing between functional units on a processor is a target-independent concept, with details like the number and nature of the functional units being target-dependent. Dan
> All of the tablegen backends work this way. As you mentioned, > there are no target-specific tablegen backends at present. > > The underlying observation here is that features are never > fundamentally "specific for a target". For example, a mapping > between vector opcodes and associated scalar opcodes could > reasonably be made on many architectures. Even > load-balancing between functional units on a processor is a > target-independent concept, with details like the number and > nature of the functional units being target-dependent.Sorry to be such a pest, but I am still trying to understand the usage model for tablegen. Are you saying it is not a good idea to write a tablegen backend for something very specific to a target? The examples I gave happen to be applicable to many targets. But the usage depends on AN implementation of codegen for a target, no? I mean, I could choose to put the related scalar instruction in a field with a specific name in the myInst class in the .td file, and would want to populate a data structure with a specific name in my C++ code. The tablegen backend should "know" the names of both the field in the .td file and the name of the data structure. How can I make this generic? Thanks, Manjunath