Chris Lattner
ddf6ca0355
the __gnuc_inline__ attribute is actually named __gnu_inline__,
...
PR4023
llvm-svn: 69618
2009-04-20 19:12:28 +00:00
Eli Friedman
4f856744e5
PR3853: Add CodeGen support for __thread.
...
llvm-svn: 69545
2009-04-19 21:05:03 +00:00
Chris Lattner
5f65cc8215
silence a warning, it isn't clear what the right answer is here,
...
will talk to steve.
llvm-svn: 69519
2009-04-19 06:59:18 +00:00
Douglas Gregor
e3dcb2ddd1
FunctionDecl::getBody() is getting an ASTContext argument for use in
...
lazy PCH deserialization. Propagate that argument wherever it needs to
be. No functionality change, except that I've tightened up a few PCH
tests in preparation.
llvm-svn: 69406
2009-04-18 00:02:19 +00:00
Anders Carlsson
eaa28f7e18
Add support for generating (very basic) C++ destructors. These aren't called by anything yet.
...
llvm-svn: 69343
2009-04-17 01:58:57 +00:00
Daniel Dunbar
c3e7cff6d3
Attributes on block functions were not being set.
...
- <rdar://problem/6800351> clang not producing correct large struct
return code for Blocks
llvm-svn: 69337
2009-04-17 00:48:04 +00:00
Daniel Dunbar
426b5cf16a
Ensure that the most recent declaration of a tentative definition wins
...
when generating a common definition.
llvm-svn: 69287
2009-04-16 15:34:14 +00:00
Daniel Dunbar
7dd749e6fd
Defer generation of tentative definitions.
...
- PR3980.
- <rdar://problem/6762287> [irgen] crash when generating tentative
definition of incomplete structure
- This also avoids creating common definitions for things which are
later overwritten.
- XFAIL'ed external-defs.c, it isn't completing types properly yet.
llvm-svn: 69231
2009-04-15 22:08:45 +00:00
Anders Carlsson
f747524819
Start attempting to generate code for C++ ctors.
...
llvm-svn: 69168
2009-04-15 15:55:24 +00:00
Daniel Dunbar
346892aafc
Comment fix.
...
llvm-svn: 69091
2009-04-14 22:41:13 +00:00
Chris Lattner
bae0e68930
Fix PR3988: extern inline functions get strong symbol definitions in
...
C99 mode. This is a regression from an earlier patch of mine.
This also simplifies the linkage enums a bit.
llvm-svn: 69069
2009-04-14 20:25:53 +00:00
Chris Lattner
02e987f3e8
implement codegen support for __attribute((__gnuc_inline__)),
...
pulling some attribute munging stuff into GetLinkageForFunction.
This should fix PR3986
llvm-svn: 69045
2009-04-14 16:44:36 +00:00
Daniel Dunbar
389325715b
Refactor how attributes are set on values.
...
- Pull out SetCommonAttributes, which handles the things common to
aliases, methods, functions, and variables.
- Pull out SetLLVMFunctionAttributesForDefinition, which handles the
LLVM attributes which we only want to apply to a definition (like
noinline and alwaysinline).
- Kill SetGVDeclarationAttributes (inlined into SetFunctionAttributes
and specialized).
- Kill SetFunctionAttributesForDefinition (inlined into sole caller).
- Inline SetGVDefinitionAttributes into SetMethodAttributes and
specialize.
- Rename SetGVDefinitionAttributes to SetFunctionDefinitionAttributes.
This is supposed to be a no functionality change commit, but I may
have made a mistake.
llvm-svn: 69036
2009-04-14 08:05:55 +00:00
Daniel Dunbar
81a3f1bdf3
Split SetGlobalValueAttributes into definition/declaration halves.
...
- No functionality change.
llvm-svn: 69035
2009-04-14 07:19:20 +00:00
Daniel Dunbar
aeddffc99d
Rename (one) SetFunctionAttributes to SetLLVMFunctionAttributes to
...
disambiguate it.
- No functionality change.
llvm-svn: 69034
2009-04-14 07:08:30 +00:00
Daniel Dunbar
64a41cb39e
Reduce indentation, no functionality change.
...
llvm-svn: 69033
2009-04-14 07:02:17 +00:00
Chris Lattner
92028dad66
defer emission of always_inline, extern_inline, and inline functions (when
...
not in c89 mode).
llvm-svn: 69032
2009-04-14 06:44:48 +00:00
Chris Lattner
169a5c963f
give always_inline functions internal linkage. If they cannot be
...
inlined for some reason, then we don't want a strong or even weak
definition.
llvm-svn: 69031
2009-04-14 06:32:05 +00:00
Chris Lattner
256c9507c8
set the linkage of an inline function according to its language rules.
...
llvm-svn: 69030
2009-04-14 06:27:57 +00:00
Daniel Dunbar
29eff88fc8
Add a comment on SetGlobalValueAttributes.
...
llvm-svn: 69029
2009-04-14 06:19:49 +00:00
Chris Lattner
3e031f4121
add a new enum type for linkage, no functionality change.
...
llvm-svn: 69028
2009-04-14 06:04:17 +00:00
Daniel Dunbar
f5f359fb73
Clean up handling of visibility.
...
llvm-svn: 69027
2009-04-14 06:00:08 +00:00
Chris Lattner
73920ce565
reduce indentation, no functionality change.
...
llvm-svn: 69026
2009-04-14 05:33:52 +00:00
Chris Lattner
6a0f907a5e
do not set visibility on "private" or "available externally" linkage objects.
...
llvm-svn: 69025
2009-04-14 05:27:13 +00:00
Daniel Dunbar
4184ac847f
Update to use hasAttr() instead of getAttr().
...
- No functionality change.
llvm-svn: 68987
2009-04-13 21:08:27 +00:00
Steve Naroff
fb46e8658c
Move/update recent FIXME (wrt UTF-8 checking for ObjC @-strings).
...
llvm-svn: 68982
2009-04-13 20:26:29 +00:00
Steve Naroff
84073ec51f
Fixed crasher in <rdar://problem/6780904> [irgen] Assertion failed: (Result == conversionOK && "UTF-8 to UTF-16 conversion failed"), function GetAddrOfConstantCFString, file CodeGenModule.cpp, line 1063.
...
Still a diagnostic related FIXME (will discuss with Daniel/Fariborz offline).
llvm-svn: 68975
2009-04-13 19:08:08 +00:00
Daniel Dunbar
d272cca527
Internal variables could mistakenly have "hidden" visibility when
...
their emission was deferred.
- <rdar://problem/6775234> variables with internal linkage should not
be exposed with -fvisibility=hidden.
llvm-svn: 68818
2009-04-10 20:26:50 +00:00
Chris Lattner
5286e774ee
reject codegen of __thread variables as unimplemented, rdar://6775265
...
llvm-svn: 68755
2009-04-10 00:35:59 +00:00
Douglas Gregor
bcced4ec31
Propagate the ASTContext to various AST traversal and lookup functions.
...
No functionality change (really).
llvm-svn: 68726
2009-04-09 21:40:53 +00:00
Anders Carlsson
80f97ab08f
Add a destination type argument to EmitConstantExpr. This will be used for when the destination has a reference type. (No functionality change yet)
...
llvm-svn: 68593
2009-04-08 04:48:15 +00:00
Daniel Dunbar
ea10ab668f
Visibility attributes should only be set on definition.
...
llvm-svn: 68561
2009-04-07 22:36:33 +00:00
Daniel Dunbar
15894b791b
Various fixes to symbols used for Obj-C x86_64 metadata.
...
- Changed method names to match gcc (categories names still aren't
mangled in).
- Expose correct name for class and metadata symbols (although
-fvisibility=hidden isn't yet correct).
- Remove several things from llvm.used that didn't need to be there
(I suspect this can still be trimmed).
- Don't use asm-prefix extension for _objc_empty_{cache,vtable} (not
needed).
- Hide EH type class info with -fvisibility=hidden
- Change setGlobal[Option]Visibility to not change the visibility of
functions with internal linkage.
llvm-svn: 68510
2009-04-07 05:48:37 +00:00
Anders Carlsson
468fa6366b
Add some basic support for generating C++ member functions.
...
llvm-svn: 68425
2009-04-04 20:47:02 +00:00
Anton Korobeynikov
c847824e8e
Basic support for regparm codegen
...
llvm-svn: 68414
2009-04-04 00:49:24 +00:00
Steve Naroff
55a719835d
Add a comment/FIXME so Eli can sleep better:-))
...
llvm-svn: 68379
2009-04-03 09:44:50 +00:00
Fariborz Jahanian
befc9dfbff
Implement -fvisibility.
...
llvm-svn: 68369
2009-04-03 03:28:57 +00:00
Daniel Dunbar
fd6cfcffa2
Add target hook for setting symbol prefix and section of unicode
...
string literals.
llvm-svn: 68363
2009-04-03 00:57:44 +00:00
Anders Carlsson
cbaeb9e633
Emit code for linkage specifications.
...
llvm-svn: 68300
2009-04-02 05:55:18 +00:00
Steve Naroff
8d816d6cb5
CodeGenModule::GetAddrOfConstantCFString():
...
- Finish up support for converting UTF8->UTF16 to support ObjC @"string" constants.
Remove warning from CheckObjCString.
As the FIXME in the test case indicates, I still have a bug to work out (apparently with \u handling).
llvm-svn: 68245
2009-04-01 21:16:31 +00:00
Steve Naroff
29cae66bde
Add ConvertUTF module from http://www.unicode.org/Public/PROGRAMS/CVTUTF .
...
#ifdef'd out the 5 conversion routines that we don't currently need.
Still need a bit more work in GetAddrOfConstantCFString(). Added a FIXME to indicate this.
Expect to remove the FIXME today...
llvm-svn: 68208
2009-04-01 15:50:34 +00:00
Steve Naroff
e14b368fa9
More "prep" work for handling UTF16 CFString.
...
Patch by Jean-Daniel Dupas. Thanks!
llvm-svn: 68203
2009-04-01 13:55:36 +00:00
Chris Lattner
d18136a644
fix the two xfails I added with a previous patch by making ObjC interface
...
types get completed when their definition is seen if previously laid out by
the code generator.
llvm-svn: 68177
2009-04-01 02:36:43 +00:00
Chris Lattner
6483908957
move trivial forwarding function inline.
...
llvm-svn: 68176
2009-04-01 02:08:13 +00:00
Anders Carlsson
237f349073
Implement code generation of namespaces and add mangling tests.
...
llvm-svn: 68170
2009-04-01 00:58:25 +00:00
Daniel Dunbar
08b216abf1
Add Target hooks for IRgen of [cf]string literals.
...
- Notably, set section on cfstring literal string data (for now, this
is done everywhere because it matches what we were already doing
for the CFString data itself)
- <rdar://problem/6599098> [irgen] linker requires objc string data
to go into cstring
llvm-svn: 68160
2009-03-31 23:42:16 +00:00
Chris Lattner
f41e87f4cd
Change UsedArray to be a vector of WeakVH to fix a dangling pointer problem that occurs when
...
attribute(used) and asm renaming are used together.
llvm-svn: 68155
2009-03-31 22:37:52 +00:00
Chris Lattner
2739d2bbe6
remove some obsolete comments, use an AssertingVH.
...
llvm-svn: 68151
2009-03-31 22:17:44 +00:00
Eli Friedman
7044b76707
Finish off semantic analysis for regparm, and remove the warning. Also
...
remove a redundant error in CodeGen.
llvm-svn: 67868
2009-03-27 21:06:47 +00:00
Fariborz Jahanian
a2d609e2f1
Besides the warning, issue unsupported diagnostics in
...
ir gen. No intended change in functionality.
llvm-svn: 67857
2009-03-27 18:38:55 +00:00
Chris Lattner
984fac5f5f
most of this is plumbing to get CompileOptions down into
...
CodeGenModule. Once there, add a new NoCommon option to
it and implement -fno-common.
llvm-svn: 67735
2009-03-26 05:00:52 +00:00
Chris Lattner
e64911a4ae
switch getBuiltinLibFunction to use the new GetOrCreateLLVMFunction
...
functionality, fixing a crash on the attached testcase. Eliminate the
BuiltinFunctions cache, as it can contain dangling pointers. This fixes
a bunch of valgrind errors on test/CodeGen/builtins.c
llvm-svn: 67484
2009-03-22 21:56:56 +00:00
Chris Lattner
5404169327
emit aliases as the definitions fly by, don't bother deferring until
...
the end of the module.
llvm-svn: 67482
2009-03-22 21:47:11 +00:00
Chris Lattner
827a3552a4
make alias definition logic more similar to functions/globals.
...
llvm-svn: 67481
2009-03-22 21:39:12 +00:00
Chris Lattner
a5ae54acc4
fix PR3200 by making alias emission use the new infrastructure. Fold
...
some tests into the alias.c file.
llvm-svn: 67479
2009-03-22 21:21:57 +00:00
Chris Lattner
d480892445
pull "runtime globals" into the same framework as other functions/global variables.
...
No intended functionality change.
llvm-svn: 67478
2009-03-22 21:03:39 +00:00
Chris Lattner
75acb0c356
fix a fixme: non-proto struct returning function definitions should be compiled
...
to something like:
define void @bar(%struct.foo* noalias sret %agg.result) nounwind {
instead of:
define void @bar(%struct.foo* noalias sret %agg.result, ...) nounwind {
llvm-svn: 67475
2009-03-22 19:35:37 +00:00
Chris Lattner
4ff71de880
set function/global names with setName instead of passing the name into the
...
ctor function. This avoids creating a temporary std::string for the name,
speeding up the testcase in PR3810 by 3.8%
llvm-svn: 67457
2009-03-22 00:12:30 +00:00
Fariborz Jahanian
629aed9327
Issue error if variables are defined inside an objc class,
...
category or protocol.
llvm-svn: 67450
2009-03-21 18:06:45 +00:00
Chris Lattner
45470943a9
now that all the decl reference and creation stuff is going through two
...
very simple places, reimplement the deferred decl emission logic to not be O(N^2),
fixing PR3810.
llvm-svn: 67447
2009-03-21 09:44:56 +00:00
Chris Lattner
a85d68e5d8
fix a crash that could occur when a variable declaration became a
...
function definition.
llvm-svn: 67446
2009-03-21 09:25:43 +00:00
Chris Lattner
149927c9f8
simplify and cleanup global variable creation stuff to all go through one
...
code path.
llvm-svn: 67445
2009-03-21 09:16:30 +00:00
Chris Lattner
832323ea41
simplify management of llvm::Function creation to all go through
...
GetAddrOfFunction. This is simpler and more efficient.
llvm-svn: 67444
2009-03-21 08:53:37 +00:00
Chris Lattner
5eaee5692c
code cleanups, rename EmitForwardFunctionDefinition ->
...
CreateFunctionPrototypeIR, though my next patch will eliminate
it entirely.
llvm-svn: 67443
2009-03-21 08:38:50 +00:00
Chris Lattner
6574906818
fix several problems with asm renaming, by pulling it into the mangling code:
...
1. it wasn't applying to definitions, only declarations, e.g. int x __asm("foo")
2. multiple definitions were conflicting, they weren't getting merged.
3. the code was duplicated in several places.
llvm-svn: 67442
2009-03-21 08:24:40 +00:00
Chris Lattner
64c55933ed
add some fixmes
...
llvm-svn: 67441
2009-03-21 08:13:05 +00:00
Chris Lattner
a9cb6261bf
reduce redundant calls of getMangledName.
...
llvm-svn: 67440
2009-03-21 08:06:59 +00:00
Chris Lattner
3bfce1887f
simplify some more code.
...
llvm-svn: 67439
2009-03-21 08:03:33 +00:00
Chris Lattner
0c5e3132aa
simplify and comment some code better. Make BindRuntimeGlobals
...
more optimistic that it will work (optimizing for the common case).
llvm-svn: 67438
2009-03-21 07:48:31 +00:00
Chris Lattner
3637652ab3
random code cleanups.
...
llvm-svn: 67437
2009-03-21 07:12:05 +00:00
Chris Lattner
6098e62d56
remove obviously dead code: you can't bitcast a pointer to "Ty" (a function type).
...
llvm-svn: 67436
2009-03-21 06:58:21 +00:00
Chris Lattner
9e8120e067
avoid making constant folding logic eliminate obviously dead bitcasts, speeding up PR3810
...
by ~2%.
llvm-svn: 67434
2009-03-21 06:53:34 +00:00
Chris Lattner
725a26b818
Add a fast path to CodeGenModule::getMangledName for almost all C functions,
...
speeding up the testcase in PR3810 by 60%.
llvm-svn: 67431
2009-03-21 06:31:09 +00:00
Daniel Dunbar
4e004ed124
IRgen support for alias of global variable.
...
- PR3818.
llvm-svn: 67297
2009-03-19 08:27:24 +00:00
Fariborz Jahanian
3654e65adf
objc: Implemented variables declared in class interface
...
whose sema decl is at the translation unit.
llvm-svn: 67249
2009-03-18 22:33:24 +00:00
Duncan Sands
1918413137
Adjust for linkage name change.
...
llvm-svn: 66691
2009-03-11 20:15:27 +00:00
Duncan Sands
bdf086f7c0
Correct for change of this name in LLVM.
...
llvm-svn: 66652
2009-03-11 08:40:02 +00:00
Daniel Dunbar
99d2835099
Backout r66408, we don't want handling of globals to rely on the
...
module symbol table. The root problem inspiring this was fixed in
r66316 (and again in r66506).
llvm-svn: 66512
2009-03-09 23:53:08 +00:00
Mike Stump
e3193ff452
Be sure to never create two functions with the same name, instead arrange to
...
reuse the prior one.
llvm-svn: 66408
2009-03-09 06:40:26 +00:00
Eli Friedman
4663a3368d
Make constant emission for @encode use the common string emission code.
...
This is a bit cleaner, and also "fixes" bad code that compares the
addresses of the string constants.
llvm-svn: 66346
2009-03-07 20:17:55 +00:00
Mike Stump
a6ca334389
Fixup our uses of various linkages to match how llvm now works. I think they are all
...
correct, but an extra set of ObjC eyes would be good.
llvm-svn: 66342
2009-03-07 16:33:28 +00:00
Daniel Dunbar
7aecee998c
(LLVM svn up) Generalize RuntimeFunctions to RuntimeGlobals and add
...
CodeGenModule::CreateRuntimeVariable.
- No real functionality change; although we now assert on silly
things like:
--
int objc_exception_throw;
void f0() { @throw(@"A"); }
--
instead of accepting it.
llvm-svn: 66292
2009-03-06 22:13:30 +00:00
Daniel Dunbar
8e79b8491f
IRgen support for weak_import.
...
- <rdar://problem/6652110> clang should support weak_import
llvm-svn: 66270
2009-03-06 16:20:49 +00:00
Daniel Dunbar
f804897ee9
Don't mangle names of local variables.
...
- For one thing, this adds unneeded overhead; for another, this
routine can be used to emit unnamed decls which we shouldn't try to
mangle.
llvm-svn: 66212
2009-03-05 22:59:19 +00:00
Eli Friedman
cecc21d2f6
Make IRGen compatible with declaring a function with incomplete
...
return/argument types. (The generated IR isn't ideal, but we can't
really do better in general.)
llvm-svn: 66132
2009-03-05 04:18:07 +00:00
Mike Stump
6c39666a77
Move more of the blocks code up and out.
...
llvm-svn: 66046
2009-03-04 18:47:42 +00:00
Mike Stump
95435674f9
Move more of blocks codegen out of CodeGenModule and into the
...
BlockModule. No functionality change. This should help people that
don't want to know anything about blocks not be confused by the
overloaded use of the term block or nor want to see all the blocks
goop.
llvm-svn: 66042
2009-03-04 18:17:45 +00:00
Daniel Dunbar
5b9e9682f1
Support "asm" renaming of external symbols.
...
- PR3698.
llvm-svn: 66038
2009-03-04 17:31:19 +00:00
Daniel Dunbar
0f3403cb5a
Don't set nounwind on functions when in using the new Obj-C ABI.
...
llvm-svn: 65806
2009-03-02 04:58:03 +00:00
Chris Lattner
a01c21f616
simplify some code.
...
llvm-svn: 65782
2009-03-01 18:47:06 +00:00
Anders Carlsson
655129990a
Initialize NSConcreteStackBlock
...
llvm-svn: 65749
2009-03-01 01:17:11 +00:00
Mike Stump
537abb0dec
Fix PR3612. We ensure that we add builtins to the GlobalDeclMap and
...
we ensure that things added to the module can be found even when they
are not in GlobalDeclMap. The later is for increased flexibility,
should someone want to do something tricky like extern "Ada" in the
same module.
llvm-svn: 65657
2009-02-27 22:42:30 +00:00
Eli Friedman
97e070ed68
Minor cleanup: use getDeclAlignInBytes helper.
...
llvm-svn: 65611
2009-02-27 04:11:37 +00:00
Chris Lattner
d42c29f9a2
fix some sema problems with wide strings and hook up basic codegen for them.
...
llvm-svn: 65582
2009-02-26 23:01:51 +00:00
Chris Lattner
d7e7b8e411
first wave of fixes for @encode sema support. This is part of PR3648.
...
The big difference here is that (like string literal) @encode has
array type, not pointer type.
llvm-svn: 65391
2009-02-24 22:18:39 +00:00
Daniel Dunbar
3c81dabd76
Emit extern_weak when needed.
...
- PR3629.
llvm-svn: 65203
2009-02-21 00:24:10 +00:00
Eli Friedman
719ed1a9ab
Initialize the Init variable to something reasonable when we emit an
...
error, so we don't crash.
llvm-svn: 65099
2009-02-20 01:18:21 +00:00
Anders Carlsson
f96954ca30
Add irgen support for the noinline attribute.
...
llvm-svn: 65056
2009-02-19 19:22:11 +00:00
Daniel Dunbar
f0acf7bd4c
Don't emit K&R unprototyped function definitions as varargs.
...
- <rdar://problem/6584606> clang/x86-64 - too many reg saves
llvm-svn: 65032
2009-02-19 07:15:39 +00:00
Daniel Dunbar
b2f4cdb233
Emission of global variable initialializer was broken in rare
...
situation where a tentative decl was emitted *after* the actual
initialization. This occurs in some rare situations with static decls.
- PR3613.
- I'm not particularly happy with this fix, but I don't see a simpler
or more elegant solution yet.
llvm-svn: 65018
2009-02-19 05:36:41 +00:00