Commit Graph

109 Commits

Author SHA1 Message Date
Owen Anderson
001dbfebcb Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a number of issues in
our current context-passing stuff, which is also fixed here


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76089 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-16 18:04:31 +00:00
Owen Anderson
9adc0abad3 Move EVER MORE stuff over to LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 23:09:55 +00:00
Owen Anderson
0a5372ed3e Begin the painful process of tearing apart the rat'ss nest that is Constants.cpp and ConstantFold.cpp.
This involves temporarily hard wiring some parts to use the global context.  This isn't ideal, but it's
the only way I could figure out to make this process vaguely incremental.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75445 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-13 04:09:18 +00:00
Owen Anderson
333c400965 This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75200 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09 23:48:35 +00:00
Owen Anderson
d1fbd14294 Push LLVMContext _back_ through IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75040 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 20:50:47 +00:00
Owen Anderson
e9b11b4313 Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75025 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 19:03:57 +00:00
Owen Anderson
3d29df3e8a Push LLVMContext through GlobalVariables and IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 01:26:06 +00:00
Owen Anderson
4434ed44c4 Make the use of const with respect to LLVMContext sane. Hopefully this is the last time, for the
moment, that I will need to make far-reaching changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74655 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 23:13:44 +00:00
Owen Anderson
31895e7359 Hold the LLVMContext by reference rather than by pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 21:22:36 +00:00
Owen Anderson
8b477ed579 Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools.

Patches for Clang and LLVM-GCC to follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74614 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 16:58:40 +00:00
Chris Lattner
0fd38069cb improve the APIs for creating struct and function types with no arguments/elements
to not have to create a temporary vector (in the API at least).  Patch by Jay Foad!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 04:13:31 +00:00
Chris Lattner
da06288aeb make sure that JIT examples link in their appropriate target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73613 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 16:48:44 +00:00
Chris Lattner
d25bff6d52 silence a warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69117 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 00:16:05 +00:00
Bill Wendling
7126702edf Get rid of some compile warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68978 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 19:45:05 +00:00
Nick Lewycky
9f85634bd2 Add Kaleidoscope to examples/ so that it gets built regularly and we'll notice
if an API change causes it to be out of date. The code is copied out of
LangImpl7.html.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68912 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 20:47:23 +00:00
Torok Edwin
eb55f3ea3c Another attempt at fixing PR2975.
Types can have references to eachother, so we can't just call destroy on them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68523 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 17:23:02 +00:00
Torok Edwin
5ce1b11412 revert r68457, its crashing in make check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68459 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 20:57:34 +00:00
Torok Edwin
59d5f83b32 fix (part of) memory leak on shutdown. See PR2975.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68457 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 20:49:21 +00:00
Chris Lattner
824b958e6f reapply Sanjiv's patch to genericize memcpy/memset/memmove to take an
arbitrary integer width for the count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59823 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 16:42:48 +00:00
Bill Wendling
dc770929cb Revert r59802. It was breaking the build of llvm-gcc:
g++ -m32 -c -g -DIN_GCC -W -Wall -Wwrite-strings -Wmissing-format-attribute -fno-common -mdynamic-no-pic -DHAVE_CONFIG_H -Wno-unused -DTARGET_NAME=\"i386-apple-darwin9.5.0\" -I. -I. -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/. -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include  -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include -DENABLE_LLVM -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/../llvm.src/include  -D_DEBUG  -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS   -I. -I. -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/. -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include  -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include ../../llvm-gcc.src/gcc/llvm-types.cpp -o llvm-types.o
../../llvm-gcc.src/gcc/llvm-convert.cpp: In member function 'void TreeToLLVM::EmitMemCpy(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)':
../../llvm-gcc.src/gcc/llvm-convert.cpp:1496: error: 'memcpy_i32' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp:1496: error: 'memcpy_i64' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp: In member function 'void TreeToLLVM::EmitMemMove(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)':
../../llvm-gcc.src/gcc/llvm-convert.cpp:1512: error: 'memmove_i32' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp:1512: error: 'memmove_i64' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp: In member function 'void TreeToLLVM::EmitMemSet(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)':
../../llvm-gcc.src/gcc/llvm-convert.cpp:1528: error: 'memset_i32' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp:1528: error: 'memset_i64' is not a member of 'llvm::Intrinsic'
make[3]: *** [llvm-convert.o] Error 1
make[3]: *** Waiting for unfinished jobs....
rm fsf-funding.pod gcov.pod gfdl.pod cpp.pod gpl.pod gcc.pod
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59809 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 09:09:41 +00:00
Sanjiv Gupta
219ab405e6 Make mem[cpy,move,set] intrinsics overloaded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 07:49:09 +00:00
Oscar Fuentes
57bd83be19 CMake: use add_llvm_example for HowToUseJIT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57944 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 02:52:59 +00:00
Oscar Fuentes
dbc2e856fc CMake: Builds all examples. Corrected name of CBackend target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56682 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 19:48:03 +00:00
Oscar Fuentes
3d01fc7de8 Initial support for the CMake build system.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 01:08:49 +00:00
Chris Lattner
944fac71e0 Switch the asmprinter (.ll) and all the stuff it requires over to
use raw_ostream instead of std::ostream.  Among other goodness,
this speeds up llvm-dis of kc++ with a release build from 0.85s
to 0.49s (88% faster).

