Commit Graph

59 Commits

Author SHA1 Message Date
Duncan Sands
58921feaa9 Fix comment typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-01 12:23:49 +00:00
Dan Gohman
6e68f59b78 Constant folding for insertvalue and extractvalue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51889 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-03 00:15:20 +00:00
Dan Gohman
041e2eb517 IR support for extractvalue and insertvalue instructions. Also, begin
moving toward making structs and arrays first-class types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-15 19:50:34 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Dan Gohman
ac72058dd6 The #include <iterator> isn't needed in this header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43232 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-22 20:44:10 +00:00
David Greene
b8f74793b9 Update GEP constructors to use an iterator interface to fix
GLIBCXX_DEBUG issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41697 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-04 15:46:09 +00:00
Chris Lattner
2b9a5daf7c Revise APIs for creating constantexpr GEPs to not require the use of vectors.
This allows us to eliminate many temporary vectors, and theirassociated malloc/free pairs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33692 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-31 04:40:28 +00:00
Reid Spencer
b913bbaa41 Cleanup ConstantFoldCompareInstruction:
1. Make the arguments const like the other ConstantFold* functions.
2. Clean up evaluateFCmpRelation so it makes sense for floating point.
3. Implement the use of evaluateFCmpRelation to fold floating point CEs
4. Shorten a variable name so more things fit on one line.
5. Fix various comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32759 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-24 18:52:08 +00:00
Reid Spencer
e4d87aa2de For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-23 06:05:41 +00:00
Reid Spencer
2f8bbf5d65 For PR950: Implement a stub for folding ICmp and FCmp instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32169 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-04 05:19:34 +00:00
Reid Spencer
3da59db637 For PR950:
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31931 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-27 01:05:10 +00:00
Chris Lattner
00f1023cf8 Add shufflevector support, todo, implement better constant folding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27510 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-08 01:18:18 +00:00
Robert Bocchino
c152f9cd26 VMCore support for the insertelement operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25408 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-17 20:07:22 +00:00
Robert Bocchino
bb90a7aa7b Added constant folding support for the extractelement operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25187 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-10 20:03:46 +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
Chris Lattner
1fca5ff62b Convert 'struct' to 'class' in various places to adhere to the coding standards
and work better with VC++.  Patch contributed by Morten Ofstad!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17281 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-27 16:14:51 +00:00
Chris Lattner
7fa6e666ec Allow creation of GEP constantexprs with a vector of value* operands as
well as a vector of constant*'s.  It turns out that this is more efficient
and all of the clients want to do that, so we should cater to them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16923 91177308-0d34-0410-b5e6-96231b3b80d8
2004-10-11 22:52:25 +00:00
Chris Lattner
82d55902c6 Fix a link error using VS8.0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14071 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-08 17:53:24 +00:00
Chris Lattner
647f82be07 Add new function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12322 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:53:41 +00:00
Chris Lattner
cbfd406541 Rename ConstantHandling.* -> ConstantFolding.*
Move a bunch of (now) private stuff from ConstantFolding.h into
ConstantFolding.cpp.

This _finally_ gets us to a place where we have a sane constant folder.  The
rules are:

1. LLVM clients now use ConstantExpr::get* methods to fold constants.  If they
   cannot be folded, a constantexpr is created, so these methods always return
   valid Constant*'s.
2. The implementation of ConstantExpr::get* uses the functions exposed by
   ConstantFolding.h to try to fold constants.  If they cannot be folded,
   they should return a null pointer.
3. The implementation of ConstantFolding can do whatever it wants, and only
   has one client (Constants.cpp)

