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

4640 Commits

Author SHA1 Message Date
Brian Gaeke
9501118e3b Minor leftover fixups from replaceMachineCodeForFunction () change.
llvm-svn: 9295
2003-10-20 17:59:09 +00:00
Brian Gaeke
b4ceb43a43 Make replaceMachineCodeForFunction() return void.
llvm-svn: 9289
2003-10-20 15:17:12 +00:00
Brian Gaeke
afbe8787cc Make replaceMachineCodeForFunction return void.
llvm-svn: 9288
2003-10-20 15:15:17 +00:00
Chris Lattner
332429f023 Apparently the dependencies are wrong for this file, so it didn't rebuild it
when changing Instruction.def.  :(

llvm-svn: 9286
2003-10-20 14:12:52 +00:00
Chris Lattner
caf5825a8a Reorder for minor efficiency gain
llvm-svn: 9285
2003-10-20 05:54:26 +00:00
Chris Lattner
c4f8226aaf Emit x86 instructions for: A = B op C, where A and B are 16-bit registers,
C is a constant which can be sign-extended from 8 bits without value loss,
and op is one of: add, sub, imul, and, or, xor.

This allows the JIT to emit the one byte version of the constant instead of
the two or 4 byte version.  Because these instructions are very common, this
can save a LOT of code space.  For example, I sampled two benchmarks, 176.gcc
and 254.gap.

BM        Old     New    Reduction
176.gcc 2673621 2548962  4.89%
254.gap  498261  475104  4.87%

Note that while the percentage is not spectacular, this did eliminate
124.6 _KILOBYTES_ of codespace from gcc.  Not bad.

Note that this doesn't effect the llc version at all, because the assembler
already does this optimization.

llvm-svn: 9284
2003-10-20 05:53:31 +00:00
Chris Lattner
bdc522f19d Hrm, a relic from the past. How cute :)
llvm-svn: 9283
2003-10-20 05:45:49 +00:00
Chris Lattner
c83d8249cb Further cleanups and simplifications
llvm-svn: 9282
2003-10-20 04:48:06 +00:00
Chris Lattner
fce0650cee Eliminate code for pointer size and endianness emulation.
llvm-svn: 9281
2003-10-20 04:11:23 +00:00
Misha Brukman
be506fc1c5 The Grammar Police was here.
llvm-svn: 9280
2003-10-20 04:03:10 +00:00
Chris Lattner
5a577c0b28 * Rename X86::IMULr16 -> X86::IMULrr16
* Implement R1 = R2 * C where R1 and R2 are 32 or 16 bits. This avoids an
  extra copy into a register, reducing register pressure.

llvm-svn: 9278
2003-10-20 03:42:58 +00:00
Chris Lattner
7a4e225f37 Eliminate unused class
llvm-svn: 9270
2003-10-19 21:39:41 +00:00
Chris Lattner
87843f87b8 Change the Opcode enum for PHI nodes from "Instruction::PHINode" to "Instruction::PHI" to be more consistent with the other instructions.
llvm-svn: 9269
2003-10-19 21:34:28 +00:00
Chris Lattner
3d519c7bab * Multiplications by 2^X are turned into shifts. This factors code out of the
getelementptr code path for use by other code paths (like malloc and alloca).
* Optimize comparisons with zero
* Generate neg, not, inc, and dec instructions, when possible.

This gives some code size wins, which might translate into performance.  We'll
see tommorow in the nightly tester.

llvm-svn: 9267
2003-10-19 21:09:10 +00:00
Chris Lattner
57825f087d Add some new instructions. Wheee
llvm-svn: 9266
2003-10-19 19:25:35 +00:00
Chris Lattner
9107ee3a11 .string adds an implicit zero at the end. This is not what we wanted.
This fixes PR#44.

llvm-svn: 9252
2003-10-19 02:51:01 +00:00
Chris Lattner
9a758cd924 Add debugtype, make output marginally more nice
llvm-svn: 9251
2003-10-19 02:27:40 +00:00
Chris Lattner
5c98a2d33a Fix PR #47
llvm-svn: 9250
2003-10-19 02:14:58 +00:00
Chris Lattner
de87c8a892 Fix bug: Jello/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.llx
This also fixes miscompilation of 176.gcc.

llvm-svn: 9249
2003-10-19 00:26:11 +00:00
Chris Lattner
27798b47fb Without this option, the -run-llc mode does not work with shared objects at
all, making it pointless for use with the code generator debugger.  With it,
it works like a charm.

llvm-svn: 9245
2003-10-18 21:54:47 +00:00
Chris Lattner
620cb7e35a Fix warning
llvm-svn: 9236
2003-10-18 19:48:10 +00:00
Chris Lattner
3ff64cf568 add support for new linkage types
llvm-svn: 9228
2003-10-18 06:30:21 +00:00
Chris Lattner
e4a69325ff Fix PR#50
llvm-svn: 9227
2003-10-18 06:14:59 +00:00
Chris Lattner
29825508f0 Add support for the new varargs intrinsics and instructions
llvm-svn: 9226
2003-10-18 05:57:43 +00:00
Chris Lattner
ae52a1b309 ADd support for the new varargs instructions
llvm-svn: 9225
2003-10-18 05:56:52 +00:00
Chris Lattner
0a276257ae Add support for the new varargs intrinsics
llvm-svn: 9224
2003-10-18 05:56:40 +00:00
Chris Lattner
080765e65d Update the sparc backend to at least compile correctly with the new varargs stuff even if it's not all implemented yet.
llvm-svn: 9223
2003-10-18 05:55:58 +00:00
Chris Lattner
79135c051e Interpret the new varargs intrinsics correctly
llvm-svn: 9222
2003-10-18 05:55:25 +00:00
Chris Lattner
e4fc9caea1 Updated to emit the final 1.0 bytecode format. This supports weak linkage,
more efficient encoding of varargs calls, and the new varargs intrinsics.

