Граф коммитов

425 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner aaa210cf82 use the new optimized debug info metadata accessors. In
addition to the inherent win, this eliminates the pointless
cost of going through the name -> mdkind stringmap that we
were paying.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99983 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 03:36:01 +00:00
Bob Wilson b5896c3792 Revert Mon Ping's 99930 due to broken llvm-gcc buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99949 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 22:28:46 +00:00
Mon P Wang 3b5caa2065 Added support for address spaces and added a isVolatile field to memcpy, memmove, and memset
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99930 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-30 21:02:45 +00:00
Rafael Espindola d1a5c31b78 When given the magic class __cxxabiv1::__fundamental_type_info, produce
the typeinfo for the fundamental types.

Fixes PR6685.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99701 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-27 02:52:14 +00:00
Rafael Espindola f075b22964 revert 99311. Looks like it broke darwin bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99317 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 19:55:22 +00:00
Rafael Espindola 5fb12c6c8f Avoid producing implicit methods when we have a explicit template instantiation
declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99311 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 18:56:16 +00:00
Anders Carlsson 7270ee4cd4 Always emit associated thunks when emitting the function itself. Remove getVtableAddressPoint, it's not used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99252 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 04:31:31 +00:00
Anders Carlsson 13189d0a18 Rename MaybeEmitVtable to EmitVTableRelatedData in preparation for making it emit thunks as well.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99251 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 04:15:00 +00:00
Anders Carlsson af4403545a Rename CGVtableInfo to CodeGenVTables in preparation of adding another VTableInfo class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99250 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-23 04:11:45 +00:00
Daniel Dunbar efb0fa9e11 C++: Add support for -fno-use-cxa-atexit.
- So much typing, so little gain...

Also, rename the __cxx_global_initialization function just to match llvm-gcc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99039 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-20 04:15:41 +00:00
John McCall f746aa6a8f Change CodeGenModule to rely on the Module's symbol table instead of
shadowing it in the GlobalDeclMap.  Eliminates the string-uniquing
requirement for mangled names, which should help C++ codegen times a little.
Forces us to do string lookups instead of pointer lookups, which might hurt
codegen times a little across the board.  We'll see how it plays out.

Removing the string-uniquing requirement implicitly fixes any bugs like
PR6635 which arose from the fact that we had multiple uniquing tables for
different kinds of identifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99012 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-19 23:29:14 +00:00
Douglas Gregor 8f51a4f2d0 Give explicit template instantiations weak ODR linkage. Former
iterations of this patch gave explicit template instantiation
link-once ODR linkage, which permitted the back end to eliminate
unused symbols. Weak ODR linkage still requires the symbols to be
generated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98441 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 18:23:07 +00:00
Douglas Gregor 34fd284e0a Re-revert the explicit template instantiation linkage patch. I am beginning to look incompetent
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98425 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 03:49:57 +00:00
Douglas Gregor 8721360da5 Reinstate patch to turn explicit template instantiations into weak symbols
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98424 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-13 03:14:19 +00:00
Douglas Gregor 4ea9006629 Revert the linkage change for explicit template instantiations; something is amiss
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98332 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 05:13:59 +00:00
Douglas Gregor e5e0c9deb1 Give explicit template instantiations weak linkage (but don't defer
them). Fixes PR6578.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98328 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 04:49:06 +00:00
Rafael Espindola bbf58bb1b8 Delay codegen of vtables when handling implicit instantiations.
This fixes PR6474.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98123 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-10 02:19:29 +00:00
Benjamin Kramer d3a344c55b Add a message to these asserts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97873 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-06 09:07:19 +00:00
John McCall 6374c3307e Implement __builtin_dwarf_sp_column for i386 (Darwin and not), x86-64 (all),
and ARM.  Implement __builtin_init_dwarf_reg_size_table for i386 (both) and
x86-64 (all).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97859 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-06 00:35:14 +00:00
Rafael Espindola 6a836706c4 Fix PR6473.
Clang's support for weakref is now better than llvm-gcc's :-)

We don't introduce a new symbol and we correctly mark undefined references weak only if there is no
definition or regular undefined references in the same file.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97733 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 18:17:24 +00:00
John McCall 468ec6c026 Revert changes r97693, r97700, and r97718.
Our testing framework can't deal with disabled targets yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97719 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 04:29:44 +00:00
Fariborz Jahanian 4819ac44c0 Refactor local class name mangling and make it
ABI conforming.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97702 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 01:02:03 +00:00
John McCall c9fe644675 Create a TargetMachine whenever we create a CodeGenAction. The codegen of
some builtins will rely on target knowledge.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97693 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-04 00:23:29 +00:00
Rafael Espindola 7b9a5aa7c0 During codegen assert that any copy assignment, destructor or constructor that
we need to synthesize has been marked as used by Sema.

