Commit Graph

74 Commits

Author SHA1 Message Date
Chris Lattner df53e20f2d implement codegen support for aggregates casted to void.
llvm-svn: 47226
2008-02-16 23:55:16 +00:00
Chris Lattner 6cba8e9d66 minor tweak to anders patch: (only) ocu vectors support splatting, but
ocu vectors should not treat bitcasts from int <-> vector as a splat
unless it is of the element type.

llvm-svn: 46664
2008-02-02 04:51:41 +00:00
Anders Carlsson 0b05d041f2 Only OCU vectors can be splatted.
llvm-svn: 46651
2008-02-01 23:17:55 +00:00
Chris Lattner a94035bbb8 Fix PR1921 by promoting negative indices to intptrty.
llvm-svn: 46599
2008-01-31 04:12:50 +00:00
Nate Begeman 936b207407 Implement first round of feedback on __builtin_overload
llvm-svn: 46572
2008-01-30 20:50:20 +00:00
Eli Friedman 9d92ce8b3a Make sure to emit all the arguments to a function call. This fixes the
codegen of calls to functions without a prototype and varargs functions, 
including printf.

llvm-svn: 46543
2008-01-30 01:32:06 +00:00
Eli Friedman 7031d734ed Fix a bug where CodeGen would attempt to erase an instruction that was
already used.

llvm-svn: 46519
2008-01-29 18:13:51 +00:00
Anders Carlsson a8dc3e6b52 Implement __builtin_offsetof.
llvm-svn: 46515
2008-01-29 15:56:48 +00:00
Anders Carlsson 6f2a10e8c9 Correctly handle scalars in braces.
llvm-svn: 46480
2008-01-29 01:15:48 +00:00
Fariborz Jahanian 0a71ad2e07 Problem with ObjC's type-encoding of nested structs causing infinit recursion.
llvm-svn: 46260
2008-01-22 22:44:46 +00:00
Nate Begeman 1e36a85f64 Implement basic overload support via a new builtin, __builtin_overload.
__builtin_overload takes 2 or more arguments:
0) a non-zero constant-expr for the number of arguments the overloaded 
   functions will take
1) the arguments to pass to the matching overloaded function
2) a list of functions to match.

The return type of __builtin_overload is inferred from the function whose args
match the types of the arguments passed to the builtin.  For example:

float a;
float sinf(float);
int   sini(int);

float b = __builtin_overload(1, a, sini, sinf);

Says that we are overloading functions that take one argument, and trying to 
pass an argument of the same type as 'a'.  sini() does not match since it takes
and argument of type int.  sinf does match, so at codegen time this will turn
into float b = sinf(a);

llvm-svn: 46132
2008-01-17 17:46:27 +00:00
Ted Kremenek 1b0ea82459 Substituted all instances of the string "Objc" for "ObjC". This fixes
some naming inconsistencies in the names of classes pertaining to Objective-C
support in clang.

llvm-svn: 45715
2008-01-07 19:49:32 +00:00
Chris Lattner 1800c18ebd fix long lines.
llvm-svn: 45531
2008-01-03 07:05:49 +00:00
Chris Lattner 20455f204f Fix a crash reported by Seo Sanghyeon.
llvm-svn: 45530
2008-01-03 06:36:51 +00:00
Nate Begeman 330aaa79e0 Allow implicit casts during arithmetic for OCUVector operations
Add codegen support and test for said casts.

llvm-svn: 45443
2007-12-30 02:59:45 +00:00
Nate Begeman 628028bd27 Allow codegen of vector fdiv
llvm-svn: 45440
2007-12-30 01:28:16 +00:00
Chris Lattner 5b12ab8c93 Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.

llvm-svn: 45410
2007-12-29 19:59:25 +00:00
Anders Carlsson c9d41e7d27 No need to do work that the folding builder does for us.
llvm-svn: 45361
2007-12-26 18:20:19 +00:00
Seo Sanghyeon acb00f4a73 Remove broken assert from CodeGen. Better check is done in Sema.
llvm-svn: 45358
2007-12-26 05:21:37 +00:00
Anders Carlsson aa5c91980e Turns out the LLVMFoldingBuilder can fold InsertElement. Knowing this, we can get rid of our special casing of constants when creating vectors.
llvm-svn: 45145
2007-12-18 02:45:33 +00:00
Anders Carlsson f5f6544edc We now support all MMX intrinsics. SSE intrinsics are next.
llvm-svn: 45062
2007-12-15 21:23:30 +00:00
Chris Lattner c6208a72f7 Fix a codegen crash on test/CodeGen/cast.c, reported by Keith.
llvm-svn: 44908
2007-12-12 04:13:20 +00:00
Ted Kremenek d4e5fbacab Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. Now
SourceManager is passed by reference, allowing the SourceManager to be
associated with a specific translation unit, and not the entire execution
of the driver.

Modified all users of Diagnostics to comply with this new interface.

Integrated SourceManager as a member variable of TargetInfo. TargetInfo will
eventually be associated with a single translation unit (just like
SourceManager).

Made the SourceManager reference in ASTContext private. Provided accessor
getSourceManager() for clients to use instead. Modified clients to comply with
new interface.

llvm-svn: 44878
2007-12-11 21:27:55 +00:00
Ted Kremenek f182e81d85 Added missing inclusion of stdarg.h. Now CGExprScalar.cpp
compiles again on Linux.

