Commit Graph

479 Commits

Author SHA1 Message Date
Chris Lattner
7d05c46d60 rename getHandlerNames to getMDKindNames, simplify its interface
and simplify all the clients that use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92224 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 20:10:43 +00:00
Chris Lattner
bcb18538c2 change the strange MetadataContext::getMDs function to expose less
irrelevant internal implementation details to clients.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92210 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 08:14:54 +00:00
Chris Lattner
a327524b69 eliminate the elem_* iterator stuff from NamedMDNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92208 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 07:57:01 +00:00
David Greene
afd52024e5 Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92092 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 00:06:26 +00:00
David Greene
5669a3e7d0 Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92091 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 23:47:53 +00:00
Chris Lattner
4bbf4ee149 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91421 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 07:26:43 +00:00
Victor Hernandez
9d0b704e3e 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86311 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 00:16:28 +00:00
Victor Hernandez
df98761d08 Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-06 01:33:24 +00:00
Victor Hernandez
24f934d055 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 00:03:03 +00:00
Chris Lattner
cdfc940912 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85699 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-01 01:27:45 +00:00
Chris Lattner
7d83ebcadd 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85678 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-31 20:08:37 +00:00
Chris Lattner
50b136dae9 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85377 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 05:53:48 +00:00
Chris Lattner
837e04a8bf bitcode writer support for blockaddress.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85376 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 05:24:40 +00:00
Chris Lattner
0eeb913aa1 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85375 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 05:14:34 +00:00
Chris Lattner
ab21db79ef rename indbr -> indirectbr to appease the residents of #llvm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85351 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-28 00:19:10 +00:00
Chris Lattner
f9be95f867 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85274 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 19:13:16 +00:00
Chris Lattner
f3523592b2 Type.h doesn't need to #include LLVMContext.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-27 17:08:31 +00:00
Victor Hernandez
046e78ce55 Remove FreeInst.
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 23:43:48 +00:00
Daniel Dunbar
22bbd9b9b8 Suppress -Asserts warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-25 23:11:06 +00:00
Victor Hernandez
66284e063a 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84987 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-24 04:23:03 +00:00
Devang Patel
9d89df1690 Hide MetadataContext implementation details.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84886 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 19:36:54 +00:00
Devang Patel
f61b2371c8 Fix getMDs() interface such that it does not expose implementation details.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 18:55:16 +00:00
Devang Patel
b5681b2293 Using TrackingVH instead of WeakVH or WeakMetadataVH.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 18:25:28 +00:00
Devang Patel
ce6a1c9756 Fix getHandlerNames() interface. Now it populate clinet supplied small vector with handler names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84820 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-22 01:01:24 +00:00
Dale Johannesen
8ba2d5befc Rename msasm to alignstack per review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84795 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 23:28:00 +00:00
Devang Patel
028fa77d56 Do not use SmallVector to store MDNode elements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84784 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 21:25:09 +00:00
Victor Hernandez
68afa54033 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84772 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-21 19:11:40 +00:00
Chris Lattner
12f031d005 simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84465 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-19 05:51:03 +00:00
Victor Hernandez
a276c603b8 Remove MallocInst from LLVM Instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84299 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 01:18:07 +00:00
Victor Hernandez
13ad5aaaff 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84292 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-17 00:00:19 +00:00
Dale Johannesen
4360298d2b Add an "msasm" flag to inline asm as suggested in PR 5125.
A little ugliness is accepted to keep the binary file format
compatible.  No functional change yet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84020 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 20:46:56 +00:00
Devang Patel
5192e30a72 Do not write empty METADATA_ATTACHMENT record.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84006 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 18:51:28 +00:00
Devang Patel
a917bfe8c2 Remove unnecessary assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84004 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 18:51:03 +00:00
Chris Lattner
cf0fe8d813 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83297 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-05 05:54:46 +00:00
Devang Patel
58a230a491 Only one custom meadata of each kind can be attached with an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83105 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-29 20:30:57 +00:00
Devang Patel
e30e678865 s/class Metadata/class MetadataContext/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83019 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 21:41:20 +00:00
Devang Patel
a2148402ce Do not use global typedef for MDKindID.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-28 21:14:55 +00:00
Victor Hernandez
3e0c99a26f Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82784 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25 18:11:52 +00:00
Victor Hernandez
96b930ddc7 Auto-upgrade malloc instructions to malloc calls.
Reviewed by Devang Patel.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-24 17:47:49 +00:00
Daniel Dunbar
a279bc3da5 Tabs -> spaces, and remove trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-20 02:20:51 +00:00
Devang Patel
e8e0213cc3 Write and read metadata attachments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 19:26:43 +00:00
Dan Gohman
f8dbee7cea Reappy r80998, now that the GlobalOpt bug that it exposed on MiniSAT is fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81172 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-07 23:54:19 +00:00
Duncan Sands
59bf4fcc06 Public and private corrections, warned about by icc (#304).
Patch by Erick Tryzelaar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81107 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 08:55:57 +00:00
Daniel Dunbar
92a97a9166 Revert "Include optional subclass flags, such as inbounds, nsw, etc., ...", this
breaks MiniSAT on x86_64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-06 00:11:24 +00:00
Dan Gohman
859fff476d Include optional subclass flags, such as inbounds, nsw, etc., in the
Constant uniquing tables. This allows distinct ConstantExpr objects
with the same operation and different flags.

Even though a ConstantExpr "a + b" is either always overflowing or
never overflowing (due to being a ConstantExpr), it's still necessary
to be able to represent it both with and without overflow flags at
the same time within the IR, because the safety of the flag may
depend on the context of the use. If the constant really does overflow,
it wouldn't ever be safe to use with the flag set, however the use
may be in code that is never actually executed.

This also makes it possible to merge all the flags tests into a single test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80998 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-04 12:08:11 +00:00
Gabor Greif
03a5f139fb back out my recent commit (r80858), it seems to break self-hosting buildbot's stage 2 configure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80871 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 02:02:59 +00:00
Devang Patel
c0ff8c85dc Add new value for given index in MDValuePtrs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 01:38:02 +00:00
Gabor Greif
190390b8d3 re-commit r66920 (which has been backed out in r66953) I may have more luck this time. I'll back out if needed...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-03 00:18:58 +00:00
Sandeep Patel
65c3c8f323 Retype from unsigned to CallingConv::ID accordingly. Approved by Bob Wilson.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80773 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 08:44:58 +00:00
Devang Patel
e4b275610a Reapply 79977.
Use MDNodes to encode debug info in llvm IR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-28 23:24:31 +00:00
Devang Patel
8245988835 Revert 79977. It causes llvm-gcc bootstrap failures on some platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80073 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 05:01:18 +00:00
Dan Gohman
1c8a23c440 Eliminate the unused Context argument on one of the ICmpInst and FCmpInst
constructors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80049 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 23:17:54 +00:00
Dan Gohman
baa26395cc Make LLVM command-line tools overwrite their output files without -f.
This is conventional command-line tool behavior. -f now just means
"enable binary output on terminals".

Add a -f option to llvm-extract and llvm-link, for consistency.

Remove F_Force from raw_fd_ostream and enable overwriting and
truncating by default. Introduce an F_Excl flag to permit users to
enable a failure when the file already exists. This flag is
currently unused.

Update Makefiles and documentation accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 15:34:52 +00:00
Devang Patel
2a610c7387 Update DebugInfo interface to use metadata, instead of special named llvm.dbg.... global variables, to encode debugging information in llvm IR. This is mostly a mechanical change that tests metadata support very well.
This change speeds up llvm-gcc by more then 6% at "-O0 -g" (measured by compiling InstructionCombining.cpp!)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79977 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-25 05:24:07 +00:00
Chris Lattner
d9ea85ab01 remove some uses of llvm/Support/Streams.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79842 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 08:43:55 +00:00
Chris Lattner
b515d75856 eliminate the std::ostream forms of the bitcode writing APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79840 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 07:49:08 +00:00
Dan Gohman
5078f84c82 Rename hasNoUnsignedOverflow and hasNoSignedOverflow to hasNoUnsignedWrap
and hasNoSignedWrap, for consistency with the nuw and nsw properties.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79539 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20 17:11:38 +00:00
Daniel Dunbar
dddfd34e32 Switch to SmallString::str from SmallString::c_str, and remove
SmallString::c_str.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79456 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-19 20:07:03 +00:00
Owen Anderson
0e275dc538 Actually privatize a IntegerTypes, and fix a few bugs exposed by this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78955 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 23:27:32 +00:00
Owen Anderson
1d0be15f89 Push LLVMContexts through the IntegerType APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78948 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 21:58:54 +00:00
Benjamin Kramer
12ddd40953 Make LLVMContext and LLVMContextImpl classes instead of structs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78690 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 17:45:13 +00:00
Erick Tryzelaar
ccf9f2b12e Change llvm-c's ordering of contexts to make it consistent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78656 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-11 07:46:16 +00:00
Owen Anderson
d7f2a6cb3f Privatize the StructType table, which unfortunately involves routing contexts through a number of APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78258 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 23:16:16 +00:00
Chris Lattner
4f95d2bda4 revert r78048, it isn't worth using assertingvh here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 23:07:12 +00:00
Owen Anderson
48b2f3e485 Factor some of the constants+context related code out into a separate header, to make LLVMContextImpl.h
not hideous.  Also, fix some MSVC compile errors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78115 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 22:41:48 +00:00
Devang Patel
d5ac40457b Use separate ValueList for metadata.
This fixes PR4666.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78056 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 06:00:18 +00:00
Devang Patel
912538beca Revert recent bitcode writer patches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78053 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 05:01:35 +00:00
Chris Lattner
0a0193edf9 switch ValueMap to using AssertingVH. This is an old patch I had laying
around in a tree I forgot about.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78048 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 04:31:02 +00:00
Devang Patel
13ed1e2936 Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78035 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 02:54:15 +00:00
Devang Patel
2453c40145 Fix MDString Abbrev setup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78034 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 02:36:39 +00:00
Devang Patel
d701aa7bed Constants and Metadata share ValueList. This means they must be emitted interleaved (using appropriate BLOCK_IDs) otherwise ValuePtrs index gets out of sync.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78033 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-04 02:26:56 +00:00
Owen Anderson
647e3016de Move the metadata constructors back to 2.5 syntax.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77733 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 21:35:40 +00:00
Owen Anderson
a7235ea724 Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77721 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 20:28:14 +00:00
Benjamin Kramer
624f3b930d Work around a dangling pointer dereference when enumerating NamedMDNodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 14:22:13 +00:00
Devang Patel
b3f7c61d9c Do not use abbrev while writing NamedMDNode name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77637 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-30 23:06:35 +00:00
Devang Patel
53a7c6c983 Enumerate NamedMDNode elements first.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77636 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-30 23:03:43 +00:00
Owen Anderson
9e9a0d5fc2 Move more code back to 2.5 APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77635 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-30 23:03:37 +00:00
Devang Patel
aa99314251 Read and write NamedMDNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77517 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 22:34:41 +00:00
Owen Anderson
debcb01b0f Move types back to the 2.5 API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77516 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 22:17:13 +00:00
Owen Anderson
baf3c40440 Move ConstantExpr to 2.5 API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77494 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 18:55:55 +00:00
Devang Patel
985fea2f1a Refactor. Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77482 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 18:15:02 +00:00
Devang Patel
0a9f7b9c3e Rename MDNode.h header. It defines MDnode and other metadata classes.
New name is Metadata.h.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 21:49:47 +00:00
Owen Anderson
af7ec97587 Return ConstantVector to 2.5 API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 21:19:26 +00:00
Owen Anderson
1fd7096407 Change ConstantArray to 2.5 API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-28 18:32:17 +00:00
Owen Anderson
8fa3338ed2 Move ConstantStruct back to 2.5 API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77266 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 22:29:26 +00:00
Dan Gohman
dd8004dc73 Add a new keyword 'inbounds' for use with getelementptr. See the
LangRef.html changes for details.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 21:53:46 +00:00
Owen Anderson
6f83c9c6ef Move ConstantFP construction back to the 2.5-ish API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 20:59:43 +00:00
Daniel Dunbar
3f53fa9a51 Remove Value::setName(const char*, unsigned).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77100 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-26 00:34:27 +00:00
Daniel Dunbar
92ccf70ad4 Finish migrating VMCore to StringRef/Twine based APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77051 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 06:02:13 +00:00
Eric Christopher
a3500da559 Move ExtractElementInst to ::Create instead of new. Update all uses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77044 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-25 02:28:41 +00:00
Owen Anderson
eed707b1e6 Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77011 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 23:12:02 +00:00
Devang Patel
2f9c3b002d MDString
- Rename member function size(). New name is length().
- Store string beginning and length. Earlier it used to store string end.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76841 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 02:00:51 +00:00
Devang Patel
104cf9e02b Derive MDNode from MetadataBase instead of Constant. Emit MDNodes into METADATA_BLOCK in bitcode file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 01:07:34 +00:00
Devang Patel
70c9d17f27 Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76787 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 21:10:50 +00:00
Devang Patel
02383cc52b Use isa<> instead of dyn_cast<>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76767 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 18:35:25 +00:00
Sanjiv Gupta
3185a4ac6d Fixed build warning. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76761 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 17:58:47 +00:00
Devang Patel
e54abc90fe Introduce MetadataBase, a base class for MDString and MDNode.
Derive MDString directly from MetadataBase. 
Introduce new bitcode block to hold metadata.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76759 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 17:43:22 +00:00
Dan Gohman
1224c38698 Assembly and Bitcode support for unsigned/signed overflow flags and
exact sdiv flags.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76475 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 21:19:07 +00:00
Bill Wendling
3d10a5a757 Add plumbing for the `linker_private' linkage type. This type is meant for
"private" symbols which the assember shouldn't strip, but which the linker may
remove after evaluation. This is mostly useful for Objective-C metadata.

This is plumbing, so we don't have a use of it yet. More to come, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76385 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 01:03:30 +00:00
Owen Anderson
50dead06ff Revert yesterday's change by removing the LLVMContext parameter to AllocaInst and MallocInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-15 23:53:25 +00:00
Owen Anderson
9adc0abad3 Move EVER MORE stuff over to LLVMContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 23:09:55 +00:00
Torok Edwin
c23197a26f llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-14 16:55:14 +00:00
Torok Edwin
c25e7581b9 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-11 20:10:48 +00:00
Owen Anderson
333c400965 This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75200 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-09 23:48:35 +00:00
Owen Anderson
e9b11b4313 Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75025 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 19:03:57 +00:00
Nick Lewycky
7f6aa2b162 Remove the vicmp and vfcmp instructions. Because we never had a release with
these instructions, no autoupgrade or backwards compatibility support is
provided.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 03:04:38 +00:00
Owen Anderson
3d29df3e8a Push LLVMContext through GlobalVariables and IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 01:26:06 +00:00
Owen Anderson
74a77812d1 LLVMContext-ify the bitcode reader.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74942 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 20:18:58 +00:00
Devang Patel
a41a5dc3b7 !"i" is a valid MDString.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74881 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-06 23:40:48 +00:00
Owen Anderson
d0265aa00e Ack, missed one incompatibility.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74695 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 07:21:49 +00:00
Owen Anderson
c8897d9c2f Restore other bits of the C API that I tore up. All pre-existing APIs default to using the
default global context, while new *InContext() APIs have been added that take a LLVMContextRef parameter.

Apologies to anyone affected by this breakage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 07:17:57 +00:00
Owen Anderson
4434ed44c4 Make the use of const with respect to LLVMContext sane. Hopefully this is the last time, for the
moment, that I will need to make far-reaching changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74655 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 23:13:44 +00:00
Owen Anderson
31895e7359 Hold the LLVMContext by reference rather than by pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 21:22:36 +00:00
Owen Anderson
8b477ed579 Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools.

Patches for Clang and LLVM-GCC to follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74614 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 16:58:40 +00:00
Chris Lattner
714fa95d01 Fix PR4336: Iterating over use-def chains doesn't seem to be deterministic.
The problem was that BitcodeReader::materializeModule would read functions
from the bc file in densemap pointer key order (doubly non-deterministic!),
which would cause the use-def chains to be set up for globals in
non-determinstic order.  Non-determinstic use/def chains can cause 
nondeterminism in many places down-stream.

Many thanks to Julien Lerouge for putting together the pass in the PR that
shows the issue!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73470 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 05:15:21 +00:00
Nick Lewycky
f7e498138f Don't remove aggregate-typed module level constants before encoding functions
since functions may contain aggregate constants too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73220 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 05:20:12 +00:00
Dan Gohman
ae3a0be92e Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.

For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.

This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72897 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 22:49:04 +00:00
Nick Lewycky
3728a02534 Update the bitcode reader to support reading .bc files where the embedded
metadata references non-Constant values such as instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72685 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-01 04:42:10 +00:00
Nick Lewycky
88b7293f49 Fix typo in error message.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72659 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-31 06:07:28 +00:00
Nick Lewycky
7a0370f66a Give embedded metadata its own type instead of relying on EmptyStructTy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72610 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 05:06:04 +00:00
Nick Lewycky
cb33799b9f Make MDNode use CallbackVH. Also change MDNode to store Value* instead of
Constant* in preperation of a future change to support holding non-Constants
in an MDNode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10 20:57:05 +00:00
Chris Lattner
962dde3cef Make a major API change to BitstreamReader: split all the reading
state out of the BitstreamReader class into a BitstreamCursor class.
Doing this allows the client to have multiple cursors into the same
file, each with potentially different live block stacks and
abbreviation records.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26 20:59:02 +00:00
Chris Lattner
266c7bbbbc Add a new "available_externally" linkage type. This is intended
to support C99 inline, GNU extern inline, etc.  Related bugzilla's
include PR3517, PR3100, & PR2933.  Nothing uses this yet, but it
appears to work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 05:44:34 +00:00
Chris Lattner
e2a466bfa9 Teach llvm-bcanalyzer to skip over the header we use on LLVM IR files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68458 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 20:54:32 +00:00
Nick Lewycky
21cc4460ef Add support for embedded metadata to LLVM. This introduces two new types of
Constant, MDString and MDNode which can only be used by globals with a name
that starts with "llvm." or as arguments to a function with the same naming
restriction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-04 07:22:01 +00:00
Chris Lattner
7d9eb5884c fix a serious regression I introduced in my previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68173 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 01:43:03 +00:00
Chris Lattner
46e7740a44 reimplement BitcodeReaderValueList in terms of WeakVH instead of making
it be an LLVM IR User object.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68156 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 22:55:09 +00:00
Dale Johannesen
1b25cb2416 Fix internal representation of fp80 to be the
same as a normal i80 {low64, high16} rather
than its own {high64, low16}.  A depressing number
of places know about this; I think I got them all.
Bitcode readers and writers convert back to the old
form to avoid breaking compatibility.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67562 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 21:16:53 +00:00
Bill Wendling
9a507cd915 Revert r66920. It was causing failures in the self-hosting buildbot (in release
mode).

Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/dg.exp ...
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes > /dev/null
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000004 start + 18446744073709543220
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes 

FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000006 start + 18446744073709543222
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes 

FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll  -bugpoint-crashcalls -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll -bugpoint-crashcalls -silence-passes 

--- Reverse-merging (from foreign repository) r66920 into '.':
U    include/llvm/Support/CallSite.h
U    include/llvm/Instructions.h
U    lib/Analysis/IPA/GlobalsModRef.cpp
U    lib/Analysis/IPA/Andersens.cpp
U    lib/Bitcode/Writer/BitcodeWriter.cpp
U    lib/VMCore/Instructions.cpp
U    lib/VMCore/Verifier.cpp
U    lib/VMCore/AsmWriter.cpp
U    lib/Transforms/Utils/LowerInvoke.cpp
U    lib/Transforms/Scalar/SimplifyCFGPass.cpp
U    lib/Transforms/IPO/PruneEH.cpp
U    lib/Transforms/IPO/DeadArgumentElimination.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 21:15:59 +00:00
Gabor Greif
b14cda3c0d Second installment of "BasicBlock operands to the back"
changes.

For InvokeInst now all arguments begin at op_begin().
The Callee, Cont and Fail are now faster to get by
access relative to op_end().

This patch introduces some temporary uglyness in CallSite.
Next I'll bring CallInst up to a similar scheme and then
the uglyness will magically vanish.

This patch also exposes all the reliance of the libraries
on InvokeInst's operand ordering. I am thinking of taking
care of that too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66920 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 18:27:29 +00:00
Duncan Sands
4dc2b39bf8 It makes no sense to have a ODR version of common
linkage, so remove it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66690 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 20:14:15 +00:00
Duncan Sands
5f4ee1fc5d Remove the one-definition-rule version of extern_weak
linkage: this linkage type only applies to declarations,
but ODR is only relevant to globals with definitions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66650 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 08:08:06 +00:00
Duncan Sands
667d4b8de6 Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr.  These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global.  In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time.   This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function.  If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body.  The
code generators on the other hand map weak and weak_odr linkage
to the same thing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 15:45:40 +00:00
Nate Begeman
0f123cf732 Add suppport for ConstantExprs of shufflevectors whose result type is not equal to the
type of the vectors being shuffled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64401 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-12 21:28:33 +00:00
Chris Lattner
ba120aa5fa fix a bitcode reader bug where it can't handle extractelement correctly:
the index of the value being extracted is always an i32.  This fixes PR3465


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63597 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 02:11:28 +00:00
Gabor Greif
ae6ab1e950 use precise getters
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63403 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 18:27:21 +00:00
Gabor Greif
75a46eb800 use specialized accessor instead of plain getOperand(0)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62330 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 18:40:27 +00:00
Rafael Espindola
bb46f52027 Add the private linkage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62279 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-15 20:18:42 +00:00
Misha Brukman
9b8f542e27 Removed trailing whitespace from Makefiles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-09 16:44:42 +00:00
Gabor Greif
fdede435b9 revert to functionally equivalent formulation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61895 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-07 23:07:22 +00:00
Gabor Greif
8fe53b733b use the obvious getters
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61893 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-07 22:39:29 +00:00
Zhongxing Xu
f900f7b5a2 revert r61368.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 05:43:56 +00:00
Zhongxing Xu
fe5c8d08ff Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61368 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-23 05:30:44 +00:00
Chris Lattner
38e7721455 Add support for writing LLVM IR to a specified BitstreamWriter.
Patch by Lukasz Janyst!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 18:37:59 +00:00
Nick Lewycky
73ddd4f00d Commit missed files from nocapture change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61240 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 09:38:31 +00:00
Bill Wendling
6fa311c233 Temporarily revert r61019, r61030, and r61040. These were breaking LLVM Release
builds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61094 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-16 19:06:48 +00:00
Nick Lewycky
382da62ec2 It turns out that "align 1" and unaligned are different. Add a bias to the
alignment attribute such that 0 means unaligned.

This will probably require a rebuild of llvm-gcc because of the change to
Attributes.h. If you see many test failures on "make check", please rebuild
your llvm-gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61030 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 07:29:55 +00:00
Nick Lewycky
e642658480 Introducing nocapture, a parameter attribute for pointers to indicate that the
callee will not introduce any new aliases of that pointer.

The attributes had all bits allocated already, so I decided to collapse
alignment. Alignment was previously stored as a 16-bit integer from bits 16 to
32 of the attribute, but it was required to be a power of 2. Now it's stored in
log2 encoded form in five bits from 16 to 21. That gives us 11 more bits of
space.

You may have already noticed that you only need four bits to encode a 16-bit
power of two, so why five bits? Because the AsmParser accepted 32-bit
alignments, even though we couldn't store them (they were silently discarded).
Now we can store them in memory, but not in the bitcode.

The bitcode format was already storing these as 64-bit VBR integers. So, the
bitcode format stays the same, keeping the alignment values stored as 16 bit
raw values. There's some hideous code in the reader and writer that deals with
this, waiting to be ripped out the moment we run out of bits again and have to
replace the parameter attributes table encoding.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61019 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 01:34:58 +00:00
Mon P Wang
aeb06d2462 Added support for the following definition of shufflevector
<result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <m x i32> <mask> 



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58964 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-10 04:46:22 +00:00
Daniel Dunbar
e2e9d8e6aa Make sure to set stdout to binary when writing bitcode files via
std::ostream API.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58042 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 19:37:34 +00:00