[LLVMdev] Using MC Parser data
Chris Lattner
clattner at apple.com
Sun Nov 7 10:53:52 PST 2010
On Nov 7, 2010, at 2:13 AM, Vladimir Kirillov wrote:
> Hi, llvmdev!
>
> I have some thoughts about using the LLVM MC Parser's data to extract
> information about symbols like global data and 'functions' (labels with
> code following) intermixed with preprocessor directives (for example a
> C-like include file using function-like macros defined in the assembler
> source code).
>
> I'm looking at the MCContext class which is likely to own all
> symbols in the file and all sections. However, I do not see whether
> the MC parser gathers any data about source locations of parsed sections
> and directives.
>
> My question is whether it is possible to use MC to extract such data.
> I guess, the first thing might be tracking the source locations (like
> clang does), but what else can be a show-stopper?
Hi Vladimir,
We don't have an MC backend that builds an "assembly AST", but it would be straight-forward to do so. Just define your own implementation of MCStreamer, and it will get called for every source level construct that the assembler runs into.
-Chris
More information about the llvm-dev
mailing list