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

1092 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
83ebc265b3 Reintroduce the InlineHint function attribute.
This time it's for real! I am going to hook this up in the frontends as well.

The inliner has some experimental heuristics for dealing with the inline hint.
When given a -respect-inlinehint option, functions marked with the inline
keyword are given a threshold just above the default for -O3.

We need some experiments to determine if that is the right thing to do.

llvm-svn: 95466
2010-02-06 01:16:28 +00:00
Jeffrey Yasskin
fb10587e50 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.

llvm-svn: 94686
2010-01-27 20:34:15 +00:00
Chris Lattner
5a57121631 make -fno-rtti the default unless a directory builds with REQUIRES_RTTI.
llvm-svn: 94378
2010-01-24 20:43:08 +00:00
Devang Patel
81f0fa06d7 Remove MetadataBase class because it is not adding significant value.
llvm-svn: 94243
2010-01-22 22:52:10 +00:00
Chris Lattner
276811b58a Stop building RTTI information for *most* llvm libraries. Notable
missing ones are libsupport, libsystem and libvmcore.  libvmcore is
currently blocked on bugpoint, which uses EH.  Once it stops using
EH, we can switch it off.

This #if 0's out 3 unit tests, because gtest requires RTTI information.
Suggestions welcome on how to fix this.

llvm-svn: 94164
2010-01-22 06:49:46 +00:00
Dan Gohman
f14fd7ec69 Make the parser include the lower level error message in its own error
message, to be more informative.

llvm-svn: 94072
2010-01-21 10:15:06 +00:00
Eric Christopher
3c5d9dc0e3 Remove the InlineHint attribute. There are no current or planned
users.

llvm-svn: 93558
2010-01-15 21:36:30 +00:00
Victor Hernandez
1ca202f9ea Consolidate ConvertGlobalValIDToValue, ConvertGlobalOrMetadataValIDToValue, and ConvertValIDToValue into a more powerful ConvertValIDToValue() that does all three's work
llvm-svn: 93197
2010-01-11 22:31:58 +00:00
Victor Hernandez
f4272b50d6 Compute isFunctionLocal in MDNode ctor or via argument in new function getWhenValsUnresolved().
Document PFS argument to ParseValID() and ConvertGlobalOrMetadataValIDToValue().

llvm-svn: 93108
2010-01-10 07:14:18 +00:00
Chris Lattner
8e44e4eddc fix PR5983, reject function bodies with no blocks per the grammar.
llvm-svn: 93067
2010-01-09 19:20:07 +00:00
Victor Hernandez
6551d8e0be When parsing function-local metadata, create a function-local MDNode
llvm-svn: 92838
2010-01-06 17:00:21 +00:00
Victor Hernandez
0e7561092b Re-add parsing of function-local metadata; this time with testcase.
llvm-svn: 92793
2010-01-05 22:22:14 +00:00
Devang Patel
311b5584e5 Allow null to be an element of NamedMDNode. e.g. !llvm.stuff = !{!0, !1, null}
llvm-svn: 92783
2010-01-05 21:47:32 +00:00
Benjamin Kramer
0ba7479f2c Move remaining stuff to the isInteger predicate.
llvm-svn: 92771
2010-01-05 21:05:54 +00:00
Devang Patel
ab66612f1b NamedMDNode is a collection MDNodes.
llvm-svn: 92761
2010-01-05 20:41:31 +00:00
Benjamin Kramer
e90a3c66c4 Avoid going through the LLVMContext for type equality where it's safe to dereference the type pointer.
llvm-svn: 92726
2010-01-05 13:12:22 +00:00
Chris Lattner
740252f319 remove some fixme's
llvm-svn: 92304
2009-12-30 06:00:36 +00:00
Chris Lattner
c3422a8190 now that instruction metadata is only parsed in one place, eliminate the
parser-global MDsOnInst vector and make ParseInstructionMetadata return
its result by-ref through an argument like the entire rest of the parser.

llvm-svn: 92302
2009-12-30 05:48:36 +00:00
Chris Lattner
fb3b372e6d reimplement ParseOptionalInfo as ParseOptionalCommaAlign, correctly
handle the comma case for metadata.

llvm-svn: 92301
2009-12-30 05:44:30 +00:00
Chris Lattner
f7b95d1fbc rename ParseOptionalCustomMetadata -> ParseInstructionMetadata,
and make it non-optional.  This fixes the bug where we'd accept
and ignore a spurious comma after some instructions.

