Commit Graph

10104 Commits

Author SHA1 Message Date
Reid Spencer
3f7d8c65bb More Cleanup:
* Name the instructions by appending to name of original
* Factor common part out of a switch statement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21597 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-27 17:46:54 +00:00
Duraid Madina
85d5f6067d clean up some warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21590 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-27 11:57:39 +00:00
Reid Spencer
a16d5a5185 This is a cleanup commit:
* Correct stale documentation in a few places
* Re-order the file to better associate things and reduce line count
* Make the pass thread safe by caching the Function* objects needed by the
  optimizers in the pass object instead of globally.
* Provide the SimplifyLibCalls pass object to the optimizer classes so they
  can access cached Function* objects and TargetData info
* Make sure the pass resets its cache if the Module passed to runOnModule
  changes
* Rename CallOptimizer LibCallOptimization. All the classes are named
  *Optimization while the objects are *Optimizer.
* Don't cache Function* in the optimizer objects because they could be used
  by multiple PassManager's running in multiple threads
* Add an optimization for strcpy which is similar to strcat
* Add a "TODO" list at the end of the file for ideas on additional libcall
  optimizations that could be added (get ideas from other compilers).

Sorry for the huge diff. Its mostly reorganization of code. That won't
happen again as I believe the design and infrastructure for this pass is
now done or close to it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21589 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-27 07:54:40 +00:00
Chris Lattner
d651f441ae detect functions that never return, and turn the instruction following a
call to them into an 'unreachable' instruction.

This triggers a bunch of times, particularly on gcc:

gzip: 36
gcc: 601
eon: 12
bzip: 38


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21587 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-27 04:52:23 +00:00
Reid Spencer
026a87a868 Prefix the debug statistics so they group together.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21583 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-27 00:20:23 +00:00
Reid Spencer
1ea099c5fd In debug builds, make a statistic for each kind of call optimization. This
helps track down what gets triggered in the pass so its easier to identify
good test cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21582 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-27 00:05:45 +00:00
Chris Lattner
bc9fa589ef This analysis doesn't take 'throwing' into consideration, it looks at
'unwinding'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21581 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 23:53:25 +00:00
Reid Spencer
0ddf0d6bec Fix up the debug statement to actually use a newline .. radical concept.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21580 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 23:07:08 +00:00
Reid Spencer
ef99ea318e Uh, this isn't argpromotion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21579 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 23:05:17 +00:00
Reid Spencer
8f13261863 Add some debugging output so we can tell which calls are getting triggered
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21578 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 23:02:16 +00:00
Reid Spencer
47a3785062 No, seriously folks, memcpy really does return void.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21575 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 22:49:48 +00:00
Reid Spencer
a525f6d8f5 memcpy returns void!!!!!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21574 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 22:46:23 +00:00
Chris Lattner
3f80a38859 don't let Reid build void*'s :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21571 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 20:03:33 +00:00
Reid Spencer
43fd4d077f Fix some bugs found by running on llvm-test:
* MemCpyOptimization can only be optimized if the 3rd and 4th arguments are
  constants and we weren't checking for that.
* The result of llvm.memcpy (and llvm.memmove) is void* not sbyte*, put in
  a cast.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21570 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 19:55:57 +00:00
Reid Spencer
fcbdb9c85b Changes From Review Feedback:
* Have the SimplifyLibCalls pass acquire the TargetData and pass it down to
  the optimization classes so they can use it to make better choices for
  the signatures of functions, etc.
* Rearrange the code a little so the utility functions are closer to their
  usage and keep the core of the pass near the top of the files.
* Adjust the StrLen pass to get/use the correct prototype depending on the
  TargetData::getIntPtrType() result. The result of strlen is size_t which
  could be either uint or ulong depending on the platform.
* Clean up some coding nits (cast vs. dyn_cast, remove redundant items from
  a switch, etc.)
* Implement the MemMoveOptimization as a twin of MemCpyOptimization (they
  only differ in name).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21569 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 19:13:17 +00:00
Chris Lattner
318c149823 Make interval partition print correctly, patch contributed by
Vladimir Prus!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21566 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 14:48:28 +00:00
Chris Lattner
93b94a6ccf Fix the compile failures from last night.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21565 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 14:40:41 +00:00
Duraid Madina
4706c0395b constmul bugfix: multiply by 27611 was broken
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21564 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 09:42:50 +00:00
Duraid Madina
3b84bac3ef clean up the code! (oops) lots more cleaning left, however.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21563 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 08:43:47 +00:00
Reid Spencer
20754ac069 * Merge get_GVInitializer and getCharArrayLength into a single function
named getConstantStringLength. This is the common part of StrCpy and
  StrLen optimizations and probably several others, yet to be written. It
  performs all the validity checks for looking at constant arrays that are
  supposed to be null-terminated strings and then computes the actual
  length of the string.
