Commit Graph

31 Commits

Author SHA1 Message Date
Oliver Hunt aefc8fd415 Support initalisers for more than just int-typed static variables.
We now use the CodeGenModule logic for generating the constant 
initialiser expression, so happily further initialiser fixes should 
automatically work for statics as well.

llvm-svn: 44495
2007-12-02 00:11:25 +00:00
Chris Lattner fb30009465 Implement support for -fwritable-strings and make the code generator
merge string literals when it is not provided.

llvm-svn: 44394
2007-11-28 05:34:05 +00:00
Chris Lattner 136449a6d7 improve codegen for global variable initializers, implementing
test/CodeGen/global-with-initialiser.c

Patch by Oliver Hunt!

llvm-svn: 44290
2007-11-23 22:07:55 +00:00
Anders Carlsson 41b7c6b250 Put constant CFStrings in the __DATA,__cfstring section.
llvm-svn: 43593
2007-11-01 00:41:52 +00:00
Devang Patel 75ef2f0b45 Take 2.
Make target info available to clang code generator.  This is far from complete but this helps clang codegen module make progress.

At the moment target triplet and target description strings are hard coded in clang::TargetInfo

llvm-svn: 43572
2007-10-31 20:01:01 +00:00
Devang Patel 7abb7acafd Initialize MemCpyFn
llvm-svn: 43569
2007-10-31 19:54:57 +00:00
Chris Lattner 5087e267c2 temporarily revert devang's patch to link in the llvm codegen etc.
llvm-svn: 43544
2007-10-31 04:53:03 +00:00
Devang Patel 46c7003052 Make target info available to clang code generator.
This is far from complete but this helps clang codegen module
make progress.

llvm-svn: 43536
2007-10-31 00:59:29 +00:00
Devang Patel 73721a12ca Refactor code into a separate method.
llvm-svn: 43519
2007-10-30 21:27:20 +00:00
Devang Patel ffe1e218f2 Fix 80 col violations.
llvm-svn: 43516
2007-10-30 20:59:40 +00:00
Devang Patel 19c2b9a66f Codegen global array initializers.
llvm-svn: 43383
2007-10-26 16:31:40 +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 9def2b15c1 Phase 2 of making the Decl class more lightweight...
Move Identifier/Loc instance variables (and associated getters/setters) down from Decl to ScopedDecl/FieldDecl.

Objc AST's can now inherit from Decl without getting instance variables and types that are C specific. For now, I am keeping NextDeclarator, since I believe it may be useful to ObjC. If not, it can be moved later.

llvm-svn: 41934
2007-09-13 21:41:19 +00:00
Chris Lattner fb2eb6941a eliminate some VC++ warnings, patch contributed by Hartmut Kaiser
llvm-svn: 41692
2007-09-04 02:34:27 +00:00
Chris Lattner 9e47ead594 Implement codegen support for lowering "library builtins" like __builtin_isinf
to their corresponding library routines (e.g. isinf).  This allows us to handle
all the stuff in macos math.h, and other stuff as it's added to *Builtins.def.

llvm-svn: 41634
2007-08-31 04:44:06 +00:00
Chris Lattner 1eec6601d9 add the ability to get the llvm function corresponding to a library builtin.
llvm-svn: 41633
2007-08-31 04:31:45 +00:00
Anders Carlsson b04ea61b79 Implement code generation for constant CFStrings.
llvm-svn: 41206
2007-08-21 00:21:21 +00:00
Anders Carlsson f087c0c1c6 Add preliminary support for converting struct types.
llvm-svn: 41145
2007-08-17 22:00:32 +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 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 d14bfa94a6 implement support for basic codegen of global variables with no initializers.
llvm-svn: 39795
2007-07-13 05:13:43 +00:00
Chris Lattner f033c147c9 remove location tracking for target info
llvm-svn: 39671
2007-06-22 19:05:19 +00:00
Chris Lattner 09153c0a8c Build enough support for aggregates to be able to compile this:
void test(int A, _Complex float Y) {
  _Complex float X;
  X = X;

}

llvm-svn: 39669
2007-06-22 18:48:09 +00:00
Chris Lattner b6984c4854 Hook up global function and variable handling. We can now compile:
int X, bar(int,int,int);
short Y;

double foo() {
  return bar(X, Y, 3);
}

into:

@X = external global i32                ; <i32*> [#uses=1]
@Y = external global i16                ; <i16*> [#uses=1]

define double @foo() {
entry:
        %tmp = load i32* @X             ; <i32> [#uses=1]
        %tmp1 = load i16* @Y            ; <i16> [#uses=1]
        %promote = sext i16 %tmp1 to i32                ; <i32> [#uses=1]
        %call = tail call i32 @bar( i32 %tmp, i32 %promote, i32 3 )             ; <i32> [#uses=1]
        %conv = sitofp i32 %call to double              ; <double> [#uses=1]
        ret double %conv
}

declare i32 @bar(i32, i32, i32)

llvm-svn: 39663
2007-06-20 04:44:43 +00:00
Chris Lattner 2ccb73bc8b Refactor CodeGenTypes out to CodeGenModule so it can be used for functions
and globals.

llvm-svn: 39661
2007-06-16 00:16:26 +00:00
Chris Lattner 23b7eb677d Finally bite the bullet and make the major change: split the clang namespace
out of the llvm namespace.  This makes the clang namespace be a sibling of
llvm instead of being a child.

The good thing about this is that it makes many things unambiguous.  The
bad things is that many things in the llvm namespace (notably data structures
like smallvector) now require an llvm:: qualifier.  IMO, libsystem and libsupport
should be split out of llvm into their own namespace in the future, which will fix
this issue.

llvm-svn: 39659
2007-06-15 23:05:46 +00:00
Chris Lattner d760e468aa Don't generate code for prototypes
llvm-svn: 39656
2007-06-15 21:16:23 +00:00
Chris Lattner d1af2d2956 Implement conversion of clang ast types to LLVM types, at least for some trivial
cases.

llvm-svn: 39519
2007-05-29 23:17:50 +00:00
Chris Lattner bed314465a Reorganize codegen files.
llvm-svn: 39504
2007-05-28 01:07:47 +00:00