Change Sema to avoid these asserts.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97589 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-02 21:28:26 +00:00
Rafael Espindola 11e8ce7380 Add support for the weakref attribute. We still produce "alias weak" as llvm-gcc does, but are more strict on what uses of weakref we accept.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96992 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 22:00:30 +00:00
John McCall c0bf462cf3 Perform two more constructor/destructor code-size optimizations:
1) emit base destructors as aliases to their unique base class destructors
under some careful conditions.  This is enabled for the same targets that can
support complete-to-base aliases, i.e. not darwin.

2) Emit non-variadic complete constructors for classes with no virtual bases
as calls to the base constructor.  This is enabled on all targets and in
theory can trigger in situations that the alias optimization can't (mostly
involving virtual bases, mostly not yet supported).

These are bundled together because I didn't think it worthwhile to split them,
not because they really need to be.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96842 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-23 00:48:20 +00:00
John McCall d46f98573b Re-introduce the ctor/dtor alias optimization, this time hidden behind a
command-line option which defaults off.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96649 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-19 01:32:20 +00:00
John McCall 8e51a1f5da Revert the ctor/dtor alias optimization for now; the buildbots can detect
some failure here that I can't.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96612 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-18 21:31:48 +00:00
John McCall 92ac9ffecd Emit complete constructors and destructors as aliases to base constructors
and destructors when the two entities are semantically identical, i.e. when
the class has no virtual base classes.  We only do this for linkage types
for which aliases are supported, i.e. internal and external, i.e. not linkonce.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96451 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-17 03:52:49 +00:00
Ted Kremenek 3d2c43e9a7 Remove use of 'std::string' from Attr objects, using instead a byte
array allocated using the allocator in ASTContext.  This addresses
these strings getting leaked when using a BumpPtrAllocator (in
ASTContext).

Fixes: <rdar://problem/7636765>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95853 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 05:28:37 +00:00
John McCall 8878686242 Emit global references with constant initializers as constants. Fixes PR5585.
The standard actually says that such references should have internal linkage,
but gcc doesn't do that, so we probably can't get away with it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95577 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-08 21:46:50 +00:00
Anders Carlsson 39de84d671 Improved handling of the visibility attribute. Declarations now inherit their parent's visibility.
(This is kind of a risky change, but I did a self-host build and everything appears to work fine!)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95511 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-07 01:44:36 +00:00
Douglas Gregor a9a55c063e Switch CodeGen's "is this variable declaration a definition?" logic
over to VarDecl::isThisDeclarationADefinition(), which handles
variables declared with linkage specifications better (among other
things). CMake 2.9 (from CVS) now builds with clang++ and is somewhat
functional.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95486 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06 05:15:45 +00:00
Anders Carlsson b2bcf1c176 Use the correct function info for constructors when applying function attributes. Fixes PR6245.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95474 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-06 02:44:09 +00:00
Douglas Gregor 0b6bc8bd7a When a function or variable somehow depends on a type or declaration
that is in an anonymous namespace, give that function or variable
internal linkage.

This change models an oddity of the C++ standard, where names declared
in an anonymous namespace have external linkage but, because anonymous
namespace are really "uniquely-named" namespaces, the names cannot be
referenced from other translation units. That means that they have
external linkage for semantic analysis, but the only sensible
implementation for code generation is to give them internal
linkage. We now model this notion via the UniqueExternalLinkage
linkage type. There are several changes here:

  - Extended NamedDecl::getLinkage() to produce UniqueExternalLinkage
    when the declaration is in an anonymous namespace.
  - Added Type::getLinkage() to determine the linkage of a type, which
    is defined as the minimum linkage of the types (when we're dealing
    with a compound type that is not a struct/class/union).
  - Extended NamedDecl::getLinkage() to consider the linkage of the
    template arguments and template parameters of function template
    specializations and class template specializations.
  - Taught code generation to rely on NamedDecl::getLinkage() when
    determining the linkage of variables and functions, also
    considering the linkage of the types of those variables and
    functions (C++ only). Map UniqueExternalLinkage to internal
    linkage, taking out the explicit checks for
    isInAnonymousNamespace().