llvm-svn: 92300
2009-12-30 05:31:19 +00:00
Chris Lattner
89aae53e72 convert 4 more instructions over.
llvm-svn: 92299
2009-12-30 05:27:33 +00:00
Chris Lattner
2aaf4a0490 add facilities to start factoring instruction metadata parsing
out of each opcode's handler.  Change ret over so far.

llvm-svn: 92298
2009-12-30 05:23:43 +00:00
Chris Lattner
03a91d987f reimplement insertvalue/extractvalue metadata handling to not blindly
accept invalid input.  Actually add a testcase.

llvm-svn: 92297
2009-12-30 05:14:00 +00:00
Chris Lattner
2ed8fad119 remove two bogus calls that accepted metadata in the middle of insert/extract value
*constant exprs*.

llvm-svn: 92296
2009-12-30 05:04:46 +00:00
Chris Lattner
63289c0f1e rename NamedOrCustomMD -> MetadataVar to follow conventions of all the rest of the code.
llvm-svn: 92295
2009-12-30 05:02:06 +00:00
Chris Lattner
2e5b6d96ac rename lltok::Metadata -> lltok::exclaim. We name tokens
after their syntactic form, not their semantic form.

llvm-svn: 92294
2009-12-30 04:56:59 +00:00
Chris Lattner
6664b8bd4d rename MetadataCache -> NumberedMetadata to follow the convention
used by other things.  Convert it to a vector since it is a dense 
numbering.

llvm-svn: 92293
2009-12-30 04:51:58 +00:00
Chris Lattner
bc506fa595 rewrite ParseMDNodeVector to follow the normal patter used in the .ll parser.
llvm-svn: 92292
2009-12-30 04:42:57 +00:00
Chris Lattner
9583b65fb9 rename ParseMDNode -> ParseMDNodeID, since it parses !42, not !{... } as you'd expect.
llvm-svn: 92291
2009-12-30 04:15:23 +00:00
Chris Lattner
c42b8ff24e fix parsing of mdstring values.
llvm-svn: 92290
2009-12-30 04:13:37 +00:00
Chris Lattner
41a3666fc1 remove the code added in r90497. It has several major issues and no tests.
llvm-svn: 92288
2009-12-30 02:20:07 +00:00
Chris Lattner
4f406c8c74 split t_Metadata into t_MDNode and t_MDString, eliminating some unsafe casting.
llvm-svn: 92287
2009-12-30 02:11:14 +00:00
Chris Lattner
c549263f8a factor code even more.
llvm-svn: 92280
2009-12-29 22:40:21 +00:00
Chris Lattner
4dd14b6835 simplify some code and unbreak the build by not consuming an
extra token.

llvm-svn: 92279
2009-12-29 22:35:39 +00:00
Benjamin Kramer
aa342be382 remove a really wrong parenthesis.
llvm-svn: 92277
2009-12-29 22:17:06 +00:00
Chris Lattner
66fa49bda4 clean up some really strange code.
llvm-svn: 92275
2009-12-29 22:01:50 +00:00
Chris Lattner
4803e84704 change ParseMDString and ParseMDNode to take arguments of the right type.
This exposed a raft of other problems, which I'll deal with in subsequent
patches.

llvm-svn: 92273
2009-12-29 21:53:55 +00:00
Chris Lattner
bfd6a6f096 switch to TrackingVH instead of WeakVH, since these can never
be RAUW'd and go to null.  This also gets us some sorely lacking
type safety.

llvm-svn: 92272
2009-12-29 21:43:58 +00:00
Chris Lattner
c6b925c592 Each instruction is allowed to have *multiple* different
metadata objects on them.  Though the entire compiler supports this,
the asmparser didn't.

llvm-svn: 92270
2009-12-29 21:25:40 +00:00
Chris Lattner
84e9de4a58 Final step in the metadata API restructuring: move the
getMDKindID/getMDKindNames methods to LLVMContext (and add
convenience methods to Module), eliminating MetadataContext.
Move the state that it maintains out to LLVMContext.

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

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

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

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

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

