Please document the layers

I keep seeing "this is a layering violation" comments on the lists.
While there are a few llvm.org pages that mention layers in passing,
there is nothing (that I've found) actually specifying the layers.
Trying to infer the layering from the code is tedious and error-prone
(or we wouldn't see so many violations in code reviews, eh?).

Now, I understand that Google has some sort of layering checker.
Could somebody extract the layering information from that tool
and throw it into a web page? I'm sure it would be helpful to a
number of people, not just me.

Thanks,
--paulr

I keep seeing “this is a layering violation” comments on the lists.

While there are a few llvm.org pages that mention layers in passing,
there is nothing (that I’ve found) actually specifying the layers.
Trying to infer the layering from the code is tedious and error-prone
(or we wouldn’t see so many violations in code reviews, eh?).

Now, I understand that Google has some sort of layering checker.
Could somebody extract the layering information from that tool
and throw it into a web page? I’m sure it would be helpful to a
number of people, not just me.

That would be nice to see, at least for the current state of the code. In the long-term it would be better to auto-generate the page.

Meanwhile, does llvm-config --components and llvm-config --libs help you?

-Andy

I keep seeing "this is a layering violation" comments on the lists.

While there are a few llvm.org pages that mention layers in passing,
there is nothing (that I've found) actually specifying the layers.
Trying to infer the layering from the code is tedious and error-prone
(or we wouldn't see so many violations in code reviews, eh?).

Now, I understand that Google has some sort of layering checker.
Could somebody extract the layering information from that tool
and throw it into a web page? I'm sure it would be helpful to a
number of people, not just me.

That would be nice to see, at least for the current state of the code. In
the long-term it would be better to auto-generate the page.

I hacked together a script that goes over our LLVMBuild.txt files and
extracts a dependency tree which can be seen as the layering description.
Here's an example with the root on the 'lli' tool:
https://gist.github.com/eliben/5348224

[a dep tree is printed only once for every library to make the output
manageable]

This description is incomplete because some dependencies are populated at
runtime (notably all the targets being linked), but it seems like a pretty
good description of layering in terms of what should or should not depend
on something else.

If this looks interesting, a better long-term strategy would be to
hack /utils/llvm-build/ to dump this when requested with some flag, because
it already understands LLVMBuild.txt files (surely to a deeper level than
my hackish script).

Meanwhile, does llvm-config --components and llvm-config --libs help you?

These just list the components and libraries, i.e.:

llvm-config --components
aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc
aarch64disassembler aarch64info aarch64utils all all-targets analysis
archive arm armasmparser armasmprinter armcodegen armdesc armdisassembler
arminfo asmparser asmprinter bitreader bitwriter codegen core cppbackend
cppbackendcodegen cppbackendinfo debuginfo engine executionengine gtest
gtest_main hexagon hexagonasmprinter hexagoncodegen hexagondesc hexagoninfo
instcombine instrumentation interpreter ipa ipo irreader jit linker mblaze
mblazeasmparser mblazeasmprinter mblazecodegen mblazedesc
mblazedisassembler mblazeinfo mc mcdisassembler mcjit mcparser mips
mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo
msp430 msp430asmprinter msp430codegen msp430desc msp430info native
nativecodegen nvptx nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo
objcarcopts object option powerpc powerpcasmprinter powerpccodegen
powerpcdesc powerpcinfo runtimedyld scalaropts selectiondag sparc
sparccodegen sparcdesc sparcinfo support tablegen target transformutils
vectorize x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler
x86info x86utils xcore xcoreasmprinter xcorecodegen xcoredesc
xcoredisassembler xcoreinfo

So I'm not sure how it helps to see the layers.

Eli

Eli