Commit Graph

445 Commits

Author SHA1 Message Date
Dan Gohman 922096cc5e Adjust for the API change to APInt::getBitsSet.
People more familiar with clang than me, please review this.

llvm-svn: 47033
2008-02-12 21:49:34 +00:00
Chris Lattner c9b96ae832 strings are arrays too
llvm-svn: 46945
2008-02-11 01:35:07 +00:00
Eli Friedman f54c4e5fea A couple of minor fixes to aggregate codegen, to stop asserting on some
edge cases.

llvm-svn: 46944
2008-02-11 01:09:17 +00:00
Eli Friedman a5b2023810 Make unsupported constant exprs fail with a warning instead of crashing
codegen.

llvm-svn: 46943
2008-02-11 00:23:10 +00:00
Chris Lattner 36fc8790b7 Fix PR1992 by computing the right type for string literals, which
is an array type not a pointer type.  This requires updating some
diags that change and updating the code generator to handle the
proper form of strings.

llvm-svn: 46941
2008-02-11 00:02:17 +00:00
Anders Carlsson c0b0e59643 Implement __builtin_va_copy
llvm-svn: 46911
2008-02-09 20:26:43 +00:00
Eli Friedman a62f3e1352 Expose the logic for field address codegen; it is needed for aggregate
initializers, and I don't want to duplicate the bitfield-handling code.  
(I'll send a patch for aggregate initializers to the mailing 
list sometime soon.)

llvm-svn: 46904
2008-02-09 08:50:58 +00:00
Lauro Ramos Venancio d74057fa87 Fix a bitfield regression. Reported by Anders Carlsson.
llvm-svn: 46889
2008-02-08 19:46:46 +00:00
Anders Carlsson 5c6c05956e Put back the top-level asm code; all tests pass now.
llvm-svn: 46868
2008-02-08 00:33:21 +00:00
Anders Carlsson 0fae4f56df Back out 46855 for now, it causes test failures on Darwin.
llvm-svn: 46867
2008-02-08 00:23:11 +00:00
Lauro Ramos Venancio 9eff02d9f8 Simplify bitfield codegen.
Fix codegen of struct { short a[3]; int b:15; }.

llvm-svn: 46859
2008-02-07 19:29:53 +00:00
Lauro Ramos Venancio 0f166de892 Fix codegen of
struct {
  char a[3];
  unsigned char b:1;
};

Fix PR1990.

llvm-svn: 46856
2008-02-07 18:18:58 +00:00
Anders Carlsson bcc3a4bf64 Handle top-level asm declarations.
llvm-svn: 46855
2008-02-07 17:19:11 +00:00
Anders Carlsson d3b06cda3c Add pointer + int (and vice versa) to the constant emitter.
llvm-svn: 46812
2008-02-06 07:23:14 +00:00
Anders Carlsson 093f1a099f Generate code for the various __builtin_ctz functions.
llvm-svn: 46811
2008-02-06 07:19:27 +00:00
Chris Lattner b818af539f now that ConvertTagDeclType is nice and simple, use it from UpdateCompletedType.
llvm-svn: 46809
2008-02-06 06:06:49 +00:00
Chris Lattner d11482ea22 simplify and speed up type refinement logic. No functionality change.
llvm-svn: 46808
2008-02-06 06:03:51 +00:00
Chris Lattner a64dde6b48 only convert the type name once, not each type it is refined.
llvm-svn: 46807
2008-02-06 05:48:29 +00:00
Chris Lattner 3340b92582 simplify a bunch of code.
llvm-svn: 46805
2008-02-06 05:29:46 +00:00
Chris Lattner 56096f3020 rename TypeHolderMap to TypeCache, which more aptly describes what it is.
llvm-svn: 46804
2008-02-06 05:21:55 +00:00
Chris Lattner ee9fafd533 split tagged decl layout into its own method.
llvm-svn: 46803
2008-02-06 05:18:32 +00:00
Chris Lattner f6e3669eb2 only update the llvm type for a struct when we used the struct
previously in an opaque context.  If we didn't do this, 
computing its layout could be wasted: just be lazy.

llvm-svn: 46802
2008-02-06 05:12:09 +00:00
Chris Lattner 68be60694e sink more of the type related code into CodeGenTypes.
llvm-svn: 46801
2008-02-06 05:08:19 +00:00
Chris Lattner 8b945ee058 codegen static variables in a function into a different namespace from
static variables outside functions.