llvm-svn: 92225
2009-12-28 20:45:51 +00:00
Chris Lattner
6dd4686b48 Metadata.h doesn't need to include ValueHandle.h anymore.
llvm-svn: 92211
2009-12-28 08:20:46 +00:00
David Greene
82413e3a13 Change errs() to dbgs().
llvm-svn: 92088
2009-12-23 23:38:28 +00:00
Anton Korobeynikov
fadc276b81 Add MSP430 interrupt calling conv. No functionality change yet.
llvm-svn: 90738
2009-12-07 02:27:35 +00:00
Victor Hernandez
e2129e2966 Add ParseInlineMetadata() which can parses metadata that refers to an instruction. Extend ParseParameterList() to use this new function so that calls to llvm.dbg.declare can pass inline metadata
llvm-svn: 90497
2009-12-03 23:40:58 +00:00
Chris Lattner
15482aa384 Add a hack for PR5601, a crash on obsolete syntax that we plan to
remove in LLVM 3.0

llvm-svn: 89973
2009-11-26 22:48:23 +00:00
Daniel Dunbar
15c86ad832 Fix MSVC warning ( | with bool and unsigned int).
llvm-svn: 86417
2009-11-07 23:51:55 +00:00
Victor Hernandez
8736a8fca4 Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.
Here is the original commit message:

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

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

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

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

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

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

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

llvm-svn: 86311
2009-11-07 00:16:28 +00:00
Victor Hernandez
a5a12cd62e Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM
llvm-svn: 86213
2009-11-06 01:33:24 +00:00
Devang Patel
02635b0c7a Use WeakVH while storing metadata in containers.
This fixes PR5393.

llvm-svn: 86091
2009-11-05 01:13:02 +00:00
Victor Hernandez
21ec158c23 Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

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

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

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

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

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

llvm-svn: 86077
2009-11-05 00:03:03 +00:00
Devang Patel
5b0aaf3a1f Parse debug info attached with insertvalue and extractvalue instructions.
llvm-svn: 85921
2009-11-03 19:06:07 +00:00
Chris Lattner
874e573d61 typo
llvm-svn: 85812
2009-11-02 18:28:45 +00:00
Chris Lattner
2bbe57b2b8 Revert 85678/85680. The decision is to stay with the current form of
indirectbr, thus we don't need "blockaddr(@func, null)".  Eliminate it
for simplicity.

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

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

llvm-svn: 85678
2009-10-31 20:08:37 +00:00
Chris Lattner
e897be280c full asmparser support for blockaddress. We can now do:
$ llvm-as foo.ll -d -disable-output

which reads and prints the .ll file.  BC encoding is the
next project.  Testcase will go in once that works.

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

llvm-svn: 85274
2009-10-27 19:13:16 +00:00
Victor Hernandez
673c036bc7 Remove FreeInst.
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.

llvm-svn: 85176
2009-10-26 23:43:48 +00:00
Chris Lattner
e3508acbef fix PR5295 where the .ll parser didn't reject a function after a global
or global after a function with conflicting names.  Update some testcases
that were accidentally depending on this behavior.

llvm-svn: 85081
2009-10-25 23:22:50 +00:00
Victor Hernandez
e8998896f5 Auto-upgrade free instructions to calls to the builtin free function.
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.

