summaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
AgeCommit message (Collapse)Author
2010-01-05NamedMDNode is a collection MDNodes.Devang Patel
llvm-svn: 92761
2010-01-05Avoid going through the LLVMContext for type equality where it's safe to ↵Benjamin Kramer
dereference the type pointer. llvm-svn: 92726
2009-12-29Final step in the metadata API restructuring: move the Chris Lattner
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-28This is a major cleanup of the instruction metadata interfaces thatChris Lattner
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-28rename getMDKind -> getMDKindID, make it autoinsert if an MD KindChris Lattner
doesn't exist already, eliminate registerMDKind. Tidy up a bunch of random stuff. llvm-svn: 92225
2009-11-07Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.Victor Hernandez
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-06Revert r86077 because it caused crashes in 179.art and 175.vpr on ARMVictor Hernandez
llvm-svn: 86213
2009-11-05Update CreateMalloc so that its callers specify the size to allocate:Victor Hernandez
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-01Revert 85678/85680. The decision is to stay with the current form of Chris Lattner
indirectbr, thus we don't need "blockaddr(@func, null)". Eliminate it for simplicity. llvm-svn: 85699
2009-10-31Make blockaddress(@func, null) be valid, and make 'deleting a basic Chris Lattner
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-28add bitcode reader support for blockaddress. We can now fullyChris Lattner
round trip blockaddress through .ll and .bc files, so add a testcase. There are still a bunch of places in the optimizer and other places that need to be updated to work with these constructs, but at least the basics are in now. llvm-svn: 85377
2009-10-28rename indbr -> indirectbr to appease the residents of #llvm.Chris Lattner
llvm-svn: 85351
2009-10-27add enough support for indirect branch for the feature test to passChris Lattner
(assembler,asmprinter, bc reader+writer) and document it. Codegen currently aborts on it. llvm-svn: 85274
2009-10-25Suppress -Asserts warning.Daniel Dunbar
llvm-svn: 85078
2009-10-24Auto-upgrade free instructions to calls to the builtin free function.Victor Hernandez
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-22Hide MetadataContext implementation details.Devang Patel
llvm-svn: 84886
2009-10-21Rename msasm to alignstack per review.Dale Johannesen
llvm-svn: 84795
2009-10-21Make changes to rev 84292 as requested by Chris Lattner.Victor Hernandez
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-17Autoupgrade malloc insts to malloc calls.Victor Hernandez
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-13Add an "msasm" flag to inline asm as suggested in PR 5125.Dale Johannesen
A little ugliness is accepted to keep the binary file format compatible. No functional change yet. llvm-svn: 84020
2009-10-13Remove unnecessary assert.Devang Patel
llvm-svn: 84004
2009-10-05strength reduce a ton of type equality tests to check the typeid (ThroughChris Lattner
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-09-29Only one custom meadata of each kind can be attached with an instruction.Devang Patel
llvm-svn: 83105
2009-09-28s/class Metadata/class MetadataContext/gDevang Patel
llvm-svn: 83019
2009-09-28Do not use global typedef for MDKindID.Devang Patel
llvm-svn: 83016
2009-09-25Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it ↵Victor Hernandez
causes regressions in the nightly tests. llvm-svn: 82784
2009-09-24Auto-upgrade malloc instructions to malloc calls.Victor Hernandez
Reviewed by Devang Patel. llvm-svn: 82694
2009-09-20Tabs -> spaces, and remove trailing whitespace.Daniel Dunbar
llvm-svn: 82355
2009-09-18Write and read metadata attachments.Devang Patel
llvm-svn: 82259
2009-09-07Reappy r80998, now that the GlobalOpt bug that it exposed on MiniSAT is fixed.Dan Gohman
llvm-svn: 81172
2009-09-06Public and private corrections, warned about by icc (#304).Duncan Sands
Patch by Erick Tryzelaar. llvm-svn: 81107
2009-09-06Revert "Include optional subclass flags, such as inbounds, nsw, etc., ...", thisDaniel Dunbar
breaks MiniSAT on x86_64. llvm-svn: 81098
2009-09-04Include optional subclass flags, such as inbounds, nsw, etc., in theDan Gohman
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-03Add new value for given index in MDValuePtrs.Devang Patel
llvm-svn: 80867
2009-09-02Retype from unsigned to CallingConv::ID accordingly. Approved by Bob Wilson.Sandeep Patel
llvm-svn: 80773
2009-08-28Reapply 79977.Devang Patel
Use MDNodes to encode debug info in llvm IR. llvm-svn: 80406
2009-08-26Revert 79977. It causes llvm-gcc bootstrap failures on some platforms.Devang Patel
llvm-svn: 80073
2009-08-25Eliminate the unused Context argument on one of the ICmpInst and FCmpInstDan Gohman
constructors. llvm-svn: 80049
2009-08-25Update DebugInfo interface to use metadata, instead of special named ↵Devang Patel
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-20Rename hasNoUnsignedOverflow and hasNoSignedOverflow to hasNoUnsignedWrapDan Gohman
and hasNoSignedWrap, for consistency with the nuw and nsw properties. llvm-svn: 79539
2009-08-19Switch to SmallString::str from SmallString::c_str, and removeDaniel Dunbar
SmallString::c_str. llvm-svn: 79456
2009-08-13Actually privatize a IntegerTypes, and fix a few bugs exposed by this.Owen Anderson
llvm-svn: 78955
2009-08-13Push LLVMContexts through the IntegerType APIs.Owen Anderson
llvm-svn: 78948
2009-08-05Privatize the StructType table, which unfortunately involves routing ↵Owen Anderson
contexts through a number of APIs. llvm-svn: 78258
2009-08-04Use separate ValueList for metadata.Devang Patel
This fixes PR4666. llvm-svn: 78056
2009-07-31Move the metadata constructors back to 2.5 syntax.Owen Anderson
llvm-svn: 77733
2009-07-31Move a few more APIs back to 2.5 forms. The only remaining ones left to ↵Owen Anderson
change back are metadata related, which I'm waiting on to avoid conflicting with Devang. llvm-svn: 77721
2009-07-30Move more code back to 2.5 APIs.Owen Anderson
llvm-svn: 77635
2009-07-29Read and write NamedMDNode.Devang Patel
llvm-svn: 77517
2009-07-29Move types back to the 2.5 API.Owen Anderson
llvm-svn: 77516