1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

399 Commits

Author SHA1 Message Date
Victor Hernandez
4e63ccc1c3 Parse function-local metadata inside function blocks
llvm-svn: 93337
2010-01-13 19:34:08 +00:00
Victor Hernandez
6de2f65f80 Revert 93270 pending investigation of how stray non-constant values end up in ValueEnumerator's ValueList during WriteConstants()
llvm-svn: 93289
2010-01-13 03:18:30 +00:00
Victor Hernandez
9b62aee9ad Make WriteConstants() more robust against stray values in ValueEnumerator's ValueList
llvm-svn: 93270
2010-01-12 23:37:59 +00:00
Devang Patel
9874d72976 s/NextValueNo/NextMDValueNo while processing metadata.
llvm-svn: 93165
2010-01-11 18:52:33 +00:00
Victor Hernandez
f4272b50d6 Compute isFunctionLocal in MDNode ctor or via argument in new function getWhenValsUnresolved().
Document PFS argument to ParseValID() and ConvertGlobalOrMetadataValIDToValue().

llvm-svn: 93108
2010-01-10 07:14:18 +00:00
Chris Lattner
953394de82 "In order to ease automatic bindings generation, it would be helpful if boolean values were distinguishable from integers. The attached patch introduces "typedef int LLVMBool;", and uses LLVMBool instead of int throughout the C API, wherever a boolean value is called for."
Patch by James Y Knight!

llvm-svn: 93079
2010-01-09 22:27:07 +00:00
Chris Lattner
8a92d699f8 clean up this code, add a fixme.
llvm-svn: 93042
2010-01-09 02:02:37 +00:00
Devang Patel
de49dd9087 NamedMDNode is never used so there is no need to enumerate it here.
llvm-svn: 93039
2010-01-09 01:24:03 +00:00
Devang Patel
fbb47c2300 NamedMDNode element is either null or MDNode. Otherwise this is a malformed NamedMDNode record.
llvm-svn: 93037
2010-01-09 01:02:22 +00:00
Devang Patel
ea208bf99c Derive NamedMDNode from Value.
llvm-svn: 93032
2010-01-09 00:30:14 +00:00
Devang Patel
10ee76f7f4 Use separate namespace for named metadata.
llvm-svn: 92931
2010-01-07 19:39:36 +00:00
Devang Patel
311b5584e5 Allow null to be an element of NamedMDNode. e.g. !llvm.stuff = !{!0, !1, null}
llvm-svn: 92783
2010-01-05 21:47:32 +00:00
Devang Patel
ab66612f1b NamedMDNode is a collection MDNodes.
llvm-svn: 92761
2010-01-05 20:41:31 +00:00
Benjamin Kramer
e90a3c66c4 Avoid going through the LLVMContext for type equality where it's safe to dereference the type pointer.
llvm-svn: 92726
2010-01-05 13:12:22 +00:00
Ted Kremenek
15f320fa10 Remove derelict serialization code.
llvm-svn: 92374
2009-12-31 23:40:17 +00:00
Chris Lattner
c12382b7c8 rename "elements" of metadata to "operands". "Elements" are
things that occur in types.  "operands" are things that occur
in values.

llvm-svn: 92322
2009-12-31 01:22:29 +00:00
Chris Lattner
6108ad9dd5 tidy
llvm-svn: 92320
2009-12-31 00:51:46 +00:00
Chris Lattner
84e9de4a58 Final step in the metadata API restructuring: move the
getMDKindID/getMDKindNames methods to LLVMContext (and add
convenience methods to Module), eliminating MetadataContext.
Move the state that it maintains out to LLVMContext.

llvm-svn: 92259
2009-12-29 09:01:33 +00:00
Chris Lattner
9ec640a902 This is a major cleanup of the instruction metadata interfaces that
I asked Devang to do back on Sep 27.  Instead of going through the
MetadataContext class with methods like getMD() and getMDs(), just
ask the instruction directly for its metadata with getMetadata()
and getAllMetadata().

This includes a variety of other fixes and improvements: previously
all Value*'s were bloated because the HasMetadata bit was thrown into
value, adding a 9th bit to a byte.  Now this is properly sunk down to
the Instruction class (the only place where it makes sense) and it
will be folded away somewhere soon.

This also fixes some confusion in getMDs and its clients about 
whether the returned list is indexed by the MDID or densely packed.
This is now returned sorted and densely packed and the comments make
this clear.

This introduces a number of fixme's which I'll follow up on.

llvm-svn: 92235
2009-12-28 23:41:32 +00:00
Chris Lattner
cd3aa9d1ff rename getMDKind -> getMDKindID, make it autoinsert if an MD Kind
doesn't exist already, eliminate registerMDKind.  Tidy up a bunch
of random stuff.

llvm-svn: 92225
2009-12-28 20:45:51 +00:00
Chris Lattner
2b65f2d7d4 rename getHandlerNames to getMDKindNames, simplify its interface
and simplify all the clients that use it.

llvm-svn: 92224
2009-12-28 20:10:43 +00:00
Chris Lattner
739292d361 change the strange MetadataContext::getMDs function to expose less
irrelevant internal implementation details to clients.

