1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 21:13:02 +02:00
Commit Graph

1374 Commits

Author SHA1 Message Date
Sumant Kowshik
18c49a775f Major bug fixes including a memory leak and tracking some exceptional conditions. Also added support for including global and indirect call information in the DS graphs used by the pool allocation
llvm-svn: 7605
2003-08-05 17:01:54 +00:00
Chris Lattner
686e94e760 DEBUG got moved to Support/Debug.h
llvm-svn: 7492
2003-08-01 22:15:03 +00:00
Chris Lattner
31224cdff9 Fix bug: FunctionResolve/2003-07-23-CPR-Reference.ll
This fixes a long time annoyance which caused prototypes for bzero, bcopy,
bcmp, fputs, and fputs_unlocked to never get deleted.  Grr.

llvm-svn: 7285
2003-07-23 22:03:18 +00:00
Chris Lattner
a824a1ab66 Eliminate using declarations, adjust for new DSGraph API
llvm-svn: 6992
2003-06-30 03:14:44 +00:00
Chris Lattner
17ea08b804 Allow the inlining limit to be controlled from the command line!
llvm-svn: 6929
2003-06-28 15:57:04 +00:00
Chris Lattner
6b54665aa9 Add support to globaldce for deleting dead function prototypes
llvm-svn: 6918
2003-06-26 05:41:18 +00:00
Chris Lattner
3dc8d444ff When internalizing global ctor/dtor list, also mark it constant. This is gross, but
until DSA is working all of the time and is totally reliable, we do this.

llvm-svn: 6917
2003-06-26 05:30:40 +00:00
Chris Lattner
e3d0b99978 Add argument to DAE to allow operation on non-internal functions
llvm-svn: 6895
2003-06-25 04:12:49 +00:00
Chris Lattner
95bf937b5a Fix the build. :(
llvm-svn: 6797
2003-06-20 14:36:52 +00:00
Chris Lattner
3a8e92a30b Changes to privatize NodeType
llvm-svn: 6795
2003-06-19 21:15:26 +00:00
Chris Lattner
cee19b1ace Remove a bunch of complicated code. The functionality is implemented in instcombine instead
llvm-svn: 6782
2003-06-19 16:59:19 +00:00
Chris Lattner
d176218b2d Handle arguments passed in through the va_arg area
llvm-svn: 6769
2003-06-18 16:25:51 +00:00
Chris Lattner
911e2c331c Initial checkin of DAE pass
llvm-svn: 6759
2003-06-17 22:21:05 +00:00
Chris Lattner
26c238c746 Fix compilation problem on GCC 2.9x
llvm-svn: 6667
2003-06-07 20:29:58 +00:00
Sumant Kowshik
a961b3c083 Made changes suggested by Chris
llvm-svn: 6606
2003-06-04 08:03:57 +00:00
Chris Lattner
0897583c5c Fix bug: FunctionResolve/2003-05-31-AllInternalDecls.ll
llvm-svn: 6486
2003-05-31 21:57:06 +00:00
Chris Lattner
00751219b0 Fix bug: FuncResolve/2003-05-31-InternalDecl.ll
Count resolutions correctly.

llvm-svn: 6482
2003-05-31 21:08:45 +00:00
Chris Lattner
d825cf5ee3 Simplify funcresolve a bit more
llvm-svn: 6480
2003-05-31 20:44:46 +00:00
Chris Lattner
a7b50146af Fix bug: FunctionResolve/2003-05-31-FuncPointerResolve.ll
llvm-svn: 6479
2003-05-31 20:33:31 +00:00
Sumant Kowshik
3186cb2b05 Added support for function pointers
llvm-svn: 6420
2003-05-29 22:42:44 +00:00
Chris Lattner
24947af013 * Separate all of the grunt work of inlining out into the Utils library.
* Make the function inliner _significantly_ smarter.  :)

llvm-svn: 6396
2003-05-29 15:11:31 +00:00
Chris Lattner
e58f6153f4 Remove using declarations
llvm-svn: 6306
2003-05-22 22:00:07 +00:00
Chris Lattner
e1d3dfec23 Make the list accept comma separated names
llvm-svn: 6295
2003-05-22 20:27:13 +00:00
Chris Lattner
ab034e55b5 * Revert to old behavior of ignoring a module if it doesn't contain a main
function and no symbols were explicitly marked to be externalized.
* Add new -internalize-public-api-list option that can be used if the symbol
  list is small, and making a new file is annoying.

llvm-svn: 6289
2003-05-22 19:48:00 +00:00
Chris Lattner
f26f3f74a3 Add option to internalize to allow it to read a file to determine which symbols
should not be internalized

llvm-svn: 6288
2003-05-22 19:34:49 +00:00
Chris Lattner
2fba72b389 Fix bug: FunctionResolve/2003-05-21-MissingArguments.ll
llvm-svn: 6273
2003-05-21 20:51:52 +00:00
Chris Lattner
f1f55e385c Don't inline functions that take variable numbers of arguments!
llvm-svn: 6024
2003-05-08 02:36:43 +00:00
Chris Lattner
d381dc9316 Remove using decl
llvm-svn: 6023
2003-05-08 02:34:52 +00:00
Chris Lattner
b74f4c1462 Fix several bugs:
* Warnings were emitted all of the time and were really annoying
  * Functions could not be resolved unless they had external linkage.  Linkonce
    linkage was not allowed
  * ConstantPointerRef's were not handled when linking functions
    we now actually handle cast (CPR) to X -> cast (NewCPR) to X

