Commit Graph

398 Commits

Author SHA1 Message Date
Gabor Greif
c9f7500d17 Finally land the InvokeInst operand reordering.
I have audited all getOperandNo calls now, fixing
hidden assumptions. CallSite related uglyness will
be eliminated successively.

Note this patch has a long and griveous history,
for all the back-and-forths have a look at
CallSite.h's log.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99399 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-24 13:21:49 +00:00
Gabor Greif
1cde4af157 backing out r99170 because it still fails on clang-x86_64-darwin10-fnt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99171 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-22 09:11:00 +00:00
Gabor Greif
9b1061e2e3 Now that hopefully all direct accesses to InvokeInst operands are fixed
we can reapply the InvokeInst operand reordering patch. (see r98957).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99170 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-22 08:28:00 +00:00
Gabor Greif
cc52ed0c4f back out r98957, it broke http://smooshlab.apple.com:8010/builders/clang-x86_64-darwin10-fnt/builds/703 in the nightly test suite
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 13:50:02 +00:00
Gabor Greif
f4f10e3779 Recommit r80858 again (which has been backed out in r80871).
This time I did a self-hosted bootstrap on Linux x86-64,
with no problems. Let's see how darwin 64-bit self-hosting
goes. At the first sign of failure I'll back this out.

Maybe the valgrind bots give me a hint of what may be wrong
(it at all).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98957 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 11:55:53 +00:00
Chris Lattner
93b122d3c4 reapply r98656 unmodified, which exposed the asmprinter not
handling constant unions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98680 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 21:25:55 +00:00
Daniel Dunbar
b85c7100c5 Revert r98656, its breaking all over the place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98662 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 19:35:34 +00:00
Chris Lattner
8b3b34f410 improve support for uniontype and ConstantUnion, patch by Tim Northover!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98656 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 19:15:03 +00:00
Chris Lattner
fdfeb6976f Add support for a union type in LLVM IR. Patch by Talin!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96011 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 20:49:41 +00:00
Evan Cheng
3922a9ba84 Also recognize armv6t2-* and armv5te-* triplets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96008 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 20:39:35 +00:00
Evan Cheng
0f8868b171 Add ARM bitcode file magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96006 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 20:13:44 +00:00
Victor Hernandez
2c482f4895 We were not writing bitcode for function-local metadata whose operands have been erased (making it not have any more function-local operands)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94842 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-29 21:19:19 +00:00
Jeffrey Yasskin
f0356fe140 Kill ModuleProvider and ghost linkage by inverting the relationship between
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
GlobalValues now, and doesn't provide modules, it's renamed to
"GVMaterializer". Code that used to need a ModuleProvider to materialize
Functions can now materialize the Functions directly. Functions no longer use a
magic linkage to record that they're materializable; they simply ask the
GVMaterializer.

Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
the functions that refer to it. Instead, because Module now exposes the same
functionality ModuleProvider used to, we store a Module* in any
LLVMModuleProviderRef and translate in the wrapper methods.  The bindings to
other languages still use the ModuleProvider concept.  It would probably be
worth some time to update them to follow the C++ more closely, but I don't
intend to do it.

Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 20:34:15 +00:00
Victor Hernandez
3cd7c3db99 Avoid modifying ValueEnumerator's MD ValueList by choosing which function-local MD to write based on the function currently being written
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93441 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-14 19:38:44 +00:00
Victor Hernandez
8ea5d4c529 In WriteFunction(), write function-local metadata before we write the instructions, so instruction's references to metadata are fully resolved by the time they get written.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93403 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-14 01:50:08 +00:00
Victor Hernandez
2cd4244815 Fix comment typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93355 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 21:25:04 +00:00
Victor Hernandez
0c316416bd Write function-local metadata as a metadata subblock of a funciton block
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93339 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 19:37:33 +00:00
Victor Hernandez
3047384a0f Revert 93270 pending investigation of how stray non-constant values end up in ValueEnumerator's ValueList during WriteConstants()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93289 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-13 03:18:30 +00:00
Victor Hernandez
994a204570 Make WriteConstants() more robust against stray values in ValueEnumerator's ValueList
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-12 23:37:59 +00:00
Victor Hernandez
24e64df7ec Compute isFunctionLocal in MDNode ctor or via argument in new function getWhenValsUnresolved().
Document PFS argument to ParseValID() and ConvertGlobalOrMetadataValIDToValue().



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93108 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-10 07:14:18 +00:00
Devang Patel
0386f01e06 Use separate namespace for named metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92931 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-07 19:39:36 +00:00
Devang Patel
69d02e0a17 Allow null to be an element of NamedMDNode. e.g. !llvm.stuff = !{!0, !1, null}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92783 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 21:47:32 +00:00
Chris Lattner
5d0cacdbb6 rename "elements" of metadata to "operands". "Elements" are
things that occur in types.  "operands" are things that occur
in values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-31 01:22:29 +00:00
Chris Lattner
081134741b 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92259 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-29 09:01:33 +00:00
Chris Lattner
3990b121cf 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-28 23:41:32 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Daniel Dunbar
d1ce3b48e2 Add raw_ostream versions of WriteBitcodeToFile and BitcodeWriterPass.
- The old versions are still hanging around, but should be migrated
   away from.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57989 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 17:39:14 +00:00
