[llvm] r328065 - Move DataTypes.h from Support to llvm-c to fix layering.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 20 18:21:49 PDT 2018


On Tue, Mar 20, 2018 at 6:01 PM Friedman, Eli <efriedma at codeaurora.org>
wrote:

> On 3/20/2018 5:48 PM, David Blaikie via llvm-commits wrote:
> > Author: dblaikie
> > Date: Tue Mar 20 17:48:05 2018
> > New Revision: 328065
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=328065&view=rev
> > Log:
> > Move DataTypes.h from Support to llvm-c to fix layering.
> >
> > Support depends on llvm-c (a few typedefs, macros, etc - Types.h,
> > Disassembler.h, and TargetMachine.h.
> >
> > This could be done the other way - those macros/typedefs/etc could be
> > moved into Support and used from llvm-c instead. If someone feels that's
> > a better direction to go, happy to discuss it/try it out/etc.
>
> This seems backwards.
>
> include/llvm-c/* is the C API wrapper, which allows code written in
> languages other than C++ to call LLVM APIs.  There shouldn't be any
> dependencies from include/llvm/* to include/llvm-c/*.
>

Yeah, I have some of the same feelings, though they seem pretty broad (see
below).

I think the llvm-c API is basically implemented across LLVM in all the
libraries that implement the underlying functionality (eg:
lib/Target/Target.cpp implements lots of llvm-c's LLVMTarget* functions -
rather than them being implemented in lib/llvm-c).

(the dependencies on llvm-c/* from include/llvm are smaller - mostly just
those macros/typedefs I mentioned - which could mostly be moved into llvm,
or rewritten to not use those macros (well, only if we moved the lib
implementations too - because they depend on the macros that stamp out
wrap/unwrap, etc))

 $ grep -r "llvm-c\/" lib include | grep -v "^include/llvm-c" | grep -v
"^lib/llvm-c"
lib/CodeGen/CodeGen.cpp:#include "llvm-c/Initialization.h"
lib/MC/MCDisassembler/Disassembler.h:#include "llvm-c/Disassembler.h"
lib/MC/MCDisassembler/Disassembler.cpp:#include "llvm-c/Disassembler.h"
lib/MC/MCDisassembler/Disassembler.cpp:// the header llvm-c/Disassembler.h
.  The pointer to the block and the
lib/MC/MCDisassembler/MCRelocationInfo.cpp:#include "llvm-c/Disassembler.h"
lib/Object/Object.cpp:#include "llvm-c/Object.h"
lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp:#include
"llvm-c/Disassembler.h"
lib/Target/TargetMachineC.cpp:#include "llvm-c/Core.h"
lib/Target/TargetMachineC.cpp:#include "llvm-c/Target.h"
lib/Target/TargetMachineC.cpp:#include "llvm-c/TargetMachine.h"
lib/Target/Target.cpp:#include "llvm-c/Target.h"
lib/Target/Target.cpp:#include "llvm-c/Initialization.h"
lib/Target/Target.cpp:// Avoid including "llvm-c/Core.h" for compile time,
fwd-declare this instead.
lib/Target/ARM/MCTargetDesc/ARMMachORelocationInfo.cpp:#include
"llvm-c/Disassembler.h"
lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp:#include
"llvm-c/Disassembler.h"
lib/Linker/LinkModules.cpp:#include "llvm-c/Linker.h"
lib/IR/DebugInfo.cpp:#include "llvm-c/DebugInfo.h"
lib/IR/Comdat.cpp:#include "llvm-c/Comdat.h"
lib/IR/Core.cpp:#include "llvm-c/Core.h"
lib/Support/PrettyStackTrace.cpp:#include "llvm-c/ErrorHandling.h"
lib/Support/ErrorHandling.cpp:#include "llvm-c/ErrorHandling.h"
lib/Support/CommandLine.cpp:#include "llvm-c/Support.h"
lib/Support/DynamicLibrary.cpp:#include "llvm-c/Support.h"
lib/IRReader/IRReader.cpp:#include "llvm-c/IRReader.h"
lib/Analysis/Analysis.cpp:#include "llvm-c/Analysis.h"
lib/Analysis/Analysis.cpp:#include "llvm-c/Initialization.h"
lib/Transforms/Scalar/Scalar.cpp:#include "llvm-c/Initialization.h"
lib/Transforms/Scalar/Scalar.cpp:#include "llvm-c/Transforms/Scalar.h"
lib/Transforms/InstCombine/InstructionCombining.cpp:#include
"llvm-c/Initialization.h"
lib/Transforms/Vectorize/Vectorize.cpp:#include "llvm-c/Initialization.h"
lib/Transforms/Vectorize/Vectorize.cpp:#include
"llvm-c/Transforms/Vectorize.h"
lib/Transforms/IPO/IPO.cpp:#include "llvm-c/Transforms/IPO.h"
lib/Transforms/IPO/IPO.cpp:#include "llvm-c/Initialization.h"
lib/Transforms/IPO/PassManagerBuilder.cpp:#include
"llvm-c/Transforms/PassManagerBuilder.h"
lib/Transforms/ObjCARC/ObjCARC.cpp:#include "llvm-c/Initialization.h"
lib/Transforms/Instrumentation/Instrumentation.cpp:#include
"llvm-c/Initialization.h"
lib/Transforms/Utils/Utils.cpp:#include "llvm-c/Initialization.h"
lib/ExecutionEngine/Orc/OrcCBindings.cpp:#include "llvm-c/OrcBindings.h"
lib/ExecutionEngine/Orc/OrcCBindingsStack.h:#include "llvm-c/OrcBindings.h"
lib/ExecutionEngine/Orc/OrcCBindingsStack.h:#include
"llvm-c/TargetMachine.h"
lib/ExecutionEngine/ExecutionEngineBindings.cpp:#include
"llvm-c/ExecutionEngine.h"
lib/Bitcode/Reader/BitReader.cpp:#include "llvm-c/BitReader.h"
lib/Bitcode/Reader/BitReader.cpp:#include "llvm-c/Core.h"
lib/Bitcode/Writer/BitWriter.cpp:#include "llvm-c/BitWriter.h"
include/llvm/MC/MCDisassembler/MCExternalSymbolizer.h:#include
"llvm-c/Disassembler.h"
include/llvm/MC/MCDisassembler/MCExternalSymbolizer.h:/// See
llvm-c/Disassembler.h.
include/llvm/MC/MCDisassembler/MCRelocationInfo.h:  /// The VariantKinds
are defined in llvm-c/Disassembler.h.
include/llvm/IR/IRBuilder.h:#include "llvm-c/Types.h"
include/llvm/IR/Comdat.h:#include "llvm-c/Types.h"
include/llvm/IR/DiagnosticInfo.h:#include "llvm-c/Types.h"
include/llvm/IR/Attributes.h:#include "llvm-c/Types.h"
include/llvm/IR/Use.h:#include "llvm-c/Types.h"
include/llvm/IR/LLVMContext.h:#include "llvm-c/Types.h"
include/llvm/IR/BasicBlock.h:#include "llvm-c/Types.h"
include/llvm/IR/Module.h:#include "llvm-c/Types.h"
include/llvm/IR/Value.h:#include "llvm-c/Types.h"
include/llvm/Support/CBindingWrapping.h:#include "llvm-c/Types.h"
include/llvm/Support/CodeGenCWrappers.h:#include "llvm-c/TargetMachine.h"
include/llvm/Support/TargetRegistry.h:#include "llvm-c/Disassembler.h"
include/llvm/Support/DataTypes.h:#include "llvm-c/DataTypes.h"
include/llvm/Support/MemoryBuffer.h:#include "llvm-c/Types.h"
include/llvm/LTO/legacy/LTOCodeGenerator.h:#include "llvm-c/lto.h"
include/llvm/LTO/legacy/LTOModule.h:#include "llvm-c/lto.h"
include/llvm/LTO/legacy/ThinLTOCodeGenerator.h:#include "llvm-c/lto.h"
include/llvm/ExecutionEngine/ExecutionEngine.h:#include
"llvm-c/ExecutionEngine.h"
include/llvm/ExecutionEngine/RTDyldMemoryManager.h:#include
"llvm-c/ExecutionEngine.h"

> -Eli
>
> --
> Employee of Qualcomm Innovation Center, Inc.
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
> Foundation Collaborative Project
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180321/e1d98f99/attachment.html>


More information about the llvm-commits mailing list