Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Commit

Permalink
Remove TypeBuilder.h, and fix the few locations using it.
Browse files Browse the repository at this point in the history
This shortcut mechanism for creating types was added 10 years ago, but
has seen almost no uptake since then, neither internally nor in
external projects.

The very small number of characters saved by using it does not seem
worth the mental overhead of an additional type-creation API, so,
delete it.

Differential Revision: https://reviews.llvm.org/D56573

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351020 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
jyknight committed Jan 13, 2019
1 parent d716eb5 commit a564740
Show file tree
Hide file tree
Showing 17 changed files with 123 additions and 831 deletions.
8 changes: 0 additions & 8 deletions docs/ExtendingLLVM.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,6 @@ Adding a fundamental type
add enum ``LLVMTypeKind`` and modify
``LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty)`` for the new type

#. ``llvm/include/llvm/IR/TypeBuilder.h``:

add new class to represent new type in the hierarchy

#. ``llvm/lib/AsmParser/LLLexer.cpp``:

add ability to parse in the type from text assembly
Expand Down Expand Up @@ -299,10 +295,6 @@ Adding a derived type
add enum ``LLVMTypeKind`` and modify
`LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty)` for the new type

#. ``llvm/include/llvm/IR/TypeBuilder.h``:

add new class to represent new class in the hierarchy

#. ``llvm/lib/AsmParser/LLLexer.cpp``:

modify ``lltok::Kind LLLexer::LexIdentifier()`` to add ability to
Expand Down
31 changes: 0 additions & 31 deletions docs/ProgrammersManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2905,37 +2905,6 @@ For example:
GV->eraseFromParent();


.. _create_types:

How to Create Types
-------------------

In generating IR, you may need some complex types. If you know these types
statically, you can use ``TypeBuilder<...>::get()``, defined in
``llvm/Support/TypeBuilder.h``, to retrieve them. ``TypeBuilder`` has two forms
depending on whether you're building types for cross-compilation or native
library use. ``TypeBuilder<T, true>`` requires that ``T`` be independent of the
host environment, meaning that it's built out of types from the ``llvm::types``
(`doxygen <http://llvm.org/doxygen/namespacellvm_1_1types.html>`__) namespace
and pointers, functions, arrays, etc. built of those. ``TypeBuilder<T, false>``
additionally allows native C types whose size may depend on the host compiler.
For example,

.. code-block:: c++

FunctionType *ft = TypeBuilder<types::i<8>(types::i<32>*), true>::get();

is easier to read and write than the equivalent

.. code-block:: c++

std::vector<const Type*> params;
params.push_back(PointerType::getUnqual(Type::Int32Ty));
FunctionType *ft = FunctionType::get(Type::Int8Ty, params, false);
See the `class comment
<http://llvm.org/doxygen/TypeBuilder_8h_source.html#l00001>`_ for more details.

.. _threading:

Threads and LLVM
Expand Down
Loading

0 comments on commit a564740

Please sign in to comment.