llvm-svn: 5967
2003-04-28 01:23:29 +00:00
Chris Lattner
db6b7ba364 Remove unnecesary &*'s
llvm-svn: 5872
2003-04-23 16:37:45 +00:00
Chris Lattner
5931df28b7 Implement: FunctionResolve/2003-04-18-ForwardDeclGlobal.ll
llvm-svn: 5816
2003-04-19 00:15:27 +00:00
Chris Lattner
08b5392e07 Global constants CAN be external
llvm-svn: 5808
2003-04-18 04:34:29 +00:00
Chris Lattner
bb00f755ed Change the interface to constant expressions to allow automatic folding
llvm-svn: 5793
2003-04-16 22:40:51 +00:00
Chris Lattner
fa4f750f3e Add new linkage types to support a real frontend
llvm-svn: 5786
2003-04-16 20:28:45 +00:00
Chris Lattner
db94bd1661 Eliminate tons of bogus warnings
llvm-svn: 5686
2003-03-03 19:57:46 +00:00
Chris Lattner
3b3cce733d Replace assertion with a handler.
llvm-svn: 5653
2003-02-27 20:55:48 +00:00
Chris Lattner
174a241cd5 Fix a bug that cause a crash resolving questionable function calls
llvm-svn: 5567
2003-02-14 19:12:29 +00:00
Chris Lattner
8de17c9baf Fix a misunderstanding of the standard associative containers
llvm-svn: 5565
2003-02-14 05:34:36 +00:00
Chris Lattner
cc7f4a3c65 Fix a problem Sumant was running into
llvm-svn: 5499
2003-02-06 22:03:46 +00:00
Chris Lattner
978ff5d0dd Split public interface out into header file
llvm-svn: 5472
2003-02-03 19:08:18 +00:00
Chris Lattner
7aec6c471b Change DSGraph stuff to use hash_(set|map) instead of std::(set|map)
This change provides a small (3%) but consistent speedup

llvm-svn: 5460
2003-02-01 04:52:08 +00:00
Chris Lattner
dcf38586ef Fix a bug resolving sprintf(...) to sprintf(char*, char*, ...)
llvm-svn: 5446
2003-01-30 22:38:44 +00:00
Chris Lattner
0e59c67f69 Actually print the function _name_ if there is a problem
llvm-svn: 5443
2003-01-30 21:33:07 +00:00
Chris Lattner
70b2c322eb * Fix function resolution for varargs function to generate incorrect bytecode instead of crashing
* remove using decls
 CVS: ----------------------------------------------------------------------

llvm-svn: 5437
2003-01-30 18:22:32 +00:00
Chris Lattner
3c20e2c6d1 Initial checkin of pool allocation code
llvm-svn: 5432
2003-01-29 21:12:13 +00:00
Chris Lattner
19ad3aaf0a Disable construction of pool allocator
llvm-svn: 5422
2003-01-24 20:13:20 +00:00
Chris Lattner
23aa2d5bfd Fix references to functions
llvm-svn: 5222
2003-01-13 00:27:23 +00:00
Vikram S. Adve
6c46fba526 External routines used to identify Cilk operations inserted by the
parallelization pass.

llvm-svn: 4965
2002-12-10 13:08:48 +00:00
Vikram S. Adve
849346ee23 This file implements a pass that automatically parallelizes a program,
using the Cilk multi-threaded runtime system to execute parallel code.
The current version inserts too many sync() operations in the program
because it does not attempt to optimize their placement.

llvm-svn: 4962
2002-12-10 00:43:34 +00:00
Chris Lattner
58944216ff Fix symbol table problem
llvm-svn: 4785
2002-11-20 19:32:43 +00:00
Chris Lattner
b5027095e5 - Eliminated the deferred symbol table stuff in Module & Function, it really
wasn't an optimization and it was causing lots of bugs.

llvm-svn: 4779
2002-11-20 18:36:02 +00:00
Chris Lattner
e5a05ec13b Minor changes to cloning interface
llvm-svn: 4770
2002-11-19 22:54:01 +00:00
Chris Lattner
27bf5916fb Rework inline pass to use cloning infrastructure to do the dirty work
llvm-svn: 4766
2002-11-19 21:54:07 +00:00
Chris Lattner
ccb8790bc4 Start using the new function cloning header
llvm-svn: 4764
2002-11-19 20:59:41 +00:00
Chris Lattner
7e4c65114b Move MutatStructTypes.h out of IPO
llvm-svn: 4762
2002-11-19 20:49:40 +00:00
Chris Lattner
17da38496e Rename CloneFunction.h to Cloning.h
llvm-svn: 4760
2002-11-19 20:08:24 +00:00
Chris Lattner
adea9960ab Move the function extractor pass from tools/extract into lib/Xform/IPO
llvm-svn: 4759
2002-11-19 18:42:59 +00:00
Chris Lattner
96d1bfd014 Fix testcase: FunctionResolve/2002-11-09-ExternFn.ll
llvm-svn: 4668
2002-11-10 03:36:55 +00:00
Chris Lattner
7252fe359e Use the new getMainFunction() method to efficiently locate main
llvm-svn: 4630
2002-11-08 20:34:21 +00:00
Chris Lattner
d5dc2c1417 Fix bug: FunctionResolve/2002-11-07-RetMismatch.ll
llvm-svn: 4618
2002-11-08 00:38:20 +00:00
Chris Lattner
15d0113fc6 Really disable pool allocator
llvm-svn: 4216
2002-10-17 04:57:09 +00:00
Chris Lattner
82f54dca49 - Change Function's so that their argument list is populated when they are
constructed.  Before, external functions would have an empty argument list,
    now a Function ALWAYS has a populated argument list.

