Commit Graph

195 Commits

Author SHA1 Message Date
Cameron Zwarich
1335022e19 Fix a regression caused by r102515 where explicit alignment on globals is
ignored. There was a test to catch this, but it was just blindly updated in
a large change. This fixes another part of <rdar://problem/9275290>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129466 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 20:36:04 +00:00
Cameron Zwarich
eb04a33dc7 Fix an obvious problem with an alignment computation. AsmPrinter actually does
the max itself, so it is not easy to write a test case for this, but I added a
test case that would fail if the code in AsmPrinter were removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129432 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 09:02:43 +00:00
Cameron Zwarich
d8b88d8558 If a global variable has a specified alignment that is less than the preferred
alignment for its type, use the minimum of the specified alignment and the ABI
alignment. This fixes <rdar://problem/9275290>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129428 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13 06:03:16 +00:00
Michael J. Spencer
1f6efa3996 Merge System into Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 18:16:10 +00:00
Owen Anderson
081c34b725 Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which
must be called in the pass's constructor.  This function uses static dependency declarations to recursively initialize
the pass's dependencies.

Clients that only create passes through the createFooPass() APIs will require no changes.  Clients that want to use the
CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
before parsing commandline arguments.

I have tested this with all standard configurations of clang and llvm-gcc on Darwin.  It is possible that there are problems
with the static dependencies that will only be visible with non-standard options.  If you encounter any crash in pass
registration/creation, please send the testcase to me directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116820 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 17:21:58 +00:00
Michael J. Spencer
87b8665878 Fix Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116800 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 07:32:42 +00:00
Owen Anderson
ce665bd2e2 Now with fewer extraneous semicolons!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 22:25:06 +00:00
Dale Johannesen
29fc6f35a5 Add x86MMX a few more places.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113914 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 00:52:23 +00:00
Dale Johannesen
bb811a2445 Add X86 MMX type to bitcode and Type.
(The Ada bindings probably need it too, but all the
obvious places to change say "do not edit this file".)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113618 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 20:55:01 +00:00
Chris Lattner
61c70e98ac remove unions from LLVM IR. They are severely buggy and not
being actively maintained, improved, or extended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112356 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 04:09:24 +00:00
Dan Gohman
b68f274b6d Don't use unsigned char for alignments in TargetData. There aren't
that many of these things, so the memory savings isn't significant,
and there are now situations where there can be alignments greater
than 128.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110836 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 18:15:01 +00:00
Owen Anderson
90c579de5a Reapply r110396, with fixes to appease the Linux buildbot gods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 18:33:48 +00:00
Owen Anderson
1f74590e9d Revert r110396 to fix buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-06 00:23:35 +00:00
Owen Anderson
9ccaf53ada Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier.  Clean up APIs related to this change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05 23:42:04 +00:00
Dan Gohman
67d0498d53 Do GEP offset calculations with unsigned math rather than signed math
to avoid undefined behavior on overflow, noticed by John Regehr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109594 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 17:11:36 +00:00
Owen Anderson
d13db2c59c Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109045 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-21 22:09:45 +00:00
Dan Gohman
6e8fd90602 Change TargetData's algorithm for computing defualt vector type
alignment to match what's used in clang and GCC for __alignof, rather
than trying to guess what Legalize is going to be doing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102206 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 19:41:15 +00:00
Chris Lattner
34e9d17d1b fix PR6332, allowing an index of zero into a zero sized array
even if the element of the array has no size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101662 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 19:02:33 +00:00
Chris Lattner
75361b69f3 rename llvm::llvm_report_error -> llvm::report_fatal_error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100709 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-07 22:58:41 +00:00
Dan Gohman
f860db2398 Revert the recent alignment changes. They're broken for -Os because,
in particular, they end up aligning strings at 16-byte boundaries, and
there's no way for GlobalOpt to check OptForSize.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100172 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 03:04:37 +00:00
Dan Gohman
04d52f8435 Change variables which are exactly 16 bytes to be 16-byte-aligned too.
This fixes test/Transforms/GlobalOpt/gv-align.ll.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100161 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-02 00:46:07 +00:00
Chris Lattner
93b122d3c4 reapply r98656 unmodified, which exposed the asmprinter not
handling constant unions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98680 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 21:25:55 +00:00
Daniel Dunbar
b85c7100c5 Revert r98656, its breaking all over the place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98662 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 19:35:34 +00:00
Chris Lattner
8b3b34f410 improve support for uniontype and ConstantUnion, patch by Tim Northover!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98656 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-16 19:15:03 +00:00
Dan Gohman
aa9d854b33 Revert r97064. Duncan pointed out that bitcasts are defined in
terms of store and load, which means bitcasting between scalar
integer and vector has endian-specific results, which undermines
this whole approach.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97137 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-25 15:20:39 +00:00
Dan Gohman
c382bc3c0f Make getTypeSizeInBits work correctly for array types; it should return
the number of value bits, not the number of bits of allocation for in-memory
storage.