Dale Johannesen
7111b02c73 Rename APFloat::convertToAPInt to bitcastToAPInt to
make it clearer what the function does.  No functional
change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57325 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-09 18:53:47 +00:00
Devang Patel
0598866c05 Large mechanical patch.
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g

This sets the stage 
- to implement function notes as function attributes and 
- to distinguish between function attributes and return value attributes.

This requires corresponding changes in llvm-gcc and clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-25 21:00:45 +00:00
Devang Patel
e3d76d37e9 s/ParamAttrsWithIndex/FnAttributeWithIndex/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 00:55:02 +00:00
Devang Patel
d9b4a5f859 Use parameter attribute store (soon to be renamed) for
Function Notes also. Function notes are stored at index ~0.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56511 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 22:35:17 +00:00
Dan Gohman
fb2bbbe786 Re-enables the new vector select in the bitcode reader, by modifying the
bitcode reader/writer as follows:

- add and use new bitcode FUNC_CODE_INST_VSELECT to handle the llvm
select opcode using either i1 or [N x i1] as the selector.
- retain old BITCODE FUNC_CODE_INST_SELECT in the bitcode reader to
handle select on i1 for backwards compatibility with existing bitcode
files.
- re-enable the vector-select.ll test program.

Also, rename the recently added bitcode opcode FUNC_CODE_INST_VCMP to
FUNC_CODE_INST_CMP2 and make the bitcode writer use it to handle
fcmp/icmp on scalars or vectors. In the bitcode writer, use
FUNC_CODE_INST_CMP for vfcmp/vicmp only. In the bitcode reader, have
FUNC_CODE_INST_CMP handle icmp/fcmp returning bool, for backwards
compatibility with existing bitcode files.

Patch by Preston Gurd!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56233 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 01:01:33 +00:00
Dan Gohman
f72fb679ef Extend the vcmp/fcmp LLVM IR instructions to take vectors as arguments
and, if so, to return a vector of boolean as a result;

Extend the select LLVM IR instruction to allow you to specify a result
type which is a vector of boolean, in which case the result will be an
element-wise selection instead of choosing one vector or the other; and

Update LangRef.html to describe these changes.

This patch was contributed by Preston Gurd!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55969 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 01:02:47 +00:00
Devang Patel
7ad033c9e7 Read and write function notes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55657 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 21:47:13 +00:00
Chris Lattner
e35f1cacc8 add #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 21:33:24 +00:00
Gordon Henriksen
5eca075b74 Rename some GC classes so that their roll will hopefully be clearer.
In particular, Collector was confusing to implementors. Several
thought that this compile-time class was the place to implement
their runtime GC heap. Of course, it doesn't even exist at runtime.
Specifically, the renames are:

  Collector               -> GCStrategy
  CollectorMetadata       -> GCFunctionInfo
  CollectorModuleMetadata -> GCModuleInfo
  CollectorRegistry       -> GCRegistry
  Function::getCollector  -> getGC (setGC, hasGC, clearGC)

