Commit Graph

1008 Commits

Author SHA1 Message Date
Dan Gohman
f316579901 Use MemoryBuffer::getBufferIdentifier() in the AsmPrinter instead
of requiring a name be passed in. This makes it use "<stdin>"
instead of "-" and makes it more consistent with the Bitcode reader.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 22:20:35 +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
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
Dan Gohman
2ec5fe524c Refactor common code from ParseAssemblyString and ParseAssemblyFile,
to expose a low-level interface for parsing from an existing MemoryBuffer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80803 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 17:18:19 +00:00
Nuno Lopes
2b4f28e270 plug another leak in LLParser::PerFunctionState::SetInstName()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80792 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 15:02:57 +00:00
Nuno Lopes
531552aaa2 plug memory leak in LLParser::PerFunctionState::SetInstName() by deleting a value after replacing it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80790 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-02 14:22:03 +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
Dan Gohman
419055453c Minor logic simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80453 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-29 23:37:49 +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
Dale Johannesen
de86d473fc Add an 'inline hint' attribute to represent source
code hints that it would be a good idea to inline
a function ("inline" keyword).  No functional change
yet; FEs do not emit this and inliner does not use it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80063 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-26 01:08:21 +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
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
Duncan Sands
bcef7df6ec Fix the build with gcc-4.4 on linux: header needed
for EOF.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79908 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-24 10:34:41 +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
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
Daniel Dunbar
689ad6ef3f Convert APint::{fromString,APInt,getBitsNeeded} to use StringRef.
- Patch by Erick Tryzelaar, with some edits (and a bug fix) from me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-13 02:33:34 +00:00
Dan Gohman
3845e50ede Extend the AsmWriter to print unnamed numbered types as "%0 = type ..."
and unnamed numbered global variables as "@0 = global ...". Extend the
AsmParser to recognize these forms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 23:32:33 +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
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
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
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
Owen Anderson
5defacc6e6 Move getTrue() and getFalse() to 2.5-like APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77685 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-31 17:39:07 +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
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
Devang Patel
5316bf0252 There is no need to keep name ref in NamedMDNode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77511 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 21:58:56 +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
Dan Gohman
dcb40a3c1c Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77459 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 15:58:36 +00:00
Devang Patel
eff2ab61b5 Parse named metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77410 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-29 00:34: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
Dan Gohman
59858cf792 Change the assembly syntax for nsw, nuw, and exact, putting them
after their associated opcodes rather than before. This makes them
a little easier to read.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77194 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 16:11:46 +00:00
Benjamin Kramer
30d3b911c9 Test commit: fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77187 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-27 09:06:52 +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
Eli Friedman
4e9bac3769 Fix assert assembling zero-argument constant GEP.
There's still a strict-aliasing violation here, but I don't feel like 
dealing with that right now...



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77005 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 21:56:17 +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
db5e90078e Silence "uninitialized use" warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76836 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 01:36:16 +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
Eric Christopher
0aaf4e91c2 Fix error message for correct opcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76829 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-23 01:01:32 +00:00
Dan Gohman
08d012eba4 Rename the new unsigned and signed keywords to nuw and nsw,
which stand for no-unsigned-wrap and no-signed-wrap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76810 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 22:44:56 +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
Owen Anderson
b3056faa55 Rename getConstantInt{True|False} to get{True|False} at Chris' behest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76598 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-21 18:03:38 +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
Devang Patel
256be96457 Refactor metadata parsing routines into separate functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76455 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-20 19:00:08 +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
Anton Korobeynikov
c5ec8a78ea Add support for naked functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 18:07:26 +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
Devang Patel
d1095407ea Fix thinko.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75061 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 22:25:56 +00:00
Devang Patel
2214c94bb7 Drop "constant" from
!0 = constant metadata !{...}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75057 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 21:57:07 +00:00
Devang Patel
1c7eea60d3 Support MDNode forward reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75031 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-08 19:23:54 +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
ff6c91efcf Use LLVMContext in the LLLexer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-07 18:44:11 +00:00
Chris Lattner
eeb4a84ac8 switch the .ll parser to use SourceMgr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 23:08:13 +00:00
Chris Lattner
92bcb426c3 switch the .ll parser into SMDiagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74734 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 22:46:18 +00:00
Owen Anderson
12c99d8160 Use LLVMContext for generating MDStrings too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74710 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 17:28:30 +00:00
Owen Anderson
e951bdff0d Use LLVMContext to generate metadata constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74708 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 17:20:28 +00:00
Owen Anderson
b43eae745e Use LLVMContext for generating UndefValue constants too!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74703 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-02 17:04:01 +00:00
Owen Anderson
fba933c823 Try again at converting the LLParser to use LLVMContext, without massive breakage this time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74671 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 23:57:11 +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
Bill Wendling
aa3943bf63 --- Reverse-merging (from foreign repository) r74648 into '.':
U    include/llvm/LLVMContext.h
U    lib/VMCore/LLVMContext.cpp
U    lib/AsmParser/LLParser.cpp
U    lib/AsmParser/LLParser.h