Make getTypeStoreSize and getTypeAllocSize work consistently for arrays and
vectors.

Fix several places in CodeGen which compute offsets into in-memory vectors
to use TargetData information.

This fixes PR1784.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97064 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-24 22:05:23 +00:00
Duncan Sands
1df9859c40 There are two ways of checking for a given type, for example isa<PointerType>(T)
and T->isPointerTy().  Convert most instances of the first form to the second form.
Requested by Chris.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96344 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-16 11:11:14 +00:00
Chris Lattner
da63b3ad63 add a method to get the alignment of an integer type even
when we don't have one laying around.  Useful if you don't
have an llvmcontext handy.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94468 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-25 23:18:11 +00:00
Chris Lattner
551dec592f finish cleaning up StructLayoutMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91612 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 20:00:21 +00:00
Bill Wendling
740266269b Calling InvalidateEntry during the refinement was breaking the bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90656 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-05 07:59:04 +00:00
Bill Wendling
32bc2362a1 Final cleanups:
- Privatize a typedef.
- Call the InvalidateEntry when refining a type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90655 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-05 07:46:49 +00:00
Bill Wendling
688da28687 Inline methods which are called only once.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-05 01:46:01 +00:00
Bill Wendling
5681689795 Refactor some code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90639 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-05 01:43:33 +00:00
Bill Wendling
1500c4f49a Some code cleanup. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 21:03:02 +00:00
Bill Wendling
cb06403145 Revert r90371. It was causing build failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90383 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 01:54:07 +00:00
Bill Wendling
b8e675c3c1 Further improvements: refactoring code that does the same thing into one
function, converting "dyn_cast" to "cast", asserting the correct things, and
other general cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90371 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 01:15:46 +00:00
Chris Lattner
35e86af8e5 remove some dead std::ostream using code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 00:55:04 +00:00
Chris Lattner
7896c9f436 improve portability to avoid conflicting with std::next in c++'0x.
Patch by Howard Hinnant!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90365 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 00:50:42 +00:00
Bill Wendling
dd5eb02304 This initial code is meant to convert TargetData to use an AbstractTypesUser so
that it doesn't have dangling pointers when abstract types are resolved. This
modifies it somewhat to address comments: making the "StructLayoutMap" an
anonymous structure, calling "removeAbstractTypeUser" when appropriate, and
adding asserts where helpful.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-03 00:17:12 +00:00
Bill Wendling
5eea342673 The llvm-gcc front-end and the pass manager use two separate TargetData objects.
This is probably not confined to *just* these two things.

Anyway, the llvm-gcc front-end may look up the structure layout information for
an abstract type. That information will be stored into a table with the FE's
TD. Instruction combine can come along and also ask for information on that
abstract type, but for a separate TD (the one associated with the pass manager).

After the type is refined, the old structure layout information in the pass
manager's TD file is out of date. If a new type is allocated in the same space
as the old-unrefined type, then the structure type information in the pass
manager's TD file will be wrong, but won't know it.

Fix this by making the TD's structure type information an abstract type user.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89176 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-18 01:03:56 +00:00
Chris Lattner
7e89738f98 Make TargetData::getStringRepresentation spit out native integer types,
this gives llvm-gcc generated modules the right data.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86435 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-08 02:32:01 +00:00
Chris Lattner
e82bdc4809 add the ability for TargetData to return information about legal integer
datatypes on a given CPU.  This is intended to allow instcombine and other
transformations to avoid converting big sequences of operations to an
inconvenient width, and will help clean up after SRoA.  See also "Adding 
legal integer sizes to TargetData" on Feb 1, 2009 on llvmdev, and PR3451.

Comments welcome.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 09:35:34 +00:00
Chris Lattner
2e07494170 more cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86369 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 09:23:04 +00:00
Chris Lattner
b7aadfac5e rewrite TargetData to use StringRef/raw_ostream instead of thrashing std::strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-07 09:13:23 +00:00
Owen Anderson
9085750d31 Try again at privatizing the layout info map, with a rewritten patch.
This preserves the existing behavior much more closely than my previous attempt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79663 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-21 19:59:12 +00:00
Owen Anderson
2ea20154ce Re-revert r79555. Apparently it's not just buildbot weirdness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79578 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20 23:51:44 +00:00
Owen Anderson
28998d1806 Reapply r79555 for testing. Daniel's trying to work out some buildbot weirdnesss.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79572 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20 23:14:20 +00:00
Bill Wendling
607abd262e --- Reverse-merging r79555 into '.':
U    include/llvm/Target/TargetData.h
U    lib/Target/TargetData.cpp

Temporarily revert 79555. It was causing hangs and test failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20 22:04:42 +00:00
Owen Anderson
d9b207122e Make the StructType->StructLayout table private to TargetData, allowing us to avoid locking on it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79555 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20 18:26:03 +00:00
Dan Gohman
d35626e8bb Update and fix some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79532 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-20 16:27:10 +00:00