llvm-svn: 9221
2003-10-18 05:54:48 +00:00
Chris Lattner
3f700e8e47 * New revised variable argument handling support
* More dense bytecode encoding for varargs calls (like printf)
* Eliminated the extremely old bytecode format.  rev #0 is now 1.0

llvm-svn: 9220
2003-10-18 05:54:18 +00:00
Chris Lattner
d0e3a15a9e New revised variable argument handling support
llvm-svn: 9219
2003-10-18 05:53:13 +00:00
Misha Brukman
a35a69da97 Chris says it's better to assert that TheModule is valid than silently return 0.
llvm-svn: 9212
2003-10-17 21:59:57 +00:00
Brian Gaeke
821c0e653c You can't just blat the address into memory, you have to blat its
displacement.

llvm-svn: 9210
2003-10-17 21:47:25 +00:00
Misha Brukman
546d6e6764 Don't release the Module, as that invalidates the Module* within the
ModuleProvider, which has bad consequences in lli::callAsMain() which tries to
access that same Module*.

llvm-svn: 9205
2003-10-17 18:31:59 +00:00
Brian Gaeke
21797d71d9 Implement replaceMachineCodeForFunction() for x86.
llvm-svn: 9204
2003-10-17 18:27:46 +00:00
Brian Gaeke
e966765990 Refactor jump insertion code from CompilationCallback() into insertJumpAtAddr().
Make insertFarJumpAtAddr() return void, because nothing uses its return value.
Remove some commented-out code.
Implement replaceMachineCodeForFunction() for SPARC.

llvm-svn: 9203
2003-10-17 18:27:37 +00:00
Brian Gaeke
4380148f33 Add prototype for replaceMachineCodeForFunction().
llvm-svn: 9202
2003-10-17 18:27:25 +00:00
Misha Brukman
d32cfacbc7 Return the Module that we just materialized.
llvm-svn: 9201
2003-10-17 18:27:13 +00:00
Brian Gaeke
eaf7472fd7 Tidy up doxygen comment for getPointerToFunction().
Add prototypes for recompileAndRelinkFunction() and runJITOnFunction().

llvm-svn: 9200
2003-10-17 18:27:12 +00:00
Brian Gaeke
7b9b6dbd63 Refactor running the JIT passes on a single function into the new method,
runJITOnFunction().

Add new method for recompiling and patching in new versions of functions,
recompileAndRelinkFunction().

llvm-svn: 9199
2003-10-17 18:27:00 +00:00
Brian Gaeke
7157eed00f Remove extra blank line.
llvm-svn: 9196
2003-10-17 18:09:10 +00:00
Chris Lattner
67a86ccbed Do not crash on empty structures
llvm-svn: 9195
2003-10-17 18:03:54 +00:00
Chris Lattner
17f8f2e317 Tighten up handling of checks for shift instructions
llvm-svn: 9191
2003-10-17 05:11:44 +00:00
Alkis Evlogimenos
5a1f705c88 Eliminate some extraneous code in SlotCalculator::insertVal().
Rename SlotCalculator::getValSlot() to SlotCalculator::getSlot(),
       SlotCalculator::insertValue() to SlotCalculator::getOrCreateSlot(),
       SlotCalculator::insertVal() to SlotCalculator::insertValue(), and
       SlotCalculator::doInsertVal() to SlotCalculator::doInsertValue().

llvm-svn: 9190
2003-10-17 02:02:40 +00:00
Brian Gaeke
edea9eca83 Fix typo in comment.
llvm-svn: 9187
2003-10-16 23:45:05 +00:00
Brian Gaeke
9b4da738dd Fix a typo in a comment, and zap a blank line.
llvm-svn: 9184
2003-10-16 23:33:38 +00:00
Misha Brukman
54c766e934 Add separator between different types of readers.
llvm-svn: 9183
2003-10-16 21:19:54 +00:00
Misha Brukman
d5c9118c89 JIT.cpp:
* #include "llvm/ModuleProvider"
* alphabetize #includes
* omit extraneous parens in pointer expressions

VM.cpp:
* #include "llvm/ModuleProvider"
* alphabetize #includes

llvm-svn: 9182
2003-10-16 21:19:34 +00:00
Misha Brukman
45a9016e1d * Reorder includes as per the style guide
* Move the constructors from .h file here
* Document ExecutionEngine::create()
* Catch exception possibly thrown by ModuleProvider::releaseModule()

llvm-svn: 9181
2003-10-16 21:18:05 +00:00
Chris Lattner
39b976aed8 Minor cleanups
llvm-svn: 9177
2003-10-16 20:12:13 +00:00
Chris Lattner
f46c45682a Add support for 'weak' linkage.
llvm-svn: 9171
2003-10-16 18:29:00 +00:00
Chris Lattner
2bdaaa4e08 Add support for 'weak' linkage.
For now, we translate linkonce into weak linkage in the bytecode format because
we don't have enough bits to represent it.  We will rev the bytecode version
soon anyways, so this will be fixed in the near future.

llvm-svn: 9170
2003-10-16 18:28:50 +00:00
Chris Lattner
09ef1749f7 Completely rewrite support for the Value::use_* list. Now, all operations on
this list (except use_size()) are constant time.  Before the killUse method
(used whenever something stopped using a value) was linear time, and thus
very very slow for large programs.

This speeds GCCAS up _substantially_ on large programs: almost 2x for 176.gcc:

176.gcc:     77.07s -> 37.38s
177.mesa:     7.59s ->  5.57s
252.eon:     21.02s -> 19.52s (*)
253.perlbmk: 11.40s -> 13.05s
254.gap:      7.25s -> 7.42s

