[PATCH] Allow opt to run pass that needs target machine.

Quentin Colombet qcolombet at apple.com
Wed Jan 15 12:18:25 PST 2014


Hi,

The attached patch adds the machinery into opt to enable testing passes that use target machine information.
Thanks for your review.

** Context **

opt is a great tool to test/play with IR to IR passes. However, opt is not able to feed a pass with target machine information (like TargetLowering) and this prevents the testing (or an easy testing) of the meaty part of some passes (e.g., codegenprepare). 


** Proposed Solution **

When registering a pass, a pass can now specify a second construct that takes as argument a pointer to TargetMachine.
The PassInfo class has been updated to reflect that possibility.
If such a constructor exists opt will use it instead of the default constructor when instantiating the pass.

A pass can specify that it supports the second constructor by using the new INITIALIZE_PASSxxx_WITH_TM as illustrated in codegenprepare.

A subsequent patch will make use of this feature to better test codegenprepare on something I am currently working.

Thanks,
-Quentin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140115/e54c532d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: codegenprepare-test.patch
Type: application/octet-stream
Size: 7136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140115/e54c532d/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140115/e54c532d/attachment-0001.html>


More information about the llvm-commits mailing list