[LLVMdev] Adding a New Instruction to LLVM IR

Eli Friedman eli.friedman at gmail.com
Fri May 18 11:37:54 PDT 2012


On Fri, May 18, 2012 at 10:52 AM, Arnamoy Bhattacharyya
<arnamoy at ualberta.ca> wrote:
> Hello;
>
> I was planning to add a new instruction to the LLVM IR (and later to MIPS
> backend) for TLS(Thread level speculation) support.  For this I tried to
> follow the steps described in http://llvm.org/docs/ExtendingLLVM dot
> html#instruction.
>
> But I could not find any llvm/lib/AsmParser/Lexer.l
> and llvm/lib/AsmParser/llvmAsmParser.y file in both the svn repository and
> the source code downloaded from the website.  Could you tell me what are the
> files that need to be modified to add a new token to parse my instruction
> from assembly text file (STEP 4) and add the grammar on how my instruction
> can be read and what it will construct as a result (STEP 5).

The relevant code is still in lib/AsmParser/; it's just that we've
swtiched from a generated lexer/parser to a hand-written one.  If you
want examples, try looking in the revision history for my atomics
work.

-Eli




More information about the llvm-dev mailing list