Commit Graph

204 Commits

Author SHA1 Message Date
Chris Lattner
1afcace3a3 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
2011-07-09 17:41:24 +00:00
Hans Wennborg
1777299737 Cast unused parameter to void.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132641 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 16:00:19 +00:00
Chris Lattner
1a55c419a6 Fix some minor typos and grammar.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131835 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-22 04:44:48 +00:00
Nick Lewycky
be1532ec66 Declare this function here so that it doesn't get C++ mangling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131379 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-15 07:20:34 +00:00
Chris Lattner
7a2bdde0a0 Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15 05:18:47 +00:00
Rafael Espindola
0d9874b48d Add the alias analysis to the C api.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129447 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 15:44:58 +00:00
Kevin Enderby
bd3327654b Adding support for printing operands symbolically to llvm's public 'C'
disassembler API.  Hooked this up to the ARM target so such tools as Darwin's
otool(1) can now print things like branch targets for example this:
  blx _puts
instead of this:
  blx #-36
And even print the expression encoded in the Mach-O relocation entried for
things like this:
  movt r0, :upper16:((_foo-_bar)+1234)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129284 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 18:08:50 +00:00
Rafael Espindola
45e1a53efd Expose more passes to the C API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129087 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-07 18:20:46 +00:00
Eric Christopher
e243fd9e2b Add a set of C bindings for the Object interface.
Patch by Patrick Walton!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128798 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-03 22:34:07 +00:00
Daniel Dunbar
8470475d6b C-API: Include DataTypes.h instead of stdint.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128446 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-29 02:30:34 +00:00
Kevin Enderby
93f7936435 Again adding a C API to the disassembler for use by such tools as Darwin's
otool(1), this time with the needed fix for case sensitive file systems :) .
This is a work in progress as the interface for producing symbolic operands is
not done.  But a hacked prototype using information from the object file's
relocation entiries and replacing immediate operands with MCExpr's has been
shown to work with no changes to the instrucion printer.  These APIs will be
moved into a dynamic library at some point.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128415 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-28 18:25:07 +00:00
Kevin Enderby
17cbaa3c82 Remove the files for r128308 as it is causing a buildbot failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128309 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-26 00:23:05 +00:00
Kevin Enderby
12b04be85d Adding a C API to the disassembler for use by such tools as Darwin's otool(1).
This is a work in progress as the interface for producing symbolic operands is
not done.  But a hacked prototype using information from the object file's
relocation entiries and replacing immediate operands with MCExpr's has been
shown to work with no changes to the instrucion printer.  These APIs will be
moved into a dynamic library at some point.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128308 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-26 00:06:33 +00:00
Rafael Espindola
6421a8815e Add a lto_codegen_compile_to_file to avoid producing a file, reading it to
memory and writing it back to disk.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128108 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-22 20:57:13 +00:00
Rafael Espindola
f21b1058a1 Add support in the LTO library for loading an object from the middle
of an file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127781 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-17 00:36:11 +00:00
Jim Grosbach
27e2649760 Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127620 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 20:59:06 +00:00
Rafael Espindola
1e09e5b979 Expose getTypeName to the C API. Patch by Patrick Walton.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125845 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18 16:35:37 +00:00
Rafael Espindola
b4cc031a3e Don't open the file again in the gold plugin. To be able to do this, update
MemoryBuffer::getOpenFile to not close the file descriptor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125128 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 22:40:47 +00:00
Devang Patel
6a6623c596 Do not include DataTypes.h in llvm-c/lto.h.
This means avoid using uint32_t. This patch reverts r112200 and fixes original  problem by fixing argument type in lto.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123038 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 22:26:25 +00:00
Michael J. Spencer
3cc52ea33c I swear I did a make clean and make before committing all this...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 18:47:54 +00:00
Michael J. Spencer
1f6efa3996 Merge System into Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 18:16:10 +00:00
Chris Lattner
a1ac3bbec7 add a function to the C api to get the context out of a module, patch
by Eric Dobson!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120259 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 20:03:44 +00:00
Chris Lattner
5400570097 add a 'LLVMConstIntOfArbitraryPrecision' api to the C api,
patch by Greg Pfeil!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119989 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 02:47:22 +00:00
Duncan Sands
4c8a7156e3 Fix comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118016 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 15:12:48 +00:00
Chris Lattner
ffa0e71c33 remove dead prototype, PR8351
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116209 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-11 17:44:22 +00:00
Owen Anderson
aa4897fa13 Add initialization routines for Instrumentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115971 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 20:17:24 +00:00
Owen Anderson
74cfb0ce1c Add initialization routines to InstCombine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115965 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 20:04:55 +00:00
Owen Anderson
b8a1ccfc4b Add initialization routines for VMCore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115963 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 19:51:21 +00:00
Owen Anderson
9966306aa7 Add initialization routines for Target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115957 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 18:50:11 +00:00
Owen Anderson
78b152470d Add initialization routines for CodeGen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115949 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 18:41:20 +00:00
Owen Anderson
861f4c38de Add initialization routines for Analysis and IPA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115946 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 18:31:00 +00:00
Owen Anderson
2c81296bc2 Add an initialization routine for libLLVMipo.a
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115933 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 18:09:59 +00:00
Owen Anderson
fbd121e198 Add a header that I forgot to commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115932 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 18:05:11 +00:00
Owen Anderson
1a3d233621 Next step on the getting-rid-of-static-ctors train: begin adding per-library
initialization functions that initialize the set of passes implemented in
that library.  Add C bindings for these functions as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115927 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 17:55:47 +00:00
Bill Wendling
7afea0cfc4 Add a new scope type "LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN" for the
"linker_private_weak_auto_def" linkage type for LTO.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114868 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 20:17:45 +00:00
Dale Johannesen
401e2d3386 Add missing X86 MMX declarations. Hopefully fixes buildbot?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113643 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 21:58:02 +00:00
Dale Johannesen
bb811a2445 Add X86 MMX type to bitcode and Type.
(The Ada bindings probably need it too, but all the
obvious places to change say "do not edit this file".)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113618 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 20:55:01 +00:00
Eric Christopher
753f3265da Fix LLVM target initialization to deal with sociopathic outside projects
that like to randomly define things like "X86", regenerate autoconf bits
and update cmake.

