1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
Commit Graph

6587 Commits

Author SHA1 Message Date
Devang Patel
5b3d61f5ed Pass const vectors by reference.
llvm-svn: 47577
2008-02-26 00:12:13 +00:00
Eli Friedman
c1fb49b19f Add missing include (for ptrdiff_t).
llvm-svn: 47576
2008-02-25 23:35:32 +00:00
Dan Gohman
4089604796 Factor the assert for indexed loads/stores out of LoadSDNode
and StoreSDNode into LSBaseSDNode.

llvm-svn: 47570
2008-02-25 22:16:29 +00:00
Chris Lattner
6292d580de add an assertion to catch a null PATypeHolder, patch by Erick Tryzelaar
llvm-svn: 47563
2008-02-25 21:28:46 +00:00
Dan Gohman
012abf0109 Convert MaskedValueIsZero and all its users to use APInt. Also add
a SignBitIsZero function to simplify a common use case.

llvm-svn: 47561
2008-02-25 21:11:39 +00:00
Chris Lattner
a2c10fa860 add LSBaseSDNode::getOffset at Dan's request.
llvm-svn: 47558
2008-02-25 19:31:21 +00:00
Chris Lattner
9fb1d740a6 prune #includes, fit in 80 cols.
llvm-svn: 47556
2008-02-25 19:21:38 +00:00
Chris Lattner
93caf1f29d make this self contained.
llvm-svn: 47555
2008-02-25 19:20:57 +00:00
Dan Gohman
4f288e3298 Add a new method to SDNode/SDOperand named getValueSizeInBits
that combines getValueType and MVT::getSizeInBits, since this
occurrs frequently.

llvm-svn: 47552
2008-02-25 19:08:02 +00:00
Evan Cheng
fc540545f1 Correctly determine whether a argument load can be folded into its uses.
llvm-svn: 47545
2008-02-25 08:50:41 +00:00
Bill Wendling
a369a6add8 Some platforms use the same name for 32-bit and 64-bit registers (like
%r3 on PPC) in their ASM files. However, it's hard for humans to read
during debugging. Adding a new field to the register data that lets you
specify a different name to be printed than the one that goes into the
ASM file -- %x3 instead of %r3, for instance.

llvm-svn: 47534
2008-02-24 00:56:13 +00:00
Scott Michel
36bbc39272 Merge current work back to tree to minimize diffs and drift. Major highlights
for CellSPU modifications:

- SPUInstrInfo.td refactoring: "multiclass" really is _your_ friend.
- Other improvements based on refactoring effort in SPUISelLowering.cpp,
  esp. in SPUISelLowering::PerformDAGCombine(), where zero amount shifts and
  rotates are now eliminiated, other scalar-to-vector-to-scalar silliness
  is also eliminated.
- 64-bit operations are being implemented, _muldi3.c gcc runtime now
  compiles and generates the right code. More work still needs to be done.

llvm-svn: 47532
2008-02-23 18:41:37 +00:00
Devang Patel
a56b43b442 Remove unnecessary "inline" keywords.
llvm-svn: 47516
2008-02-23 01:11:02 +00:00
Devang Patel
63d29fccdf Use dyn_cast instead of isa + cast.
llvm-svn: 47511
2008-02-23 00:47:00 +00:00
Evan Cheng
676068324b Forgot this.
llvm-svn: 47510
2008-02-23 00:46:11 +00:00
Devang Patel
f674975a65 To support multiple return values, now ret instruction supports multiple operands instead of one aggregate operand.
llvm-svn: 47508
2008-02-23 00:35:18 +00:00
Dale Johannesen
ae08bdb4cf Split ParameterAttributes.h, putting the complicated
stuff into ParamAttrsList.h.  Per feedback from
ParamAttrs changes.

llvm-svn: 47504
2008-02-22 22:17:59 +00:00
Evan Cheng
c7ef6dc2db Remove an invalid assertion now that there are implicit virtual register operands.
llvm-svn: 47493
2008-02-22 19:25:04 +00:00
Devang Patel
f7d8b7679b Add StripDeadPrototypes pass.
llvm-svn: 47488
2008-02-22 18:39:29 +00:00
Dale Johannesen
a96eb3a1d8 Pass alignment on ByVal parameters, from FE, all
the way through.  It is now used for codegen.

llvm-svn: 47484
2008-02-22 17:49:45 +00:00
Anton Korobeynikov
fd4b209731 Add smart refcounting pointer class to ADT back (known before as IntrusiveSPtr.h).
llvm-svn: 47482
2008-02-22 17:26:05 +00:00
Anton Korobeynikov
5eaa8e774e Unbreak build for VC2008. Patch by Argiris Kirtzidis!
llvm-svn: 47480
2008-02-22 10:11:21 +00:00
Evan Cheng
fa73e0c64e Enable re-materialization of instructions which have virtual register operands if
the definition of the operand also reaches its uses.

llvm-svn: 47475
2008-02-22 09:24:50 +00:00
Devang Patel
8ae63af4b1 Read and write getresult.
llvm-svn: 47471
2008-02-22 02:49:49 +00:00
Chris Lattner
7d3c05df5b minor cleanups to LSBaseSDNode.
llvm-svn: 47469
2008-02-22 01:54:35 +00:00
Andrew Lenharth
b8f9871711 Better names as per Evan's request
llvm-svn: 47435
2008-02-21 16:11:38 +00:00
Andrew Lenharth
db9cd46f5d Atomic op support. If any gcc test uses __sync builtins, it might start failing on archs that haven't implemented them yet
llvm-svn: 47430
2008-02-21 06:45:13 +00:00
Anton Korobeynikov
9f8c4b85cf Add convenient helper to get suffix of the file
llvm-svn: 47397
2008-02-20 19:41:22 +00:00
Dan Gohman
62071ec646 Remove inline keywords from in-class function definitions, for
consistency.

llvm-svn: 47393
2008-02-20 19:29:58 +00:00
Devang Patel
de35f122f2 getresult type is the type of indexed aggregate element
llvm-svn: 47392
2008-02-20 19:26:55 +00:00
Devang Patel
6266d7147e Specify GetResultInst index as an unsigned.
llvm-svn: 47390
2008-02-20 19:10:47 +00:00
Devang Patel
aae784581e Fix typo. Add const version of getAggregateValue() accessor member function.
llvm-svn: 47386
2008-02-20 18:36:16 +00:00
Dan Gohman
48d03d5a2d Add explicit keywords.
llvm-svn: 47382
2008-02-20 16:44:09 +00:00
Dan Gohman
00fed8a97e Add an intersects method to APInt, to capture a common idiom.
llvm-svn: 47379
2008-02-20 16:08:11 +00:00
Anton Korobeynikov
9c87c6526e Add 'sink' cmdline option. Patch by Mikhail Glushenkov!
llvm-svn: 47377
2008-02-20 12:38:07 +00:00
Anton Korobeynikov
c41f5b6af4 Fix newly-introduced 4.3 warnings
llvm-svn: 47375
2008-02-20 12:07:57 +00:00
Anton Korobeynikov
b2dfae5fed And final pack of warnings silencing
llvm-svn: 47372
2008-02-20 11:27:04 +00:00
Anton Korobeynikov
7dd00942cc Update gcc 4.3 warnings fix patch with recent head changes
llvm-svn: 47368
2008-02-20 11:10:28 +00:00
Anton Korobeynikov
0c5e186924 Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
llvm-svn: 47367
2008-02-20 11:08:44 +00:00
Bill Wendling
becea18656 Fixed typo.
llvm-svn: 47365
2008-02-20 09:14:09 +00:00
Bill Wendling
9a2a1ddf6e More constification of things. More comments added. No functionality
changes. (Sorry for any formatting changes that creeped in.)

llvm-svn: 47362
2008-02-20 07:36:31 +00:00
Nick Lewycky
0b6cdd1eff Add 'umax' similar to 'smax' SCEV. Closes PR2003.
Parse reversed smax and umax as smin and umin and express them with negative
or binary-not SCEVs (which are really just subtract under the hood).

Parse 'xor %x, -1' as (-1 - %x).

Remove dead code (ConstantInt::get always returns a ConstantInt).

