Commit Graph

20171 Commits

Author SHA1 Message Date
Chris Lattner
3748147aaf Emit the switch stmt cases in alphabetical order instead of pointer order,
which is not stable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23456 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 21:59:35 +00:00
Jim Laskey
e6b90fba4a Addition of a simple two pass scheduler. This version is currently hacked up
for testing and will require target machine info to do a proper scheduling.
The simple scheduler can be turned on using -sched=simple (defaults
to -sched=none)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23455 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 21:57:04 +00:00
Chris Lattner
6bc7e513d5 implement a fixme: only select values once, even if used multiple times.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23454 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 21:53:26 +00:00
Chris Lattner
ff0c1ef9eb Remove some dead code. ctor evaluation subsumes empty ctor elim
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23453 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 20:38:20 +00:00
Chris Lattner
a22fdb0a37 Add support for alloca, implementing ctor-list-opt.ll:CTOR6
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23452 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 17:07:09 +00:00
Chris Lattner
33c36f399f Testcase that uses an alloca
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23451 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 17:06:32 +00:00
Chris Lattner
aae4a1cd3f Add a debug printout, fix a crash on kc++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23450 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 07:34:35 +00:00
Chris Lattner
798b4d5bb3 Implement loads/stores through GEP's of globals. This implements
ctor-list-opt.ll:CTOR5.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23449 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 06:52:44 +00:00
Chris Lattner
43898ef0ae add another case, this one that uses getelementptr instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23448 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 06:51:50 +00:00
Chris Lattner
0b142e3920 Replace TraverseGEPInitializer with ConstantFoldLoadThroughGEPConstantExpr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23447 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 05:34:07 +00:00
Chris Lattner
ebe61201d1 Eliminate GetGEPGlobalInitializer in favor of the more powerful
ConstantFoldLoadThroughGEPConstantExpr function in the utils lib.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23446 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 05:28:52 +00:00
Chris Lattner
363f2a26d5 Factor the GetGEPGlobalInitializer out of this pass and into Transforms/Utils
as ConstantFoldLoadThroughGEPConstantExpr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23445 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 05:28:06 +00:00
Chris Lattner
c5f52e6da1 Move the ConstantFoldLoadThroughGEPConstantExpr function out of the InstCombine
pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23444 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 05:27:10 +00:00
Chris Lattner
c5406b55d5 add a new function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23443 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 05:26:32 +00:00
Chris Lattner
562a055ca7 add a comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23442 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 05:16:34 +00:00
Chris Lattner
04de1cfb2b Add support for getelementptr, load, and correctly reject volatile stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23441 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 05:15:37 +00:00
Chris Lattner
d44b0ff038 add a test for load
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23440 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 05:14:48 +00:00
Chris Lattner
cdf98bed96 Add support for br/brcond/switch and phi
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23439 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 04:57:38 +00:00
Chris Lattner
44b19f2bcb add another testcase with simple control flow
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23438 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 04:57:10 +00:00
Chris Lattner
79c1101947 Add a simple interpreter to this code, allowing us to statically evaluate
global ctors that are simple enough.  This implements ctor-list-opt.ll:CTOR2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23437 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 04:44:35 +00:00
Chris Lattner
1fcfe32e51 make this harder: put some code into it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23436 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 04:43:01 +00:00
Chris Lattner
db973e60ce factor some code into a InstallGlobalCtors method, add comments. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23435 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 02:31:18 +00:00
Chris Lattner
7d8e58f384 Make the global opt optimizer work on modules with a null terminator, by
accepting the null even with a non-65535 init prio


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23434 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 02:19:27 +00:00
Chris Lattner
b1ab458047 Factor this code out into a few methods.
Implement the start of global ctor optimization.  It is currently smart
enough to remove the global ctor for cases like this:

struct foo {
  foo() {}
} x;

