Commit Graph

2124 Commits

Author SHA1 Message Date
Duncan Sands
fd7b326bea Make invokes of inline asm legal. Teach codegen
how to lower them (with no attempt made to be
efficient, since they should only occur for
unoptimized code).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45108 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 18:08:19 +00:00
Gordon Henriksen
57cebeec7b C and Ocaml bindings for address spaces, for that burgeoning market
for Ocaml-based compilers targeting embedded devices. :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45096 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 16:08:32 +00:00
Christopher Lamb
43ad6b3e0d Change the PointerType api for creating pointer types. The old functionality of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45082 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 01:12:55 +00:00
Christopher Lamb
303dae993a Make it clear in the LangRef that allocation instructions only operated on the generic address space. Implement support in the verifier for ensuring this is true.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45080 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 01:00:21 +00:00
Duncan Sands
ece2c04d53 Make instcombine promote inline asm calls to 'nounwind'
calls.  Remove special casing of inline asm from the
inliner.  There is a potential problem: the verifier
rejects invokes of inline asm (not sure why).  If an
asm call is not marked "nounwind" in some .ll, and
instcombine is not run, but the inliner is run, then
an illegal module will be created.  This is bad but
I'm not sure what the best approach is.  I'm tempted
to remove the check in the verifier...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-16 15:51:49 +00:00
Anders Carlsson
d04764a8ac All MMX shift instructions took a <2 x i32> vector as the shift amount parameter. Change this to be <1 x i64> instead, which matches the assembler instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45027 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 06:38:54 +00:00
Duncan Sands
7915cbee4d Revert r44626, which turned off the use of readonly
and readnone for functions with bodies because it
broke llvm-gcc-4.2 bootstrap.  It turns out that,
because of LLVM's array_ref hack, gcc was computing
pure/const attributes wrong (now fixed by turning
off the gcc ipa-pure-const pass).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44937 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 16:01:40 +00:00
Gordon Henriksen
1ae6135fa3 Add (very basic) bindings for ModuleProvider.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44899 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 01:04:30 +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
Chris Lattner
7431c2ba79 Teach VMCore to constant fold shufflevectors with constant operands.
This allows us to compile:

#include <emmintrin.h>
typedef __m128i VSInt16;
typedef short vSInt16 __attribute__ ((__vector_size__ (16)));
VSInt16 t3() {
  return (VSInt16)((vSInt16)_mm_set1_epi16(6518));
}

into:

_t3:
	movaps	LCPI1_0, %xmm0
	ret

instead of:
_t3:
	movl	$6518, %eax
	movd	%eax, %xmm0
	pextrw	$0, %xmm0, %eax
	xorps	%xmm0, %xmm0
	pinsrw	$0, %eax, %xmm0
	punpcklwd	%xmm0, %xmm0
	pshufd	$0, %xmm0, %xmm0
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44856 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 07:49:37 +00:00
Chris Lattner
9eaa835e88 significantly simplify some code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44850 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 06:07:39 +00:00
Chris Lattner
2b0f806c88 refactor some code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44849 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 05:55:02 +00:00
Chris Lattner
f286f6fd93 Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.
Reimplement the xform in Analysis/ConstantFolding.cpp where we can use
targetdata to validate that it is safe.  While I'm in there, fix some const
correctness issues and generalize the interface to the "operand folder".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44817 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 22:53:04 +00:00
Gordon Henriksen
53c34b1db9 Delete the CollectorNamePool if it should become empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44775 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 03:35:18 +00:00
Gordon Henriksen
80a75bfae9 Adding a collector name attribute to Function in the IR. These
methods are new to Function:

  bool hasCollector() const;
  const std::string &getCollector() const;
  void setCollector(const std::string &);
  void clearCollector();