This cuts down on the wierd dependencies, and eliminates the two interfaces.
The old constanthandling interface was especially bad for clients to use
because almost none of them took the failure condition into consideration,
thus leading to obscure problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10807 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-12 21:13:12 +00:00
Chris Lattner
8b0f0cb908 Remove a whole bunch more ugliness. This is actually getting to the point of
this whole refactoring: allow constant folding methods to return something
other than predefined classes, allow them to return generic Constant*'s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10806 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-12 21:02:29 +00:00
Chris Lattner
6b7b91ab03 Move ConstantHandling.h into lib/VMCore and out of include/llvm
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10805 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-12 20:48:11 +00:00
Chris Lattner
731ba7f032 Eliminate a lot of out-of-date comments, and all of the wierd overloaded
operator constant folding stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10803 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-12 20:43:44 +00:00
Chris Lattner
c4a1509829 Move prototype of llvm::ConstantFoldInstruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10786 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-12 18:25:44 +00:00
Chris Lattner
5d5a714b24 Implement == and != correctly. Before they would incorrectly return !=
for some constant exprs when they could really be the same value


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10058 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-17 20:19:35 +00:00
Chris Lattner
0dc396909e Constant folding shalt not be built on annotations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10052 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-17 19:05:17 +00:00
Chris Lattner
8b70b78ba4 Fixes for PR114: Thanks to Reid Spencer!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10029 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-16 20:21:15 +00:00
Brian Gaeke
d0fde30ce8 Put all LLVM code into the llvm namespace, as per bug 109.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-11 22:41:34 +00:00
Chris Lattner
d5e4918fa7 Fix spello
Add negate overload


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9709 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-04 23:37:40 +00:00
John Criswell
6fbcc26f14 Added LLVM copyright header (for lack of a better term).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9304 91177308-0d34-0410-b5e6-96231b3b80d8
2003-10-20 20:19:47 +00:00
Chris Lattner
48486893f4 Standardize header file comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8782 91177308-0d34-0410-b5e6-96231b3b80d8
2003-09-30 18:37:50 +00:00
Chris Lattner
30780ccf15 Add support for ~ operator on constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7258 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 17:21:17 +00:00
Chris Lattner
3889a2cb05 Remove a ton of extraneous #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6842 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-22 03:08:05 +00:00
John Criswell
be583b914d Included assert.h so that the code compiles under newer versions of GCC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6682 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-11 14:01:36 +00:00
Chris Lattner
eca8e8f111 *** Huge: Make constantexprs be handled correctly, conservatively
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5923 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-25 02:51:46 +00:00
Chris Lattner
fd73cf895c Don't force a ConstantPointer to be returned
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5799 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-17 19:22:47 +00:00
Chris Lattner
ce8a14915d - Renamed Type::isIntegral() to Type::isInteger()
- Added new method Type::isIntegral() that is the same as isInteger, but
    also accepts bool.
SCVS: ----------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3572 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-03 01:05:48 +00:00
Chris Lattner
f4e3c006ac Remove constant propogation support for NOT instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3321 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:17:07 +00:00
Chris Lattner
e56096aa41 Implement constant propogation of logical (and, or, xor) expressions.
Fixes testcase: test/Regression/Transforms/ConstProp/logicaltest.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3153 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-30 16:24:25 +00:00
Chris Lattner
a803899af5 Move a bunch of code to a .cpp file, don't #include Instruction.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2499 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 17:54:50 +00:00
Chris Lattner
4c1061f58c Implement constant propogation of shift instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2471 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-06 03:01:37 +00:00
Chris Lattner
bdd15ad565 Implement remainder
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2463 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-03 21:40:37 +00:00
Chris Lattner
31bcdb822f Split ConstantVals.h into Constant.h and Constants.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2378 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-28 19:55:58 +00:00
Chris Lattner
66160427de Minor change to reflect that ConstantHandling is now part of VMCore
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2163 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-08 20:15:12 +00:00
Chris Lattner
05c05ea9ca Implement constant propogation of multiply and divide instructions!!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2134 91177308-0d34-0410-b5e6-96231b3b80d8
2002-04-07 08:10:14 +00:00
Chris Lattner
c4edcb3a17 Pull stuff out of opt namespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1511 91177308-0d34-0410-b5e6-96231b3b80d8
2002-01-21 21:44:38 +00:00
Chris Lattner
e9bb2df410 Rename ConstPoolVal -> Constant
Rename ConstPool*   -> Constant*
Rename ConstPoolVals.h -> ConstantVals.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1407 91177308-0d34-0410-b5e6-96231b3b80d8
2001-12-03 22:26:30 +00:00
Chris Lattner
8927973283 Be more const correct
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1332 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-26 16:48:56 +00:00
Chris Lattner
76ac1a45b4 Implement constant propogation of null pointer values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1078 91177308-0d34-0410-b5e6-96231b3b80d8
2001-11-01 05:55:13 +00:00
Chris Lattner
37aabf28b3 Implemented constant propogation of cast instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1064 91177308-0d34-0410-b5e6-96231b3b80d8
2001-10-31 05:07:57 +00:00