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

Nick Lewycky nicholas at mxc.ca
Sat Dec 10 19:25:29 PST 2011


Nick Lewycky wrote:
> 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.

I've gone ahead and done this. With the attached patch applied, nothing 
in lib/Target/* or include/llvm/Target/* include anything from 
include/llvm/CodeGen.

The .cpp files that moved are TargetELFWriterInfo, TargetFrameLowering, 
TargetLoweringObjectFile, TargetMachine, TargetOptions, 
TargetRegisterInfo and TargetSubtargetInfo. The .h files that moved are 
the matching headers for the .cpp files plus TargetInstrInfo, 
TargetSelectionDAGInfo and TargetLowering.

Please review! More generally, I suggest reviewing the idea of moving 
everything rather than looking at the patch itself. The patch is lots of 
changing Target/X to CodeGen/X, nothing exciting.

Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: target-no-codegen-llvm-1.patch
Type: text/x-diff
Size: 471265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111210/54a6903d/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: target-no-codegen-clang-1.patch
Type: text/x-diff
Size: 1425 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111210/54a6903d/attachment-0001.patch>


More information about the llvm-dev mailing list