summaryrefslogtreecommitdiff
path: root/lib/VMCore/Type.cpp
Commit message (Collapse)AuthorAge
* Teach Type::getPointerAddressSpace to look through pointer vectorsChandler Carruth2012-11-01
| | | | | | | | | | politely and document this feature. This simple API extension then allows us to write all of the Instructions' address space query methods much more simply. No functionality change intended here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167223 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the series of commits starting with r166578 which introduced theChandler Carruth2012-11-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | getIntPtrType support for multiple address spaces via a pointer type, and also introduced a crasher bug in the constant folder reported in PR14233. These commits also contained several problems that should really be addressed before they are re-committed. I have avoided reverting various cleanups to the DataLayout APIs that are reasonable to have moving forward in order to reduce the amount of churn, and minimize the number of commits that were reverted. I've also manually updated merge conflicts and manually arranged for the getIntPtrType function to stay in DataLayout and to be defined in a plausible way after this revert. Thanks to Duncan for working through this exact strategy with me, and Nick Lewycky for tracking down the really annoying crasher this triggered. (Test case to follow in its own commit.) After discussing with Duncan extensively, and based on a note from Micah, I'm going to continue to back out some more of the more problematic patches in this series in order to ensure we go into the LLVM 3.2 branch with a reasonable story here. I'll send a note to llvmdev explaining what's going on and why. Summary of reverted revisions: r166634: Fix a compiler warning with an unused variable. r166607: Add some cleanup to the DataLayout changes requested by Chandler. r166596: Revert "Back out r166591, not sure why this made it through since I cancelled the command. Bleh, sorry about this! r166591: Delete a directory that wasn't supposed to be checked in yet. r166578: Add in support for getIntPtrType to get the pointer type based on the address space. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167221 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a helper for telling whether a type is a pointer or vector of pointer type.Duncan Sands2012-10-30
| | | | | | | | Simplify the implementation of the corresponding integer and float functions and move them inline while there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167014 91177308-0d34-0410-b5e6-96231b3b80d8
* Back out r166591, not sure why this made it through since I cancelled the ↵Micah Villmow2012-10-24
| | | | | | command. Bleh, sorry about this! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166596 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete a directory that wasn't supposed to be checked in yet.Micah Villmow2012-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166591 91177308-0d34-0410-b5e6-96231b3b80d8
* Add in support for getIntPtrType to get the pointer type based on the ↵Micah Villmow2012-10-24
| | | | | | | | | | address space. This checkin also adds in some tests that utilize these paths and updates some of the clients. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166578 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. ↵Sylvestre Ledru2012-09-27
| | | | | | See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164767 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164768 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo 'iff' => 'if'Sylvestre Ledru2012-09-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164767 91177308-0d34-0410-b5e6-96231b3b80d8
* whitespace.Nadav Rotem2012-09-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164203 91177308-0d34-0410-b5e6-96231b3b80d8
* Postpone the deletion of the old name in StructType::setName to allow using ↵Benjamin Kramer2012-08-04
| | | | | | | | a slice of the old name. Fixes PR13522. Add a rudimentary unit test to exercise the behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161296 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r155241, which is causing some breakage.Bill Wendling2012-04-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155253 91177308-0d34-0410-b5e6-96231b3b80d8
* If we discover all of the named structs in a module, then don't bother toBill Wendling2012-04-20
| | | | | | | process any more Values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155241 91177308-0d34-0410-b5e6-96231b3b80d8
* Cache the sized-ness of struct types, once we reach the steady state ofChandler Carruth2012-03-07
| | | | | | | | | | | | | | | "is sized". This prevents every query to isSized() from recursing over every sub-type of a struct type. This could get *very* slow for extremely deep nesting of structs, as in 177.mesa. This change is a 45% speedup for 'opt -O2' of 177.mesa.linked.bc, and likely a significant speedup for other cases as well. It even impacts -O0 cases because so many part of the code try to check whether a type is sized. Thanks for the review from Nick Lewycky and Benjamin Kramer on IRC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152197 91177308-0d34-0410-b5e6-96231b3b80d8
* Reinstate r151049 now that GeneralHash is fixed.Jay Foad2012-02-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151248 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r151049 cos it broke the buildbots.Jay Foad2012-02-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151052 91177308-0d34-0410-b5e6-96231b3b80d8
* PR1210: make uniquing of struct and function types more efficient byJay Foad2012-02-21
| | | | | | | | | | using a DenseMap and Talin's new GeneralHash, avoiding the need for a temporary std::vector on every lookup. Patch by Meador Inge! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151049 91177308-0d34-0410-b5e6-96231b3b80d8
* Cache the sizes of vectors instead of calculating them all over the place.Bill Wendling2012-02-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149954 91177308-0d34-0410-b5e6-96231b3b80d8
* Reserve space in these vectors to prevent having to grow the array tooBill Wendling2012-02-07
| | | | | | | much. This gets us an addition 0.9% on 445.gobmk. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149952 91177308-0d34-0410-b5e6-96231b3b80d8
* add StructType helpers too.Chris Lattner2012-01-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149000 91177308-0d34-0410-b5e6-96231b3b80d8
* Ok, break down and add some cast<>'ing helper methods to the Type classChris Lattner2012-01-26
| | | | | | | | | | | | | to reduce the number of cast<>'s we have. This allows someone to use things like Ty->getVectorNumElements() instead of cast<VectorType>(Ty)->getNumElements() when you know that a type is a vector. It would be a great general cleanup to move the codebase to use these, I will do so in the code I'm touching. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148999 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the Type::getNumElements() method, which is only called in 4 places,Chris Lattner2012-01-25
| | | | | | | | did something extremely surprising, and shadowed actually useful implementations that had completely different behavior. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148898 91177308-0d34-0410-b5e6-96231b3b80d8
* Type: replaced usage of ID with getTypeID().Stepan Dyatkovskiy2012-01-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147446 91177308-0d34-0410-b5e6-96231b3b80d8
* VMCore: add assert for miscompileDylan Noblesmith2011-12-31
| | | | | | | | | | | | | See PR11652. Trying to add this assert to setSubclassData() itself actually prevented the miscompile entirely, so it has to be here. This makes the source of the bug more obvious than the other asserts triggering later on did. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147390 91177308-0d34-0410-b5e6-96231b3b80d8
* The powers that be have decided that LLVM IR should now support 16-bitDan Gohman2011-12-17
| | | | | | | | | "half precision" floating-point with a first-class type. This patch adds basic IR support (but not codegen support). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146786 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for vectors of pointers.Nadav Rotem2011-12-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145801 91177308-0d34-0410-b5e6-96231b3b80d8
* Rip out the old StructType APIs as warned about on llvmdev last week.Chris Lattner2011-08-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137953 91177308-0d34-0410-b5e6-96231b3b80d8
* add ifdef's to let people easily remove these dead api for testing.Chris Lattner2011-08-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137483 91177308-0d34-0410-b5e6-96231b3b80d8
* forward to the correct constructor.Chris Lattner2011-08-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137479 91177308-0d34-0410-b5e6-96231b3b80d8
* add two missing function implsChris Lattner2011-08-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137470 91177308-0d34-0410-b5e6-96231b3b80d8
* add new accessors to reflect new terminology in struct types.Chris Lattner2011-08-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137468 91177308-0d34-0410-b5e6-96231b3b80d8
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
* bump pointer allocate LLVM IR types, since they are never deallocated.Chris Lattner2011-07-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135248 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r135042. As Chris pointed out, it had no effect, and was based onJay Foad2011-07-13
| | | | | | a complete misunderstanding of the code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135070 91177308-0d34-0410-b5e6-96231b3b80d8
* Really cache function types and anonymous struct types.Jay Foad2011-07-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135042 91177308-0d34-0410-b5e6-96231b3b80d8
* stop leaking all named struct types with an empty name. ThanksChris Lattner2011-07-13
| | | | | | | | to Benjamin Kramer for steering me in the right direction here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135031 91177308-0d34-0410-b5e6-96231b3b80d8
* Second attempt at de-constifying LLVM Types in FunctionType::get(),Jay Foad2011-07-12
| | | | | | StructType::get() and TargetData::getIntPtrType(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134982 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r134893 and r134888 (and related patches in other trees). It was causingBill Wendling2011-07-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | an assert on Darwin llvm-gcc builds. Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, li\ ne 2067. etc. http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354 --- Reverse-merging r134893 into '.': U include/llvm/Target/TargetData.h U include/llvm/DerivedTypes.h U tools/bugpoint/ExtractFunction.cpp U unittests/Support/TypeBuilderTest.cpp U lib/Target/ARM/ARMGlobalMerge.cpp U lib/Target/TargetData.cpp U lib/VMCore/Constants.cpp U lib/VMCore/Type.cpp U lib/VMCore/Core.cpp U lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Instrumentation/ProfilingUtils.cpp U lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/CodeGen/SjLjEHPrepare.cpp --- Reverse-merging r134888 into '.': G include/llvm/DerivedTypes.h U include/llvm/Support/TypeBuilder.h U include/llvm/Intrinsics.h U unittests/Analysis/ScalarEvolutionTest.cpp U unittests/ExecutionEngine/JIT/JITTest.cpp U unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp U unittests/VMCore/PassManagerTest.cpp G unittests/Support/TypeBuilderTest.cpp U lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp U lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp U lib/VMCore/IRBuilder.cpp G lib/VMCore/Type.cpp U lib/VMCore/Function.cpp G lib/VMCore/Core.cpp U lib/VMCore/Module.cpp U lib/AsmParser/LLParser.cpp U lib/Transforms/Utils/CloneFunction.cpp G lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Utils/InlineFunction.cpp U lib/Transforms/Instrumentation/GCOVProfiling.cpp U lib/Transforms/Scalar/ObjCARC.cpp U lib/Transforms/Scalar/SimplifyLibCalls.cpp U lib/Transforms/Scalar/MemCpyOptimizer.cpp G lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/Transforms/IPO/ArgumentPromotion.cpp U lib/Transforms/InstCombine/InstCombineCompares.cpp U lib/Transforms/InstCombine/InstCombineAndOrXor.cpp U lib/Transforms/InstCombine/InstCombineCalls.cpp U lib/CodeGen/DwarfEHPrepare.cpp U lib/CodeGen/IntrinsicLowering.cpp U lib/Bitcode/Reader/BitcodeReader.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134949 91177308-0d34-0410-b5e6-96231b3b80d8
* De-constify Types in StructType::get() and TargetData::getIntPtrType().Jay Foad2011-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134893 91177308-0d34-0410-b5e6-96231b3b80d8
* De-constify Types in FunctionType::get().Jay Foad2011-07-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134888 91177308-0d34-0410-b5e6-96231b3b80d8
* remove the DerivedType which isn't adding value anymore.Chris Lattner2011-07-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134832 91177308-0d34-0410-b5e6-96231b3b80d8
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134829 91177308-0d34-0410-b5e6-96231b3b80d8
* fix the varargs version of StructType::get to not require an LLVMContext, ↵Chris Lattner2011-06-18
| | | | | | | | | making usage much cleaner. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133364 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate some pointless virtual methods.Chris Lattner2011-06-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133363 91177308-0d34-0410-b5e6-96231b3b80d8
* eliminate the Type::getDescription() method, using "<<" instead. This Chris Lattner2011-06-18
| | | | | | | removes some gunk from LLVMContext. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133360 91177308-0d34-0410-b5e6-96231b3b80d8
* change Type.h to forward declare ArrayRef instead of #including it.Chris Lattner2011-06-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133197 91177308-0d34-0410-b5e6-96231b3b80d8
* prune #includes.Chris Lattner2011-06-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133194 91177308-0d34-0410-b5e6-96231b3b80d8
* move the address space into the subclass data field, saving a word on ↵Chris Lattner2011-06-16
| | | | | | | | | PointerType. This limits the # address spaces to 2^23, which should be good enough. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133192 91177308-0d34-0410-b5e6-96231b3b80d8
* tidy up some comments, store the 'isvararg' bit for FunctionType inChris Lattner2011-06-16
| | | | | | | the SubclassData field, saving a word. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133191 91177308-0d34-0410-b5e6-96231b3b80d8
* remove Type::getVAArgsPromotedType, which is dead, and tidy up a bit.Chris Lattner2011-06-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133190 91177308-0d34-0410-b5e6-96231b3b80d8
* Make codegen able to handle values of empty types. This is one wayRafael Espindola2011-05-13
| | | | | | to fix PR9900. I will keep it open until sable is able to comment on it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131294 91177308-0d34-0410-b5e6-96231b3b80d8