Commit Graph

11 Commits

Author SHA1 Message Date
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 07eb733ef8 Evaluate the initializer for automatic variables.
llvm-svn: 39771
2007-07-12 00:39:48 +00:00
Chris Lattner e9a6453ded add some infrastructure for codegen'ing complex numbers. implement addition
of complex.  We now produce optimal code for:

void test(_Complex float *Y) {
  *Y = *Y + *Y;
}

$ clang -emit-llvm cg.c | llvm-as | opt -std-compile-opts | llc -march=x86-64
...
_test:
        movss (%rdi), %xmm0
        addss %xmm0, %xmm0
        movss 4(%rdi), %xmm1
        movss %xmm0, (%rdi)
        addss %xmm1, %xmm1
        movss %xmm1, 4(%rdi)
        ret

llvm-svn: 39673
2007-06-22 21:44:33 +00:00
Chris Lattner f033c147c9 remove location tracking for target info
llvm-svn: 39671
2007-06-22 19:05:19 +00:00
Chris Lattner 0fb8465981 Don't forget to set this
llvm-svn: 39670
2007-06-22 18:57:44 +00:00
Chris Lattner f39b03d98b fix naming of aggregate arguments.
llvm-svn: 39667
2007-06-22 18:15:16 +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 53621a535d Implement support for formal arguments. We can now compile this:
int test(int X, short Y, float Z) {
  return (int)(X*Y+Z);
}

to:

define i32 @test(i32 %X, i16 %Y, float %Z) {
entry:
        %promote = sext i16 %Y to i32           ; <i32> [#uses=1]
        %mul = mul i32 %promote, %X             ; <i32> [#uses=1]
        %promote3 = sitofp i32 %mul to float            ; <float> [#uses=1]
        %add = add float %promote3, %Z          ; <float> [#uses=1]
        %conv = fptosi float %add to i32                ; <i32> [#uses=1]
        ret i32 %conv
}

with:

$ clang -emit-llvm t.c | llvm-as | opt -std-compile-opts | llvm-dis

llvm-svn: 39652
2007-06-13 20:44:40 +00:00
Chris Lattner 1ad38f8fee codegen all declarators in a declstmt, allowing us to successfully codegen
stuff like:

void test() {
  int *X, Y, *Z[14];

  X[Y] = 4;
}

llvm-svn: 39624
2007-06-09 01:20:56 +00:00
Chris Lattner 03df12294b Add initial support for fixed-size local vardecls. This allows us to compile:
int func() {
  register int X;
  {
    int Y;

into:

define i32 @func() {
entry:
        %X = alloca i32         ; <i32*> [#uses=0]
        %Y = alloca i32         ; <i32*> [#uses=0]
        %allocapt = bitcast i32 undef to i32            ; <i32> [#uses=0]
...

llvm-svn: 39553
2007-06-02 04:53:11 +00:00
Chris Lattner 84915fa79b Start stubbing out decl codegen.
llvm-svn: 39550
2007-06-02 04:16:21 +00:00