]>
granicus.if.org Git - clang/log
Chris Lattner [Fri, 3 Aug 2007 16:37:04 +0000 (16:37 +0000)]
implement codegen for multidest ocuvector expressions, like:
vec2.yx = vec2; // reverse
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40782
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 3 Aug 2007 16:28:33 +0000 (16:28 +0000)]
add codegen support for storing into a single-element ocu lvalue, such as:
vec2.x = f;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40781
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 3 Aug 2007 16:18:34 +0000 (16:18 +0000)]
refactor handling of ocuvector lvalue->rvalue codegen into its own method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40780
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 3 Aug 2007 16:09:33 +0000 (16:09 +0000)]
In the common case where we are shuffling a vector, emit an
llvm vector shuffle instead of a bunch of insert/extract operations.
For: vec4 = vec4.yyyy; // splat
Emit:
%tmp1 = shufflevector <4 x float> %tmp, <4 x float> undef, <4 x i32> < i32 1, i32 1, i32 1, i32 1 >
instead of:
%tmp1 = extractelement <4 x float> %tmp, i32 1
%tmp2 = insertelement <4 x float> undef, float %tmp1, i32 0
%tmp3 = extractelement <4 x float> %tmp, i32 1
%tmp4 = insertelement <4 x float> %tmp2, float %tmp3, i32 1
%tmp5 = extractelement <4 x float> %tmp, i32 1
%tmp6 = insertelement <4 x float> %tmp4, float %tmp5, i32 2
%tmp7 = extractelement <4 x float> %tmp, i32 1
%tmp8 = insertelement <4 x float> %tmp6, float %tmp7, i32 3
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40779
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 3 Aug 2007 16:00:20 +0000 (16:00 +0000)]
add OCUVectorComponent::getNumComponents()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40778
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 3 Aug 2007 15:52:31 +0000 (15:52 +0000)]
Add support for scalar-returning element accesses like V.x
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40777
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 3 Aug 2007 00:16:29 +0000 (00:16 +0000)]
implement lvalue to rvalue conversion for ocuvector components. We can now compile stuff
like this:
typedef __attribute__(( ocu_vector_type(4) )) float float4;
float4 test1(float4 V) {
return V.wzyx+V;
}
to:
_test1:
pshufd $27, %xmm0, %xmm1
addps %xmm0, %xmm1
movaps %xmm1, %xmm0
ret
and:
_test1:
mfspr r2, 256
oris r3, r2, 4096
mtspr 256, r3
li r3, lo16(LCPI1_0)
lis r4, ha16(LCPI1_0)
lvx v3, r4, r3
vperm v3, v2, v2, v3
vaddfp v2, v3, v2
mtspr 256, r2
blr
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40771
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 23:37:31 +0000 (23:37 +0000)]
add support for codegen of an OCUVectorComponent as an lvalue.
We can now codegen:
vec4.xy;
as nothing!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40769
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 23:36:59 +0000 (23:36 +0000)]
Add support for encoding a OCUVectorComponent into a single integer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40768
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 22:41:43 +0000 (22:41 +0000)]
oops, this is the real fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40766
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 22:36:03 +0000 (22:36 +0000)]
update test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40765
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 22:33:49 +0000 (22:33 +0000)]
rename some helpers, have them return the idx of the field being accessed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40764
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 22:20:00 +0000 (22:20 +0000)]
Use static methods, which don't require an instance of OCUVectorType
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40763
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 22:19:39 +0000 (22:19 +0000)]
mark some methods static, don't consider a vector to be an ocuvector
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40762
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 21:50:34 +0000 (21:50 +0000)]
silence some warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40761
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 21:47:28 +0000 (21:47 +0000)]
Minor comment improvements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40760
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 21:40:29 +0000 (21:40 +0000)]
make sure we don't lose the ability to parse carbon.h
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40759
91177308 -0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Thu, 2 Aug 2007 09:58:41 +0000 (09:58 +0000)]
Hyphenate a word, to check auto-update feature. Third times the charm!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40734
91177308 -0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Thu, 2 Aug 2007 09:54:52 +0000 (09:54 +0000)]
Expand a contraction to test auto-update on commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40733
91177308 -0d34-0410-b5e6-
96231b3b80d8
Reid Spencer [Thu, 2 Aug 2007 09:50:49 +0000 (09:50 +0000)]
Test auto-update with minor grammaro fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40732
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 04:22:39 +0000 (04:22 +0000)]
Fix a bug in my previous commit
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40719
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 04:14:33 +0000 (04:14 +0000)]
switch a fixme to an assert.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40717
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Thu, 2 Aug 2007 04:09:23 +0000 (04:09 +0000)]
Tweak to Expr::isIntegerConstantExpr...make sure the result is appropriately size for TypesCompatibleExpr's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40716
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 2 Aug 2007 03:55:37 +0000 (03:55 +0000)]
Increase the macro id cache to look up several recent entries, not just the last one.
This is important in insane cases like the one dannyb sent me recently:
#define F0(a) void a(){}
#define F1(a) F0(a##0) F0(a##1) F0(a##2) F0(a##3) F0(a##4) F0(a##5) F0(a##6) F0(a##7)
#define F2(a) F1(a##0) F1(a##1) F1(a##2) F1(a##3) F1(a##4) F1(a##5) F1(a##6) F1(a##7)
#define F3(a) F2(a##0) F2(a##1) F2(a##2) F2(a##3) F2(a##4) F2(a##5) F2(a##6) F2(a##7)
#define F4(a) F3(a##0) F3(a##1) F3(a##2) F3(a##3) F3(a##4) F3(a##5) F3(a##6) F3(a##7)
#define F5(a) F4(a##0) F4(a##1) F4(a##2) F4(a##3) F4(a##4) F4(a##5) F4(a##6) F4(a##7)
#define F6(a) F5(a##0) F5(a##1) F5(a##2) F5(a##3) F5(a##4) F5(a##5) F5(a##6) F5(a##7)
F6(f)
cpp is great. :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40715
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Thu, 2 Aug 2007 02:53:48 +0000 (02:53 +0000)]
Tidy up Parser::ParseTypeofSpecifier()...implement FIXME and minor restructure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40713
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Thu, 2 Aug 2007 00:19:14 +0000 (00:19 +0000)]
Add a couple const modifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40708
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Thu, 2 Aug 2007 00:13:27 +0000 (00:13 +0000)]
Hack Expr::isConstantExpr() to allow for __builtin_types_compatible_p.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40705
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Wed, 1 Aug 2007 23:45:51 +0000 (23:45 +0000)]
- Finish hooking up support for __builtin_types_compatible_p().
- Fix type printing code for recently added TypeOfExpr/TypeOfType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40700
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Wed, 1 Aug 2007 22:05:33 +0000 (22:05 +0000)]
Add AST/Sema support for __builtin_types_compatible_p (a GNU extension).
Todo...still need to call the action from the parser...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40693
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Wed, 1 Aug 2007 18:02:17 +0000 (18:02 +0000)]
Add comments to getTypeOfExpr/getTypeOfType.
Also add instances of TypeOfExpr/TypeOfType to the Types vector (so we can keep track of them).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40677
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Wed, 1 Aug 2007 17:20:42 +0000 (17:20 +0000)]
Two typeof() related changes...
- Changed the name of ASTContext::getTypeOfType(Expr*)->getTypeOfExpr().
- Remove FIXME for TypeOfExpr::getAsStringInternal(). This will work fine for printing the AST. It isn't ideal
for error diagnostics (since it's more natural to display the expressions type).
One "random" (or at least delayed:-) change...
- Changed all "ext_typecheck_*" diagnostics from EXTENSION->WARNING. Reason: Since -pedantic is now
off (by default), these diagnostics were never being emitted (which is bad). With this change, clang will
emit the warning all the time. The only downside (wrt GCC compatibility) is -pedantic-errors will not turn
this diagnostics into errors (a "feature" of making tagging them with EXTENSION). When/if this becomes
an issue, we can revisit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40676
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 1 Aug 2007 06:24:52 +0000 (06:24 +0000)]
update this to build with LLVM ToT
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40665
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 1 Aug 2007 00:23:58 +0000 (00:23 +0000)]
Print floating point literal values better.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40659
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Tue, 31 Jul 2007 23:56:32 +0000 (23:56 +0000)]
Tighten up Parser::ParseTypeofSpecifier().
Add some more tests to typeof.c. Also added a couple of missing "expect" attributes that caused the test to fail.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40656
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 21:33:24 +0000 (21:33 +0000)]
remove more explicit accesses to the canonical type pointer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40653
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 21:27:01 +0000 (21:27 +0000)]
simplify some type checking code, don't explicitly access
canonical types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40652
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 21:13:58 +0000 (21:13 +0000)]
move trivial type predicates inline.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40651
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 19:29:30 +0000 (19:29 +0000)]
split the rest of the type predicates into pure predicates:
there is now an isXXXType and a getAsXXXType
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40646
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 18:57:09 +0000 (18:57 +0000)]
add internals manual to project
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40645
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 18:54:50 +0000 (18:54 +0000)]
Owen pointed out that this made no sense :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40644
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 18:43:04 +0000 (18:43 +0000)]
add two missing files to the xcode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40643
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 16:56:34 +0000 (16:56 +0000)]
rename isReferenceType to follow the new scheme.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40640
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 16:53:04 +0000 (16:53 +0000)]
make isPointerType() a pure predicate, rename the
existing one to getAsPointerType()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40639
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 16:50:51 +0000 (16:50 +0000)]
update name
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40637
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Tue, 31 Jul 2007 12:34:36 +0000 (12:34 +0000)]
Add parsing and AST support for GNU "typeof".
Many small changes to lot's of files.
Still some FIXME's, however the basic support is in place.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40631
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 06:37:39 +0000 (06:37 +0000)]
Oops, I committed the wrong file before. This expands the description of
type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40620
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 05:42:17 +0000 (05:42 +0000)]
Add a start at a clang internals manual, documenting some
of the more subtle and interesting classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40615
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 31 Jul 2007 04:52:37 +0000 (04:52 +0000)]
add a link
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40614
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 30 Jul 2007 18:53:26 +0000 (18:53 +0000)]
Don't use canonical type for sema here. In
void func() {
typedef int foo;
foo *Y;
**Y; // error
}
we now get:
indirection requires pointer operand ('foo' invalid)
instead of:
indirection requires pointer operand ('int' invalid)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40597
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Mon, 30 Jul 2007 03:52:55 +0000 (03:52 +0000)]
Upgrade a comment...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40585
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Mon, 30 Jul 2007 03:29:09 +0000 (03:29 +0000)]
Finish up semantic analysis for vector components.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40584
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Sun, 29 Jul 2007 16:33:31 +0000 (16:33 +0000)]
Implement pretty diagnostics when doing on-the-fly vector sizing (for vector component access).
For example, before this commit, the following diagnostics would be emitted...
ocu.c:49:12: error: incompatible types assigning 'float __attribute__((ocu_vector_type(3)))' to 'float4'
vec4_2 = vec4.rgb; // shorten
~~~~~~ ^ ~~~~~~~~
ocu.c:51:7: error: incompatible types assigning 'float __attribute__((ocu_vector_type(2)))' to 'float'
f = vec2.xx; // shorten
~ ^ ~~~~~~~
Now, the diagnostics look as you would expect...
ocu.c:49:12: error: incompatible types assigning 'float3' to 'float4'
vec4_2 = vec4.rgb; // shorten
~~~~~~ ^ ~~~~~~~~
ocu.c:51:7: error: incompatible types assigning 'float2' to 'float'
f = vec2.xx; // shorten
~ ^ ~~~~~~~
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40579
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Sat, 28 Jul 2007 23:10:27 +0000 (23:10 +0000)]
Added a new expression, OCUVectorComponent.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40577
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Fri, 27 Jul 2007 22:15:19 +0000 (22:15 +0000)]
Implement syntax/semantic analysis for OCU Vector Components.
Next step, AST support...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40568
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Thu, 26 Jul 2007 18:32:01 +0000 (18:32 +0000)]
Add Type::isOCUVectorType().
Convert isFunctionType(), isStructureType(), and isUnionType() to the new API.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40541
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Thu, 26 Jul 2007 14:35:56 +0000 (14:35 +0000)]
Fix the following bogus diagnostic...reported by Jeroen.
#include <stdio.h>
int
main(void) {
int test = 0;
printf("Type is %s\n", (test >= 1 ? "short" : "char"));
return (0);
}
It comes up with a diagnostic that's misleading upon first read.
t.c:7:36: error: incompatible operand types ('char *' and 'char *')
printf("Type is %s\n", (test >= 1 ? "short" : "char"));
^ ~~~~~~~ ~~~~~~
1 diagnostic generated.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40526
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 26 Jul 2007 06:11:49 +0000 (06:11 +0000)]
add another link.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40512
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 26 Jul 2007 05:59:05 +0000 (05:59 +0000)]
don't expect to be able to reparse arbitrary system headers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40511
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Thu, 26 Jul 2007 03:18:02 +0000 (03:18 +0000)]
Forgot a return stmt (oops).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40509
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Thu, 26 Jul 2007 03:11:44 +0000 (03:11 +0000)]
Various improvements to Sema::ParseMemberReferenceExpr().
- Added source range support to Diag's.
- Used the new type predicate API to remove dealing with the canonical
type explicitly.
- Added Type::isRecordType().
- Removed some casts.
- Removed a const qualifier from RecordType::getDecl().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40508
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Wed, 25 Jul 2007 20:45:33 +0000 (20:45 +0000)]
- Fix commit in Parser.h (patch by Kevin Andre).
- Add comment and minor cleanup to yesterday's fix to ParseCallExpr().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40492
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Wed, 25 Jul 2007 00:24:17 +0000 (00:24 +0000)]
Fix a couple of bugs, add some new cool stuff.
1. Fix a todo in Parser::ParseTag, to recover better. On code like
that in test/Sema/decl-invalid.c it causes us to return a single
error instead of multiple.
2. Fix an error in Sema::ParseDeclarator, where it would crash if the
declarator didn't have an identifier. Instead, diagnose the problem.
3. Start adding infrastructure to track the range of locations covered
by a declspec or declarator. This is mostly implemented for declspec,
but could be improved, it is missing for declarator.
Thanks to Neil for pointing out this crash.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40482
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Tue, 24 Jul 2007 21:46:40 +0000 (21:46 +0000)]
Fix Sema::ParseCallExpr()...it wasn't doing the default array/function promotions on it's argument types.
This resulted in the following errors when compiling promote_types_in_proto.c test...
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang test/Parser/promote_types_in_proto.c
test/Parser/promote_types_in_proto.c:7:24: error: incompatible types passing 'char *[]' to function expecting 'char *const []'
arrayPromotion(argv);
~~~~~~~~~~~~~~ ^~~~
test/Parser/promote_types_in_proto.c:8:27: error: incompatible types passing 'void (char *const [])' to function expecting 'void (char *const [])'
functionPromotion(arrayPromotion);
~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~
2 diagnostics generated.
When fixing this, noticed that both ParseCallExpr() and ParseReturnStmt() were prematurely comparing types for
equivalence. This is incorrect (since the expr. promotions haven't been done yet). To fix this, I moved the
check "down" to Sema::CheckAssignmentConstraints().
I also converted Type::isArrayType() to the modern API (since I needed it). Still more Type predicates to
convert.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40475
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 24 Jul 2007 18:03:18 +0000 (18:03 +0000)]
add documentation skeleton
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40471
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 24 Jul 2007 17:59:54 +0000 (17:59 +0000)]
add a bare bones web page
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40470
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 24 Jul 2007 17:03:04 +0000 (17:03 +0000)]
Fix a comment, patch by Kevin Andre!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40466
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 24 Jul 2007 16:58:17 +0000 (16:58 +0000)]
implement ast building and trivial semantic analysis of stmt exprs.
This implements test/Sema/stmt_exprs.c
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40465
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 24 Jul 2007 06:59:01 +0000 (06:59 +0000)]
avoid std::string yet again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40462
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 24 Jul 2007 06:57:14 +0000 (06:57 +0000)]
Use a smallstring instead of an std::string in FileChanged to avoid some malloc traffic.
This speeds up -E on xalancbmk by 2.4%
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40461
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 24 Jul 2007 06:43:46 +0000 (06:43 +0000)]
check in an experiment that didn't work out, to allow for future investigation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40460
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Tue, 24 Jul 2007 05:57:19 +0000 (05:57 +0000)]
Add a cache to SourceManager to accellerate line # lookup. This is a
bottleneck for -E computation, because every token that starts a line needs
to determine *which* line it is on (so -E mode can insert the appropriate
vertical whitespace). This optimization improves this common case where
it is striding through the line # table.
This speeds up -E on xalancbmk by 3.2%
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40459
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 23 Jul 2007 23:21:34 +0000 (23:21 +0000)]
Fix two paste-avoidance bugs I introduced last night. Patch
by Neil Booth. This fixes Preprocessor/output_paste_avoid.c
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40454
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 23 Jul 2007 22:46:22 +0000 (22:46 +0000)]
fix bogus warnings about potentially uninit vars Size and Align.
Patch by Neil Booth!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40452
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 23 Jul 2007 22:23:52 +0000 (22:23 +0000)]
Fix a scoping bug that apple gcc doesn't catch for some reason.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40450
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 23 Jul 2007 17:05:23 +0000 (17:05 +0000)]
correctly verify that default and case are in a switchstmt,
this fixes test/Sema/switch.c.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40438
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 23 Jul 2007 06:31:11 +0000 (06:31 +0000)]
avoid creating std::strings in MoveToLine
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40424
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 23 Jul 2007 06:23:07 +0000 (06:23 +0000)]
In OutputString, avoid calling memcpy for really tiny strings.
This speeds up -E on 447.dealII by 5.8%
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40423
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 23 Jul 2007 06:14:36 +0000 (06:14 +0000)]
Avoid calling getSpelling at all for identifiers, which are
trivial to handle and very very common. This speeds up -E on
447.dealII by 2.5%
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40422
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 23 Jul 2007 06:09:34 +0000 (06:09 +0000)]
change the concatenation avoidance algorithm to be partially table-driven
and avoid computing the spelling of tokens when not needed. This speeds
up -E on 447.dealII by 2.2%
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40421
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 23 Jul 2007 05:18:42 +0000 (05:18 +0000)]
If a token doesn't need cleaning, we can get its first character
without having to get the whole token. This speeds up -E on
447.dealII by 1.8%
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40420
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 23 Jul 2007 05:14:05 +0000 (05:14 +0000)]
A minor tweak to -E output, speeding up -E 1.5% on 447.dealII
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40419
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 23 Jul 2007 04:56:47 +0000 (04:56 +0000)]
implement a missing feature in the #include handler, where
it did not handle <xyz> headers coming from macro expansions.
This requires special treatment, as the include name is lexed
as multiple tokens, which require reassembly before processing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40418
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Mon, 23 Jul 2007 04:15:27 +0000 (04:15 +0000)]
refactor the interface to Preprocessor::GetIncludeFilenameSpelling,
no functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40414
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 22:50:09 +0000 (22:50 +0000)]
fix a bug getting the spelling of an identifier token
that required cleaning. If the token required cleaning,
don't include the cleaned tokens in the returned length.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40410
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 22:33:25 +0000 (22:33 +0000)]
no need to avoid pasting >* It can't form ->*, because we know the previous
token was not -> and if the token before it was -, the - and > would avoid pasting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40409
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 22:11:35 +0000 (22:11 +0000)]
GCC doesn't set __STDC_VERSION__ usually. It never sets it in
C++ mode, even gnu C++ mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40408
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 20:11:46 +0000 (20:11 +0000)]
Switch TargetInfo::getTargetDefines from using an std::map<std::string, ...> to using
a llvm::StringMap. This dramatically reduces the startup time of the preprocessor,
speeding up -Eonly on xalankbmk by 2.2%.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40396
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 18:44:36 +0000 (18:44 +0000)]
Change hte lexer to start a start pointer to the underlying
memorybuffer instead of a pointer to the memorybuffer itself. This
reduces coupling and eliminates a pointer dereference on a hot path.
This speeds up -Eonly on 483.xalancbmk by 2.1%
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40394
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 18:38:25 +0000 (18:38 +0000)]
split the slow path out of Lexer::getSourceLocation and do not let the
compiler inline it. This speeds up -Eonly on 483.xalancbmk by about 1%
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40393
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 07:28:00 +0000 (07:28 +0000)]
Implement a simple cache in headersearch. This speeds up
preprocessing 483.xalancbmk by about 10%, reducing the number
of file lookup queries from
2139411 to 199466 (over 10x)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40390
91177308 -0d34-0410-b5e6-
96231b3b80d8
Anders Carlsson [Sun, 22 Jul 2007 07:07:56 +0000 (07:07 +0000)]
Refactor switch analysis to make it possible to detect duplicate case values
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40388
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 06:40:36 +0000 (06:40 +0000)]
remove redundant test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40386
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 06:38:50 +0000 (06:38 +0000)]
avoid a small bit of string traffic by not storing the ""'s around a string in CurFilename
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40385
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 06:29:05 +0000 (06:29 +0000)]
avoid recursion between SkipBCPLComment and SkipWhitespace. In cases like this:
// foo
// bar
// baz
we'd get two levels of call (bcpl & whitespace) for each line, leading to some
seriously deep stacks in some cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40384
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 06:05:44 +0000 (06:05 +0000)]
when running in -E mode on multiple files, there is no reason to accumulate
fileid's and macroid's across files. Clearing between files keeps the tables
smaller and slightly speeds up compilation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40383
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 04:13:33 +0000 (04:13 +0000)]
Catch goto's with a missing identifier, patch by Neil Booth.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40381
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 22 Jul 2007 01:16:55 +0000 (01:16 +0000)]
Fix a really subtle bug in the macro expander caching code, where
redefinition of a macro could cause invalid memory to be deleted.
Found preprocessing 253.perlbmk.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40380
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sat, 21 Jul 2007 23:43:37 +0000 (23:43 +0000)]
Fix a lexer bug where we incorrectly rejected
int i = /*/ */ 1;
Thanks to Neil for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40379
91177308 -0d34-0410-b5e6-
96231b3b80d8
Steve Naroff [Sat, 21 Jul 2007 13:32:03 +0000 (13:32 +0000)]
Minor simplification to Expr::isLvalue().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40375
91177308 -0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sat, 21 Jul 2007 06:41:57 +0000 (06:41 +0000)]
Add support for reusing macroid's with negative physical loc deltas. This
keeps the MacroInfo table more compact.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40281
91177308 -0d34-0410-b5e6-
96231b3b80d8