This fixes much of PR5792, which, as discovered by Anders Carlsson, is
actually the reason behind the pass-manager assertion that causes the
majority of clang-on-clang regression test failures. With this fix,
Clang-built-Clang+LLVM passes 88% of its regression tests (up from
67%). The specific numbers are:

LLVM:
  Expected Passes    : 4006
  Expected Failures  : 32
  Unsupported Tests  : 40
  Unexpected Failures: 736

Clang:
  Expected Passes    : 1903
  Expected Failures  : 14
  Unexpected Failures: 75

Overall:
  Expected Passes    : 5909
  Expected Failures  : 46
  Unsupported Tests  : 40
  Unexpected Failures: 811

Still to do:
  - Improve testing
  - Check whether we should allow the presence of types with
  InternalLinkage (in addition to UniqueExternalLinkage) given
  variables/functions internal linkage in C++, as mentioned in
  PR5792. 
  - Determine how expensive the getLinkage() calls are in practice;
  consider caching the result in NamedDecl.
  - Assess the feasibility of Chris's idea in comment #1 of PR5792.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95216 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03 09:33:45 +00:00
Chris Lattner b9f709665a Don't explicitly force utf strings into the __TEXT,__ustring
by setting the section of the generated global.  This is an
optimization done by the code generator, and the code being
removed didn't handle the case when the string contained an
embedded nul (which the code generator does correctly 
handle).  This is rdar://7589850



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95003 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 20:59:08 +00:00
Sebastian Redl 31310a21fb In C++, an initializer on a variable doesn't necessarily mean it's the definition. With that in mind, rename getDefinition to getAnyInitializer (to distinguish it from getInit) and reimplement it in terms of isThisDeclarationADefinition. Update all code to use this new function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94999 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-01 20:16:42 +00:00
Ken Dyck 8b752f10c3 Change the return type of ASTContext::getDeclAlignInBytes() to CharUnits and,
now that the "InBytes" part of the name is implied by the return type, rename
it to getDeclAlign().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94681 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-27 17:10:57 +00:00
Ken Dyck 4da244c23d Use CharUnits for alignment of UTF16 string in GetAddrOfConstantCFString().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94564 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 18:46:23 +00:00
Anders Carlsson 3bb92693c3 Use the right definition when emitting a global variable. Fixes PR5564.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94555 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 17:43:42 +00:00
Ken Dyck 687cc4a850 Introduce CodeGenModule::GetTargetTypeStoreSize() to calculate the store size
of LLVM types in character units.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94542 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 13:48:07 +00:00
Anders Carlsson d0c4792ca6 If a global variable has an initializer with side effects, it can never be deferred (even if it's in an anonymous namespace).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94525 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-26 06:15:16 +00:00
David Chisnall 0d13f6fdbd Created __builtin___NSStringMakeConstantString() builtin, which generates constant Objective-C strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94274 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-23 02:40:42 +00:00
Anton Korobeynikov 82d0a418c8 Generalize target weirdness handling having proper layering in mind:
1. Add helper class for sema checks for target attributes
 2. Add helper class for codegen of target attributes

As a proof-of-concept - implement msp430's 'interrupt' attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93118 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-10 12:58:08 +00:00
Chris Lattner 031421bc8f revert r92749, which is just dead code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93074 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-09 21:14:47 +00:00
Eli Friedman 6c6bda3b0b Fix for PR5967: Make const-marking for LLVM globals correct for cases requiring
run-time initialization, and emit run-time initializers aggresively to avoid
ordering issues with deferred globals.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92976 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-08 00:50:11 +00:00
Douglas Gregor dffb8010a1 Fix linkage for RTTI names by re-using the logic for computing the
linkage of vtables. Before this, we were emitting RTTI names for
template instantiations with strong external linkage rather than with
weak ODR linkage.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92857 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 22:00:56 +00:00
Douglas Gregor 4b0f21c0f8 Fix marking of virtual members for nested classes whose first non-pure virtual function has a body inlined in the class
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92855 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-06 20:27:16 +00:00
Douglas Gregor bd6d6197fc Improve key-function computation for templates. In particular:
- All classes can have a key function; templates don't change that.
  non-template classes when computing the key function.
  - We always mark all of the virtual member functions of class
  template instantiations. 
  - The vtable for an instantiation of a class template has weak
  linkage. 

We could probably use available_externally linkage for vtables of
classes instantiated by explicit instantiation declarations (extern
templates), but GCC doesn't do this and I'm not 100% that the ABI
permits it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92753 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 19:06:31 +00:00
Mike Stump ef372018c2 Add code to skip the emission of available externally functions at -O0. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92749 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 18:48:04 +00:00