252.eon would speed up a whole lot more, but optimization time is being
dominated by the inlining pass, which needs to be fixed.

llvm-svn: 9160
2003-10-16 16:53:07 +00:00
Chris Lattner
f0da6e06e6 This code does not require random access use_lists
llvm-svn: 9156
2003-10-16 16:49:12 +00:00
Chris Lattner
0747f39327 Eliminate using declaration
Rewrite code to work with use_lists what are either random access or bidirectional

llvm-svn: 9155
2003-10-16 16:48:53 +00:00
Chris Lattner
eab4a2d0d1 #include vector which we will need here soon
llvm-svn: 9144
2003-10-15 22:09:32 +00:00
Brian Gaeke
255e770272 Fix up error message.
llvm-svn: 9139
2003-10-15 20:46:58 +00:00
Chris Lattner
f2ed60c0b7 Decrease usage of use_size()
llvm-svn: 9135
2003-10-15 16:48:29 +00:00
Chris Lattner
c6778e91f4 Cleanup
llvm-svn: 9133
2003-10-15 16:42:21 +00:00
Chris Lattner
ac95730fca Generalize abstract interpreter interface to allow linking in an arbitrary number of shared objects
llvm-svn: 9129
2003-10-14 21:52:52 +00:00
Misha Brukman
50fa0a7bae Order #includes as per the style guide.
llvm-svn: 9128
2003-10-14 21:42:11 +00:00
Misha Brukman
1d9479ba78 Enabling incremental bytecode loading in the JIT:
* FunctionPassManager ctor now takes in a ModuleProvider
* run() materializes function before running passes on it

llvm-svn: 9126
2003-10-14 21:38:42 +00:00
Misha Brukman
5252af2728 Enabling incremental bytecode loading in the JIT:
* The VM is now constructed with a ModuleProvider

llvm-svn: 9125
2003-10-14 21:37:41 +00:00
Misha Brukman
cc1cfd01ed Enabling incremental bytecode loading in the JIT:
* ExecutionEngine and VM can be constructed using a ModuleProvider.

llvm-svn: 9124
2003-10-14 21:36:31 +00:00
Chris Lattner
1cad7eb7b0 Substantial cleanups:
* Add header comment
 * Remove extraneous #includes
 * Move the FileType enum into the GCC class
 * The GCC class is not virtual.
 * Move all of the "constructor" functions into the classes themselves
 * Stop using cl::list as arguments, use std::vector instead (which cl::list
   derives from)
 * Improve comments

llvm-svn: 9121
2003-10-14 21:34:11 +00:00
Chris Lattner
187faf250c Actually return an error if something bad happens, don't just exit.
llvm-svn: 9119
2003-10-14 21:07:25 +00:00
Chris Lattner
c115e75755 Output a contorted sequence of instructions to make sure that we don't access
off the bottom of the stack.  This fixes PR#41