llvm-svn: 84987
2009-10-24 04:23:03 +00:00
Victor Hernandez
48872a3306 Minor code cleanup.
llvm-svn: 84919
2009-10-23 00:59:10 +00:00
Dale Johannesen
2bb120a97f Rename msasm to alignstack per review.
llvm-svn: 84795
2009-10-21 23:28:00 +00:00
Victor Hernandez
0996619220 Make changes to rev 84292 as requested by Chris Lattner.
Most changes are cleanup, but there is 1 correctness fix:
I fixed InstCombine so that the icmp is removed only if the malloc call is removed (which requires explicit removal because the Worklist won't DCE any calls since they can have side-effects).

llvm-svn: 84772
2009-10-21 19:11:40 +00:00
Devang Patel
7edc7aa34d Cosmetic changes.
s/validName/isValidName/g
s/with an Instruction/to an Instruction/g
s/RegisterMDKind/registerMDKind/g

llvm-svn: 84689
2009-10-20 22:50:27 +00:00
Chris Lattner
5f094e66a8 clean up after metadata changes.
llvm-svn: 84463
2009-10-19 05:31:10 +00:00
Chris Lattner
0e1b04a0a7 remove some nonascii weird stuff
llvm-svn: 84410
2009-10-18 05:27:44 +00:00
Chris Lattner
236a43f2a2 add some fixme's
llvm-svn: 84408
2009-10-18 05:09:15 +00:00
Victor Hernandez
a25a2890fa Remove MallocInst from LLVM Instructions.
llvm-svn: 84299
2009-10-17 01:18:07 +00:00
Victor Hernandez
4d7283f82c Autoupgrade malloc insts to malloc calls.
Update testcases that rely on malloc insts being present.

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

llvm-svn: 84292
2009-10-17 00:00:19 +00:00
Devang Patel
a4ac3dd8bc Parse PHI instruction with attached metadata.
llvm-svn: 84264
2009-10-16 18:45:49 +00:00
Dale Johannesen
7db511a23e 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.

llvm-svn: 84020
2009-10-13 20:46:56 +00:00
Devang Patel
e911e90808 Parse GEP with attached custom metadata. This happens during libprofile_rt.bca build.
llvm-svn: 84002
2009-10-13 18:49:55 +00:00
Chris Lattner
a3cf123e86 strength reduce a ton of type equality tests to check the typeid (Through
the new predicates I added) instead of going through a context and doing a
pointer comparison.  Besides being cheaper, this allows a smart compiler
to turn the if sequence into a switch.

llvm-svn: 83297
2009-10-05 05:54:46 +00:00
Devang Patel
292bcd8ca1 Only one custom meadata of each kind can be attached with an instruction.
llvm-svn: 83105
2009-09-29 20:30:57 +00:00
Devang Patel
629ad89954 Parse custom metadata attached with an instruction.
llvm-svn: 83033
2009-09-29 00:01:14 +00:00
Devang Patel
1070b7a713 s/class Metadata/class MetadataContext/g
llvm-svn: 83019
2009-09-28 21:41:20 +00:00
Devang Patel
d836a7d651 Do not use global typedef for MDKindID.
llvm-svn: 83016
2009-09-28 21:14:55 +00:00
Victor Hernandez
f772c0b8b2 Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
llvm-svn: 82784
2009-09-25 18:11:52 +00:00
Victor Hernandez
ff8027ced6 Auto-upgrade malloc instructions to malloc calls.
Reviewed by Devang Patel.

llvm-svn: 82694
2009-09-24 17:47:49 +00:00
Daniel Dunbar
378331a13d Tabs -> spaces, and remove trailing whitespace.
llvm-svn: 82355
2009-09-20 02:20:51 +00:00
Devang Patel
d90471a00d Fix parsing of optional metadata for 'load', 'store' and 'alloc' instructions.
llvm-svn: 82175
2009-09-17 23:04:48 +00:00
Devang Patel
b3173a0dfb Parse debug info attached with an instruction.
llvm-svn: 82063
2009-09-16 18:18:06 +00:00
Dan Gohman
35984a8849 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.

llvm-svn: 81256
2009-09-08 22:20:35 +00:00
Dan Gohman
1147a7ba87 Reappy r80998, now that the GlobalOpt bug that it exposed on MiniSAT is fixed.
llvm-svn: 81172
2009-09-07 23:54:19 +00:00
Daniel Dunbar
452643b58c Revert "Include optional subclass flags, such as inbounds, nsw, etc., ...", this
breaks MiniSAT on x86_64.

llvm-svn: 81098
2009-09-06 00:11:24 +00:00
Dan Gohman
8b386a0b63 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.

llvm-svn: 80998
2009-09-04 12:08:11 +00:00
Dan Gohman
3f7a370991 Refactor common code from ParseAssemblyString and ParseAssemblyFile,
to expose a low-level interface for parsing from an existing MemoryBuffer.

llvm-svn: 80803
2009-09-02 17:18:19 +00:00
Nuno Lopes
fb0a20c04b plug another leak in LLParser::PerFunctionState::SetInstName()
llvm-svn: 80792
2009-09-02 15:02:57 +00:00
Nuno Lopes
f00826065d plug memory leak in LLParser::PerFunctionState::SetInstName() by deleting a value after replacing it
llvm-svn: 80790
2009-09-02 14:22:03 +00:00
Sandeep Patel
9c4e094e2a Retype from unsigned to CallingConv::ID accordingly. Approved by Bob Wilson.
llvm-svn: 80773
2009-09-02 08:44:58 +00:00
Dan Gohman
4fef698b89 Minor logic simplification.
llvm-svn: 80453
2009-08-29 23:37:49 +00:00
Devang Patel
fbaeda732e Reapply 79977.
Use MDNodes to encode debug info in llvm IR.

llvm-svn: 80406
2009-08-28 23:24:31 +00:00
Devang Patel
10c075a316 Revert 79977. It causes llvm-gcc bootstrap failures on some platforms.
llvm-svn: 80073
2009-08-26 05:01:18 +00:00
Dale Johannesen
f90fc6544b 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.

llvm-svn: 80063
2009-08-26 01:08:21 +00:00
Dan Gohman
4d20610e6e Eliminate the unused Context argument on one of the ICmpInst and FCmpInst
constructors.

llvm-svn: 80049
2009-08-25 23:17:54 +00:00
Devang Patel
7d42bfab6c 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!)

