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

75 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner 531a550531 daniel prefers completed thoughts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59404 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 06:16:27 +00:00
Daniel Dunbar 9615ecb44f Normalize many BasicBlock names.
- Use dotted notation for blocks related to a particular statement
   type.
 - Use .end for landing pads.

No functionality change in NDEBUG mode. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59210 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 01:38:36 +00:00
Daniel Dunbar be65abc8e4 Rename ?: operator blocks to cond.true and cond.false (I don't know
what "cond.?" means, and this avoids quoting).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59128 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 10:13:37 +00:00
Chris Lattner 9802a5173f Lower ?: into select when the selected values are cheap and side-effect-free.
This cuts another 200 lines off expr.ll, forming 23 selects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59124 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 08:55:54 +00:00
Chris Lattner f7b5ea9de3 emit better codegen for ||/&&, shrinking expr.ll by another 240 lines.
This happens for stuff like this:

x = cond1 || cond2 || cond3 || cond4;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59123 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 08:38:24 +00:00
Chris Lattner 20eb09d562 use ConstantFoldsToSimpleInteger instead of code emission to do
constant folding.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59121 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 08:26:50 +00:00
Chris Lattner 035cf42943 Use EmitBranchOnBoolExpr in VisitConditionalOperator. This
shrinks code yet again by a bit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59114 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 08:08:13 +00:00
Chris Lattner 31a0984b5c Move EmitBranchOnBoolExpr and ConstantFoldsToSimpleInteger to
CodeGenFunction.cpp.  Change VisitConditionalOperator to use
constant fold instead of codegen'ing a constant conditional.

Change ForStmt to use EmitBranchOnBoolExpr, this shrinks
expr.c very slightly to 40239 lines.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59113 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 08:04:58 +00:00
Chris Lattner 746e03ed51 Clean up some code to use isZero instead of calling getZExtValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59103 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 04:54:14 +00:00
Daniel Dunbar 1fef965b8e Use createBasicBlock here too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59095 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-12 00:02:07 +00:00
Daniel Dunbar a448fb2da0 Rework IRgen invariant w.r.t. current insert point.
- EmitStmt is no longer required to finish with a current insertion
   point defined (i.e. it does not need to make dummy
   blocks). Instead, it can clear the insertion point in the builder
   which indicates that the current insertion point is unreachable.
 - CodeGenFunction provides HaveInsertPoint and EnsureInsertPoint
   which respectively test if there is an insert point and ensure an
   insertion point exists (by making a dummy block).
 - Clearly mark functions in CodeGenFunction which can be called with
   no insertion point defined. Currently this is a limited set, and
   EmitStmt simply EnsureInsertPoint()s before emitting subsequent IR.

Remove EmitDummyBlock, which is no longer needed. Clients who haven't
already cleared the insertion point (typically via EmitBranch) can do
so by hand.

Remove isDummyBlock, which has effectively been renamed to
HaveInsertPoint.

The main thrust of this change is that we no longer have create dummy
blocks just to destroy them a short time later in EmitBlock in the
common case that there is no unreachable code following something like
a goto. 

Additionally, this means that we are not using the hokey condition in
isDummyBlock that a block without a name is a dummy block. Guess how
well that works when we never emit block names!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 23:11:34 +00:00
Chris Lattner c657e92d7b Try to not emit the dead side of ?: if the condition is a constant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59061 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 18:56:45 +00:00
Sebastian Redl 0518999d3a Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof expressions, both of values and types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 17:56:53 +00:00
Daniel Dunbar d57a871339 Add CodeGenFunction::EmitBranch.
- Emits an unconditional branch, with extra logic to avoid generating
   spurious branches out of dummy blocks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59037 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 09:41:28 +00:00
Chris Lattner 0946ccd1e5 short circuit && and || when possible. This substantially reduces
the size of the -O0 output on some cases.  For example, on expr.c from
176.gcc, it shrinks the .ll file from 43164 to 42835 lines, and removed
references to two external symbols.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59034 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 07:41:27 +00:00
Daniel Dunbar 55e874299f Centralize basic block creation in CodeGenFunction::createBasicBlock.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 02:29:29 +00:00
Anders Carlsson ddf7cac45d Implement lowering of va_arg in clang directly. (This is 32-bit X86 only for now).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58681 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 05:30:00 +00:00
Daniel Dunbar 45d196b838 Move IRBuilder type definition to common file.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-01 01:53:16 +00:00
Chris Lattner be20bb558c make codegen reject initializes with designators, like this:
t.c:1:13: error: cannot codegen this designators yet
int a[10] = {2, 4, [8]=9, 10};
            ^~~~~~~~~~~~~~~~~



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58220 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 23:53:12 +00:00
Daniel Dunbar 0d504c1da8 Remove unneeded EncodingRecordTypes argument to getObjCEncodingForType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 20:21:44 +00:00
Dale Johannesen ee5a700af3 Adjust calls to APFloat conversion for new interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57332 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-09 23:02:32 +00:00
Daniel Dunbar 90df4b6661 Avoid superfluous errors regarding variable-length arrays (casts).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55759 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 03:43:08 +00:00
Daniel Dunbar 662174c82e Downgrade a number of FIXME asserts to ErrorUnsupported.
- Notably VLAs


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-29 17:28:43 +00:00
Daniel Dunbar 85c59edda0 Add special "property reference" CodeGen::LValue type for emitting
Objective-C property references.
 - This handles property references "more correctly" but setters still
   don't work.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55534 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-29 08:11:39 +00:00
