[LLVMdev] An assembly level interface for LLVM

Reid Spencer reid at x10sys.com
Sun Dec 14 14:58:01 PST 2003


Oops .. pardon my last incomplete posting, pushed Ctrl-Enter by
accident! As I was saying ..

Rahul's idea is interesting and would make some aspects of LLVM
programming easier, but I wouldn't use it in my source language for the
following reasons:

1. Of necessity the "snippet parser" would need to be based on the same
    language/grammar as AsmParser. Allowing parsing and correct error 
    handling of snippets could obfuscate the grammar and make
    maintenance of it harder. 
2. The overhead in the compiler for parsing snippets would be too high
    for my compiler. Compilers are already memory and CPU intensive 
    applications, adding any additional CPU burden for convenience is a
    high price to pay.
3. There are alternative mechanisms that can achieve the same thing. I
    would much rather use a set of C++ templates, CPP macros, or plain
    functions to achieve the same end. This essentially raises the 
    level of abstraction for programming the IR.

What would be quite useful is to have a *standard* set of IR utility
functions/macros/templates that would achieve the same end. Programming
to the LLVM IR is already quite simple but an even higher level
interface would provide support for the many idioms that occur
frequently. 

Just my $0.02 worth ...

Reid.

On Sun, 2003-12-14 at 09:31, Rahul Joshi wrote:
> Hi LLVMdev,
> 
> Sorry about the bad title, but I hope you will get my idea. I
> think that in many LLVM programs that create/modify the LLVM
> IR (like say a language frontend/profiler etc), and in other
> cases too, some of the code is just "mechanical", for example
> creating function types takes like 4-5 lines of code, but
> nothing interesting goes on there. I think we can get rid of
> such code by providing an LLVM assembly language parsing
> library. For example, a type parser may look something like:
> 
> TypeParser p("uint x uinx -> void");
> Type* FuncType = p.getType();
> 
> The same thing can be extended to an LLVM snippet parser,
> which will parse LLVM instruction. We can use $1, $2 etc as
> paramaters, so that snippets can be instantiated with 
> specific arguments.
> 
> Do others think this functionality will be useful?
> 
> Thanks,
> Rahul
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev


_______________________
Reid Spencer
President & CTO
eXtensible Systems, Inc.
rspencer at x10sys.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20031214/c969189f/attachment.sig>


More information about the llvm-dev mailing list