How to put a pass for last?

Hello guys,

I’m writing a pass that must check every machine instruction that will go to assembly.
I’ve put my pass registration just before the “addAsmEmmiter” line in LLVMTargetMachine.cpp

But, iterating trought machine functions and basic blocks inside the functions, there are still machine instructions that I cant reach.

This is the beginnig of the asm output of my example test program:

.align 16
.globl main
.type main, #function
sethi 4194296, %g1
or %g1, 56, %g1
save %g1, %o6, %o6
sethi 0, %l0

The nop right before sethi is one instruction I’m not being able to reach in my pass.
But there is more:

add %l0, 1, %l0
st %l0, [%i6±12]
.BB1_2: ! bb8
ld [%i6±12], %l0
subcc %l0, 1000, %l0
bl .BB1_1 ! bb
.BB1_3: ! bb12
ba .BB1_5 ! bb19
or %g0, 1, %l0

Here both the “ba” and the “nop”, that are the 3rd and 2nd last operations of this snipet, are not reachable.

Could I express myself good enougth?
Is it possible to do what I want?
Do you know what might be the problem?