llvm-svn: 79977
2009-08-25 05:24:07 +00:00
Duncan Sands
a769cf864c Fix the build with gcc-4.4 on linux: header needed
for EOF.

llvm-svn: 79908
2009-08-24 10:34:41 +00:00
Dan Gohman
6ec8176e22 Rename hasNoUnsignedOverflow and hasNoSignedOverflow to hasNoUnsignedWrap
and hasNoSignedWrap, for consistency with the nuw and nsw properties.

llvm-svn: 79539
2009-08-20 17:11:38 +00:00
Owen Anderson
dc11fe967d Actually privatize a IntegerTypes, and fix a few bugs exposed by this.
llvm-svn: 78955
2009-08-13 23:27:32 +00:00
Owen Anderson
9df206d02d Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Daniel Dunbar
3a5a25d5d5 Convert APint::{fromString,APInt,getBitsNeeded} to use StringRef.
- Patch by Erick Tryzelaar, with some edits (and a bug fix) from me.

llvm-svn: 78885
2009-08-13 02:33:34 +00:00
Dan Gohman
4ee8471442 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.

llvm-svn: 78859
2009-08-12 23:32:33 +00:00
Benjamin Kramer
9a590500ea Make LLVMContext and LLVMContextImpl classes instead of structs.
llvm-svn: 78690
2009-08-11 17:45:13 +00:00
Owen Anderson
3d0e1b855d Privatize the StructType table, which unfortunately involves routing contexts through a number of APIs.
llvm-svn: 78258
2009-08-05 23:16:16 +00:00
Owen Anderson
cf2c39dc30 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.

llvm-svn: 78115
2009-08-04 22:41:48 +00:00
Owen Anderson
034ab4f8b1 Move the metadata constructors back to 2.5 syntax.
llvm-svn: 77733
2009-07-31 21:35:40 +00:00
Owen Anderson
1dc40e205b 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.

llvm-svn: 77721
2009-07-31 20:28:14 +00:00
Owen Anderson
d0e6352c97 Move getTrue() and getFalse() to 2.5-like APIs.
llvm-svn: 77685
2009-07-31 17:39:07 +00:00
Owen Anderson
93ccaf5c60 Move more code back to 2.5 APIs.
llvm-svn: 77635
2009-07-30 23:03:37 +00:00
Owen Anderson
881d928f9b Move types back to the 2.5 API.
llvm-svn: 77516
2009-07-29 22:17:13 +00:00
Devang Patel
c8dfc60e5e There is no need to keep name ref in NamedMDNode.
llvm-svn: 77511
2009-07-29 21:58:56 +00:00
Owen Anderson
0ce2151b36 Move ConstantExpr to 2.5 API.
llvm-svn: 77494
2009-07-29 18:55:55 +00:00
Dan Gohman
a3af79a5c3 Minor code simplification.
llvm-svn: 77459
2009-07-29 15:58:36 +00:00
Devang Patel
127ab37209 Parse named metadata.
llvm-svn: 77410
2009-07-29 00:34:02 +00:00
Devang Patel
cb23671431 Rename MDNode.h header. It defines MDnode and other metadata classes.
New name is Metadata.h.

