Commit Graph

211 Commits

Author SHA1 Message Date
Chris Lattner
3b12ab4519 Inline the fastpath of PATypeHolder::get(). This is a small speedup in
instcombine among other things.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54814 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-15 15:16:50 +00:00
Dan Gohman
430b8a22e2 Fix several const-correctness issues, resolving some -Wcast-qual warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 14:45:15 +00:00
Dan Gohman
c418bf3dd5 Use find instead of lower_bound.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53474 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 20:58:19 +00:00
Dan Gohman
1002c02034 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53179 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07 18:00:37 +00:00
Dan Gohman
8de552d6f3 Use operator new instead of new char[].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53066 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03 00:53:09 +00:00
Chris Lattner
a1aabe422f fix some warnings when assertions are disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52587 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 19:47:03 +00:00
Chris Lattner
d34ff14358 switch TypeHasCycleThroughItself from using an std::set to using a SmallPtrSet,
this speeds up the linking testcase in PR1860 by 44% (.379 -> 0.263)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52365 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:20:58 +00:00
Dan Gohman
81a0c0b44e IR, bitcode reader, bitcode writer, and asmparser changes to
insertvalue and extractvalue to use constant indices instead of
Value* indices. And begin updating LangRef.html.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51806 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 00:58:22 +00:00
Dan Gohman
844731a7f1 Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 00:00:25 +00:00
Chris Lattner
d52b62ae05 Enforce that multiple return values have to have at least one result.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 05:36:34 +00:00
Duncan Sands
495304e351 Make it possible to get an empty struct using
the new StructType::get method.  The second NULL
is to pacify the gcc warning mechanism.  This
patch compiles but is otherwise untested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48645 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 15:53:17 +00:00
Chris Lattner
d8ff3caaa0 add some convenience methods for creating GEP instructions and
struct types.  Patch by David Chisnall, with some tweaks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48531 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 05:06:05 +00:00
Dan Gohman
450e7c3c54 Initialize ArgTypes directly instead of manually copying in the elements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48195 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 23:41:23 +00:00
Devang Patel
552ec65ebd Revert SmallVector ctor variants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47908 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 21:54:56 +00:00
Devang Patel
52f8ed8368 Add FunctionType ctor variant that takes SmallVector params.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47895 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-04 18:57:05 +00:00
Devang Patel
93f9d57bcd What if functions can return aggregate values ?
One small step towards multiple return value support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47406 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 22:36:03 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Christopher Lamb
fe63fb986d Implement address space attribute for LLVM pointer types. Address spaces are
regions of memory that have a target specific relationship, as described in the 
Embedded C Technical Report. 

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

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