llvm-svn: 4149
2002-10-13 20:57:00 +00:00
Chris Lattner
9d067ad595 Account for global variables resolved more accurately.
llvm-svn: 4143
2002-10-13 17:30:30 +00:00
Chris Lattner
721a5fac62 Use methods that are more explanatory
llvm-svn: 4142
2002-10-13 17:12:47 +00:00
Chris Lattner
8cd34b84b2 Stop using DataStructureGraph.h
llvm-svn: 4106
2002-10-10 20:33:46 +00:00
Chris Lattner
42547124d0 - Dramatically simplify the ConstantMerge code now that
Value::replaceAllUsesWith works with constants correctly.

llvm-svn: 4104
2002-10-09 23:16:04 +00:00
Chris Lattner
83d105d986 Almost a complete rewrite of FunctionResolution to now resolve functions
and global variables.

This fixes bug: FuncResolve/2002-08-19-ResolveGlobalVarsEasier.ll
And bug: SingleSource/UnitTests/2002-10-09-ArrayResolution.c

Note that this does not fix bug:
FunctionResolve/2002-08-19-ResolveGlobalVars.ll because replaceAllUsesWith
breaks when a constantexpr is pointing to the thing being replaced.  This
is more of an infrastructure problem than anything.

llvm-svn: 4099
2002-10-09 21:10:06 +00:00
Chris Lattner
c532e35cce Non-functionality change just to make it more clear what is going on
llvm-svn: 4060
2002-10-07 18:34:32 +00:00
Chris Lattner
7cf9f6f4b1 Updates to work with recent Statistic's changes:
* Renamed StatisticReporter.h/cpp to Statistic.h/cpp
    * Broke constructor to take two const char * arguments instead of one, so
      that indendation can be taken care of automatically.
    * Sort the list by pass name when printing
    * Make sure to print all statistics as a group, instead of randomly when
      the statistics dtors are called.
    * Updated ProgrammersManual with new semantics.

llvm-svn: 4002
2002-10-01 22:38:41 +00:00
Chris Lattner
4cc183889f Updates to work with recent Statistic's changes:
* Renamed StatisticReporter.h/cpp to Statistic.h/cpp
    * Broke constructor to take two const char * arguments instead of one, so
      that indendation can be taken care of automatically.
    * Sort the list by pass name when printing
    * Make sure to print all statistics as a group, instead of randomly when
      the statistics dtors are called.
    * Updated ProgrammersManual with new semantics.

llvm-svn: 4001
2002-10-01 22:38:37 +00:00
Chris Lattner
7cdd2e0cb0 Converted SimpleStructMutation to take TargetData as a required pass.
llvm-svn: 3932
2002-09-26 00:17:21 +00:00
Chris Lattner
a4184f9ab6 Fix: ConstantMerge/2002-09-23-CPR-Update.ll
Basically, this bug boiled down to calling replaceUsesOfWith on a constant,
which changed it's shape in an illegal way.  This pass now goes through all
of the trouble neccesary to do the replacement on constants.

llvm-svn: 3895
2002-09-23 23:00:46 +00:00
Chris Lattner
5c6d487ee2 Don't insert a PHI node to merge "returns" from an inlined function if there
is only a single return from the function!