Don't use getIntegerSCEV(-1, Ty). The first value is an int, then it gets
passed into a uint64_t. Instead, create the -1 directly from
ConstantInt::getAllOnesValue().

llvm-svn: 47360
2008-02-20 06:48:22 +00:00
Dan Gohman
28b341cbf5 Add some comments to Intrinsic::getDeclaration to clarify how to
get declarations for overloaded intrinsics.

llvm-svn: 47353
2008-02-20 01:07:51 +00:00
Dale Johannesen
7eccf11cfb Add Alignment field to ParameterAttributes and
treat more or less rationally in interface
functions, subject to change.  No functional change.

llvm-svn: 47352
2008-02-19 23:51:49 +00:00
Devang Patel
a74d2cbb6f Add GetResultInst. First step for multiple return value support.
llvm-svn: 47348
2008-02-19 22:15:16 +00:00
Dale Johannesen
ecb2b233b1 Expand ParameterAttributes to 32 bits (in preparation
for adding alignment info, not there yet).  Clean up
interfaces to reference ParameterAttributes consistently.

llvm-svn: 47342
2008-02-19 21:38:47 +00:00
Chris Lattner
ae2f8bc116 remove the LowerSelect pass. The last client was the old Sparc backend, which is long dead by now.
llvm-svn: 47323
2008-02-19 07:49:17 +00:00
Chris Lattner
010e9fb704 remove the lower packed pass. It can never work and even the parts that
could work don't work fully.  This fixes PR1705.  Oh yeah, we don't have
packed types anymore either ;-)

llvm-svn: 47322
2008-02-19 07:39:17 +00:00
Evan Cheng
bb577266bf - When DAG combiner is folding a bit convert into a BUILD_VECTOR, it should check if it's essentially a SCALAR_TO_VECTOR. Avoid turning (v8i16) <10, u, u, u> to <10, 0, u, u, u, u, u, u>. Instead, simply convert it to a SCALAR_TO_VECTOR of the proper type.
- X86 now normalize SCALAR_TO_VECTOR to (BIT_CONVERT (v4i32 SCALAR_TO_VECTOR)). Get rid of X86ISD::S2VEC.

llvm-svn: 47290
2008-02-18 23:04:32 +00:00
Duncan Sands
a85448506d Simplify caller updating using a CallSite, as
requested by Chris.  While there, do the same
for an existing function committed by someone
called "lattner" :)

llvm-svn: 47273
2008-02-18 17:32:13 +00:00
Roman Levenstein
a7d4ae1435 New helper function getMBBFromIndex() that given an index in any instruction of an MBB returns a pointer the MBB. Reviewed by Evan.
llvm-svn: 47267
2008-02-18 09:35:30 +00:00
Owen Anderson
b0dee942db Add support for setting parameters to CallSite.
llvm-svn: 47249
2008-02-18 00:10:55 +00:00
Owen Anderson
48dd6a0f96 Add a predicate to Argument to check for the StructRet attribute.
llvm-svn: 47248
2008-02-17 23:22:28 +00:00
Andrew Lenharth
c178981b85 llvm.memory.barrier, and impl for x86 and alpha
llvm-svn: 47204
2008-02-16 01:24:58 +00:00
Dan Gohman
a9386d8501 Rename CountMemOperands to ComputeMemOperandsEnd to reflect what
it actually does. Simplify CountOperands a little by reusing
ComputeMemOperandsEnd. And reword some comments for both.

llvm-svn: 47198
2008-02-16 00:36:48 +00:00
Scott Michel
3ad0263173 Make tblgen a little smarter about constants smaller than i32. Currently,
tblgen will complain if a sign-extended constant does not fit into a
data type smaller than i32, e.g., i16. This causes a problem when certain
hex constants are used, such as 0xff for byte masks or immediate xor
values.

tblgen will try the sign-extended value first and, if the sign extended
value would overflow, it tries to see if the unsigned value will fit.
Consequently, a software developer can now safely incant:

	(XORHIr16 R16C:$rA, 0xffff)

which is somewhat clearer and more informative than incanting:

	(XORHIr16 R16C:$rA, (i16 -1))

even if the two are bitwise equivalent.

Tblgen also outputs the 64-bit unsigned constant in the generated ISel code
when getTargetConstant() is invoked.

llvm-svn: 47188
2008-02-15 23:05:48 +00:00
Evan Cheng
bb357cd8a6 - Removing the infamous r2rMap_ and rep() method. Now the coalescer will update
register defs and uses after each successful coalescing.
- Also removed a number of hacks and fixed some subtle kill information bugs.

llvm-svn: 47167
2008-02-15 18:24:29 +00:00
Evan Cheng
2cb3fd8f72 Added CommuteChangesDestination(). This returns true if commuting the specified
machine instr will change its definition register.

llvm-svn: 47166
2008-02-15 18:21:33 +00:00
Dan Gohman
e34f24132b Change MemOperand's size and offset to be 64-bit.
llvm-svn: 47151
2008-02-15 01:29:57 +00:00
Duncan Sands
0056f1e823 In TargetLowering::LowerCallTo, don't assert that
the return value is zero-extended if it isn't
sign-extended.  It may also be any-extended.
Also, if a floating point value was returned
in a larger floating point type, pass 1 as the
second operand to FP_ROUND, which tells it
that all the precision is in the original type.
I think this is right but I could be wrong.
Finally, when doing libcalls, set isZExt on
a parameter if it is "unsigned".  Currently
isSExt is set when signed, and nothing is
set otherwise.  This should be right for all
calls to standard library routines.

llvm-svn: 47122
2008-02-14 17:28:50 +00:00
Nate Begeman
1ef1013b6c Change how FP immediates are handled.
1) ConstantFP is now expand by default
2) ConstantFP is not turned into TargetConstantFP during Legalize
   if it is legal.

This allows ConstantFP to be handled like Constant, allowing for 
targets that can encode FP immediates as MachineOperands.

As a bonus, fix up Itanium FP constants, which now correctly match,
and match more constants!  Hooray.

llvm-svn: 47121
2008-02-14 08:57:00 +00:00
Nate Begeman
8352abdd98 Support a new type of MachineOperand, MO_FPImmediate, used for holding
FP Immediates, crazily enough

llvm-svn: 47117
2008-02-14 07:39:30 +00:00
Nate Begeman
929fd03fbe Nuke dead comment
llvm-svn: 47114
2008-02-14 07:23:11 +00:00
Dan Gohman
5562e340b7 Fix a typo in a comment.
llvm-svn: 47097
2008-02-13 22:32:12 +00:00
Dan Gohman
99b38405e3 Simplify some logic in ComputeMaskedBits. And change ComputeMaskedBits
to pass the mask APInt by value, not by reference. 

llvm-svn: 47096
2008-02-13 22:28:48 +00:00
Dan Gohman
588498082a Rename APInt's isPositive to isNonNegative, to reflect what it
actually does.

llvm-svn: 47090
2008-02-13 22:09:18 +00:00
Dan Gohman
d22101a970 Add countTrailingOnes member functions to APInt.
llvm-svn: 47086
2008-02-13 21:11:05 +00:00
Dan Gohman
547ea0a60d Fix a typo in a comment.
llvm-svn: 47085
2008-02-13 20:56:53 +00:00
Dan Gohman
2181ea3b6c Add count{Leading,Trailing}Ones_{32,64} functions with simple implementations.
llvm-svn: 47084
2008-02-13 20:54:54 +00:00
Nicolas Geoffray
72fa78e195 Enable exception handling int JIT
llvm-svn: 47079
2008-02-13 18:39:37 +00:00
Devang Patel
8190e4fbe0 Remove use of ltdl
llvm-svn: 47065
2008-02-13 17:11:39 +00:00
Evan Cheng
9c21fd25f0 Simplify.
llvm-svn: 47059
2008-02-13 09:18:16 +00:00
Evan Cheng
d4ddda68fa Initial support for copy elimination by commuting its definition MI.
PR1877.
A3 = op A2 B0<kill>                                                                                                                                                                            
...                                                                                                                                                                                     
B1 = A3      <- this copy                                                                                                                                                                      
...                                                                                                                                                                                          
   = op A3   <- more uses                                                                                                                                                                      
                                                                                                                                                                                                 
