Commit Graph

34731 Commits

Author SHA1 Message Date
Chris Lattner eb5b20ae48 add better comments.
llvm-svn: 39904
2007-07-16 06:46:50 +00:00
Chris Lattner b0f5d55912 factor a common predicate into a static method.
llvm-svn: 39903
2007-07-16 06:16:59 +00:00
Chris Lattner 651f0e9c8f Add a hack (mirroring llvm-gcc) to pointer difference
codegen to compile:

int test(int *A, int *B) {
  return A-B;
}

into:

_test:
        movl 4(%esp), %eax
        subl 8(%esp), %eax
        sarl $2, %eax
        ret

instead of:

_test:
        movl 4(%esp), %eax
        subl 8(%esp), %eax
        movl %eax, %ecx
        sarl $31, %ecx
        shrl $30, %ecx
        addl %ecx, %eax
        sarl $2, %eax
        ret

llvm-svn: 39902
2007-07-16 05:43:05 +00:00
Chris Lattner f57999dcb1 add required directories to the path automatically, so the user doesn't need to worry about it.
llvm-svn: 39901
2007-07-16 04:35:52 +00:00
Chris Lattner 8ecc9f60b2 Make check conflicts with the other default llvm target, 'make check' will come later I guess.
llvm-svn: 39900
2007-07-16 04:30:36 +00:00
Chris Lattner 55d278cef9 'make check' is what more people expect.
llvm-svn: 39899
2007-07-16 04:26:57 +00:00
Chris Lattner 31e39e9cdb Doug Gregor pointed out that _Complex actually isn't C++ at all.
llvm-svn: 39898
2007-07-16 04:22:42 +00:00
Chris Lattner 539007a78a Add support for C++'0x keywords, patch by Doug Gregor
llvm-svn: 39897
2007-07-16 04:18:29 +00:00
Chris Lattner 640fd5124d Repair a regression in Transforms/InstCombine/mul.ll that Reid noticed.
llvm-svn: 39896
2007-07-16 04:15:34 +00:00
Chris Lattner d8bdf53335 rename function to avoid llvm-upgrade warning
llvm-svn: 39895
2007-07-16 04:09:00 +00:00
Nick Lewycky b7c0c8a350 Start adding and cleaning up comments.
llvm-svn: 39894
2007-07-16 02:58:37 +00:00
Nick Lewycky 5246026c8c Handle decrementing loops properly. Fixes PR1533.
Always pass the constant as the second parameter to HowManyLessThans.

Remove obsolete "isSigned" parameter.

llvm-svn: 39893
2007-07-16 02:08:00 +00:00
Chris Lattner aee0cfd486 Now that isPointerType can return a pointer type, avoid stripping off typedef
information in the common case.  On this invalid code:

typedef float float4 __attribute__((vector_size(16)));
typedef int int4 __attribute__((vector_size(16)));
void test(float4 a, int4 *result, int i) {
    result[i] = a;
}

we now generate:
  t.c:5:15: error: incompatible types assigning 'float4' to 'int4'
instead of:
  t.c:5:15: error: incompatible types assigning 'float4' to 'int  __attribute__((vector_size(16)))'

This implements test/Sema/typedef-retain.c

llvm-svn: 39892
2007-07-16 00:23:25 +00:00
Chris Lattner 36d572b9ea Use the return value of isPointerType and isVectorType to significantly simplify
ParseArraySubscriptExpr.  Notably, the new code doesn't have to think about 
canonical types at all.

llvm-svn: 39891
2007-07-16 00:14:47 +00:00
Chris Lattner 68ebef886a as a very useful feature, make isVectorType and isPointerType return
the actual vectortype or pointertype when they return success.

llvm-svn: 39890
2007-07-16 00:13:25 +00:00
Chris Lattner 5981db49a2 rename variables to be more consistent. Always use LHS/RHS intead of T1/T2 sometimes.
llvm-svn: 39889
2007-07-15 23:59:53 +00:00
Chris Lattner 51aff8bd7c Remove an extraneous QualType from CastExpr, it's type is always
the result type of the expr node.

Implement isIntegerConstantExpr for ImplicitCastExpr nodes the same
was as for CastExpr nodes.

Implement proper sign/zero extension as well as truncation and noop
conversion in the i-c-e evaluator.  This allows us to correctly
handle i-c-e's like these:

char array[1024/(sizeof (long))];
int x['\xBb' == (char) 187 ? 1: -1];

this implements test/Sema/i-c-e2.c

llvm-svn: 39888
2007-07-15 23:54:50 +00:00
Chris Lattner 48f84b85b7 don't let builtin-type handling code fall into pointer handling code
not all builtin types have size and alignment equal to pointers :)

llvm-svn: 39887
2007-07-15 23:46:53 +00:00
Chris Lattner 5c4664e355 set the correct width for a character literal when evaluating it as an i-c-e.
llvm-svn: 39886
2007-07-15 23:32:58 +00:00
Chris Lattner 0f0adc6b9d add a helper method.
llvm-svn: 39885
2007-07-15 23:32:03 +00:00
Chris Lattner 0e9d6226ca Refactor code so that isIntegerConstantExpr has an ASTContext available.
llvm-svn: 39884
2007-07-15 23:26:56 +00:00
Chris Lattner ec6480e235 new testcase
llvm-svn: 39882
2007-07-15 22:30:34 +00:00
Chris Lattner d4fef8dbca Implement shift-simplify.ll:test[45].
First teach instcombine that sign bit checks only demand the 
sign bit, this allows simplify demanded bits to hack on 
expressions better.

Second, teach instcombine that ashr is useless if only the
sign bit is demanded.

