Commit Graph

3074 Commits

Author SHA1 Message Date
Jeffrey Yasskin 406ac811ab Fix http://llvm.org/PR5160, to let CallbackVHs modify other ValueHandles on the
same Value without breaking things.

llvm-svn: 83861
2009-10-12 17:43:32 +00:00
Chris Lattner 40cf28d6eb add some more hooks to the C bindings, patch by Kenneth Uildriks!
llvm-svn: 83821
2009-10-12 04:01:02 +00:00
Dan Gohman 09984279fd Add a form of addPreserved which takes a string argument, to allow passes
to declare that they preserve other passes without needing to pull in
additional header file or library dependencies. Convert MachineFunctionPass
and CodeGenLICM to make use of this.

llvm-svn: 83555
2009-10-08 17:00:02 +00:00
Devang Patel bcdb02587e Do not assume that the module is set.
llvm-svn: 83462
2009-10-07 16:37:55 +00:00
Duncan Sands 986742a14f Make getPointerTo return a const PointerType* rather than
an unqualified PointerType* because it seems more correct.

llvm-svn: 83454
2009-10-07 07:35:19 +00:00
Duncan Sands 9ed7b16bf3 Introduce and use convenience methods for getting pointer types
where the element is of a basic builtin type.  For example, to get
an i8* use getInt8PtrTy.

llvm-svn: 83379
2009-10-06 15:40:36 +00:00
Chris Lattner fdd8790718 strength reduce a ton of type equality tests to check the typeid (Through
the new predicates I added) instead of going through a context and doing a
pointer comparison.  Besides being cheaper, this allows a smart compiler
to turn the if sequence into a switch.

llvm-svn: 83297
2009-10-05 05:54:46 +00:00
Nick Lewycky ae4617c974 Requires element types in a constant initializer to match the element types of
of the constant. This reverts r6544 and r7428.

llvm-svn: 83270
2009-10-03 19:30:43 +00:00
Devang Patel 48575e3f2e Check for null MDNode element while printing comment.
llvm-svn: 83172
2009-09-30 21:26:51 +00:00
Jeffrey Yasskin 8ce67f83bc Assert that ConstantArrays are created with correctly-typed elements.
llvm-svn: 83168
2009-09-30 21:08:08 +00:00
Devang Patel 711ab5b8ec Print tag name for MDNodes that are used to encode debug info.
llvm-svn: 83160
2009-09-30 20:16:54 +00:00
Devang Patel 7b4d52b170 Lookup handler name only when assertions are enabled.
llvm-svn: 83114
2009-09-29 22:05:52 +00:00
Devang Patel b4034364d6 Add removeMD().
llvm-svn: 83107
2009-09-29 20:42:25 +00:00
Devang Patel 5bf7a49fd7 Only one custom meadata of each kind can be attached with an instruction.
llvm-svn: 83105
2009-09-29 20:30:57 +00:00
Devang Patel 561977940c Use assertion instead of early exit to catch malformed custom metadata store.
llvm-svn: 83102
2009-09-29 20:01:19 +00:00
Devang Patel ba4a6fdd17 Parse custom metadata attached with an instruction.
llvm-svn: 83033
2009-09-29 00:01:14 +00:00
Dan Gohman f919bd6651 Add C API calls for building FNeg operations. Patch by KS Sreeram!
llvm-svn: 83021
2009-09-28 21:51:41 +00:00
Devang Patel 2d85eef974 s/class Metadata/class MetadataContext/g
llvm-svn: 83019
2009-09-28 21:41:20 +00:00
Devang Patel b1a4477f1f Do not use global typedef for MDKindID.
llvm-svn: 83016
2009-09-28 21:14:55 +00:00
Devang Patel 565371b4c9 Do not hardcode metadata names.
llvm-svn: 83010
2009-09-28 20:56:00 +00:00
Devang Patel 59c0c1388f Remove dead code.
llvm-svn: 82999
2009-09-28 18:31:56 +00:00
Dan Gohman 08d86dac71 Remove temporary debugging hack.
llvm-svn: 82953
2009-09-28 00:44:15 +00:00
Dan Gohman 4dbb301f17 Move the dominator verification code out of special code embedded within
the PassManager code into a regular verifyAnalysis method.

Also, reorganize loop verification. Make the LoopPass infrastructure
call verifyLoop as needed instead of having LoopInfo::verifyAnalysis
check every loop in the function after each looop pass. Add a new
command-line argument, -verify-loop-info, to enable the expensive
full checking.

llvm-svn: 82952
2009-09-28 00:27:48 +00:00
Dan Gohman 277e767578 Extend the StartPassTimer and StopPassTimer functions so that the
code that stops the timer doesn't have to search to find the timer
object before it stops the timer. This avoids a lock acquisition
and a few other things done with the timer running.

llvm-svn: 82949
2009-09-28 00:07:05 +00:00
Dan Gohman 5e8ba5d514 Extract the code for releasing a pass into a separate function, and
tidy it up a little.

llvm-svn: 82944
2009-09-27 23:38:27 +00:00
Nick Lewycky 93e06a57c9 Remove the "metadata*" type and simplify the code it complicated. This was only
used to support GlobalVariables storing MDNodes, back when they were derived
from Constant before the introduction of NamedMDNode, but never removed.