==>                                                                                                                                                                                             
                                                                                                                                                                                            
B2 = op B0 A2<kill>                                                                                                                                                                            
...                                                                                                                                                                                          
B1 = B2      <- now an identify copy                                                                                                                                                           
...                                                                                                                                                                                          
   = op B2   <- more uses

This speeds up FreeBench/neural by 29%, Olden/bh by 12%, oopack_v1p8 by 53%.

llvm-svn: 47046
2008-02-13 03:01:43 +00:00
Evan Cheng
da24989368 - Added removeValNo() to remove all live ranges of a particular value#.
- removeRange() can now update value# information.

llvm-svn: 47044
2008-02-13 02:48:26 +00:00
Evan Cheng
95894280dc Added debugging routine dumpUses.
llvm-svn: 47042
2008-02-13 02:45:38 +00:00
Dan Gohman
09023887f8 Convert SelectionDAG::ComputeMaskedBits to use APInt instead of uint64_t.
Add an overload that supports the uint64_t interface for use by clients
that haven't been updated yet.

llvm-svn: 47039
2008-02-13 00:35:47 +00:00
Dan Gohman
f65b0b112c Change APInt::getBitsSet to accept a "half-open" range, where the
hiBit parameter marks the index one past the last desired set bit.

llvm-svn: 47032
2008-02-12 21:47:33 +00:00
Owen Anderson
274aa2846e Re-apply the patch to improve the optimizations of memcpy's, with several
bugs fixed.  This now passes PPC bootstrap.

llvm-svn: 47026
2008-02-12 21:15:18 +00:00
Dan Gohman
3e4b49b4a6 Add a doxygen comment for SrcValueSDNode, to make its purpose
clear and to clarify how it differs from MemOperandSDNode.

llvm-svn: 47015
2008-02-12 18:52:52 +00:00
Dan Gohman
b7bbe43ad3 Correct the order of the arguments in the examples in the comments
for APInt::getBitsSet. And fix an off-by-one bug in "wrapping" mode.

llvm-svn: 46978
2008-02-11 23:45:14 +00:00
Ted Kremenek
dbef529071 The factories for ImutAVLTree/ImmutableSet/ImmutableMap now take an (optional)
BumpPtrAllocator argument to their constructors.  This BumpPtrAllocator
will be used to allocate trees.  If no BumpPtrAllocator is provided, one
is created (as before).

llvm-svn: 46975
2008-02-11 23:11:12 +00:00
Dan Gohman
861923ed06 From Chris' review: change MemOperandSDNode's constructor to pass its
argument by reference, rather than by value. 

llvm-svn: 46960
2008-02-11 18:56:50 +00:00
Ted Kremenek
f06b7ac532 Added "Profile" method to APFloat for use with FoldingSet.
Added member template "Add" to FoldingSetNodeID that allows "adding" arbitrary
objects to a profile via dispatch to FoldingSetTrait<T>::Profile().

Removed FoldingSetNodeID::AddAPFloat and FoldingSetNodeID::APInt, as their
functionality is now replaced using the above mentioned member template.

llvm-svn: 46957
2008-02-11 17:24:50 +00:00
Duncan Sands
b9bf0dcb7c Add arbitrary integer support to getRegisterType and
getNumRegisters.  This is needed for calling functions
with apint parameters or return values.

llvm-svn: 46956
2008-02-11 11:09:23 +00:00
Wojciech Matyjewicz
76c2b22ee4 Fix PR1798 - an error in the evaluation of SCEVAddRecExpr at an
arbitrary iteration.

The patch:
1) changes SCEVSDivExpr into SCEVUDivExpr,
2) replaces PartialFact() function with BinomialCoefficient(); the 
computations (essentially, the division) in BinomialCoefficient() are 
performed with the apprioprate bitwidth necessary to avoid overflow; 
unsigned division is used instead of the signed one.

Computations in BinomialCoefficient() require support from the code 
generator for APInts. Currently, we use a hack rounding up the 
neccessary bitwidth to the nearest power of 2. The hack is easy to turn 
off in future.

One remaining issue: we assume the divisor of the binomial coefficient 
formula can be computed accurately using 16 bits. It means we can handle 
AddRecs of length up to 9. In future, we should use APInts to evaluate 
the divisor.

Thanks to Nicholas for cooperation!

llvm-svn: 46955
2008-02-11 11:03:14 +00:00
Duncan Sands
204c89cafa Add a isBigEndian method to complement isLittleEndian.
llvm-svn: 46954
2008-02-11 10:37:04 +00:00
Dan Gohman
cabaec582f Rename MRegisterInfo to TargetRegisterInfo.
llvm-svn: 46930
2008-02-10 18:45:23 +00:00
Wojciech Matyjewicz
2e45476439 Add a check if the initial value of the induction variable is 0 (the method comment says it should be).
llvm-svn: 46907
2008-02-09 18:06:58 +00:00
Dan Gohman
672d341167 Change ConstantSDNode to store an APInt instead of a uint64_t, and
begin adding some methods to use it this way.

llvm-svn: 46899
2008-02-08 22:59:30 +00:00
Dan Gohman
3d296e049c Add an isSignedIntN, like isIntN but for signed integer values instead of
unsigned.

llvm-svn: 46894
2008-02-08 21:58:15 +00:00
Evan Cheng
90f03a0b88 It's not always safe to fold movsd into xorpd, etc. Check the alignment of the load address first to make sure it's 16 byte aligned.
llvm-svn: 46893
2008-02-08 21:20:40 +00:00
Ted Kremenek
557bbab669 Constified operator<< in APSInt.
llvm-svn: 46882
2008-02-08 07:14:19 +00:00
Dan Gohman
1f255f2db7 Avoid needlessly casting away const qualifiers.
llvm-svn: 46876
2008-02-08 03:26:46 +00:00
Dan Gohman
eb7c8e4f6b Follow Chris' suggestion; change the PseudoSourceValue accessors
to return pointers instead of references, since this is always what
is needed.

llvm-svn: 46857
2008-02-07 18:41:25 +00:00
Dan Gohman
011075cfdb Add support to FoldingSet for hashing APInt objects.
llvm-svn: 46833
2008-02-06 23:09:15 +00:00
Dan Gohman
f00842e086 Re-apply the memory operand changes, with a fix for the static
initializer problem, a minor tweak to the way the
DAGISelEmitter finds load/store nodes, and a renaming of the
new PseudoSourceValue objects.

llvm-svn: 46827
2008-02-06 22:27:42 +00:00
Anton Korobeynikov
b1576212e7 Don't dereference an invalid pointer if string is empty.
llvm-svn: 46781
2008-02-05 23:34:40 +00:00
Dale Johannesen
e8fa3130f8 Implement sseregparm.
llvm-svn: 46764
2008-02-05 20:46:33 +00:00
Ted Kremenek
3277f38b25 Added FoldingSet profiling support to ImmutableSet.
llvm-svn: 46757
2008-02-05 18:50:25 +00:00
Ted Kremenek
571ad3913c Changed profiling method for ImmutableMap to once again just use its
unique ImutAVLTree* for profiling.

Modified ImutAVLTree:
 (1) changed ComputeHash() to ComputeDigest() and
 (2) changed Profile() to use the computed digest and
 (3) modified insertion of IMutAVLTree into the FoldingSet owned by
     the ImutAVLTreeFactory object to use profiling instead of computing
     a direct hash.  This fixes a bug where our abuse of the FoldingSet would
     not work when the FoldingSet was resized.

llvm-svn: 46753
2008-02-05 17:30:43 +00:00
Dale Johannesen
bf7691e2e8 Missed one.
llvm-svn: 46733
2008-02-05 01:12:10 +00:00
Evan Cheng
ca7db1ca34 Unbreak teh build.
llvm-svn: 46729
2008-02-05 00:25:13 +00:00
Dale Johannesen
9b7f4064e3 Do not unconditionally redefine vec_ext_v16qi and
vec_ext_v4si builtins.  This is a hack; they should
be defined here, then resolved in the X86 BE.
However there is enough other stuff missing in the
X86 BE for SSE41 that this will do for now.

