How to create a mangler instance from target machine?

Dear LLVM,

Might be a easy question for someone, but not for me now. Consider there is a TargetMachine instance. Having this target, how could you get a corresponding Mangler class instance?

Mangler depends on MCContext, which is connected with LLVMTargetMachine inherited from TargetMachine. However, LLVMTargetMachine is only available for targets machines implementations, and not available externally.

How to solve this?


  • Dima.

Dear LLVM,

Sorry, maybe the question was not clear. Here's an example. Consider
an LLVM user supplies a function called "function.with.dots" to
backend. Backend generates an object containing symbol
"function_2E_with_2E_dots". This is the effect of Mangler in work!
Question: how user is supposed to know about this name change at LLVM
user level, i.e. without digging into backend internals?

I'm trying to create my own instance of Mangler, but there is no
MCContext around. Is it the right way to go? What could be done in
this case?

- Dima.