llvm-svn: 3878
2002-09-22 18:41:25 +00:00
Chris Lattner
99d6a46698 Fix FunctionInlining pass assertion failure:
ilist:104: failed assertion `Traits::getNext(NodePtr) != 0 && "Dereferencing end()!"'

llvm-svn: 3768
2002-09-16 22:30:20 +00:00
Misha Brukman
2e598f0092 Function.h is unnecessary when Module.h is included.
llvm-svn: 3716
2002-09-14 03:04:02 +00:00
Misha Brukman
dbe90c56ec Following Chris's advice, I'm pruning some unnecessary .h includes that I'm
noticing. Since Module includes Function, and eventually, BasicBlock and
GlobalVariable, the last three are unnecessary to be included directly.

llvm-svn: 3713
2002-09-14 02:06:53 +00:00
Chris Lattner
547be87c13 Change the MallocInst & AllocaInst ctors to take the allocated type, not the
pointer type returned.

llvm-svn: 3711
2002-09-13 22:28:50 +00:00
Chris Lattner
f820cab2ad Change the MallocInst & AllocaInst ctors to take the allocated type, not the
pointer type returned.

llvm-svn: 3710
2002-09-13 22:28:45 +00:00
Chris Lattner
0b81131afc Fix bug in previous checkin
llvm-svn: 3672
2002-09-10 23:31:12 +00:00
Chris Lattner
f2e4e61769 Clean up code due to auto-insert constructors
llvm-svn: 3666
2002-09-10 22:38:49 +00:00
Chris Lattner
37c3a1d80c Clean up code due to auto-insert constructors
llvm-svn: 3665
2002-09-10 22:38:47 +00:00
Chris Lattner
5758cf6d77 Simplify code (somtimes dramatically), by using the new "auto-insert" feature
of instruction constructors.

llvm-svn: 3655
2002-09-10 17:03:06 +00:00
Chris Lattner
4b8ce3aed2 Factor silly code duplication out
llvm-svn: 3627
2002-09-08 21:47:54 +00:00
Chris Lattner
9f18db8156 Eliminated the MemAccessInst class, folding contents into GEP class.
llvm-svn: 3488
2002-08-22 23:37:24 +00:00
Chris Lattner
cddef868de Do not create load/stores with indexes
llvm-svn: 3420
2002-08-21 22:10:52 +00:00
Chris Lattner
289ad0e1fd - Made GlobalDCE worklist driven, making it more successful. Now can handle
cases like: test/Regression/Transforms/GlobalDCE/2002-08-17-WorkListTest.ll

llvm-svn: 3381
2002-08-18 01:28:30 +00:00
Chris Lattner
c8183d92e3 Remove support for NOT instruction
llvm-svn: 3313
2002-08-14 17:45:39 +00:00
Chris Lattner
a21e315db4 - Cleaned up the interface to AnalysisUsage to take analysis class names
instead of ::ID's.
 - Pass::getAnalysis<> now no longer takes an optional argument

llvm-svn: 3265
2002-08-08 19:01:30 +00:00
Chris Lattner
b630b06f0d Remove unneccesary #inlcude
llvm-svn: 3200
2002-08-01 20:01:02 +00:00
Chris Lattner
f8ca791c68 * Indent class into anonymous namespace, filling up the diff with garbage
* Internalize global variables with initializers
* Add new stat to track global variable internalization
* Only count functions that were not internal before in internalized function
  count

llvm-svn: 3163
2002-07-30 19:48:44 +00:00
Chris Lattner
4d05134df0 Fix bug with last patch which would occur when a call returned void and we
attempted to assign it a name.

llvm-svn: 3142
2002-07-30 02:42:49 +00:00
Chris Lattner
1980b35509 * Make sure the resolved function call instructions get the name from the
old call instruction
* Implement conversion of return values for calls.  This fixes bug:
   test/Regression/Transforms/FunctionResolve/retmismatch3.ll

llvm-svn: 3140
2002-07-30 00:50:49 +00:00
Chris Lattner
7a9eb848cd * Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Remove getPassName implementations from various subclasses

llvm-svn: 3113
2002-07-26 21:12:46 +00:00
Chris Lattner
b934722f1b * Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Remove getPassName implementations from various subclasses

llvm-svn: 3112
2002-07-26 21:12:44 +00:00
Chris Lattner
05fe67c0d2 *** empty log message ***
llvm-svn: 3075
2002-07-25 06:17:51 +00:00
Chris Lattner
4a9e674077 Eliminate several include/llvm/Transforms/IPO/*.h files, moving their contents into IPO.h
llvm-svn: 3043
2002-07-24 17:12:05 +00:00
Chris Lattner
921e366a5c Merge ChangeAllocations into scalar.h
llvm-svn: 3038
2002-07-23 22:04:17 +00:00
Chris Lattner
176a67ce61 Rename header
llvm-svn: 3037
2002-07-23 22:04:02 +00:00
Chris Lattner
46077f4e0f Cleanup and simplify code
llvm-svn: 3036
2002-07-23 22:03:41 +00:00
Chris Lattner
ac78173ee0 Incorporate ConstantMerge.h into IPO.h
llvm-svn: 3035
2002-07-23 19:57:40 +00:00
Chris Lattner
c482880f9e *** empty log message ***
llvm-svn: 3016
2002-07-23 18:06:35 +00:00
Chris Lattner
606421d005 * Remove getPassName implementation
* Register all Passes

llvm-svn: 3015
2002-07-23 18:06:30 +00:00
Chris Lattner
670d7d06fe * Break the two different behaviors of SimpleStructMutation into two subclasses
* Register the passes

llvm-svn: 3013
2002-07-23 18:03:11 +00:00
Chris Lattner
bdb978fa79 * Remove lots of dead stuff
* Register Pass

llvm-svn: 3011
2002-07-23 18:01:39 +00:00
Chris Lattner
24bcbdd155 *** empty log message ***
llvm-svn: 3002
2002-07-23 17:52:38 +00:00
Chris Lattner
99ad379582 *** empty log message ***
llvm-svn: 2985
2002-07-22 02:10:13 +00:00
Chris Lattner
c459d57fe3 Seperate stats for DCE'd functions and vars
llvm-svn: 2961
2002-07-18 06:40:04 +00:00
Chris Lattner
13b8b7c8fe *** empty log message ***
llvm-svn: 2959
2002-07-18 04:43:20 +00:00
Chris Lattner
1abd637044 Only functions with external linkage can be resolved to function declarations.
This change fixes programs that have multiple functions named the same thing,
where are least one of them is static/internal.

llvm-svn: 2954
2002-07-18 03:01:24 +00:00
Chris Lattner
3710b0d6d1 * Correctly get prototype for void*malloc(size_t)
llvm-svn: 2951
2002-07-18 00:18:01 +00:00
Chris Lattner
a6842aa353 Disable pool allocation stuff until data structure analysis is sorted back out
llvm-svn: 2869
2002-07-10 22:36:47 +00:00
Chris Lattner
a590093513 *** empty log message ***
llvm-svn: 2813
2002-06-30 16:25:25 +00:00
Anand Shukla
85065832f1 changes to make it compatible with 64bit gcc
llvm-svn: 2792
2002-06-25 21:07:58 +00:00
Chris Lattner
dfd421a7df MEGAPATCH checkin.
For details, See: docs/2002-06-25-MegaPatchInfo.txt

llvm-svn: 2779
2002-06-25 16:13:24 +00:00
Chris Lattner
d7cbd7d5d2 MEGAPATCH checkin.
For details, See: docs/2002-06-25-MegaPatchInfo.txt

llvm-svn: 2778
2002-06-25 16:13:21 +00:00
Chris Lattner
8e1476c302 Remove DynamicConstantMerge pass, because it did not fit in with the Pass
system correctly.

llvm-svn: 2772
2002-06-25 15:55:29 +00:00
Chris Lattner
ef6daeb534 Remove "fixers" for problems in GCC generated code that cannot be generated
anymore.

llvm-svn: 2771
2002-06-25 15:55:03 +00:00
Chris Lattner
3611a1e91c Do not remove type names that contain a .
llvm-svn: 2747
2002-05-26 20:17:35 +00:00
Chris Lattner
d98e784be4 Fix "unimplemented features":
test/Regression/Transforms/FunctionResolve/retmismatch[12].ll

This makes it much more useful for running benchmarks that are missing
prototypes for some functions.

llvm-svn: 2745
2002-05-24 21:33:26 +00:00
Chris Lattner
5dc1524174 Split the FunctionResolution pass out of CleanGCCOutput.cpp.
llvm-svn: 2742
2002-05-24 20:42:13 +00:00
Chris Lattner
e69803b06f Support programs that do not #include <malloc.h> or give a full prototype
for malloc and free.  Lots of crufty benchmarks are using stuff like:
char *malloc();
void free();

to forward declare malloc and free.  Now we recognize and raise these forms

llvm-svn: 2740
2002-05-24 20:29:18 +00:00
Chris Lattner
d406cb7c9d Convert transforms over to standardize debugging output on -debug option
llvm-svn: 2714
2002-05-22 17:27:12 +00:00
Chris Lattner
adba963886 Add support for printing out statistics information when -stats is added to
the command line

llvm-svn: 2601
2002-05-10 15:38:35 +00:00
Chris Lattner
276dd3d721 fix comments and documentation in file
llvm-svn: 2530
2002-05-07 19:04:39 +00:00
Chris Lattner
e125e808a8 Split ChangeAllocations.cpp into Raise & LowerAllocations.cpp
llvm-svn: 2529
2002-05-07 19:02:48 +00:00
Chris Lattner
9e1c79995e Updates to move some header files out of include/llvm/Transforms into
the Scalar and Utils subdirectories

llvm-svn: 2523
2002-05-07 18:36:35 +00:00
Chris Lattner
c5a6d978b8 Reduce dependance on TransformInternals.h, instead using the TransformUtils library
llvm-svn: 2518
2002-05-07 18:12:18 +00:00
Chris Lattner
2c44e5bca3 Be a little more efficient, do not generate loads and stores with indices in them.
llvm-svn: 2430
2002-05-02 17:38:14 +00:00
Chris Lattner
cfc512e714 Eliminate dead global variables
llvm-svn: 2400
2002-04-29 18:13:11 +00:00
Chris Lattner
96e0c48175 Eliminate duplicate or unneccesary #include's
llvm-svn: 2397
2002-04-29 17:42:12 +00:00
Chris Lattner
589debc4ba Add new optional getPassName() virtual function that a Pass can override
to make debugging output a lot nicer.

llvm-svn: 2395
2002-04-29 14:57:45 +00:00
Chris Lattner
ec70d92221 Tighten up the AnalysisUsage of lots of passes, primarily to correctly indicate whether or not they invalidate the CFGA
llvm-svn: 2386
2002-04-28 21:27:06 +00:00
Chris Lattner
321a8cf4ba Split ConstantVals.h into Constant.h and Constants.h
llvm-svn: 2378
2002-04-28 19:55:58 +00:00
Chris Lattner
e5d8bd9baf Be careful not to make "external" function internal
llvm-svn: 2363
2002-04-28 05:48:34 +00:00
Chris Lattner
23e713d49d Initial checkin of new "Internalize" pass for GCCLD
llvm-svn: 2362
2002-04-28 05:43:27 +00:00
Chris Lattner
2f0ee1833d s/Method/Function
llvm-svn: 2336
2002-04-27 07:27:19 +00:00
Chris Lattner
536cf1b13f * Rename MethodPass class to FunctionPass
- Rename runOnMethod to runOnFunction
* Transform getAnalysisUsageInfo into getAnalysisUsage
  - Method is now const
  - It now takes one AnalysisUsage object to fill in instead of 3 vectors
    to fill in
  - Pass's now specify which other passes they _preserve_ not which ones
    they modify (be conservative!)
  - A pass can specify that it preserves all analyses (because it never
    modifies the underlying program)
* s/Method/Function/g in other random places as well

llvm-svn: 2333
2002-04-27 06:56:12 +00:00
Chris Lattner
0c04e4d1ef Changes because the Terminator::getSuccessor function now FAILS if successor
IDX is out of range instead of returning null.

llvm-svn: 2332
2002-04-27 03:15:45 +00:00
Chris Lattner
1e7147c9e9 * Change Constant::getNullConstant to Constant::getNullValue
* Add support for pool allocating array allocations of varying size

llvm-svn: 2329
2002-04-27 02:29:32 +00:00
Chris Lattner
039edb92f3 Programs that actually free memory were broken
llvm-svn: 2307
2002-04-18 22:11:30 +00:00
Chris Lattner
8e2b6edf87 Add a fixme so that we don't forget this is broken.
llvm-svn: 2298
2002-04-18 18:52:03 +00:00
Chris Lattner
eee0e3f1f7 Correctly transform dependant arguments, allowing the perimeter bm to work.
llvm-svn: 2282
2002-04-18 14:43:30 +00:00
Chris Lattner
c004e8f534 run an extra pass after a function has been transformed to eliminate
obviously duplicate loads of the pool base.

llvm-svn: 2255
2002-04-15 22:42:23 +00:00
Chris Lattner
983272ba58 Turn off debug output
llvm-svn: 2247
2002-04-14 06:14:41 +00:00
Chris Lattner
3b7f72e4e4 * Allow datasize to be specified on the commandline
* Build new datatypes correctly
* Transform instructions that return null pointers from functions to return
  a null index.

llvm-svn: 2244
2002-04-13 23:13:18 +00:00
Chris Lattner
47b17915d5 * Give alloca's for pool descriptors better names than "pool<n>".
* Fill in the pool descriptor links in the pool descriptors.

llvm-svn: 2239
2002-04-13 19:52:54 +00:00
Chris Lattner
249f5243f1 * Add names to the symbol table for pool types and modified types
* Handle more complex structure so that power works almost
* Fix bug with pooldestroy call where we passed in the size of the object
  instead of the pool to destroy.  bisort is now pool allocated successfully!

llvm-svn: 2238
2002-04-13 19:25:57 +00:00
Chris Lattner
24f4497fe9 Implement function rewriting to use offsets instead of pointers in programs.
This now works with treeadd at least, and perhaps other programs as well.

llvm-svn: 2233
2002-04-12 20:23:15 +00:00
Chris Lattner
3b04124abd * Add documentation
* Split the CleanGCC pass into two passes, a global pass and an IP pass.
  Before it was just a global pass, but it did illegal things to the
  module, which broke other passes that were being scheduled with it by
  gccld.

llvm-svn: 2224
2002-04-10 20:33:11 +00:00
Chris Lattner
5e12c7caf5 Move FunctionArgument out of iOther.h into Argument.h and rename class to
be 'Argument' instead of FunctionArgument.

llvm-svn: 2216
2002-04-09 19:48:49 +00:00
Chris Lattner
7ae20d642d Add #includes to make up for #includes pruned out of header files.
llvm-svn: 2207
2002-04-09 18:37:46 +00:00
Chris Lattner
31e5838296 s/Method/Function
Remove extraneous #includes of llvm/Assembly/Writer

llvm-svn: 2178
2002-04-08 22:03:00 +00:00
Chris Lattner
bc15ae64dd Change references to the Method class to be references to the Function
class.  The Method class is obsolete (renamed) and all references to it
are being converted over to Function.

llvm-svn: 2144
2002-04-07 20:49:59 +00:00
Chris Lattner
1ee6bf5249 PATypeHolder is now not a template
llvm-svn: 2106
2002-04-04 19:24:34 +00:00
Chris Lattner
2e3a4dece6 Allow scalars that point to multiple nodes when building the scalar map.
llvm-svn: 2087
2002-04-01 01:26:53 +00:00
Chris Lattner
99da111daf Add extra case here to avoid getting spurious output
llvm-svn: 2086
2002-04-01 00:45:33 +00:00
Chris Lattner
c620b825b6 Add debug output
llvm-svn: 2066
2002-03-31 07:17:46 +00:00
Chris Lattner
4c4a273f43 * Catch and ignore (for now) return instructions in tranformed functions
* Add more debugging output
* Fix problems refering to wrong versions of various graphs
* Build the pool descriptor map!
* Clear the nodemapping map after building pool descriptor to avoid assert
* Transform the NEw function body, not the old one...
* Matrix.ll now works!

llvm-svn: 2058
2002-03-30 20:53:14 +00:00
Chris Lattner
410c6394d3 * Clean up data structures [AllocDSNode -> DSNode]
* TransformFunctionInfo now has call field form field mapping.  May be
  removed in the future.
* Moved the computation of "Scalars" into transformFunctionBody so
  transformFunction didn't have to recompute it.
* Implement the node mapping calculation in preparation to calculate
  PoolDescriptors to pass to transformFunctionBody
* Print out the node mapping [it looks right!]
* Other minor changes

llvm-svn: 2056
2002-03-30 09:12:35 +00:00
Chris Lattner
36d50d01ab Maintain enough information so that the pools for all of the nodes of
the graph can be passed around.

llvm-svn: 2053
2002-03-30 04:02:31 +00:00
Chris Lattner
a4b9a9f573 Implement the first batch of transformations to the methods. So far it:
* Converts malloc instructions to poolalloc
 * Converts free instructions to poolfree
 * Convert calls to call the new cloned hacked up versions

Note that this does not modify hacked up stuff yet, just the top level
function

llvm-svn: 2052
2002-03-29 21:25:19 +00:00
Chris Lattner
9166ac0b3f Correctly clone the function with the extra argument types. Now we need
to modify the function next.

This also properly recycles functions so that we don't get exponential
code blowup in the common case.

llvm-svn: 2049
2002-03-29 19:05:48 +00:00
Chris Lattner
b6b7c3fe60 s/Method/Function
llvm-svn: 2048
2002-03-29 19:04:45 +00:00
Chris Lattner
6b1ce137c2 Find out which calls in the function we need to transform and how.
Next step is to start hacking functions up.

llvm-svn: 2044
2002-03-29 17:13:46 +00:00
Chris Lattner
5df9c977e1 s/Method/Function
llvm-svn: 2043
2002-03-29 17:08:29 +00:00
Chris Lattner
3a9f1dd66a Modularize code a bit
llvm-svn: 2040
2002-03-29 06:21:38 +00:00
Chris Lattner
7c2529076a Implement the first step of pool allocation - Creating, initialization, and
destruction of the pools.

llvm-svn: 2039
2002-03-29 05:50:20 +00:00
Chris Lattner
815e2f4daa Flesh out a bunch more code, print allocations that are poolable.
llvm-svn: 2031
2002-03-29 03:40:59 +00:00
Chris Lattner
e46e35806a s/method/function
llvm-svn: 2030
2002-03-29 03:40:25 +00:00
Chris Lattner
4ca6fd00f2 s/Method/Function/g
llvm-svn: 2029
2002-03-29 03:39:36 +00:00
Chris Lattner
0336a78488 Initial checkin of Noop pass that will be the pool allocator
llvm-svn: 2014
2002-03-28 18:08:31 +00:00
Chris Lattner
849c762b02 Change references from Method to Function
change references from MethodARgument to FunctionArgument

llvm-svn: 1991
2002-03-26 18:01:55 +00:00
Chris Lattner
88ccdcd73e Remove code designed to compensate for a bug in GCC. The bug has since
been fixed.

llvm-svn: 1881
2002-03-15 20:35:21 +00:00
Chris Lattner
962e012ad5 Take CallGraph out of the CFG namespace. It has nothing to do with CFGs
llvm-svn: 1820
2002-03-06 17:16:43 +00:00
Chris Lattner
e2383e8592 Change over to use new style pass mechanism, now passes only expose small
creation functions in their public header file, unless they can help it.

llvm-svn: 1816
2002-02-26 21:46:54 +00:00
Chris Lattner
11d689e99a When inlining basic blocks and instructions, give them a name!
llvm-svn: 1796
2002-02-25 00:31:02 +00:00
Chris Lattner
3d83ea4268 Handle more cases in the linker
llvm-svn: 1771
2002-02-18 19:05:15 +00:00
Chris Lattner
8e9be000a7 * Pull BasicBlock::pred_* and BasicBlock::succ_* out of BasicBlock.h and into
llvm/Support/CFG.h
* Make pred & succ iterators for intervals global functions
* Add #includes that are now neccesary because BasicBlock.h doesn't include
  InstrTypes.h anymore

llvm-svn: 1750
2002-02-12 22:39:50 +00:00
Chris Lattner
2e463f5dbe Convert xforms over to new pass structure.
llvm-svn: 1605
2002-01-31 00:45:11 +00:00
Chris Lattner
83056c99ec Pull RaiseAllocations stuff out of the CleanGCC pass into it's own pass in
the ChangeAllocations.h header file.

llvm-svn: 1522
2002-01-22 00:13:51 +00:00
Chris Lattner
4454cdc5c0 Move stuff out of the Optimizations directories into the appropriate Transforms
directories.  Eliminate the opt namespace.

llvm-svn: 1520
2002-01-21 23:17:48 +00:00
Chris Lattner
bbb4dcdcd1 Rename SwapStructureContents -> IPO/SimpleStructMutation
Move MutateStructTypes.(cpp|h) -> IPO/MutateStructTypes.(cpp|h)

llvm-svn: 1510
2002-01-21 07:52:35 +00:00
Chris Lattner
2521ae1011 Implement a more powerful, simpler, pass system. This pass system can figure
out how to run a collection of passes optimially given their behaviors and
charactaristics.

Convert code to use it.

llvm-svn: 1507
2002-01-21 07:31:50 +00:00
Chris Lattner
3dc9a2a61f Changes to build successfully with GCC 3.02
llvm-svn: 1503
2002-01-20 22:54:45 +00:00
Chris Lattner
315df5b058 The proper prototype for malloc returns a pointer, not an unsized array
llvm-svn: 1463
2001-12-14 16:32:20 +00:00
Chris Lattner
c4a5815033 Renamed inst_const_iterator -> const_inst_iterator
Renamed op_const_iterator   -> const_op_iterator
Renamed PointerType::getValueType() -> PointerType::getElementType()

llvm-svn: 1408
2001-12-04 00:03:30 +00:00
Chris Lattner
f6b7da2bb5 Rename ConstPoolVal -> Constant
Rename ConstPool*   -> Constant*
Rename ConstPoolVals.h -> ConstantVals.h

llvm-svn: 1407
2001-12-03 22:26:30 +00:00
Chris Lattner
bcf2df7058 Split the PHINode class out from the iOther.h file into the iPHINode.h file
llvm-svn: 1405
2001-12-03 18:02:31 +00:00
Chris Lattner
463cc31132 Create a new #include "Support/..." directory structure to move things
from "llvm/Support/..." that are not llvm dependant.

Move files and fix #includes

llvm-svn: 1400
2001-11-27 00:03:19 +00:00
Chris Lattner
2459d65720 Remove debugging output
llvm-svn: 1383
2001-11-26 19:14:16 +00:00
Chris Lattner
c56685dca6 Support internal linkage
llvm-svn: 1382
2001-11-26 19:14:03 +00:00
Chris Lattner
118f8023f8 Implement DCE of global values
llvm-svn: 1360
2001-11-26 18:42:17 +00:00
Chris Lattner
c1f0351928 Support selectable structure transformations
llvm-svn: 1342
2001-11-26 16:59:10 +00:00
Chris Lattner
98a6ef2594 Support mutation of array indexing
llvm-svn: 1341
2001-11-26 16:58:33 +00:00
Chris Lattner
e19d5b4615 -cleangcc pass now remove type names that are never referenced and type names for pointers to primitive types.
llvm-svn: 1312
2001-11-15 04:34:46 +00:00
Chris Lattner
f45cb25619 Better heuristics for handling arrays
llvm-svn: 1296
2001-11-14 11:02:49 +00:00
Chris Lattner
184137a419 Fix minor bug
llvm-svn: 1273
2001-11-12 20:13:04 +00:00
Chris Lattner
053906abc0 Initail checking of structure swapper
llvm-svn: 1248
2001-11-10 07:28:25 +00:00
Chris Lattner
79fd0836bb Initial checkin of structure mutator
llvm-svn: 1246
2001-11-10 07:26:31 +00:00
Chris Lattner
d376cb5113 Don't print spurious linking warnings about methods that are never used.
Cleanup ExprTypeConvert a bit.

llvm-svn: 1141
2001-11-05 19:43:10 +00:00
Chris Lattner
5d261d7928 Refactor code to share stuff
llvm-svn: 1127
2001-11-04 23:24:06 +00:00
Chris Lattner
42cf9aaa3a Fix cast instructions that end up in bad places in GCC output
llvm-svn: 1117
2001-11-04 07:40:51 +00:00
Chris Lattner
2b011e7b50 Add new cleanup pass:
//  1. PHI nodes with multiple entries for the same predecessor.  GCC sometimes
//     generates code that looks like this:
//
//  bb7:  br bool %cond1004, label %bb8, label %bb8
//  bb8: %reg119 = phi uint [ 0, %bb7 ], [ 1, %bb7 ]
//
//     which is completely illegal LLVM code.  To compensate for this, we insert
//     an extra basic block, and convert the code to look like this:
//
//  bb7: br bool %cond1004, label %bbX, label %bb8
//  bbX: br label bb8
//  bb8: %reg119 = phi uint [ 0, %bbX ], [ 1, %bb7 ]
//

llvm-svn: 1114
2001-11-03 21:08:59 +00:00
Chris Lattner
bcdf581aec * Export method to merge identically named methods
* Add code to fix PHI nodes that are missing arguments.  These PHI nodes can
  be generated by GCC if there is an uninitialized variable flowing into a merge
  point.  For example:

int foo(int y) {
  int X;
  if (y) X = 1;
  return X;
}

llvm-svn: 1110
2001-11-03 19:51:56 +00:00
Chris Lattner
30050d95ae Changes to compile the TSP benchmark successfully. Favor warning instead of assertion failures.
llvm-svn: 1103
2001-11-03 10:04:22 +00:00
Chris Lattner
fb0626b9ed Add code to link method together with the same name if one is vararg and the other isn't.
This resolves definitions like this:
   %list * "foo"(...)
   %list * "foo"(int)

together which can often occur because C programmers don't put prototypes in like they should.  GRR

llvm-svn: 1102
2001-11-03 09:19:00 +00:00
Chris Lattner
cd8bcd33aa Propogate name to the malloc itself instead of to the cast
llvm-svn: 1071
2001-11-01 02:40:36 +00:00
Chris Lattner
009d9de81c Implement code to convert %malloc and %free FUNCTION CALLS into the instruction equivalent
llvm-svn: 1065
2001-10-31 06:35:59 +00:00
Chris Lattner
a9dacc1925 Initial version of GCC cleanup pass: just removes extraneous global symbol table entries for types
llvm-svn: 1062
2001-10-31 04:33:19 +00:00
Chris Lattner
98ce708757 Fix bug when inlining a method that refers to a global variable
llvm-svn: 1056
2001-10-31 02:27:26 +00:00
Chris Lattner
5c29b9fafd Initial checkin
llvm-svn: 897
2001-10-18 20:05:37 +00:00
Chris Lattner
4429216038 Convert optimizations to the pass infrastructure
llvm-svn: 873
2001-10-18 01:32:34 +00:00
Chris Lattner
8dc436c6db Minor cleanup
llvm-svn: 812
2001-10-14 23:29:30 +00:00
Chris Lattner
8314c1f1bc Support indirect calls
llvm-svn: 764
2001-10-13 06:52:31 +00:00
Chris Lattner
08b1dde37e Commit more code over to new cast style
llvm-svn: 697
2001-10-02 03:41:24 +00:00
Chris Lattner
ad1b0a1a83 Convert more code to use new style casts
Eliminate old style casts from value.h

llvm-svn: 696
2001-10-01 20:11:19 +00:00
Chris Lattner
797730ca28 Constant pool is dead
llvm-svn: 455
2001-09-07 16:42:51 +00:00
Chris Lattner
11f4097f50 Support external methods
llvm-svn: 200
2001-07-15 21:43:45 +00:00
Chris Lattner
c00392210d Broad superficial changes:
* Renamed getOpcode to getOpcodeName
* Changed getOpcodeName to return a const char * instead of string
* Added a getOpcode method to replace getInstType
* Changed code to use getOpcode instead of getInstType

llvm-svn: 152
2001-07-07 19:24:15 +00:00
Chris Lattner
6f7587e4d3 Changed the fundemental architecture of Operands for Instructions. Now
Operands are maintained as a vector<Use> in the User class, and operator
iterators are provided as before.  Getting an operand no longer requires
a virtual function call.

WARNING: getOperand(x) where x >= getNumOperands() will now assert instead
of returning null!

llvm-svn: 149
2001-07-07 08:36:50 +00:00
Chris Lattner
0815f96a2f Optimizations got their own header files
Optimizations now live in the 'opt' namespace
include/llvm/Opt was renamed include/llvm/Optimizations

llvm-svn: 113
2001-06-30 04:36:40 +00:00
Chris Lattner
d616582a7a Miscellaneous cleanups:
* Convert post to pre-increment for for loops
  * Use generic programming more
  * Use new Value::cast* instructions
  * Use new Module, Method, & BasicBlock forwarding methods
  * Use new facilities in STLExtras.h
  * Use new Instruction::isPHINode() method

llvm-svn: 96
2001-06-27 23:41:11 +00:00
Chris Lattner
a6d2f96bdb Updates to support
* Changes in PHI node structure

llvm-svn: 25
2001-06-11 15:04:40 +00:00
Chris Lattner
e6b9b382e2 Initial revision
llvm-svn: 2
2001-06-06 20:29:01 +00:00