[llvm-commits] [llvm] r140951 - in /llvm/trunk: ./ include/llvm/TableGen/ lib/ lib/TableGen/ utils/TableGen/

James Molloy james.molloy at arm.com
Tue Oct 4 00:16:39 PDT 2011


Hi Peter,

This is a good idea, and I've been meaning to do it for a while.

I have multiple other projects based on LLVM, and while tblgen is extremely
useful the barrier to entry to using it in spinoff projects is the cost of
maintaining a backend under the main LLVM tree, and not being able to keep
your code together.

The way I was going to go was slightly different to yours, in that I was
going to make a couple of the main tblgen headers public and have clients
#include those, create shared objects and pass them to the main LLVM tblgen
as a dynamically loaded backend, much how opt has the "-load" option.

With your method, I still see the possibility of the content of the "main"
tblgen file changing and breaking spinoff projects' code. The worst part
about this though is that because their main function will be held out of
tree in their own sourcebase, they won't get proper merge conflicts and
fixing the changes may be manual and arduous.

Have you thought about these kind of developers (hobbyist and academic) and
how your changes will affect them, for better or worse?

Cheers,

James

-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu
[mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Peter Collingbourne
Sent: 04 October 2011 00:49
To: Chris Lattner
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] [llvm] r140951 - in /llvm/trunk: ./
include/llvm/TableGen/ lib/ lib/TableGen/ utils/TableGen/

Hi Chris,

> What direction are you going here?

My intention is to move the Clang tblgen backends into the Clang
source tree by building the tblgen parser out into a library that
can be used to create tblgen-like tools, and creating LLVM and Clang
utilities which contain their respective backends and which are clients
of that library.  I'm trying to achieve this incrementally, by first
creating a TableGen library containing the parser and most of 'main'.
Currently tblgen is the only client, but I hope to replace this with
llvm-tblgen and clang-tblgen utilities.

> Are you committed to fixing these problems as follow-ons?

To address these issues:

> 1. All of the 'main' code and the top-level cl::opt's should be in
utils/tablegen, not in TableGen/Main.h

Since llvm-tblgen and clang-tblgen would share most of the
implementation of their 'main' functions, I think it makes sense to
also put most of that code in the library.  The TableGenAction class
allows for tools to provide the relevant part of 'main' that calls
out to their backends.

I have noticed that this change is causing problems for shared library
users [1], and I apologise for not anticipating this.  I think that as
a single-purpose library, TableGen does not belong in the shared library,
so the most logical way to resolve this problem is to exclude it from
the shared library.

> 2. The tablegen headers (like the rest of it :) are a mess, they are not
split properly between public and private headers.

I think that to begin with, the TableGen public interface should
provide the bare minimum to allow clients to write their own
tblgen-like tools.  To this end, the public interface consists of
the backend base class, the TableGenAction base class, the Record
data structure definitions and the 'TableGenMain' function.  I believe
that I've largely achieved this split with the current set of header
files in include/llvm/TableGen.

> 3. The tblgen code uses RTTI and EH, which none of the rest of the LLVM
libraries do.
>
> So long as RTTI and EH don't invade tools other than the utils/TableGen
executable, I'm ok with continuing to forget about #3, but #1 and #2 are
pretty important.

I'm not addressing this problem.  The TableGen library and its clients
will be built with RTTI and EH.

Thanks,
-- 
Peter

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-October/043687.html
_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits








More information about the llvm-commits mailing list