Several accessors and nested types have also been renamed to be
consistent. These changes should be obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54899 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-17 18:44:35 +00:00
Dan Gohman
fc74abfba5 Enable first-class aggregates support.
Remove the GetResultInst instruction. It is still accepted in LLVM assembly
and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove
support for return instructions with multiple values. These are auto-upgraded
to use InsertValueInst instructions.

The IRBuilder still accepts multiple-value returns, and auto-upgrades them
to InsertValueInst instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53941 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 00:34:11 +00:00
Dan Gohman
e089160d10 InsertValue and ExtractValue constant expressions are always
folded. Remove code that handled the case where they aren't
folded, and remove bitcode reader/writer support for them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 23:30:30 +00:00
Chris Lattner
6fa6a32e4e Add a little wrapper header that is put around bc files when emitting
bc files for modules with a target triple that indicates they are for
darwin.  The reader unconditionally handles this, and the writer could
turn this on for more targets if we care.

This change has two benefits for darwin:

1) it allows us to encode the cpu type of the file in an easy to read
   place that doesn't require decoding the bc file.
2) it works around a bug (IMO) in darwin's AR where it is incapable of
   handling files that are not a multiple of 8 bytes long.  BC files
   are only guaranteed to be multiples of 4 bytes long.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53275 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 05:14:23 +00:00
Anton Korobeynikov
b0a882f540 Turn stdout into binary mode during bitcode emission.
This is necessary on windows targets, since stdout is in text mode there.
Patch by Julien Lerouge!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52038 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 07:24:01 +00:00
Dan Gohman
0aab28bf4c Improved bitcode support for insertvalue/extractvalue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51822 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 19:11:15 +00:00
Dan Gohman
81a0c0b44e IR, bitcode reader, bitcode writer, and asmparser changes to
insertvalue and extractvalue to use constant indices instead of
Value* indices. And begin updating LangRef.html.

There's definately more to come here, but I'm checking this 
basic support in now to make it available to people who are
interested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51806 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 00:58:22 +00:00
Dan Gohman
e4977cf750 Make structs and arrays first-class types, and add assembly
and bitcode support for the extractvalue and insertvalue
instructions and constant expressions.

Note that this does not yet include CodeGen support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51468 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 01:55:30 +00:00
Dale Johannesen
6667646a56 Allow an extra bit for CommonLinkage.
This changes the .bc file format, but if I understand
how it works correctly, old .bc files continue to
be readable.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51161 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-15 20:49:28 +00:00
Dale Johannesen
aafce77b17 Add CommonLinkage; currently tentative definitions
are represented as "weak", but there are subtle differences
in some cases on Darwin, so we need both.  The intent
is that "common" will behave identically to "weak" unless
somebody changes their target to do something else.
No functional change as yet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51118 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-14 20:12:51 +00:00
Nate Begeman
ac80ade158 Add two new instructions to the llvm IR, vicmp and vfcmp. see updated LangRef
for details.  CodeGen support coming in a follow up patch


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50985 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-12 19:01:56 +00:00
Nick Lewycky
280a6e607d Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989
r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 16:53:59 +00:00
Chris Lattner
58d74910c6 Reimplement the parameter attributes support, phase #1. hilights:
1. There is now a "PAListPtr" class, which is a smart pointer around
   the underlying uniqued parameter attribute list object, and manages
   its refcount.  It is now impossible to mess up the refcount.
2. PAListPtr is now the main interface to the underlying object, and
   the underlying object is now completely opaque.
3. Implementation details like SmallVector and FoldingSet are now no
   longer part of the interface.
4. You can create a PAListPtr with an arbitrary sequence of
   ParamAttrsWithIndex's, no need to make a SmallVector of a specific 
   size (you can just use an array or scalar or vector if you wish).