Temporarily reverting r74648. It was causing massive failures in release mode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74653 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 22:33:26 +00:00
Owen Anderson
c137ea6cf5 Convert LLParser to use LLVMContext for creating constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74648 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 21:57: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
Devang Patel
923078c65d Support stand alone metadata syntax.
!0 = constant metadata !{i32 21, i32 22}
@llvm.blah = constant metadata !{i32 1000, i16 200, metadata !0}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74630 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 19:21:12 +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
0fd38069cb improve the APIs for creating struct and function types with no arguments/elements
to not have to create a temporary vector (in the API at least).  Patch by Jay Foad!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-01 04:13:31 +00:00
Anton Korobeynikov
385f5a99ec Address review comments: add 3 ARM calling conventions.
Dispatch C calling conv. to one of these conventions based on
target triple and subtarget features.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73530 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 18:50:49 +00:00
Dan Gohman
24b108bc8c Fix a typo in a diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73429 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 21:52:11 +00:00
Dan Gohman
a119de86a0 Fix old-style type names in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 23:30:43 +00:00
Nick Lewycky
a5f54a06b0 Create FunctionType::isValidArgumentType to go along with isValidReturnType.
Also create isValidElementType for ArrayType, PointerType, StructType and
VectorType.

Make LLParser use them. This closes up some holes like an assertion failure on:

  %x = type {label}

but largely doesn't change any semantics. The only thing we accept now which
we didn't before is vectors of opaque type such as "<4 x opaque>". The opaque
can be resolved to an int or float when linking.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-07 07:26:46 +00:00
Nick Lewycky
00907c7d81 Refuse metadata* type for function arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73010 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-07 01:45:11 +00:00
Devang Patel
578efa920a Add new function attribute - noimplicitfloat
Update code generator to use this attribute and remove NoImplicitFloat target option.
Update llc to set this attribute when -no-implicit-float command line option is used.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 21:57:13 +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
Devang Patel
d18e31ae17 Add new function attribute - noredzone.
Update code generator to use this attribute and remove DisableRedZone target option.
Update llc to set this attribute when -disable-red-zone command line option is used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72894 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 22:05:33 +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
Jay Foad
e3e51c0038 Use v.data() instead of &v[0] when SmallVector v might be empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72210 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 09:52:38 +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
040f758e3a testcase and asmparser fix for PR4066
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70080 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 21:26:00 +00:00
Nick Lewycky
55f64dbb39 Fix warning in .ll parser, detect and reject available_externally on function
declarations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68944 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 07:02: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
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
ad9ad7c827 Fix a bug in our autoupgrade support: in an argument list to a function
call, we should treat "i64 zext" as the start of a constant expr, but
"i64 0 zext" as an argument with an obsolete attribute on it (this form
is already tested by test/Assembler/2007-07-30-AutoUpgradeZextSext.ll).

Make the autoupgrade logic more discerning to avoid treating "i64 zext"
as an old-style attribute, causing us to reject a valid constant expr.
This fixes PR3876.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67682 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 06:36:36 +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
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
Chris Lattner
a9a9e07d1c Fix two classes of bugs. First:
validate an invariant so that the asmparser rejects a bad construct
instead of the verifier.  Before:

