[LLVMdev] moving from lib/Target and lib/CodeGen

Nick Lewycky nlewycky at google.com
Thu Dec 8 19:54:50 PST 2011


We've had a circular dependency in LLVM for a while, and while we've
been fortunate that we could ignore it by implementing functions in
header files, a recent innocent change caused a cyclic dependency
between Target and CodeGen just because of inlining that happens in
GCC. I'm proposing to fix this by moving code from Target to CodeGen

If I understand correctly, lib/CodeGen is target-independent code
generator parts and lib/Target provides a target-independent interface
that the code in CodeGen uses, while lib/Target/Foo provides
target-specific data for, and implementations of, those target
independent pieces. The targets themselves have access to both CodeGen
and Target, and those Target-independent interfaces are defined in
terms of types in CodeGen.

This means we have two target-independent layers, one in lib/Target
(excluding subdirs) and lib/CodeGen. I think the right thing to do is
move the pieces in lib/Target which mention CodeGen types (for example
TargetInstrInfo) into CodeGen. Please let me know whether this is the
right thing to do, and meanwhile I'm going to try to prepare a patch
that does this.

Nick



More information about the llvm-dev mailing list