Daniel Dunbar 9c3fc703b2 Initial support for Obj-C dot-syntax for getters.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55410 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 06:57:25 +00:00
Daniel Dunbar d1d66bcd69 Change another is-a-pointer check to check in terms of LLVM type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 10:38:11 +00:00
Daniel Dunbar 270cc66683 Do is-a-pointer checks in terms of LLVM types in
EmitScalarConversion().
 - Important for allowing Obj-C void * to id<X> casts and so on.
 - Not sure about this fix however, perhaps Type should understand
   that id is effectively a pointer type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55311 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 09:51:32 +00:00
Argyrios Kyrtzidis 7267f7832e Add CodeGen support for CXXZeroInitValueExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55249 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 19:35:47 +00:00
Daniel Dunbar 0a04d77bde 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55234 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 10:51:21 +00:00
Daniel Dunbar 8f2926b73e Trim CGObjCRuntime::GenerateMessageSend[Super]
- Returns an RValue.
 - Reduced to only taking the CodeGenFunction, Expr, and Receiver.
 - Becomes responsible for emitting the arguments.

Add CodeGenFunction::EmitCallExprExt
 - Takes optional extra arguments to insert at the head of the call.
 - This allows the Obj-C runtimes to call into this and isolates the
   argument and call instruction generation code to one place. Upshot
   is that we now pass structures (more) correctly.

Also, fix one aspect of generating methods which take structure
arguments (for NeXT). This probably needs to be merged with the
SetFunctionAttributes code in CodeGenModule.cpp


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55223 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 03:46:30 +00:00
Daniel Dunbar ed7c618f84 Move all Obj-C runtime interaction into CodeGenFunction.
- Drop duplicate (and broken) code for sending messages.
 - Add EmitObjCProtocolExpr to CodeGenFunction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55024 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 00:28:19 +00:00
Daniel Dunbar 54d19091a8 Add CodeGen support for AddrLabelExpr in initializers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54837 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-16 01:41:47 +00:00
Daniel Dunbar 488e993a13 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54836 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-16 00:56:44 +00:00
Daniel Dunbar af2f62ce32 Change ObjCRuntime GenerateProtocol[Ref] methods to take
ObjCProtocolDecl directly.

Implement CodeGen support for forward protocol decls (no-ops are so
    nice to implement).

Also moved CGObjCRuntime.h out of CodeGenModule.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54709 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 00:59:25 +00:00
Daniel Dunbar 22711185f2 Drop Sender from GenerateMessageSend*
- Was unused and generated a unnecessary load of self
(missed file)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54668 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-12 05:40:10 +00:00
Daniel Dunbar 98c5ead87d Protocol related tweaks
- Implement type conversion of ObjCQualifiedIdType
 - Wire @protocol(...) to GenerateProtocolRef in ScalarExprEmitter


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54666 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-12 05:08:18 +00:00
Daniel Dunbar a008db15ee Add @selector(...) codegen support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54665 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-12 03:55:34 +00:00
Daniel Dunbar 208ff5e8a0 Change CodeGenModule to only create ObjC runtime for ObjC files
- Changed CodeGenModule::getObjCRuntime to return reference.
 - Added CodeGenModule::hasObjCRuntime predicate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54645 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 18:12:00 +00:00
Daniel Dunbar de7fb8413b More #include cleaning
- Remove internal uses of AST.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54628 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 05:00:27 +00:00
Chris Lattner d9f6910f4e rename PreDefinedExpr -> PredefinedExpr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10 01:53:14 +00:00
Chris Lattner 85e356825b update to make IRBuilder API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54548 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-08 19:57:58 +00:00
Daniel Dunbar 8c6f57c38b Fix CodeGen of pointer arithmetic in compound assignment statements.
- Changed EmitSub to work on all cases (arithmetic, ptr - int, ptr -
   ptr) so that implementation matches that of other operators.

 - Modify EmitCompoundAssign to compute and perform the appropriate
   casts of left, right, and result types for the assorted pointer
   arithmetic cases.

 - Fix EmitSub (ptr - int) case to negate the rhs *after*
   extension. This is critical when the rhs is unsigned (and needs
   extension).

 - This fixes cfrac.

 - <rdr://6115726>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54392 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-06 02:00:38 +00:00
Daniel Dunbar 820b03398f Bug fix, CodeGen of (void*) - (void*) was broken.
- <rdar://problem/6122967>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54338 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 00:47:03 +00:00
Daniel Dunbar 0ffb125996 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54318 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-04 16:51:22 +00:00
Chris Lattner 9619662a1d remove uses of QualType::getCanonicalType() from codegen for PR2189
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54107 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-26 22:37:01 +00:00
Chris Lattner 91d723da7b implement codegen support for labels at the end of stmtexprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54100 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-26 20:23:23 +00:00
Chris Lattner 345f720969 minor tidying, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54099 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-26 20:15:14 +00:00
Nate Begeman 7a66d7b6c0 Generate vector compares in codegen
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54048 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-25 20:16:05 +00:00
Chris Lattner f31627f676 Fix a codegen crash on:
int foo(void) {
  float x[2];
  return x;
}

rdar://6093986


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53946 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 06:31:27 +00:00
Daniel Dunbar 8ee6a63ba1 Add note to check what __alignof__ a function type should be.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53928 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 19:44:18 +00:00