llvm-as: assembly parsed, but does not verify as correct!
Invalid struct return type!
i64 (%struct.Type*, %struct.Type*)* @foo

after:

llvm-as: t.ll:5:8: functions with 'sret' argument must return void
define i64 @foo(%struct.Type* noalias nocapture sret %agg.result, %struct.Type* nocapture byval %t) nounwind {
       ^


Second, check that void is only used where allowed (in function return types) not in
arbitrary places, fixing PR3747 - Crash in llvm-as with void field in struct.  We
now reject that example with:

$ llvm-as t.ll
llvm-as: t.ll:1:12: struct element can not have void type
%x = type {void}
           ^





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66394 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 04:49:14 +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
Chris Lattner
f6f0bdfec3 Fix a pretty awesome bug that only happened in a strange case with anonymous
types.  This was reading the uint for the keyword after the token was advanced.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65743 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-01 00:53:13 +00:00
Chris Lattner
452e2627dc reject 0 element vectors with:
@a = internal constant void bitcast(<0 x i8> <> to void)
                                     ^

Fixes PR3685


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65698 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 18:12:41 +00:00
Chris Lattner
f570e621ab add proper asmwriter and asmparser support for anonymous functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 21:48:13 +00:00
Duncan Sands
35b5107951 Pacify gcc-4.3 (thinks IsConstant may be used
uninitialized).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64220 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-10 16:24:55 +00:00
Dan Gohman
b9070d3f63 Use slightly more correct grammar in error messages.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64148 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-09 17:41:21 +00:00
Chris Lattner
4a2f112a5c fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64091 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-08 20:00:15 +00:00
Chris Lattner
b4bd16fc5e reject void pointers with a nice error:
llvm-as: t.ll:2:15: pointers to void are invalid, use i8* instead
%X = type void*
              ^

instead of asserting and dying.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64089 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-08 19:56:22 +00:00
Dale Johannesen
49de98214b Reapply 63765. Patches for clang and llvm-gcc to follow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63812 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 01:49:45 +00:00
Dale Johannesen
4d452de150 Reverting 63765. This broke the build of both clang
and llvm-gcc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 22:47:25 +00:00
Nate Begeman
d24479730a New feature: add support for target intrinsics being defined in the
target directories themselves.  This also means that VMCore no longer
needs to know about every target's list of intrinsics.  Future work
will include converting the PowerPC target to this interface as an
example implementation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63765 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 19:47:21 +00:00
Chris Lattner
91dad87ddc Fix PR3372
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 07:24:28 +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
Dan Gohman
24c047fa6b 61949 accidentally introduced an escaped newline. Fix this by making
the comment a little more verbose.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 23:51:48 +00:00
Dan Gohman
069f12a590 Fix the comment for lltok::backslash.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61949 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 22:18:13 +00:00
Dan Gohman
5d13665c09 Fix the path to llvm/Assembly/Parser.h in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61948 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 22:17:05 +00:00
Chris Lattner
1e407c338f one more crash from PR3281, we now diagnose:
llvm-as: t.ll:2:39: function may not return opaque type
  %"bwmoyl" = tail call coldcc opaque @g()
                                      ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61933 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-08 19:05:36 +00:00
Chris Lattner
0d8484f2ed fix wordo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61728 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:56:52 +00:00
Steve Naroff
b0adcdb7e5 Remove redundant ValID::ValID:: scoping (doesn't compile on Windows).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61727 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:48:47 +00:00
Chris Lattner
dfd19ddcfa Reject PR3281:accepted03.ll with:
llvm-as: accepted03.ll:1:35: invalid unresolved type up reference
declare void @r({ \7, opaque, \10 } %su)
                                  ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61725 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:34:07 +00:00
Chris Lattner
830703b1bd reject PR3281:crash11.ll with:
llvm-as: crash11.ll:2:27: function may not return return opaque type
  "xw" = tail call opaque @608(label %31)
                          ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:27:50 +00:00
Chris Lattner
959873d2da reject PR3281:crash10.ll with:
llvm-as: crash10.ll:3:35: floating point constant does not have type 'ppc_fp128'
  "dumy" = fcmp ult ppc_fp128 "j",9209.4
                                  ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61721 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:24:23 +00:00
Chris Lattner
c38daba25b reject PR3281:crash09.ll with this diagnostic:
llvm-as: crash09.ll:3:1: self referential type is invalid
type %0
^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61720 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:19:46 +00:00
Chris Lattner
0b61635063 allow opaque undefs. This resolves PR3282 and fixes
test/Assembler/2005-05-05-OpaqueUndefValues.ll



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61719 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 18:12:21 +00:00
Dan Gohman
d68a07650c Tidy up #includes, deleting a bunch of unnecessary #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61715 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 17:59:02 +00:00
Chris Lattner
d0f9c730d4 produce the same diagnostics for vicmp constant exprs as vicmp instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61685 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 08:26:05 +00:00
Chris Lattner
e914b59c00 Fix PR3281:crash08.ll with this diagnostic:
llvm-as: crash08.ll:3:15: invalid operand type for instruction
  "qp" = sdiv fp128 0x1, %30
              ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61684 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 08:24:46 +00:00
Chris Lattner
0088a5cc72 reject PR3281:crash07.ll with:
llvm-as: crash07.ll:2:32: va_arg requires operand with first class type
  %y = va_arg [52 x <{}>] %43, double (...) sspreq
                               ^


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61683 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 08:18:44 +00:00
Chris Lattner
e67c1aa398 reject undef/zero labels. This fixes PR3281:crash0[56].ll with these
diagnostics:
llvm-as: crash05.ll:1:14: invalid type for null constant
global label zeroinitializer addrspace (75), section "c"
             ^
llvm-as: crash06.ll:2:14: invalid type for null constant
  udiv label zeroinitializer, @0
             ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61681 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 08:13:38 +00:00
Chris Lattner
4a1c4a414c add checking intentionally elided for vfcmp/vicmp since they should really
just be removed.  However, this fixes PR3281:crash04.ll, diagnosing it with:

lvm-as: crash04.ll:2:13: vfcmp requires vector floating point operands
  vfcmp uno double* undef, undef
            ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61680 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 08:09:48 +00:00
Chris Lattner
d77d04c323 diagnose PR3281:crash02.ll with:
llvm-as: crash02.ll:1:62: invalid function return type
declare { <{ <{}>, void ([1898 x { void ()* }], opaque, ...) (), fp128 * }>, opaque } @t ()
                                                             ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61679 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 08:04:33 +00:00
Chris Lattner
99bb315f32 reject PR3281:crash01.ll with:
llvm-as: crash01.ll:1:9: invalid function return type
declare opaque @t()
        ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61678 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 08:00:30 +00:00
Chris Lattner
081b505f77 fix PR3281:accepted0[02].ll: represent empty arrays distinctly, and
diagnose attempts to initialize non-empty arrays with them.  This 
produces:
llvm-as: accepted02.ll:1:28: invalid empty array initializer
@"o" = global [5 x double] []
                           ^
llvm-as: accepted00.ll:1:32: invalid empty array initializer
@"za" = thread_local global {} []
                               ^
[


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61676 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 07:52:51 +00:00
Chris Lattner
3fbb3ab14d PR3281:crash00.ll: produce this diagnostic instead of crashing:
@t = global i8 0, align 3
                        ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-05 07:46:05 +00:00
Chris Lattner
ad7d1e2085 Refactor some parser interfaces to fix PR3278 and a FIXME:
ParseAssemblyString with a specified module would not parse
into the module, it would create and return a new one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61635 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-04 20:44:11 +00:00
Misha Brukman
5679d18c54 Alphabetized #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61595 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 22:49:28 +00:00
Misha Brukman
9ea4034e00 Down with trailing whitespace!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61594 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 22:46:48 +00:00
Daniel Dunbar
c120526e20 Remove comma at end of enumerator list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 16:32:55 +00:00
Daniel Dunbar
0526de6b3e Remove bison specific Makefile bits for AsmParser.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 16:29:09 +00:00
Chris Lattner
6d6b3cc89b Fix a really horrible typo, which caused undefined behavior.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61566 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 08:49:06 +00:00
Chris Lattner
3ed88efb03 minor cleanups and comment improvements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61564 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 08:05:26 +00:00
Chris Lattner
a896176973 add a #include to hopefully get the x86-64-linux buildbot building.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61563 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 07:18:46 +00:00
Chris Lattner
db7ba94c88 update the cmakefile. This is a "best guess", I haven't tested this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61561 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 07:14:23 +00:00
Chris Lattner
df98617b23 Reimplement the old and horrible bison parser for .ll files with a nice
and clean recursive descent parser.

This change has a couple of ramifications:
1. The parser code is about 400 lines shorter (in what we maintain, not
   including what is autogenerated).
2. The code should be significantly faster than the old code because we 
   don't have to work around bison's poor handling of datatypes with 
   ctors/dtors.  This also makes the code much more resistant to memory 
   leaks.
3. We now get caret diagnostics from the .ll parser, woo.
4. The actual diagnostics emited from the parser are completely different
   so a bunch of testcases had to be updated.
5. I now disallow "%ty = type opaque %ty = type i32".  There was no good
   reason to support this, it was just an accident of the old 
   implementation.  I have no reason to think that anyone is actually using
   this.
6. The syntax for sticking a global variable has changed to make it 
   unambiguous.  I don't think anyone is depending on this since only clang
   supports this and it is not solid yet, so I'm not worried about anything
   breaking.
7. This gets rid of the last use of bison, and along with it the .cvs files.
   I'll prune this from the makefiles as a subsequent commit.

There are a few minor cleanups that can be done after this commit (suggestions
welcome!) but this passes dejagnu testing and is ready for its time in the
limelight.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61558 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 07:01:27 +00:00
Nick Lewycky
d802be39d7 Update the .cvs files for nocapture.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61241 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-19 09:41:54 +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
29bc4f0dcc Forgot to revert r61031 when I reverted r61019, r61030, and r61040.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61150 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-17 20:59:57 +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
fd7eb7252f Update generated files after nocapture syntax change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61031 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-15 07:31:07 +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
Nick Lewycky
02ff308aa1 Extend the 'noalias' attribute to function return values. This is intended to
indicate functions that allocate, such as operator new, or list::insert. The
actual definition is slightly less strict (for now).

No changes to the bitcode reader/writer, asm printer or verifier were needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59934 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 03:41:24 +00:00
Bill Wendling
6ff4bfee3a Regenerated
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59204 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 01:03:00 +00:00
Bill Wendling
e9e6bdf27f Implement stack protectors as function attributes: "ssp" and "sspreq".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59202 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 01:02:14 +00:00
Nuno Lopes
aa386d0881 regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58697 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 14:43:20 +00:00
Nuno Lopes
b0c53da1e1 fix leakage of APFloats in getExistingVal()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58696 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 14:42:19 +00:00
Nuno Lopes
1983033820 regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 14:28:33 +00:00
Nuno Lopes
91c2620862 fix leakage of APSInt in getVal()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58693 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 14:26:58 +00:00
Oscar Fuentes
ddbbb4fe89 CMake: Cross-platform support for using pre-generated llvmAsmParser.cpp and llvmAsmParser.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58130 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-25 03:19:08 +00:00
Cedric Venet
389b715e0f Modify the cmake build system so that if it doesn't find bison, it will use the pregenerated file in from the svn (.cvs). Work only for windows for the moment. Tested on Vista64 with MSVC2008express.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58090 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 11:24:33 +00:00
Nuno Lopes
8a5f34776e regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57577 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 12:05:02 +00:00
Nuno Lopes
f2bd650fdf fix memleak in GetForwardRefForGlobal()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57576 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 12:04:36 +00:00
Nuno Lopes
f05ff66a22 regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57575 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 11:20:21 +00:00
Nuno Lopes
ee87b3b6d9 fix memleak in getTypeVal()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57574 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 11:19:34 +00:00
Nuno Lopes
6ec8a25b27 regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57573 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 11:11:12 +00:00
Nuno Lopes
0ecaf52796 fix memleak in ResolveTypeTo()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 11:10:21 +00:00
Chris Lattner
740e709d0d regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 06:16:57 +00:00
Chris Lattner
c7e3069bfa Fix the .ll grammar rules to allow any type before an 'i32', not just an
integer type.  Invalid things like 'float 42' are now rejected by the
semantic analysis in the productions not the parser.  This fixes PR2733.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 06:16:45 +00:00
Chris Lattner
f9078f99d9 regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57559 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 06:03:48 +00:00
Chris Lattner
22b92e3b86 Eliminate the "IntType ::= INTTYPE" production, just use
INTTYPE everywhere.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57558 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 06:03:37 +00:00
Dale Johannesen
236bbd4146 Generated files for previous checkin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57331 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-09 23:01:34 +00:00
Dale Johannesen
23a98551ab Add a "loses information" return value to APFloat::convert
and APFloat::convertToInteger.  Restore return value to
IEEE754.  Adjust all users accordingly.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57329 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-09 23:00:39 +00:00
Chris Lattner
9fc4da40ef regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57290 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 06:44:45 +00:00
Chris Lattner
cd16843499 Add missing semicolumns in parser rules, those missing semicolumns
are required to compile with the latest Bison.

Patch by Samuel Tardieu!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 06:44:36 +00:00
Nuno Lopes
8a88a37b16 regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57114 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 16:49:34 +00:00
Nuno Lopes
d0ad67788d clean ArgTypeListI production: free the PATypeHolder
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57113 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 16:49:03 +00:00
Nuno Lopes
191dfb96de regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57009 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:52:39 +00:00
Nuno Lopes
aa1aee3e95 fix more memleaks in ResolveTypeTo() and ParseGlobalVariable()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57008 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:51:46 +00:00
Nuno Lopes
9e9631dae9 regenerate with bison 2.3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57007 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:45:58 +00:00
Nuno Lopes
06a62886fb fix memleak in FunctionHeaderH
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57005 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 15:44:21 +00:00
Devang Patel
652203f3f3 Support inreg, zext and sext as return value attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56801 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 20:49:50 +00:00
Devang Patel
2c9c3e7368 Implement function notes as function attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 23:51:19 +00:00
Dale Johannesen
e7261863c5 Generated files for warning fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56715 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 23:46:20 +00:00
Dale Johannesen
4598a4ece8 Fix a compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56714 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 23:45:53 +00:00
Devang Patel
19c874638d Now Attributes are divided in three groups
- return attributes - inreg, zext and sext
- parameter attributes
- function attributes - nounwind, readonly, readnone, noreturn

Return attributes use 0 as the index.
Function attributes use ~0U as the index.

This patch requires corresponding changes in llvm-gcc and clang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56704 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 22:53:05 +00:00
Dale Johannesen
dfe8c84e1e Generated files for previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56679 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 19:32:34 +00:00
Dale Johannesen
86098bd6a6 Add "inreg" field to CallSDNode (doesn't increase
its size).  Adjust various lowering functions to
pass this info through from CallInst.  Use it to
implement sseregparm returns on X86.  Remove
X86_ssecall calling convention.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56677 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 19:31:26 +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
Eric Christopher
2a5196fe67 Fix fallout from revision r56535.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56545 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 04:55:49 +00:00
Devang Patel
20bcaff6a7 Put FN_NOTE_AlwaysInline and others in FnAttr namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56527 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 00:06:15 +00:00
Devang Patel
dd4924c564 Move FN_NOTE_AlwaysInline and other out of ParamAttrs namespace.
Do not check isDeclaration() in hasNote(). It is clients' responsibility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56524 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 23:52:03 +00:00
Devang Patel
2d2255d2d9 s/ParameterAttributes/Attributes/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56520 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 23:25:44 +00:00
Devang Patel
eaf42abab6 s/ParameterAttributes/Attributes/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 23:03:40 +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
Chris Lattner
ccef6b5d76 regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 21:18:31 +00:00
Chris Lattner
013766707b allow inreg on the result of a function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 21:18:08 +00:00
Oscar Fuentes
3d01fc7de8 Initial support for the CMake build system.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 01:08:49 +00:00
Dan Gohman
d8ee59b0ca Update generated files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55972 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 01:13:24 +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