[LLVMdev] [RFC] CodeGenPrepare will eventually introduce dependencies to libLLVMCodeGen in libLLVMScalarOpts

Hal Finkel hfinkel at anl.gov
Wed Feb 19 13:43:05 PST 2014


----- Original Message -----
> From: "Quentin Colombet" <qcolombet at apple.com>
> To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>
> Sent: Wednesday, February 19, 2014 3:30:49 PM
> Subject: [LLVMdev] [RFC] CodeGenPrepare will eventually introduce dependencies to libLLVMCodeGen in libLLVMScalarOpts
> 
> 
> Hi,
> 
> 
> I am working on a patch for CodeGenPrepare, which introduces a use of
> TargetLoweringBase::InstructionOpcodeToISD (see [1] for the
> details).
> This is usual for CodeGenPrepare to use the TargetLowering class when
> it is available, however, using this particular function creates
> linking problems.
> 
> 
> ** Context **
> 
> 
> The TargetLowering class is part of libLLVMCodeGen, which means that
> in theory every consumer of libLLVMScalarOpts would have to link
> against libLLVMCodeGen.
> 
> 
> 
> In practice, so far it was not required because all the functions of
> TargetLowering called in CodeGenPrepare are either:
> - virtual function (resolved dynamically).
> - inlined in the header (code available statically).
> 
> 
> However, if you use a method that does not follow this pattern (like
> TargetLoweringBase::InstructionOpcodeToISD), the problem will show
> up.
> 
> 
> 
> 
> ** Advices Needed **
> 
> 
> What would be the right way of fixing that?
> 
> 
> There are short term solutions:
> - We can inline the functions we need in the header (Hack).
> - We can mark the functions we need as virtual (Hack).
> - We can move the functions elsewhere (where?).
> 
> 
> What would be a longer term solution: i.e., how can we prevent this
> problem to happen again?
> The only thing I can think of is moving CodeGenPrepare elsewhere.
> 

It seems to me that IR optimizations that depend directly on TargetLowering belong in CodeGen. Why don't you just move them all there?

 -Hal

> 
> 
> 
> Thanks for your help,
> 
> 
> -Quentin [1]
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140217/205266.html
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-dev mailing list