Commit Graph

67 Commits

Author SHA1 Message Date
Hans Wennborg ac9fb36c31 Clean-up after r159077.
Remove temporary GlobalVariable constructors now that Clang has been
updated (r159078).

llvm-svn: 159079
2012-06-23 12:14:23 +00:00
Hans Wennborg cbe34b4cc9 Extend the IL for selecting TLS models (PR9788)
This allows the user/front-end to specify a model that is better
than what LLVM would choose by default. For example, a variable
might be declared as

  @x = thread_local(initialexec) global i32 42

if it will not be used in a shared library that is dlopen'ed.

If the specified model isn't supported by the target, or if LLVM can
make a better choice, a different model may be used.

llvm-svn: 159077
2012-06-23 11:37:03 +00:00
Jay Foad 7f4cd9e678 Micro-optimisation in getAliasedGlobal.
llvm-svn: 136610
2011-08-01 12:28:01 +00:00
Chris Lattner 229907cd11 land David Blaikie's patch to de-constify Type, with a few tweaks.
llvm-svn: 135375
2011-07-18 04:54:35 +00:00
Chris Lattner 81210d232d Fix GlobalValue::isDeclaration() to always consider aliases to be definitions.
llvm-svn: 135182
2011-07-14 20:22:18 +00:00
Chris Lattner 8561721bce add comments.
llvm-svn: 135164
2011-07-14 18:12:44 +00:00
Chris Lattner 923053a1d6 consolidate GlobalValue::isDeclaration into one
non-virtual function.

llvm-svn: 135163
2011-07-14 18:10:41 +00:00
Chris Lattner 79617815c8 code cleanup
llvm-svn: 135157
2011-07-14 18:01:49 +00:00
Chris Lattner b1ed91f397 Land the long talked about "type system rewrite" patch. This
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.

llvm-svn: 134829
2011-07-09 17:41:24 +00:00
Chris Lattner 8488640da7 hoist GlobalValue::removeDeadConstantUsers up to being a method on Constant.
llvm-svn: 125828
2011-02-18 04:41:42 +00:00
Dan Gohman 390914cbe8 Make GlobalValue alignment consistent with load, store, and alloca
alignment, fixing silent truncation of alignment values.

llvm-svn: 109653
2010-07-28 20:56:48 +00:00
Gabor Greif c78d720f02 rename use_const_iterator to const_use_iterator for consistency's sake
llvm-svn: 99564
2010-03-25 23:06:16 +00:00
Nick Lewycky 780d2fe319 A function with no Module owner isn't materializable. This fixes F->dump() for
functions not embedded within modules.

llvm-svn: 96272
2010-02-15 21:27:20 +00:00
Jeffrey Yasskin 091217be6f Kill ModuleProvider and ghost linkage by inverting the relationship between
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
GlobalValues now, and doesn't provide modules, it's renamed to
"GVMaterializer". Code that used to need a ModuleProvider to materialize
Functions can now materialize the Functions directly. Functions no longer use a
magic linkage to record that they're materializable; they simply ask the
GVMaterializer.

Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
the functions that refer to it. Instead, because Module now exposes the same
functionality ModuleProvider used to, we store a Module* in any
LLVMModuleProviderRef and translate in the wrapper methods.  The bindings to
other languages still use the ModuleProvider concept.  It would probably be
worth some time to update them to follow the C++ more closely, but I don't
intend to do it.

Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.

llvm-svn: 94686
2010-01-27 20:34:15 +00:00
Jeffrey Yasskin 7c57c41d5f In GlobalVariable::setInitializer, assert that the initializer has the
right type.

llvm-svn: 89014
2009-11-17 00:43:13 +00:00
Chris Lattner 46b5c642b9 remove a bunch of extraneous LLVMContext arguments
from various APIs, addressing PR5325.

llvm-svn: 86231
2009-11-06 04:27:31 +00:00
Chris Lattner 253bc77513 the verifier shouldn't modify the IR.
llvm-svn: 85722
2009-11-01 18:11:50 +00:00
Chris Lattner 274717419c fix an issue where the verifier would reject a function whose entry
block had its address taken even if the blockaddress was dead.

llvm-svn: 85706
2009-11-01 04:08:01 +00:00
Owen Anderson 4056ca9568 Move types back to the 2.5 API.
llvm-svn: 77516
2009-07-29 22:17:13 +00:00
Daniel Dunbar d43b86d4a4 Finish migrating VMCore to StringRef/Twine based APIs.
llvm-svn: 77051
2009-07-25 06:02:13 +00:00
Daniel Dunbar 4975db6276 Initial update to VMCore to use Twines for string arguments.
- The only meat here is in Value.{h,cpp} the rest is essential 'const
   std::string &' -> 'const Twine &'.

llvm-svn: 77048
2009-07-25 04:41:11 +00:00
Dan Gohman 1ddf98ad8e Convert a few more things to use raw_ostream.
llvm-svn: 77039
2009-07-25 01:43:01 +00:00
Torok Edwin fbcc663cbf llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Owen Anderson 785c56ce1d LLVMContext-ification.
llvm-svn: 75072
2009-07-08 23:50:31 +00:00
Torok Edwin fb8d6d5b58 Implement changes from Chris's feedback.
Finish converting lib/Target.