llvm-svn: 44821
2007-12-10 23:44:32 +00:00
Anders Carlsson b9eb82c3ee Add EmitShuffleVector helper method.
llvm-svn: 44806
2007-12-10 19:35:18 +00:00
Anders Carlsson a297e7a888 Implement CodeGen for vectors. Don't create unnecessary conversion instructions if the value to be converted is a constant.
llvm-svn: 44606
2007-12-05 07:36:10 +00:00
Seo Sanghyeon 3d072bea09 Ignore typedefs in pointer arithmetic codegen.
llvm-svn: 44529
2007-12-03 06:23:43 +00:00
Chris Lattner f0780fae43 convert the rest of the stderr users in codegen to use diagnostics.
llvm-svn: 44503
2007-12-02 01:49:16 +00:00
Chris Lattner b6a7b582ee Fix a codegen crash on void ?: reported by Oliver
llvm-svn: 44454
2007-11-30 17:56:23 +00:00
Chris Lattner 2ab40a6207 Fix sema support for the gnu ?: expression with a
missing middle expression, and fix a codegen bug where
we didn't correctly promote the condition to the right 
result type.  This fixes PR1824.

llvm-svn: 44322
2007-11-26 01:40:58 +00:00
Nate Begeman 4c18c23eb3 Implement codegen of CXX Bool
llvm-svn: 44160
2007-11-15 05:40:03 +00:00
Anders Carlsson e89b84ab29 Fix a typo that prevented pointer-to-int conversions from working.
llvm-svn: 43588
2007-10-31 23:18:02 +00:00
Devang Patel ffe1e218f2 Fix 80 col violations.
llvm-svn: 43516
2007-10-30 20:59:40 +00:00
Devang Patel fa0cb1ef3a Remove commented out line.
llvm-svn: 43508
2007-10-30 18:31:12 +00:00
Anders Carlsson d849982e84 Add (partial) support for @encode.
llvm-svn: 43439
2007-10-29 05:01:08 +00:00
Devang Patel b989c9e65c Fix "strbuf += stufflen;" crash.
llvm-svn: 43365
2007-10-25 22:19:13 +00:00
Chris Lattner 35e564ed09 Add a new ChooseExpr::isConditionTrue method to unify
some code.

llvm-svn: 43322
2007-10-25 00:29:32 +00:00
Devang Patel b67e596d86 Handle non-constant initializers.
llvm-svn: 43301
2007-10-24 18:05:48 +00:00
Devang Patel 43fc86d0f2 Visit CompoundLiteralExpr and InitListExpr
llvm-svn: 43300
2007-10-24 17:18:43 +00:00
Hartmut Kaiser 7078da8e58 Updated VC++ build system.
Silenced some VC++ warnings.
Had to rephrase a partial specialization of the IntrospectionTrait struct in SerializationTest.cpp, please review.
Added a compiler specific workaround in IdentifierTable.h. Is that the way to fix this kind of issues?

llvm-svn: 43074
2007-10-17 15:00:17 +00:00
Steve Naroff 32e44c0032 Move type compatibility predicates from Type to ASTContext. In addition, the predicates are now instance methods (they were previously static class methods on Type).
This allowed me to fix the following hack from this weekend...

// FIXME: Devise a way to do this without using strcmp.
// Would like to say..."return getAsStructureType() == IdStructType;", but
// we don't have a pointer to ASTContext.
bool Type::isObjcIdType() const {
  if (const RecordType *RT = getAsStructureType())
    return !strcmp(RT->getDecl()->getName(), "objc_object");
  return false;
}

...which is now...

bool isObjcIdType(QualType T) const {
  return T->getAsStructureType() == IdStructType;
}

Side notes:

- I had to remove a convenience function from the TypesCompatibleExpr class.

int typesAreCompatible() const {return Type::typesAreCompatible(Type1,Type2);}

Which required a couple clients get a little more verbose...

-    Result = TCE->typesAreCompatible();
+    Result = Ctx.typesAreCompatible(TCE->getArgType1(), TCE->getArgType2());

Overall, I think this change also makes sense for a couple reasons...

1) Since ASTContext vends types, it makes sense for the type compatibility API to be there.
2) This allows the type compatibility predeciates to refer to data not strictly present in the AST (which I have found problematic on several occasions).

llvm-svn: 43009
2007-10-15 20:41:53 +00:00
Anders Carlsson 7e13ab88a2 Add code generation and sema checking for __builtin_va_arg.
llvm-svn: 43006
2007-10-15 20:28:48 +00:00
Anders Carlsson d5f857f2e5 Fix an incorrect assertion.
llvm-svn: 42951
2007-10-13 05:52:34 +00:00
Anders Carlsson 24ebce6fca Generate code for va_start and va_end.
llvm-svn: 42939
2007-10-12 23:56:29 +00:00
Devang Patel 7ad0c2f1f9 Use LLVMFoldingBuilder
llvm-svn: 42807
2007-10-09 19:49:58 +00:00
Chris Lattner 2dd003e807 further apfloat'ize the front-end, allowing codegen to pass
APFloat straight through to LLVM now.

llvm-svn: 42236
2007-09-22 18:47:25 +00:00
Chris Lattner d3d8aca074 update to match llvm mainline api
llvm-svn: 41926
2007-09-13 06:19:18 +00:00
Chris Lattner 6fb276d433 adjust to a change in the LLVM APIs, this is still very hackish until
the front-end adopts APFloat though.  This fixes test/CodeGen/mandel.c

llvm-svn: 41908
2007-09-13 01:26:11 +00:00
Chris Lattner 69de3f4af6 When dumping out errors about unsupported stuff, emit loc info.
llvm-svn: 41907
2007-09-13 01:17:29 +00:00
Hartmut Kaiser ec7531c9f6 Fixed compilation on Windows.
Silenced a couple of warnings.
Added *.vcproj file for new clangAnalysis library.
Renamed Basic to clangBasic projects.

llvm-svn: 41767
2007-09-07 14:34:20 +00:00