Other interesting changes:
 1) This makes Value::print be non-virtual.
 2) AP[S]Int and ConstantRange can no longer print to ostream directly, 
    use raw_ostream instead.
 3) This fixes a bug in raw_os_ostream where it didn't flush itself 
    when destroyed.
 4) This adds a new SDNode::print method, instead of only allowing "dump".


A lot of APIs have both std::ostream and raw_ostream versions, it would
be useful to go through and systematically anihilate the std::ostream 
versions.

This passes dejagnu, but there may be minor fallout, plz let me know if
so and I'll fix it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55263 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 22:23:09 +00:00
Chris Lattner
ef5dc366e7 use proper namespace qualifications
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55259 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 22:00:15 +00:00
Anton Korobeynikov
c40c8b333d Remove asmprinters from examples by default. This reduces their size by ~5%
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54890 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 13:55:33 +00:00
Chris Lattner
fad86b003a Rework the routines that convert AP[S]Int into a string. Now, instead of
returning an std::string by value, it fills in a SmallString/SmallVector
passed in.  This significantly reduces string thrashing in some cases.

More specifically, this:
 - Adds an operator<< and a print method for APInt that allows you to 
   directly send them to an ostream.
 - Reimplements APInt::toString to be much simpler and more efficient
   algorithmically in addition to not thrashing strings quite as much.

This speeds up llvm-dis on kc++ by 7%, and may also slightly speed up the
asmprinter.  This also fixes a bug I introduced into the asmwriter in a
previous patch w.r.t. alias printing.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54873 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 07:19:36 +00:00
Eric Christopher
7a61d701c0 Have IRBuilder take a template argument on whether or not to preserve
names. This can save a lot of allocations if you aren't going to be
looking at the output.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 19:39:37 +00:00
Gabor Greif
7cbd8a3e92 API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interfaces will be in place for some time. (Merge from use-diet branch.)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51200 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-16 19:29:10 +00:00
Gabor Greif
b1dbcd886a Fix a bunch of 80col violations that arose from the Create API change. Tweak makefile targets to find these better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51143 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-15 10:04:30 +00:00
Duncan Sands
89f6d88db3 Merge LLVMBuilder and FoldingBuilder, calling
the result IRBuilder.  Patch by Dominic Hamon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49604 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 06:22:09 +00:00
Chris Lattner
7098772436 silence warning when assertions are disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49371 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 05:49:09 +00:00
Duncan Sands
e2c4304654 Use Intrinsic::getDeclaration in more places.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49338 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 13:45:04 +00:00
Gabor Greif
051a950000 API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 20:25:17 +00:00
Chris Lattner
7520fcd7a5 Fix an incorrect comment, PR2147.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48323 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 03:29:42 +00:00
Chris Lattner
fc001bbfc3 remove attributions from examples.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45420 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:37:57 +00:00
Chris Lattner
57360d1f1c remove attributions from the rest of the llvm makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45416 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:11:13 +00:00
Christopher Lamb
43ad6b3e0d Change the PointerType api for creating pointer types. The old functionality of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45082 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 01:12:55 +00:00
Chris Lattner
bef8e0b0a7 add a new BF->LLVM translator, contributed by Sterling Stein.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41881 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12 18:24:00 +00:00
Chris Lattner
9132a2b818 rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()
Add an APSInt::toString() method.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41309 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-23 05:15:32 +00:00
Gabor Greif
a99be51bf5 Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37913 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-05 17:07:56 +00:00
Owen Anderson
241c3dac3f Remove BFtoLLVM. It was old, and a poor example because it didn't use best practices for making
a LLVM frontend in C++.  Maybe someday it will be rewritten..


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37858 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-03 21:36:47 +00:00
Chris Lattner
4bcca0f2ac switch this to bitcode instead of bytecode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36867 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 09:29:13 +00:00
Reid Spencer
c20c6c346c Revert last patch. The examples build now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34970 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 17:26:14 +00:00
Reid Spencer
34bd70de3c Adjust for changes in GenericValue type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34969 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 17:24:31 +00:00
Chris Lattner
3c2319e245 temporarily disable this until Reid has a chance to fix it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34962 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-06 07:30:03 +00:00
Chris Lattner
680f2f016e eliminate vector-related ctors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34227 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-13 06:06:26 +00:00
Reid Spencer
56427031f6 Fix a #include to resolve IntegerType class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33385 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-19 22:45:50 +00:00
Reid Spencer
bc0895a596 Add a #include to resolve IntegerType class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33384 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-19 22:45:05 +00:00