Commit Graph

167 Commits

Author SHA1 Message Date
Douglas Gregor 3a66952bea Make ParallelJIT pthreads linking with CMake slightly less broken
llvm-svn: 83820
2009-10-12 04:00:13 +00:00
Victor Hernandez e6ff7662b6 Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
llvm-svn: 82784
2009-09-25 18:11:52 +00:00
Victor Hernandez 46cd467310 Auto-upgrade malloc instructions to malloc calls.
Reviewed by Devang Patel.

llvm-svn: 82694
2009-09-24 17:47:49 +00:00
Erick Tryzelaar 21e83eab3f Add examples for Kaleidoscope chapters 2 through 6.
Conflicts:

	examples/Makefile

llvm-svn: 82574
2009-09-22 21:15:19 +00:00
Erick Tryzelaar 2d8813cfb0 Rename Kaleidoscope to show that it's for Chapter 7 of the tutorial.
llvm-svn: 82573
2009-09-22 21:15:00 +00:00
Erick Tryzelaar 6e2b34bc14 Sync c++ kaleidoscope tutorial with test.
llvm-svn: 82572
2009-09-22 21:14:49 +00:00
Reid Kleckner ab7700479f Allocate the module provider in the Kaleidoscope code on the heap, not the stack, so that it can be properly deleted. Also update the tutorial with the new code. This fixes PR4762, hopefully better than the last time.
llvm-svn: 80138
2009-08-26 20:58:25 +00:00
Dan Gohman 61a8796ddb Make LLVM command-line tools overwrite their output files without -f.
This is conventional command-line tool behavior. -f now just means
"enable binary output on terminals".

Add a -f option to llvm-extract and llvm-link, for consistency.

Remove F_Force from raw_fd_ostream and enable overwriting and
truncating by default. Introduce an F_Excl flag to permit users to
enable a failure when the file already exists. This flag is
currently unused.

Update Makefiles and documentation accordingly.