llvm-svn: 39880
2007-07-15 20:54:51 +00:00
Chris Lattner 06205d5567 Implement shift-simplify.ll:test3, turning:
(X << 31) <s 0  --> (X&1) != 0

This happens dozens of times in the CFE.

llvm-svn: 39879
2007-07-15 20:42:37 +00:00
Chris Lattner b1711e8485 remove obsolete comment.
llvm-svn: 39868
2007-07-15 06:46:25 +00:00
Chris Lattner 3fc74e2468 Change SourceManager::getInstantiationLoc to take virtual locations, doing its
virtual->physical mapping explicitly.

llvm-svn: 39867
2007-07-15 06:35:27 +00:00
Steve Naroff 81569d2044 This is the final step/commit for implementing exlicit implicit casts. Unlike the
previous two checkins, which involved lot's of tedious refactoring, this checkin is nice and clean:-)

- Hacked UsualUnaryConversions, UsualArithmeticConversions, and DefaultFunctionArrayConversion
to create the AST node (using a helper function promoteExprToType).
- Added a setType method to Expr.
- Changed Expr::isIntegerConstantExpr to allow for the new node.

llvm-svn: 39866
2007-07-15 02:02:06 +00:00
Chris Lattner 598305dfbd non-apple targets should be like i386, not the mythical, bogus, linux target.
llvm-svn: 39865
2007-07-15 01:37:36 +00:00
Chris Lattner c02c4abe5b Cache macro expander objects to avoid thrashing malloc in heavy expansion situations.
This doesn't significantly improve carbon.h, but it does speed up
INPUTS/macro_pounder_obj.c by 48%

llvm-svn: 39864
2007-07-15 00:25:26 +00:00
Chris Lattner 03928c7f9a Make parser scope cache be a member of the parser instead of a global,
which makes it multithread clean.

llvm-svn: 39863
2007-07-15 00:04:39 +00:00
Chris Lattner 564f478595 switch function-like macros from using a vector for their arguments to an
explicitly new'd array.  The array never mutates once created, so a vector
is overkill.

llvm-svn: 39862
2007-07-14 22:46:43 +00:00
Chris Lattner 819f2ef77b switch from using a vector to a smallvector for macro replacement tokens
This speeds up parsing carbon.h by 3.3% by avoiding some malloc traffic for 
small macros.

llvm-svn: 39861
2007-07-14 22:15:50 +00:00
Chris Lattner f40fe99118 expose an iterator interface to getReplacementTokens instead of the datastructure itself.
llvm-svn: 39860
2007-07-14 22:11:41 +00:00
Chris Lattner a3834341c5 split function-like and object-like macro body parsing to make the
code more obvious.

llvm-svn: 39859
2007-07-14 21:54:03 +00:00
Gabor Greif e97cd7e65c add FIXME and un-XFAIL test
llvm-svn: 39858
2007-07-14 20:05:18 +00:00
Nick Lewycky ddc2f9ba57 Clarify the language. Pointed out by Duncan Sands.
llvm-svn: 39857
2007-07-14 17:41:03 +00:00
Nick Lewycky d20f485866 Fix the build. Patch from Holger Schurig.
llvm-svn: 39856
2007-07-14 15:11:14 +00:00
Anton Korobeynikov 383a324735 Long live the exception handling!
This patch fills the last necessary bits to enable exceptions
handling in LLVM. Currently only on x86-32/linux.

In fact, this patch adds necessary intrinsics (and their lowering) which
represent really weird target-specific gcc builtins used inside unwinder.

After corresponding llvm-gcc patch will land (easy) exceptions should be
more or less workable. However, exceptions handling support should not be 
thought as 'finished': I expect many small and not so small glitches
everywhere.

llvm-svn: 39855
2007-07-14 14:06:15 +00:00
Bill Wendling 657a203adf Add missing directory
llvm-svn: 39853
2007-07-14 09:37:10 +00:00
Nick Lewycky 39519f5c41 Use maximal intersection algorithm exclusively. Fixes miscompile bug.
llvm-svn: 39852
2007-07-14 04:28:04 +00:00
Nick Lewycky 61b4a265ee Add alternate ConstantRange intersection algorithm.
llvm-svn: 39851
2007-07-14 02:51:34 +00:00
Chris Lattner 4481b428db A significant refactoring of the type size stuff to also
compute type alignment.  This info is needed for struct layout.

llvm-svn: 39850
2007-07-14 01:29:45 +00:00
Chris Lattner 9d3b0e0001 Implement trivial integer initializers, like 'int X = 4;' for global
vars.  Approach suggested by Keith.

llvm-svn: 39849
2007-07-14 00:23:28 +00:00
Chris Lattner 6ee31f5df8 In "int X,Y;", compile both X and Y.
llvm-svn: 39848
2007-07-14 00:16:50 +00:00
Chris Lattner 027f21dd72 add a fixme
llvm-svn: 39847
2007-07-14 00:01:01 +00:00
Chris Lattner 666115c848 Improve char literal pretty printing, patch by Keith Bauer!
llvm-svn: 39846
2007-07-13 23:58:20 +00:00
Evan Cheng 07bc082891 Added test case from PR1540.
llvm-svn: 39845
2007-07-13 23:57:33 +00:00
Devang Patel 4cd1413f15 Make LCSSA a loop pass.
llvm-svn: 39844
2007-07-13 23:57:11 +00:00
Evan Cheng 1fae1cd3e1 Fix for PR1540: Specify F0, F1 are sub-registers of D0, etc.
llvm-svn: 39843
2007-07-13 23:55:50 +00:00
Gabor Greif 03a0073b36 fix type of main, use !=
llvm-svn: 39842
2007-07-13 23:40:27 +00:00