llvm-svn: 92210
2009-12-28 08:14:54 +00:00
Chris Lattner
0a47dbff64 eliminate the elem_* iterator stuff from NamedMDNode.
llvm-svn: 92208
2009-12-28 07:57:01 +00:00
David Greene
7d1f350ec6 Change errs() to dbgs().
llvm-svn: 92092
2009-12-24 00:06:26 +00:00
David Greene
06d50ca292 Change errs() to dbgs().
llvm-svn: 92091
2009-12-23 23:47:53 +00:00
Chris Lattner
587962c667 Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait.  This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.

llvm-svn: 91421
2009-12-15 07:26:43 +00:00
Victor Hernandez
8736a8fca4 Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.
Here is the original commit message:

This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments.

Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.

llvm-svn: 86311
2009-11-07 00:16:28 +00:00
Victor Hernandez
a5a12cd62e Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM
llvm-svn: 86213
2009-11-06 01:33:24 +00:00
Victor Hernandez
21ec158c23 Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.

llvm-svn: 86077
2009-11-05 00:03:03 +00:00
Chris Lattner
2bbe57b2b8 Revert 85678/85680. The decision is to stay with the current form of
indirectbr, thus we don't need "blockaddr(@func, null)".  Eliminate it
for simplicity.

llvm-svn: 85699
2009-11-01 01:27:45 +00:00
Chris Lattner
cbab35746f Make blockaddress(@func, null) be valid, and make 'deleting a basic
block with a blockaddress still referring to it' replace the invalid 
blockaddress with a new blockaddress(@func, null) instead of a 
inttoptr(1).

This changes the bitcode encoding format, and still needs codegen 
support (this should produce a non-zero value, referring to the entry
block of the function would also be quite reasonable).

llvm-svn: 85678
2009-10-31 20:08:37 +00:00
Chris Lattner
1efa0c450a add bitcode reader support for blockaddress. We can now fully
round trip blockaddress through .ll and .bc files, so add a testcase.

There are still a bunch of places in the optimizer and other places
that need to be updated to work with these constructs, but at least
the basics are in now.

llvm-svn: 85377
2009-10-28 05:53:48 +00:00
Chris Lattner
075e225442 bitcode writer support for blockaddress.
llvm-svn: 85376
2009-10-28 05:24:40 +00:00
Chris Lattner
f605b2e8f9 Previously, all operands to Constant were themselves constant.
In the new world order, BlockAddress can have a BasicBlock operand.
This doesn't permute much, because if you have a ConstantExpr (or
anything more specific than Constant) we still know the operand has
to be a Constant.

llvm-svn: 85375
2009-10-28 05:14:34 +00:00
Chris Lattner
2bc8002f4c rename indbr -> indirectbr to appease the residents of #llvm.
llvm-svn: 85351
2009-10-28 00:19:10 +00:00
Chris Lattner
fdda543cea add enough support for indirect branch for the feature test to pass
(assembler,asmprinter, bc reader+writer) and document it.  Codegen
currently aborts on it.

llvm-svn: 85274
2009-10-27 19:13:16 +00:00
Chris Lattner
fa5b1df64a Type.h doesn't need to #include LLVMContext.h
llvm-svn: 85254
2009-10-27 17:08:31 +00:00
Victor Hernandez
673c036bc7 Remove FreeInst.
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.

llvm-svn: 85176
2009-10-26 23:43:48 +00:00
Daniel Dunbar
4a18e32e25 Suppress -Asserts warning.
llvm-svn: 85078
2009-10-25 23:11:06 +00:00
Victor Hernandez
e8998896f5 Auto-upgrade free instructions to calls to the builtin free function.
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.

llvm-svn: 84987
2009-10-24 04:23:03 +00:00
Devang Patel
5c461d6dcd Hide MetadataContext implementation details.
llvm-svn: 84886
2009-10-22 19:36:54 +00:00
Devang Patel
2a0e2f1794 Fix getMDs() interface such that it does not expose implementation details.
llvm-svn: 84885
2009-10-22 18:55:16 +00:00
Devang Patel
1fa3e26912 Using TrackingVH instead of WeakVH or WeakMetadataVH.
llvm-svn: 84884
2009-10-22 18:25:28 +00:00
Devang Patel
6df2865e24 Fix getHandlerNames() interface. Now it populate clinet supplied small vector with handler names.
llvm-svn: 84820
2009-10-22 01:01:24 +00:00
Dale Johannesen
2bb120a97f Rename msasm to alignstack per review.
llvm-svn: 84795
2009-10-21 23:28:00 +00:00
Devang Patel
d10159397a Do not use SmallVector to store MDNode elements.
llvm-svn: 84784
2009-10-21 21:25:09 +00:00
Victor Hernandez
0996619220 Make changes to rev 84292 as requested by Chris Lattner.
Most changes are cleanup, but there is 1 correctness fix:
I fixed InstCombine so that the icmp is removed only if the malloc call is removed (which requires explicit removal because the Worklist won't DCE any calls since they can have side-effects).

llvm-svn: 84772
2009-10-21 19:11:40 +00:00
Chris Lattner
3c31b79b45 simplify.
llvm-svn: 84465
2009-10-19 05:51:03 +00:00
Victor Hernandez
a25a2890fa Remove MallocInst from LLVM Instructions.
llvm-svn: 84299
2009-10-17 01:18:07 +00:00
Victor Hernandez
4d7283f82c Autoupgrade malloc insts to malloc calls.
Update testcases that rely on malloc insts being present.

Also prematurely remove MallocInst handling from IndMemRemoval and RaiseAllocations to help pass tests in this incremental step.

llvm-svn: 84292
2009-10-17 00:00:19 +00:00