Fixes PR7852.

Patch by Xerxes Rånby!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112499 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 18:34:48 +00:00
Chris Lattner
61c70e98ac remove unions from LLVM IR. They are severely buggy and not
being actively maintained, improved, or extended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112356 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 04:09:24 +00:00
Devang Patel
767b5b6227 Fix prototypes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112200 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 17:47:45 +00:00
Dan Gohman
92b06c2c06 lto_codegen_set_gcc_path was removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112069 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 18:37:04 +00:00
Bill Wendling
55ae515f9d Create the new linker type "linker_private_weak_def_auto".
It's similar to "linker_private_weak", but it's known that the address of the
object is not taken. For instance, functions that had an inline definition, but
the compiler decided not to inline it. Note, unlike linker_private and
linker_private_weak, linker_private_weak_def_auto may have only default
visibility.  The symbols are removed by the linker from the final linked image
(executable or dynamic library).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111684 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 22:05:50 +00:00
Erick Tryzelaar
f7af931930 Expose LLVMSetOperand and LLVMGetNumOperands to llvm-c and ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111625 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 14:51:22 +00:00
Rafael Espindola
2d643ef328 Make it possible to set the cpu used for codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110759 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 00:15:13 +00:00
Rafael Espindola
98197e55c1 Make it possible to set the flags passed to the assembler.
Nick, please review.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110705 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-10 18:55:09 +00:00
Rafael Espindola
cbb170d057 Make it possible to set the target triple and expose that with an option in the
gold plugin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110604 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-09 21:09:46 +00:00
Eric Christopher
eec5008e77 Fix PR7809 by creating a header for just llvm variables that can be
included in exported interfaces.  Update a couple of exported interfaces.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110532 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-08 02:44:17 +00:00
Chris Lattner
847da55716 start straightening out libedis's dependencies and make it fit
better in the llvm world.  Among other things, this changes:

1. The guts of libedis are now moved into lib/MC/MCDisassembler
2. llvm-mc now depends on lib/MC/MCDisassembler, not tools/edis,
   so edis and mc don't have to be built in series.
3. lib/MC/MCDisassembler no longer depends on the C api, the C
   API depends on it.
4. Various code cleanup changes. 

There is still a lot to be done to make edis fit with the llvm
design, but this is an incremental step in the right direction.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108869 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-20 18:25:19 +00:00
Duncan Sands
837a0c3b05 Expose BasicBlock::moveBefore and moveAfter in C API, patch
by Benjamin Saunders.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108699 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 15:31:07 +00:00
Duncan Sands
d90fee9b42 Expose JIT::recompileAndRelinkFunction for use through the C API.
Patch by Benjamin Saunders.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108690 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-19 09:33:13 +00:00