Commit Graph

288 Commits

Author SHA1 Message Date
Daniel Dunbar 29ac59f25c Add CodeGenFunction::EmitDummyBlock for marking places where we make
"dummy" blocks (blocks just used to make sure we have a place to dump
code to).

llvm-svn: 59022
2008-11-11 04:34:23 +00:00
Daniel Dunbar 05e629aec6 Remove CodeGenFunction::StartBlock.
- Was confusing and only used in one small part of the code.

llvm-svn: 59020
2008-11-11 04:12:31 +00:00
Daniel Dunbar 75283ff38a Centralize basic block creation in CodeGenFunction::createBasicBlock.
- No functionality change.

llvm-svn: 59017
2008-11-11 02:29:29 +00:00
Anders Carlsson 3442f82c2f Support named operands in inline asm statements.
llvm-svn: 58940
2008-11-09 18:54:14 +00:00
Daniel Dunbar 1e75408d89 Emit error unsupported when asm string conversion fails instead of
assert.

llvm-svn: 57721
2008-10-17 20:58:01 +00:00
Daniel Dunbar b9fd902fdc Change CGDebugInfo::setLocation to just ignore invalid locations. This
simplifies clients.

Also, add assert that RegionStack is empty when the CGDebugInfo is
destroyed.

llvm-svn: 57684
2008-10-17 16:15:48 +00:00
Chris Lattner 5d3e26a4f6 silence release-assert warnings.
llvm-svn: 57392
2008-10-12 00:31:50 +00:00
Ted Kremenek 704a2505db In EmitDeclStmt: use DeclStmt::const_decl_iterator instead of walking the scoped decl chain.
llvm-svn: 57192
2008-10-06 18:42:27 +00:00
Daniel Dunbar e23f28f8a5 Emit error unsupported for break/continue/goto inside Obj-C exception
handling blocks.
 - This has false positives, but at least prevents miscompiles.

llvm-svn: 56958
2008-10-02 18:02:06 +00:00
Daniel Dunbar 2efd538f61 Add infrastructure for proper @finally support.
- Provides a basic primitive to jump to an arbitrary basic block,
   through the finally code.

 - Only used for return statements and rethrow currently. Still need
   to handle break, continue and goto.

 - Code still needs to be shuffled around to live elsewhere.

llvm-svn: 56827
2008-09-30 01:06:03 +00:00
Daniel Dunbar a2d3570fc9 Skip redundant if.
llvm-svn: 56762
2008-09-28 00:19:22 +00:00
Daniel Dunbar 1c64e5d12f Refactor some CodeGen functionality:
- Add CodeGenFunction::{EmitReturnOfRValue, EmitIvarOffset}
 - Factor EmitLValueForIvar out of EmitObjCIvarRefLValue.

No non-error functionality change (some unsupported errors are
degraded to asserts for the time being).

llvm-svn: 56543
2008-09-24 04:00:38 +00:00
Anders Carlsson 9396a89899 Make sure to store the exception in the catch parameter.
llvm-svn: 56102
2008-09-11 09:15:33 +00:00
Anders Carlsson b5130d8588 Make sure to emit the catch parameter as well as the catch body.
llvm-svn: 56101
2008-09-11 08:21:54 +00:00
Daniel Dunbar 54bb1933b1 Use a unified return block.
- For the time being this means our emitted code is somewhat worse,
   especially for aggregates. This will be fixed.

llvm-svn: 56013
2008-09-09 21:00:17 +00:00
Anders Carlsson 1963b0c38f Move handling of @try and @throw to the runtime class.
llvm-svn: 55983
2008-09-09 10:04:29 +00:00
Anders Carlsson 2e744e8aa6 Stub out CodeGenFunction::EmitObjCForCollectionStmt.
Add CodeGenFunction::EmitMemSetToZero and make AggExprEmitter::EmitAggregateClear use it.

llvm-svn: 55573
2008-08-30 19:51:14 +00:00
Daniel Dunbar a799807dea Downgrade a number of FIXME asserts to ErrorUnsupported.
- Notably VLAs

llvm-svn: 55544
2008-08-29 17:28:43 +00:00
Daniel Dunbar c8317a44cf Implement Obj-C ivar references to aggregates.
Implement Obj-C lvalue message sends (aggregate returns).

Update several places to emit more precise ErrorUnsupported warnings
  for currently unimplemented Obj-C features (main missing chunks are
  property references, Obj-C exception handling, and the for ... in
  syntax).

llvm-svn: 55234
2008-08-23 10:51:21 +00:00
Daniel Dunbar a7c8cf6200 Change WarnUnsupported to ErrorUnsupported (in name and in practice).
- We are beyond the point where this shows up often and when it does
   generating miscompiled files is bad.

llvm-svn: 54836
2008-08-16 00:56:44 +00:00
Daniel Dunbar 56fdb6ae69 More #include cleaning
- Kill unnecessary #includes in .cpp files. This is an automatic
   sweep so some things removed are actually used, but happen to be
   included by a previous header. I tried to get rid of the obvious
   examples and this was the easiest way to trim the #includes in one
   fell swoop.
 - We now return to regularly scheduled development.

