Commit Graph

1116 Commits

Author SHA1 Message Date
Fariborz Jahanian 3b636c15e0 Use CodeGenModule API for ObjC runtime function references.
Patch by David Chisnall.

llvm-svn: 68043
2009-03-30 18:02:14 +00:00
Chris Lattner 5bbb3c8ad9 Push DeclGroup much farther throughout the compiler. Now the various
productions (except the already broken ObjC cases like @class X,Y;) in 
the parser that can produce more than one Decl return a DeclGroup instead
of a Decl, etc.

This allows elimination of the Decl::NextDeclarator field, and exposes
various clients that should look at all decls in a group, but which were
only looking at one (such as the dumper, printer, etc).  These have been
fixed.

Still TODO:

1) there are some FIXME's in the code about potentially using
DeclGroup for better location info.
2) ParseObjCAtDirectives should return a DeclGroup due to @class etc.
3) I'm not sure what is going on with StmtIterator.cpp, or if it can
   be radically simplified now.
4) I put a truly horrible hack in ParseTemplate.cpp.

I plan to bring up #3/4 on the mailing list, but don't plan to tackle
#1/2 in the short term.

llvm-svn: 68002
2009-03-29 16:50:03 +00:00
Eli Friedman bbcf49e410 Initial implementation of ARM ABI. Mostly untested. Note that I'm not
really intending to take ownership of this; I wrote this mostly because 
I was curious about how the ARM ABI works.  It should be a decent start, 
though.

llvm-svn: 67969
2009-03-29 00:15:25 +00:00
Chris Lattner 529efc74ad rename some methods.
llvm-svn: 67923
2009-03-28 06:33:19 +00:00
Chris Lattner cf16983179 change HandleTranslationUnit to take an ASTContext instead of TranslationUnit
llvm-svn: 67910
2009-03-28 04:11:33 +00:00
Eli Friedman 754d5ac658 Trivial cleanup.
llvm-svn: 67899
2009-03-28 03:27:06 +00:00
Eli Friedman 09a9b6e335 Move where block-related variables are initialized so that block
types don't get generated when blocks aren't used.

llvm-svn: 67898
2009-03-28 03:24:54 +00:00
Eli Friedman 9127aa1caf Minor cleanup.
llvm-svn: 67896
2009-03-28 03:10:45 +00:00
Eli Friedman e381f7e3e9 Misc small fixes/cleanups/comment changes.
llvm-svn: 67895
2009-03-28 02:45:41 +00:00
Eli Friedman 8b7b1b1aee Change compound assignment operators to keep track of both the promoted
LHS type and the computation result type; this encodes information into 
the AST which is otherwise non-obvious.  Fix Sema to always come up with the 
right answer for both of these types.  Fix IRGen and the analyzer to 
account for these changes.  This fixes PR2601.  The approach is inspired 
by PR2601 comment 2.

Note that this changes real *= complex in CodeGen from a silent 
miscompilation to an explicit error.

I'm not really sure that the analyzer changes are correct, or how to 
test them... someone more familiar with the analyzer should check those 
changes.

llvm-svn: 67889
2009-03-28 01:22:36 +00:00
Devang Patel afc1c1d405 Do not emit debug information for variables while generating optimized code. The llvm optimizer and code generator are not yet ready to support optimized code debugging.
llvm-svn: 67876
2009-03-27 23:16:32 +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
Fariborz Jahanian dac14a7159 - Minor change to dump of ivar layout map.
- Temporarily undef'ed __OBJC2__ in nonfragile objc abi mode
  as it was forcing ivar synthesis in a certain project which clang
  does not yet support.

llvm-svn: 67766
2009-03-26 19:10:36 +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
Fariborz Jahanian f909f92799 More for for objc2's ivar layout map (currently
is not in use).

llvm-svn: 67713
2009-03-25 22:36:49 +00:00
Mike Stump 871c1f6f88 Remove -f__block as codegen for __block variables should be solid.
llvm-svn: 67697
2009-03-25 18:05:39 +00:00
Mike Stump d2142cffbf Fixup codegen for block literals that bleed copy/dispose information
from previous block literals.

llvm-svn: 67696
2009-03-25 17:58:24 +00:00
Chris Lattner 8c37df4f91 simplify some conditionals, don't copy LangOptions.
llvm-svn: 67674
2009-03-25 03:28:08 +00:00
Devang Patel 94406c954f Encode language.
llvm-svn: 67650
2009-03-24 20:35:51 +00:00
Daniel Dunbar bf1fe8c36c Support member reference on ?: of struct type.
llvm-svn: 67603
2009-03-24 02:38:23 +00:00
Eli Friedman 2dc5f29ff2 Fix the ABI convention for struct returns on x86 outside of Darwin.
llvm-svn: 67577
2009-03-23 23:26:24 +00:00
Fariborz Jahanian aedcfa49b9 Must allow for strong cast of floats as well (objc2 gc).
llvm-svn: 67551
2009-03-23 19:10:40 +00:00
Eli Friedman 31a20d680a Some minor fixes for complex IRGen.
llvm-svn: 67501
2009-03-23 04:08:46 +00:00
Eli Friedman 7b4716750b Fix a subtle bug in CodeGen for the increment of a bitfield.
llvm-svn: 67499
2009-03-23 03:00:06 +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
Eli Friedman d6a7b72944 Remove dead code.
llvm-svn: 67477
2009-03-22 20:54:47 +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 e09ad90882 don't set the name of a call instruction to "call" in release-asserts
build.  This shaves another 3% off.

llvm-svn: 67460
2009-03-22 00:32:22 +00:00
Chris Lattner 47640221da fix CreateTempAlloca to not set a name on the alloca for temporaries
in release-assert builds.  For automatic variables, explicitly set
a name with setName that does not make a temporary std::string.

This speeds up -emit-llvm-only -disable-free on PR3810 by 4.6%

llvm-svn: 67459
2009-03-22 00:24:14 +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
Mike Stump efd7caa825 Fixup codegen for nested block literals so that we generate
copy_helpers and dispose_helpers as necessary for them.

llvm-svn: 67453
2009-03-21 21:00:35 +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