llvm-svn: 46727
2008-02-04 23:27:29 +00:00
Evan Cheng
352062f5f7 Typo.
llvm-svn: 46725
2008-02-04 23:10:38 +00:00
Ted Kremenek
f2e96e37f4 Modified 'Profile' method of ImmutableMap to use the 'Profile' method
of the contained ImutAVLTree root.

llvm-svn: 46719
2008-02-04 21:17:02 +00:00
Ted Kremenek
9679f99479 Modified node creation of ImutAVLTree to do a hash lookup for an existing
node in the FoldingSet of nodes held by the Factory object.  If we
we find a node with a matching hash, we do a full structural comparison.
Nodes are also now inserted into the FoldingSet only when we mark them
Immutable, as their children can change during intermediate-rebalancing.

The 'Profile' method for ImutAVLTree is no longer used when looking up
existing ImutAVLTrees with a given set of contents; instead the Profile method
is used by other clients that wish to insert such a tree into a folding set.
This means that we are not using FoldingSet in ImutAVLTreeFactory in the way
it was intended, but instead are using it as an opaque hashtable.

llvm-svn: 46717
2008-02-04 21:15:24 +00:00
Ted Kremenek
6dab41ed32 Added "bucket_iterators" to FoldingSet. Bucket iterators allow iteration
over all the nodes in a particular bucket.

llvm-svn: 46716
2008-02-04 21:11:17 +00:00
Ted Kremenek
62853a3478 constified operator~().
llvm-svn: 46707
2008-02-04 16:57:26 +00:00
Nate Begeman
ead8dfeef2 SSE 4.1 Intrinsics and detection
llvm-svn: 46681
2008-02-03 07:18:54 +00:00
Chris Lattner
6ea106139d Change the 'global modification' APIs in SelectionDAG to take a new
DAGUpdateListener object pointer instead of just returning a vector 
of deleted nodes.  This makes the interfaces more efficient (no more
allocating a vector [at least a malloc], filling it in, then walking
it) and more clean.  This also allows the client to be notified of
nodes that are *changed* but not deleted.

llvm-svn: 46677
2008-02-03 06:49:24 +00:00
Evan Cheng
c57ec111f2 SDIsel processes llvm.dbg.declare by recording the variable debug information descriptor and its corresponding stack frame index in MachineModuleInfo. This only works if the local variable is "homed" in the stack frame. It does not work for byval parameter, etc.
Added ISD::DECLARE node type to represent llvm.dbg.declare intrinsic. Now the intrinsic calls are lowered into a SDNode and lives on through out the codegen passes.
For now, since all the debugging information recording is done at isel time, when a ISD::DECLARE node is selected, it has the side effect of also recording the variable. This is a short term solution that should be fixed in time.

llvm-svn: 46659
2008-02-02 04:07:54 +00:00
Gordon Henriksen
b75d9e974d Fixing a bug creating floating point constants of type other
than double through the C bindings. Thanks to Tomas Lindquist
Olsen for reporting it.

llvm-svn: 46656
2008-02-02 01:07:50 +00:00
Evan Cheng
9ff6b89bd9 Frame index can be negative.
llvm-svn: 46655
2008-02-02 00:17:00 +00:00
Evan Cheng
d6222fc11d Remove the nasty LABEL hack with a much less evil one. Now llvm.dbg.func.start implies a stoppoint is set. SelectionDAGISel records a new source line but does not create a ISD::LABEL node for this special stoppoint. Asm printer will magically print this label. This ensures nothing is emitted before.
llvm-svn: 46635
2008-02-01 09:10:45 +00:00
Evan Cheng
abe3a9ad27 Rename RecordLabel to RecordSourceLine because that's what it is doing.
llvm-svn: 46628
2008-02-01 02:05:57 +00:00
Anton Korobeynikov
1cc154d068 Add convenient std::string helpers to StringMap. Patch by Mikhail Glushenkov!
llvm-svn: 46625
2008-01-31 23:02:33 +00:00
Evan Cheng
2a533e6894 Revert 46556 and 46585. Dan please fix the PseudoSourceValue problem and re-commit.
llvm-svn: 46623
2008-01-31 21:00:00 +00:00
Anton Korobeynikov
91b7d99e8a Reapply the patch with fix.
llvm-svn: 46615
2008-01-31 17:43:25 +00:00
Chris Lattner
87c2925656 revert anton's recent stringmap patch, which breaks clang.
llvm-svn: 46614
2008-01-31 17:24:51 +00:00
Anton Korobeynikov
55998b56a0 Make StringMap to be more STL'ish. Patch by Mikhail Glushenkov!
llvm-svn: 46612
2008-01-31 12:30:40 +00:00
Anton Korobeynikov
45e5afd820 Whitespace cleanup
llvm-svn: 46611
2008-01-31 12:10:41 +00:00
Evan Cheng
705212577d Add an extra operand to LABEL nodes which distinguishes between debug, EH, or misc labels. This fixes the EH breakage. However I am not convinced this is *the* solution.
llvm-svn: 46609
2008-01-31 09:59:15 +00:00
Evan Cheng
a63f6736f3 MRegisterInfo::getLocation() is a really bad idea. Its function is to calculate the offset from frame pointer to a stack slot and then storing the delta in a MachineLocation object. The name is bad (it implies a getter), and MRegisterInfo doesn't need to know about MachineLocation.
Replace getLocation() with getFrameIndexOffset() which returns the delta from frame pointer to stack slot. Dwarf writer can then use the information for whatever it wants.

llvm-svn: 46597
2008-01-31 03:37:28 +00:00
Dan Gohman
562ed58408 Avoid unnecessarily casting away const, fixing a FIXME.
llvm-svn: 46591
2008-01-31 01:05:10 +00:00
Dan Gohman
703a070e12 Fix a typo in a comment.
llvm-svn: 46588
2008-01-31 00:44:33 +00:00
Dan Gohman
3993809a0c Rename ISD::FLT_ROUNDS to ISD::FLT_ROUNDS_ to avoid conflicting
with the real FLT_ROUNDS (defined in <float.h>).

llvm-svn: 46587
2008-01-31 00:41:03 +00:00
Dan Gohman
4326d513ab Create a new class, MemOperand, for describing memory references
in the backend. Introduce a new SDNode type, MemOperandSDNode, for
holding a MemOperand in the SelectionDAG IR, and add a MemOperand
list to MachineInstr, and code to manage them. Remove the offset
field from SrcValueSDNode; uses of SrcValueSDNode that were using
it are all all using MemOperandSDNode now.

Also, begin updating some getLoad and getStore calls to use the
PseudoSourceValue objects.

Most of this was written by Florian Brander, some
reorganization and updating to TOT by me.

llvm-svn: 46585
2008-01-31 00:25:39 +00:00
Evan Cheng
07f3cd3242 A semi-gross fix for a debug info issue. When inserting the "function start" label (i.e. first label in the entry block) take care to insert it at the beginning of the block.
llvm-svn: 46568
2008-01-30 19:35:32 +00:00
Evan Cheng
918b9c9335 Even though InsertAtEndOfBasicBlock is an ugly hack it still deserves a proper name. Rename it to EmitInstrWithCustomInserter since it does not necessarily insert
instruction at the end.

llvm-svn: 46562
2008-01-30 18:18:23 +00:00
Dan Gohman
dd9be7d05e Add a new PseudoSourceValue class, which will be used to help track
memory reference information in the backend. Most of this was written by
Florian Brander, cleanup and updating to TOT by me.

llvm-svn: 46556
2008-01-30 16:35:31 +00:00
Dan Gohman
13d1327796 Factor the addressing mode and the load/store VT out of LoadSDNode
and StoreSDNode into their common base class LSBaseSDNode. Member
functions getLoadedVT and getStoredVT are replaced with the common
getMemoryVT to simplify code that will handle both loads and stores.

llvm-svn: 46538
2008-01-30 00:15:11 +00:00
Ted Kremenek
acc17d1b24 Altered ctor for APSInt to accept an optional "isUnsigned" flag. Default
behavior is unchanged.

llvm-svn: 46521
2008-01-29 18:55:14 +00:00
Dan Gohman
6f9748b626 Add comments describing what the loop depth values mean. Also, make a
minor simplification to the loop depth calculation code.