llvm-svn: 79990
2009-08-25 15:34:52 +00:00
Reid Kleckner e56676a3cc Fixed double free in Kaleidoscope. Fixes PR4762.
llvm-svn: 79896
2009-08-24 05:42:21 +00:00
Chris Lattner 6973395cc7 eliminate the std::ostream forms of the bitcode writing APIs.
llvm-svn: 79840
2009-08-23 07:49:08 +00:00
Oscar Fuentes 349df2c976 CMake: LLVMConfig assigns LLVMX86 to the `native' component
name. Updated LLVM_LINK_COMPONENTS of Kaleidoscope.

llvm-svn: 79219
2009-08-17 01:41:46 +00:00
Owen Anderson 55f1c09e31 Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Owen Anderson 5a1acd9912 Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.

llvm-svn: 77721
2009-07-31 20:28:14 +00:00
Owen Anderson 4056ca9568 Move types back to the 2.5 API.
llvm-svn: 77516
2009-07-29 22:17:13 +00:00
Owen Anderson c2c7932c64 Change ConstantArray to 2.5 API.
llvm-svn: 77347
2009-07-28 18:32:17 +00:00
Owen Anderson 69c464dec4 Move ConstantFP construction back to the 2.5-ish API.
llvm-svn: 77247
2009-07-27 20:59:43 +00:00
Owen Anderson edb4a70325 Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
llvm-svn: 77011
2009-07-24 23:12:02 +00:00
Owen Anderson 47db941fd3 Get rid of the Pass+Context magic.
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Eli Friedman e04169cc21 PR4591: Make sure to initialize the pass manager before using it.
llvm-svn: 76422
2009-07-20 14:50:07 +00:00
Daniel Dunbar c8fb7c61a9 Fix build
llvm-svn: 76366
2009-07-19 08:27:16 +00:00
Xerxes Ranby 68602758e4 Fix: Kaleidoscope link in JIT and Interpreter by including JIT.h and Interpreter.h
llvm-svn: 76363
2009-07-19 08:10:01 +00:00
Reid Kleckner fc8a2d5a83 Add EngineBuilder to ExecutionEngine in favor of the five optional argument EE::create().
Also a test commit.

llvm-svn: 76276
2009-07-18 00:42:18 +00:00
Owen Anderson c277dc408b Privatize the ConstantFP table. I'm on a roll!
llvm-svn: 76097
2009-07-16 19:05:41 +00:00
Owen Anderson 20b34ac794 Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a number of issues in
our current context-passing stuff, which is also fixed here

llvm-svn: 76089
2009-07-16 18:04:31 +00:00
Owen Anderson b6b2530000 Move EVER MORE stuff over to LLVMContext.
llvm-svn: 75703
2009-07-14 23:09:55 +00:00
Owen Anderson 53a52215b5 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.

llvm-svn: 75445
2009-07-13 04:09:18 +00:00
Owen Anderson 1e5f00e7a7 This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
llvm-svn: 75200
2009-07-09 23:48:35 +00:00
Owen Anderson a771459bb1 Push LLVMContext _back_ through IRBuilder.
llvm-svn: 75040
2009-07-08 20:50:47 +00:00
Owen Anderson b17f32945f Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
llvm-svn: 75025
2009-07-08 19:03:57 +00:00
Owen Anderson 5948fdf68b Push LLVMContext through GlobalVariables and IRBuilder.
llvm-svn: 74985
2009-07-08 01:26:06 +00:00
Owen Anderson 2a15443aa8 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.

llvm-svn: 74655
2009-07-01 23:13:44 +00:00
Owen Anderson 1cf085d558 Hold the LLVMContext by reference rather than by pointer.
llvm-svn: 74640
2009-07-01 21:22:36 +00:00
Owen Anderson 6773d388aa 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.

llvm-svn: 74614
2009-07-01 16:58:40 +00:00
Chris Lattner 96122debc1 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!

llvm-svn: 74584
2009-07-01 04:13:31 +00:00
Chris Lattner d24df24527 make sure that JIT examples link in their appropriate target.
llvm-svn: 73613
2009-06-17 16:48:44 +00:00
Chris Lattner 0813c0c34c silence a warning.
llvm-svn: 69117
2009-04-15 00:16:05 +00:00
Bill Wendling 7aba8e30c4 Get rid of some compile warnings.
llvm-svn: 68978
2009-04-13 19:45:05 +00:00
Nick Lewycky 109af6232b 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.

llvm-svn: 68912
2009-04-12 20:47:23 +00:00
Torok Edwin 73312b3f39 Another attempt at fixing PR2975.
Types can have references to eachother, so we can't just call destroy on them.

llvm-svn: 68523
2009-04-07 17:23:02 +00:00
Torok Edwin 839026562c revert r68457, its crashing in make check.
llvm-svn: 68459
2009-04-06 20:57:34 +00:00
Torok Edwin 96dadc3b63 fix (part of) memory leak on shutdown. See PR2975.
llvm-svn: 68457
2009-04-06 20:49:21 +00:00
Chris Lattner dd7083452f reapply Sanjiv's patch to genericize memcpy/memset/memmove to take an
arbitrary integer width for the count.

llvm-svn: 59823
2008-11-21 16:42:48 +00:00
Bill Wendling 4bce2bff88 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

llvm-svn: 59809
2008-11-21 09:09:41 +00:00
Sanjiv Gupta 09a203765a Make mem[cpy,move,set] intrinsics overloaded.
llvm-svn: 59802
2008-11-21 07:49:09 +00:00
Oscar Fuentes cac467ef44 CMake: use add_llvm_example for HowToUseJIT.
llvm-svn: 57944
2008-10-22 02:52:59 +00:00
Oscar Fuentes 9e3f7dbeda CMake: Builds all examples. Corrected name of CBackend target.
llvm-svn: 56682
2008-09-26 19:48:03 +00:00
Oscar Fuentes a229b3c9a7 Initial support for the CMake build system.
llvm-svn: 56419
2008-09-22 01:08:49 +00:00
Chris Lattner 0c19df4871 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.

llvm-svn: 55263
2008-08-23 22:23:09 +00:00
Chris Lattner 8e8eae6860 use proper namespace qualifications
llvm-svn: 55259
2008-08-23 22:00:15 +00:00
Anton Korobeynikov b9fc3a26fc Remove asmprinters from examples by default. This reduces their size by ~5%
llvm-svn: 54890
2008-08-17 13:55:33 +00:00
Chris Lattner 17f7165f84 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.

llvm-svn: 54873
2008-08-17 07:19:36 +00:00
Eric Christopher 5927883970 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.

llvm-svn: 54546
2008-08-08 19:39:37 +00:00
Gabor Greif e1f6e4b21d API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interfaces will be in place for some time. (Merge from use-diet branch.)
llvm-svn: 51200
2008-05-16 19:29:10 +00:00
Gabor Greif 697e94cc22 Fix a bunch of 80col violations that arose from the Create API change. Tweak makefile targets to find these better.
llvm-svn: 51143
2008-05-15 10:04:30 +00:00
Duncan Sands a07136ee2d Merge LLVMBuilder and FoldingBuilder, calling
the result IRBuilder.  Patch by Dominic Hamon.

llvm-svn: 49604
2008-04-13 06:22:09 +00:00
Chris Lattner 166c458df4 silence warning when assertions are disabled.
llvm-svn: 49371
2008-04-08 05:49:09 +00:00
Duncan Sands 813384951e Use Intrinsic::getDeclaration in more places.
llvm-svn: 49338
2008-04-07 13:45:04 +00:00
Gabor Greif e9ecc68d8f 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.

llvm-svn: 49277
2008-04-06 20:25:17 +00:00
Chris Lattner 723f2a1646 Fix an incorrect comment, PR2147.
llvm-svn: 48323
2008-03-13 03:29:42 +00:00
Chris Lattner bcf65db6f3 remove attributions from examples.
llvm-svn: 45420
2007-12-29 20:37:57 +00:00
Chris Lattner 11cc8b3c14 remove attributions from the rest of the llvm makefiles.
llvm-svn: 45416
2007-12-29 20:11:13 +00:00
Christopher Lamb edf0788758 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.
llvm-svn: 45082
2007-12-17 01:12:55 +00:00
Chris Lattner 909ef0973b add a new BF->LLVM translator, contributed by Sterling Stein.
llvm-svn: 41881
2007-09-12 18:24:00 +00:00
Chris Lattner b0f158cfdf rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()
Add an APSInt::toString() method.

llvm-svn: 41309
2007-08-23 05:15:32 +00:00
Gabor Greif e16561cd5d Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.

llvm-svn: 37913
2007-07-05 17:07:56 +00:00
Owen Anderson fc56043844 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..

llvm-svn: 37858
2007-07-03 21:36:47 +00:00
Chris Lattner 41528e6e42 switch this to bitcode instead of bytecode
llvm-svn: 36867
2007-05-06 09:29:13 +00:00
Reid Spencer 68173455cd Revert last patch. The examples build now.
llvm-svn: 34970
2007-03-06 17:26:14 +00:00
Reid Spencer 8a9ae48d53 Adjust for changes in GenericValue type.
llvm-svn: 34969
2007-03-06 17:24:31 +00:00
Chris Lattner 70c3c66e38 temporarily disable this until Reid has a chance to fix it.
llvm-svn: 34962
2007-03-06 07:30:03 +00:00
Chris Lattner e3cf188c1e eliminate vector-related ctors
llvm-svn: 34227
2007-02-13 06:06:26 +00:00
Reid Spencer 969bdf344f Fix a #include to resolve IntegerType class.
llvm-svn: 33385
2007-01-19 22:45:50 +00:00
Reid Spencer 727f31b2cd Add a #include to resolve IntegerType class.
llvm-svn: 33384
2007-01-19 22:45:05 +00:00
Chris Lattner b800b3921c add some casts to support a change in the getOrInsertFunction interface
llvm-svn: 32984
2007-01-07 07:40:09 +00:00
Reid Spencer bc013ba367 For PR950:
Convert signed integer types to signless.

llvm-svn: 32786
2006-12-31 05:50:28 +00:00
Reid Spencer 266e42b312 For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.

llvm-svn: 32751
2006-12-23 06:05:41 +00:00
Bill Wendling f3baad3ee1 Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.

llvm-svn: 32298
2006-12-07 01:30:32 +00:00
Reid Spencer d43999259b For PR1019:
Add HAVE_PTHREAD to makefiles with support from configure and use it to
determine whether to build examples/ParallelJIT.
Patch by Anton Korobeynikov.

llvm-svn: 32054
2006-12-01 00:37:14 +00:00
Bill Wendling afd54eb8b6 Replacing std::iostreams with llvm iostreams. Some of these changes involve
adding a temporary wrapper around the ostream to make it friendly to
functions expecting an LLVM stream. This should be fixed in the future.

llvm-svn: 31990
2006-11-29 00:19:40 +00:00
Reid Spencer e0fc4dfc22 For PR950:
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.

llvm-svn: 31063
2006-10-20 07:07:24 +00:00
Chris Lattner e63072ea0a Use llvm-config to determine what to link in
llvm-svn: 30092
2006-09-04 06:04:03 +00:00
Chris Lattner 5dbafa8aad WriteBytecodeToFile actually can't throw.
llvm-svn: 29397
2006-07-28 22:08:23 +00:00
Chris Lattner 91c3733cac WriteBytecodeToFile throws, so this needs EH info.
llvm-svn: 29392
2006-07-28 21:55:54 +00:00
Reid Spencer a647c7ff42 Use archive libraries instead of object files for VMCore, BCReader,
BCWriter, and bzip2 libraries. Adjust the various makefiles to accommodate
these changes. This was done to speed up link times.

llvm-svn: 28610
2006-06-01 01:30:27 +00:00
Reid Spencer 6c8368beea Support correct build:
1. Capture the ENABLE_THREADS configure variable in Makefile.config
2. Use ENABLE_THREADS to avoid building ParallelJIT if threads are not
   present.

llvm-svn: 28609
2006-06-01 01:09:43 +00:00
Reid Spencer d078a1fd4c Correct some grammar and describe current reality.
llvm-svn: 28532
2006-05-29 02:31:47 +00:00
Chris Lattner 5eae951603 Catch a potentially thrown exception.
llvm-svn: 28295
2006-05-14 19:08:39 +00:00
Jeff Cohen e46cbe7a55 Minor corrections.
llvm-svn: 27042
2006-03-24 03:11:31 +00:00
Chris Lattner 7f731c5db9 Upgrade this to use the new intrinsic names
llvm-svn: 26483
2006-03-03 01:31:12 +00:00
Jeff Cohen 11e26b52b2 When a function takes a variable number of pointer arguments, with a zero
pointer marking the end of the list, the zero *must* be cast to the pointer
type.  An un-cast zero is a 32-bit int, and at least on x86_64, gcc will
not extend the zero to 64 bits, thus allowing the upper 32 bits to be
random junk.

The new END_WITH_NULL macro may be used to annotate a such a function
so that GCC (version 4 or newer) will detect the use of un-casted zero
at compile time.

llvm-svn: 23888
2005-10-23 04:37:20 +00:00
Reid Spencer f85fabeb71 For PR616:
These patches make threading optional in LLVM. The configuration scripts are now
modified to accept a --disable-threads switch. If this is used, the Mutex class
will be implemented with all functions as no-op. Furthermore, linking against
libpthread will not be done. Finally, the ParallelJIT example needs libpthread
so its makefile was changed to always add -lpthread to the link line.

llvm-svn: 23003
2005-08-24 10:07:20 +00:00
Jeff Cohen 5f4ef3c5a8 Eliminate all remaining tabs and trailing spaces.
llvm-svn: 22523
2005-07-27 06:12:32 +00:00
Reid Spencer 8640f2bdc1 Get rid of warnings on Alpha
llvm-svn: 22428
2005-07-13 23:20:24 +00:00
Reid Spencer 06a1da3efb Correct the file title.
llvm-svn: 22414
2005-07-12 22:00:29 +00:00
Reid Spencer 6855097c0d For PR418:
Add an example program that utilizes multiple threads in the JIT to process
work. This was used by Evan Jones as the original test case for ensuring
that the ExecutionEngine was thread safe.

Original source by Evan Jones (adapted from other LLVM JIT examples) and
made LLVM style compliant by Reid Spencer.

llvm-svn: 22411
2005-07-12 21:51:33 +00:00
Chris Lattner 5879f9c24d Don't forget these are calls
llvm-svn: 21730
2005-05-06 06:21:59 +00:00
Chris Lattner eaf625dc5c These are legal for tail calls
llvm-svn: 21723
2005-05-06 05:59:50 +00:00
Misha Brukman 8c0ca76517 Convert tabs to spaces
llvm-svn: 21433
2005-04-22 03:18:56 +00:00
Misha Brukman 2f72bafb60 Remove trailing whitespace at the end of lines
llvm-svn: 21380
2005-04-20 16:42:34 +00:00
Chris Lattner 3779fd6521 add missing copyright header
llvm-svn: 20614
2005-03-15 15:46:23 +00:00