llvm-svn: 77370
2009-07-28 21:49:47 +00:00
Owen Anderson
390e9778d4 Return ConstantVector to 2.5 API.
llvm-svn: 77366
2009-07-28 21:19:26 +00:00
Owen Anderson
aa8c94b051 Change ConstantArray to 2.5 API.
llvm-svn: 77347
2009-07-28 18:32:17 +00:00
Owen Anderson
d729f993b8 Move ConstantStruct back to 2.5 API.
llvm-svn: 77266
2009-07-27 22:29:26 +00:00
Dan Gohman
490eb36e1d Add a new keyword 'inbounds' for use with getelementptr. See the
LangRef.html changes for details.

llvm-svn: 77259
2009-07-27 21:53:46 +00:00
Owen Anderson
256c2c250e Move ConstantFP construction back to the 2.5-ish API.
llvm-svn: 77247
2009-07-27 20:59:43 +00:00
Dan Gohman
39c0d3b10a 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.

llvm-svn: 77194
2009-07-27 16:11:46 +00:00
Benjamin Kramer
706c0b2b97 Test commit: fix typo
llvm-svn: 77187
2009-07-27 09:06:52 +00:00
Daniel Dunbar
9f50ab3c49 Finish migrating VMCore to StringRef/Twine based APIs.
llvm-svn: 77051
2009-07-25 06:02:13 +00:00
Eric Christopher
df9c86fc26 Move ExtractElementInst to ::Create instead of new. Update all uses.
llvm-svn: 77044
2009-07-25 02:28:41 +00:00
Owen Anderson
cc33e89571 Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
llvm-svn: 77011
2009-07-24 23:12:02 +00:00
Eli Friedman
11e86150c4 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...

llvm-svn: 77005
2009-07-24 21:56:17 +00:00
Devang Patel
45ce5c2ac1 MDString
- Rename member function size(). New name is length().
- Store string beginning and length. Earlier it used to store string end.

llvm-svn: 76841
2009-07-23 02:00:51 +00:00
Devang Patel
63cece4454 Silence "uninitialized use" warning.
llvm-svn: 76836
2009-07-23 01:36:16 +00:00
Devang Patel
6b2162686a Derive MDNode from MetadataBase instead of Constant. Emit MDNodes into METADATA_BLOCK in bitcode file.
llvm-svn: 76834
2009-07-23 01:07:34 +00:00
Eric Christopher
973fc2d7ab Fix error message for correct opcode.
llvm-svn: 76829
2009-07-23 01:01:32 +00:00
Dan Gohman
001d777207 Rename the new unsigned and signed keywords to nuw and nsw,
which stand for no-unsigned-wrap and no-signed-wrap.

llvm-svn: 76810
2009-07-22 22:44:56 +00:00
Devang Patel
5794cb80ad Introduce MetadataBase, a base class for MDString and MDNode.
Derive MDString directly from MetadataBase. 
Introduce new bitcode block to hold metadata.

llvm-svn: 76759
2009-07-22 17:43:22 +00:00
Owen Anderson
7f61f8dc30 Rename getConstantInt{True|False} to get{True|False} at Chris' behest.
llvm-svn: 76598
2009-07-21 18:03:38 +00:00
Dan Gohman
d2ad3e183b Assembly and Bitcode support for unsigned/signed overflow flags and
exact sdiv flags.

llvm-svn: 76475
2009-07-20 21:19:07 +00:00
Devang Patel
25ea06491e Refactor metadata parsing routines into separate functions.
llvm-svn: 76455
2009-07-20 19:00:08 +00:00
Bill Wendling
1a10a060cb 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.

llvm-svn: 76385
2009-07-20 01:03:30 +00:00
Anton Korobeynikov
60f7bd3562 Add support for naked functions
llvm-svn: 76198
2009-07-17 18:07:26 +00:00
Owen Anderson
4483fbda5e Revert yesterday's change by removing the LLVMContext parameter to AllocaInst and MallocInst.
llvm-svn: 75863
2009-07-15 23:53:25 +00:00
Owen Anderson
8c85061ee6 Move EVER MORE stuff over to LLVMContext.
llvm-svn: 75703
2009-07-14 23:09:55 +00:00
Torok Edwin
f955a6ef49 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").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Torok Edwin
ae8a3ff177 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.

llvm-svn: 75379
2009-07-11 20:10:48 +00:00
Owen Anderson
49226b1075 This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
llvm-svn: 75200
2009-07-09 23:48:35 +00:00
Devang Patel
61c3f7bd41 Fix thinko.
llvm-svn: 75061
2009-07-08 22:25:56 +00:00
Devang Patel
23e55694c5 Drop "constant" from
!0 = constant metadata !{...}