llvm-svn: 46800
2008-02-06 04:54:32 +00:00
Chris Lattner a5e4d30942 Finish off the refactoring of type handling stuff. Now we recompile every
tag decl after it has been completed

llvm-svn: 46798
2008-02-06 04:51:19 +00:00
Chris Lattner adf1f51fc5 move the codegen ASTConsumer out of the driver into libcodegen,
eliminating a bunch of forwarding methods and generally 
simplifying things.

llvm-svn: 46792
2008-02-06 02:01:47 +00:00
Anders Carlsson 3ed4aea198 Even more inline asm codegen fixes.
llvm-svn: 46784
2008-02-06 00:11:32 +00:00
Nate Begeman 3399bb424c simple implementation of __builtin_alloca
llvm-svn: 46783
2008-02-06 00:02:50 +00:00
Anders Carlsson b737b6247f Improvements to inline asm code generation.
llvm-svn: 46779
2008-02-05 23:18:57 +00:00
Anders Carlsson fcbb11a86f Add some binops.
llvm-svn: 46766
2008-02-05 20:54:21 +00:00
Anders Carlsson b170d0cf7e More improvements to inline asm CG.
llvm-svn: 46762
2008-02-05 20:01:53 +00:00
Anders Carlsson d0cd0d89a0 Append input argument to args vector.
llvm-svn: 46751
2008-02-05 16:57:38 +00:00
Anders Carlsson 952a99592f Add code generation for inline asm statements.
llvm-svn: 46750
2008-02-05 16:35:33 +00:00
Chris Lattner b1537ebdd4 rewrite some of the type refinement code to eliminate dangling pointers
simplify the code and generally make it more robust.

llvm-svn: 46745
2008-02-05 08:06:13 +00:00
Chris Lattner 86964a9653 Change the key of CGRecordLayouts from being an llvm type* to being a decl*. LLVM
Type*'s can change as types are refined, so we can't use them as a stable key in
the map.  Decls don't change, so use them instead.

This patch was written by Anders, but he's too shy to commit it himself :)

llvm-svn: 46743
2008-02-05 06:55:31 +00:00
Chris Lattner b977b6a59b Relax an assertion, fixing PR1968
llvm-svn: 46742
2008-02-05 06:37:34 +00:00
Devang Patel 6c037da51c Update outdated comment.
llvm-svn: 46737
2008-02-05 03:17:42 +00:00
Devang Patel a703a67384 Cleanup InitListExpr code generation code.
Handle padding fields while initializing struct (fix PR 1962)

llvm-svn: 46736
2008-02-05 02:39:50 +00:00
Eli Friedman 26a6dd0877 Fix memory corruption from the type map being modified while a reference
to a cell is being held.

llvm-svn: 46735
2008-02-05 02:18:07 +00:00
Devang Patel 86e7166522 Keep track of padding fields.
llvm-svn: 46734
2008-02-05 01:40:48 +00:00
Christopher Lamb 025b5fb883 Add experimental support for address space qualified types. Address space
qualifiers use the __attribute__((address_space(id))) syntax.

llvm-svn: 46691
2008-02-04 02:31:56 +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
Chris Lattner ce6ae5cb06 fix codegen on static variables which have multiple decl nodes. These
should be merged just like normal globals.  This fixes this testcase
that Anders provided:

static struct s a;
static struct s *ap1 = &a;
static struct s a =  { 10 };

llvm-svn: 46661
2008-02-02 04:43:11 +00:00
Anders Carlsson 0b05d041f2 Only OCU vectors can be splatted.
llvm-svn: 46651
2008-02-01 23:17:55 +00:00
Anders Carlsson f4f3679eea Generate correct code for __builtin_huge_val
llvm-svn: 46639
2008-02-01 16:06:34 +00:00
Anders Carlsson b49fdfb5f0 Implement __builtin_huge_val.
llvm-svn: 46627
2008-02-01 00:44:41 +00:00
Lauro Ramos Venancio bb733a2bdc Implement review feedback. Use getAsPointerType instead of cast<PointerType>.
llvm-svn: 46613
2008-01-31 15:19:04 +00:00
Nate Begeman 4cd6689d1f Remainder of the __builtin_overload feedback
llvm-svn: 46601
2008-01-31 05:38:29 +00:00
Chris Lattner a94035bbb8 Fix PR1921 by promoting negative indices to intptrty.
llvm-svn: 46599
2008-01-31 04:12:50 +00:00
Lauro Ramos Venancio 86b99c1b79 getLLVMFieldNo can't be called before emitting the base value.
llvm-svn: 46576
2008-01-30 21:23:20 +00:00