<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi,<div><br></div><div>The attached patch adds the machinery into opt to enable testing passes that use target machine information.</div><div>Thanks for your review.</div><div><br></div><div>** Context **</div><div><br></div><div>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). </div><div><br></div><div><br></div><div>** Proposed Solution **</div><div><br></div><div>When registering a pass, a pass can now specify a second construct that takes as argument a pointer to TargetMachine.</div><div>The PassInfo class has been updated to reflect that possibility.</div><div>If such a constructor exists opt will use it instead of the default constructor when instantiating the pass.</div><div><br></div><div>A pass can specify that it supports the second constructor by using the new INITIALIZE_PASSxxx_WITH_TM as illustrated in codegenprepare.</div><div><br></div><div>A subsequent patch will make use of this feature to better test codegenprepare on something I am currently working.</div><div><br></div><div>Thanks,</div><div><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">-Quentin</div>

</div>
</div></body></html>