llvm-svn: 75057
2009-07-08 21:57:07 +00:00
Devang Patel
530fc78aec Support MDNode forward reference.
llvm-svn: 75031
2009-07-08 19:23:54 +00:00
Owen Anderson
332aae685b Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
llvm-svn: 75025
2009-07-08 19:03:57 +00:00
Nick Lewycky
d46a7b2d22 Remove the vicmp and vfcmp instructions. Because we never had a release with
these instructions, no autoupgrade or backwards compatibility support is
provided.

llvm-svn: 74991
2009-07-08 03:04:38 +00:00
Owen Anderson
7a1f69e433 Push LLVMContext through GlobalVariables and IRBuilder.
llvm-svn: 74985
2009-07-08 01:26:06 +00:00
Owen Anderson
33df2f9812 Use LLVMContext in the LLLexer.
llvm-svn: 74934
2009-07-07 18:44:11 +00:00
Chris Lattner
d49e5380ec switch the .ll parser to use SourceMgr.
llvm-svn: 74735
2009-07-02 23:08:13 +00:00
Chris Lattner
739a32b190 switch the .ll parser into SMDiagnostic.
llvm-svn: 74734
2009-07-02 22:46:18 +00:00
Owen Anderson
4c1647bc63 Use LLVMContext for generating MDStrings too.
llvm-svn: 74710
2009-07-02 17:28:30 +00:00
Owen Anderson
ea0b9b58ae Use LLVMContext to generate metadata constants.
llvm-svn: 74708
2009-07-02 17:20:28 +00:00
Owen Anderson
bd328c24a0 Use LLVMContext for generating UndefValue constants too!
llvm-svn: 74703
2009-07-02 17:04:01 +00:00
Owen Anderson
110917b453 Try again at converting the LLParser to use LLVMContext, without massive breakage this time.
llvm-svn: 74671
2009-07-01 23:57:11 +00:00
Owen Anderson
4fa7e54329 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.

llvm-svn: 74655
2009-07-01 23:13:44 +00:00
Bill Wendling
cbd3f64f54 --- 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.

llvm-svn: 74653
2009-07-01 22:33:26 +00:00
Owen Anderson
b70b5ab513 Convert LLParser to use LLVMContext for creating constants.
llvm-svn: 74648
2009-07-01 21:57:44 +00:00
Owen Anderson
cf112e59c3 Hold the LLVMContext by reference rather than by pointer.
llvm-svn: 74640
2009-07-01 21:22:36 +00:00
Devang Patel
905d32435c Support stand alone metadata syntax.
!0 = constant metadata !{i32 21, i32 22}
@llvm.blah = constant metadata !{i32 1000, i16 200, metadata !0}

llvm-svn: 74630
2009-07-01 19:21:12 +00:00
Owen Anderson
81b8dabb53 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.

llvm-svn: 74614
2009-07-01 16:58:40 +00:00
Chris Lattner
4bdaace06e 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!

llvm-svn: 74584
2009-07-01 04:13:31 +00:00
Anton Korobeynikov
cc8d0058e2 Address review comments: add 3 ARM calling conventions.
Dispatch C calling conv. to one of these conventions based on
target triple and subtarget features.

llvm-svn: 73530
2009-06-16 18:50:49 +00:00
Dan Gohman
1fdd9a7c08 Fix a typo in a diagnostic.
llvm-svn: 73429
2009-06-15 21:52:11 +00:00
Dan Gohman
111f127d23 Fix old-style type names in comments.
llvm-svn: 73362
2009-06-14 23:30:43 +00:00
Nick Lewycky
71dc3c5d85 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.

llvm-svn: 73016
2009-06-07 07:26:46 +00:00
Nick Lewycky
3a8ea63343 Refuse metadata* type for function arguments.
llvm-svn: 73010
2009-06-07 01:45:11 +00:00
Devang Patel
8d170194e8 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.

llvm-svn: 72959
2009-06-05 21:57:13 +00:00
Dan Gohman
5f6f8101d5 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

llvm-svn: 72897
2009-06-04 22:49:04 +00:00
Devang Patel
9757e4f9f3 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.