5. All the client code that had to check for a null pointer before
   dereferencing the pointer is simplified to just access the 
   PAListPtr directly.
6. The interfaces for adding attrs to a list and removing them is a
   bit simpler.

Phase #2 will rename some stuff (e.g. PAListPtr) and do other less 
invasive changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-12 17:45:29 +00:00
Anton Korobeynikov
f8342b9866 Honour aliases visibility when reading from/writing to bitcode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48248 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-11 21:40:17 +00:00
Nick Lewycky
fc82fabe00 Add an unwind_to field to basic blocks, making them Users instead of Values.
This is the first checkin for PR1269, the new EH infrastructure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-02 02:48:09 +00:00
Devang Patel
9a8a88b72d Remove debugging help.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47585 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 01:42:38 +00:00
Devang Patel
d9d99ff8e8 Update bitcode reader and writer to handle multiple return values.
Take 2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47583 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 01:29:32 +00:00
Evan Cheng
1df439773c Backing out r47521 for now. This has broken a number of tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47533 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-23 19:32:32 +00:00
Devang Patel
e9fabd94ab Properly read and write bitcodes for multiple return values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47521 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-23 01:44:55 +00:00
Dale Johannesen
22c3979fca Split ParameterAttributes.h, putting the complicated
stuff into ParamAttrsList.h.  Per feedback from
ParamAttrs changes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47504 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22 22:17:59 +00:00
Devang Patel
197be3de7f Read and write getresult.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47471 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22 02:49:49 +00:00
Dale Johannesen
8d1433c6fc Support alignment within ParamAttrs in the I/O handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47401 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 21:15:19 +00:00
Dale Johannesen
0d51e7ec0d Expand ParameterAttributes to 32 bits (in preparation
for adding alignment info, not there yet).  Clean up
interfaces to reference ParameterAttributes consistently.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47342 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-19 21:38:47 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Christopher Lamb
d49e18d29f Implement part of review feedback for address spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44933 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 08:44:39 +00:00
Duncan Sands
216b74c20c Fix compilation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44864 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 12:20:47 +00:00
Christopher Lamb
fe63fb986d Implement address space attribute for LLVM pointer types. Address spaces are
regions of memory that have a target specific relationship, as described in the 
Embedded C Technical Report. 

This also implements the 2007-12-11-AddressSpaces test, 
which demonstrates how address space attributes can be used in LLVM IR.

In addition, this patch changes the bitcode signature for stores (in a backwards 
compatible manner), such that the pointer type, rather than the pointee type, is 
encoded. This permits type information in the pointer (e.g. address space) to be 
preserved for stores.

LangRef updates are forthcoming.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44858 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 08:59:05 +00:00
Gordon Henriksen
80a75bfae9 Adding a collector name attribute to Function in the IR. These
methods are new to Function:

  bool hasCollector() const;
  const std::string &getCollector() const;
  void setCollector(const std::string &);
  void clearCollector();

