Using passes declared in anonymous namespaces

Hi,

in my project, I’d like to estimate the cost of a bunch of instructions. I’ve found that there is a public function called CostModelAnalysis::getInstructionCost which does exactly what I want…

… except it’s defined in an anonymous namespace, so I cannot access it from my code.

Is there a good way to re-use functionality from such anonymous LLVM passes? I’m tempted to just copy-paste the entire source file and adapt it for my project, but I feel there must be something better. I’d be thankful for all hints!

Best,
Jonas