... saving a bit of startup time for the program.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23433 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 01:43:45 +00:00
Chris Lattner
09eec56af0 new testcase for static ctor list optimizations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23432 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-26 01:42:03 +00:00
Jeff Cohen
a48283baa3 Fix VC++ build errors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23431 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-25 19:04:43 +00:00
Chris Lattner
aebac50e77 Fix some logic I broke that caused a regression on
SimplifyLibCalls/2005-05-20-sprintf-crash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23430 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-25 07:06:48 +00:00
Chris Lattner
5931c54e85 Move MaskedValueIsZero up.
Match a bunch of idioms for sign extensions, implementing InstCombine/signext.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23428 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-24 23:43:33 +00:00
Chris Lattner
8a11da021b All of these should turn into sign extends (e.g. extsh/extsb on PPC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23427 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-24 23:42:18 +00:00
Chris Lattner
a58ef7b652 Add long-overdue helpers for getting constants with known upper bits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23426 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-24 22:57:28 +00:00
Chris Lattner
5d735bf29b Simplify this code a bit by relying on recursive simplification. Support
sprintf("%s", P)'s that have uses.

s/hasNUses(0)/use_empty()/


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23425 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-24 22:17:06 +00:00
Chris Lattner
397fa21f27 Enhance this to check for a crash, add a case that crashes simplifylibcalls,
and add a case that has uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23424 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-24 22:16:04 +00:00
Chris Lattner
d4f43519c2 new testcase that crashes the CFE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23423 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-24 20:54:33 +00:00
Chris Lattner
5fada3b218 new testcase for PR630
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23422 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-24 08:38:28 +00:00
Chris Lattner
5b845c9443 Add support for a marker byte that indicates that we shouldn't add the user
prefix to a symbol name


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23421 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-24 08:24:28 +00:00
Chris Lattner
8baaa4f0b6 change proto slightly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23420 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-24 08:23:53 +00:00
Chris Lattner
296dfe3b8a memoize translations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23419 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-24 00:50:51 +00:00
Chris Lattner
ea874f3306 Teach the dag isel generator how to construct arbitrary immediates. The
generated isel now tries li then lis, then lis+ori.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23418 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-24 00:41:58 +00:00
Chris Lattner
72fe91c4dd Teach the DAG isel generator to emit code that creates nodes.
Fix a few corner cases parsing things like (i32 imm:$foo)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23417 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-24 00:40:24 +00:00
Chris Lattner
8fc3568d98 Emit better code (no more copies for var references), and support DAG patterns
(e.g. things like rotates).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23416 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 23:16:51 +00:00
Chris Lattner
547394ca38 Fix a fixme by passing around SDOperand's instead of SDNode*'s
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23415 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 21:53:45 +00:00
Chris Lattner
d1ff35a49d Emit code that matches the incoming DAG pattern and checks predicates.
This does not check that types match yet, but PPC only has one integer type
;-).

This also doesn't have the code to build the resultant dag.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23414 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 21:33:23 +00:00
Chris Lattner
3f7e91477e emit information about the order patterns are to be matched.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23413 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 20:52:47 +00:00
Chris Lattner
813033248c start filling in the switch stmt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23412 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 19:36:15 +00:00
Chris Lattner
b60e0815df remove some debugging code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23411 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 18:49:09 +00:00
Chris Lattner
263d1e469d Fold two consequtive branches that share a common destination between them.
This implements SimplifyCFG/branch-fold.ll, and is useful on ?:/min/max heavy
code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23410 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 18:47:20 +00:00
Chris Lattner
9a82a3ccac new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23409 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 18:43:57 +00:00
Chris Lattner
055dc102e9 simplify some logic further
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23408 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 07:23:18 +00:00
Chris Lattner
f58c1a578e pull a bunch of logic out of SimplifyCFG into a helper fn
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23407 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 06:39:30 +00:00
Chris Lattner
7c439929bc speed up Archive::isBytecodeArchive in the case when the archive doesn't have
an llvm-ranlib symtab.  This speeds up gccld -native on an almost empty .o file
from 1.63s to 0.18s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23406 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-23 06:22:58 +00:00