[LLVMdev] instruction scheduling issue

Krzysztof Parzyszek kparzysz at codeaurora.org
Mon Jan 7 12:25:54 PST 2013

On 1/7/2013 2:15 PM, Xu Liu wrote:
> This would be ideal. How can I do the instrumentation pass after the
> instruction scheduling?

You could derive your own class from TargetPassConfig, and add the 
annotation pass in YourDerivedTargetPassConfig::addPreEmitPass.  This 
will add your annotation pass very late, just before the final code is 
emitted.  If you're using the X86 target, then the class and the 
function is already there:


bool X86PassConfig::addPreEmitPass() {
   bool ShouldPrint = false;
   if (getOptLevel() != CodeGenOpt::None && getX86Subtarget().hasSSE2()) {
     ShouldPrint = true;

   if (getX86Subtarget().hasAVX() && UseVZeroUpper) {
     ShouldPrint = true;

   return ShouldPrint;


Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation

More information about the llvm-dev mailing list