llvm-svn: 82943
2009-09-27 23:27:42 +00:00
Nick Lewycky 28a5f25d87 Round out the API for the new optimization flags.
llvm-svn: 82930
2009-09-27 21:33:04 +00:00
Dan Gohman 4338f905b7 Micro-optimize DerivedType::dropAllTypeUses.
llvm-svn: 82900
2009-09-27 15:32:21 +00:00
Nick Lewycky 14d1cccc2b Remove dead code from this function and optimize. Update its corresponding
LangRef entry too.

llvm-svn: 82890
2009-09-27 07:55:32 +00:00
Nick Lewycky 42fb7452df Instruction::clone does not need to take an LLVMContext&. Remove that and
update all the callers.

llvm-svn: 82889
2009-09-27 07:38:41 +00:00
Duncan Sands 129de48982 For the NSWSub support in the builder to actually be useable,
there need to be corresponding changes to the constant folders,
done in this patch.

llvm-svn: 82862
2009-09-26 15:35:35 +00:00
Dan Gohman 394468dc8e Rename ConstantFP's getInf to getInfinity.
llvm-svn: 82823
2009-09-25 23:40:21 +00:00
Dan Gohman feb5021134 Add a ConstantFP::getInf utility function for creating infinity ConstantFPs.
llvm-svn: 82818
2009-09-25 23:00:48 +00:00
Victor Hernandez e6ff7662b6 Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
llvm-svn: 82784
2009-09-25 18:11:52 +00:00
Victor Hernandez 46cd467310 Auto-upgrade malloc instructions to malloc calls.
Reviewed by Devang Patel.

llvm-svn: 82694
2009-09-24 17:47:49 +00:00
Devang Patel 4e6f2e46e8 Move parent assertion check before metadata deletion.
llvm-svn: 82692
2009-09-24 16:19:11 +00:00
Devang Patel 52e819c7cf Delete attached metadata when an instruction is deleted.
llvm-svn: 82647
2009-09-23 20:33:51 +00:00
Devang Patel add586526e Do not leave behind metadata while cloning an instruction.
llvm-svn: 82638
2009-09-23 18:32:25 +00:00
Dan Gohman c0353bfff5 Give MachineMemOperand an operator<<, factoring out code from
two different places for printing MachineMemOperands.

Drop the virtual from Value::dump and instead give Value a
protected virtual hook that can be overridden by subclasses
to implement custom printing. This lets printing be more
consistent, and simplifies printing of PseudoSourceValue
values.

llvm-svn: 82599
2009-09-23 01:33:16 +00:00
Victor Hernandez ddc2ce4fe2 No need to verify that malloc's return type is i8*.
llvm-svn: 82561
2009-09-22 18:50:03 +00:00
Daniel Dunbar 86707c9913 Fix commento.
llvm-svn: 82544
2009-09-22 10:30:34 +00:00
Daniel Dunbar 70d4fb0d97 Add a TrackingVH value handle.
This is designed for tracking a value even when it might move (like WeakVH), but it is an error to delete the referenced value (unlike WeakVH0. TrackingVH is templated like AssertingVH on the tracked Value subclass, it is an error to RAUW a tracked value to an incompatible type.

For implementation reasons the latter error is only diagnosed on accesses to a mis-RAUWed TrackingVH, because we don't want a virtual interface in a templated class.

The former error is also only diagnosed on access, so that clients are allowed to delete a tracked value, as long as they don't use it. This makes it easier for the client to reason about destruction.

llvm-svn: 82506
2009-09-22 02:02:33 +00:00
Chris Lattner cf295039e4 Fix PR5023: The instruction form of DominatorTree::dominates did not
take into consideration that the result of an invoke is only valid in
the normal dest, not the unwind dest.  This caused 'PHINode::hasConstantValue'
to return true in an invalid situation, causing mem2reg to delete a phi that
was actually needed.  This caused a crash building 483.xalancbmk.

llvm-svn: 82491
2009-09-21 22:39:35 +00:00
Chris Lattner 22151ce5e9 move DominatorTree::dominates for instructions out of line,
no functionality change.

llvm-svn: 82490
2009-09-21 22:30:50 +00:00
Chris Lattner 7d08da6b2a tidy up
llvm-svn: 82489
2009-09-21 22:27:34 +00:00
Nuno Lopes 2c7e72cf42 initialize SymbolsCanStartWithDigit to false by default
llvm-svn: 82454
2009-09-21 14:11:56 +00:00
Nick Lewycky 9b3ed87506 Peer through zext and sext to eliminate them when it is safe to do so.
llvm-svn: 82389
2009-09-20 07:31:25 +00:00
Nick Lewycky b0225ba289 Fold 'icmp eq (icmp), true' into an xor(icmp).
llvm-svn: 82386
2009-09-20 07:21:39 +00:00
Nick Lewycky ff550aa36d Correct the comment; this applies to fcmp too.
llvm-svn: 82380
2009-09-20 06:27:35 +00:00
Nick Lewycky 0f8348e85b Remove tab, again.
llvm-svn: 82379
2009-09-20 06:26:34 +00:00