Skip to content
  1. Nov 12, 2008
    • Ted Kremenek's avatar
      StoreManager::BindDecl now takes an SVal* for the initialization value instead... · cd639218
      Ted Kremenek authored
      StoreManager::BindDecl now takes an SVal* for the initialization value instead of an Expr* (which can be null).  Lazy symbolication of conjured symbols is now the sole responsibility of GRExprEngine.
      
      llvm-svn: 59151
      cd639218
    • Douglas Gregor's avatar
      Implement support for operator overloading using candidate operator · a11693bc
      Douglas Gregor authored
      functions for built-in operators, e.g., the builtin
      
        bool operator==(int const*, int const*)
      
      can be used for the expression "x1 == x2" given:
      
        struct X {
          operator int const*();
        } x1, x2;
      
      The scheme for handling these built-in operators is relatively simple:
      for each candidate required by the standard, create a special kind of
      candidate function for the built-in. If overload resolution picks the
      built-in operator, we perform the appropriate conversions on the
      arguments and then let the normal built-in operator take care of it. 
      
      There may be some optimization opportunity left: if we can reduce the
      number of built-in operator overloads we generate, overload resolution
      for these cases will go faster. However, one must be careful when
      doing this: GCC generates too few operator overloads in our little
      test program, and fails to compile it because none of the overloads it
      generates match.
      
      Note that we only support operator overload for non-member binary
      operators at the moment. The other operators will follow.
      
      As part of this change, ImplicitCastExpr can now be an lvalue.
      
      llvm-svn: 59148
      a11693bc
    • Daniel Dunbar's avatar
      Start a README.txt of possible optimizations to do in IRgen. · 28897804
      Daniel Dunbar authored
      llvm-svn: 59130
      28897804
    • Daniel Dunbar's avatar
      Handle ?: in EmitBranchOnBoolExpr. · bf3c22e5
      Daniel Dunbar authored
      llvm-svn: 59129
      bf3c22e5
    • Daniel Dunbar's avatar
      Rename ?: operator blocks to cond.true and cond.false (I don't know · d2a53a7b
      Daniel Dunbar authored
      what "cond.?" means, and this avoids quoting).
      
      llvm-svn: 59128
      d2a53a7b
    • Daniel Dunbar's avatar
      Comment/indentation fix. · 682712cd
      Daniel Dunbar authored
      llvm-svn: 59127
      682712cd
    • Eli Friedman's avatar
      Some additions to tryEvaluate I've had sitting around for a while. · 9a156e5c
      Eli Friedman authored
      This pushes it a lot closer to being able to deal with most of the stuff 
      CodeGen's constant expression evaluator knows how to deal with.  This 
      also fixes PR3003.
      
      The test could possibly use some improvement, but this'll work for now.  
      Test 6 is inspired by PR3003; the other tests are mostly just designed
      to exercise the new code.  The reason for the funny structure of the 
      tests is that type fixing for arrays inside of structs is the only place 
      in Sema that calls tryEvaluate, at least for the moment.
      
      llvm-svn: 59125
      9a156e5c
    • Chris Lattner's avatar
      Lower ?: into select when the selected values are cheap and side-effect-free. · 3fd91f83
      Chris Lattner authored
      This cuts another 200 lines off expr.ll, forming 23 selects.
      
      llvm-svn: 59124
      3fd91f83
    • Chris Lattner's avatar
      emit better codegen for ||/&&, shrinking expr.ll by another 240 lines. · 35710d18
      Chris Lattner authored
      This happens for stuff like this:
      
      x = cond1 || cond2 || cond3 || cond4;
      
      llvm-svn: 59123
      35710d18
    • Chris Lattner's avatar
      use ConstantFoldsToSimpleInteger instead of code emission to do · 8b084582
      Chris Lattner authored
      constant folding.
      
      llvm-svn: 59121
      8b084582
    • Daniel Dunbar's avatar
      IRgen improvements on unreachable code: · 5fc28718
      Daniel Dunbar authored
       - Split out "simple" statements which can easily handle IR generation
         when there is no insert point. These are generally statements which
         start by emitting a new block or are only containers for other
         statements.
      
       - This fixes a regression in emitting dummy blocks, notably for case
         statements.
      
       - This also fixes spurious emission of a number of debug stoppoint
         intrinsic instructions.
      
      Remove unneeded sw.body block, just clear the insertion point.
      
      Lift out CodeGenFunction::EmitStopPoint which calls into the
      CGDebugInfo class when generating debug info.
      
      Normalize definitions of Emit{Break,Continue}Stmt and usage of
      ErrorUnsupported.
      
      llvm-svn: 59118
      5fc28718
    • Chris Lattner's avatar
      Handle Unary ! in EmitBranchOnBoolExpr, so that we can efficiently · d9537734
      Chris Lattner authored
      codegen stuff like "if (!(X && Y))"
      
      llvm-svn: 59115
      d9537734
    • Chris Lattner's avatar
      Use EmitBranchOnBoolExpr in VisitConditionalOperator. This · 51e7118c
      Chris Lattner authored
      shrinks code yet again by a bit.
      
      llvm-svn: 59114
      51e7118c
    • Chris Lattner's avatar
      Move EmitBranchOnBoolExpr and ConstantFoldsToSimpleInteger to · cd439299
      Chris Lattner authored
      CodeGenFunction.cpp.  Change VisitConditionalOperator to use
      constant fold instead of codegen'ing a constant conditional.
      
      Change ForStmt to use EmitBranchOnBoolExpr, this shrinks
      expr.c very slightly to 40239 lines.
      
      llvm-svn: 59113
      cd439299
    • Chris Lattner's avatar
      sort files by name. · c51ded9e
      Chris Lattner authored
      llvm-svn: 59112
      c51ded9e
    • Chris Lattner's avatar
      Make emission of 'if' conditions much more sophisticated when we · b7a9e164
      Chris Lattner authored
      have a condition that is an &&/||.  Before we used to compile things like this:
      
      int test() {
        if (x && y) foo(); else bar();
      }
      
      into:
      
      	%0 = load i32* @x		; <i32> [#uses=1]
      	%1 = icmp ne i32 %0, 0		; <i1> [#uses=1]
      	br i1 %1, label %land_rhs, label %land_cont
      
      land_rhs:		; preds = %entry
      	%2 = load i32* @y		; <i32> [#uses=1]
      	%3 = icmp ne i32 %2, 0		; <i1> [#uses=1]
      	br label %land_cont
      
      land_cont:		; preds = %land_rhs, %entry
      	%4 = phi i1 [ false, %entry ], [ %3, %land_rhs ]		; <i1> [#uses=1]
      	br i1 %4, label %ifthen, label %ifelse
      
      ifthen:		; preds = %land_cont
      	%call = call i32 (...)* @foo()		; <i32> [#uses=0]
      	br label %ifend
      
      ifelse:		; preds = %land_cont
      	%call1 = call i32 (...)* @bar()		; <i32> [#uses=0]
      	br label %ifend
      
      ifend:		; preds = %ifelse, %ifthen
      
      
      Now we turn it into the much more svelte code:
      
              %0 = load i32* @x               ; <i32> [#uses=1]
              %1 = icmp ne i32 %0, 0          ; <i1> [#uses=1]
              br i1 %1, label %land_lhs_true, label %ifelse
      
      land_lhs_true:          ; preds = %entry
              %2 = load i32* @y               ; <i32> [#uses=1]
              %3 = icmp ne i32 %2, 0          ; <i1> [#uses=1]
              br i1 %3, label %ifthen, label %ifelse
      
      ifthen:         ; preds = %land_lhs_true
              %call = call i32 (...)* @foo()          ; <i32> [#uses=0]
              br label %ifend
      
      ifelse:         ; preds = %land_lhs_true, %entry
              %call1 = call i32 (...)* @bar()         ; <i32> [#uses=0]
              br label %ifend
      
      ifend:          ; preds = %ifelse, %ifthen
      
      Note the lack of a phi node.
      
      This shrinks the -O0 .ll file for 176.gcc/expr.c from 43176 to 40267 lines.
      
      llvm-svn: 59111
      b7a9e164
    • Chris Lattner's avatar
      fix a crash analyzing constants in 176.gcc/expr.c with my next patch. It was · fac05aea
      Chris Lattner authored
      crashing because we errors are ignored in subexpressions that are not evaluated,
      but we still evaluate the result of parents.  This would cause an assertion 
      because the erroneous subexpr didn't have its result value set to the right type.
      
      llvm-svn: 59110
      fac05aea
    • Chris Lattner's avatar
      aa3f951e
    • Chris Lattner's avatar
      Clean up some code to use isZero instead of calling getZExtValue. · 4ad31fcc
      Chris Lattner authored
      llvm-svn: 59103
      4ad31fcc
    • Sebastian Redl's avatar
      Fix testcase for 64-bit systems. · 85a40191
      Sebastian Redl authored
      llvm-svn: 59099
      85a40191
    • Daniel Dunbar's avatar
      Use createBasicBlock here too. · 8307290f
      Daniel Dunbar authored
      llvm-svn: 59095
      8307290f
    • Daniel Dunbar's avatar
      Disable generation of basic block names in NDEBUG mode. · 851eec11
      Daniel Dunbar authored
      Revert to enabling generation of instruction names when not in NDEBUG
      mode.
      
      llvm-svn: 59094
      851eec11
    • Daniel Dunbar's avatar
      Rework IRgen invariant w.r.t. current insert point. · 5c7e3935
      Daniel Dunbar authored
       - EmitStmt is no longer required to finish with a current insertion
         point defined (i.e. it does not need to make dummy
         blocks). Instead, it can clear the insertion point in the builder
         which indicates that the current insertion point is unreachable.
       - CodeGenFunction provides HaveInsertPoint and EnsureInsertPoint
         which respectively test if there is an insert point and ensure an
         insertion point exists (by making a dummy block).
       - Clearly mark functions in CodeGenFunction which can be called with
         no insertion point defined. Currently this is a limited set, and
         EmitStmt simply EnsureInsertPoint()s before emitting subsequent IR.
      
      Remove EmitDummyBlock, which is no longer needed. Clients who haven't
      already cleared the insertion point (typically via EmitBranch) can do
      so by hand.
      
      Remove isDummyBlock, which has effectively been renamed to
      HaveInsertPoint.
      
      The main thrust of this change is that we no longer have create dummy
      blocks just to destroy them a short time later in EmitBlock in the
      common case that there is no unreachable code following something like
      a goto. 
      
      Additionally, this means that we are not using the hokey condition in
      isDummyBlock that a block without a name is a dummy block. Guess how
      well that works when we never emit block names!
      
      llvm-svn: 59089
      5c7e3935
  2. Nov 11, 2008
Loading