The assembly representation is as such:

  define void @f() gc "shadow-stack" { ...

The implementation uses an on-the-side table to map Functions to 
collector names, such that there is no overhead. A StringPool is 
further used to unique collector names, which are extremely
likely to be unique per process.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44769 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 03:18:06 +00:00
Gordon Henriksen
afba8fe662 Reverting dtor devirtualization patch.
_sabre_: it has a major problem: by the time ~Value is run, all of the "parts" of the derived classes have been destroyed
_sabre_: the vtable lives to fight another day

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44760 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 02:14:30 +00:00
Chris Lattner
d418239da7 fix some warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44756 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 01:51:22 +00:00
Chris Lattner
429c8221cc Fix a big problem in the recent dtor refactoring work, now it passes 2007-11-19-InlineAsm.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44755 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 01:48:29 +00:00
Gordon Henriksen
ed455c8fa2 Devirtualizing Value destructor (PR889). Patch by Pawel Kunio!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44747 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 22:46:10 +00:00
Duncan Sands
5d84afdc83 Commit 44487 broke bootstrap of llvm-gcc-4.2. It is
not yet clear why, but in the meantime work around the
problem by making less use of readnone/readonly info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44626 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 21:03:28 +00:00
Duncan Sands
a3355ffb3d Rather than having special rules like "intrinsics cannot
throw exceptions", just mark intrinsics with the nounwind
attribute.  Likewise, mark intrinsics as readnone/readonly
and get rid of special aliasing logic (which didn't use
anything more than this anyway).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44544 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 20:06:50 +00:00
Duncan Sands
6bb0ae4711 Small optimization of parameter attribute lookup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44458 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 18:20:58 +00:00
Duncan Sands
757d243167 Add a convenience method for modifying parameter
attributes.  While there, I noticed that not all
attribute methods returned a pointer-to-constant,
so I fixed that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44457 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 18:19:18 +00:00
Duncan Sands
a8b974648f Check that there are not more attributes than
function parameters.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44452 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 15:52:20 +00:00
Duncan Sands
fd8890dbee Small parameter attributes cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44433 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 08:30:15 +00:00
Duncan Sands
afa3b6da11 Add some convenience methods for querying attributes, and
use them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44403 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 17:07:01 +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
Duncan Sands
827cde1c83 Fix PR1816. If a bitcast of a function only exists because of a
trivial difference in function attributes, allow calls to it to
be converted to direct calls.  Based on a patch by Török Edwin.
While there, move the various lists of mutually incompatible
parameters etc out of the verifier and into ParameterAttributes.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44315 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 14:10:56 +00:00
Duncan Sands
ed4a2f1688 Rename the 'const' parameter attribute to 'readnone',
and the 'pure' parameter attribute to 'readonly'.
Names suggested by DannyB.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44273 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 20:23:04 +00:00
Duncan Sands
5e41f65699 In order for parameter attribute uniquing to make
any sense it is important that ParamAttr::None gets
treated the same as not supplying an attribute at
all.  Rather than stripping ParamAttr::None out of
the list of attributes, assert if ParamAttr::None
is seen.  Fix up the bitcode reader which liked to
insert ParamAttr::None all over the place.  Patch
based on one by Török Edwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44250 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-20 14:09:29 +00:00
Dan Gohman
50cdabcfd5 Remove meaningless qualifiers from return types, avoiding compiler warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44240 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-19 20:46:23 +00:00
Chris Lattner
b28a6dce6d print a call to a fastcc function as:
call x86_fastcallcc void @func( i32* %X, i64 0 )
not:
	callx86_fastcallcc  void @func( i32* %X, i64 0 )

This fixes Codegen/X86/fast-cc-merge-stack-adj.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44217 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-18 18:32:16 +00:00
Nate Begeman
b348d18caf Add support for vectors to int <-> float casts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44204 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-17 03:58:34 +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
Duncan Sands
c455ebeb0c I discover array_lengthof, thanks to gabor on #llvm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44139 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14 21:58:02 +00:00
Duncan Sands
0a4f91ea18 Simplify the attribute verification code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44116 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14 14:02:11 +00:00
Anton Korobeynikov
0adb7b41e7 Add pure/const attributes. Documentation will follow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44109 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-14 09:52:30 +00:00
Duncan Sands
d0561900f3 Don't barf on empty basic blocks. Do not rely on assert
doing something - this needs to work for release builds
too.  I chose to just abort rather than following the
fancy logic of abortIfBroken, because (1) it is a pain
to do otherwise, and (2) nothing is going to work if the
module is this broken.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43611 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 10:50:26 +00:00
Chris Lattner
b5c91641b5 remove verifier command line option: this should be part of the API, not
a command line optn.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43603 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 04:43:13 +00:00
Owen Anderson
765d64501c Now with less tabs!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43601 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 03:54:23 +00:00
Chris Lattner
e41dcdc964 Fix InstCombine/2007-10-31-StringCrash.ll by removing an obvious
(in hindsight) infinite recursion.  Simplify the code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43597 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 02:30:35 +00:00
Dan Gohman
2cda9399de Fix a regression in test/CodeGen/X86/2007-04-24-VectorCrash.ll introduced
by r43510. Gracefully handle constants with vector type that aren't
ConstantVector or ConstantAggregateZero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43579 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 21:36:31 +00:00
Owen Anderson
c570e33a61 Add a preverifier pass to check that every basic block ends in a terminator, so that we don't segfault when verifying invalid code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43578 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 21:04:18 +00:00
Dan Gohman
d61de35564 Add support for folding binary operators with vector zero operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43510 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30 19:00:49 +00:00
Chris Lattner
0569187653 I am not sure this is a good idea to be an option, but rename the option for
now.  It conflicts with clang's -pedantic flag.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43431 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29 03:14:55 +00:00
Anton Korobeynikov
536c64b4d6 Add 'pedantic' mode to verifier rejecting syntactically valid, but 'bad' due to other reasons code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43424 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-28 22:50:32 +00:00
Owen Anderson
d20cc14dbf Make DomTree and PostDomTree thin wrappers around DomTreeBase, rather than inheriting from it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43259 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-23 20:58:37 +00:00
Dan Gohman
ac72058dd6 The #include <iterator> isn't needed in this header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43232 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-22 20:44:10 +00:00
Chris Lattner
b7daa84a35 this doesn't need dynamic_cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43133 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-18 16:26:24 +00:00
Chris Lattner
fe3e3f4438 Reduce reliance on rtti info
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43130 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-18 16:11:18 +00:00