Peter Housel
2010-Jul-15 15:17 UTC
[LLVMdev] [PATCH] Addition to TableGen for dumping intrinsics as XML
The LLVM libraries provide the llvm::Intrinsic::getDeclaration() function, which can provide a standard external declaration for any of the (currently) 762 defined LLVM intrinsics, both for ordinary intrinsics and for overrideable intrinsics with supplied parameter types. Clients that do not link with the LLVM libraries (such as the Open Dylan compiler, which has its own IR and its own bitcode output) do not have access to this facility, however. In order to make intrinsics information available, the enclosed patch adds a command-line flag which causes TableGen to dump all of the information obtained from parsing Intrinsics.td into an XML output file. This output can then be read by clients or transformed into code or tables using (say) an XSLT script. The current output of the tool is also enclosed as a sample. -Peter- -------------- next part -------------- A non-text attachment was scrubbed... Name: xmlintrinsic.diff Type: application/octet-stream Size: 9887 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100715/5c1b5c9d/attachment.obj> -------------- next part -------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: Intrinsics.xml Type: application/xml Size: 327295 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100715/5c1b5c9d/attachment.xml>
Peter S. Housel
2010-Jul-22 14:39 UTC
[LLVMdev] [PATCH] Addition to TableGen for dumping intrinsics as XML
At Thu, 15 Jul 2010 08:17:37 -0700, Peter Housel wrote:> The LLVM libraries provide the llvm::Intrinsic::getDeclaration() > function, which can provide a standard external declaration for any > of the (currently) 762 defined LLVM intrinsics, both for ordinary > intrinsics and for overrideable intrinsics with supplied parameter > types. Clients that do not link with the LLVM libraries (such as the > Open Dylan compiler, which has its own IR and its own bitcode > output) do not have access to this facility, however. > > In order to make intrinsics information available, the enclosed > patch adds a command-line flag which causes TableGen to dump all of > the information obtained from parsing Intrinsics.td into an XML > output file. This output can then be read by clients or transformed > into code or tables using (say) an XSLT script. > > The current output of the tool is also enclosed as a sample.Ping? On IRC Dan Gohman expressed some reservations about doing this, given the incremental burden of yet another emitter backend (this would be number 28) in TableGen, making it that much harder to refactor and maintain. I'm not particularly worried about this, given that XMLIntrinsicEmitter uses the same interface to the rest of TableGen as the existing IntrinsicEmitter (namely the LoadIntrinsics function and the CodeGenIntrinsic class). An alternative, which would permit anyone to generate any information they need from TableGen would be to embed a Python interpreter, allowing users to execute arbitrary scripts. These scripts could traverse the TableGen data model and generate appropriate output; eventually all of the emitters could be ripped out and replaced with (likely more concise) scripts. I have seen this approach used to good effect in the omniORB IDL compiler. It would be a fair amount of work to implement, however, so I don't want to pursue this approach without consensus that it would be a good idea. (It would also have to be done carefully to avoid making the build dependencies for LLVM more complex.) Whatever approach is taken, I (and other people) do need some way of automatically generating intrinsics information for languages other than C++ and C, and I'd rather not have to implement my own TableGen too. -Peter-
Peter S. Housel
2010-Jul-29 07:02 UTC
[LLVMdev] [PATCH] Addition to TableGen for dumping intrinsics as XML
At Thu, 22 Jul 2010 07:39:36 -0700, Peter S. Housel wrote:> At Thu, 15 Jul 2010 08:17:37 -0700, Peter Housel wrote: > > The LLVM libraries provide the llvm::Intrinsic::getDeclaration() > > function, which can provide a standard external declaration for any > > of the (currently) 762 defined LLVM intrinsics, both for ordinary > > intrinsics and for overrideable intrinsics with supplied parameter > > types. Clients that do not link with the LLVM libraries (such as the > > Open Dylan compiler, which has its own IR and its own bitcode > > output) do not have access to this facility, however. > > > > In order to make intrinsics information available, the enclosed > > patch adds a command-line flag which causes TableGen to dump all of > > the information obtained from parsing Intrinsics.td into an XML > > output file. This output can then be read by clients or transformed > > into code or tables using (say) an XSLT script. > > > > The current output of the tool is also enclosed as a sample. > > Ping?The enclosed patch adds a FileCheck test for the feature. -Peter- -------------- next part -------------- A non-text attachment was scrubbed... Name: tg.diff Type: application/octet-stream Size: 12397 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100729/05407e4b/attachment.obj>
Peter S. Housel
2010-Aug-10 20:21 UTC
[LLVMdev] [PATCH] Addition to TableGen for dumping intrinsics as XML
At Thu, 22 Jul 2010 07:39:36 -0700, Peter S. Housel wrote:> Whatever approach is taken, I (and other people) do need some way of > automatically generating intrinsics information for languages other > than C++ and C, and I'd rather not have to implement my own TableGen > too.FWIW, I did end up implementing my own (subset of) TableGen in Dylan. The curious can see it at http://www.opendylan.org/cgi-bin/viewvc.cgi/trunk/fundev/sources/app/llvm-tablegen/ -Peter-