llvm-svn: 75043
2009-07-08 20:53:28 +00:00
Owen Anderson b17f32945f Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
llvm-svn: 75025
2009-07-08 19:03:57 +00:00
Torok Edwin 6dd2730024 Start converting to new error handling API.
cerr+abort -> llvm_report_error
assert(0)+abort -> LLVM_UNREACHABLE (assert(0)+llvm_unreachable-> abort() included)

llvm-svn: 75018
2009-07-08 18:01:40 +00:00
Owen Anderson 5948fdf68b Push LLVMContext through GlobalVariables and IRBuilder.
llvm-svn: 74985
2009-07-08 01:26:06 +00:00
Owen Anderson 0d2de8c35e Revert r73790, and replace it with a significantly less ugly solution. Rather than trying to make the global reader-writer lock work,
create separate recursive mutexes for each value map.  The recursive-ness fixes the double-acquiring issue, which having one per ValueMap
lets us continue to maintain some concurrency.

llvm-svn: 73801
2009-06-20 00:24:58 +00:00
Owen Anderson b07dd959a4 Fix a serious bug that would cause deadlock during abstract type refinement. The constant creation
gets involved, and we end up trying to recursively acquire a writer lock.  The fix for this is slightly horrible,
and involves passing a boolean "locked" parameter around in Constants.cpp, but it's better than having locked and
unlocked versions of most of the code.

llvm-svn: 73790
2009-06-19 23:16:19 +00:00
Chris Lattner 6f884e07c5 make GlobalValue::removeDeadConstantUsers() const.
llvm-svn: 66403
2009-03-09 05:50:45 +00:00
Duncan Sands 715b2897d8 Use mayBeOverridden here, in anticipation of the
day when more linkage types will be handled.

llvm-svn: 61944
2009-01-08 20:55:49 +00:00
Anton Korobeynikov 1a1140429e Make safer variant of alias resolution routine to be default
llvm-svn: 56005
2008-09-09 20:05:04 +00:00
Anton Korobeynikov 4e518041d3 Fix typo
llvm-svn: 55998
2008-09-09 18:24:07 +00:00
Anton Korobeynikov ac2c655808 Fix incorrect linker behaviour: we shouldn't resolve weak aliases.
llvm-svn: 55997
2008-09-09 18:23:48 +00:00
Gabor Greif 2d3024d838 eliminate calls to deprecated Use::init() interface
llvm-svn: 51570
2008-05-26 21:33:52 +00:00
Duncan Sands dd7daee850 Factor code to copy global value attributes like
the section or the visibility from one global
value to another: copyAttributesFrom.  This is
particularly useful for duplicating functions:
previously this was done by explicitly copying
each attribute in turn at each place where a
new function was created out of an old one, with
the result that obscure attributes were regularly
forgotten (like the collector or the section).
Hopefully now everything is uniform and nothing
is forgotten.

llvm-svn: 51567
2008-05-26 19:58:59 +00:00
Gabor Greif f6caff66a1 merge of use-diet branch to trunk
llvm-svn: 50943
2008-05-10 08:32:32 +00:00
Anton Korobeynikov 2fb3897f1b Slightly increase default set size. It's cheap and won't hurt.
llvm-svn: 48682
2008-03-22 07:48:40 +00:00
Anton Korobeynikov da7db7d9a1 Add helper for ultimate aliasee resoltion
llvm-svn: 48255
2008-03-11 22:28:56 +00:00
Chris Lattner f3ebc3f3d2 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Christopher Lamb 54dd24c2a7 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.

llvm-svn: 44858
2007-12-11 08:59:05 +00:00
Chris Lattner c2d0530030 handle gep aliasee
llvm-svn: 36815
2007-05-05 23:49:02 +00:00
Jeff Cohen ee7bf76342 Unbreak VC++ build.
llvm-svn: 36700
2007-05-03 22:09:21 +00:00
Anton Korobeynikov a30bc8fccf Fix typo. Interesting, but old variant worked too :)
llvm-svn: 36588
2007-04-30 10:28:40 +00:00
Anton Korobeynikov 546ea7ea88 Implement review feedback
llvm-svn: 36564
2007-04-29 18:02:48 +00:00
Anton Korobeynikov b18f8f85e9 Implement review feedback. Aliasees can be either GlobalValue's or
bitcasts of them.

llvm-svn: 36537
2007-04-28 13:45:00 +00:00
Anton Korobeynikov a97b694c82 Implement aliases. This fixes PR1017 and it's dependent bugs. CFE part
will follow.

llvm-svn: 36435
2007-04-25 14:27:10 +00:00
Lauro Ramos Venancio 749e4668e7 Implement the "thread_local" keyword.
llvm-svn: 35950
2007-04-12 18:32:50 +00:00
Chris Lattner dd89d9c648 reapply my previous patch with a bugfix.
llvm-svn: 34627
2007-02-26 05:02:39 +00:00