llvm-svn: 46511
2008-01-29 12:12:40 +00:00
Dan Gohman
c1c27c9fda Fix a typo in a comment.
llvm-svn: 46507
2008-01-29 12:06:33 +00:00
Dan Gohman
522401f26e Add explicit keywords.
llvm-svn: 46506
2008-01-29 11:36:12 +00:00
Duncan Sands
390baa691d Use getPreferredAlignmentLog or getPreferredAlignment
to get the alignment of global variables, rather than
using hand-made versions.

llvm-svn: 46495
2008-01-29 06:23:44 +00:00
Dale Johannesen
f12104ce4b Handle 'X' constraint in asm's better.
llvm-svn: 46485
2008-01-29 02:21:21 +00:00
Ted Kremenek
752475ffa1 Added destructor for template class FoldingSetNodeWrapper.
Added getValue() to FoldingSetNodeWrapper.

llvm-svn: 46465
2008-01-28 22:05:23 +00:00
Nick Lewycky
6b070b1b93 Handle some more combinations of extend and icmp. Fixes PR1940.
llvm-svn: 46431
2008-01-28 03:48:02 +00:00
Owen Anderson
7ad72080a6 Fixes for BreakCriticalMachineCodeEdge by Fernando.
llvm-svn: 46419
2008-01-27 19:51:03 +00:00
Chris Lattner
9c66a1b961 make isExactlyValue work for long double.
llvm-svn: 46410
2008-01-27 06:19:08 +00:00
Bill Wendling
629a569ce9 The CorrelatedExpressionElimination pass is known to be buggy. Remove it.
This fixes PR1769.