The assembly representation is as such:

  define void @f() gc "shadow-stack" { ...

The implementation uses an on-the-side table to map Functions to 
collector names, such that there is no overhead. A StringPool is 
further used to unique collector names, which are extremely
likely to be unique per process.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44769 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 03:18:06 +00:00
Chris Lattner
a1afde77fa Unbreak backwards compatibility with bytecode format. Regression
introduced by this patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071126/055824.html



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44364 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 17:48:06 +00:00
Duncan Sands
dc024674ff Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44359 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 13:23:08 +00:00
Dale Johannesen
a471c2ecda Next PPC long double bits. First cut at constants.
No compile-time support for constant operations yet,
just format transformations.  Make readers and
writers work.  Split constants into 2 doubles in
Legalize.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42865 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11 18:07:22 +00:00
Dale Johannesen
693717fbe6 Make temporaries explicit to avoid premature
destruction of compiler-created ones.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42383 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-26 23:20:33 +00:00
Dale Johannesen
9d5f456077 Revise previous patch per review comments.
Next round of x87 long double stuff.
Getting close now, basically works.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41875 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12 03:30:33 +00:00
Dale Johannesen
3f6eb7419d Add APInt interfaces to APFloat (allows directly
access to bits).  Use them in place of float and
double interfaces where appropriate.
First bits of x86 long double constants handling 
(untested, probably does not work).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41858 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11 18:32:33 +00:00
Dale Johannesen
073d48da50 Revert previous change to IR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41769 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-07 18:31:50 +00:00
Dale Johannesen
43421b3dd7 Next round of APFloat changes.
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double.  Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41747 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06 18:13:44 +00:00
Dale Johannesen
ebbc95da49 Patch 10 for long double. Doing constants right needs expanding ConstantFP
to handle values bigger than double.  If we assume host==target and host
long double works correctly, this is not too bad, but we don't want to
have that limitation longterm.  I could implement accepting double
constants as long double or something like that, which would lead to
incorrect codegen with no errors; the more I think about that the worse
it seems.  Rather than do such a hack that would be backed out later,
I'm settling for giving reasonable error messages, for now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40974 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-09 22:51:36 +00:00
Dale Johannesen
320fc8a39e Long double, part 1 of N. Support in IR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40774 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-03 01:03:46 +00:00
Chris Lattner
3a08abfd34 remove a dead case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37916 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-05 17:18:32 +00:00
Chris Lattner
384003d2c0 allow partially materialized modules to be written out, which just strips out
the functions which haven't been read.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36999 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-11 23:51:59 +00:00
Chris Lattner
a9bb713130 Make a preemptive bitcode format change to support PR1146. This lets us do
pr1146 in llvm 2.1 without ugly code to emulate old behavior.  This should
be merged into the 2.0 release branch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36928 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-08 05:38:01 +00:00
Chris Lattner
4eab2e57f9 Flush the file after writing bitcode so that clients who don't close their
ofstreams will be ok.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36878 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 19:19:23 +00:00
Jeff Cohen
332376bc60 Unbreak VC++.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36831 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 03:12:47 +00:00
Chris Lattner
f9f2e83170 add abbrevs for binops and casts. This shrinks a testcase from 725132->682500
bytes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36829 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 02:38:57 +00:00
Chris Lattner
2bce93a2ae implement reading/writing of inlineasm objects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36827 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 01:58:20 +00:00
Chris Lattner
94687acd21 add some abbrevs for ret and unreachable, shrinking kc++ from 2717360->2705388
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36823 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 01:28:01 +00:00
Chris Lattner
cb3d91b05b add a denser encoding for null terminated strings, add a 6-bit abbrev as
well.  This shrinks kc++ from 2724088 to 2717360 bytes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36821 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 00:53:07 +00:00
Chris Lattner
817f08a0e5 add an abbreviation for the string constants opzn, shrinking the constnats
block from:

  Block ID #11 (CONSTANTS_BLOCK):
      Num Instances: 1722
         Total Size: 3.85976e+06b/482470B/120617W
          % of file: 16.7609
       Average Size: 2241.44b/280.18B/70.045W
  Tot/Avg SubBlocks: 0/0
    Tot/Avg Abbrevs: 1/0.00058072
    Tot/Avg Records: 26423/15.3444
      % Abbrev Recs: 69.1746

to:

 Block ID #11 (CONSTANTS_BLOCK):
      Num Instances: 1724
         Total Size: 2.62406e+06b/328008B/82001.9W
          % of file: 12.041
       Average Size: 1522.08b/190.26B/47.5649W
  Tot/Avg SubBlocks: 0/0
    Tot/Avg Abbrevs: 2/0.00116009
    Tot/Avg Records: 26280/15.2436
      % Abbrev Recs: 68.9992

This shrinks kc++ from 2815788 to 2724088 bytes, which means the bitcode
file is now smaller than the bytecode file.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36820 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 00:42:18 +00:00
Chris Lattner
ff7fc5dabe implement the 'string constant' optimization. This shrinks kc.bit from
2878544 to 2815788


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36818 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 00:35:24 +00:00
Chris Lattner
abfbf85004 further reduce the redundancy of types in the instruction encoding. This
shrinks function bodies in kc++ from 891913B to 884073B


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36817 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 00:21:25 +00:00
Chris Lattner
7337ab9e92 stop encoding type/value pairs when the type is implied by the value.
This shrinks the function block of kc++ from 1055K to 906K


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36816 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 00:00:00 +00:00
Chris Lattner
440168b00e add an abbrev for loads. This shrinks the function block about 50K, from:
Block ID #12 (FUNCTION_BLOCK):
      Num Instances: 2344
         Total Size: 8.8434e+06b/1.10542e+06B/276356W
          % of file: 35.6726
       Average Size: 3772.78b/471.598B/117.899W
  Tot/Avg SubBlocks: 4065/1.73422
    Tot/Avg Abbrevs: 0/0
    Tot/Avg Records: 128487/54.8153
      % Abbrev Recs: 0

to:

 Block ID #12 (FUNCTION_BLOCK):
      Num Instances: 2344
         Total Size: 8.44518e+06b/1.05565e+06B/263912W
          % of file: 34.6203
       Average Size: 3602.89b/450.362B/112.59W
  Tot/Avg SubBlocks: 4065/1.73422
    Tot/Avg Abbrevs: 0/0
    Tot/Avg Records: 128487/54.8153
      % Abbrev Recs: 22.2077


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36779 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 07:44:49 +00:00
Chris Lattner
a0f1ecc45e add abbrevs for the constants tables. This shrinks it from 4.49755e6 bits
to 3.85972e6 bits in kc++


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36778 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 07:36:14 +00:00
Chris Lattner
d092e0e18f Add abbreviations to the TYPE_BLOCK for pointers, functions, structs and arrays.
This shrinks the type_block of kc++ from 139901 bits to 99389 bits (0.55% to 0.39%
of the file), a 40% reduction.

This shrink the record from:

  Block ID #10 (TYPE_BLOCK):
      Num Instances: 1
         Total Size: 139901b/17487.6B/4371.91W
          % of file: 0.549306
        Num Abbrevs: 0
        Num Records: 3203
      % Abbrev Recs: 0

to:

  Block ID #10 (TYPE_BLOCK):
      Num Instances: 1
         Total Size: 99389b/12423.6B/3105.91W
          % of file: 0.390862
        Num Abbrevs: 4
        Num Records: 3203
      % Abbrev Recs: 99.6566

With a common histogram of:

       Code Histogram:
                1613    POINTER
                1100    FUNCTION
                255     STRUCT
                224     ARRAY
                5       INTEGER
                2       OPAQUE
                1       LABEL
                1       DOUBLE
                1       VOID
                1       NUMENTRY


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36776 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 06:30:12 +00:00
Chris Lattner
ff294a4e1e add a char6 abbrev for bbnames and value names. This represents each character
with 6 bits where possible.  This shrinks kc++ from 3324164B to 3183584B.  The
old VST was:

  Block ID #14 (VALUE_SYMTAB):
         Total Size: 1.26713e+07b/1.58391e+06B/395978W
       Average Size: 5403.53b/675.442B/168.86W
          % of file: 47.6484

The new one is:

  Block ID #14 (VALUE_SYMTAB):
         Total Size: 1.15467e+07b/1.44334e+06B/360834W
       Average Size: 4923.96b/615.495B/153.874W
          % of file: 45.3368

This is 11% smaller than the VST in the bytecode format.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36771 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 01:26:50 +00:00
Chris Lattner
7a263ea859 add an abbreviation for the type symtab, this shrinks the TST from 175197 bits
to 103165 bits:

Old:
  Block ID #13 (TYPE_SYMTAB):
      Num Instances: 1
         Total Size: 175197b/21899.6B/5474.91W
       Average Size: 175197b/21899.6B/5474.91W
          % of file: 0.657023
  Tot/Avg SubBlocks: 0/0
    Tot/Avg Abbrevs: 0/0
    Tot/Avg Records: 255/255
      % Abbrev Recs: 0

New:
  Block ID #13 (TYPE_SYMTAB):
      Num Instances: 1
         Total Size: 103165b/12895.6B/3223.91W
       Average Size: 103165b/12895.6B/3223.91W
          % of file: 0.387937
  Tot/Avg SubBlocks: 0/0
    Tot/Avg Abbrevs: 1/1
    Tot/Avg Records: 255/255
      % Abbrev Recs: 100


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36769 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 00:47:19 +00:00
Chris Lattner
e17b658c79 Implement support for globally associating abbrevs with block IDs, which
relieves us from having to emit the abbrevs into each instance of the block.
This shrinks kc.bit from 3368K to 3333K, but will be a more significant win
once instructions are abbreviated.

The VST went from:

  Block ID #14 (VALUE_SYMTAB):
      Num Instances: 2345
         Total Size: 1.29508e+07b/1.61885e+06B/404713W
       Average Size: 5522.73b/690.342B/172.585W
          % of file: 48.0645
  Tot/Avg SubBlocks: 0/0
    Tot/Avg Abbrevs: 7035/3
    Tot/Avg Records: 120924/51.5667
      % Abbrev Recs: 100

to:

  Block ID #14 (VALUE_SYMTAB):
      Num Instances: 2345
         Total Size: 1.26713e+07b/1.58391e+06B/395978W
       Average Size: 5403.53b/675.442B/168.86W
          % of file: 47.5198
  Tot/Avg SubBlocks: 0/0
    Tot/Avg Abbrevs: 0/0
    Tot/Avg Records: 120924/51.5667
      % Abbrev Recs: 100

because we didn't emit the same 3 abbrevs 2345 times :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36767 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-05 00:17:00 +00:00
Chris Lattner
fd1ae95b8f allow the 8-bit abbrev to be used for either bb or other values
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36761 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 21:31:13 +00:00
Chris Lattner
2453f71ae1 shave another 150K off of kc++, by using a 7-bit encoding for BB names
where we can.  This shrinks kc++'s down to 3368K, with a VST record of:

  Block ID #14 (VALUE_SYMTAB):
      Num Instances: 2345
         Total Size: 1.29508e+07b/1.61885e+06B/404713W
       Average Size: 5522.73b/690.342B/172.585W
          % of file: 48.0645
  Tot/Avg SubBlocks: 0/0
    Tot/Avg Abbrevs: 7035/3
    Tot/Avg Records: 120924/51.5667
      % Abbrev Recs: 100

Isn't it nice to be able to optimizer bc size without touching the reader? :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36759 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 20:58:35 +00:00
Chris Lattner
5969830361 where possible, encode symtab names with 7 bits per char instead of 8. This
shaves 110K off kc++ to 3514K.  Before:

  Block ID #14 (VALUE_SYMTAB):
      Num Instances: 2345
         Total Size: 1.50425e+07b/1.88031e+06B/470077W
       Average Size: 6414.69b/801.837B/200.459W
          % of file: 51.8057
  Tot/Avg SubBlocks: 0/0
    Tot/Avg Abbrevs: 2345/1
    Tot/Avg Records: 120924/51.5667
      % Abbrev Recs: 85.1791

after:

  Block ID #14 (VALUE_SYMTAB):
      Num Instances: 2345
         Total Size: 1.41229e+07b/1.76536e+06B/441341W
       Average Size: 6022.56b/752.82B/188.205W
          % of file: 50.2295
  Tot/Avg SubBlocks: 0/0
    Tot/Avg Abbrevs: 4690/2
    Tot/Avg Records: 120924/51.5667
      % Abbrev Recs: 85.1791


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36758 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 20:52:02 +00:00
Chris Lattner
2e7899dae9 Encode all value symtab strings as arrays of 8-bit fixed width integers,
instead of the default inefficient encoding.  This shrinks kc++ from 4134K
to 3629K


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36755 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 20:34:50 +00:00
Chris Lattner
15e6d170e8 eliminate internal length fields from record. Records already know their
total length


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36752 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 19:11:41 +00:00
Chris Lattner
07faafc8f9 stub out creation of BLOCKINFO_BLOCK
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36749 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 18:26:27 +00:00
Chris Lattner
1d1f9ade54 fix encoding of invoke instructions. kc++ now round trips
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36737 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 03:52:24 +00:00
Chris Lattner
9113e73ecf encode and read param attrs along with function type. WE can now roundtrip Olden/voronoi loslessly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36735 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 03:41:34 +00:00
Chris Lattner
f6f9cd1bf2 fix a bug encoding param attrs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36730 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 03:14:09 +00:00
Chris Lattner
f0a6531997 add writer support for param attrs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36724 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 02:59:04 +00:00
Chris Lattner
62bbeea8ea trivial scaffolding for param attrs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36720 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 00:44:52 +00:00
Chris Lattner
76520191ab Encoding calling conv info in call/invoke instrs, tree add now round trips completely
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36707 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 22:34:03 +00:00
Chris Lattner
38b12ce186 don't bother encoding # varargs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36705 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 22:19:34 +00:00
Chris Lattner
e825ed5a03 fix encoding of BB names in the symtab
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36704 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 22:18:21 +00:00
Chris Lattner
f4c8e52433 add reader logic for terminator instrs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36642 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 05:46:45 +00:00
Chris Lattner
f639875cd7 use the correct code for binop instrs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36639 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 04:26:36 +00:00
Chris Lattner
60ce9b5a01 fix build with non-buggy compilers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36621 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-01 07:03:37 +00:00
Chris Lattner
be1f993f2d write the symbol table for function bodies
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36610 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-01 02:14:57 +00:00
Chris Lattner
d309c75b7d encode all of the instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36609 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-01 02:13:26 +00:00
Anton Korobeynikov
9cd3ccf506 Implement visibility checking during linking. Also implement protected
visibility support for bitcode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36577 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-29 20:56:48 +00:00
Chris Lattner
01b27458a1 Fix this to use the right block ID
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36550 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-29 05:49:09 +00:00
Chris Lattner
1a9df8eee0 moved Writer.cpp -> BitcodeWriter.cpp to make it more unique in the tree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36549 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-29 05:31:57 +00:00
Chris Lattner
b9d0c2a6a0 start code for writing out instructions. Separate BB#s from normal value
#'s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36472 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-26 05:53:54 +00:00
Chris Lattner
8d35c79f27 add support for incorporating and purging functions to the value enumerator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36465 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-26 03:50:57 +00:00
Chris Lattner
51d5f29c3f improve a comment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36464 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-26 03:32:43 +00:00
Chris Lattner
198f34ac35 move some code around, fix a bug in the reader reading globalinits (which
I just introduced), stub out function reading, purge aggregate values from
the value table before reading functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36463 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-26 03:27:58 +00:00
Chris Lattner
07d98b4afb add bitcode alias support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36461 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-26 02:46:40 +00:00
Chris Lattner
f581c3b81e implement reading and writing of constant exprs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36394 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-24 07:07:11 +00:00
Chris Lattner
631a8ed3ff fix off-by-one computing size for section abbrevs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36388 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-24 03:29:47 +00:00
Chris Lattner
2edd22b959 Emit module-level constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36384 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-24 00:16:04 +00:00
Chris Lattner
b992be14bb write out the symtab for globals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36374 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-23 20:35:01 +00:00
Chris Lattner
d127c1b5f3 implement reading of abbrevs, and writing of abbreviated global varrs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36367 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-23 18:58:34 +00:00
Chris Lattner
36d5e7d31b first part of implementation of abbrevs. The writer isn't fully there yet and the
reader doesn't handle them at all yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36363 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-23 16:04:05 +00:00
Chris Lattner
47f96bf246 promote LLVMBitCodes to be a public header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36358 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-23 01:01:37 +00:00
Chris Lattner
fd57cecd2c Initial support for writing bitcode files. This currently only writes types,
the type symtab, and global/function protos, and is missing the important
size optimization, but it is a place to start.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36331 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-22 06:24:45 +00:00