llvm-svn: 9114
2003-10-14 19:09:05 +00:00
Chris Lattner
907de53acb Disable the leaf function optimization, which is apparently not legal on
X86/linux.  :(  The problem is that a signal delivered while the function
is executing could clobber the functions stack.  This is a partial fix
for PR41.

llvm-svn: 9113
2003-10-14 18:52:41 +00:00
Chris Lattner
a567862e89 Do not move variable sized allocations to the top of the caller, which might
break dominance relationships, and is otherwise bad.  This fixes bug:
Inline/2003-10-13-AllocaDominanceProblem.ll.  This also fixes miscompilation
of 3 176.gcc source files (reload1.c, global.c, flow.c)

llvm-svn: 9109
2003-10-14 01:11:07 +00:00
Chris Lattner
55c1da7877 Do not allow fallthroughs in switch statements. This fixes PR37,
253.perlbmk, and test/Programs/SingleSource/UnitTests/2003-10-13-SwitchTest.c!

llvm-svn: 9101
2003-10-13 20:32:04 +00:00
Brian Gaeke
add2fc5294 Remove WordsEmitted statistic; there's already a non-backend-specific
jello statistic for this (just divide #-bytes-of-code-emitted by 4).

Rewrite head-of-file comment.

llvm-svn: 9098
2003-10-13 19:51:20 +00:00
Chris Lattner
be8bc81ce0 LLI no longer has -abort-on-exception
llvm-svn: 9097
2003-10-13 18:26:49 +00:00
Chris Lattner
9506b0d6e2 Use the autoconf macro John wrote
llvm-svn: 9095
2003-10-13 17:13:53 +00:00
Chris Lattner
dda241ffe4 Whoops, we inserted into the wrong set. What's up with the dead set anyway?
llvm-svn: 9094
2003-10-13 16:49:21 +00:00
Chris Lattner
752b5bcffd Use external df iterators to avoid revisiting blocks in functions with
multiple setjmp calls.

llvm-svn: 9093
2003-10-13 16:44:50 +00:00
Chris Lattner
97f3f7e819 Make use of "external" depth-first iterators to avoid revisiting nodes
multiple times.  This reduces the time to construct post-dominance sets a LOT.
For example, optimizing perlbmk goes from taking 12.9894s to 1.4074s.

llvm-svn: 9091
2003-10-13 16:36:06 +00:00
Chris Lattner
c39d256841 Stop using "reverse depth first" order
llvm-svn: 9081
2003-10-13 15:21:58 +00:00
Chris Lattner
0ad8f7bb8f Minor cleanups
llvm-svn: 9079
2003-10-13 14:57:53 +00:00
Chris Lattner
20cebd6ccb Speed up TypesEqual by specializing it for all of the derived types, avoiding
a lot of virtual method dispatch overhead.

llvm-svn: 9078
2003-10-13 14:55:56 +00:00
Chris Lattner
8f34f82f84 Avoid calling getTypeSlot more
llvm-svn: 9077
2003-10-13 14:34:59 +00:00
Chris Lattner
bc7c13c803 Avoid creating lots of pointless opaque types, with short lifetimes
llvm-svn: 9076
2003-10-13 14:03:36 +00:00
Chris Lattner
1a43c990a8 This is a header file, hear me roar
llvm-svn: 9075
2003-10-13 05:34:24 +00:00
Chris Lattner
34b8bc6716 * Remove extraneous #includes
* Fix a nasty initializer ordering bug.  Any only-CFG passes which registered
  themselves before the CFGOnlyAnalysis vector initialized got forgotten and
  thus got invalidated and recomputed.

In particular, in my compiled version of gccas, the Loop information pass was
being recomputed unnecessarily.

llvm-svn: 9074
2003-10-13 05:33:01 +00:00
Chris Lattner
7a5241cc99 Wrap code at 80 columns
llvm-svn: 9073
2003-10-13 05:04:27 +00:00
Chris Lattner
09abbd2da6 This is a header file, thus it needs a -*-C++-*-
llvm-svn: 9072
2003-10-13 04:22:07 +00:00
Chris Lattner
b6c8569f05 Regularize header file comments
llvm-svn: 9071
2003-10-13 03:32:08 +00:00
Chris Lattner
1c989f6d65 Regularize header file comment, eliminate using's
llvm-svn: 9069
2003-10-13 03:30:47 +00:00
Chris Lattner
c8586d8d06 Minor cleanups
llvm-svn: 9067
2003-10-13 01:02:33 +00:00
Chris Lattner
af8f585013 Checkin an improvement contributed by Bill:
Only transform call sites in a setjmp'ing function which are reachable from
the setjmp.  If the call dominates the setjmp (for example), the called
function cannot longjmp to the setjmp.

This dramatically reduces the number of invoke instructions created in some
large testcases.

llvm-svn: 9066
2003-10-13 00:57:16 +00:00
Chris Lattner
7519b1216b Add support to the loop canonicalization pass to make it transform loops to
have a SINGLE backedge.  This is useful to, for example, the -indvars pass.

This implements testcase LoopSimplify/single-backedge.ll and closes PR#34

llvm-svn: 9065
2003-10-13 00:37:13 +00:00
Chris Lattner
be9a1813c6 Make getNumBackEdges more efficient
llvm-svn: 9063
2003-10-12 22:14:27 +00:00
Chris Lattner
f4ca01758d Rename loop preheaders pass to loop simplify
llvm-svn: 9061
2003-10-12 21:52:28 +00:00
Chris Lattner
1c8a980870 File is renamed to LoopSimplify.cpp
llvm-svn: 9059
2003-10-12 21:44:18 +00:00
Chris Lattner
7fe9661cae First step in renaming the preheaders pass to loopsimplify
llvm-svn: 9058
2003-10-12 21:43:28 +00:00
Chris Lattner
510dfc942a The preheader insertion pass only depends on the CFG. Mark it as such, which
allows GCCAS to only run it once.

llvm-svn: 9056
2003-10-12 19:33:10 +00:00
Chris Lattner
bfffd3052d Rename method
llvm-svn: 9055
2003-10-12 18:52:12 +00:00
Chris Lattner
5567441de9 * Spell "necessary" correctly
* Print floating point values using C99 hexadecimal style FP if possible.
  This increases the number of floating point constants that may be emitted
  inline, and improves precision for global variable initializers which
  can not be emitted in integer form.

This fixes the Olden/Power benchmark with the CBE!!!!

llvm-svn: 9052
2003-10-12 08:12:58 +00:00
Chris Lattner
b81f5e6db8 * Be TBAA safe
* Fix isFPCSafeToPrint to find more constants safe to print, which it was
  failing because ftostr was padding with leading space characters.
* Scan the entire module for global constants instead of each function at a
  time.  This has the advantage of allowing us to emit constants at global
  scope instead of function scope.  This speeds FP programs quite a bit.

llvm-svn: 9048
2003-10-12 04:36:29 +00:00
Brian Gaeke
143f9b5000 Make mmap's fd for anonymous memory acquisition default to -1, except on
Linux. This is consistent with what FreeBSD and Solaris both want.
This makes the JIT work on FreeBSD 5.1-RELEASE. Whee.

llvm-svn: 9045
2003-10-11 03:51:18 +00:00
Brian Gaeke
acbc37a19e Don't include "Config/stdlib.h".
llvm-svn: 9037
2003-10-10 19:12:22 +00:00
Brian Gaeke
b4b2fa9060 Include <cctype> and <cstdlib> instead of <ctype.h> and "Config/stdlib.h".
llvm-svn: 9036
2003-10-10 19:12:08 +00:00
Brian Gaeke
e5249bf429 Include <cstdio> instead of <stdio.h>.
llvm-svn: 9032
2003-10-10 18:46:52 +00:00
Brian Gaeke
a3f850a182 Don't include Config/stdio.h or <stdio.h>.
llvm-svn: 9031
2003-10-10 18:46:29 +00:00
Misha Brukman
868eac95dd Fix spelling.
llvm-svn: 9027
2003-10-10 17:57:28 +00:00
Misha Brukman
c59161ff84 Fix spelling/grammar.
llvm-svn: 9023
2003-10-10 17:54:14 +00:00
Misha Brukman
e7d07e3cf1 * Tabs to spaces
* Doxygenified function comments
* Added FIXMEs to solicit documentation for other functions

llvm-svn: 9022
2003-10-10 17:45:12 +00:00
Misha Brukman
32c5aec6ec Fix spelling.
llvm-svn: 9021
2003-10-10 17:42:19 +00:00
Misha Brukman
9fcbd8d16f * Doxygenified comments
* Wrap code at 80 columns
* Ordered includes according to LLVM style guide

llvm-svn: 9020
2003-10-10 17:41:32 +00:00
Brian Gaeke
c38ad8b86e Never set any signal handlers.
Never call setjmp(), longjmp() or strsignal().

llvm-svn: 9014
2003-10-10 17:03:22 +00:00
Brian Gaeke
e90a3199eb Rewrite head-of-file comment.
In lookupFunction():
 Change to use "F" for Function argument instead of ancient "M".
 Remove commented-out code.
 Change to use GetAddressOfSymbol instead of dlsym.

llvm-svn: 9013
2003-10-10 17:03:10 +00:00
Brian Gaeke
30e2817dc5 Change to use GetAddressOfSymbol instead of dlsym.
llvm-svn: 9012
2003-10-10 17:02:42 +00:00
Brian Gaeke
26333b9b39 Change to use LinkDynamicObject instead of dlopen.
llvm-svn: 9011
2003-10-10 17:01:49 +00:00
Brian Gaeke
254dd12289 Change to use strtoul instead of strtoll.
llvm-svn: 9010
2003-10-10 17:01:36 +00:00
Misha Brukman
339d9fb58d Fixing the spelling of this filename.
llvm-svn: 9009
2003-10-10 16:57:31 +00:00
Brian Gaeke
ec80b3028e Add my abstracted dynamic linker support files.
llvm-svn: 9008
2003-10-10 16:55:42 +00:00
Chris Lattner
1d18ef00c3 Reserve space for PHI operands
llvm-svn: 9007
2003-10-10 16:34:58 +00:00
Chris Lattner
c7042b310c Ok, the "fix" for this is to do a real associative container. Symbol tables
are ordered by name, not by slot, so the previous solution wasn't any good.
On a large testcase, this reduces time to parse from 2.17s to 1.58s.

llvm-svn: 9002
2003-10-10 05:43:47 +00:00
Chris Lattner
269b0c1d79 Accept 'weak' as a linkage type. For now, just turn it into linkonce linkage
llvm-svn: 8998
2003-10-10 04:54:02 +00:00
Chris Lattner
e4012123b6 Add better checking
llvm-svn: 8996
2003-10-10 03:56:01 +00:00
Chris Lattner
3fd3ddbd2d Another 10% performance improvement by not using replaceAllUsesWith
llvm-svn: 8994
2003-10-09 23:10:14 +00:00
Chris Lattner
b8883ea999 Reserve space for PHI nodes when we read them in. This provides a VERY
tasty 15% speedup on the testcase from Bill.

llvm-svn: 8993
2003-10-09 22:46:58 +00:00
Chris Lattner
7467b5ff4e Use the version of getValue that takes the type plane instead of the type
if possible.  This provides a consistent 8.5% speedup.

llvm-svn: 8991
2003-10-09 22:39:30 +00:00
Chris Lattner
85f5b18995 Pass a vector around to reduce dynamic allocation
Throw the RawInst class in an anon namespace

llvm-svn: 8990
2003-10-09 20:45:42 +00:00
Chris Lattner
36f2dcd3d5 Change getConstantValue to throw an exception on error, not return null
llvm-svn: 8988
2003-10-09 20:41:16 +00:00
Chris Lattner
01d8fd6a3b Do not read past the end of the contained type list
llvm-svn: 8986
2003-10-09 20:31:18 +00:00
Chris Lattner
c0abb16551 Remove potentially N^2 algorithm from symbol table reader. No speedup
in practice though

llvm-svn: 8985
2003-10-09 20:30:04 +00:00
Chris Lattner
8f99fbb02c Major refactoring of the bytecode reader. This includes the following
changes:
  * BytecodeReader::getType(...) used to return a null pointer
    on error.  This was only checked about half the time.  Now we convert
    it to throw an exception, and delete the half that checked for error.
    This was checked in before, but psmith crashed and lost the change :(
  * insertValue no longer returns -1 on error, so callers don't need to
    check for it.
  * Substantial rewrite of InstructionReader.cpp, to use more efficient,
    simpler, data structures.  This provides another 5% speedup.  This also
    makes the code much easier to read and understand.

llvm-svn: 8984
2003-10-09 20:22:47 +00:00
Chris Lattner
4eb71c8940 Significantly clean up parsing of instructions. This exceptionizes and
simplifies the control flow a bit.  This provides a small (~3%) speedup,
but it's primarily a cleanup exercise.

llvm-svn: 8983
2003-10-09 18:25:19 +00:00
Chris Lattner
c527ed77b8 Eliminate the instruction placeholder. Simplify a bunch of code.
This results in no significant speedup, but does provide simpler code

llvm-svn: 8980
2003-10-09 06:14:26 +00:00
Chris Lattner
6f7b5bd63f Eliminate the old LateResolveValues data structure, replacing it with a
new, simpler, ForwardReferences data structure.  This is just the first
simple replacement, subsequent changes will improve the code more.

This simple change improves the performance of loading a file from HDF5
(contributed by Bill) from 2.36s to 1.93s, a 22% improvement.  This
presumably has to do with the fact that we only create ONE placeholder for
a particular forward referenced values, and also may be because the data
structure is much simpler.

llvm-svn: 8979
2003-10-09 06:05:40 +00:00
Chris Lattner
3b7b192b6a Remove a dead method
llvm-svn: 8978
2003-10-09 05:25:34 +00:00
Chris Lattner
55e1c2edfb This patch substantially simplifies and cleans up handling of basic blocks
in the bytecode parser.  Before we tried to shoehorn basic blocks into the
"getValue" code path with other types of values.  For a variety of reasons
this was a bad idea, so this patch separates it out into its own data structure.

This simplifies the code, makes it fit in 80 columns, and is also much faster.
In a testcase provided by Bill, which has lots of PHI nodes, this patch speeds
up bytecode parsing from taking 6.9s to taking 2.32s.  More speedups to
follow later.

llvm-svn: 8977
2003-10-08 22:52:54 +00:00
Chris Lattner
c920c81739 Inline the postResolveValues method. It was poorly named anyway
llvm-svn: 8976
2003-10-08 21:51:46 +00:00
Chris Lattner
a7d6d16c13 Various cleanups and simplifications. This speeds up reading a bytecode file
Bill gave me from 8.69s to 6.90s.

llvm-svn: 8971
2003-10-08 21:18:57 +00:00
Misha Brukman
7b758ed3b5 Destroy allocated resources on exception.
llvm-svn: 8969
2003-10-08 19:55:47 +00:00
Chris Lattner
bf95cc12a3 Update comment
llvm-svn: 8965
2003-10-08 16:56:11 +00:00
Chris Lattner
9cece85acb Use a set to keep track of which edges have been noticed as executable already
to avoid reprocessing PHI nodes needlessly.  This speeds up the big bad PHI
testcase 43%: from 104.9826 to 73.5157s

llvm-svn: 8964
2003-10-08 16:55:34 +00:00
Chris Lattner
251ff679ce Minor fixes here and there
llvm-svn: 8963
2003-10-08 16:21:03 +00:00
Chris Lattner
36960b263b Avoid building data structures we don't really need. This improves the runtime
of a test that Bill Wendling sent me from 228.5s to 105s.  Obviously there is
more improvement to be had, but this is a nice speedup which should be "felt"
by many programs.

llvm-svn: 8962
2003-10-08 15:47:41 +00:00
Alkis Evlogimenos
74568bc9d4 Change MRegisterDesc::AliasSet, TargetInstrDescriptor::ImplicitDefs
and TargetInstrDescriptor::ImplicitUses to always point to a null
terminated array and never be null. So there is no need to check for
pointer validity when iterating over those sets. Code that looked
like:

if (const unsigned* AS = TID.ImplicitDefs) {
  for (int i = 0; AS[i]; ++i) {
    // use AS[i]
  }
}

was changed to:

for (const unsigned* AS = TID.ImplicitDefs; *AS; ++AS) {
  // use *AS
}

llvm-svn: 8960
2003-10-08 05:20:08 +00:00
Chris Lattner
16b7ed1eaa whoops, don't accidentally lose variable names
llvm-svn: 8955
2003-10-07 22:58:41 +00:00
Chris Lattner
f507e6e58e Fix bug: InstCombine/cast.ll:test11 / PR#7
llvm-svn: 8954
2003-10-07 22:54:13 +00:00
Chris Lattner
e8b656a62f Refactor code a bit
llvm-svn: 8952
2003-10-07 22:32:43 +00:00
Chris Lattner
bd123c6e51 Add a sanity check for constant expression casts
llvm-svn: 8951
2003-10-07 22:19:19 +00:00
Chris Lattner
bbfaf77c5d Fix bugzilla bug #5
llvm-svn: 8930
2003-10-07 19:33:31 +00:00
Chris Lattner
a18861ff29 Bill contributed this major rewrite of the -lowerswitch pass to make it generate
logarithmic conditional branch sequences instead of linear sequences.  Thanks Bill!

llvm-svn: 8928
2003-10-07 18:46:23 +00:00
Chris Lattner
edb06ce061 Fix bug in previous checkin
llvm-svn: 8922
2003-10-07 15:17:02 +00:00
Chris Lattner
151444f98f Actually _PASS IN_ NO_RESERVE if we have it.
Thanks to Brian for fixing this obvious oops

llvm-svn: 8899
2003-10-06 19:07:41 +00:00
Misha Brukman
a1a55a6071 ToolRunner.h has been moved from include/Support to include/llvm/Support.
llvm-svn: 8898
2003-10-06 18:37:24 +00:00
Chris Lattner
6f939cc824 Users can never be null
llvm-svn: 8895
2003-10-06 17:33:39 +00:00
Chris Lattner
e6955c77e0 Minor speedups for the instcombine pass
llvm-svn: 8894
2003-10-06 17:11:01 +00:00
Chris Lattner
512ab7b5fd Speed up the predicate used to decide when to inline by caching the size
of callees between executions.

On eon, in release mode, this changes the inliner from taking 11.5712s
to taking 2.2066s.  In debug mode, it went from taking 14.4148s to
taking 7.0745s.  In release mode, this is a 24.7% speedup of gccas, in
debug mode, it's a total speedup of 11.7%.

This also makes it slightly more aggressive.  This could be because we
are not judging the size of the functions quite as accurately as before.
When we start looking at the performance of the generated code, this can
be investigated further.

llvm-svn: 8893
2003-10-06 15:52:43 +00:00
Brian Gaeke
f9a4341b54 Add # of printed instructions statistic to both the SPARC and X86 LLC backends.
llvm-svn: 8892
2003-10-06 15:41:21 +00:00
Chris Lattner
5b814e067a Avoid doing pointless work. Amazingly, this makes us go faster.
Running the inliner on 252.eon used to take 48.4763s, now it takes 14.4148s.

In release mode, it went from taking 25.8741s to taking 11.5712s.

This also fixes a FIXME.

llvm-svn: 8890
2003-10-06 15:23:43 +00:00
Chris Lattner
da4d014b4c Implement the NamedRegionTimer class
llvm-svn: 8889
2003-10-06 15:02:31 +00:00
Brian Gaeke
7bd96d6b90 All of our supported operating systems (so far) and FreeBSD technically
want you to include <sys/stat.h> for fstat(), struct stat, and friends.

llvm-svn: 8887
2003-10-06 03:30:28 +00:00
Chris Lattner
87f1ce9b96 This changes the PromoteMemToReg function to create "pruned" SSA form, not
"minimal" SSA form (in other words, it doesn't insert dead PHIs).  This
speeds up the mem2reg pass very significantly because it doesn't have to
do a lot of frivolous work in many common cases.

In the 252.eon function I have been playing with, this doesn't even insert
the 120 PHI nodes that it used to which were trivially dead (in the process
of promoting 356 alloca instructions overall).  This speeds up the mem2reg
pass from 1.2459s to 0.1284s.  More significantly, the DCE pass used to take
2.4138s to remove the 120 dead PHI nodes that mem2reg constructed, now it
takes 0.0134s (which is the time to scan the function and decide that there
is nothing dead).  So overall, on this one function, we speed things up a
total of 3.5179s, which is a 24.8x speedup!  :)

This change is tested by the Mem2Reg/2003-10-05-DeadPHIInsertion.ll test,
which now passes.

llvm-svn: 8884
2003-10-05 22:19:20 +00:00
Chris Lattner
d1c3f771f8 Change the interface to PromoteMemToReg to also take a DominatorTree
llvm-svn: 8883
2003-10-05 21:20:13 +00:00
Chris Lattner
47c12a2771 Speed up the mem2reg transform for allocas which are only read/written in a single
basic block.  This is amazingly common in code generated by the C/C++ front-ends.
This change makes it not have to insert ANY phi nodes, whereas before it would insert
a ton of dead ones which DCE would have to clean up.

Thus, this fix improves compile-time performance of these trivial allocas in two ways:
  1. It doesn't have to do the walking and book-keeping for renaming
  2. It does not insert dead phi nodes for them which would have to
     subsequently be cleaned up.

On my favorite testcase from 252.eon, this special case handles 305 out of
356 promoted allocas in the function.  It speeds up the mem2reg pass from 7.5256s
to 1.2505s.  It inserts 677 fewer dead PHI nodes, which speeds up a subsequent
-dce pass from 18.7524s to 2.4806s.

There are still 120 trivially dead PHI nodes being inserted for variables used
in multiple basic blocks, but they are not handled by this patch.

llvm-svn: 8881
2003-10-05 20:54:03 +00:00
Chris Lattner
ef607b19d1 Move support/lib/Support back to lib/Support
llvm-svn: 8874
2003-10-05 19:24:38 +00:00
Chris Lattner
e0ae24753d Add support for the Invoke instruction by using the LowerInvoke pass
llvm-svn: 8872
2003-10-05 19:16:09 +00:00
Chris Lattner
fc3f9605a7 Instead of hacking in custom support for Invoke/Unwind, use the LowerInvoke pass
llvm-svn: 8871
2003-10-05 19:15:47 +00:00
Chris Lattner
40a236b9ea Initial checkin of the LLVM->LLVM transform to support code generators which
do not support stack unwinding yet

llvm-svn: 8869
2003-10-05 19:14:42 +00:00
Chris Lattner
5206a78804 simplify-cfg is really a function pass
llvm-svn: 8868
2003-10-05 19:14:16 +00:00
Chris Lattner
e2a7875d26 Be more careful handling PHI nodes, which might be of potentially high degree.
This reduces the time to verify a function from eon with a large number of
large PHI nodes from 22996s (6.38 hours) to 10.5499s

llvm-svn: 8866
2003-10-05 17:44:18 +00:00
Chris Lattner
ada012bfcd The first PHI node may be null, scan for the first non-null one
llvm-svn: 8865
2003-10-05 05:34:39 +00:00
Chris Lattner
a5fd39ee21 The VersionNumbers vector is only used during PHI placement. Turn it into an argument, allowing us to get rid of the vector.
llvm-svn: 8864
2003-10-05 04:33:22 +00:00
Chris Lattner
4877c37b80 * Update file header comment
*** Revamp the code which handled unreachable code in the function.  Now the
    code is much more efficient for high-degree basic blocks, such as those
    that occur in the 252.eon SPEC benchmark.

For the interested, the time to promote a SINGLE alloca in _ZN7mrScene4ReadERSi
function used to be > 3.5s.  Now it is < .075s.  The function has a LOT of
allocas in it, so it appeared to be infinite looping, this should make it much
nicer.  :)

llvm-svn: 8863
2003-10-05 04:26:39 +00:00
Chris Lattner
baba417853 Simplify the loop a bit
llvm-svn: 8862
2003-10-05 03:45:44 +00:00
Chris Lattner
59281d3581 There is no need for separate WriteSets and PhiNodeBlocks lists. It is just a
work-list of value definitions.  This allows elimination of the explicit
'iterative' step of the algorithm, and also reuses temporary memory better.

llvm-svn: 8861
2003-10-05 03:39:10 +00:00
Chris Lattner
5958d93c95 The PhiNodes 2D vector is only used during PHI node placement. It doesn't
need to be an instance variable!

llvm-svn: 8860
2003-10-05 03:26:25 +00:00
Chris Lattner
91d69f2693 * Document instance vars better
* Fuse two parallel loops
* Use a more specific type for AllocaLookup

llvm-svn: 8859
2003-10-05 03:16:07 +00:00
Chris Lattner
773a1c4474 Two small cleanups/speedups:
* Do not insert a new entry into NewPhiNodes during the rename pass if there are no PHIs in a block.
 * Do not compute WriteSets in parallel

llvm-svn: 8858
2003-10-05 02:37:36 +00:00
Chris Lattner
9f0a542057 * Minor cleanups
* Eliminate the KillList instance variable, instead, just delete loads and
  stores as they are "renamed", and delete allocas when they are done
* Make the 'visited' set an instance variable to avoid passing it on the stack.

llvm-svn: 8857
2003-10-05 01:52:53 +00:00
Chris Lattner
dcefc3244a A couple of minor code cleanups.
Print literal doubles using ftostr instead of <<, because it yields higher precision numbers.

llvm-svn: 8855
2003-10-05 00:40:51 +00:00
Chris Lattner
b5f0d32b91 Type tables are now AbstractTypeUsers. This allows them to merge together
constants as necessary due to type resolution.  With this change, the
following spec benchmarks now link: 176.gcc, 177.mesa, 252.eon,
253.perlbmk, & 300.twolf.  IOW, all SPEC INT and FP benchmarks now link.

llvm-svn: 8853
2003-10-05 00:17:43 +00:00
Chris Lattner
def80d731a Rename AbstractModuleProvider -> ModuleProvider, to match the header file name,
and because, while the class used by the interface is abstract, the actual
concept is not.

llvm-svn: 8850
2003-10-04 20:14:59 +00:00
Chris Lattner
7a9db7a722 Transform two methods to return pointers directly instead of returning them
as 'by reference' arguments.

llvm-svn: 8849
2003-10-04 20:00:03 +00:00
Chris Lattner
0e866f36a0 Use V for values, not D.
llvm-svn: 8848
2003-10-04 19:29:21 +00:00
Chris Lattner
2b8c4bf029 Do not leak the ModuleProvider if releaseModule() throws.
llvm-svn: 8847
2003-10-04 19:19:37 +00:00
Chris Lattner
06dbcc0540 Minor random speedup: make Constant::getNullValue only call ConstantFOO::get
once!

llvm-svn: 8845
2003-10-03 19:34:51 +00:00
Chris Lattner
f66ac75a94 Explicit copy ctors are no longer needed
llvm-svn: 8844
2003-10-03 19:02:41 +00:00
Chris Lattner
a2c1509b21 Minor cleanups
llvm-svn: 8843
2003-10-03 18:57:54 +00:00
Chris Lattner
18c3f42894 This checkin basically amounts to a complete rewrite of the type-resolution
machinery.  This dramatically simplifies how things works, removes irritating
little corner cases, and overall improves speed and reliability.

Highlights of this change are:

1. The exponential algorithm built into the code is now gone.  For example
   the time to disassemble one bytecode file from the mesa benchmark went
   from taking 12.5s to taking 0.16s.
2. The linker bugs should be dramatically reduced.  The one remaining bug
   has to do with constant handling, which I actually introduced in
   "union-find" checkins.
3. The code is much easier to follow, as a result of fewer special cases.
   It's probably also smaller.  yaay.

llvm-svn: 8842
2003-10-03 18:46:24 +00:00
Chris Lattner
101d5058cb These methods are dead, remove them. Because the bodies will soon be
ressurected, just ifdef them out for now.

llvm-svn: 8840
2003-10-03 18:39:57 +00:00
Chris Lattner
85444d1dbd Dramatically simplify DerivedType::refineAbstractTypeToInternal
This makes use of the new PATypeHolder's to keep types from being deleted
prematurely, instead of the wierd "self reference" garbage.  This is easier
to understand and more efficient as well.

llvm-svn: 8834
2003-10-03 04:48:21 +00:00
Chris Lattner
b217f24289 Make the PATypeHolder use a simple union-find implementation to handle
merging of types.  This makes it MUCH more efficient than before, also
making things simpler.

llvm-svn: 8833
2003-10-02 23:35:57 +00:00
Chris Lattner
62331c44ab There is no need for BytecodeParser to be an AbstractTypeUser. Instead, it
can just use PATypeHolders

llvm-svn: 8832
2003-10-02 20:26:18 +00:00
Chris Lattner
83856d0df1 There is no reason for Value to be an AbstractTypeUser. This just makes things
significantly more complete.  Instead, just make DerivedType's AbstractTypeUser's,
and make Value contain a PATypeHolder.

llvm-svn: 8828
2003-10-02 19:44:40 +00:00
Chris Lattner
9f5802fac5 The objects mapped are really PATypeHolders, not PATypeHandles
llvm-svn: 8822
2003-10-02 19:00:34 +00:00
Alkis Evlogimenos
a37b58ce09 Moved enum and command-line option in separate file. Also added function that returns the user selected register allocator to the caller.
llvm-svn: 8819
2003-10-02 16:57:49 +00:00
Chris Lattner
059033218b Implement InstCombine/add.ll:test17 & 18
llvm-svn: 8817
2003-10-02 15:11:26 +00:00
Alkis Evlogimenos
42a09316bb Change llc command line for register allocators
llvm-svn: 8815
2003-10-02 06:13:19 +00:00
Alkis Evlogimenos
e6fdc87045 Use std::string::size_type for for ColonPos to stop gcc from giving a warning
llvm-svn: 8811
2003-10-01 22:49:22 +00:00
Alkis Evlogimenos
a50598c684 Revert previous change. For some reason this went into the main branch
llvm-svn: 8805
2003-10-01 19:40:13 +00:00
Alkis Evlogimenos
e3af981096 Added command line option for linear scan allocator
llvm-svn: 8804
2003-10-01 19:38:10 +00:00
Misha Brukman
15fd4fd90c The comment seems irrelevant as the pass has become a BasicBlock pass.
llvm-svn: 8803
2003-10-01 05:24:50 +00:00
Chris Lattner
bdca1b438d Make sure to get the definition of getRegisterAllocator
llvm-svn: 8801
2003-09-30 22:24:00 +00:00
Chris Lattner
5509b86d74 RegisterAllocation.h is going away
llvm-svn: 8795
2003-09-30 20:15:04 +00:00
Chris Lattner
b0860d88c2 include passes.h which defines the interface this file exposes
llvm-svn: 8793
2003-09-30 20:13:59 +00:00