* Implement the MemCpyOptimization class. This just turns memcpy of 1, 2, 4
  and 8 byte data blocks that are properly aligned on those boundaries into
  a load and a store. Much more could be done here but alignment
  restrictions and lack of knowledge of the target instruction set prevent
  use from doing significantly more. That will have to be delegated to the
  code generators as they lower llvm.memcpy calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21562 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 07:45:18 +00:00
Duraid Madina
b2322561cb * Add code to reduce multiplies by constant integers to shifts, adds and
subtracts. This is a very rough and nasty implementation of Lefevre's
  "pattern finding" algorithm. With a few small changes though, it should
  end up beating most other methods in common use, regardless of the size
  of the constant (currently, it's often one or two shifts worse)

  TODO: rewrite it so it's not hideously ugly (this is a translation from
        perl, which doesn't help ;)
        bypass most of it for multiplies by 2^n+1
	(eventually) teach it that some combinations of shift+add are
	cheaper than others (e.g. shladd on ia64, scaled adds on alpha)
	get it to try multiple booth encodings in search of the cheapest
	routine
	make it work for negative constants

  This is hacked up as a DAG->DAG transform, so once I clean it up I hope
  it'll be pulled out of here and put somewhere else. The only thing backends
  should really have to worry about for now is where to draw the line
  between using this code vs. going ahead and doing an integer multiply
  anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21560 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 07:23:02 +00:00
Reid Spencer
912401c3f6 * Implement StrLenOptimization
* Factor out commonalities between StrLenOptimization and StrCatOptimization
* Make sure that signatures return sbyte* not void*


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21559 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 05:24:00 +00:00
Reid Spencer
43e0baece3 Incorporate feedback from Chris:
* Change signatures of OptimizeCall and ValidateCalledFunction so they are
  non-const, allowing the optimization object to be modified. This is in
  support of caching things used across multiple calls.
* Provide two functions for constructing and caching function types
* Modify the StrCatOptimization to cache Function objects for strlen and
  llvm.memcpy so it doesn't regenerate them on each call site. Make sure
  these are invalidated each time we start the pass.
* Handle both a GEP Instruction and a GEP ConstantExpr
* Add additional checks to make sure we really are dealing with an arary of
  sbyte and that all the element initializers are ConstantInt or
  ConstantExpr that reduce to ConstantInt.
* Make sure the GlobalVariable is constant!
* Don't use ConstantArray::getString as it can fail and it doesn't give us
  the right thing. We must check for null bytes in the middle of the array.
* Use llvm.memcpy instead of memcpy so we can factor alignment into it.
* Don't use void* types in signatures, replace with sbyte* instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21555 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 03:26:15 +00:00
Chris Lattner
d36f979085 Fold (X > -1) | (Y > -1) --> (X&Y > -1)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21552 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-26 01:18:33 +00:00
Reid Spencer
855adb1ac4 Changes due to code review and new implementation:
* Don't use std::string for the function names, const char* will suffice
* Allow each CallOptimizer to validate the function signature before
  doing anything
* Repeatedly loop over the functions until an iteration produces
  no more optimizations. This allows one optimization to insert a
  call that is optimized by another optimization.
* Implement the ConstantArray portion of the StrCatOptimization
* Provide a template for the MemCpyOptimization
* Make ExitInMainOptimization split the block, not delete everything
  after the return instruction.
(This covers revision 1.3 and 1.4, as the 1.3 comments were botched)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21548 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-25 21:20:38 +00:00
Chris Lattner
229ab2e7b2 implement some more logical compares with constants, so that:
int foo1(int x, int y) {
  int t1 = x >= 0;
  int t2 = y >= 0;
  return t1 & t2;
}
int foo2(int x, int y) {
  int t1 = x == -1;
  int t2 = y == -1;
  return t1 & t2;
}

produces:

_foo1:
        or r2, r4, r3
        srwi r2, r2, 31
        xori r3, r2, 1
        blr
_foo2:
        and r2, r4, r3
        addic r2, r2, 1
        li r2, 0
        addze r3, r2
        blr

instead of:

_foo1:
        srwi r2, r4, 31
        xori r2, r2, 1
        srwi r3, r3, 31
        xori r3, r3, 1
        and r3, r2, r3
        blr
_foo2:
        addic r2, r4, 1
        li r2, 0
        addze r2, r2
        addic r3, r3, 1
        li r3, 0
        addze r3, r3
        and r3, r2, r3
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21547 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-25 21:20:28 +00:00
Reid Spencer
6cc0311c6d Lots of changes based on review and new functionality:
* Use a 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21546 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-25 21:11:48 +00:00
Chris Lattner
6ea9279304 Codegen x < 0 | y < 0 as (x|y) < 0. This allows us to compile this to:
_foo:
        or r2, r4, r3
        srwi r3, r2, 31
        blr

instead of:

_foo:
        srwi r2, r4, 31
        srwi r3, r3, 31
        or r3, r2, r3
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21544 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-25 21:03:25 +00:00
Chris Lattner
91bd25d9df Make dominates(A,B) work with post dominators. Patch contributed by
Naveen Neelakantam, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21543 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-25 20:50:33 +00:00
Chris Lattner
a70b66d49e implement getelementptr.ll:test10
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21541 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-25 20:17:30 +00:00
Chris Lattner
a1198b5254 Correctly handle global-argument aliases induced in main
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21537 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-25 19:16:31 +00:00
Chris Lattner
63320cc841 Don't mess up SCC traversal when a node has null edges out of it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21536 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-25 19:16:17 +00:00
Reid Spencer
b7c11e3966 Post-Review Cleanup:
* Fix comments at top of file
* Change algorithm for running the call optimizations from n*n to something
  closer to n.
* Use a hash_map to store and lookup the optimizations since there will
  eventually (or potentially) be a large number of them. This gets lookup
  based on the name of the function to O(1). Each CallOptimizer now has a
  std::string member named func_name that tracks the name of the function
  that it applies to. It is this string that is entered into the hash_map
  for fast comparison against the function names encountered in the module.
* Cleanup some style issues pertaining to iterator invalidation
* Don't pass the Function pointer to the OptimizeCall function because if
  the optimization needs it, it can get it from the CallInst passed in.
* Add the skeleton for a new CallOptimizer, StrCatOptimizer which will
  eventually replace strcat's of constant strings with direct copies.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21526 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-25 03:59:26 +00:00
Reid Spencer
a1aad3b0ed Shut GCC 4.0 up about classes that have virtual functions but a non-virtual
destructor. Just add the do-nothing virtual destructor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21524 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-25 02:55:55 +00:00
Reid Spencer
a7c049bf6a A new pass to provide specific optimizations for certain well-known library
calls. The pass visits all external functions in the module and determines
if such function calls can be optimized. The optimizations are specific to
the library calls involved. This initial version only optimizes calls to
exit(3) when they occur in main(): it changes them to ret instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21522 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-25 02:53:12 +00:00
Reid Spencer
e8f3848639 Older compilers won't like the inline virtual destructor in the header file
so we put the destructor in Pass.cpp and make it non-inline.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21520 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-25 01:01:35 +00:00
Reid Spencer
2b2a528374 Shut GCC 4.0 up about classes with virtual functions but no virtual
destructor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21510 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-24 22:27:20 +00:00
Chris Lattner
f52d681657 Eliminate cases where we could << by 64, which is undefined in C.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21500 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-24 17:46:05 +00:00
Chris Lattner
a1df33c0ee Implement xor.ll:test21: select (not C), A, B -> select C, B, A
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21495 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-24 07:30:14 +00:00
Chris Lattner
64001d0a13 Allow these methods to take a generic Value* to simplify clients. Use
const_cast instead of c casts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21493 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-24 07:28:37 +00:00
Chris Lattner
484d3cf0e3 Use getPrimitiveSizeInBits() instead of getPrimitiveSize()*8
Completely rework the 'setcc (cast x to larger), y' code.  This code has
the advantage of implementing setcc.ll:test19 (being more general than
the previous code) and being correct in all cases.

This allows us to unxfail 2004-11-27-SetCCForCastLargerAndConstant.ll,
and close PR454.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21491 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-24 06:59:08 +00:00
Chris Lattner
ea1049139e Fix a bug in my previous checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21485 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-23 22:01:39 +00:00
Chris Lattner
4f0247c10d Add a method, remove last use of Type.def
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21483 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-23 22:00:09 +00:00
Jeff Cohen
9d80930e95 Eliminate tabs and trailing spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21480 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-23 21:38:35 +00:00
Chris Lattner
cc1f24585e Propagate eq sets through the bu graphs to the cbu and eq graphs, fixing
a crash of the sfv on 188.ammp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21478 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-23 21:11:05 +00:00
Chris Lattner
6970b661cb Generalize the setcc -> PHI and Select folding optimizations to work with
any constant RHS, not just a constant integer RHS.  This implements
select.ll:test17


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21470 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-23 15:31:55 +00:00
Misha Brukman
dca7978d1d * Order #includes as per style guide
* Combine multiple ``std::cerr <<'' statements into one for simplicity


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21458 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 19:13:22 +00:00
Misha Brukman
27177f8c16 Convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21457 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 18:06:01 +00:00
Alkis Evlogimenos
38da41cc44 Silence gcc-4.0.0 warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21453 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 17:56:01 +00:00
Misha Brukman
7847fcac17 Convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21452 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 17:54:37 +00:00
Reid Spencer
18969fbc9f Implement the --enable-targets= feature of the configure script. The make
variable TARGETS_TO_BUILD is used to determine which targets in lib/Target
are built and which libraries are linked into llc. This effectively
implements the feature. One item remains: disabling targets in the dejagnu
test suite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21450 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 17:20:11 +00:00
Andrew Lenharth
500b4dba32 keep track of max depth stats
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21446 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 13:35:18 +00:00
Tanya Lattner
9f83822565 Updated dependence analyzer. Fixed numerous bugs. Same stage scheduling, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21444 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 06:32:48 +00:00
Chris Lattner
3fe4d3cb5b Malloc/Free have mod/ref effects. Do not allow CSE of function calls that
call malloc/free.  This fixes PR555.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21443 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 05:36:59 +00:00
Misha Brukman
3c94497ec7 Convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21440 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 04:08:30 +00:00
Misha Brukman
dedf2bd5a3 Convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21439 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-22 04:01:18 +00:00
Misha Brukman
fd93908ae8 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21427 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 23:48:37 +00:00
Misha Brukman
0e0a7a45d3 * Remove trailing whitespace
* Convert tabs to spaces


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21426 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 23:38:14 +00:00
Misha Brukman
b5f662fa03 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21425 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 23:30:14 +00:00
Misha Brukman
4633f1cde8 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21424 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 23:13:11 +00:00
Misha Brukman
f976c856fc Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21422 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 22:55:34 +00:00
Misha Brukman
d1c881a8d4 * Remove trailing whitespace
* Convert tabs to spaces


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21421 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 22:43:08 +00:00
Misha Brukman
edf128a7fa Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21420 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 22:36:52 +00:00
Misha Brukman
23c6d2cb79 * Remove trailing whitespace
* Convert tabs to spaces


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21418 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 21:48:46 +00:00
Misha Brukman
8a96c53d36 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21417 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 21:44:41 +00:00
Misha Brukman
2b37d7cf28 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21416 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 21:13:18 +00:00
Misha Brukman
019b63931b * Remove trailing whitespace
* Convert tabs to spaces


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21415 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 21:10:11 +00:00
Chris Lattner
837a521c48 Match another form of eqv
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21413 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 21:09:11 +00:00
Chris Lattner
109026290b Handle stores of global address as stores of immediates. Instead of:
test1:
        movl $N, %eax
        movl %eax, G
        ret

emit:

test1:
        movl $N, G
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21407 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 19:11:03 +00:00
Chris Lattner
75f354bd7a Handle (store &GV -> mem) as a store immediate. This often occurs for
printf format strings and other stuff.  Instead of generating this:

        movl $l1__2E_str_1, %eax
        movl %eax, (%esp)

we now emit:

        movl $l1__2E_str_1, (%esp)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21406 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 19:03:24 +00:00
Reid Spencer
8e827e8661 Use the actual uid/gid for defaulting the fields in the archive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21405 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 17:49:57 +00:00
Chris Lattner
cb2d1a2dc2 Fix a bug where we would not promote calls to invokes if they occured in
the same block as the setjmp.  Thanks to Greg Pettyjohn for noticing this!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21403 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 16:46:46 +00:00
Reid Spencer
3468e57f64 Eliminate calls to system dependent function getuid by using
the newly implemented sys::Process::GetCurrentUserId function. Replace
similarly for getgid.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21402 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 16:15:19 +00:00
Reid Spencer
93b3473478 Provide an implementation of the GetCurrentUserId and GetCurrentGroupId
methods that were recently added to the interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21401 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 16:12:57 +00:00
Chris Lattner
a5ed1bd00b add support for taking and resolving the address of free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21396 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 16:09:43 +00:00
Chris Lattner
566f600779 Improve doxygen, from part of Evan's patch that didn't apply.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21394 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 16:06:03 +00:00
Chris Lattner
0f67dd6237 Improve doxygen documentation, patch contributed by Evan Jones!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21393 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 16:04:49 +00:00
Chris Lattner
588bbbffa1 Improve and elimination. On PPC, for:
bool %test(int %X) {
        %Y = and int %X, 8
        %Z = setne int %Y, 0
        ret bool %Z
}

we now generate this:

        rlwinm r2, r3, 0, 28, 28
        srwi r3, r2, 3

instead of this:

        rlwinm r2, r3, 0, 28, 28
        srwi r2, r2, 3
        rlwinm r3, r2, 0, 31, 31

I'll leave it to Nate to get it down to one instruction. :)

---------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21391 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 06:28:15 +00:00
Chris Lattner
1c2a9b95dc Fold (x & 8) != 0 and (x & 8) == 8 into (x & 8) >> 3.
This turns this PPC code:

        rlwinm r2, r3, 0, 28, 28
        cmpwi cr7, r2, 8
        mfcr r2
        rlwinm r3, r2, 31, 31, 31

into this:

        rlwinm r2, r3, 0, 28, 28
        srwi r2, r2, 3
        rlwinm r3, r2, 0, 31, 31

Next up, nuking the extra and.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21390 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 06:12:41 +00:00
Chris Lattner
956db27a63 Instcombine this:
%shortcirc_val = select bool %tmp.1, bool true, bool %tmp.4             ; <bool> [#uses=1]
        %tmp.6 = cast bool %shortcirc_val to int                ; <int> [#uses=1]

into this:

        %shortcirc_val = or bool %tmp.1, %tmp.4         ; <bool> [#uses=1]
        %tmp.6 = cast bool %shortcirc_val to int                ; <int> [#uses=1]

not this:

        %tmp.4.cast = cast bool %tmp.4 to int           ; <int> [#uses=1]
        %tmp.6 = select bool %tmp.1, int 1, int %tmp.4.cast             ; <int> [#uses=1]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21389 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 05:43:13 +00:00
Chris Lattner
bf5d4fb7d8 Teach simplifycfg that setcc is cheap and non-trapping, so that it can
convert this:

        %tmp.1 = seteq int %i, 0                ; <bool> [#uses=1]
        br bool %tmp.1, label %shortcirc_done, label %shortcirc_next

shortcirc_next:         ; preds = %entry
        %tmp.4 = seteq int %j, 0                ; <bool> [#uses=1]
        br label %shortcirc_done

shortcirc_done:         ; preds = %shortcirc_next, %entry
        %shortcirc_val = phi bool [ %tmp.4, %shortcirc_next ], [ true, %entry ]         ; <bool> [#uses=1]

to this:
        %tmp.1 = seteq int %i, 0                ; <bool> [#uses=1]
        %tmp.4 = seteq int %j, 0                ; <bool> [#uses=1]
        %shortcirc_val = select bool %tmp.1, bool true, bool %tmp.4             ; <bool> [#uses=1]

... which is later simplified by instcombine into an or.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21388 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 05:31:13 +00:00
Reid Spencer
2aafadcc76 For Bug 543:
Standardize the error messages to be in "path: what failed: why" format.
Also attempt to use the correct errno to ThrowErrno in situations where
the errno value is erased by subsequent system calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21385 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 02:50:10 +00:00
Reid Spencer
03aee2e3f2 For Bug 543:
Allow the ThrowErrno function to optionally accept an error number
parameter so that callers can specify the error number to be used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21384 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 02:30:32 +00:00
Misha Brukman
d6a29a5304 Remove trailing whitespace, patch by Markus Oberhumer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21379 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 16:05:03 +00:00
Misha Brukman
22c46da12b Add FIXME by Markus Oberhumer from bug 545: not checking for "." in $PATH may
result in returning executable files that won't be runnable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21378 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 15:42:11 +00:00
Misha Brukman
8177bf8904 Do not mark directories as `executable', we only want program files
Patch by Markus Oberhumer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21377 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 15:33:22 +00:00
Misha Brukman
4619c75f64 Ignore dangling symlinks in getDirectoryContents()
Thanks to Markus Oberhumer for the patch!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21370 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 04:04:07 +00:00
Misha Brukman
4b2afe6394 Initialize fields mode, uid, and gid.
Patch by Markus Oberhumer.  Thanks!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21369 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 03:55:35 +00:00
Misha Brukman
72a9caa260 Align comments together for consistency
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21368 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-20 03:52:59 +00:00
Chris Lattner
7d27fc0252 Wrap some long lines.
Make IPSCCP strip off dead constant exprs that are using functions, making
them appear as though their address is taken.  This allows us to propagate
some more pool descriptors, lowering the overhead of pool alloc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21363 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 19:16:19 +00:00
Chris Lattner
20b463629b fix PR549
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21360 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 15:27:29 +00:00
Chris Lattner
240d6f4c9d Eliminate a broken transformation, fixing PR548
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21354 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 06:04:18 +00:00
Chris Lattner
f577c6122f Add completely untested support for mtcrf/mfcrf encoding
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21353 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 05:41:52 +00:00
Chris Lattner
14522e31d9 switch over the rest of the formats that use RC to use isDOT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21352 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 05:21:30 +00:00
Chris Lattner
883059fb58 Convert the XForm instrs and XSForm instruction over to use isDOT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21351 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 05:15:18 +00:00
Chris Lattner
97a2d42999 Now that the ppc64 and vmx operands of I are always 0, forward substitute
them away.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21350 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 05:05:22 +00:00
Chris Lattner
a611ab72ca convert over bform and iform instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21349 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 05:00:59 +00:00
Chris Lattner
57226fbc7b Convert over DForm and DSForm instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21348 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 04:59:28 +00:00
Chris Lattner
e19d0b1130 Convert XLForm and XForm instructions over to use PPC64 when appropriate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21347 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 04:51:30 +00:00
Chris Lattner
5035cef732 Convert XO XS and XFX forms to use isPPC64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21346 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 04:40:07 +00:00
Chris Lattner
0bdc6f1fd4 Turn PPC64 and VMX into classes that can be added to instructions instead of
bits that must be passed up the inheritance hierarchy.  Convert MForm and AForm
instructions over


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21345 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-19 04:32:54 +00:00
Nate Begeman
1cbf3abbb8 Next round of PPC CR optimizations. For the following code:
int %bar(float %a, float %b, float %c, float %d) {
entry:
    %tmp.1 = setlt float %a, %d
    %tmp.2 = setlt float %b, %d
    %or = or bool %tmp.1, %tmp.2
    %tmp.3 = setgt float %c, %d
    %tmp.4 = or bool %or, %tmp.3
    %tmp.5 = and bool %tmp.4, true
    %retval = cast bool %tmp.5 to int
    ret int %retval
}

We now emit:

_bar:
.LBB_bar_0:     ; entry
        fcmpu cr0, f1, f4
        fcmpu cr1, f2, f4
        cror 0, 0, 4
        fcmpu cr1, f3, f4
        cror 28, 0, 5
        mfcr r2
        rlwinm r3, r2, 29, 31, 31
        blr

Instead of:

_bar:
.LBB_bar_0:     ; entry
        fcmpu cr7, f1, f4
        mfcr r2
        rlwinm r2, r2, 29, 31, 31
        fcmpu cr7, f2, f4
        mfcr r3
        rlwinm r3, r3, 29, 31, 31
        or r2, r2, r3
        fcmpu cr7, f3, f4
        mfcr r3
        rlwinm r3, r3, 30, 31, 31
        or r3, r2, r3
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21321 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 07:48:09 +00:00
Chris Lattner
ea96b5edbb silence a bogus warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21320 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 05:26:21 +00:00
Chris Lattner
fda2b55e1b Fold setcc of MVT::i1 operands into logical operations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21319 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 04:48:12 +00:00
Chris Lattner
4a44c8df19 Another minor simplification: handle setcc (zero_extend x), c -> setcc(x, c')
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21318 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 04:30:45 +00:00
Chris Lattner
7467c9b086 Another simple xform
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21317 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 04:11:19 +00:00
Chris Lattner
706aa9685a Fold:
// (X != 0) | (Y != 0) -> (X|Y != 0)
        // (X == 0) & (Y == 0) -> (X|Y == 0)

Compiling this:

int %bar(int %a, int %b) {
        entry:
        %tmp.1 = setne int %a, 0
        %tmp.2 = setne int %b, 0
        %tmp.3 = or bool %tmp.1, %tmp.2
        %retval = cast bool %tmp.3 to int
        ret int %retval
        }

to this:

_bar:
        or r2, r3, r4
        addic r3, r2, -1
        subfe r3, r3, r2
        blr

instead of:

_bar:
        addic r2, r3, -1
        subfe r2, r2, r3
        addic r3, r4, -1
        subfe r3, r3, r4
        or r3, r2, r3
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21316 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 03:59:53 +00:00
Chris Lattner
36019aa5c6 Make the AND elimination operation recursive and significantly more powerful,
eliminating an and for Nate's testcase:

int %bar(int %a, int %b) {
        entry:
        %tmp.1 = setne int %a, 0
        %tmp.2 = setne int %b, 0
        %tmp.3 = or bool %tmp.1, %tmp.2
        %retval = cast bool %tmp.3 to int
        ret int %retval
        }

generating:

_bar:
        addic r2, r3, -1
        subfe r2, r2, r3
        addic r3, r4, -1
        subfe r3, r3, r4
        or r3, r2, r3
        blr

instead of:

_bar:
        addic r2, r3, -1
        subfe r2, r2, r3
        addic r3, r4, -1
        subfe r3, r3, r4
        or r2, r2, r3
        rlwinm r3, r2, 0, 31, 31
        blr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21315 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 03:48:41 +00:00
Nate Begeman
16ac709c63 Change codegen for setcc to read the bit directly out of the condition
register.  Added support in the .td file for the g5-specific variant
  of cr -> gpr moves that executes faster, but we currently don't
  generate it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21314 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 02:43:24 +00:00
Chris Lattner
d91ff7cd3b Add support for targets that require stubs for external functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21313 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 01:44:27 +00:00
Chris Lattner
477d1de9b2 Handle ExternalSymbol operands in the PPC JIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21312 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-18 00:46:10 +00:00
Nate Begeman
f8b02949e3 Make pattern isel default for ppc
Add new ppc beta option related to using condition registers
Make pattern isel control flag (-enable-pattern-isel) global and tristate
  0 == off
  1 == on
  2 == target default


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21309 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-15 22:12:16 +00:00
Chris Lattner
36d12733bb a new simple pass, which will be extended to be more useful in the future.
This pass forward branches through conditions when it can show that the
conditions is either always true or false for a predecessor.  This currently
only handles the most simple cases of this, but is successful at threading
across 2489 branches and 65 switch instructions in 176.gcc, which isn't bad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21306 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-15 19:28:32 +00:00
Andrew Lenharth
1e0d9bda62 fix calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21303 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-14 17:34:20 +00:00
Andrew Lenharth
3ae1829fe5 a 21264 fix, and fix the operator precidence on an and -> zap check (should fix hundreds of test cases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21302 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-14 16:24:00 +00:00
Duraid Madina
1ce0c015ad print negative 64 bit immediates as negative numbers, makes things a little
easier on the eyes, not that numbers like 18446744073709541376 are bad or
anything


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21300 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-14 10:08:01 +00:00
Duraid Madina
3eb7150c3e oops, this stopped us turning movl r4=0xFFFFFFFF;; and rX, r4 into zxt4
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21299 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-14 10:06:35 +00:00
Nate Begeman
7bfba7d5e3 Implement multi-way branches through logical ops on condition registers.
This can generate considerably shorter code, reducing the size of crafty
by almost 1%.  Also fix the printing of mcrf.  The code is currently
disabled until it gets a bit more testing, but should work as-is.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21298 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-14 09:45:08 +00:00
Nate Begeman
72ea281d61 Add a couple missing transforms in getSetCC that were triggering assertions
in the PPC Pattern ISel


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21297 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-14 08:56:52 +00:00
Duraid Madina
c4ccc2db6b we have zextloads, not sextloads!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21296 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-14 08:37:32 +00:00
Nate Begeman
ef7288c824 Add the necessary support to codegen condition register logical ops with
register allocated condition registers.  Make sure that the printed
  output is gas compatible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21295 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-14 03:20:38 +00:00
Nate Begeman
1b7f7fbf95 Start allocating condition registers. Almost all explicit uses of CR0 are
now gone.  Next step is to get rid of the remaining ones and then start
allocating bools to CRs where appropriate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21294 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 23:15:44 +00:00
Nate Begeman
3664ceffdd Implement the fold shift X, zext(Y) -> shift X, Y at the target level,
where it is safe to do so.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21293 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 22:14:14 +00:00
Nate Begeman
eea805e74c Disbale the broken fold of shift + sz[ext] for now
Move the transform for select (a < 0) ? b : 0 into the dag from ppc isel
Enable the dag to fold and (setcc, 1) -> setcc for targets where setcc
  always produces zero or one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21291 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 21:23:31 +00:00
Chris Lattner
97e001dec7 fix an infinite loop
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21289 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 20:06:29 +00:00
Chris Lattner
fd8d389ede fix some serious miscompiles on ia64, alpha, and ppc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21288 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 19:53:40 +00:00
Chris Lattner
51679c430f avoid work when possible, perhaps fix the problem nate and andrew are seeing
with != 0 comparisons vanishing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21287 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 19:41:05 +00:00
Andrew Lenharth
c24b537399 WOW, function calls still seem to work after this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21286 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 17:17:28 +00:00
Andrew Lenharth
556c44e116 prepare for func call optimization
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21285 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 16:19:50 +00:00
Duraid Madina
ed09502a0b * add the shladd instruction
* fold left shifts of 1, 2, 3 or 4 bits into adds

  This doesn't save much now, but should get a serious workout once
  multiplies by constants get converted to shift/add/sub sequences.
  Hold on! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21282 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 06:12:04 +00:00
Andrew Lenharth
4f7cba5af8 add matches for SxADDL and company, as well as simplify the SxADDQ code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21281 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 05:19:55 +00:00
Chris Lattner
e9c35e7309 Implement expansion of unsigned i64 -> FP.
Note that this probably only works for little endian targets, but is enough
to get siod working :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21280 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 05:09:42 +00:00
Duraid Madina
c02780eed1 * if ANDing with a constant of the form:
0x00000..00FFF..FF
      ^      ^
      ^      ^
    any number of
    0's followed by
    some number of
    1's

    then we use dep.z to just paste zeros over the input. For the special
    cases where this is zxt1/zxt2/zxt4, we use those instructions instead,
    because we're all about readability!!!
    that's what it's about!! readability!

  *twitch* ;D


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21279 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 04:50:54 +00:00
Andrew Lenharth
483f22d817 added all flavors of zap for anding
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21276 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 03:47:03 +00:00
Chris Lattner
ffe284c651 Make expansion of uint->fp cast assert out instead of infinitely recurse.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21275 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 03:42:14 +00:00
Chris Lattner
5bf2686a1b Fix some mysteriously missing {}'s which cause the miscompilation of
Olden/mst, Ptrdist/bc, Obsequi, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21274 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 03:29:53 +00:00
Chris Lattner
e666fcfbdd add back the optimization that Nate added for shl X, (zext_inreg y)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21273 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 02:58:13 +00:00
Chris Lattner
8a8dbfa57c Oops, remove these too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21272 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 02:47:57 +00:00
Chris Lattner
519f40ba4e remove one more occurance of this that snuck in
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21271 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 02:46:17 +00:00
Chris Lattner
2942e9c301 Remove support for ZERO_EXTEND_INREG. This pessimizes code, genering stuff
like this:

        ldah $1,1($31)
        lda $1,-1($1)
        and $0,$1,$24

instead of this:

        zap $0,252,$24

To get this back, the selector should recognize the ISD::AND case where this
happens and emit the appropriate ZAP instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21270 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 02:43:40 +00:00
Chris Lattner
6ac614a4f2 Remove special handling of ZERO_EXTEND_INREG. This pessimizes code, causing
things like this:

       mov r9 = 65535;;
       and r8 = r8, r9;;

To be emitted instead of:

        zxt2 r8 = r8;;

To get this back, the selector for ISD::AND should recognize this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21269 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 02:41:52 +00:00
Chris Lattner
c951d87fe9 Elimate handling of ZERO_EXTEND_INREG. This causes the PPC backend to emit
andi instructions instead of rlwinm instructions for zero extend, but they
seem like they would take the same time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21268 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 02:40:26 +00:00
Chris Lattner
91302a10ae Z_E_I is gone
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21267 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 02:39:05 +00:00
Chris Lattner
23993561e2 Instead of making ZERO_EXTEND_INREG nodes, use the helper method in
SelectionDAG to do the job with AND.  Don't legalize Z_E_I anymore as
it is gone


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21266 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 02:38:47 +00:00
Chris Lattner
0f2287baa1 Remove all foldings of ZERO_EXTEND_INREG, moving them to work for AND nodes
instead.  OVerall, this increases the amount of folding we can do.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21265 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-13 02:38:18 +00:00
Nate Begeman
db81ebab89 Fold shift x, [sz]ext(y) -> shift x, y
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21262 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-12 23:32:28 +00:00
Nate Begeman
b882752bd0 Fold shift by size larger than type size to undef
Make llvm undef values generate ISD::UNDEF nodes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21261 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-12 23:12:17 +00:00
Nate Begeman
9765c25eb7 Implement setcc op, -1 sequences
Remove dead setcc op, 0 sequences
Coming later: generalization of op, imm


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21260 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-12 21:22:28 +00:00
Chris Lattner
1c51c6ac13 promote extload i1 -> extload i8
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21258 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-12 20:30:10 +00:00
Chris Lattner
3464547968 add an argument to allow avoiding deleting phi nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21255 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-12 18:52:14 +00:00