llvm-svn: 46408
2008-01-27 06:11:41 +00:00
Chris Lattner
266b518f13 make this 64-bit safe
llvm-svn: 46402
2008-01-26 19:50:30 +00:00
Chris Lattner
f2a0e6c176 Reorder a field to reduce the size of StackObject. Note that this
may require a clean rebuild on leopard. :(

llvm-svn: 46360
2008-01-25 17:49:41 +00:00
Duncan Sands
b9f1e3df90 Add more assertions to catch accesses outside of
arrays.  Also, as a convenience, don't barf, just
return false, if someone calls isTruncStoreLegal
or isLoadXLegal with an extended type for the in
memory type.

llvm-svn: 46352
2008-01-25 10:20:53 +00:00
Chris Lattner
93f4f5970c move this field back. Moving the field causes miscompilations (!) of voronoi and others.
llvm-svn: 46350
2008-01-25 07:29:34 +00:00
Chris Lattner
1ce075bcaa move MachineFrameInfo::CreateFixedObject out of line, give MachineFrameInfo
a reference to TargetFrameInfo.  Rearrange order of fields in StackObject to
save a word.

llvm-svn: 46348
2008-01-25 07:19:06 +00:00
Chris Lattner
72795598b9 add a fixme.
llvm-svn: 46346
2008-01-25 06:20:20 +00:00
Ted Kremenek
274df5b7db Added additional overloaded operators for APSInt to match the operators of
APInt.

While some operators were already specifically overloaded for APSInt, others
resulted in using the overloaded operator methods in APInt, which would result
in the signedness bit being lost.

Modified the APSInt(APInt&) constructor to be "explicit" and to take an
extra (optional) flag to indicate the signedness.  Making the ctor explicit
will catch any implicit conversations between APSInt -> APInt -> APSInt that
results in the signedness flag being lost.

llvm-svn: 46316
2008-01-24 18:59:52 +00:00
Chris Lattner
5740a10d2c Add hasByValAttr() and hasNoAliasAttr() methods to the Argument class.
llvm-svn: 46314
2008-01-24 17:47:11 +00:00
Owen Anderson
4d78ff86ae Move some functionality for adding flags to MachineInstr's into methods on MachineInstr rather than LiveVariables.
llvm-svn: 46295
2008-01-24 01:10:07 +00:00
Evan Cheng
91089e6d66 Let each target decide byval alignment. For X86, it's 4-byte unless the aggregare contains SSE vector(s). For x86-64, it's max of 8 or alignment of the type.
llvm-svn: 46286
2008-01-23 23:17:41 +00:00
Ted Kremenek
faa43d4b3c Added special escape sequences "\{", "\}", and "\|" when processing
getNodeLabel(); these sequences allow the user to specify the characters '{',
'}', and '|' in the label, which facilitate breaking the label into multiple
record segments.

llvm-svn: 46283
2008-01-23 22:29:58 +00:00
Ted Kremenek
d6669b6b8a Added "getRoot()" to ImmutableSet.
Made ImmutableSet::ImmutableSet(ImutAVLTree* Root) public. (this allows handy
casting between trees and sets).

llvm-svn: 46277
2008-01-23 19:57:33 +00:00
Anton Korobeynikov
67f0de9810 Silence a warning. Should we turn this into configure-time check?
llvm-svn: 46251
2008-01-22 11:01:23 +00:00
Ted Kremenek
8425e78e77 Fixed buggy caching of the hash value of an ImutAVLTree node.
llvm-svn: 46229
2008-01-21 22:54:46 +00:00
Ted Kremenek
bee8cd7cd8 Moved method call within a conditional branch because its effects will
be ignored on the false branch.

llvm-svn: 46228
2008-01-21 22:51:35 +00:00
Ted Kremenek
1c8968610e Adjusted ImutAVLTree::ComputeHash to compute a hash value that is based on a
clearer sequence of hashing compositions.

llvm-svn: 46227
2008-01-21 22:50:37 +00:00
Ted Kremenek
fed0381d40 Added "clear" method to FoldingSetNodeID to allow a FoldingSetNodeID object
to be reused to compute multiple object profiles.

llvm-svn: 46226
2008-01-21 22:49:22 +00:00
Ted Kremenek
91db428477 Replaced (FoldingSet) profiling of ImutAVLTree with a hashing based scheme. The
problem was that we previously hashed based on the pointers of the left and
right children, but this is bogus: we can easily have different trees that
represent the same set. Now we use a hashing based scheme that compares the
*contents* of the trees, but not without having to do a full scan of a tree. The
only caveat is that with hashing is that we may have collisions, which result in
two different trees being falsely labeled as equivalent. If this becomes a
problem, we can add extra data to the profile to hopefully resolve most
collisions.

llvm-svn: 46224
2008-01-21 22:33:30 +00:00
Chris Lattner
831f4502e8 Fix the failures in the PPC JIT by marking relocation entries for
external symbols (e.g. 'fmod') as needing a stub.  This regression
was introduced by Evan's jit patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071231/056749.html

With this fixed, the two ExecutionEngine failures are passing on ppc,
and the ppc jit works on freebench and olden.

This should be pulled into the 2.2 release branch.

llvm-svn: 46222
2008-01-21 22:27:27 +00:00
Ted Kremenek
99c2b963e8 Changed argument name for 'Profile' method to potentially fix a name conflict
reported in pr1929 (http://llvm.org/PR1929).

llvm-svn: 46193
2008-01-19 17:21:43 +00:00
Ted Kremenek
7de447b8a6 Modified ImmutableSet/ImmutableMap to use FoldingSet profiling using
FoldingSetTrait instead of directly calling a 'Profile' method.

llvm-svn: 46190
2008-01-19 04:51:55 +00:00
Ted Kremenek
dce31b9785 Added FoldingSet style 'profiling' support for APSInt.
llvm-svn: 46189
2008-01-19 04:31:12 +00:00
Ted Kremenek
702d3b8f37 Added FoldingSet style 'profiling' support for APInt.
llvm-svn: 46188
2008-01-19 04:23:33 +00:00
Ted Kremenek
a0105180ad Made 'FoldingSetNodeID' a proper class instead of a nested class in
'FoldingSetNodeImpl' (previously 'FoldingSetNodeID' was a typedef of
'FoldingSetNodeImpl::NodeID').

Why?  Clients can now easily forward declare 'FoldingSetNodeID' without having
to include FoldingSet.h.

llvm-svn: 46187
2008-01-19 04:22:50 +00:00
Ted Kremenek
f28b73631c Made 'profiling' of objects in a FoldingSet trait-based using FoldingSetTrait
instead of always assuming that the stored objects had a method called
'Profile'. The default behavior is to dispatch to a 'Profile' method (as
before), but via template specialization this behavior can now be overridden by
clients.

Added templated class 'FoldingSetNodeWrapper', a generic wrapper class that
allows one to insert objects into a FoldingSet that do not directly inherit from
FoldingSetNode. This is useful for inserting objects that do not always need to
pay the overhead of inheriting from FoldingSetNode, or were designed with that
behavior in mind.

llvm-svn: 46186
2008-01-19 03:58:00 +00:00
Chris Lattner
55c50079c3 don't form an std::string with a null pointer, it aborts.
llvm-svn: 46166
2008-01-18 18:54:31 +00:00
Chris Lattner
5c5e3031b0 remove magic numbers.
llvm-svn: 46162
2008-01-18 17:13:03 +00:00
Ted Kremenek
e08671bc63 Reverted implementation of ImmutableMap::find() to return a TreeTy* instead of
an iterator, since the implementation returned an iterator that pointed to a
different node! Renamed this implementation to SlimFind() so that users do not
expect it to return an iterator (it is a more efficient implementation than
returning an iterator if the user just wants to find the value of a key).

Added a FIXME to implement ImmutableMap::find() that returns an iterator.

llvm-svn: 46150
2008-01-18 00:38:04 +00:00
Chris Lattner
41717f6989 This commit changes:
1. Legalize now always promotes truncstore of i1 to i8. 
2. Remove patterns and gunk related to truncstore i1 from targets.
3. Rename the StoreXAction stuff to TruncStoreAction in TLI.
4. Make the TLI TruncStoreAction table a 2d table to handle from/to conversions.
5. Mark a wide variety of invalid truncstores as such in various targets, e.g.
   X86 currently doesn't support truncstore of any of its integer types.
6. Add legalize support for truncstores with invalid value input types.
7. Add a dag combine transform to turn store(truncate) into truncstore when
   safe.

The later allows us to compile CodeGen/X86/storetrunc-fp.ll to:

_foo:
	fldt	20(%esp)
	fldt	4(%esp)
	faddp	%st(1)
	movl	36(%esp), %eax
	fstps	(%eax)
	ret

instead of:

_foo:
	subl	$4, %esp
	fldt	24(%esp)
	fldt	8(%esp)
	faddp	%st(1)
	fstps	(%esp)
	movl	40(%esp), %eax
	movss	(%esp), %xmm0
	movss	%xmm0, (%eax)
	addl	$4, %esp
	ret

llvm-svn: 46140
2008-01-17 19:59:44 +00:00
Ted Kremenek
7c8ee3790f Implemented "FIXME" in ImutAVLTree: isEqual() now also compares the *data* value
and not just the key value when comparing trees. To do this we added data_type
and data_type_ref to the ImutContainerInfo trait classes. For values stored in
the tree that do not have separate key and data components, data_type is simply
a typedef of bool, and isDataEqual() always evaluates to true. This allows us to
support both ImmutableSet and ImmutableMap using the same underlying logic.

llvm-svn: 46130
2008-01-17 17:36:49 +00:00
Chris Lattner
98cd94a56d add some helper methods.
llvm-svn: 46128
2008-01-17 07:30:38 +00:00
Chris Lattner
d033200a8f * Introduce a new SelectionDAG::getIntPtrConstant method
and switch various codegen pieces and the X86 backend over
  to using it.

* Add some comments to SelectionDAGNodes.h

* Introduce a second argument to FP_ROUND, which indicates
  whether the FP_ROUND changes the value of its input. If
  not it is safe to xform things like fp_extend(fp_round(x)) -> x.

llvm-svn: 46125
2008-01-17 07:00:52 +00:00
Dale Johannesen
cfa41e888e Do not mark EH tables no-dead-strip unless the
associated function is so marked.

llvm-svn: 46088
2008-01-16 19:59:28 +00:00
Chris Lattner
50f1b6f9a5 Factor the ReachesChainWithoutSideEffects out of dag combiner into
a public SDOperand::reachesChainWithoutSideEffects method.  No 
functionality change.

llvm-svn: 46050
2008-01-16 05:49:24 +00:00
Ted Kremenek
9b2d0769ed Changed ImmutableMap::find to return an iterator instead of a pointer
to the tree node.

llvm-svn: 46034
2008-01-15 23:53:53 +00:00
Devang Patel
2dda5ca0a4 - Introduces versioning macro LLVM_LTO_VERSION
- Communicate symbol visibility
- Communicate code generation model

llvm-svn: 46033
2008-01-15 23:52:34 +00:00
Dale Johannesen
319c7bb405 Fix and enable EH for x86-64 Darwin. Adds
ShortenEHDataFor64Bits as a not-very-accurate
abstraction to cover all the changes in DwarfWriter.
Some cosmetic changes to Darwin assembly code for
gcc testsuite compatibility.

llvm-svn: 46029
2008-01-15 23:24:56 +00:00
Owen Anderson
214c1c3461 Move some calls to getVRegDef higher in the callgraph, so they don't get executed as frequently in performance sensitive code.
llvm-svn: 46027
2008-01-15 22:58:11 +00:00
Evan Cheng
b94df1d6e5 Unbreak the build.
llvm-svn: 46021
2008-01-15 22:19:35 +00:00
Gordon Henriksen
26e9b6653c Fix a memory correctness error noticed by valgrind (harmless in practice).
Thanks to Duncan Sands for noticing it.

llvm-svn: 46007
2008-01-15 20:02:11 +00:00
Evan Cheng
5e40103440 Oops. Forgot to commit this.
llvm-svn: 46003
2008-01-15 07:49:54 +00:00
Anton Korobeynikov
08ea121968 For PR1839: add initial support for __builtin_trap. llvm-gcc part is missed
as well as PPC codegen

llvm-svn: 46001
2008-01-15 07:02:33 +00:00
Duncan Sands
81e35b4d47 I noticed that the trampoline straightening transformation could
drop attributes on varargs call arguments.  Also, it could generate
invalid IR if the transformed call already had the 'nest' attribute
somewhere (this can never happen for code coming from llvm-gcc,
but it's a theoretical possibility).  Fix both problems.

llvm-svn: 45973
2008-01-14 19:52:09 +00:00
Evan Cheng
a5183224b0 Add hasByValArgument() to test if a call instruction has byval argument(s).
llvm-svn: 45913
2008-01-12 18:57:32 +00:00
Duncan Sands
3b617cbe30 Be more liberal in what parameter attributes are
allowed on the vararg arguments of a call.

llvm-svn: 45909
2008-01-12 16:42:01 +00:00
Chris Lattner
fb5876f0be Allow clients to specify the inline threshold when creating
the inliner pass.  Patch by Robert Zeh.

llvm-svn: 45903
2008-01-12 06:49:13 +00:00
Chris Lattner
433aca5066 remove some incorrect classof's.
llvm-svn: 45893
2008-01-11 23:25:16 +00:00
Duncan Sands
e55a5806ac Do not allow attributes beyond a function's last
parameter, even if it is a varargs function.  Do
allow attributes on the varargs part of a call,
but not beyond the last argument.  Only allow
selected attributes to be on the varargs part of
a call (currently only 'byval' is allowed).  The
reasoning here is that most attributes, eg inreg,
simply make no sense here.

llvm-svn: 45887
2008-01-11 22:36:48 +00:00
Chris Lattner
89d996afce add operator==/!= to smallvector.
llvm-svn: 45872
2008-01-11 18:42:02 +00:00
Chris Lattner
0293fca6d8 rename MachineInstr::setInstrDescriptor -> setDesc
llvm-svn: 45871
2008-01-11 18:10:50 +00:00
Chris Lattner
ff7707de37 don't include loopinfo.h from this file.
llvm-svn: 45858
2008-01-11 06:30:04 +00:00
Chris Lattner
201be5f41e Move typedef of loop to top of the file where it is more obvious.
llvm-svn: 45857
2008-01-11 06:29:42 +00:00
Chris Lattner
b9232a8374 Fix 80 col violations
llvm-svn: 45856
2008-01-11 06:27:42 +00:00
Scott Michel
1e9496e4d4 More CellSPU refinement and progress:
- Cleaned up custom load/store logic, common code is now shared [see note
  below], cleaned up address modes

- More test cases: various intrinsics, structure element access (load/store
  test), updated target data strings, indirect function calls.

Note: This patch contains a refactoring of the LoadSDNode and StoreSDNode
structures: they now share a common base class, LSBaseSDNode, that
provides an interface to their common functionality. There is some hackery
to access the proper operand depending on the derived class; otherwise,
to do a proper job would require finding and rearranging the SDOperands
sent to StoreSDNode's constructor. The current refactor errs on the
side of being conservatively and backwardly compatible while providing
functionality that reduces redundant code for targets where loads and
stores are custom-lowered.

llvm-svn: 45851
2008-01-11 02:53:15 +00:00
Chris Lattner
bfffa4f21e Simplify the side effect stuff a bit more and make licm/sinking
both work right according to the new flags.

This removes the TII::isReallySideEffectFree predicate, and adds
TII::isInvariantLoad. 

It removes NeverHasSideEffects+MayHaveSideEffects and adds
UnmodeledSideEffects as machine instr flags.  Now the clients
can decide everything they need.

I think isRematerializable can be implemented in terms of the
flags we have now, though I will let others tackle that.

llvm-svn: 45843
2008-01-10 23:08:24 +00:00
Duncan Sands
2c89976416 Output sinl for a long double FSIN node, not sin.
Likewise fix up a bunch of other libcalls.  While
there I remove NEG_F32 and NEG_F64 since they are
not used anywhere.  This fixes 9 Ada ACATS failures.

llvm-svn: 45833
2008-01-10 10:28:30 +00:00
Evan Cheng
8934a96adb Clearify the meaning of immutable StackObject.
llvm-svn: 45828
2008-01-10 07:19:43 +00:00
Evan Cheng
f20828226e Add a isImmutable bit to StackObject. Fixed stack objects are immutable (in the function) unless specified otherwise.
llvm-svn: 45812
2008-01-10 02:18:37 +00:00
Dale Johannesen
fdd4b3846f Emit unused EH frames for weak definitions on Darwin,
because assembler/linker can't cope with weak absolutes.
PR 1880.

llvm-svn: 45811
2008-01-10 02:03:30 +00:00
Chris Lattner
d3a396668c provide def_* and use_* iterators in addition to reg_* iterators.
The first only returns definitions of a register, the second only
returns uses, the third returns both.

llvm-svn: 45803
2008-01-10 01:01:27 +00:00
Chris Lattner
b02074514e Fix PR1845 and rdar://5676945. Generic vectors smaller
than hardware supported type will be scalarized, so we
can infer their alignment from that info.

We now codegen pr1845 into:

_boolVectorSelect:
	lbz r2, 0(r3)
	stb r2, -16(r1)
	blr 

llvm-svn: 45796
2008-01-10 00:30:57 +00:00
Evan Cheng
f91cfb435f Fix sse2.psrl.w and sse2.psrl.q definitions.
llvm-svn: 45772
2008-01-09 02:16:44 +00:00
Ted Kremenek
8461cdc206 Added "getRoot()" to ImmutableMap.
Made the ctor for ImmutableMap to construct a map from an AVL tree public.

llvm-svn: 45756
2008-01-08 21:05:59 +00:00
Ted Kremenek
9d742fd3c4 Fixed 80 col. violation.
llvm-svn: 45752
2008-01-08 19:38:55 +00:00
Chris Lattner
9b7b3ade8f add a mayLoad property for machine instructions, a correlary to mayStore.
This is currently not set by anything.

llvm-svn: 45748
2008-01-08 18:05:21 +00:00
Chris Lattner
a39e69f292 add match support for casts.
llvm-svn: 45744
2008-01-08 07:02:44 +00:00
Nate Begeman
9b7f984bbb Update the comment on scalar to vector to be a bit more clear.
llvm-svn: 45707
2008-01-07 17:52:24 +00:00
Duncan Sands
7955cf0cd7 Small cleanup for handling of type/parameter attribute
incompatibility.

llvm-svn: 45704
2008-01-07 17:16:06 +00:00
Chris Lattner
ba567fa77b split TargetInstrDesc out into its own header file.
llvm-svn: 45696
2008-01-07 07:33:08 +00:00
Chris Lattner
f83aae613c rename TargetInstrDescriptor -> TargetInstrDesc.
Make MachineInstr::getDesc return a reference instead
of a pointer, since it can never be null.

llvm-svn: 45695
2008-01-07 07:27:27 +00:00
Chris Lattner
c9e870d7c6 remove a dead method.
llvm-svn: 45694
2008-01-07 06:47:10 +00:00
Chris Lattner
57e851edfe Rename all the M_* flags to be namespace qualified enums, and switch
all clients over to using predicates instead of these flags directly.
These are now private values which are only to be used to statically
initialize the tables.

llvm-svn: 45692
2008-01-07 06:42:05 +00:00
Chris Lattner
c745aa59b3 add more and significantly better comments to the rest of the machineinstr
flags that can be set.  Add predicates for the ones lacking it, and switch
some clients over to using the predicates instead of Flags directly.

llvm-svn: 45690
2008-01-07 06:21:53 +00:00
Chris Lattner
1cdb8f4da1 add some mroe comments, add a isImplicitDef() method, add
isConditionalBranch() and isUnconditionalBranch() methods.

llvm-svn: 45688
2008-01-07 05:38:38 +00:00
Chris Lattner
9b987de2c5 rename hasVariableOperands() -> isVariadic(). Add some comments.
Evan, please review the comments I added to getNumDefs to make sure
that they are accurate, thx.

llvm-svn: 45687
2008-01-07 05:19:29 +00:00
Chris Lattner
b0e50db817 Move M_* flags down in the file. Move SchedClass up in the
TargetInstrDescriptor class and shrink to 16-bits, saving a 
word in TargetInstrDescriptor.  Add some comments.

llvm-svn: 45686
2008-01-07 05:06:49 +00:00
Gordon Henriksen
e90b061f6a Removing a leaked file.
llvm-svn: 45681
2008-01-07 03:23:52 +00:00
Chris Lattner
9d38dfa4a5 Move a bunch more accessors from TargetInstrInfo to TargetInstrDescriptor
llvm-svn: 45680
2008-01-07 03:13:06 +00:00
Chris Lattner
55343065e3 remove MachineOpCode typedef.
llvm-svn: 45679
2008-01-07 02:48:55 +00:00
Chris Lattner
96d0a93f8e remove some uses of MachineOpCode, move getSchedClass
into TargetInstrDescriptor from TargetInstrInfo.

llvm-svn: 45678
2008-01-07 02:46:03 +00:00
Chris Lattner
93e1e6ee12 Add predicates methods to TargetOperandInfo, and switch all clients
over to using them, instead of diddling Flags directly.  Change the
various flags from const variables to enums.

llvm-svn: 45677
2008-01-07 02:39:19 +00:00
Gordon Henriksen
edbfece273 Setting GlobalDirective in TargetAsmInfo by default rather than
providing a misleading facility. It's used once in the MIPS backend
and hardcoded as "\t.globl\t" everywhere else.

llvm-svn: 45676
2008-01-07 02:31:11 +00:00
Chris Lattner
f7f96d818f Rename MachineInstr::getInstrDescriptor -> getDesc(), which reflects
that it is cheap and efficient to get.

Move a variety of predicates from TargetInstrInfo into 
TargetInstrDescriptor, which makes it much easier to query a predicate
when you don't have TII around.  Now you can use MI->getDesc()->isBranch()
instead of going through TII, and this is much more efficient anyway. Not
all of the predicates have been moved over yet.

Update old code that used MI->getInstrDescriptor()->Flags to use the
new predicates in many places.

llvm-svn: 45674
2008-01-07 01:56:04 +00:00
Owen Anderson
f19692b2f6 Move even more functionality from MRegisterInfo into TargetInstrInfo.
Some day I'll get it all moved over...

llvm-svn: 45672
2008-01-07 01:35:02 +00:00
Gordon Henriksen
db4f51e1b9 With this patch, the LowerGC transformation becomes the
ShadowStackCollector, which additionally has reduced overhead with
no sacrifice in portability.

Considering a function @fun with 8 loop-local roots,
ShadowStackCollector introduces the following overhead
(x86):

; shadowstack prologue
        movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax
        movl    (%eax), %ecx
        movl    $___gc_fun, 20(%esp)
        movl    $0, 24(%esp)
        movl    $0, 28(%esp)
        movl    $0, 32(%esp)
        movl    $0, 36(%esp)
        movl    $0, 40(%esp)
        movl    $0, 44(%esp)
        movl    $0, 48(%esp)
        movl    $0, 52(%esp)
        movl    %ecx, 16(%esp)
        leal    16(%esp), %ecx
        movl    %ecx, (%eax)

; shadowstack loop overhead
        (none)

; shadowstack epilogue
        movl    48(%esp), %edx
        movl    %edx, (%ecx)

; shadowstack metadata
        .align  3
___gc_fun:                              # __gc_fun
        .long   8
        .space  4

In comparison to LowerGC:

; lowergc prologue
        movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax
        movl    (%eax), %ecx
        movl    %ecx, 48(%esp)
        movl    $8, 52(%esp)
        movl    $0, 60(%esp)
        movl    $0, 56(%esp)
        movl    $0, 68(%esp)
        movl    $0, 64(%esp)
        movl    $0, 76(%esp)
        movl    $0, 72(%esp)
        movl    $0, 84(%esp)
        movl    $0, 80(%esp)
        movl    $0, 92(%esp)
        movl    $0, 88(%esp)
        movl    $0, 100(%esp)
        movl    $0, 96(%esp)
        movl    $0, 108(%esp)
        movl    $0, 104(%esp)
        movl    $0, 116(%esp)
        movl    $0, 112(%esp)

; lowergc loop overhead
        leal    44(%esp), %eax
        movl    %eax, 56(%esp)
        leal    40(%esp), %eax
        movl    %eax, 64(%esp)
        leal    36(%esp), %eax
        movl    %eax, 72(%esp)
        leal    32(%esp), %eax
        movl    %eax, 80(%esp)
        leal    28(%esp), %eax
        movl    %eax, 88(%esp)
        leal    24(%esp), %eax
        movl    %eax, 96(%esp)
        leal    20(%esp), %eax
        movl    %eax, 104(%esp)
        leal    16(%esp), %eax
        movl    %eax, 112(%esp)

; lowergc epilogue
        movl    48(%esp), %edx
        movl    %edx, (%ecx)

; lowergc metadata
        (none)

llvm-svn: 45670
2008-01-07 01:30:53 +00:00
Gordon Henriksen
88a41c672b Enabling the target-independent garbage collection infrastructure by hooking it
up to the various compiler pipelines.

This doesn't actually add support for any GC algorithms, which means it 
temporarily breaks a few tests. To be fixed shortly.

llvm-svn: 45669
2008-01-07 01:30:38 +00:00
Chris Lattner
14310afe42 rename isLoad -> isSimpleLoad due to evan's desire to have such a predicate.
llvm-svn: 45667
2008-01-06 23:38:27 +00:00
Chris Lattner
a09bc3d9a4 back out accidental commit.
llvm-svn: 45660
2008-01-06 19:19:32 +00:00
Chris Lattner
6badc24aa5 fix an accidental commit that broke all the testers :(
llvm-svn: 45659
2008-01-06 19:18:52 +00:00
Duncan Sands
fd975e4b3d The transform that tries to turn calls to bitcast functions into
direct calls bails out unless caller and callee have essentially
equivalent parameter attributes.  This is illogical - the callee's
attributes should be of no relevance here.  Rework the logic, which
incidentally fixes a crash when removed arguments have attributes.

llvm-svn: 45658
2008-01-06 18:27:01 +00:00
Duncan Sands
b8489f09a2 When transforming a call to a bitcast function into
a direct call with cast parameters and cast return
value (if any), instcombine was prepared to cast any
non-void return value into any other, whether castable
or not.  Add a new predicate for testing whether casting
is valid, and check it both for the return value and
(as a cleanup) for the parameters.

llvm-svn: 45657
2008-01-06 10:12:28 +00:00
Chris Lattner
5489888580 rename isStore -> mayStore to more accurately reflect what it captures.
llvm-svn: 45656
2008-01-06 08:36:04 +00:00
Chris Lattner
06c02cdcbc describe isStore and simplify the implementation of hasUnmodelledSideEffects.
No functionality change. 

llvm-svn: 45651
2008-01-06 05:43:21 +00:00
Evan Cheng
759f389846 X86 JIT PIC jumptable support.
llvm-svn: 45616
2008-01-05 02:26:58 +00:00
Owen Anderson
6c7beb1748 Didn't mean to commit this.
llvm-svn: 45607
2008-01-05 00:43:37 +00:00
Owen Anderson
4cce45354c Didn't mean to commit this.
llvm-svn: 45606
2008-01-05 00:42:45 +00:00
Owen Anderson
2adf8c5533 Move some more functionality from MRegisterInfo to TargetInstrInfo.
llvm-svn: 45603
2008-01-04 23:57:37 +00:00
Bill Wendling
93556af6c4 Don't recalculate the loop info and loop dominators analyses if they're
preserved.

llvm-svn: 45596
2008-01-04 20:54:55 +00:00
Wojciech Matyjewicz
2502769cf3 fix typo
llvm-svn: 45595
2008-01-04 20:04:08 +00:00
Evan Cheng
7322e4dec4 X86 PIC JIT support fixes: encoding bugs, add lazy pointer stubs support.
llvm-svn: 45575
2008-01-04 10:46:51 +00:00
Chris Lattner
f4972fa569 Add a really quick hack at a machine code sinking pass, enabled with --enable-sinking.
It is missing validity checks, so it is known broken.  However, it is powerful enough
to compile this contrived code:

void test1(int C, double A, double B, double *P) {
  double Tmp = A*A+B*B;
  *P = C ? Tmp : A;
}

into:

_test1:
	movsd	8(%esp), %xmm0
	cmpl	$0, 4(%esp)
	je	LBB1_2	# entry
LBB1_1:	# entry
	movsd	16(%esp), %xmm1
	mulsd	%xmm1, %xmm1
	mulsd	%xmm0, %xmm0
	addsd	%xmm1, %xmm0
LBB1_2:	# entry
	movl	24(%esp), %eax
	movsd	%xmm0, (%eax)
	ret

instead of:

_test1:
	movsd	16(%esp), %xmm0
	mulsd	%xmm0, %xmm0
	movsd	8(%esp), %xmm1
	movapd	%xmm1, %xmm2
	mulsd	%xmm2, %xmm2
	addsd	%xmm0, %xmm2
	cmpl	$0, 4(%esp)
	je	LBB1_2	# entry
LBB1_1:	# entry
	movapd	%xmm2, %xmm1
LBB1_2:	# entry
	movl	24(%esp), %eax
	movsd	%xmm1, (%eax)
	ret

woo.

llvm-svn: 45570
2008-01-04 07:36:53 +00:00
Gordon Henriksen
8e4ae9a345 Trying that again.
llvm-svn: 45529
2008-01-03 03:32:33 +00:00
Evan Cheng
fb2bc4fc95 Change MachineRelocation::DoesntNeedFnStub to NeedStub. This fields will be used
for non-function GV relocations that require function address stubs (e.g. Mac OS X in non-static mode).

llvm-svn: 45527
2008-01-03 02:56:28 +00:00
Chris Lattner
6c74a2cbcb don't access element zero of an array of size zero.
llvm-svn: 45526
2008-01-03 01:25:31 +00:00
Chris Lattner
e54252e6e1 Don't create a new ParamAttrsList (which copies the vector) just to
get a profile.

llvm-svn: 45524
2008-01-03 00:29:27 +00:00
Chris Lattner
e14d4d026e move some code out of line, rearrange a bit.
llvm-svn: 45519
2008-01-03 00:10:22 +00:00
Chris Lattner
8634e197c3 Disallow copying explicitly.
llvm-svn: 45518
2008-01-03 00:09:47 +00:00
Chris Lattner
9ec341b120 Split param attr implementation out from Function.cpp into its
own file.  Don't #include ParameterAttributes.h into any major
public header files: just move methods out of line as appropriate.

llvm-svn: 45517
2008-01-02 23:42:30 +00:00