llvm-svn: 72894
2009-06-04 22:05:33 +00:00
Nick Lewycky
a9de2f1c81 Give embedded metadata its own type instead of relying on EmptyStructTy.
llvm-svn: 72610
2009-05-30 05:06:04 +00:00
Jay Foad
16d48d2595 Use v.data() instead of &v[0] when SmallVector v might be empty.
llvm-svn: 72210
2009-05-21 09:52:38 +00:00
Nick Lewycky
f417462ddf 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.

llvm-svn: 71407
2009-05-10 20:57:05 +00:00
Chris Lattner
f795b63fb2 testcase and asmparser fix for PR4066
llvm-svn: 70080
2009-04-25 21:26:00 +00:00
Nick Lewycky
ecd6602046 Fix warning in .ll parser, detect and reject available_externally on function
declarations.

llvm-svn: 68944
2009-04-13 07:02:02 +00:00
Chris Lattner
c1bfdc9bb2 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.

llvm-svn: 68940
2009-04-13 05:44:34 +00:00
Nick Lewycky
eea5412e19 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.

llvm-svn: 68420
2009-04-04 07:22:01 +00:00
Chris Lattner
e7eed82209 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.

llvm-svn: 67682
2009-03-25 06:36:36 +00:00
Dale Johannesen
34123aba43 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.

llvm-svn: 67562
2009-03-23 21:16:53 +00:00
Duncan Sands
b27c523449 It makes no sense to have a ODR version of common
linkage, so remove it.

llvm-svn: 66690
2009-03-11 20:14:15 +00:00
Duncan Sands
aadb34c357 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.

llvm-svn: 66650
2009-03-11 08:08:06 +00:00
Chris Lattner
2db6dc1753 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}
           ^

llvm-svn: 66394
2009-03-09 04:49:14 +00:00
Duncan Sands
5ab54d488f 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.

llvm-svn: 66339
2009-03-07 15:45:40 +00:00
Chris Lattner
a9611661b0 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.

llvm-svn: 65743
2009-03-01 00:53:13 +00:00
Chris Lattner
af8467a57f reject 0 element vectors with:
@a = internal constant void bitcast(<0 x i8> <> to void)
                                     ^

Fixes PR3685

llvm-svn: 65698
2009-02-28 18:12:41 +00:00
Chris Lattner
fc11ee35c5 add proper asmwriter and asmparser support for anonymous functions.
llvm-svn: 64953
2009-02-18 21:48:13 +00:00
Duncan Sands
e0f1fe111b Pacify gcc-4.3 (thinks IsConstant may be used
uninitialized).

llvm-svn: 64220
2009-02-10 16:24:55 +00:00
Dan Gohman
b7e521e39d Use slightly more correct grammar in error messages.
llvm-svn: 64148
2009-02-09 17:41:21 +00:00
Chris Lattner
f6b4b170b6 fix typo
llvm-svn: 64091
2009-02-08 20:00:15 +00:00
Chris Lattner
803ee40d44 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.

llvm-svn: 64089
2009-02-08 19:56:22 +00:00
Dale Johannesen
fa28929927 Reapply 63765. Patches for clang and llvm-gcc to follow.
llvm-svn: 63812
2009-02-05 01:49:45 +00:00
Dale Johannesen
f6e1822ccd Reverting 63765. This broke the build of both clang
and llvm-gcc.

llvm-svn: 63786
2009-02-04 22:47:25 +00:00
Nate Begeman
66f10b55ed 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.

llvm-svn: 63765
2009-02-04 19:47:21 +00:00
Chris Lattner
11cfab6d5b Fix PR3372
llvm-svn: 63501
2009-02-02 07:24:28 +00:00
Rafael Espindola
0aba6c9435 Add the private linkage.
llvm-svn: 62279
2009-01-15 20:18:42 +00:00
Misha Brukman
71c7e40966 Removed trailing whitespace from Makefiles.
llvm-svn: 61991
2009-01-09 16:44:42 +00:00
Dan Gohman
ff89414349 61949 accidentally introduced an escaped newline. Fix this by making
the comment a little more verbose.

llvm-svn: 61959
2009-01-08 23:51:48 +00:00
Dan Gohman
88a0d4277d Fix the comment for lltok::backslash.
llvm-svn: 61949
2009-01-08 22:18:13 +00:00