aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-07-09 17:41:24 +0000
committerChris Lattner <sabre@nondot.org>2011-07-09 17:41:24 +0000
commit1afcace3a3a138b1b18e5c6270caa8dae2261ae2 (patch)
tree2fed26ec8965151524b81246c7fa7c3e2382fd31
parentc36ed70ec5c3c99f9559cfaa199373f60219a2be (diff)
Land the long talked about "type system rewrite" patch. This
patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--docs/LangRef.html149
-rw-r--r--docs/ProgrammersManual.html196
-rw-r--r--include/llvm-c/Core.h23
-rw-r--r--include/llvm-c/Transforms/IPO.h3
-rw-r--r--include/llvm/AbstractTypeUser.h205
-rw-r--r--include/llvm/Bitcode/LLVMBitCodes.h57
-rw-r--r--include/llvm/Constants.h16
-rw-r--r--include/llvm/DefaultPasses.h1
-rw-r--r--include/llvm/DerivedTypes.h192
-rw-r--r--include/llvm/Function.h4
-rw-r--r--include/llvm/GlobalAlias.h10
-rw-r--r--include/llvm/GlobalValue.h4
-rw-r--r--include/llvm/InitializePasses.h1
-rw-r--r--include/llvm/Instructions.h82
-rw-r--r--include/llvm/LinkAllPasses.h1
-rw-r--r--include/llvm/Module.h76
-rw-r--r--include/llvm/Support/PassManagerBuilder.h2
-rw-r--r--include/llvm/Transforms/IPO.h7
-rw-r--r--include/llvm/Transforms/Utils/ValueMapper.h34
-rw-r--r--include/llvm/Type.h332
-rw-r--r--include/llvm/TypeSymbolTable.h152
-rw-r--r--include/llvm/Value.h23
-rw-r--r--lib/AsmParser/LLLexer.h4
-rw-r--r--lib/AsmParser/LLParser.cpp575
-rw-r--r--lib/AsmParser/LLParser.h87
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp390
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.h10
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp113
-rw-r--r--lib/Bitcode/Writer/ValueEnumerator.cpp114
-rw-r--r--lib/Bitcode/Writer/ValueEnumerator.h3
-rw-r--r--lib/CodeGen/ShadowStackGC.cpp49
-rw-r--r--lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp1
-rw-r--r--lib/Linker/LinkModules.cpp1816
-rw-r--r--lib/Target/CBackend/CBackend.cpp217
-rw-r--r--lib/Target/CppBackend/CPPBackend.cpp88
-rw-r--r--lib/Target/TargetData.cpp51
-rw-r--r--lib/Transforms/IPO/CMakeLists.txt1
-rw-r--r--lib/Transforms/IPO/DeadTypeElimination.cpp112
-rw-r--r--lib/Transforms/IPO/IPO.cpp5
-rw-r--r--lib/Transforms/IPO/MergeFunctions.cpp1
-rw-r--r--lib/Transforms/IPO/StripSymbols.cpp24
-rw-r--r--lib/Transforms/Utils/CloneModule.cpp24
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp22
-rw-r--r--lib/Transforms/Utils/ValueMapper.cpp107
-rw-r--r--lib/VMCore/AsmWriter.cpp441
-rw-r--r--lib/VMCore/CMakeLists.txt1
-rw-r--r--lib/VMCore/ConstantFold.cpp2
-rw-r--r--lib/VMCore/Constants.cpp56
-rw-r--r--lib/VMCore/ConstantsContext.h142
-rw-r--r--lib/VMCore/Core.cpp49
-rw-r--r--lib/VMCore/Function.cpp6
-rw-r--r--lib/VMCore/Globals.cpp1
-rw-r--r--lib/VMCore/InlineAsm.cpp2
-rw-r--r--lib/VMCore/Instructions.cpp66
-rw-r--r--lib/VMCore/LLVMContextImpl.cpp18
-rw-r--r--lib/VMCore/LLVMContextImpl.h47
-rw-r--r--lib/VMCore/Metadata.cpp1
-rw-r--r--lib/VMCore/Module.cpp178
-rw-r--r--lib/VMCore/Type.cpp1205
-rw-r--r--lib/VMCore/TypeSymbolTable.cpp168
-rw-r--r--lib/VMCore/TypesContext.h426
-rw-r--r--lib/VMCore/Value.cpp15
-rw-r--r--lib/VMCore/Verifier.cpp130
-rw-r--r--test/Assembler/2002-07-25-ReturnPtrFunction.ll6
-rw-r--r--test/Assembler/2002-12-15-GlobalResolve.ll2
-rw-r--r--test/Assembler/2003-04-15-ConstantInitAssertion.ll2
-rw-r--r--test/Assembler/2003-05-21-MalformedStructCrash.ll2
-rw-r--r--test/Assembler/2004-11-28-InvalidTypeCrash.ll2
-rw-r--r--test/Assembler/getelementptr.ll6
-rw-r--r--test/CodeGen/Generic/crash.ll2
-rw-r--r--test/CodeGen/X86/2010-02-12-CoalescerBug-Impdef.ll4
-rw-r--r--test/CodeGen/X86/2010-11-09-MOVLPS.ll2
-rw-r--r--test/CodeGen/X86/fp-stack-2results.ll24
-rw-r--r--test/CodeGen/X86/pr3317.ll2
-rw-r--r--test/Feature/globalvars.ll4
-rw-r--r--test/Feature/testtype.ll4
-rw-r--r--test/FrontendC/mmx-inline-asm.c2
-rw-r--r--test/Linker/2003-01-30-LinkerTypeRename.ll3
-rw-r--r--test/Linker/2003-08-23-GlobalVarLinking.ll2
-rw-r--r--test/Linker/2003-08-23-RecursiveOpaqueTypeResolve.ll3
-rw-r--r--test/Linker/2003-08-28-TypeResolvesGlobal.ll2
-rw-r--r--test/Linker/testlink1.ll99
-rw-r--r--test/Linker/testlink2.ll48
-rw-r--r--test/Linker/unnamed-addr1-a.ll6
-rw-r--r--test/Other/constant-fold-gep.ll78
-rw-r--r--test/Transforms/ConstProp/extractvalue.ll7
-rw-r--r--test/Transforms/ConstProp/insertvalue.ll25
-rw-r--r--test/Transforms/ConstProp/overflow-ops.ll39
-rw-r--r--test/Transforms/DeadArgElim/keepalive.ll2
-rw-r--r--test/Transforms/GlobalOpt/2005-09-27-Crash.ll2
-rw-r--r--test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll4
-rw-r--r--test/Transforms/InstCombine/getelementptr.ll19
-rw-r--r--test/Transforms/InstCombine/phi.ll2
-rw-r--r--test/Transforms/InstCombine/vec_narrow.ll12
-rw-r--r--test/Transforms/InstCombine/vec_shuffle.ll29
-rw-r--r--test/Transforms/LowerSetJmp/simpletest.ll1
-rw-r--r--test/Transforms/MemCpyOpt/memcpy.ll8
-rw-r--r--test/Transforms/Reassociate/2011-01-26-UseAfterFree.ll2
-rw-r--r--test/Transforms/SCCP/ipsccp-basic.ll8
-rw-r--r--test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll6
-rw-r--r--test/Transforms/ScalarRepl/copy-aggregate.ll11
-rw-r--r--test/Transforms/ScalarRepl/phi-select.ll4
-rw-r--r--test/Verifier/2002-04-13-RetTypes.ll2
-rw-r--r--test/Verifier/2008-11-15-RetVoid.ll2
-rw-r--r--tools/bugpoint/ExtractFunction.cpp2
-rw-r--r--tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp45
-rw-r--r--tools/llvm-extract/llvm-extract.cpp1
-rw-r--r--unittests/CMakeLists.txt1
-rw-r--r--unittests/VMCore/DerivedTypesTest.cpp88
109 files changed, 3032 insertions, 5933 deletions
diff --git a/docs/LangRef.html b/docs/LangRef.html
index 08d84df4a8..5959b3d5dc 100644
--- a/docs/LangRef.html
+++ b/docs/LangRef.html
@@ -74,16 +74,14 @@
<ol>
<li><a href="#t_array">Array Type</a></li>
<li><a href="#t_struct">Structure Type</a></li>
- <li><a href="#t_pstruct">Packed Structure Type</a></li>
+ <li><a href="#t_opaque">Opaque Type</a></li>
<li><a href="#t_vector">Vector Type</a></li>
</ol>
</li>
<li><a href="#t_function">Function Type</a></li>
<li><a href="#t_pointer">Pointer Type</a></li>
- <li><a href="#t_opaque">Opaque Type</a></li>
</ol>
</li>
- <li><a href="#t_uprefs">Type Up-references</a></li>
</ol>
</li>
<li><a href="#constants">Constants</a>
@@ -1535,7 +1533,6 @@ synchronization behavior.</p>
<a href="#t_function">function</a>,
<a href="#t_pointer">pointer</a>,
<a href="#t_struct">structure</a>,
- <a href="#t_pstruct">packed structure</a>,
<a href="#t_vector">vector</a>,
<a href="#t_opaque">opaque</a>.
</td>
@@ -1703,7 +1700,9 @@ synchronization behavior.</p>
possible to have a two dimensional array, using an array as the element type
of another array.</p>
-
+</div>
+
+
<!-- _______________________________________________________________________ -->
<h4>
<a name="t_aggregate">Aggregate Types</a>
@@ -1842,9 +1841,7 @@ synchronization behavior.</p>
<h5>Overview:</h5>
<p>The structure type is used to represent a collection of data members together
- in memory. The packing of the field types is defined to match the ABI of the
- underlying processor. The elements of a structure may be any type that has a
- size.</p>
+ in memory. The elements of a structure may be any type that has a size.</p>
<p>Structures in memory are accessed using '<tt><a href="#i_load">load</a></tt>'
and '<tt><a href="#i_store">store</a></tt>' by getting a pointer to a field
@@ -1852,66 +1849,76 @@ synchronization behavior.</p>
Structures in registers are accessed using the
'<tt><a href="#i_extractvalue">extractvalue</a></tt>' and
'<tt><a href="#i_insertvalue">insertvalue</a></tt>' instructions.</p>
+
+<p>Structures may optionally be "packed" structures, which indicate that the
+ alignment of the struct is one byte, and that there is no padding between
+ the elements. In non-packed structs, padding between field types is defined
+ by the target data string to match the underlying processor.</p>
+
+<p>Structures can either be "anonymous" or "named". An anonymous structure is
+ defined inline with other types (e.g. <tt>{i32, i32}*</tt>) and a named types
+ are always defined at the top level with a name. Anonmyous types are uniqued
+ by their contents and can never be recursive since there is no way to write
+ one. Named types can be recursive.
+</p>
+
<h5>Syntax:</h5>
<pre>
- { &lt;type list&gt; }
+ %T1 = type { &lt;type list&gt; } <i>; Named normal struct type</i>
+ %T2 = type &lt;{ &lt;type list&gt; }&gt; <i>; Named packed struct type</i>
</pre>
-
+
<h5>Examples:</h5>
<table class="layout">
<tr class="layout">
<td class="left"><tt>{ i32, i32, i32 }</tt></td>
<td class="left">A triple of three <tt>i32</tt> values</td>
- </tr><tr class="layout">
+ </tr>
+ <tr class="layout">
<td class="left"><tt>{&nbsp;float,&nbsp;i32&nbsp;(i32)&nbsp;*&nbsp;}</tt></td>
<td class="left">A pair, where the first element is a <tt>float</tt> and the
second element is a <a href="#t_pointer">pointer</a> to a
<a href="#t_function">function</a> that takes an <tt>i32</tt>, returning
an <tt>i32</tt>.</td>
</tr>
+ <tr class="layout">
+ <td class="left"><tt>&lt;{ i8, i32 }&gt;</tt></td>
+ <td class="left">A packed struct known to be 5 bytes in size.</td>
+ </tr>
</table>
</div>
-
+
<!-- _______________________________________________________________________ -->
<h4>
- <a name="t_pstruct">Packed Structure Type</a>
+ <a name="t_opaque">Opaque Type</a>
</h4>
<div>
<h5>Overview:</h5>
-<p>The packed structure type is used to represent a collection of data members
- together in memory. There is no padding between fields. Further, the
- alignment of a packed structure is 1 byte. The elements of a packed
- structure may be any type that has a size.</p>
-
-<p>Structures are accessed using '<tt><a href="#i_load">load</a></tt> and
- '<tt><a href="#i_store">store</a></tt>' by getting a pointer to a field with
- the '<tt><a href="#i_getelementptr">getelementptr</a></tt>' instruction.</p>
+<p>Opaque types are used to represent named structure types that do not have a
+ body specified. This corresponds (for example) to the C notion of a forward
+ declared structure.</p>
<h5>Syntax:</h5>
<pre>
- &lt; { &lt;type list&gt; } &gt;
+ %X = type opaque
+ %52 = type opaque
</pre>
<h5>Examples:</h5>
<table class="layout">
<tr class="layout">
- <td class="left"><tt>&lt; { i32, i32, i32 } &gt;</tt></td>
- &