Possible to mark a region of source code area to apply passes?

So I would like to have finer control over where to apply my pass and possibly only targeting few lines of source code. One thing I imagine would work is to wrap a block of code (within a function) with some C++ constructs which translate to certain llvm intrinsic calls at the IR level, then I can scan for those llvm intrinsic calls while enumerating all the instructions to know when to apply my custom pass. Any help would be much appreciated! Thanks!