Commit Graph

34741 Commits

Author SHA1 Message Date
Dan Gohman 06c60b6032 Fix comments about vectors to use the current wording.
llvm-svn: 39921
2007-07-16 14:29:03 +00:00
Dan Gohman c6e67a6126 Remove the trailing semicolon from function declarations in LLVM,
where it's interpreted as a comment, not part of the syntax.

llvm-svn: 39920
2007-07-16 13:37:30 +00:00
Bill Wendling a5d30d5d83 Fix validation errors
llvm-svn: 39917
2007-07-16 08:52:56 +00:00
Bill Wendling af5b63f6da Clean up some formatting
llvm-svn: 39916
2007-07-16 08:46:40 +00:00
Bill Wendling bcb3b41d99 Clean up some formatting. Add some doc_code div tags.
llvm-svn: 39915
2007-07-16 08:44:39 +00:00
Reid Spencer f8031b9cf2 Prepare for building from llvm-top. Unfortunately, this doesn't work because
of the cyclic depndency between llvm and llvm-gcc-4-0.

llvm-svn: 39910
2007-07-16 08:05:18 +00:00
Reid Spencer 961eddcfa6 Prepare stacker module for the new llvm-top build mechanism.
llvm-svn: 39909
2007-07-16 07:51:40 +00:00
Bill Wendling 457d1343b1 Constify the is*Lvalue() methods.
llvm-svn: 39907
2007-07-16 07:07:56 +00:00
Chris Lattner bb1b44f004 Make octal constant lexing use AdvanceToTokenCharacter to give more
accurate diagnostics.  For test/Lexer/comments.c we now emit:

int x = 000000080;  /* expected-error {{invalid digit}} */
               ^
constants.c:7:4: error: invalid digit '8' in octal constant
00080;             /* expected-error {{invalid digit}} */
   ^


The last line is due to an escaped newline.  The full line looks like:

int y = 0000\
00080;             /* expected-error {{invalid digit}} */


Previously, we emitted:
constants.c:4:9: error: invalid digit '8' in octal constant
int x = 000000080;  /* expected-error {{invalid digit}} */
        ^
constants.c:6:9: error: invalid digit '8' in octal constant
int y = 0000\
        ^

which isn't too bad, but the new way is better for the user,
regardless of whether there is an escaped newline or not.

All the other lexer-related diagnostics should switch over 
to using AdvanceToTokenCharacter where appropriate.  Help
wanted :).

This implements test/Lexer/constants.c.

llvm-svn: 39906
2007-07-16 06:55:01 +00:00
Chris Lattner 8a7003cd9f Add a new Preprocessor::AdvanceToTokenCharacter method which, given a sloc
specifying the start of a token and a logical (phase 3) character number,
returns a sloc representing the input character corresponding to it.

llvm-svn: 39905
2007-07-16 06:48:38 +00:00
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