LangRef updates are forthcoming.


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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44359 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 13:23:08 +00:00
Nate Begeman
5db1afb462 Basic non-power-of-2 vector support
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44181 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-15 21:15:26 +00:00
Dan Gohman
ef1af7d6d5 Add Type::isIntOrIntVector, like Type::isFPOrFPVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41190 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-20 19:25:59 +00:00
Dale Johannesen
320fc8a39e Long double, part 1 of N. Support in IR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40774 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-03 01:03:46 +00:00
Chris Lattner
1bfb8b7333 This enum is dead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37920 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-05 17:28:01 +00:00
Dan Gohman
fa73ea2d9f Minor comment cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37321 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-24 14:36:04 +00:00
Chris Lattner
645fc4edc2 if functiontype is going to have a pointer to a paramattr object, it better
be const.  The only way to get a pointer to these returns a const pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36734 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-04 03:39:28 +00:00
Jeff Cohen
dc4cb35105 Have compiler enforce this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36353 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-22 22:16:55 +00:00
Reid Spencer
4f859aa532 For PR1146:
Make ParamAttrsList objects unique. You can no longer directly create or
destroy them but instead must go through the ParamAttrsList::get()
interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36327 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-22 05:46:44 +00:00
Chris Lattner
a5f5a9c8e2 Fix a problem where primitive types lose their name after llvm_shutdown is called.
This also reduces the amount of work done at static construction time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36285 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-20 22:33:47 +00:00
Chris Lattner
17fcdd5e1b Refactor SymbolTableListTraits to only have a single pointer in it, instead
of two.  This shrinkifies Function by 8 bytes (104->96) and Module by 8
bytes (68->60).  On a testcase of mine, this reduces the memory used to
read a module header from 565680b to 561024, a little over 4K.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36188 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-17 03:26:42 +00:00
Reid Spencer
18da072088 For PR1146:
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35877 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 02:44:20 +00:00
Reid Spencer
3aad26e4da Remove a memory leak, until ParamAttrsList is uniqued.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35823 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 17:20:18 +00:00
Reid Spencer
4746ecf16e For PR1146:
* Add ParamAttrList pointers to Function and CallInst.
* Move the implementation of ParamAttrList from Type.cpp to Function.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35818 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 15:01:12 +00:00
Reid Spencer
89b1f46a10 For PR1146:
Move parameter attributes functionality to ParamAttrsList class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35806 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-09 06:07:52 +00:00
Reid Spencer
5a1ebb3c99 For PR1209:
Implement Type class's ContainedTys without using a std::vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35693 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-06 02:02:20 +00:00
Reid Spencer
66123626ad Add the NoUnwind function attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35260 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-22 02:14:48 +00:00
Reid Spencer
9e57414e69 Reduce #includage by taking a method out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34774 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 04:02:06 +00:00
Chris Lattner
f00c6add97 remove dead method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34436 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-20 05:29:47 +00:00
Reid Spencer
ac9dcb94dd For PR1195:
Change use of "packed" term to "vector" in comments, strings, variable
names, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34300 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 03:39:18 +00:00
Reid Spencer
a85210ac66 For PR1195:
Change a comment: Packed Type -> Vector Type


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34299 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 03:11:50 +00:00
Reid Spencer
9d6565a5b1 For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 02:26:10 +00:00
Reid Spencer
cc5dc2e792 Assert that elements of packed are pointer/float/opaque.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34165 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-10 22:02:45 +00:00
Reid Spencer
e463fc8098 Allow PackedType to be constructed with an abstract type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34152 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-10 19:03:01 +00:00
Chris Lattner
d1f711fa6d Fix clients like this:
delete ParseBytecodeFile(InputFilename, 0, &ErrorMessage);
  llvm_shutdown();
  delete ParseBytecodeFile(InputFilename, 0, &ErrorMessage);

The primitive type objects failed to ressurect themselves after shutdown, leading
to crashes in clients that used them after llvm_shutdown().

This solution isn't wonderful, because we clearly have static ctors.  However,
the code it replaces was just as bad, so it's not a regression.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34106 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-09 22:24:04 +00:00
Reid Spencer
ef9b9a7939 For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does
not support types planes. This means that all symbol names in LLVM must now
be unique. The patch addresses the necessary changes to deal with this and
removes code no longer needed as a result. This completes the bulk of the
changes for this PR. Some cleanup patches will follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33918 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 20:47:22 +00:00
Anton Korobeynikov
b10308e440 Propagate changes from my local tree. This patch includes:
1. New parameter attribute called 'inreg'. It has meaning "place this
parameter in registers, if possible". This is some generalization of
gcc's regparm(n) attribute. It's currently used only in X86-32 backend.
2. Completely rewritten CC handling/lowering code inside X86 backend.
Merged stdcall + c CCs and fastcall + fast CC.
3. Dropped CSRET CC. We cannot add struct return variant for each
target-specific CC (e.g. stdcall + csretcc and so on).
4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in
on first attribute has meaning 'This is hidden pointer to structure
return. Handle it gently'.
5. Fixed small bug in llvm-extract + add new feature to
FunctionExtraction pass, which relinks all internal-linkaged callees
from deleted function to external linkage. This will allow further
linking everything together.

NOTEs: 1. Documentation will be updated soon.
       2. llvm-upgrade should be improved to translate csret => sret.
          Before this, there will be some unexpected test fails.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33597 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-28 13:31:35 +00:00
Reid Spencer
43276ee280 IntegerType is a sized DerivedType too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33521 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-26 07:51:36 +00:00
Reid Spencer
ab60be7a00 Remove dead methods in the ValTypes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33372 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-19 21:25:12 +00:00
Reid Spencer
c10305743c For PR1043:
This is the final patch for this PR. It implements some minor cleanup
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask -> IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*

This also fixes PR1120.

Patch by Sheng Zhou.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-19 21:13:56 +00:00
Reid Spencer
b5f378e11b Use a cheaper computation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33336 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-18 18:14:49 +00:00
Reid Spencer
7808dcba05 Provide an isPowerOf2ByteWidth method for the IntegerType class. This will
mostly be used by back ends that wish to distinguish between integer types
that fit evenly within a natural integer type and those that don't.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33328 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-18 02:59:54 +00:00