llvm-svn: 54632
2008-08-11 06:23:49 +00:00
Daniel Dunbar ad319a73f2 More #include cleaning
- Remove internal uses of AST.h

llvm-svn: 54628
2008-08-11 05:00:27 +00:00
Daniel Dunbar 88402ce8d0 Add CodeGen support for indirect goto.
- Follows emission scheme used by llvm-gcc, i.e. invent an id for
   each label whose address is taken and replace each indirect goto by
   a switch to each possible target.
 - Currently we emit a switch for each indirect goto instead of
   merging them as llvm-gcc does.

llvm-svn: 54318
2008-08-04 16:51:22 +00:00
Chris Lattner 7e80097f6e implement codegen support for labels at the end of stmtexprs.
llvm-svn: 54100
2008-07-26 20:23:23 +00:00
Chris Lattner 6284378fcd minor tidying, no functionality change.
llvm-svn: 54099
2008-07-26 20:15:14 +00:00
Daniel Dunbar 0e5845c13a Rework codegen of case ranges
- Fix multiple issues with the way case ranges were emitted, see test
   cases details about the specific issues.

 - The root issue was not being careful about how basic blocks were
   emitted which led to them being chained together incorrectly,
   resulting in improper control flow.

 - Fixes <rdar://problem/6098585>

llvm-svn: 54006
2008-07-25 01:11:38 +00:00
Daniel Dunbar 2e0f1cd00c Fix EmitCaseStmtRange to ignore empty ranges
- Also cleaned up emission slightly 
 - Inspection of the code revealed several other bugs, however. Case
   ranges are not properly wired and can result in switch cases being
   dropped or even infinite loops. See: <rdar://problem/6098585>

Completes: <rdar://problem/6094119>
llvm-svn: 53975
2008-07-24 01:18:41 +00:00
Eli Friedman 327944b343 Basic support for volatile loads and stores. Stores the volatile
qualifier in the lvalue, and changes lvalue loads/stores to honor 
the volatile flag.  Places which need some further attention are marked 
with FIXMEs.

Patch by Cédric Venet.

llvm-svn: 52264
2008-06-13 23:01:12 +00:00
Sanjiv Gupta 98070578bf Generate subprogram debug info with -g.
Also take care of freeing memory at the right places.

llvm-svn: 51553
2008-05-25 05:15:42 +00:00
Dan Gohman 5d30975e5e Change uses of llvm::Type::isFirstClassType to use the new
llvm::Type::isSingleValueType. Currently these two functions have
the same behavior, but soon isFirstClassType will return true for
struct and array types.

Clang may some day want to use of isFirstClassType for some of
these some day as an optimization, but it'll require some
consideration.

llvm-svn: 51446
2008-05-22 22:12:56 +00:00
Eli Friedman 1763075b9c Make debugging information usable. This is barebones, but it makes -g
actually work (instead of crashing llc), and there's enough info emitted 
to get line number information in gdb. This should hopefully be helpful 
for debugging non-working programs.

I got rid of the begin/endregion calls because the implementation wasn't 
working; someone who knows the debugging info a bit better might try to 
add it. I really have no clue how a compiler is supposed to emit them.

This commit shouldn't have any effect without -g.

llvm-svn: 51404
2008-05-22 01:40:10 +00:00
Eli Friedman c7460b1011 Minor refactoring: compute the return value separately from emitting the
ret.

llvm-svn: 51403
2008-05-22 01:22:33 +00:00
Eli Friedman 6a7087e455 Emit basic block for switch body; fixes PR2307.
llvm-svn: 50968
2008-05-12 16:08:04 +00:00
Sanjiv Gupta 15cb669039 Added -g command line options to clang for generating source level debug information. This patch currently enables generation of line number debug information (stoppoints) and region begin/end debug information. The new files CGDebugInfo.h and CGDebugInfo.cpp implements the debug info manager class CGDebugInfo.
llvm-svn: 50848
2008-05-08 08:54:20 +00:00
Gabor Greif d36afd7d65 tracking API changes arising from r49277
llvm-svn: 49279
2008-04-06 20:42:52 +00:00
Chris Lattner f3bc75afcf Since isComplexType() no longer returns true for _Complex integers, the code
generator needs to call isAnyComplexType().  This fixes PR1960.

llvm-svn: 49220
2008-04-04 16:54:41 +00:00
Chris Lattner 4bd5596d08 Add initial support for objc codegen for methods, ivars, and the
etoile runtime, patch by David Chisnall!

llvm-svn: 48969
2008-03-30 23:03:07 +00:00
Chris Lattner 7a51313d8a Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it.  This follows the main
llvm tree, and allows the libraries to be built in parallel.  The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in.  This speeds
up parallel builds, particularly incremental ones.

llvm-svn: 48402
2008-03-15 23:59:48 +00:00