From nicholas at mxc.ca Mon Sep 15 00:31:29 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 15 Sep 2008 05:31:29 -0000 Subject: [llvm-commits] [llvm] r56198 - in /llvm/trunk/projects/sample/docs: ./ index.html Message-ID: <200809150531.m8F5VUUw001018@zion.cs.uiuc.edu> Author: nicholas Date: Mon Sep 15 00:31:29 2008 New Revision: 56198 URL: http://llvm.org/viewvc/llvm-project?rev=56198&view=rev Log: Add "sample" documentation to sample project. This fixes part of PR2793. Added: llvm/trunk/projects/sample/docs/ llvm/trunk/projects/sample/docs/index.html Added: llvm/trunk/projects/sample/docs/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/projects/sample/docs/index.html?rev=56198&view=auto ============================================================================== --- llvm/trunk/projects/sample/docs/index.html (added) +++ llvm/trunk/projects/sample/docs/index.html Mon Sep 15 00:31:29 2008 @@ -0,0 +1,6 @@ + + +

SAMPLE PROJECT DOCUMENTATION

+

This is just a placeholder

+ + From evan.cheng at apple.com Mon Sep 15 01:28:42 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 15 Sep 2008 06:28:42 -0000 Subject: [llvm-commits] [llvm] r56199 - in /llvm/trunk: lib/CodeGen/SimpleRegisterCoalescing.cpp test/CodeGen/ARM/2008-09-14-CoaleserBug.ll Message-ID: <200809150628.m8F6SgO5002918@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 15 01:28:41 2008 New Revision: 56199 URL: http://llvm.org/viewvc/llvm-project?rev=56199&view=rev Log: Correctly update kill infos after extending a live range and merge 2 val#'s; fix 56165 - do not mark val# copy field if the copy does not define the val#. Added: llvm/trunk/test/CodeGen/ARM/2008-09-14-CoaleserBug.ll Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=56199&r1=56198&r2=56199&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Sep 15 01:28:41 2008 @@ -182,16 +182,20 @@ } // Okay, merge "B1" into the same value number as "B0". - if (BValNo != ValLR->valno) + if (BValNo != ValLR->valno) { + IntB.addKills(ValLR->valno, BValNo->kills); IntB.MergeValueNumberInto(BValNo, ValLR->valno); + } DOUT << " result = "; IntB.print(DOUT, tri_); DOUT << "\n"; // If the source instruction was killing the source register before the // merge, unset the isKill marker given the live range has been extended. int UIdx = ValLREndInst->findRegisterUseOperandIdx(IntB.reg, true); - if (UIdx != -1) + if (UIdx != -1) { ValLREndInst->getOperand(UIdx).setIsKill(false); + IntB.removeKill(ValLR->valno, FillerStart); + } ++numExtends; return true; @@ -568,7 +572,8 @@ LiveInterval &LI = li_->getInterval(CopyDstReg); unsigned DefIdx = li_->getDefIndex(li_->getInstructionIndex(UseMI)); const LiveRange *DLR = LI.getLiveRangeContaining(DefIdx); - DLR->valno->copy = UseMI; + if (DLR->valno->def == DefIdx) + DLR->valno->copy = UseMI; } } } Added: llvm/trunk/test/CodeGen/ARM/2008-09-14-CoaleserBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2008-09-14-CoaleserBug.ll?rev=56199&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2008-09-14-CoaleserBug.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2008-09-14-CoaleserBug.ll Mon Sep 15 01:28:41 2008 @@ -0,0 +1,29 @@ +; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin + +@"\01LC1" = external constant [288 x i8] ; <[288 x i8]*> [#uses=1] + +declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind + +define i32 @main(i32 %argc, i8** %argv) nounwind { +entry: + br label %bb.i + +bb.i: ; preds = %bb.i, %entry + %i.01.i = phi i32 [ 0, %entry ], [ %indvar.next52, %bb.i ] ; [#uses=1] + %indvar.next52 = add i32 %i.01.i, 1 ; [#uses=2] + %exitcond53 = icmp eq i32 %indvar.next52, 15 ; [#uses=1] + br i1 %exitcond53, label %bb.i33.loopexit, label %bb.i + +bb.i33.loopexit: ; preds = %bb.i + %0 = malloc [347 x i8] ; <[347 x i8]*> [#uses=2] + %.sub = getelementptr [347 x i8]* %0, i32 0, i32 0 ; [#uses=1] + call void @llvm.memcpy.i32( i8* %.sub, i8* getelementptr ([288 x i8]* @"\01LC1", i32 0, i32 0), i32 287, i32 1 ) nounwind + br label %bb.i28 + +bb.i28: ; preds = %bb.i28, %bb.i33.loopexit + br i1 false, label %repeat_fasta.exit, label %bb.i28 + +repeat_fasta.exit: ; preds = %bb.i28 + free [347 x i8]* %0 + unreachable +} From nicholas at mxc.ca Mon Sep 15 01:31:52 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 15 Sep 2008 06:31:52 -0000 Subject: [llvm-commits] [llvm] r56200 - /llvm/trunk/docs/ProgrammersManual.html Message-ID: <200809150631.m8F6VqYR003049@zion.cs.uiuc.edu> Author: nicholas Date: Mon Sep 15 01:31:52 2008 New Revision: 56200 URL: http://llvm.org/viewvc/llvm-project?rev=56200&view=rev Log: Fix documentation for these functions; they do not only modify users within the block specified by the InstList. Patch by Stefanus Du Toit. Modified: llvm/trunk/docs/ProgrammersManual.html Modified: llvm/trunk/docs/ProgrammersManual.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.html?rev=56200&r1=56199&r2=56200&view=diff ============================================================================== --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Mon Sep 15 01:31:52 2008 @@ -1944,9 +1944,9 @@
  • ReplaceInstWithValue -

    This function replaces all uses (within a basic block) of a given - instruction with a value, and then removes the original instruction. The - following example illustrates the replacement of the result of a particular +

    This function replaces all uses of a given instruction with a value, + and then removes the original instruction. The following example + illustrates the replacement of the result of a particular AllocaInst that allocates memory for a single integer with a null pointer to an integer.

    @@ -1962,8 +1962,10 @@
  • ReplaceInstWithInst

    This function replaces a particular instruction with another - instruction. The following example illustrates the replacement of one - AllocaInst with another.

    + instruction, inserting the new instruction into the basic block at the + location where the old instruction was, and replacing any uses of the old + instruction with the new instruction. The following example illustrates + the replacement of one AllocaInst with another.

    
    
    
    
    From nicholas at mxc.ca  Mon Sep 15 01:32:05 2008
    From: nicholas at mxc.ca (Nick Lewycky)
    Date: Sun, 14 Sep 2008 23:32:05 -0700
    Subject: [llvm-commits] [PATCH] minor documentation fixes for
     programmer's manual
    In-Reply-To: <79145F27-6DD9-4EA7-BD2B-40F185E19121@rapidmind.com>
    References: <79145F27-6DD9-4EA7-BD2B-40F185E19121@rapidmind.com>
    Message-ID: <48CE0165.5060500@mxc.ca>
    
    Stefanus Du Toit wrote:
    > The following tiny patch fixes the documentation for  
    > ReplaceInstWithValue in the programmer's manual, and gives more  
    > details on ReplaceInstWithInst.
    
    Thanks! Applied.
    
    In the future, please make sure you attach your patches. Or if you think 
    you did attach it, please make sure it's attached with 
    Content-disposition: attachment, instead of inline.
    
    Nick
    
    > Index: docs/ProgrammersManual.html
    > ===================================================================
    > --- docs/ProgrammersManual.html (revision 56103)
    > +++ docs/ProgrammersManual.html (working copy)
    > @@ -1944,7 +1944,7 @@
    >   
      >
    • ReplaceInstWithValue > > -

      This function replaces all uses (within a basic block) of a > given > +

      This function replaces all uses of a given > instruction with a value, and then removes the original > instruction. The > following example illustrates the replacement of the result of a > particular > AllocaInst that allocates memory for a single integer > with a null > @@ -1962,8 +1962,11 @@ >

    • ReplaceInstWithInst > >

      This function replaces a particular instruction with another > - instruction. The following example illustrates the replacement of > one > - AllocaInst with another.

      > + instruction, inserting the new instruction into the basic block at > + the location where the old instruction was, and replacing any uses > + of the old instruction with the new instruction. The following > + example illustrates the replacement of one AllocaInst > + with another.

      > >
      >
      > 
      > 
      > --
      > Stefanus Du Toit 
      >    RapidMind Inc.
      >    phone: +1 519 885 5455 x116 -- fax: +1 519 885 1463
      > 
      > 
      > 
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      > 
      
      
      
      From ggreif at gmail.com  Mon Sep 15 09:00:19 2008
      From: ggreif at gmail.com (Gabor Greif)
      Date: Mon, 15 Sep 2008 14:00:19 -0000
      Subject: [llvm-commits] [llvm] r56215 -
      	/llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
      Message-ID: <200809151400.m8FE0JwV000396@zion.cs.uiuc.edu>
      
      Author: ggreif
      Date: Mon Sep 15 09:00:15 2008
      New Revision: 56215
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56215&view=rev
      Log:
      add some more tests
      
      Modified:
          llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
      
      Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp?rev=56215&r1=56214&r2=56215&view=diff
      
      ==============================================================================
      --- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original)
      +++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Mon Sep 15 09:00:15 2008
      @@ -164,8 +164,8 @@
                           --digits;
                           Acc = (Acc << 1) | (Tag & 1);
                           if (Cushion <= 0) {
      -		      PrevU = U;
      -		      U = stripTag(U->Next);
      +                        PrevU = U;
      +                        U = stripTag(U->Next);
                           }
                           continue;
                   }
      @@ -363,6 +363,7 @@
           struct UseChain<0> {
               Use first;
               UseChain(Value *V) : first(V) {}
      +        UseChain(Use &U) : first(U) {}
           };
       
           template 
      @@ -372,6 +373,9 @@
               UseChain(Value *V)
                   : first(rest.first)
                   , rest(V) {}
      +        UseChain(Use &U)
      +            : first(rest.first)
      +            , rest(U) {}
           };
       
           UseChain<30> uc31((Value*)0xCAFEBABCUL);
      @@ -432,6 +436,17 @@
           Use ms35(m34);
           Use ms31(m30);
           Use ms32(ms31);
      +
      +    UseChain<24, 0xCAFEBABCUL> uc25;
      +    Use& u25(uc25.first);
      +    T3::UseChain<10> m11s24dS(u25);
      +    Use& m36(m11s24dS.first);
      +
      +
      +    T3::UseChain<10> s10S((Value*)0xCAFEBABCUL);
      +    UseChain<20, 0xCAFEBABCUL> d20ss10S(s10S.first);
      +    T3::UseChain<20> s20sd20ss10S(d20ss10S.first);
      +    Use& m53(s20sd20ss10S.first);
       }
       
       
      @@ -476,6 +491,22 @@
               return 4;
           if ((Value*)0xCAFEBABCUL != T4::ms32.getValue()) // check the mutated value
               return 4;
      +
      +    T4::m36.showWaymarks();
      +    if ((Value*)0xCAFEBABCUL != T4::m36.getValue())
      +        return 4;
      +    T4::m36.showWaymarks();
      +    if ((Value*)0xCAFEBABCUL != T4::m36.getValue()) // check the mutated value
      +        return 4;
      +    T4::m36.showWaymarks();
      +
      +    T4::m53.showWaymarks();
      +    if ((Value*)0xCAFEBABCUL != T4::m53.getValue())
      +        return 4;
      +    T4::m53.showWaymarks();
      +    if ((Value*)0xCAFEBABCUL != T4::m53.getValue()) // check the mutated value
      +        return 4;
      +    T4::m53.showWaymarks();
       }
       
       #endif
      
      
      
      
      From ggreif at gmail.com  Mon Sep 15 10:16:58 2008
      From: ggreif at gmail.com (Gabor Greif)
      Date: Mon, 15 Sep 2008 15:16:58 -0000
      Subject: [llvm-commits] [llvm] r56216 - in /llvm/branches/ggreif/use-diet:
       include/llvm/Use.h lib/VMCore/getValue.cpp
      Message-ID: <200809151516.m8FFGxML002692@zion.cs.uiuc.edu>
      
      Author: ggreif
      Date: Mon Sep 15 10:16:57 2008
      New Revision: 56216
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56216&view=rev
      Log:
      make nilUse inline and prepare for getting rid of PrevU
      
      Modified:
          llvm/branches/ggreif/use-diet/include/llvm/Use.h
          llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
      
      Modified: llvm/branches/ggreif/use-diet/include/llvm/Use.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/Use.h?rev=56216&r1=56215&r2=56216&view=diff
      
      ==============================================================================
      --- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original)
      +++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Mon Sep 15 10:16:57 2008
      @@ -69,7 +69,10 @@
         class UseWaymark;
         friend class UseWaymark;
         Value *getValue() const;
      -  static Use *nilUse(const Value*); // marks the end of the def/use chain
      +  /// nilUse - returns a 'token' that marks the end of the def/use chain
      +  static Use *nilUse(const Value *V) {
      +    return addTag((Use*)V, fullStopTagN);
      +  }
         static bool isNil(Use *U) { return extractTag(U) == fullStopTagN; }
         void showWaymarks() const;
         static bool isStop(Use *U) {
      
      Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp?rev=56216&r1=56215&r2=56216&view=diff
      
      ==============================================================================
      --- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original)
      +++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Mon Sep 15 10:16:57 2008
      @@ -62,7 +62,10 @@
       /// punchAwayDigits -- ensure that repainted area
       /// begins with a stop
       ///
      -static inline void punchAwayDigits(Use *PrevU) {
      +static inline void punchAwayDigits(Use *PrevU, Use **Uprev) {
      +  if (PrevU)
      +    assert(&PrevU->Next == stripTag(Uprev) && "U->Prev differs from PrevU?");
      +
           if (PrevU)
               PrevU->Next = stripTag(PrevU->Next);
       }
      @@ -149,7 +152,7 @@
                   switch (Tag) {
                       case Use::fullStopTagN:
                           if (Cushion <= 0) {
      -                        punchAwayDigits(PrevU);
      +                        punchAwayDigits(PrevU, U->Prev);
                               repaintByCalculating(reinterpret_cast(Next), U);
                           }
                           return reinterpret_cast(Next);
      @@ -191,7 +194,7 @@
         while (1) {
           switch (Tag) {
           case Use::fullStopTagN: {
      -        punchAwayDigits(PrevU);
      +        punchAwayDigits(PrevU, U->Prev);
               repaintByCalculating(reinterpret_cast(Next), U);
               return reinterpret_cast(Next);
           }
      @@ -203,7 +206,7 @@
       
               while (1) {
                   if (!digits) {
      -                punchAwayDigits(PrevU);
      +                punchAwayDigits(PrevU, U->Prev);
                       repaintByCopying(Tagspace, U);
                       return reinterpret_cast(Acc << 2);
                   }
      @@ -216,7 +219,7 @@
                   Next = stripTag(Next);
                   switch (Tag) {
                       case Use::fullStopTagN: {
      -                    punchAwayDigits(PrevU);
      +                    punchAwayDigits(PrevU, U->Prev);
                           repaintByCalculating(reinterpret_cast(Next), U);
                           return reinterpret_cast(Next);
                       }
      @@ -289,11 +292,6 @@
         }
       }
       
      -/*inline*/Use *Use::nilUse(const Value *V) {
      -  // return 0;
      -  return addTag((Use*)V, fullStopTagN);
      -}
      -
       static bool again(false);
       
       Value *Use::get() const {
      
      
      
      
      From gohman at apple.com  Mon Sep 15 11:10:51 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Mon, 15 Sep 2008 16:10:51 -0000
      Subject: [llvm-commits] [llvm] r56221 - /llvm/trunk/utils/llvm.grm
      Message-ID: <200809151610.m8FGAprU004754@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Mon Sep 15 11:10:51 2008
      New Revision: 56221
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56221&view=rev
      Log:
      Update the LLVM polygen grammar for recent language changes:
      x86_ssecallcc, function notes, and some whitespace adjustments.
      
      Modified:
          llvm/trunk/utils/llvm.grm
      
      Modified: llvm/trunk/utils/llvm.grm
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/llvm.grm?rev=56221&r1=56220&r2=56221&view=diff
      
      ==============================================================================
      --- llvm/trunk/utils/llvm.grm (original)
      +++ llvm/trunk/utils/llvm.grm Mon Sep 15 11:10:51 2008
      @@ -123,6 +123,7 @@
                        coldcc |
                        "x86_stdcallcc" |
                        "x86_fastcallcc" |
      +                 "x86_ssecallcc" |
                        cc EUINT64VAL ;
       
       ParamAttr ::= zeroext
      @@ -149,6 +150,19 @@
       
       OptFuncAttrs  ::= + _ | OptFuncAttrs FuncAttr ;
       
      +FuncNoteList  ::= FuncNote
      +              | FuncNoteList ^ "," FuncNote
      +              ;
      +
      +FuncNote      ::= inline ^ "=" ^ never
      +              | inline ^ "=" ^ always
      +              | "opt_size"
      +              ;
      +
      +OptFuncNotes  ::= _
      +              | notes ^ "(" ^ FuncNoteList ^ ")"
      +              ;
      +
       OptGC         ::= + _ | gc STRINGCONSTANT ;
       
       OptAlign      ::= + _ | align EUINT64VAL ;
      @@ -175,9 +189,9 @@
        | "[" ^ EUINT64VAL "x" Types ^ "]"
        | "<" ^ EUINT64VAL "x" Types ^ ">"
        | "{" TypeListI "}"
      - | "{" "}"
      + | "{" ^ "}"
        | "<" ^ "{" TypeListI "}" ^ ">"
      - | "<" ^ "{" "}" ^ ">"
      + | "<" ^ "{" ^ "}" ^ ">"
        ;
       
       ArgType ::= Types OptParamAttrs ;
      @@ -191,13 +205,13 @@
       TypeListI ::= Types | TypeListI ^ "," Types ;
       
       ConstVal::= Types "[" ^ ConstVector ^ "]"
      - | Types "[" "]"
      + | Types "[" ^ "]"
        | Types "c" ^ STRINGCONSTANT
        | Types "<" ^ ConstVector ^ ">"
        | Types "{" ConstVector "}"
      - | Types "{" "}"
      + | Types "{" ^ "}"
        | Types "<" ^ "{" ConstVector "}" ^ ">"
      - | Types "<" ^ "{" "}" ^ ">"
      + | Types "<" ^ "{" ^ "}" ^ ">"
        | Types null
        | Types undef
        | Types SymbolicValueRef
      @@ -271,7 +285,7 @@
       ArgList ::= ArgListH | ArgListH ^ "," "..." | "..." | _ ;
       
       FunctionHeaderH ::= OptCallingConv ResultTypes GlobalName "(" ^ ArgList ^ ")"
      -                  OptFuncAttrs OptSection OptAlign OptGC ;
      +                  OptFuncAttrs OptSection OptAlign OptGC OptFuncNotes ;
       
       BEGIN ::= ( begin | "{" ) ^ "\n";
       
      @@ -296,12 +310,12 @@
        | zeroinitializer
        | "<" ConstVector ">"
        | "[" ConstVector "]"
      - | "[" "]"
      + | "[" ^ "]"
        | "c" ^ STRINGCONSTANT
        | "{" ConstVector "}"
      - | "{" "}"
      + | "{" ^ "}"
        | "<" ^ "{" ConstVector "}" ^ ">"
      - | "<" ^ "{" "}" ^ ">"
      + | "<" ^ "{" ^ "}" ^ ">"
        | ConstExpr
        | asm OptSideEffect STRINGCONSTANT ^ "," STRINGCONSTANT ;
       
      @@ -330,8 +344,9 @@
        | br label ValueRef
        | br INTTYPE ValueRef ^ "," label ValueRef ^ "," label ValueRef
        | switch IntType ValueRef ^ "," label ValueRef "[" JumpTable "]"
      - | switch IntType ValueRef ^ "," label ValueRef "[" "]"
      - | invoke OptCallingConv ResultTypes ValueRef "(" ^ ParamList ^ ")" OptFuncAttrs
      + | switch IntType ValueRef ^ "," label ValueRef "[" ^ "]"
      + | invoke OptCallingConv ResultTypes ValueRef ^ "(" ^ ParamList ^ ")"
      +   OptFuncAttrs
          to label ValueRef unwind label ValueRef
        | unwind
        | unreachable ) ^ "\n";
      @@ -370,7 +385,7 @@
        | insertelement ResolvedVal ^ "," ResolvedVal ^ "," ResolvedVal
        | shufflevector ResolvedVal ^ "," ResolvedVal ^ "," ResolvedVal
        | phi PHIList
      - | OptTailCall OptCallingConv ResultTypes ValueRef "(" ^ ParamList ^ ")"
      + | OptTailCall OptCallingConv ResultTypes ValueRef ^ "(" ^ ParamList ^ ")"
          OptFuncAttrs
        | MemoryInst ;
       
      
      
      
      
      From baldrick at free.fr  Mon Sep 15 13:42:40 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Mon, 15 Sep 2008 18:42:40 -0000
      Subject: [llvm-commits] [llvm] r56222 - /llvm/trunk/tools/opt/opt.cpp
      Message-ID: <200809151842.m8FIgerD009679@zion.cs.uiuc.edu>
      
      Author: baldrick
      Date: Mon Sep 15 13:42:38 2008
      New Revision: 56222
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56222&view=rev
      Log:
      End of the GlobalsModRef experiment.
      
      Modified:
          llvm/trunk/tools/opt/opt.cpp
      
      Modified: llvm/trunk/tools/opt/opt.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=56222&r1=56221&r2=56222&view=diff
      
      ==============================================================================
      --- llvm/trunk/tools/opt/opt.cpp (original)
      +++ llvm/trunk/tools/opt/opt.cpp Mon Sep 15 13:42:38 2008
      @@ -285,8 +285,6 @@
         addPass(PM, createLoopDeletionPass());         // Delete dead loops
         addPass(PM, createLoopUnrollPass());           // Unroll small loops
         addPass(PM, createInstructionCombiningPass()); // Clean up after the unroller
      -  addPass(PM, createGlobalsModRefPass());        // Alias analysis of globals
      -  addPass(PM, createMarkModRefPass());       // Mark functions readonly/readnone
         addPass(PM, createGVNPass());                  // Remove redundancies
         addPass(PM, createMemCpyOptPass());            // Remove memcpy / form memset
         addPass(PM, createSCCPPass());                 // Constant prop with SCCP
      
      
      
      
      From clattner at apple.com  Mon Sep 15 13:54:29 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Mon, 15 Sep 2008 11:54:29 -0700
      Subject: [llvm-commits] [llvm] r56189 - in /llvm/trunk:
      	include/llvm/CodeGen/ lib/CodeGen/ lib/Target/ARM/
      	lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/
      In-Reply-To: <200809131758.m8DHwOc8023051@zion.cs.uiuc.edu>
      References: <200809131758.m8DHwOc8023051@zion.cs.uiuc.edu>
      Message-ID: 
      
      
      On Sep 13, 2008, at 10:58 AM, Dan Gohman wrote:
      
      > Author: djg
      > Date: Sat Sep 13 12:58:21 2008
      > New Revision: 56189
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=56189&view=rev
      > Log:
      > Remove isImm(), isReg(), and friends, in favor of
      > isImmediate(), isRegister(), and friends, to avoid confusion
      > about having two different names with the same meaning. I'm
      > not attached to the longer names, and would be ok with
      > changing to the shorter names if others prefer it.
      
      Thanks for doing this Dan, but could you go the other way?  The short  
      names are just as legible and are more concise.  I started converting  
      all the old ones over to the short ones before but apparently got  
      distracted and never finished, :(
      
      -Chris
      
      
      From baldrick at free.fr  Mon Sep 15 13:57:31 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Mon, 15 Sep 2008 18:57:31 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56223 - in /llvm-gcc-4.2/trunk/gcc:
       llvm-backend.cpp llvm-linker-hack.cpp
      Message-ID: <200809151857.m8FIvVtK010206@zion.cs.uiuc.edu>
      
      Author: baldrick
      Date: Mon Sep 15 13:57:29 2008
      New Revision: 56223
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56223&view=rev
      Log:
      End of the GlobalsModRef experiment.
      
      Modified:
          llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
          llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
      
      Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=56223&r1=56222&r2=56223&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
      +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Sep 15 13:57:29 2008
      @@ -30,7 +30,6 @@
       #include "llvm/PassManager.h"
       #include "llvm/ValueSymbolTable.h"
       #include "llvm/Analysis/LoopPass.h"
      -#include "llvm/Analysis/Passes.h"
       #include "llvm/Analysis/Verifier.h"
       #include "llvm/Assembly/Writer.h"
       #include "llvm/Assembly/PrintModulePass.h"
      @@ -430,10 +429,6 @@
           if (flag_unroll_loops)
             PM->add(createLoopUnrollPass());          // Unroll small loops
           PM->add(createInstructionCombiningPass());  // Clean up after the unroller
      -    if (flag_unit_at_a_time) {
      -      PM->add(createGlobalsModRefPass());       // Alias analysis of globals
      -      PM->add(createMarkModRefPass());       // Mark functions readonly/readnone
      -    }
           PM->add(createGVNPass());                   // Remove redundancies
           PM->add(createMemCpyOptPass());             // Remove memcpy / form memset
           PM->add(createSCCPPass());                  // Constant prop with SCCP
      
      Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=56223&r1=56222&r2=56223&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original)
      +++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Mon Sep 15 13:57:29 2008
      @@ -22,7 +22,6 @@
       
       #include "llvm/Module.h"
       #include "llvm/ModuleProvider.h"
      -#include "llvm/Analysis/Passes.h"
       #include "llvm/Analysis/Verifier.h"
       #include "llvm/Target/TargetMachineRegistry.h"
       #include "llvm/Transforms/Scalar.h"
      @@ -86,8 +85,6 @@
         llvm::createMemCpyOptPass();
         llvm::createDeadTypeEliminationPass();
         llvm::createLoopDeletionPass();
      -  llvm::createGlobalsModRefPass();
      -  llvm::createMarkModRefPass();
       
         std::string Err;
         llvm::TargetMachineRegistry::getClosestStaticTargetForModule(*MP->getModule(),
      
      
      
      
      From ggreif at gmail.com  Mon Sep 15 14:15:30 2008
      From: ggreif at gmail.com (Gabor Greif)
      Date: Mon, 15 Sep 2008 19:15:30 -0000
      Subject: [llvm-commits] [llvm] r56224 - in /llvm/branches/ggreif/use-diet:
       include/llvm/Use.h lib/VMCore/getValue.cpp
      Message-ID: <200809151915.m8FJFVOo010714@zion.cs.uiuc.edu>
      
      Author: ggreif
      Date: Mon Sep 15 14:15:29 2008
      New Revision: 56224
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56224&view=rev
      Log:
      simplify
      
      Modified:
          llvm/branches/ggreif/use-diet/include/llvm/Use.h
          llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
      
      Modified: llvm/branches/ggreif/use-diet/include/llvm/Use.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/Use.h?rev=56224&r1=56223&r2=56224&view=diff
      
      ==============================================================================
      --- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original)
      +++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Mon Sep 15 14:15:29 2008
      @@ -115,17 +115,9 @@
           bool P[] = { true, false, false, true };
           return P[T];
         }
      -  inline Value *getFastValueMaybe() const;
       public:
      -
      -
         operator Value*() const { return get(); }
      -  Value *get() const; /*{
      -    if (Value *V = getFastValueMaybe())
      -      return V;
      -    else
      -      return Val1; // for now :-)
      -    }*/
      +  inline Value *get() const;
         User *getUser() const;
         const Use* getImpliedUser() const;
         static Use *initTags(Use *Start, Use *Stop, ptrdiff_t Done = 0);
      @@ -247,14 +239,12 @@
         unsigned getOperandNo() const;
       };
       
      -Value *Use::getFastValueMaybe() const {
      -  if (fullStopTagN == extractTag(Next)) {
      -    return reinterpret_cast(stripTag(Next));
      -  }
      -  return 0;
      +Value *Use::get() const {
      +  return fullStopTagN == extractTag(Next)
      +    ? reinterpret_cast(stripTag(Next))
      +    : (Val1 == getValue() ? Val1 : 0); // should crash if not equal!
       }
       
      -
       template<> struct simplify_type > {
         typedef User* SimpleType;
         
      
      Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp?rev=56224&r1=56223&r2=56224&view=diff
      
      ==============================================================================
      --- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original)
      +++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Mon Sep 15 14:15:29 2008
      @@ -63,11 +63,11 @@
       /// begins with a stop
       ///
       static inline void punchAwayDigits(Use *PrevU, Use **Uprev) {
      +  Uprev = stripTag(Uprev);
         if (PrevU)
      -    assert(&PrevU->Next == stripTag(Uprev) && "U->Prev differs from PrevU?");
      +    assert(&PrevU->Next == Uprev && "U->Prev differs from PrevU?");
       
      -    if (PrevU)
      -        PrevU->Next = stripTag(PrevU->Next);
      +    *Uprev = stripTag(*Uprev);
       }
       
       
      @@ -292,20 +292,6 @@
         }
       }
       
      -static bool again(false);
      -
      -Value *Use::get() const {
      -  Value *V(Val1);
      -  //  if ((size_t)V == 0x5b0d150)
      -  //    getValue();
      -  Value *ValComp(getValue());
      -  if (V != ValComp)
      -    assert(V == ValComp && "Computed Value wrong?");
      -  if (again)
      -    getValue();
      -  return V;
      -}
      -
       static char TagChar(int Tag) {
         return "s10S"[Tag];
       }
      
      
      
      
      From bruno.cardoso at gmail.com  Mon Sep 15 14:38:14 2008
      From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
      Date: Mon, 15 Sep 2008 19:38:14 -0000
      Subject: [llvm-commits] [llvm] r56225 -
      	/llvm/trunk/test/CodeGen/Mips/2008-08-08-bswap.ll
      Message-ID: <200809151938.m8FJcEXA011389@zion.cs.uiuc.edu>
      
      Author: bruno
      Date: Mon Sep 15 14:38:11 2008
      New Revision: 56225
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56225&view=rev
      Log:
      Added testcase for bswap allegrexel intrinsic
      
      Added:
          llvm/trunk/test/CodeGen/Mips/2008-08-08-bswap.ll
      
      Added: llvm/trunk/test/CodeGen/Mips/2008-08-08-bswap.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/2008-08-08-bswap.ll?rev=56225&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/Mips/2008-08-08-bswap.ll (added)
      +++ llvm/trunk/test/CodeGen/Mips/2008-08-08-bswap.ll Mon Sep 15 14:38:11 2008
      @@ -0,0 +1,12 @@
      +; RUN: llvm-as < %s | llc -march=mips | grep wsbw | count 1
      +
      +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64"
      +target triple = "psp"
      +
      +define i32 @__bswapsi2(i32 %u) nounwind {
      +entry:
      +	tail call i32 @llvm.bswap.i32( i32 %u )		; :0 [#uses=1]
      +	ret i32 %0
      +}
      +
      +declare i32 @llvm.bswap.i32(i32) nounwind readnone
      
      
      
      
      From gohman at apple.com  Mon Sep 15 14:46:04 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Mon, 15 Sep 2008 19:46:04 -0000
      Subject: [llvm-commits] [llvm] r56226 - in /llvm/trunk:
       include/llvm/CodeGen/SelectionDAGNodes.h
       lib/CodeGen/SelectionDAG/SelectionDAG.cpp test/CodeGen/ARM/cse-libcalls.ll
      Message-ID: <200809151946.m8FJk4g1011624@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Mon Sep 15 14:46:03 2008
      New Revision: 56226
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56226&view=rev
      Log:
      Re-enable SelectionDAG CSE for calls. It matters in the case of
      libcalls, as in this testcase on ARM.
      
      Added:
          llvm/trunk/test/CodeGen/ARM/cse-libcalls.ll
      Modified:
          llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
      
      Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=56226&r1=56225&r2=56226&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Mon Sep 15 14:46:03 2008
      @@ -2205,7 +2205,8 @@
       
         /// Set this call to not be marked as a tail call. Normally setter
         /// methods in SDNodes are unsafe because it breaks the CSE map,
      -  /// but we don't CSE calls so it's ok in this case.
      +  /// but we don't include the tail call flag for calls so it's ok
      +  /// in this case.
         void setNotTailCall() { IsTailCall = false; }
       
         SDValue getChain() const { return getOperand(0); }
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=56226&r1=56225&r2=56226&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Sep 15 14:46:03 2008
      @@ -423,6 +423,12 @@
             ID.AddPointer(CP->getConstVal());
           break;
         }
      +  case ISD::CALL: {
      +    const CallSDNode *Call = cast(N);
      +    ID.AddInteger(Call->getCallingConv());
      +    ID.AddInteger(Call->isVarArg());
      +    break;
      +  }
         case ISD::LOAD: {
           const LoadSDNode *LD = cast(N);
           ID.AddInteger(LD->getAddressingMode());
      @@ -636,7 +642,6 @@
         // not subject to CSE.
         if (!Erased && N->getValueType(N->getNumValues()-1) != MVT::Flag &&
             !N->isMachineOpcode() &&
      -      N->getOpcode() != ISD::CALL &&
             N->getOpcode() != ISD::DBG_LABEL &&
             N->getOpcode() != ISD::DBG_STOPPOINT &&
             N->getOpcode() != ISD::EH_LABEL &&
      @@ -662,7 +667,6 @@
       
         switch (N->getOpcode()) {
         default: break;
      -  case ISD::CALL:
         case ISD::HANDLENODE:
         case ISD::DBG_LABEL:
         case ISD::DBG_STOPPOINT:
      @@ -3310,13 +3314,23 @@
       SelectionDAG::getCall(unsigned CallingConv, bool IsVarArgs, bool IsTailCall,
                             SDVTList VTs,
                             const SDValue *Operands, unsigned NumOperands) {
      -  // Do not CSE calls. Note that in addition to being a compile-time
      -  // optimization (since attempting CSE of calls is unlikely to be
      -  // meaningful), we actually depend on this behavior. CallSDNode can
      -  // be mutated, which is only safe if calls are not CSE'd.
      +  // Do not include isTailCall in the folding set profile.
      +  FoldingSetNodeID ID;
      +  AddNodeIDNode(ID, ISD::CALL, VTs, Operands, NumOperands);
      +  ID.AddInteger(CallingConv);
      +  ID.AddInteger(IsVarArgs);
      +  void *IP = 0;
      +  if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) {
      +    // Instead of including isTailCall in the folding set, we just
      +    // set the flag of the existing node.
      +    if (!IsTailCall)
      +      cast(E)->setNotTailCall();
      +    return SDValue(E, 0);
      +  }
         SDNode *N = NodeAllocator.Allocate();
         new (N) CallSDNode(CallingConv, IsVarArgs, IsTailCall,
                            VTs, Operands, NumOperands);
      +  CSEMap.InsertNode(N, IP);
         AllNodes.push_back(N);
         return SDValue(N, 0);
       }
      
      Added: llvm/trunk/test/CodeGen/ARM/cse-libcalls.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/cse-libcalls.ll?rev=56226&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/ARM/cse-libcalls.ll (added)
      +++ llvm/trunk/test/CodeGen/ARM/cse-libcalls.ll Mon Sep 15 14:46:03 2008
      @@ -0,0 +1,30 @@
      +; RUN: llvm-as < %s | llc -march=arm | grep {bl.\*__ltdf} | count 1
      +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
      +target triple = "i386-apple-darwin8"
      +
      +; Without CSE of libcalls, there are two calls in the output instead of one.
      +
      +define i32 @u_f_nonbon(double %lambda) nounwind {
      +entry:
      +	%tmp19.i.i = load double* null, align 4		;  [#uses=2]
      +	%tmp6.i = fcmp olt double %tmp19.i.i, 1.000000e+00		;  [#uses=1]
      +	%dielectric.0.i = select i1 %tmp6.i, double 1.000000e+00, double %tmp19.i.i		;  [#uses=1]
      +	%tmp10.i4 = fdiv double 0x4074C2D71F36262D, %dielectric.0.i		;  [#uses=1]
      +	br i1 false, label %bb28.i, label %bb508.i
      +
      +bb28.i:		; preds = %bb28.i, %entry
      +	br i1 false, label %bb502.loopexit.i, label %bb28.i
      +
      +bb.nph53.i:		; preds = %bb502.loopexit.i
      +	%tmp354.i = sub double -0.000000e+00, %tmp10.i4		;  [#uses=0]
      +	br label %bb244.i
      +
      +bb244.i:		; preds = %bb244.i, %bb.nph53.i
      +	br label %bb244.i
      +
      +bb502.loopexit.i:		; preds = %bb28.i
      +	br i1 false, label %bb.nph53.i, label %bb508.i
      +
      +bb508.i:		; preds = %bb502.loopexit.i, %entry
      +	ret i32 1
      +}
      
      
      
      
      From ggreif at gmail.com  Mon Sep 15 15:01:55 2008
      From: ggreif at gmail.com (Gabor Greif)
      Date: Mon, 15 Sep 2008 20:01:55 -0000
      Subject: [llvm-commits] [llvm] r56227 - in /llvm/branches/ggreif/use-diet:
       include/llvm/Use.h lib/VMCore/getValue.cpp
      Message-ID: <200809152001.m8FK1tj6012105@zion.cs.uiuc.edu>
      
      Author: ggreif
      Date: Mon Sep 15 15:01:53 2008
      New Revision: 56227
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56227&view=rev
      Log:
      more cleanups, enable other efficiency hack
      
      Modified:
          llvm/branches/ggreif/use-diet/include/llvm/Use.h
          llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
      
      Modified: llvm/branches/ggreif/use-diet/include/llvm/Use.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/Use.h?rev=56227&r1=56226&r2=56227&view=diff
      
      ==============================================================================
      --- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original)
      +++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Mon Sep 15 15:01:53 2008
      @@ -161,7 +161,6 @@
           if (isStop(Next))
             assert((isStop(*StrippedPrev) || (StrippedNext ? isStop(StrippedNext->Next) : true)) && "joining digits?");
           *StrippedPrev = Next;
      -  //    Use *StrippedNext(getNext());
           if (StrippedNext) StrippedNext->setPrev(StrippedPrev);
         }
       
      
      Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp?rev=56227&r1=56226&r2=56227&view=diff
      
      ==============================================================================
      --- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original)
      +++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Mon Sep 15 15:01:53 2008
      @@ -12,8 +12,6 @@
       //===----------------------------------------------------------------------===//
       
       #include "llvm/User.h"
      -#include 
      -//#include 
       // this can later be removed:
       #include 
       
      @@ -23,7 +21,7 @@
       
         friend class Use;
       
      -enum { requiredSteps = sizeof(Value*) * 8 - 2 };
      +enum { spareBits = 2, requiredSteps = sizeof(Value*) * 8 - spareBits };
       
       /// repaintByCopying -- given a pattern and a
       /// junk tagspace, copy the former's tags into
      @@ -46,7 +44,7 @@
       /// junk tagspace, compute tags into the latter
       ///
       static inline void repaintByCalculating(unsigned long Tags, Use *Junk) {
      -    Tags >>= 2;
      +    Tags >>= spareBits;
       
           for (int I = requiredSteps - 1; I >= 0; --I) {
               Use::NextPtrTag Tag(Tags & (1 << I) ? Use::oneDigitTagN : Use::zeroDigitTagN);
      @@ -62,12 +60,11 @@
       /// punchAwayDigits -- ensure that repainted area
       /// begins with a stop
       ///
      -static inline void punchAwayDigits(Use *PrevU, Use **Uprev) {
      +static inline void punchAwayDigits(Use **Uprev) {
         Uprev = stripTag(Uprev);
      -  if (PrevU)
      -    assert(&PrevU->Next == Uprev && "U->Prev differs from PrevU?");
      -
      -    *Uprev = stripTag(*Uprev);
      +  // if (PrevU)
      +  //   assert(&PrevU->Next == Uprev && "U->Prev differs from PrevU?");
      +  *Uprev = stripTag(*Uprev);
       }
       
       
      @@ -79,6 +76,7 @@
       ///    overpainted.
       ///  In any case this routine is invoked with U being
       ///  pointed at from a Use with a stop tag.
      +///
       static inline Value *gatherAndPotentiallyRepaint(Use *U) {
         int Cushion = requiredSteps;
       
      @@ -94,23 +92,14 @@
             if (Cushion <= 0) {
                 assert((Tag == Use::fullStopTagN || Tag == Use::stopTagN)
                        && "More digits?");
      -          return reinterpret_cast(Acc << 2);
      +          return reinterpret_cast(Acc << spareBits);
             }
       
             switch (Tag) {
                 case Use::fullStopTagN:
                     return reinterpret_cast(Next);
                 case Use::stopTagN: {
      -              // for efficieny:
      -              // goto efficiency
      -              /* THIS PESSIMIZES THE ddsd30S case !!!
      -              Next = Next->Next;
      -              // __builtin_prefetch(Next);
      -              --Cushion;
      -              Tag = extractTag(Next);
      -              Next = stripTag(Next);
      -              */
      -              break;
      +	      goto efficiency;
                 }
                 default:
                     Acc = (Acc << 1) | (Tag & 1);
      @@ -124,12 +113,6 @@
             break;
         }
       
      -  // FIXME: We track prev this way, in the real
      -  // Use struct there is a (tagged) Prev.
      -  // It is needed to punch over junk
      -  // digit sequence just before repaint.
      -  Use *PrevU = NULL;
      -
         while (Cushion > 0) {
           switch (Tag) {
           case Use::fullStopTagN:
      @@ -142,7 +125,7 @@
       
               while (1) {
                   if (!digits)
      -                return reinterpret_cast(Acc << 2);
      +                return reinterpret_cast(Acc << spareBits);
       
                   Next = Next->Next;
                   // __builtin_prefetch(Next);
      @@ -152,13 +135,12 @@
                   switch (Tag) {
                       case Use::fullStopTagN:
                           if (Cushion <= 0) {
      -                        punchAwayDigits(PrevU, U->Prev);
      +                        punchAwayDigits(U->Prev);
                               repaintByCalculating(reinterpret_cast(Next), U);
                           }
                           return reinterpret_cast(Next);
                       case Use::stopTagN: {
                           if (Cushion <= 0) {
      -                        PrevU = U;
                               U = stripTag(U->Next);
                           }
                           goto efficiency;
      @@ -167,7 +149,6 @@
                           --digits;
                           Acc = (Acc << 1) | (Tag & 1);
                           if (Cushion <= 0) {
      -                        PrevU = U;
                               U = stripTag(U->Next);
                           }
                           continue;
      @@ -185,16 +166,14 @@
           } // switch
         } // while
       
      -  // Now we know that we have a nice cushion between
      -  // U and Next. Do the same thing as above, but
      -  // don't decrement Cushion any more, instead
      -  // push U forward. After the value is found,
      -  // repaint beginning at U.
      +  // Now we know that we have a nice cushion between U and Next. Do the same
      +  // thing as above, but don't decrement Cushion any more, instead push U
      +  // forward. After the value is found, repaint beginning at U.
       
         while (1) {
           switch (Tag) {
           case Use::fullStopTagN: {
      -        punchAwayDigits(PrevU, U->Prev);
      +        punchAwayDigits(U->Prev);
               repaintByCalculating(reinterpret_cast(Next), U);
               return reinterpret_cast(Next);
           }
      @@ -206,20 +185,19 @@
       
               while (1) {
                   if (!digits) {
      -                punchAwayDigits(PrevU, U->Prev);
      +                punchAwayDigits(U->Prev);
                       repaintByCopying(Tagspace, U);
      -                return reinterpret_cast(Acc << 2);
      +                return reinterpret_cast(Acc << spareBits);
                   }
       
                   Next = Next->Next;
                   // __builtin_prefetch(Next);
      -            PrevU = U;
                   U = stripTag(U->Next);
                   Tag = extractTag(Next);
                   Next = stripTag(Next);
                   switch (Tag) {
                       case Use::fullStopTagN: {
      -                    punchAwayDigits(PrevU, U->Prev);
      +                    punchAwayDigits(U->Prev);
                           repaintByCalculating(reinterpret_cast(Next), U);
                           return reinterpret_cast(Next);
                       }
      @@ -238,7 +216,6 @@
           default:
               Next = Next->Next;
               // __builtin_prefetch(Next);
      -        PrevU = U;
               U = stripTag(U->Next);
               Tag = extractTag(Next);
               Next = stripTag(Next);
      @@ -251,12 +228,13 @@
       ///  - picking up exactly ToGo digits
       ///  - or finding a stop which marks the beginning
       ///    of a repaintable area
      +///
       static inline Value *skipPotentiallyGathering(Use *U,
                                                     unsigned long Acc,
                                                     int ToGo) {
         while (1) {
           if (!ToGo)
      -      return reinterpret_cast(Acc << 2);
      +      return reinterpret_cast(Acc << spareBits);
       
           Use *Next(U->Next);
           // __builtin_prefetch(Next);
      
      
      
      
      From bruno.cardoso at gmail.com  Mon Sep 15 16:06:58 2008
      From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes)
      Date: Mon, 15 Sep 2008 21:06:58 -0000
      Subject: [llvm-commits] [llvm] r56228 - in /llvm/trunk/lib/Target/Mips:
       MipsSubtarget.cpp MipsTargetMachine.cpp
      Message-ID: <200809152106.m8FL6xPU014011@zion.cs.uiuc.edu>
      
      Author: bruno
      Date: Mon Sep 15 16:06:55 2008
      New Revision: 56228
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56228&view=rev
      Log:
      Fixed Bug 2751
      http://llvm.org/bugs/show_bug.cgi?id=2751
      
      Abicall was enabled even when static code model was provided 
      in the command line.
      The correct behavior is to disable abicall when static is
      specified.
      
      
      Modified:
          llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp
          llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp
      
      Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp?rev=56228&r1=56227&r2=56228&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp (original)
      +++ llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp Mon Sep 15 16:06:55 2008
      @@ -65,9 +65,9 @@
           HasCondMov = true;
         }
       
      -  // Abicall is the default for O32 ABI and is ignored 
      -  // for EABI.
      -  if (NotABICall || isABI_EABI())
      +  // Abicall is the default for O32 ABI, but is disabled within EABI and in
      +  // static code.
      +  if (NotABICall || isABI_EABI() || (TM.getRelocationModel() == Reloc::Static))
           HasABICall = false;
       
         // TODO: disable when handling 64 bit symbols in the future.
      
      Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp?rev=56228&r1=56227&r2=56228&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp (original)
      +++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp Mon Sep 15 16:06:55 2008
      @@ -46,7 +46,7 @@
         TLInfo(*this) 
       {
         // Abicall enables PIC by default
      -  if (Subtarget.hasABICall() && (getRelocationModel() != Reloc::Static))
      +  if (Subtarget.hasABICall())
           setRelocationModel(Reloc::PIC_);  
       
         // TODO: create an option to enable long calls, like -mlong-calls, 
      
      
      
      
      From dpatel at apple.com  Mon Sep 15 16:13:46 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Mon, 15 Sep 2008 21:13:46 -0000
      Subject: [llvm-commits] [llvm] r56229 - in /llvm/trunk:
       include/llvm/PassManagerUtils.h utils/PassManagerUtils.cpp
      Message-ID: <200809152113.m8FLDkQM014227@zion.cs.uiuc.edu>
      
      Author: dpatel
      Date: Mon Sep 15 16:13:42 2008
      New Revision: 56229
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56229&view=rev
      Log:
      Extract optimization pass selection code from llvm-gcc into a separate routine.
      This can be used by other stand alone tools, such as 'opt'.
      
      Added:
          llvm/trunk/include/llvm/PassManagerUtils.h
          llvm/trunk/utils/PassManagerUtils.cpp
      
      Added: llvm/trunk/include/llvm/PassManagerUtils.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagerUtils.h?rev=56229&view=auto
      
      ==============================================================================
      --- llvm/trunk/include/llvm/PassManagerUtils.h (added)
      +++ llvm/trunk/include/llvm/PassManagerUtils.h Mon Sep 15 16:13:42 2008
      @@ -0,0 +1,36 @@
      +//===-- llvm/Support/PassManagerUtils.h -------------------------*- C++ -*-===//
      +//
      +//                     The LLVM Compiler Infrastructure
      +//
      +// This file is distributed under the University of Illinois Open Source
      +// License. See LICENSE.TXT for details.
      +//
      +//===----------------------------------------------------------------------===//
      +//
      +// This file provides interface to pass manager utilities.
      +//
      +//===----------------------------------------------------------------------===//
      +
      +namespace llvm {
      +
      +class FunctionPassManager;
      +class PassManager;
      +
      +/// AddOptimizationPasses - This routine adds optimization passes 
      +/// based on selected optimization level, OptLevel. This routine is
      +/// used by llvm-gcc and other tools.
      +///
      +/// OptLevel - Optimization Level
      +/// EnableIPO - Enables IPO passes. llvm-gcc enables this when
      +///             flag_unit_at_a_time is set.
      +/// InlinerSelection - 1 : Add function inliner.
      +///                  - 2 : Add AlwaysInliner.
      +/// OptLibCalls - Simplify lib calls, if set.
      +/// PruneEH - Add PruneEHPass, if set.
      +/// UnrollLoop - Unroll loops, if set.
      +void AddOptimizationPasses(FunctionPassManager &FPM, PassManager &MPM,
      +                           unsigned OptLevel, bool EnableIPO,
      +                           unsigned InlinerSelection, bool OptLibCalls,
      +                           bool PruneEH, bool UnrollLoop);
      +
      +}
      
      Added: llvm/trunk/utils/PassManagerUtils.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/PassManagerUtils.cpp?rev=56229&view=auto
      
      ==============================================================================
      --- llvm/trunk/utils/PassManagerUtils.cpp (added)
      +++ llvm/trunk/utils/PassManagerUtils.cpp Mon Sep 15 16:13:42 2008
      @@ -0,0 +1,108 @@
      +//===-- PassManagerUtils.cpp - --------------------------------------------===//
      +//
      +//                     The LLVM Compiler Infrastructure
      +//
      +// This file is distributed under the University of Illinois Open Source
      +// License. See LICENSE.TXT for details.
      +//
      +//===----------------------------------------------------------------------===//
      +//
      +// This file implements pass manager utiliy routines.
      +//
      +//===----------------------------------------------------------------------===//
      +
      +#include "llvm/PassManagerUtils.h"
      +#include "llvm/PassManagers.h"
      +#include "llvm/Transforms/Scalar.h"
      +#include "llvm/Transforms/IPO.h"
      +#include "llvm/Analysis/LoopPass.h"
      +
      +/// AddOptimizationPasses - This routine adds optimization passes 
      +/// based on selected optimization level, OptLevel. This routine is
      +/// used by llvm-gcc and other tools.
      +///
      +/// OptLevel - Optimization Level
      +/// EnableIPO - Enables IPO passes. llvm-gcc enables this when
      +///             flag_unit_at_a_time is set.
      +/// InlinerSelection - 1 : Add function inliner.
      +///                  - 2 : Add AlwaysInliner.
      +/// OptLibCalls - Simplify lib calls, if set.
      +/// PruneEH - Add PruneEHPass, if set.
      +/// UnrollLoop - Unroll loops, if set.
      +void llvm::AddOptimizationPasses(FunctionPassManager &FPM, PassManager &MPM,
      +                                 unsigned OptLevel, bool EnableIPO,
      +                                 unsigned InlinerSelection, bool OptLibCalls,
      +                                 bool PruneEH, bool UnrollLoop) {
      +  if (OptLevel == 0) 
      +    return;
      +
      +  FPM.add(createCFGSimplificationPass());
      +  if (OptLevel == 1)
      +    FPM.add(createPromoteMemoryToRegisterPass());
      +  else
      +    FPM.add(createScalarReplAggregatesPass());
      +  FPM.add(createInstructionCombiningPass());
      +
      +  if (EnableIPO)
      +    MPM.add(createRaiseAllocationsPass());      // call %malloc -> malloc inst
      +  MPM.add(createCFGSimplificationPass());       // Clean up disgusting code
      +  MPM.add(createPromoteMemoryToRegisterPass()); // Kill useless allocas
      +  if (EnableIPO) {
      +    MPM.add(createGlobalOptimizerPass());       // OptLevel out global vars
      +    MPM.add(createGlobalDCEPass());             // Remove unused fns and globs
      +    MPM.add(createIPConstantPropagationPass()); // IP Constant Propagation
      +    MPM.add(createDeadArgEliminationPass());    // Dead argument elimination
      +  }
      +  MPM.add(createInstructionCombiningPass());    // Clean up after IPCP & DAE
      +  MPM.add(createCFGSimplificationPass());       // Clean up after IPCP & DAE
      +  if (EnableIPO && PruneEH)
      +    MPM.add(createPruneEHPass());               // Remove dead EH info
      +  if (InlinerSelection == 1)                    // respect -fno-inline-functions
      +    MPM.add(createFunctionInliningPass());      // Inline small functions
      +  else if (InlinerSelection == 2)
      +    MPM.add(createAlwaysInlinerPass());         // Inline always_inline functions
      +  if (OptLevel > 2)
      +    MPM.add(createArgumentPromotionPass());   // Scalarize uninlined fn args
      +  if (OptLibCalls)
      +    MPM.add(createSimplifyLibCallsPass());    // Library Call Optimizations
      +  MPM.add(createInstructionCombiningPass());  // Cleanup for scalarrepl.
      +  MPM.add(createJumpThreadingPass());         // Thread jumps.
      +  MPM.add(createCFGSimplificationPass());     // Merge & remove BBs
      +  MPM.add(createScalarReplAggregatesPass());  // Break up aggregate allocas
      +  MPM.add(createInstructionCombiningPass());  // Combine silly seq's
      +  MPM.add(createCondPropagationPass());       // Propagate conditionals
      +  MPM.add(createTailCallEliminationPass());   // Eliminate tail calls
      +  MPM.add(createCFGSimplificationPass());     // Merge & remove BBs
      +  MPM.add(createReassociatePass());           // Reassociate expressions
      +  MPM.add(createLoopRotatePass());            // Rotate Loop
      +  MPM.add(createLICMPass());                  // Hoist loop invariants
      +  MPM.add(createLoopUnswitchPass());
      +  MPM.add(createLoopIndexSplitPass());        // Split loop index
      +  MPM.add(createInstructionCombiningPass());  
      +  MPM.add(createIndVarSimplifyPass());        // Canonicalize indvars
      +  MPM.add(createLoopDeletionPass());          // Delete dead loops
      +  if (UnrollLoop)
      +    MPM.add(createLoopUnrollPass());          // Unroll small loops
      +  MPM.add(createInstructionCombiningPass());  // Clean up after the unroller
      +  MPM.add(createGVNPass());                   // Remove redundancies
      +  MPM.add(createMemCpyOptPass());             // Remove memcpy / form memset
      +  MPM.add(createSCCPPass());                  // Constant prop with SCCP
      +  
      +  // Run instcombine after redundancy elimination to exploit opportunities
      +  // opened up by them.
      +  MPM.add(createInstructionCombiningPass());
      +  MPM.add(createCondPropagationPass());       // Propagate conditionals
      +  MPM.add(createDeadStoreEliminationPass());  // Delete dead stores
      +  MPM.add(createAggressiveDCEPass());   // Delete dead instructions
      +  MPM.add(createCFGSimplificationPass());     // Merge & remove BBs
      +  
      +  if (EnableIPO) {
      +    MPM.add(createStripDeadPrototypesPass());   // Get rid of dead prototypes
      +    MPM.add(createDeadTypeEliminationPass());   // Eliminate dead types
      +  }
      +  
      +  if (OptLevel > 1 && EnableIPO)
      +    MPM.add(createConstantMergePass());       // Merge dup global constants 
      +  
      +  return;
      +}
      
      
      
      
      From gohman at apple.com  Mon Sep 15 16:22:08 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Mon, 15 Sep 2008 21:22:08 -0000
      Subject: [llvm-commits] [llvm] r56230 - in /llvm/trunk:
       lib/Transforms/Scalar/LoopStrengthReduce.cpp
       test/CodeGen/X86/optimize-smax.ll
      Message-ID: <200809152122.m8FLM8iT014496@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Mon Sep 15 16:22:06 2008
      New Revision: 56230
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56230&view=rev
      Log:
      Teach LSR to optimize away SMAX operations for tripcounts in common
      cases.  See the comment above OptimizeSMax for the full story, and
      the testcase for an example. This cancels out a pessimization
      commonly attributed to indvars, and will allow us to lift some of
      the artificial throttles in indvars, rather than add new ones.
      
      Added:
          llvm/trunk/test/CodeGen/X86/optimize-smax.ll
      Modified:
          llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
      
      Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=56230&r1=56229&r2=56230&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
      +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Sep 15 16:22:06 2008
      @@ -184,6 +184,11 @@
           /// inside the loop then try to eliminate the cast opeation.
           void OptimizeShadowIV(Loop *L);
       
      +    /// OptimizeSMax - Rewrite the loop's terminating condition
      +    /// if it uses an smax computation.
      +    ICmpInst *OptimizeSMax(Loop *L, ICmpInst *Cond,
      +                           IVStrideUse* &CondUse);
      +
           bool FindIVUserForCond(ICmpInst *Cond, IVStrideUse *&CondUse,
                                  const SCEVHandle *&CondStride);
           bool RequiresTypeConversion(const Type *Ty, const Type *NewTy);
      @@ -1695,6 +1700,123 @@
         return Cond;
       }
       
      +/// OptimizeSMax - Rewrite the loop's terminating condition if it uses
      +/// an smax computation.
      +///
      +/// This is a narrow solution to a specific, but acute, problem. For loops
      +/// like this:
      +///
      +///   i = 0;
      +///   do {
      +///     p[i] = 0.0;
      +///   } while (++i < n);
      +///
      +/// where the comparison is signed, the trip count isn't just 'n', because
      +/// 'n' could be negative. And unfortunately this can come up even for loops
      +/// where the user didn't use a C do-while loop. For example, seemingly
      +/// well-behaved top-test loops will commonly be lowered like this:
      +//
      +///   if (n > 0) {
      +///     i = 0;
      +///     do {
      +///       p[i] = 0.0;
      +///     } while (++i < n);
      +///   }
      +///
      +/// and then it's possible for subsequent optimization to obscure the if
      +/// test in such a way that indvars can't find it.
      +///
      +/// When indvars can't find the if test in loops like this, it creates a
      +/// signed-max expression, which allows it to give the loop a canonical
      +/// induction variable:
      +///
      +///   i = 0;
      +///   smax = n < 1 ? 1 : n;
      +///   do {
      +///     p[i] = 0.0;
      +///   } while (++i != smax);
      +///
      +/// Canonical induction variables are necessary because the loop passes
      +/// are designed around them. The most obvious example of this is the
      +/// LoopInfo analysis, which doesn't remember trip count values. It
      +/// expects to be able to rediscover the trip count each time it is
      +/// needed, and it does this using a simple analyis that only succeeds if
      +/// the loop has a canonical induction variable.
      +///
      +/// However, when it comes time to generate code, the maximum operation
      +/// can be quite costly, especially if it's inside of an outer loop.
      +///
      +/// This function solves this problem by detecting this type of loop and
      +/// rewriting their conditions from ICMP_NE back to ICMP_SLT, and deleting
      +/// the instructions for the maximum computation.
      +///
      +ICmpInst *LoopStrengthReduce::OptimizeSMax(Loop *L, ICmpInst *Cond,
      +                                           IVStrideUse* &CondUse) {
      +  // Check that the loop matches the pattern we're looking for.
      +  if (Cond->getPredicate() != CmpInst::ICMP_EQ &&
      +      Cond->getPredicate() != CmpInst::ICMP_NE)
      +    return Cond;
      +
      +  SelectInst *Sel = dyn_cast(Cond->getOperand(1));
      +  if (!Sel || !Sel->hasOneUse()) return Cond;
      +
      +  SCEVHandle IterationCount = SE->getIterationCount(L);
      +  if (isa(IterationCount))
      +    return Cond;
      +  SCEVHandle One = SE->getIntegerSCEV(1, IterationCount->getType());
      +
      +  // Adjust for an annoying getIterationCount quirk.
      +  IterationCount = SE->getAddExpr(IterationCount, One);
      +
      +  // Check for a max calculation that matches the pattern.
      +  SCEVSMaxExpr *SMax = dyn_cast(IterationCount);
      +  if (!SMax || SMax != SE->getSCEV(Sel)) return Cond;
      +
      +  SCEVHandle SMaxLHS = SMax->getOperand(0);
      +  SCEVHandle SMaxRHS = SMax->getOperand(1);
      +  if (!SMaxLHS || SMaxLHS != One) return Cond;
      +
      +  // Check the relevant induction variable for conformance to
      +  // the pattern.
      +  SCEVHandle IV = SE->getSCEV(Cond->getOperand(0));
      +  SCEVAddRecExpr *AR = dyn_cast(IV);
      +  if (!AR || !AR->isAffine() ||
      +      AR->getStart() != One ||
      +      AR->getStepRecurrence(*SE) != One)
      +    return Cond;
      +
      +  // Check the right operand of the select, and remember it, as it will
      +  // be used in the new comparison instruction.
      +  Value *NewRHS = 0;
      +  if (SE->getSCEV(Sel->getOperand(1)) == SMaxRHS)
      +    NewRHS = Sel->getOperand(1);
      +  else if (SE->getSCEV(Sel->getOperand(2)) == SMaxRHS)
      +    NewRHS = Sel->getOperand(2);
      +  if (!NewRHS) return Cond;
      +
      +  // Ok, everything looks ok to change the condition into an SLT or SGE and
      +  // delete the max calculation.
      +  ICmpInst *NewCond =
      +    new ICmpInst(Cond->getPredicate() == CmpInst::ICMP_NE ?
      +                   CmpInst::ICMP_SLT :
      +                   CmpInst::ICMP_SGE,
      +                 Cond->getOperand(0), NewRHS, "scmp", Cond);
      +
      +  // Delete the max calculation instructions.
      +  Cond->replaceAllUsesWith(NewCond);
      +  Cond->eraseFromParent();
      +  SE->deleteValueFromRecords(Cond);
      +  Instruction *Cmp = cast(Sel->getOperand(0));
      +  Sel->eraseFromParent();
      +  SE->deleteValueFromRecords(Sel);
      +  if (Cmp->use_empty()) {
      +    Cmp->eraseFromParent();
      +    SE->deleteValueFromRecords(Cmp);
      +  }
      +  CondUse->User = NewCond;
      +  return NewCond;
      +}
      +
       /// OptimizeShadowIV - If IV is used in a int-to-float cast
       /// inside the loop then try to eliminate the cast opeation.
       void LoopStrengthReduce::OptimizeShadowIV(Loop *L) {
      @@ -1836,6 +1958,11 @@
         if (!FindIVUserForCond(Cond, CondUse, CondStride))
           return; // setcc doesn't use the IV.
       
      +  // If the trip count is computed in terms of an smax (due to ScalarEvolution
      +  // being unable to find a sufficient guard, for example), change the loop
      +  // comparison to use SLT instead of NE.
      +  Cond = OptimizeSMax(L, Cond, CondUse);
      +
         // If possible, change stride and operands of the compare instruction to
         // eliminate one stride.
         Cond = ChangeCompareStride(L, Cond, CondUse, CondStride);
      
      Added: llvm/trunk/test/CodeGen/X86/optimize-smax.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/optimize-smax.ll?rev=56230&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/optimize-smax.ll (added)
      +++ llvm/trunk/test/CodeGen/X86/optimize-smax.ll Mon Sep 15 16:22:06 2008
      @@ -0,0 +1,236 @@
      +; RUN: llvm-as < %s | llc -march=x86 | not grep cmov
      +
      +; LSR should be able to eliminate the smax computations by
      +; making the loops use slt comparisons instead of ne comparisons.
      +
      +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
      +target triple = "i386-apple-darwin9"
      +
      +define void @foo(i8* %r, i32 %s, i32 %w, i32 %x, i8* %j, i32 %d) nounwind {
      +entry:
      +	%0 = mul i32 %x, %w		;  [#uses=2]
      +	%1 = mul i32 %x, %w		;  [#uses=1]
      +	%2 = sdiv i32 %1, 4		;  [#uses=1]
      +	%.sum2 = add i32 %2, %0		;  [#uses=2]
      +	%cond = icmp eq i32 %d, 1		;  [#uses=1]
      +	br i1 %cond, label %bb29, label %bb10.preheader
      +
      +bb10.preheader:		; preds = %entry
      +	%3 = icmp sgt i32 %x, 0		;  [#uses=1]
      +	br i1 %3, label %bb.nph9, label %bb18.loopexit
      +
      +bb.nph7:		; preds = %bb7.preheader
      +	%4 = mul i32 %y.08, %w		;  [#uses=1]
      +	%5 = mul i32 %y.08, %s		;  [#uses=1]
      +	%6 = add i32 %5, 1		;  [#uses=1]
      +	%tmp8 = icmp sgt i32 1, %w		;  [#uses=1]
      +	%smax9 = select i1 %tmp8, i32 1, i32 %w		;  [#uses=1]
      +	br label %bb6
      +
      +bb6:		; preds = %bb7, %bb.nph7
      +	%x.06 = phi i32 [ 0, %bb.nph7 ], [ %indvar.next7, %bb7 ]		;  [#uses=3]
      +	%7 = add i32 %x.06, %4		;  [#uses=1]
      +	%8 = shl i32 %x.06, 1		;  [#uses=1]
      +	%9 = add i32 %6, %8		;  [#uses=1]
      +	%10 = getelementptr i8* %r, i32 %9		;  [#uses=1]
      +	%11 = load i8* %10, align 1		;  [#uses=1]
      +	%12 = getelementptr i8* %j, i32 %7		;  [#uses=1]
      +	store i8 %11, i8* %12, align 1
      +	br label %bb7
      +
      +bb7:		; preds = %bb6
      +	%indvar.next7 = add i32 %x.06, 1		;  [#uses=2]
      +	%exitcond10 = icmp ne i32 %indvar.next7, %smax9		;  [#uses=1]
      +	br i1 %exitcond10, label %bb6, label %bb7.bb9_crit_edge
      +
      +bb7.bb9_crit_edge:		; preds = %bb7
      +	br label %bb9
      +
      +bb9:		; preds = %bb7.preheader, %bb7.bb9_crit_edge
      +	br label %bb10
      +
      +bb10:		; preds = %bb9
      +	%indvar.next11 = add i32 %y.08, 1		;  [#uses=2]
      +	%exitcond12 = icmp ne i32 %indvar.next11, %x		;  [#uses=1]
      +	br i1 %exitcond12, label %bb7.preheader, label %bb10.bb18.loopexit_crit_edge
      +
      +bb10.bb18.loopexit_crit_edge:		; preds = %bb10
      +	br label %bb10.bb18.loopexit_crit_edge.split
      +
      +bb10.bb18.loopexit_crit_edge.split:		; preds = %bb.nph9, %bb10.bb18.loopexit_crit_edge
      +	br label %bb18.loopexit
      +
      +bb.nph9:		; preds = %bb10.preheader
      +	%13 = icmp sgt i32 %w, 0		;  [#uses=1]
      +	br i1 %13, label %bb.nph9.split, label %bb10.bb18.loopexit_crit_edge.split
      +
      +bb.nph9.split:		; preds = %bb.nph9
      +	br label %bb7.preheader
      +
      +bb7.preheader:		; preds = %bb.nph9.split, %bb10
      +	%y.08 = phi i32 [ 0, %bb.nph9.split ], [ %indvar.next11, %bb10 ]		;  [#uses=3]
      +	br i1 true, label %bb.nph7, label %bb9
      +
      +bb.nph5:		; preds = %bb18.loopexit
      +	%14 = sdiv i32 %w, 2		;  [#uses=1]
      +	%15 = icmp slt i32 %w, 2		;  [#uses=1]
      +	%16 = sdiv i32 %x, 2		;  [#uses=2]
      +	br i1 %15, label %bb18.bb20_crit_edge.split, label %bb.nph5.split
      +
      +bb.nph5.split:		; preds = %bb.nph5
      +	%tmp2 = icmp sgt i32 1, %16		;  [#uses=1]
      +	%smax3 = select i1 %tmp2, i32 1, i32 %16		;  [#uses=1]
      +	br label %bb13
      +
      +bb13:		; preds = %bb18, %bb.nph5.split
      +	%y.14 = phi i32 [ 0, %bb.nph5.split ], [ %indvar.next1, %bb18 ]		;  [#uses=4]
      +	%17 = mul i32 %14, %y.14		;  [#uses=2]
      +	%18 = shl i32 %y.14, 1		;  [#uses=1]
      +	%19 = srem i32 %y.14, 2		;  [#uses=1]
      +	%20 = add i32 %19, %18		;  [#uses=1]
      +	%21 = mul i32 %20, %s		;  [#uses=2]
      +	br i1 true, label %bb.nph3, label %bb17
      +
      +bb.nph3:		; preds = %bb13
      +	%22 = add i32 %17, %0		;  [#uses=1]
      +	%23 = add i32 %17, %.sum2		;  [#uses=1]
      +	%24 = sdiv i32 %w, 2		;  [#uses=2]
      +	%tmp = icmp sgt i32 1, %24		;  [#uses=1]
      +	%smax = select i1 %tmp, i32 1, i32 %24		;  [#uses=1]
      +	br label %bb14
      +
      +bb14:		; preds = %bb15, %bb.nph3
      +	%x.12 = phi i32 [ 0, %bb.nph3 ], [ %indvar.next, %bb15 ]		;  [#uses=5]
      +	%25 = shl i32 %x.12, 2		;  [#uses=1]
      +	%26 = add i32 %25, %21		;  [#uses=1]
      +	%27 = getelementptr i8* %r, i32 %26		;  [#uses=1]
      +	%28 = load i8* %27, align 1		;  [#uses=1]
      +	%.sum = add i32 %22, %x.12		;  [#uses=1]
      +	%29 = getelementptr i8* %j, i32 %.sum		;  [#uses=1]
      +	store i8 %28, i8* %29, align 1
      +	%30 = shl i32 %x.12, 2		;  [#uses=1]
      +	%31 = or i32 %30, 2		;  [#uses=1]
      +	%32 = add i32 %31, %21		;  [#uses=1]
      +	%33 = getelementptr i8* %r, i32 %32		;  [#uses=1]
      +	%34 = load i8* %33, align 1		;  [#uses=1]
      +	%.sum6 = add i32 %23, %x.12		;  [#uses=1]
      +	%35 = getelementptr i8* %j, i32 %.sum6		;  [#uses=1]
      +	store i8 %34, i8* %35, align 1
      +	br label %bb15
      +
      +bb15:		; preds = %bb14
      +	%indvar.next = add i32 %x.12, 1		;  [#uses=2]
      +	%exitcond = icmp ne i32 %indvar.next, %smax		;  [#uses=1]
      +	br i1 %exitcond, label %bb14, label %bb15.bb17_crit_edge
      +
      +bb15.bb17_crit_edge:		; preds = %bb15
      +	br label %bb17
      +
      +bb17:		; preds = %bb15.bb17_crit_edge, %bb13
      +	br label %bb18
      +
      +bb18.loopexit:		; preds = %bb10.bb18.loopexit_crit_edge.split, %bb10.preheader
      +	%36 = icmp slt i32 %x, 2		;  [#uses=1]
      +	br i1 %36, label %bb20, label %bb.nph5
      +
      +bb18:		; preds = %bb17
      +	%indvar.next1 = add i32 %y.14, 1		;  [#uses=2]
      +	%exitcond4 = icmp ne i32 %indvar.next1, %smax3		;  [#uses=1]
      +	br i1 %exitcond4, label %bb13, label %bb18.bb20_crit_edge
      +
      +bb18.bb20_crit_edge:		; preds = %bb18
      +	br label %bb18.bb20_crit_edge.split
      +
      +bb18.bb20_crit_edge.split:		; preds = %bb18.bb20_crit_edge, %bb.nph5
      +	br label %bb20
      +
      +bb20:		; preds = %bb18.bb20_crit_edge.split, %bb18.loopexit
      +	switch i32 %d, label %return [
      +		i32 3, label %bb22
      +		i32 1, label %bb29
      +	]
      +
      +bb22:		; preds = %bb20
      +	%37 = mul i32 %x, %w		;  [#uses=1]
      +	%38 = sdiv i32 %37, 4		;  [#uses=1]
      +	%.sum3 = add i32 %38, %.sum2		;  [#uses=2]
      +	%39 = add i32 %x, 15		;  [#uses=1]
      +	%40 = and i32 %39, -16		;  [#uses=1]
      +	%41 = add i32 %w, 15		;  [#uses=1]
      +	%42 = and i32 %41, -16		;  [#uses=1]
      +	%43 = mul i32 %40, %s		;  [#uses=1]
      +	%44 = icmp sgt i32 %x, 0		;  [#uses=1]
      +	br i1 %44, label %bb.nph, label %bb26
      +
      +bb.nph:		; preds = %bb22
      +	br label %bb23
      +
      +bb23:		; preds = %bb24, %bb.nph
      +	%y.21 = phi i32 [ 0, %bb.nph ], [ %indvar.next5, %bb24 ]		;  [#uses=3]
      +	%45 = mul i32 %y.21, %42		;  [#uses=1]
      +	%.sum1 = add i32 %45, %43		;  [#uses=1]
      +	%46 = getelementptr i8* %r, i32 %.sum1		;  [#uses=1]
      +	%47 = mul i32 %y.21, %w		;  [#uses=1]
      +	%.sum5 = add i32 %47, %.sum3		;  [#uses=1]
      +	%48 = getelementptr i8* %j, i32 %.sum5		;  [#uses=1]
      +	tail call void @llvm.memcpy.i32(i8* %48, i8* %46, i32 %w, i32 1)
      +	br label %bb24
      +
      +bb24:		; preds = %bb23
      +	%indvar.next5 = add i32 %y.21, 1		;  [#uses=2]
      +	%exitcond6 = icmp ne i32 %indvar.next5, %x		;  [#uses=1]
      +	br i1 %exitcond6, label %bb23, label %bb24.bb26_crit_edge
      +
      +bb24.bb26_crit_edge:		; preds = %bb24
      +	br label %bb26
      +
      +bb26:		; preds = %bb24.bb26_crit_edge, %bb22
      +	%49 = mul i32 %x, %w		;  [#uses=1]
      +	%.sum4 = add i32 %.sum3, %49		;  [#uses=1]
      +	%50 = getelementptr i8* %j, i32 %.sum4		;  [#uses=1]
      +	%51 = mul i32 %x, %w		;  [#uses=1]
      +	%52 = sdiv i32 %51, 2		;  [#uses=1]
      +	tail call void @llvm.memset.i32(i8* %50, i8 -128, i32 %52, i32 1)
      +	ret void
      +
      +bb29:		; preds = %bb20, %entry
      +	%53 = add i32 %w, 15		;  [#uses=1]
      +	%54 = and i32 %53, -16		;  [#uses=1]
      +	%55 = icmp sgt i32 %x, 0		;  [#uses=1]
      +	br i1 %55, label %bb.nph11, label %bb33
      +
      +bb.nph11:		; preds = %bb29
      +	br label %bb30
      +
      +bb30:		; preds = %bb31, %bb.nph11
      +	%y.310 = phi i32 [ 0, %bb.nph11 ], [ %indvar.next13, %bb31 ]		;  [#uses=3]
      +	%56 = mul i32 %y.310, %54		;  [#uses=1]
      +	%57 = getelementptr i8* %r, i32 %56		;  [#uses=1]
      +	%58 = mul i32 %y.310, %w		;  [#uses=1]
      +	%59 = getelementptr i8* %j, i32 %58		;  [#uses=1]
      +	tail call void @llvm.memcpy.i32(i8* %59, i8* %57, i32 %w, i32 1)
      +	br label %bb31
      +
      +bb31:		; preds = %bb30
      +	%indvar.next13 = add i32 %y.310, 1		;  [#uses=2]
      +	%exitcond14 = icmp ne i32 %indvar.next13, %x		;  [#uses=1]
      +	br i1 %exitcond14, label %bb30, label %bb31.bb33_crit_edge
      +
      +bb31.bb33_crit_edge:		; preds = %bb31
      +	br label %bb33
      +
      +bb33:		; preds = %bb31.bb33_crit_edge, %bb29
      +	%60 = mul i32 %x, %w		;  [#uses=1]
      +	%61 = getelementptr i8* %j, i32 %60		;  [#uses=1]
      +	%62 = mul i32 %x, %w		;  [#uses=1]
      +	%63 = sdiv i32 %62, 2		;  [#uses=1]
      +	tail call void @llvm.memset.i32(i8* %61, i8 -128, i32 %63, i32 1)
      +	ret void
      +
      +return:		; preds = %bb20
      +	ret void
      +}
      +
      +declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
      +
      +declare void @llvm.memset.i32(i8*, i8, i32, i32) nounwind
      
      
      
      
      From resistor at mac.com  Mon Sep 15 17:00:39 2008
      From: resistor at mac.com (Owen Anderson)
      Date: Mon, 15 Sep 2008 22:00:39 -0000
      Subject: [llvm-commits] [llvm] r56231 -
      	/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
      Message-ID: <200809152200.m8FM0dR5015709@zion.cs.uiuc.edu>
      
      Author: resistor
      Date: Mon Sep 15 17:00:38 2008
      New Revision: 56231
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56231&view=rev
      Log:
      Live intervals for live-in registers should begin at the beginning of a basic block, not at the first
      instruction.  Also, their valno's should have an unknown def.  This has no effect currently, but was
      causing issues when StrongPHIElimination was enabled.
      
      Modified:
          llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
      
      Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=56231&r1=56230&r2=56231&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
      +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Sep 15 17:00:38 2008
      @@ -624,7 +624,11 @@
         MachineBasicBlock::iterator mi = MBB->begin();
         unsigned baseIndex = MIIdx;
         unsigned start = baseIndex;
      -  unsigned end = start;
      +  while (baseIndex / InstrSlots::NUM < i2miMap_.size() && 
      +         getInstructionFromIndex(baseIndex) == 0)
      +    baseIndex += InstrSlots::NUM;
      +  unsigned end = baseIndex;
      +  
         while (mi != MBB->end()) {
           if (mi->killsRegister(interval.reg, tri_)) {
             DOUT << " killed";
      @@ -659,7 +663,7 @@
           }
         }
       
      -  LiveRange LR(start, end, interval.getNextValue(start, 0, VNInfoAllocator));
      +  LiveRange LR(start, end, interval.getNextValue(~0U, 0, VNInfoAllocator));
         interval.addRange(LR);
         interval.addKill(LR.valno, end);
         DOUT << " +" << LR << '\n';
      @@ -676,11 +680,6 @@
         // Track the index of the current machine instr.
         unsigned MIIndex = 0;
         
      -  // Skip over empty initial indices.
      -  while (MIIndex / InstrSlots::NUM < i2miMap_.size() &&
      -         getInstructionFromIndex(MIIndex) == 0)
      -    MIIndex += InstrSlots::NUM;
      -  
         for (MachineFunction::iterator MBBI = mf_->begin(), E = mf_->end();
              MBBI != E; ++MBBI) {
           MachineBasicBlock *MBB = MBBI;
      @@ -699,6 +698,11 @@
                                      true);
           }
           
      +    // Skip over empty initial indices.
      +    while (MIIndex / InstrSlots::NUM < i2miMap_.size() &&
      +           getInstructionFromIndex(MIIndex) == 0)
      +      MIIndex += InstrSlots::NUM;
      +    
           for (; MI != miEnd; ++MI) {
             DOUT << MIIndex << "\t" << *MI;
       
      
      
      
      
      From gohman at apple.com  Mon Sep 15 17:18:04 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Mon, 15 Sep 2008 22:18:04 -0000
      Subject: [llvm-commits] [llvm] r56232 - in /llvm/trunk:
       lib/Analysis/ScalarEvolution.cpp
       test/Analysis/ScalarEvolution/avoid-smax-0.ll
       test/Analysis/ScalarEvolution/avoid-smax-1.ll
       test/Analysis/ScalarEvolution/avoid-smax.ll
      Message-ID: <200809152218.m8FMI4oD016186@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Mon Sep 15 17:18:04 2008
      New Revision: 56232
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56232&view=rev
      Log:
      Teach ScalarEvolution to consider loop preheaders in the search for
      an if statement that guards a loop, to allow indvars to avoid smax
      operations in more situations.
      
      Added:
          llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-0.ll
            - copied unchanged from r56221, llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax.ll
          llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll
      Removed:
          llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax.ll
      Modified:
          llvm/trunk/lib/Analysis/ScalarEvolution.cpp
      
      Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=56232&r1=56231&r2=56232&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
      +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Sep 15 17:18:04 2008
      @@ -1480,6 +1480,12 @@
           SCEVHandle HowManyLessThans(SCEV *LHS, SCEV *RHS, const Loop *L,
                                       bool isSigned);
       
      +    /// getPredecessorWithUniqueSuccessorForBB - Return a predecessor of BB
      +    /// (which may not be an immediate predecessor) which has exactly one
      +    /// successor from which BB is reachable, or null if no such block is
      +    /// found.
      +    BasicBlock* getPredecessorWithUniqueSuccessorForBB(BasicBlock *BB);
      +
           /// executesAtLeastOnce - Test whether entry to the loop is protected by
           /// a conditional between LHS and RHS.
           bool executesAtLeastOnce(const Loop *L, bool isSigned, SCEV *LHS, SCEV *RHS);
      @@ -1825,6 +1831,11 @@
         case Instruction::Select:
           // This could be a smax or umax that was lowered earlier.
           // Try to recover it.
      +    //
      +    // FIXME: This doesn't recognize code like this:
      +    //    %t = icmp sgt i32 %n, -1
      +    //    %max = select i1 %t, i32 %n, i32 0
      +    //
           if (ICmpInst *ICI = dyn_cast(U->getOperand(0))) {
             Value *LHS = ICI->getOperand(0);
             Value *RHS = ICI->getOperand(1);
      @@ -2703,6 +2714,28 @@
         return UnknownValue;
       }
       
      +/// getPredecessorWithUniqueSuccessorForBB - Return a predecessor of BB
      +/// (which may not be an immediate predecessor) which has exactly one
      +/// successor from which BB is reachable, or null if no such block is
      +/// found.
      +///
      +BasicBlock *
      +ScalarEvolutionsImpl::getPredecessorWithUniqueSuccessorForBB(BasicBlock *BB) {
      +  // If the block has a unique predecessor, the predecessor must have
      +  // no other successors from which BB is reachable.
      +  if (BasicBlock *Pred = BB->getSinglePredecessor())
      +    return Pred;
      +
      +  // A loop's header is defined to be a block that dominates the loop.
      +  // If the loop has a preheader, it must be a block that has exactly
      +  // one successor that can reach BB. This is slightly more strict
      +  // than necessary, but works if critical edges are split.
      +  if (Loop *L = LI.getLoopFor(BB))
      +    return L->getLoopPreheader();
      +
      +  return 0;
      +}
      +
       /// executesAtLeastOnce - Test whether entry to the loop is protected by
       /// a conditional between LHS and RHS.
       bool ScalarEvolutionsImpl::executesAtLeastOnce(const Loop *L, bool isSigned,
      @@ -2711,14 +2744,11 @@
         BasicBlock *PreheaderDest = L->getHeader();
       
         // Starting at the preheader, climb up the predecessor chain, as long as
      -  // there are unique predecessors, looking for a conditional branch that
      -  // protects the loop.
      -  // 
      -  // This is a conservative apporoximation of a climb of the
      -  // control-dependence predecessors.
      -
      -  for (; Preheader; PreheaderDest = Preheader,
      -                    Preheader = Preheader->getSinglePredecessor()) {
      +  // there are predecessors that can be found that have unique successors
      +  // leading to the original header.
      +  for (; Preheader;
      +       PreheaderDest = Preheader,
      +       Preheader = getPredecessorWithUniqueSuccessorForBB(Preheader)) {
       
           BranchInst *LoopEntryPredicate =
             dyn_cast(Preheader->getTerminator());
      
      Added: llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll?rev=56232&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll (added)
      +++ llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll Mon Sep 15 17:18:04 2008
      @@ -0,0 +1,234 @@
      +; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
      +; RUN: not grep select %t
      +; RUN: grep {icmp ne i32.\* %w	} %t
      +
      +; Indvars should be able to insert a canonical induction variable
      +; for the bb6 loop without using a maximum calculation (icmp, select)
      +; because it should be able to prove that the comparison is guarded
      +; by an appropriate conditional branch.
      +
      +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
      +target triple = "i386-apple-darwin9"
      +
      +define void @foo(i8* %r, i32 %s, i32 %w, i32 %x, i8* %j, i32 %d) nounwind {
      +entry:
      +	%0 = mul i32 %x, %w		;  [#uses=2]
      +	%1 = mul i32 %x, %w		;  [#uses=1]
      +	%2 = sdiv i32 %1, 4		;  [#uses=1]
      +	%.sum2 = add i32 %2, %0		;  [#uses=2]
      +	%cond = icmp eq i32 %d, 1		;  [#uses=1]
      +	br i1 %cond, label %bb29, label %bb10.preheader
      +
      +bb10.preheader:		; preds = %entry
      +	%3 = icmp sgt i32 %x, 0		;  [#uses=1]
      +	br i1 %3, label %bb.nph9, label %bb18.loopexit
      +
      +bb.nph7:		; preds = %bb7.preheader
      +	%4 = mul i32 %y.08, %w		;  [#uses=1]
      +	%5 = mul i32 %y.08, %s		;  [#uses=1]
      +	%6 = add i32 %5, 1		;  [#uses=1]
      +	br label %bb6
      +
      +bb6:		; preds = %bb7, %bb.nph7
      +	%x.06 = phi i32 [ %13, %bb7 ], [ 0, %bb.nph7 ]		;  [#uses=3]
      +	%7 = add i32 %x.06, %4		;  [#uses=1]
      +	%8 = shl i32 %x.06, 1		;  [#uses=1]
      +	%9 = add i32 %6, %8		;  [#uses=1]
      +	%10 = getelementptr i8* %r, i32 %9		;  [#uses=1]
      +	%11 = load i8* %10, align 1		;  [#uses=1]
      +	%12 = getelementptr i8* %j, i32 %7		;  [#uses=1]
      +	store i8 %11, i8* %12, align 1
      +	%13 = add i32 %x.06, 1		;  [#uses=2]
      +	br label %bb7
      +
      +bb7:		; preds = %bb6
      +	%14 = icmp slt i32 %13, %w		;  [#uses=1]
      +	br i1 %14, label %bb6, label %bb7.bb9_crit_edge
      +
      +bb7.bb9_crit_edge:		; preds = %bb7
      +	br label %bb9
      +
      +bb9:		; preds = %bb7.preheader, %bb7.bb9_crit_edge
      +	%15 = add i32 %y.08, 1		;  [#uses=2]
      +	br label %bb10
      +
      +bb10:		; preds = %bb9
      +	%16 = icmp slt i32 %15, %x		;  [#uses=1]
      +	br i1 %16, label %bb7.preheader, label %bb10.bb18.loopexit_crit_edge
      +
      +bb10.bb18.loopexit_crit_edge:		; preds = %bb10
      +	br label %bb10.bb18.loopexit_crit_edge.split
      +
      +bb10.bb18.loopexit_crit_edge.split:		; preds = %bb.nph9, %bb10.bb18.loopexit_crit_edge
      +	br label %bb18.loopexit
      +
      +bb.nph9:		; preds = %bb10.preheader
      +	%17 = icmp sgt i32 %w, 0		;  [#uses=1]
      +	br i1 %17, label %bb.nph9.split, label %bb10.bb18.loopexit_crit_edge.split
      +
      +bb.nph9.split:		; preds = %bb.nph9
      +	br label %bb7.preheader
      +
      +bb7.preheader:		; preds = %bb.nph9.split, %bb10
      +	%y.08 = phi i32 [ %15, %bb10 ], [ 0, %bb.nph9.split ]		;  [#uses=3]
      +	br i1 true, label %bb.nph7, label %bb9
      +
      +bb.nph5:		; preds = %bb18.loopexit
      +	%18 = sdiv i32 %w, 2		;  [#uses=1]
      +	%19 = icmp slt i32 %w, 2		;  [#uses=1]
      +	%20 = sdiv i32 %x, 2		;  [#uses=1]
      +	br i1 %19, label %bb18.bb20_crit_edge.split, label %bb.nph5.split
      +
      +bb.nph5.split:		; preds = %bb.nph5
      +	br label %bb13
      +
      +bb13:		; preds = %bb18, %bb.nph5.split
      +	%y.14 = phi i32 [ %42, %bb18 ], [ 0, %bb.nph5.split ]		;  [#uses=4]
      +	%21 = mul i32 %18, %y.14		;  [#uses=2]
      +	%22 = shl i32 %y.14, 1		;  [#uses=1]
      +	%23 = srem i32 %y.14, 2		;  [#uses=1]
      +	%24 = add i32 %23, %22		;  [#uses=1]
      +	%25 = mul i32 %24, %s		;  [#uses=2]
      +	br i1 true, label %bb.nph3, label %bb17
      +
      +bb.nph3:		; preds = %bb13
      +	%26 = add i32 %21, %0		;  [#uses=1]
      +	%27 = add i32 %21, %.sum2		;  [#uses=1]
      +	%28 = sdiv i32 %w, 2		;  [#uses=1]
      +	br label %bb14
      +
      +bb14:		; preds = %bb15, %bb.nph3
      +	%x.12 = phi i32 [ %40, %bb15 ], [ 0, %bb.nph3 ]		;  [#uses=5]
      +	%29 = shl i32 %x.12, 2		;  [#uses=1]
      +	%30 = add i32 %29, %25		;  [#uses=1]
      +	%31 = getelementptr i8* %r, i32 %30		;  [#uses=1]
      +	%32 = load i8* %31, align 1		;  [#uses=1]
      +	%.sum = add i32 %26, %x.12		;  [#uses=1]
      +	%33 = getelementptr i8* %j, i32 %.sum		;  [#uses=1]
      +	store i8 %32, i8* %33, align 1
      +	%34 = shl i32 %x.12, 2		;  [#uses=1]
      +	%35 = or i32 %34, 2		;  [#uses=1]
      +	%36 = add i32 %35, %25		;  [#uses=1]
      +	%37 = getelementptr i8* %r, i32 %36		;  [#uses=1]
      +	%38 = load i8* %37, align 1		;  [#uses=1]
      +	%.sum6 = add i32 %27, %x.12		;  [#uses=1]
      +	%39 = getelementptr i8* %j, i32 %.sum6		;  [#uses=1]
      +	store i8 %38, i8* %39, align 1
      +	%40 = add i32 %x.12, 1		;  [#uses=2]
      +	br label %bb15
      +
      +bb15:		; preds = %bb14
      +	%41 = icmp sgt i32 %28, %40		;  [#uses=1]
      +	br i1 %41, label %bb14, label %bb15.bb17_crit_edge
      +
      +bb15.bb17_crit_edge:		; preds = %bb15
      +	br label %bb17
      +
      +bb17:		; preds = %bb15.bb17_crit_edge, %bb13
      +	%42 = add i32 %y.14, 1		;  [#uses=2]
      +	br label %bb18
      +
      +bb18.loopexit:		; preds = %bb10.bb18.loopexit_crit_edge.split, %bb10.preheader
      +	%43 = icmp slt i32 %x, 2		;  [#uses=1]
      +	br i1 %43, label %bb20, label %bb.nph5
      +
      +bb18:		; preds = %bb17
      +	%44 = icmp sgt i32 %20, %42		;  [#uses=1]
      +	br i1 %44, label %bb13, label %bb18.bb20_crit_edge
      +
      +bb18.bb20_crit_edge:		; preds = %bb18
      +	br label %bb18.bb20_crit_edge.split
      +
      +bb18.bb20_crit_edge.split:		; preds = %bb18.bb20_crit_edge, %bb.nph5
      +	br label %bb20
      +
      +bb20:		; preds = %bb18.bb20_crit_edge.split, %bb18.loopexit
      +	switch i32 %d, label %return [
      +		i32 3, label %bb22
      +		i32 1, label %bb29
      +	]
      +
      +bb22:		; preds = %bb20
      +	%45 = mul i32 %x, %w		;  [#uses=1]
      +	%46 = sdiv i32 %45, 4		;  [#uses=1]
      +	%.sum3 = add i32 %46, %.sum2		;  [#uses=2]
      +	%47 = add i32 %x, 15		;  [#uses=1]
      +	%48 = and i32 %47, -16		;  [#uses=1]
      +	%49 = add i32 %w, 15		;  [#uses=1]
      +	%50 = and i32 %49, -16		;  [#uses=1]
      +	%51 = mul i32 %48, %s		;  [#uses=1]
      +	%52 = icmp sgt i32 %x, 0		;  [#uses=1]
      +	br i1 %52, label %bb.nph, label %bb26
      +
      +bb.nph:		; preds = %bb22
      +	br label %bb23
      +
      +bb23:		; preds = %bb24, %bb.nph
      +	%y.21 = phi i32 [ %57, %bb24 ], [ 0, %bb.nph ]		;  [#uses=3]
      +	%53 = mul i32 %y.21, %50		;  [#uses=1]
      +	%.sum1 = add i32 %53, %51		;  [#uses=1]
      +	%54 = getelementptr i8* %r, i32 %.sum1		;  [#uses=1]
      +	%55 = mul i32 %y.21, %w		;  [#uses=1]
      +	%.sum5 = add i32 %55, %.sum3		;  [#uses=1]
      +	%56 = getelementptr i8* %j, i32 %.sum5		;  [#uses=1]
      +	tail call void @llvm.memcpy.i32(i8* %56, i8* %54, i32 %w, i32 1)
      +	%57 = add i32 %y.21, 1		;  [#uses=2]
      +	br label %bb24
      +
      +bb24:		; preds = %bb23
      +	%58 = icmp slt i32 %57, %x		;  [#uses=1]
      +	br i1 %58, label %bb23, label %bb24.bb26_crit_edge
      +
      +bb24.bb26_crit_edge:		; preds = %bb24
      +	br label %bb26
      +
      +bb26:		; preds = %bb24.bb26_crit_edge, %bb22
      +	%59 = mul i32 %x, %w		;  [#uses=1]
      +	%.sum4 = add i32 %.sum3, %59		;  [#uses=1]
      +	%60 = getelementptr i8* %j, i32 %.sum4		;  [#uses=1]
      +	%61 = mul i32 %x, %w		;  [#uses=1]
      +	%62 = sdiv i32 %61, 2		;  [#uses=1]
      +	tail call void @llvm.memset.i32(i8* %60, i8 -128, i32 %62, i32 1)
      +	ret void
      +
      +bb29:		; preds = %bb20, %entry
      +	%63 = add i32 %w, 15		;  [#uses=1]
      +	%64 = and i32 %63, -16		;  [#uses=1]
      +	%65 = icmp sgt i32 %x, 0		;  [#uses=1]
      +	br i1 %65, label %bb.nph11, label %bb33
      +
      +bb.nph11:		; preds = %bb29
      +	br label %bb30
      +
      +bb30:		; preds = %bb31, %bb.nph11
      +	%y.310 = phi i32 [ %70, %bb31 ], [ 0, %bb.nph11 ]		;  [#uses=3]
      +	%66 = mul i32 %y.310, %64		;  [#uses=1]
      +	%67 = getelementptr i8* %r, i32 %66		;  [#uses=1]
      +	%68 = mul i32 %y.310, %w		;  [#uses=1]
      +	%69 = getelementptr i8* %j, i32 %68		;  [#uses=1]
      +	tail call void @llvm.memcpy.i32(i8* %69, i8* %67, i32 %w, i32 1)
      +	%70 = add i32 %y.310, 1		;  [#uses=2]
      +	br label %bb31
      +
      +bb31:		; preds = %bb30
      +	%71 = icmp slt i32 %70, %x		;  [#uses=1]
      +	br i1 %71, label %bb30, label %bb31.bb33_crit_edge
      +
      +bb31.bb33_crit_edge:		; preds = %bb31
      +	br label %bb33
      +
      +bb33:		; preds = %bb31.bb33_crit_edge, %bb29
      +	%72 = mul i32 %x, %w		;  [#uses=1]
      +	%73 = getelementptr i8* %j, i32 %72		;  [#uses=1]
      +	%74 = mul i32 %x, %w		;  [#uses=1]
      +	%75 = sdiv i32 %74, 2		;  [#uses=1]
      +	tail call void @llvm.memset.i32(i8* %73, i8 -128, i32 %75, i32 1)
      +	ret void
      +
      +return:		; preds = %bb20
      +	ret void
      +}
      +
      +declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
      +
      +declare void @llvm.memset.i32(i8*, i8, i32, i32) nounwind
      
      Removed: llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax.ll?rev=56231&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax.ll (original)
      +++ llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax.ll (removed)
      @@ -1,35 +0,0 @@
      -; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop bb3: (-1 + %n) iterations!}
      -
      -; We don't want to use a max in the trip count expression in
      -; this testcase.
      -
      -define void @foo(i32 %n, i32* %p, i32* %q) nounwind {
      -entry:
      -	icmp sgt i32 %n, 0
      -	br i1 %0, label %bb, label %return
      -
      -bb:
      -	load i32* %q, align 4
      -	icmp eq i32 %1, 0
      -	br i1 %2, label %return, label %bb3.preheader
      -
      -bb3.preheader:
      -	br label %bb3
      -
      -bb3:
      -	%i.0 = phi i32 [ %7, %bb3 ], [ 0, %bb3.preheader ]
      -	getelementptr i32* %p, i32 %i.0
      -	load i32* %3, align 4
      -	add i32 %4, 1
      -	getelementptr i32* %p, i32 %i.0
      -	store i32 %5, i32* %6, align 4
      -	add i32 %i.0, 1
      -	icmp slt i32 %7, %n
      -	br i1 %8, label %bb3, label %return.loopexit
      -
      -return.loopexit:
      -	br label %return
      -
      -return:
      -	ret void
      -}
      
      
      
      
      From gohman at apple.com  Mon Sep 15 20:01:33 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Tue, 16 Sep 2008 01:01:33 -0000
      Subject: [llvm-commits] [llvm] r56233 - in /llvm/trunk:
       include/llvm/Bitcode/LLVMBitCodes.h lib/Bitcode/Reader/BitcodeReader.cpp
       lib/Bitcode/Writer/BitcodeWriter.cpp test/Assembler/vector-select.ll
      Message-ID: <200809160101.m8G11Y0W020940@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Mon Sep 15 20:01:33 2008
      New Revision: 56233
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56233&view=rev
      Log:
      Re-enables the new vector select in the bitcode reader, by modifying the
      bitcode reader/writer as follows:
      
      - add and use new bitcode FUNC_CODE_INST_VSELECT to handle the llvm
      select opcode using either i1 or [N x i1] as the selector.
      - retain old BITCODE FUNC_CODE_INST_SELECT in the bitcode reader to
      handle select on i1 for backwards compatibility with existing bitcode
      files.
      - re-enable the vector-select.ll test program.
      
      Also, rename the recently added bitcode opcode FUNC_CODE_INST_VCMP to
      FUNC_CODE_INST_CMP2 and make the bitcode writer use it to handle
      fcmp/icmp on scalars or vectors. In the bitcode writer, use
      FUNC_CODE_INST_CMP for vfcmp/vicmp only. In the bitcode reader, have
      FUNC_CODE_INST_CMP handle icmp/fcmp returning bool, for backwards
      compatibility with existing bitcode files.
      
      Patch by Preston Gurd!
      
      Modified:
          llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
          llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
          llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
          llvm/trunk/test/Assembler/vector-select.ll
      
      Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=56233&r1=56232&r2=56233&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original)
      +++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Mon Sep 15 20:01:33 2008
      @@ -206,8 +206,10 @@
           FUNC_CODE_INST_GETRESULT   = 25, // GETRESULT:  [ty, opval, n]
           FUNC_CODE_INST_EXTRACTVAL  = 26, // EXTRACTVAL: [n x operands]
           FUNC_CODE_INST_INSERTVAL   = 27, // INSERTVAL:  [n x operands]
      -    // fcmp/icmp returning vector of Int1Ty, NOT for vicmp/vfcmp
      -    FUNC_CODE_INST_VCMP        = 28  // VCMP:       [opty, opval, opval, pred]
      +    // fcmp/icmp returning Int1TY or vector of Int1Ty, NOT for vicmp/vfcmp
      +    FUNC_CODE_INST_CMP2        = 28, // VCMP:       [opty, opval, opval, pred]
      +    // new select on i1 or [N x i1]
      +    FUNC_CODE_INST_VSELECT     = 29  // VSELECT:    [ty,opval,opval,predty,pred]
         };
       } // End bitc namespace
       } // End llvm namespace
      
      Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=56233&r1=56232&r2=56233&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
      +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Sep 15 20:01:33 2008
      @@ -1495,15 +1495,32 @@
           }
             
           case bitc::FUNC_CODE_INST_SELECT: { // SELECT: [opval, ty, opval, opval]
      +      // obsolete form of select
      +      // handles select i1 ... in old bitcode
             unsigned OpNum = 0;
             Value *TrueVal, *FalseVal, *Cond;
             if (getValueTypePair(Record, OpNum, NextValueNo, TrueVal) ||
                 getValue(Record, OpNum, TrueVal->getType(), FalseVal) ||
                 getValue(Record, OpNum, Type::Int1Ty, Cond))
               return Error("Invalid SELECT record");
      +      
      +      I = SelectInst::Create(Cond, TrueVal, FalseVal);
      +      break;
      +    }
      +      
      +    case bitc::FUNC_CODE_INST_VSELECT: {// VSELECT: [ty,opval,opval,predty,pred]
      +      // new form of select
      +      // handles select i1 or select [N x i1]
      +      unsigned OpNum = 0;
      +      Value *TrueVal, *FalseVal, *Cond;
      +      if (getValueTypePair(Record, OpNum, NextValueNo, TrueVal) ||
      +          getValue(Record, OpNum, TrueVal->getType(), FalseVal) ||
      +          getValueTypePair(Record, OpNum, NextValueNo, Cond))
      +        return Error("Invalid SELECT record");
       
             // select condition can be either i1 or [N x i1]
      -      if (const VectorType* vector_type = dyn_cast(Cond->getType())) {
      +      if (const VectorType* vector_type =
      +          dyn_cast(Cond->getType())) {
               // expect 
               if (vector_type->getElementType() != Type::Int1Ty) 
                 return Error("Invalid SELECT condition type");
      @@ -1557,6 +1574,8 @@
           }
             
           case bitc::FUNC_CODE_INST_CMP: { // CMP: [opty, opval, opval, pred]
      +      // VFCmp/VICmp
      +      // or old form of ICmp/FCmp returning bool
             unsigned OpNum = 0;
             Value *LHS, *RHS;
             if (getValueTypePair(Record, OpNum, NextValueNo, LHS) ||
      @@ -1574,16 +1593,15 @@
               I = new VICmpInst((ICmpInst::Predicate)Record[OpNum], LHS, RHS);
             break;
           }
      -    case bitc::FUNC_CODE_INST_VCMP: { // VCMP: [opty, opval, opval, pred]
      -      // Fcmp/ICmp returning vector of bool
      +    case bitc::FUNC_CODE_INST_CMP2: { // CMP2: [opty, opval, opval, pred]
      +      // Fcmp/ICmp returning bool or vector of bool
             unsigned OpNum = 0;
             Value *LHS, *RHS;
             if (getValueTypePair(Record, OpNum, NextValueNo, LHS) ||
                 getValue(Record, OpNum, LHS->getType(), RHS) ||
                 OpNum+1 != Record.size())
      -        return Error("Invalid VCMP record");
      +        return Error("Invalid CMP2 record");
             
      -      // will always be vector
             if (LHS->getType()->isFPOrFPVector())
               I = new FCmpInst((FCmpInst::Predicate)Record[OpNum], LHS, RHS);
             else 
      
      Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=56233&r1=56232&r2=56233&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
      +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Mon Sep 15 20:01:33 2008
      @@ -746,10 +746,10 @@
           break;
         }
         case Instruction::Select:
      -    Code = bitc::FUNC_CODE_INST_SELECT;
      +    Code = bitc::FUNC_CODE_INST_VSELECT;
           PushValueAndType(I.getOperand(1), InstID, Vals, VE);
           Vals.push_back(VE.getValueID(I.getOperand(2)));
      -    Vals.push_back(VE.getValueID(I.getOperand(0)));
      +    PushValueAndType(I.getOperand(0), InstID, Vals, VE);
           break;
         case Instruction::ExtractElement:
           Code = bitc::FUNC_CODE_INST_EXTRACTELT;
      @@ -772,11 +772,10 @@
         case Instruction::FCmp:
         case Instruction::VICmp:
         case Instruction::VFCmp:
      -    if (isa(I.getOperand(0)->getType())
      -        && (I.getOpcode() == Instruction::ICmp
      -            || I.getOpcode() == Instruction::FCmp)) {
      -      // compare returning vector of Int1Ty
      -      Code = bitc::FUNC_CODE_INST_VCMP;
      +    if (I.getOpcode() == Instruction::ICmp
      +        || I.getOpcode() == Instruction::FCmp) {
      +      // compare returning Int1Ty or vector of Int1Ty
      +      Code = bitc::FUNC_CODE_INST_CMP2;
           } else {
             Code = bitc::FUNC_CODE_INST_CMP;
           }
      
      Modified: llvm/trunk/test/Assembler/vector-select.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/vector-select.ll?rev=56233&r1=56232&r2=56233&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Assembler/vector-select.ll (original)
      +++ llvm/trunk/test/Assembler/vector-select.ll Mon Sep 15 20:01:33 2008
      @@ -1,5 +1,4 @@
       ; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | grep select
      -; XFAIL: *
       ; rudimentary test of select on vectors returning vector of bool
       
       define <4 x i32> @foo(<4 x i32> %a, <4 x i32> %b,
      
      
      
      
      From gohman at apple.com  Mon Sep 15 20:07:32 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Mon, 15 Sep 2008 18:07:32 -0700
      Subject: [llvm-commits] llvm bitcode change for review or commit
      In-Reply-To: <1221506732.26003.15.camel@Remington>
      References: <1221506732.26003.15.camel@Remington>
      Message-ID: 
      
      Hi Preston,
      
      This looks good to me. I've committed it, with a few trivial
      comment changes.
      
      Thanks,
      
      Dan
      
      On Sep 15, 2008, at 12:25 PM, Preston Gurd wrote:
      
      > Re-enables the new vector select in the bitcode reader, by modifying  
      > the
      > bitcode reader/writer as follows:
      >
      > - add and use new bitcode FUNC_CODE_INST_VSELECT to handle the llvm
      > select opcode using either i1 or [N x i1] as the selector.
      > - retain old BITCODE FUNC_CODE_INST_SDELECT in the bitcode reader to
      > handle select on i1 for backwards compatibility with existing bitcode
      > files.
      > - re-enable the vector-select.ll test program.
      >
      > Also, rename the recently added bitcode opcode FUNC_CODE_INST_VCMP to
      > FUNC_CODE_INST_CMP2 and make the bitcode writer use it to handle
      > fcmp/icmp on scalars or vectors. In the bitcode writer, use
      > FUNC_CODE_INST_CMP for vfcmp/vicmp only. In the bitcode reader, have
      > FUNC_CODE_INST_CMP handle icmp/fcmp returning bool, for backwards
      > compatibility with existing bitcode files.
      >
      > Could someone please review these changes and either advise me what
      > additional changes you might want or else commit the patch for me?
      >
      > Thanks,
      >
      > Preston Gurd
      > 
      
      
      
      From gohman at apple.com  Mon Sep 15 20:37:09 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Tue, 16 Sep 2008 01:37:09 -0000
      Subject: [llvm-commits] [llvm] r56234 -
       /llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll
      Message-ID: <200809160137.m8G1bA8G022110@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Mon Sep 15 20:37:08 2008
      New Revision: 56234
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56234&view=rev
      Log:
      Fix spacing in the grep line for this test, following the recent
      SCEV-whitespace changes.
      
      Modified:
          llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll
      
      Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll?rev=56234&r1=56233&r2=56234&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll (original)
      +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll Mon Sep 15 20:37:08 2008
      @@ -1,4 +1,4 @@
      -; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop header: ( 0 smax  %n) iterations!}
      +; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop header: (0 smax %n) iterations!}
       ; XFAIL: *
       
       define void @foo(i32 %n) {
      
      
      
      
      From gohman at apple.com  Mon Sep 15 20:42:28 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Tue, 16 Sep 2008 01:42:28 -0000
      Subject: [llvm-commits] [llvm] r56235 - in
       /llvm/trunk/lib/CodeGen/SelectionDAG: SelectionDAGBuild.cpp
       SelectionDAGISel.cpp
      Message-ID: <200809160142.m8G1gSdo022254@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Mon Sep 15 20:42:28 2008
      New Revision: 56235
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56235&view=rev
      Log:
      Don't take the time to CheckDAGForTailCallsAndFixThem when tail calls
      are not enabled. Instead just omit the tail call flag when calls are
      created.
      
      Modified:
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=56235&r1=56234&r2=56235&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Sep 15 20:42:28 2008
      @@ -4201,7 +4201,8 @@
           TLI.LowerCallTo(getRoot(), CS.getType(),
                           CS.paramHasAttr(0, ParamAttr::SExt),
                           CS.paramHasAttr(0, ParamAttr::ZExt),
      -                    FTy->isVarArg(), CS.getCallingConv(), IsTailCall,
      +                    FTy->isVarArg(), CS.getCallingConv(),
      +                    IsTailCall && PerformTailCallOpt,
                           Callee, Args, DAG);
         if (CS.getType() != Type::VoidTy)
           setValue(CS.getInstruction(), Result.first);
      @@ -5138,7 +5139,8 @@
       
         std::pair Result =
           TLI.LowerCallTo(getRoot(), I.getType(), false, false, false, CallingConv::C,
      -                    true, DAG.getExternalSymbol("malloc", IntPtr), Args, DAG);
      +                    PerformTailCallOpt, DAG.getExternalSymbol("malloc", IntPtr),
      +                    Args, DAG);
         setValue(&I, Result.first);  // Pointers always fit in registers
         DAG.setRoot(Result.second);
       }
      @@ -5152,7 +5154,7 @@
         MVT IntPtr = TLI.getPointerTy();
         std::pair Result =
           TLI.LowerCallTo(getRoot(), Type::VoidTy, false, false, false,
      -                    CallingConv::C, true,
      +                    CallingConv::C, PerformTailCallOpt,
                           DAG.getExternalSymbol("free", IntPtr), Args, DAG);
         DAG.setRoot(Result.second);
       }
      @@ -5323,6 +5325,9 @@
                                   unsigned CallingConv, bool isTailCall,
                                   SDValue Callee,
                                   ArgListTy &Args, SelectionDAG &DAG) {
      +  assert((!isTailCall || PerformTailCallOpt) &&
      +         "isTailCall set when tail-call optimizations are disabled!");
      +
         SmallVector Ops;
         Ops.push_back(Chain);   // Op#0 - Chain
         Ops.push_back(Callee);
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=56235&r1=56234&r2=56235&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Sep 15 20:42:28 2008
      @@ -526,7 +526,8 @@
         // with correct tailcall attribute so that the target can rely on the tailcall
         // attribute indicating whether the call is really eligible for tail call
         // optimization.
      -  CheckDAGForTailCallsAndFixThem(*CurDAG, TLI);
      +  if (PerformTailCallOpt)
      +    CheckDAGForTailCallsAndFixThem(*CurDAG, TLI);
       
         // Final step, emit the lowered DAG as machine code.
         CodeGenAndEmitDAG();
      
      
      
      
      From isanbard at gmail.com  Tue Sep 16 01:30:48 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Tue, 16 Sep 2008 06:30:48 -0000
      Subject: [llvm-commits] [llvm] r56240 -
       /llvm/trunk/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c
      Message-ID: <200809160630.m8G6Umms030680@zion.cs.uiuc.edu>
      
      Author: void
      Date: Tue Sep 16 01:30:47 2008
      New Revision: 56240
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56240&view=rev
      Log:
      Remove space that was forgotten.`
      
      Modified:
          llvm/trunk/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c
      
      Modified: llvm/trunk/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c?rev=56240&r1=56239&r2=56240&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c (original)
      +++ llvm/trunk/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c Tue Sep 16 01:30:47 2008
      @@ -1,4 +1,4 @@
      -// RUN: %llvmgcc -S %s -o - | grep {llvm.ctlz.i32( i32} | count 2
      +// RUN: %llvmgcc -S %s -o - | grep {llvm.ctlz.i32(i32} | count 2
       // RUN: %llvmgcc -S %s -o - | grep {llvm.ctlz.i32(i32} | count 1
       
       unsigned t2(unsigned X) {
      
      
      
      
      From isanbard at gmail.com  Tue Sep 16 01:40:05 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Tue, 16 Sep 2008 06:40:05 -0000
      Subject: [llvm-commits] [llvm] r56241 -
       /llvm/trunk/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c
      Message-ID: <200809160640.m8G6e5RF030947@zion.cs.uiuc.edu>
      
      Author: void
      Date: Tue Sep 16 01:40:04 2008
      New Revision: 56241
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56241&view=rev
      Log:
      Fix test to account for no more whitespace and that one of the matches is the
      "declare" statement.
      
      Modified:
          llvm/trunk/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c
      
      Modified: llvm/trunk/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c?rev=56241&r1=56240&r2=56241&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c (original)
      +++ llvm/trunk/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c Tue Sep 16 01:40:04 2008
      @@ -1,5 +1,5 @@
      -// RUN: %llvmgcc -S %s -o - | grep {llvm.ctlz.i32(i32} | count 2
      -// RUN: %llvmgcc -S %s -o - | grep {llvm.ctlz.i32(i32} | count 1
      +// RUN: %llvmgcc -S %s -o - | grep {llvm.ctlz.i32(i32} | count 3
      +// RUN: %llvmgcc -S %s -o - | grep {llvm.ctlz.i32(i32} | grep declare | count 1
       
       unsigned t2(unsigned X) {
         return __builtin_clz(X);
      
      
      
      
      From baldrick at free.fr  Tue Sep 16 01:24:22 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Tue, 16 Sep 2008 08:24:22 +0200
      Subject: [llvm-commits] [llvm] r56229 - in /llvm/trunk:
      	include/llvm/PassManagerUtils.h utils/PassManagerUtils.cpp
      In-Reply-To: <200809152113.m8FLDkQM014227@zion.cs.uiuc.edu>
      References: <200809152113.m8FLDkQM014227@zion.cs.uiuc.edu>
      Message-ID: <200809160824.23459.baldrick@free.fr>
      
      Hi Devang,
      
      > +/// PruneEH - Add PruneEHPass, if set.
      
      this one maybe can be dropped: running the
      PruneEH pass doesn't do anything wrong when
      compiling without exception support, it just
      doesn't do anything at all.  It also does
      it speedily.  So it might as well always be
      run.  What do you think?
      
      Ciao,
      
      Duncan.
      
      
      From baldrick at free.fr  Tue Sep 16 01:37:43 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Tue, 16 Sep 2008 08:37:43 +0200
      Subject: [llvm-commits] [llvm] r56087 -
      	/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
      In-Reply-To: 
      References: <200809110215.m8B2F4om008283@zion.cs.uiuc.edu>
      	<200809111027.21624.baldrick@free.fr>
      	
      Message-ID: <200809160837.43912.baldrick@free.fr>
      
      Hi Dale,
      
      > On Sep 11, 2008, at 1:27 AMPDT, Duncan Sands wrote:
      > >> Succumb utterly to compatibility and implement
      > >> __sync_fetch_and_nand as ANDC, even though that's
      > >> not what nand means.
      > >
      > > what's this about?
      > 
      >  From the function's name one would expect it to do a NAND operation,  
      > ~(A&B), and that's what I thought when I implemented it on ppc (which  
      > conveniently has a NAND instruction).  In fact gcc generates ANDC,  
      > (~A)&B, consistently on all platforms AFAICT.  I don't see anything  
      > definitive in any documentation, so I'm going with gcc compatibility.   
      > (I don't imagine anybody is using this anyway.)
      
      I see - thanks for the explanation.  How about changing the llvm name
      to ATOMIC_LOAD_ANDC?
      
      Ciao,
      
      Duncan.
      
      
      From dalej at apple.com  Tue Sep 16 11:39:23 2008
      From: dalej at apple.com (Dale Johannesen)
      Date: Tue, 16 Sep 2008 09:39:23 -0700
      Subject: [llvm-commits] [llvm] r56087 -
      	/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
      In-Reply-To: <200809160837.43912.baldrick@free.fr>
      References: <200809110215.m8B2F4om008283@zion.cs.uiuc.edu>
      	<200809111027.21624.baldrick@free.fr>
      	
      	<200809160837.43912.baldrick@free.fr>
      Message-ID: 
      
      
      On Sep 15, 2008, at 11:37 PMPDT, Duncan Sands wrote:
      
      > Hi Dale,
      >
      >> On Sep 11, 2008, at 1:27 AMPDT, Duncan Sands wrote:
      >>>> Succumb utterly to compatibility and implement
      >>>> __sync_fetch_and_nand as ANDC, even though that's
      >>>> not what nand means.
      >>>
      >>> what's this about?
      >>
      >> From the function's name one would expect it to do a NAND operation,
      >> ~(A&B), and that's what I thought when I implemented it on ppc (which
      >> conveniently has a NAND instruction).  In fact gcc generates ANDC,
      >> (~A)&B, consistently on all platforms AFAICT.  I don't see anything
      >> definitive in any documentation, so I'm going with gcc compatibility.
      >> (I don't imagine anybody is using this anyway.)
      >
      > I see - thanks for the explanation.  How about changing the llvm name
      > to ATOMIC_LOAD_ANDC?
      
      I strongly prefer following the gcc name.
      
      
      
      From gohman at apple.com  Tue Sep 16 11:44:05 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Tue, 16 Sep 2008 16:44:05 -0000
      Subject: [llvm-commits] [llvm] r56243 -
      	/llvm/trunk/include/llvm/Instructions.h
      Message-ID: <200809161644.m8GGi6jk002759@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Tue Sep 16 11:44:00 2008
      New Revision: 56243
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56243&view=rev
      Log:
      FCmpInst predicates UNO, ORD, FALSE, and TRUE are commutative.
      
      Modified:
          llvm/trunk/include/llvm/Instructions.h
      
      Modified: llvm/trunk/include/llvm/Instructions.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=56243&r1=56242&r2=56243&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Instructions.h (original)
      +++ llvm/trunk/include/llvm/Instructions.h Tue Sep 16 11:44:00 2008
      @@ -807,16 +807,22 @@
                  "Invalid operand types for FCmp instruction");
         }
       
      -  /// This also tests for commutativity. If isEquality() returns true then
      -  /// the predicate is also commutative. Only the equality predicates are
      -  /// commutative.
         /// @returns true if the predicate of this instruction is EQ or NE.
         /// @brief Determine if this is an equality predicate.
         bool isEquality() const {
           return SubclassData == FCMP_OEQ || SubclassData == FCMP_ONE ||
                  SubclassData == FCMP_UEQ || SubclassData == FCMP_UNE;
         }
      -  bool isCommutative() const { return isEquality(); }
      +
      +  /// @returns true if the predicate of this instruction is commutative.
      +  /// @brief Determine if this is a commutative predicate.
      +  bool isCommutative() const {
      +    return isEquality() ||
      +           SubclassData == FCMP_FALSE ||
      +           SubclassData == FCMP_TRUE ||
      +           SubclassData == FCMP_ORD ||
      +           SubclassData == FCMP_UNO;
      +  }
       
         /// @returns true if the predicate is relational (not EQ or NE). 
         /// @brief Determine if this a relational predicate.
      
      
      
      
      From baldrick at free.fr  Tue Sep 16 11:51:22 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Tue, 16 Sep 2008 18:51:22 +0200
      Subject: [llvm-commits] [llvm] r56087 -
      	/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
      In-Reply-To: 
      References: <200809110215.m8B2F4om008283@zion.cs.uiuc.edu>
      	<200809160837.43912.baldrick@free.fr>
      	
      Message-ID: <200809161851.22387.baldrick@free.fr>
      
      > > I see - thanks for the explanation.  How about changing the llvm name
      > > to ATOMIC_LOAD_ANDC?
      > 
      > I strongly prefer following the gcc name.
      
      Well, you could always change the LLVM and gcc names (including upstream) :)
      
      Ciao,
      
      Duncan.
      
      
      From evan.cheng at apple.com  Tue Sep 16 12:28:20 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Tue, 16 Sep 2008 17:28:20 -0000
      Subject: [llvm-commits] [llvm] r56244 -
      	/llvm/trunk/lib/System/Unix/Memory.inc
      Message-ID: <200809161728.m8GHSKne005113@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Tue Sep 16 12:28:18 2008
      New Revision: 56244
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56244&view=rev
      Log:
      AllocateRWXMemory -> AllocateRWX.
      
      Modified:
          llvm/trunk/lib/System/Unix/Memory.inc
      
      Modified: llvm/trunk/lib/System/Unix/Memory.inc
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Memory.inc?rev=56244&r1=56243&r2=56244&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/System/Unix/Memory.inc (original)
      +++ llvm/trunk/lib/System/Unix/Memory.inc Tue Sep 16 12:28:18 2008
      @@ -18,7 +18,7 @@
       #include 
       #endif
       
      -/// AllocateRWXMemory - Allocate a slab of memory with read/write/execute
      +/// AllocateRWX - Allocate a slab of memory with read/write/execute
       /// permissions.  This is typically used for JIT applications where we want
       /// to emit code to the memory then jump to it.  Getting this type of memory
       /// is very OS specific.
      
      
      
      
      From dpatel at apple.com  Tue Sep 16 13:16:15 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Tue, 16 Sep 2008 11:16:15 -0700
      Subject: [llvm-commits] [llvm] r56229 - in /llvm/trunk:
      	include/llvm/PassManagerUtils.h utils/PassManagerUtils.cpp
      In-Reply-To: <200809160824.23459.baldrick@free.fr>
      References: <200809152113.m8FLDkQM014227@zion.cs.uiuc.edu>
      	<200809160824.23459.baldrick@free.fr>
      Message-ID: <3D9E6D31-BCAE-446C-92D1-207B6535A608@apple.com>
      
      
      On Sep 15, 2008, at 11:24 PM, Duncan Sands wrote:
      
      > Hi Devang,
      >
      >> +/// PruneEH - Add PruneEHPass, if set.
      >
      > this one maybe can be dropped: running the
      > PruneEH pass doesn't do anything wrong when
      > compiling without exception support, it just
      > doesn't do anything at all.  It also does
      > it speedily.  So it might as well always be
      > run.  What do you think?
      
      OK. Feel free to change llvm-gcc. I'm not going to touch it today.
      -
      Devang
      
      
      
      From gohman at apple.com  Tue Sep 16 13:46:06 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Tue, 16 Sep 2008 18:46:06 -0000
      Subject: [llvm-commits] [llvm] r56246 - in /llvm/trunk:
       lib/Analysis/ScalarEvolution.cpp
       lib/Transforms/Scalar/InstructionCombining.cpp
       test/Transforms/InstCombine/adjust-for-sminmax.ll
       test/Transforms/InstCombine/preserve-sminmax.ll
      Message-ID: <200809161846.m8GIk6KV007342@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Tue Sep 16 13:46:06 2008
      New Revision: 56246
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56246&view=rev
      Log:
      Improve instcombine's handling of integer min and max in two ways:
       - Recognize expressions like "x > -1 ? x : 0" as min/max and turn them
         into expressions like "x < 0 ? 0 : x", which is easily recognizable
         as a min/max operation.
       - Refrain from folding expression like "y/2 < 1" to "y < 2" when the
         comparison is being used as part of a min or max idiom, like
         "y/2 < 1 ? 1 : y/2". In that case, the division has another use, so
         folding doesn't eliminate it, and obfuscates the min/max, making it
         harder to recognize as a min/max operation.
      
      These benefit ScalarEvolution, CodeGen, and anything else that wants to
      recognize integer min and max.
      
      Added:
          llvm/trunk/test/Transforms/InstCombine/adjust-for-sminmax.ll
          llvm/trunk/test/Transforms/InstCombine/preserve-sminmax.ll
      Modified:
          llvm/trunk/lib/Analysis/ScalarEvolution.cpp
          llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
      
      Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=56246&r1=56245&r2=56246&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
      +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Sep 16 13:46:06 2008
      @@ -1831,11 +1831,6 @@
         case Instruction::Select:
           // This could be a smax or umax that was lowered earlier.
           // Try to recover it.
      -    //
      -    // FIXME: This doesn't recognize code like this:
      -    //    %t = icmp sgt i32 %n, -1
      -    //    %max = select i1 %t, i32 %n, i32 0
      -    //
           if (ICmpInst *ICI = dyn_cast(U->getOperand(0))) {
             Value *LHS = ICI->getOperand(0);
             Value *RHS = ICI->getOperand(1);
      
      Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=56246&r1=56245&r2=56246&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
      +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Sep 16 13:46:06 2008
      @@ -219,7 +219,8 @@
           Instruction *visitBitCast(BitCastInst &CI);
           Instruction *FoldSelectOpOp(SelectInst &SI, Instruction *TI,
                                       Instruction *FI);
      -    Instruction *visitSelectInst(SelectInst &CI);
      +    Instruction *visitSelectInst(SelectInst &SI);
      +    Instruction *visitSelectInstWithICmp(SelectInst &SI, ICmpInst *ICI);
           Instruction *visitCallInst(CallInst &CI);
           Instruction *visitInvokeInst(InvokeInst &II);
           Instruction *visitPHINode(PHINode &PN);
      @@ -5312,8 +5313,7 @@
           }
         }
       
      -  // See if we are doing a comparison between a constant and an instruction that
      -  // can be folded into the comparison.
      +  // See if we are doing a comparison with a constant.
         if (ConstantInt *CI = dyn_cast(Op1)) {
           Value *A, *B;
           
      @@ -5324,9 +5324,9 @@
             return new ICmpInst(I.getPredicate(), A, B);
           }
           
      -    // If we have a icmp le or icmp ge instruction, turn it into the appropriate
      -    // icmp lt or icmp gt instruction.  This allows us to rely on them being
      -    // folded in the code below.
      +    // If we have an icmp le or icmp ge instruction, turn it into the
      +    // appropriate icmp lt or icmp gt instruction.  This allows us to rely on
      +    // them being folded in the code below.
           switch (I.getPredicate()) {
           default: break;
           case ICmpInst::ICMP_ULE:
      @@ -5446,7 +5446,24 @@
               return new ICmpInst(ICmpInst::ICMP_EQ, Op0, AddOne(CI));
             break;
           }
      -          
      +  }
      +
      +  // Test if the ICmpInst instruction is used exclusively by a select as
      +  // part of a minimum or maximum operation. If so, refrain from doing
      +  // any other folding. This helps out other analyses which understand
      +  // non-obfuscated minimum and maximum idioms, such as ScalarEvolution
      +  // and CodeGen. And in this case, at least one of the comparison
      +  // operands has at least one user besides the compare (the select),
      +  // which would often largely negate the benefit of folding anyway.
      +  if (I.hasOneUse())
      +    if (SelectInst *SI = dyn_cast(*I.use_begin()))
      +      if ((SI->getOperand(1) == Op0 && SI->getOperand(2) == Op1) ||
      +          (SI->getOperand(2) == Op0 && SI->getOperand(1) == Op1))
      +        return 0;
      +
      +  // See if we are doing a comparison between a constant and an instruction that
      +  // can be folded into the comparison.
      +  if (ConstantInt *CI = dyn_cast(Op1)) {
           // Since the RHS is a ConstantInt (CI), if the left hand side is an 
           // instruction, see if that instruction also has constants so that the 
           // instruction can be folded into the icmp 
      @@ -8181,6 +8198,91 @@
         return 0;
       }
       
      +/// visitSelectInstWithICmp - Visit a SelectInst that has an
      +/// ICmpInst as its first operand.
      +///
      +Instruction *InstCombiner::visitSelectInstWithICmp(SelectInst &SI,
      +                                                   ICmpInst *ICI) {
      +  bool Changed = false;
      +  ICmpInst::Predicate Pred = ICI->getPredicate();
      +  Value *CmpLHS = ICI->getOperand(0);
      +  Value *CmpRHS = ICI->getOperand(1);
      +  Value *TrueVal = SI.getTrueValue();
      +  Value *FalseVal = SI.getFalseValue();
      +
      +  // Check cases where the comparison is with a constant that
      +  // can be adjusted to fit the min/max idiom. We may edit ICI in
      +  // place here, so make sure the select is the only user.
      +  if (ICI->hasOneUse())
      +    if (ConstantInt *CI = dyn_cast(CmpRHS))
      +      switch (Pred) {
      +      default: break;
      +      case ICmpInst::ICMP_ULT:
      +      case ICmpInst::ICMP_SLT: {
      +        // X < MIN ? T : F  -->  F
      +        if (CI->isMinValue(Pred == ICmpInst::ICMP_SLT))
      +          return ReplaceInstUsesWith(SI, FalseVal);
      +        // X < C ? X : C-1  -->  X > C-1 ? C-1 : X
      +        Constant *AdjustedRHS = SubOne(CI);
      +        if ((CmpLHS == TrueVal && AdjustedRHS == FalseVal) ||
      +            (CmpLHS == FalseVal && AdjustedRHS == TrueVal)) {
      +          Pred = ICmpInst::getSwappedPredicate(Pred);
      +          CmpRHS = AdjustedRHS;
      +          std::swap(FalseVal, TrueVal);
      +          ICI->setPredicate(Pred);
      +          ICI->setOperand(1, CmpRHS);
      +          SI.setOperand(1, TrueVal);
      +          SI.setOperand(2, FalseVal);
      +          Changed = true;
      +        }
      +        break;
      +      }
      +      case ICmpInst::ICMP_UGT:
      +      case ICmpInst::ICMP_SGT: {
      +        // X > MAX ? T : F  -->  F
      +        if (CI->isMaxValue(Pred == ICmpInst::ICMP_SGT))
      +          return ReplaceInstUsesWith(SI, FalseVal);
      +        // X > C ? X : C+1  -->  X < C+1 ? C+1 : X
      +        Constant *AdjustedRHS = AddOne(CI);
      +        if ((CmpLHS == TrueVal && AdjustedRHS == FalseVal) ||
      +            (CmpLHS == FalseVal && AdjustedRHS == TrueVal)) {
      +          Pred = ICmpInst::getSwappedPredicate(Pred);
      +          CmpRHS = AdjustedRHS;
      +          std::swap(FalseVal, TrueVal);
      +          ICI->setPredicate(Pred);
      +          ICI->setOperand(1, CmpRHS);
      +          SI.setOperand(1, TrueVal);
      +          SI.setOperand(2, FalseVal);
      +          Changed = true;
      +        }
      +        break;
      +      }
      +      }
      +
      +  if (CmpLHS == TrueVal && CmpRHS == FalseVal) {
      +    // Transform (X == Y) ? X : Y  -> Y
      +    if (Pred == ICmpInst::ICMP_EQ)
      +      return ReplaceInstUsesWith(SI, FalseVal);
      +    // Transform (X != Y) ? X : Y  -> X
      +    if (Pred == ICmpInst::ICMP_NE)
      +      return ReplaceInstUsesWith(SI, TrueVal);
      +    /// NOTE: if we wanted to, this is where to detect integer MIN/MAX
      +
      +  } else if (CmpLHS == FalseVal && CmpRHS == TrueVal) {
      +    // Transform (X == Y) ? Y : X  -> X
      +    if (Pred == ICmpInst::ICMP_EQ)
      +      return ReplaceInstUsesWith(SI, FalseVal);
      +    // Transform (X != Y) ? Y : X  -> Y
      +    if (Pred == ICmpInst::ICMP_NE)
      +      return ReplaceInstUsesWith(SI, TrueVal);
      +    /// NOTE: if we wanted to, this is where to detect integer MIN/MAX
      +  }
      +
      +  /// NOTE: if we wanted to, this is where to detect integer ABS
      +
      +  return Changed ? &SI : 0;
      +}
      +
       Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
         Value *CondVal = SI.getCondition();
         Value *TrueVal = SI.getTrueValue();
      @@ -8329,7 +8431,7 @@
             // Transform (X != Y) ? X : Y  -> X
             if (FCI->getPredicate() == FCmpInst::FCMP_ONE)
               return ReplaceInstUsesWith(SI, TrueVal);
      -      // NOTE: if we wanted to, this is where to detect MIN/MAX/ABS/etc.
      +      // NOTE: if we wanted to, this is where to detect MIN/MAX
       
           } else if (FCI->getOperand(0) == FalseVal && FCI->getOperand(1) == TrueVal){
             // Transform (X == Y) ? Y : X  -> X
      @@ -8347,31 +8449,15 @@
             // Transform (X != Y) ? Y : X  -> Y
             if (FCI->getPredicate() == FCmpInst::FCMP_ONE)
               return ReplaceInstUsesWith(SI, TrueVal);
      -      // NOTE: if we wanted to, this is where to detect MIN/MAX/ABS/etc.
      +      // NOTE: if we wanted to, this is where to detect MIN/MAX
           }
      +    // NOTE: if we wanted to, this is where to detect ABS
         }
       
         // See if we are selecting two values based on a comparison of the two values.
      -  if (ICmpInst *ICI = dyn_cast(CondVal)) {
      -    if (ICI->getOperand(0) == TrueVal && ICI->getOperand(1) == FalseVal) {
      -      // Transform (X == Y) ? X : Y  -> Y
      -      if (ICI->getPredicate() == ICmpInst::ICMP_EQ)
      -        return ReplaceInstUsesWith(SI, FalseVal);
      -      // Transform (X != Y) ? X : Y  -> X
      -      if (ICI->getPredicate() == ICmpInst::ICMP_NE)
      -        return ReplaceInstUsesWith(SI, TrueVal);
      -      // NOTE: if we wanted to, this is where to detect MIN/MAX/ABS/etc.
      -
      -    } else if (ICI->getOperand(0) == FalseVal && ICI->getOperand(1) == TrueVal){
      -      // Transform (X == Y) ? Y : X  -> X
      -      if (ICI->getPredicate() == ICmpInst::ICMP_EQ)
      -        return ReplaceInstUsesWith(SI, FalseVal);
      -      // Transform (X != Y) ? Y : X  -> Y
      -      if (ICI->getPredicate() == ICmpInst::ICMP_NE)
      -        return ReplaceInstUsesWith(SI, TrueVal);
      -      // NOTE: if we wanted to, this is where to detect MIN/MAX/ABS/etc.
      -    }
      -  }
      +  if (ICmpInst *ICI = dyn_cast(CondVal))
      +    if (Instruction *Result = visitSelectInstWithICmp(SI, ICI))
      +      return Result;
       
         if (Instruction *TI = dyn_cast(TrueVal))
           if (Instruction *FI = dyn_cast(FalseVal))
      
      Added: llvm/trunk/test/Transforms/InstCombine/adjust-for-sminmax.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/adjust-for-sminmax.ll?rev=56246&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Transforms/InstCombine/adjust-for-sminmax.ll (added)
      +++ llvm/trunk/test/Transforms/InstCombine/adjust-for-sminmax.ll Tue Sep 16 13:46:06 2008
      @@ -0,0 +1,85 @@
      +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {icmp s\[lg\]t i32 %n, 0} | count 16
      +
      +; Instcombine should recognize that this code can be adjusted
      +; to fit the canonical smax/smin pattern.
      +
      +define i32 @floor_a(i32 %n) {
      +  %t = icmp sgt i32 %n, -1
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @ceil_a(i32 %n) {
      +  %t = icmp slt i32 %n, 1
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @floor_b(i32 %n) {
      +  %t = icmp sgt i32 %n, 0
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @ceil_b(i32 %n) {
      +  %t = icmp slt i32 %n, 0
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @floor_c(i32 %n) {
      +  %t = icmp sge i32 %n, 0
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @ceil_c(i32 %n) {
      +  %t = icmp sle i32 %n, 0
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @floor_d(i32 %n) {
      +  %t = icmp sge i32 %n, 1
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @ceil_d(i32 %n) {
      +  %t = icmp sle i32 %n, -1
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @floor_e(i32 %n) {
      +  %t = icmp sgt i32 %n, -1
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @ceil_e(i32 %n) {
      +  %t = icmp slt i32 %n, 1
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @floor_f(i32 %n) {
      +  %t = icmp sgt i32 %n, 0
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @ceil_f(i32 %n) {
      +  %t = icmp slt i32 %n, 0
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @floor_g(i32 %n) {
      +  %t = icmp sge i32 %n, 0
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @ceil_g(i32 %n) {
      +  %t = icmp sle i32 %n, 0
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @floor_h(i32 %n) {
      +  %t = icmp sge i32 %n, 1
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      +define i32 @ceil_h(i32 %n) {
      +  %t = icmp sle i32 %n, -1
      +  %m = select i1 %t, i32 %n, i32 0
      +  ret i32 %m
      +}
      
      Added: llvm/trunk/test/Transforms/InstCombine/preserve-sminmax.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/preserve-sminmax.ll?rev=56246&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Transforms/InstCombine/preserve-sminmax.ll (added)
      +++ llvm/trunk/test/Transforms/InstCombine/preserve-sminmax.ll Tue Sep 16 13:46:06 2008
      @@ -0,0 +1,22 @@
      +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep { i32 \[%\]sd, \[\[:alnum:\]\]* \\?1\\>} | count 4
      +
      +; Instcombine normally would fold the sdiv into the comparison,
      +; making "icmp slt i32 %h, 2", but in this case the sdiv has
      +; another use, so it wouldn't a big win, and it would also
      +; obfuscate an otherise obvious smax pattern to the point where
      +; other analyses wouldn't recognize it.
      +
      +define i32 @foo(i32 %h) {
      +  %sd = sdiv i32 %h, 2
      +  %t = icmp slt i32 %sd, 1
      +  %r = select i1 %t, i32 %sd, i32 1
      +  ret i32 %r
      +}
      +
      +define i32 @bar(i32 %h) {
      +  %sd = sdiv i32 %h, 2
      +  %t = icmp sgt i32 %sd, 1
      +  %r = select i1 %t, i32 %sd, i32 1
      +  ret i32 %r
      +}
      +
      
      
      
      
      From gohman at apple.com  Tue Sep 16 13:52:57 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Tue, 16 Sep 2008 18:52:57 -0000
      Subject: [llvm-commits] [llvm] r56247 - in /llvm/trunk:
       lib/Analysis/ScalarEvolution.cpp
       test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll
       test/Analysis/ScalarEvolution/avoid-smax-1.ll
      Message-ID: <200809161852.m8GIqvoS007556@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Tue Sep 16 13:52:57 2008
      New Revision: 56247
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56247&view=rev
      Log:
      Finally re-apply r46959. This is made feasible by the combination
      of r56230, r56232, and r56246.
      
      Modified:
          llvm/trunk/lib/Analysis/ScalarEvolution.cpp
          llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll
          llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll
      
      Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=56247&r1=56246&r2=56247&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
      +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Sep 16 13:52:57 2008
      @@ -1981,8 +1981,8 @@
       
         // At this point, we would like to compute how many iterations of the 
         // loop the predicate will return true for these inputs.
      -  if (isa(LHS) && !isa(RHS)) {
      -    // If there is a constant, force it into the RHS.
      +  if (LHS->isLoopInvariant(L) && !RHS->isLoopInvariant(L)) {
      +    // If there is a loop-invariant, force it into the RHS.
           std::swap(LHS, RHS);
           Cond = ICmpInst::getSwappedPredicate(Cond);
         }
      
      Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll?rev=56247&r1=56246&r2=56247&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll (original)
      +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll Tue Sep 16 13:52:57 2008
      @@ -1,5 +1,4 @@
       ; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop header: (0 smax %n) iterations!}
      -; XFAIL: *
       
       define void @foo(i32 %n) {
       entry:
      
      Modified: llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll?rev=56247&r1=56246&r2=56247&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll (original)
      +++ llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll Tue Sep 16 13:52:57 2008
      @@ -1,11 +1,13 @@
       ; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
      -; RUN: not grep select %t
      +; RUN: grep select %t | count 2
       ; RUN: grep {icmp ne i32.\* %w	} %t
       
       ; Indvars should be able to insert a canonical induction variable
       ; for the bb6 loop without using a maximum calculation (icmp, select)
       ; because it should be able to prove that the comparison is guarded
      -; by an appropriate conditional branch.
      +; by an appropriate conditional branch. Unfortunately, indvars is
      +; not yet able to find the comparison for the other too loops in
      +; this testcase.
       
       target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
       target triple = "i386-apple-darwin9"
      
      
      
      
      From evan.cheng at apple.com  Tue Sep 16 14:55:08 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Tue, 16 Sep 2008 12:55:08 -0700
      Subject: [llvm-commits] [llvm] r56247 - in /llvm/trunk:
      	lib/Analysis/ScalarEvolution.cpp
      	test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll
      	test/Analysis/ScalarEvolution/avoid-smax-1.ll
      In-Reply-To: <200809161852.m8GIqvoS007556@zion.cs.uiuc.edu>
      References: <200809161852.m8GIqvoS007556@zion.cs.uiuc.edu>
      Message-ID: 
      
      Woohoo! Thanks Dan.
      
      Evan
      
      On Sep 16, 2008, at 11:52 AM, Dan Gohman wrote:
      
      > Author: djg
      > Date: Tue Sep 16 13:52:57 2008
      > New Revision: 56247
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=56247&view=rev
      > Log:
      > Finally re-apply r46959. This is made feasible by the combination
      > of r56230, r56232, and r56246.
      >
      > Modified:
      >    llvm/trunk/lib/Analysis/ScalarEvolution.cpp
      >    llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11- 
      > ReversedCondition.ll
      >    llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll
      >
      > Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=56247&r1=56246&r2=56247&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
      > +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Sep 16 13:52:57  
      > 2008
      > @@ -1981,8 +1981,8 @@
      >
      >   // At this point, we would like to compute how many iterations of  
      > the
      >   // loop the predicate will return true for these inputs.
      > -  if (isa(LHS) && !isa(RHS)) {
      > -    // If there is a constant, force it into the RHS.
      > +  if (LHS->isLoopInvariant(L) && !RHS->isLoopInvariant(L)) {
      > +    // If there is a loop-invariant, force it into the RHS.
      >     std::swap(LHS, RHS);
      >     Cond = ICmpInst::getSwappedPredicate(Cond);
      >   }
      >
      > Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11- 
      > ReversedCondition.ll
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll?rev=56247&r1=56246&r2=56247&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11- 
      > ReversedCondition.ll (original)
      > +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11- 
      > ReversedCondition.ll Tue Sep 16 13:52:57 2008
      > @@ -1,5 +1,4 @@
      > ; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop  
      > header: (0 smax %n) iterations!}
      > -; XFAIL: *
      >
      > define void @foo(i32 %n) {
      > entry:
      >
      > Modified: llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll?rev=56247&r1=56246&r2=56247&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll  
      > (original)
      > +++ llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll Tue Sep  
      > 16 13:52:57 2008
      > @@ -1,11 +1,13 @@
      > ; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
      > -; RUN: not grep select %t
      > +; RUN: grep select %t | count 2
      > ; RUN: grep {icmp ne i32.\* %w	} %t
      >
      > ; Indvars should be able to insert a canonical induction variable
      > ; for the bb6 loop without using a maximum calculation (icmp, select)
      > ; because it should be able to prove that the comparison is guarded
      > -; by an appropriate conditional branch.
      > +; by an appropriate conditional branch. Unfortunately, indvars is
      > +; not yet able to find the comparison for the other too loops in
      > +; this testcase.
      >
      > target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32- 
      > i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64- 
      > f80:128:128"
      > target triple = "i386-apple-darwin9"
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From pgurd at rapidmind.com  Mon Sep 15 14:25:31 2008
      From: pgurd at rapidmind.com (Preston Gurd)
      Date: Mon, 15 Sep 2008 15:25:31 -0400
      Subject: [llvm-commits] llvm bitcode change for review or commit
      Message-ID: <1221506732.26003.15.camel@Remington>
      
      Re-enables the new vector select in the bitcode reader, by modifying the
      bitcode reader/writer as follows:
      
      - add and use new bitcode FUNC_CODE_INST_VSELECT to handle the llvm
      select opcode using either i1 or [N x i1] as the selector.
      - retain old BITCODE FUNC_CODE_INST_SDELECT in the bitcode reader to
      handle select on i1 for backwards compatibility with existing bitcode
      files.
      - re-enable the vector-select.ll test program.
      
      Also, rename the recently added bitcode opcode FUNC_CODE_INST_VCMP to
      FUNC_CODE_INST_CMP2 and make the bitcode writer use it to handle
      fcmp/icmp on scalars or vectors. In the bitcode writer, use
      FUNC_CODE_INST_CMP for vfcmp/vicmp only. In the bitcode reader, have
      FUNC_CODE_INST_CMP handle icmp/fcmp returning bool, for backwards
      compatibility with existing bitcode files.
      
      Could someone please review these changes and either advise me what
      additional changes you might want or else commit the patch for me?
      
      Thanks,
      
      Preston Gurd
      -------------- next part --------------
      A non-text attachment was scrubbed...
      Name: llvm.diff
      Type: text/x-patch
      Size: 5474 bytes
      Desc: not available
      Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080915/94e10c2f/attachment.bin 
      
      From paul at rapidmind.com  Tue Sep 16 13:07:09 2008
      From: paul at rapidmind.com (Paul Redmond)
      Date: Tue, 16 Sep 2008 14:07:09 -0400
      Subject: [llvm-commits] [PATCH] align constant pool loads using preferred
      	alignment
      Message-ID: <48CFF5CD.5050102@rapidmind.com>
      
      Hi,
      
      As suggested by Dan Gohman:
      
      This patch changes SelectionDAG::getConstantPool to always set the 
      alignment of the ConstantPoolSDNode using the target's preferred 
      alignment for the constant type.
      
      In LegalizeDAG, when performing loads from the constant pool, the 
      ConstantPoolSDNode's alignment is used in the calls to getLoad and 
      getExtLoad.
      
      This change prevents SelectionDAG::getLoad/getExtLoad from incorrectly 
      choosing the ABI alignment for constant pool loads when Alignment == 0. 
      The incorrect alignment is only a performance issue when ABI alignment 
      does not equal preferred alignment (i.e., on x86 it was generating 
      MOVUPS instead of MOVAPS for v4f32 constant loads when the default ABI 
      alignment for 128bit vectors is forced to 1 byte.)
      
      thanks,
      Paul
      -------------- next part --------------
      A non-text attachment was scrubbed...
      Name: const_pref_align.diff
      Type: text/x-diff
      Size: 4732 bytes
      Desc: not available
      Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080916/353e641b/attachment.bin 
      
      From gohman at apple.com  Tue Sep 16 15:45:54 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Tue, 16 Sep 2008 20:45:54 -0000
      Subject: [llvm-commits] [llvm] r56248 - in /llvm/trunk:
       include/llvm/CodeGen/MachineConstantPool.h lib/CodeGen/MachineFunction.cpp
      Message-ID: <200809162045.m8GKjt3v011120@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Tue Sep 16 15:45:53 2008
      New Revision: 56248
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56248&view=rev
      Log:
      Fix these comments to reflect current reality. Surprisingly,
      MachineConstantPool::getConstantPoolIndex actually expects
      a log2-encoded alignment.
      
      Modified:
          llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h
          llvm/trunk/lib/CodeGen/MachineFunction.cpp
      
      Modified: llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h?rev=56248&r1=56247&r2=56248&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/MachineConstantPool.h Tue Sep 16 15:45:53 2008
      @@ -122,7 +122,8 @@
         unsigned getConstantPoolAlignment() const { return PoolAlignment; }
         
         /// getConstantPoolIndex - Create a new entry in the constant pool or return
      -  /// an existing one.  User must specify an alignment in bytes for the object.
      +  /// an existing one.  User must specify the log2 of the minimum required
      +  /// alignment for the object.
         unsigned getConstantPoolIndex(Constant *C, unsigned Alignment);
         unsigned getConstantPoolIndex(MachineConstantPoolValue *V,unsigned Alignment);
         
      
      Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=56248&r1=56247&r2=56248&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
      +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Tue Sep 16 15:45:53 2008
      @@ -479,7 +479,8 @@
       }
       
       /// getConstantPoolIndex - Create a new entry in the constant pool or return
      -/// an existing one.  User must specify an alignment in bytes for the object.
      +/// an existing one.  User must specify the log2 of the minimum required
      +/// alignment for the object.
       ///
       unsigned MachineConstantPool::getConstantPoolIndex(Constant *C, 
                                                          unsigned Alignment) {
      
      
      
      
      From isanbard at gmail.com  Tue Sep 16 16:12:30 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Tue, 16 Sep 2008 21:12:30 -0000
      Subject: [llvm-commits] [llvm] r56249 - in /llvm/trunk:
       include/llvm/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/ lib/Target/ARM/
       lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/Mips/
       lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ utils/TableGen/
      Message-ID: <200809162112.m8GLCWHs011996@zion.cs.uiuc.edu>
      
      Author: void
      Date: Tue Sep 16 16:12:30 2008
      New Revision: 56249
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56249&view=rev
      Log:
      - Change "ExternalSymbolSDNode" to "SymbolSDNode".
      - Add linkage to SymbolSDNode (default to external).
      - Change ISD::ExternalSymbol to ISD::Symbol.
      - Change ISD::TargetExternalSymbol to ISD::TargetSymbol
      
      These changes pave the way to allowing SymbolSDNodes with non-external linkage.
      
      Modified:
          llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
          llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
          llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
          llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
          llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
          llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp
          llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
          llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp
          llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp
          llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
          llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
          llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp
          llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
          llvm/trunk/lib/Target/TargetSelectionDAG.td
          llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
          llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
          llvm/trunk/lib/Target/X86/X86ISelLowering.h
          llvm/trunk/lib/Target/X86/X86Instr64bit.td
          llvm/trunk/lib/Target/X86/X86InstrInfo.td
          llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
      
      Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Tue Sep 16 16:12:30 2008
      @@ -278,7 +278,7 @@
             if (isa(Node))     return true;
             if (isa(Node))   return true;
             if (isa(Node))      return true;
      -      if (isa(Node)) return true;
      +      if (isa(Node))         return true;
             if (isa(Node))     return true;
             if (Node->getOpcode() == ISD::EntryToken) return true;
             return false;
      
      Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Tue Sep 16 16:12:30 2008
      @@ -282,8 +282,11 @@
           return getConstantPool(C, VT, Align, Offset, true);
         }
         SDValue getBasicBlock(MachineBasicBlock *MBB);
      -  SDValue getExternalSymbol(const char *Sym, MVT VT);
      -  SDValue getTargetExternalSymbol(const char *Sym, MVT VT);
      +  SDValue getSymbol(const char *Sym, MVT VT,
      +                   GlobalValue::LinkageTypes LT = GlobalValue::ExternalLinkage);
      +  SDValue getTargetSymbol(const char *Sym, MVT VT,
      +                          GlobalValue::LinkageTypes LT =
      +                            GlobalValue::ExternalLinkage);
         SDValue getArgFlags(ISD::ArgFlagsTy Flags);
         SDValue getValueType(MVT);
         SDValue getRegister(unsigned Reg, MVT VT);
      @@ -758,8 +761,8 @@
       
         std::vector ValueTypeNodes;
         std::map ExtendedValueTypeNodes;
      -  StringMap ExternalSymbols;
      -  StringMap TargetExternalSymbols;
      +  StringMap Symbols;
      +  StringMap TargetSymbols;
       };
       
       template <> struct GraphTraits : public GraphTraits {
      
      Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Tue Sep 16 16:12:30 2008
      @@ -21,6 +21,7 @@
       
       #include "llvm/Value.h"
       #include "llvm/Constants.h"
      +#include "llvm/GlobalValue.h"
       #include "llvm/ADT/FoldingSet.h"
       #include "llvm/ADT/GraphTraits.h"
       #include "llvm/ADT/iterator.h"
      @@ -89,7 +90,7 @@
           BasicBlock, VALUETYPE, ARG_FLAGS, CONDCODE, Register,
           Constant, ConstantFP,
           GlobalAddress, GlobalTLSAddress, FrameIndex,
      -    JumpTable, ConstantPool, ExternalSymbol,
      +    JumpTable, ConstantPool, Symbol,
       
           // The address of the GOT
           GLOBAL_OFFSET_TABLE,
      @@ -133,7 +134,7 @@
           TargetFrameIndex,
           TargetJumpTable,
           TargetConstantPool,
      -    TargetExternalSymbol,
      +    TargetSymbol,
           
           /// RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...)
           /// This node represents a target intrinsic function with no side effects.
      @@ -487,7 +488,7 @@
           // INLINEASM - Represents an inline asm block.  This node always has two
           // return values: a chain and a flag result.  The inputs are as follows:
           //   Operand #0   : Input chain.
      -    //   Operand #1   : a ExternalSymbolSDNode with a pointer to the asm string.
      +    //   Operand #1   : A SymbolSDNode with a pointer to the asm string.
           //   Operand #2n+2: A RegisterNode.
           //   Operand #2n+3: A TargetConstant, indicating if the reg is a use/def
           //   Operand #last: Optional, an incoming flag.
      @@ -2045,23 +2046,24 @@
         }
       };
       
      -class ExternalSymbolSDNode : public SDNode {
      +class SymbolSDNode : public SDNode {
         const char *Symbol;
      +  GlobalValue::LinkageTypes Linkage;
         virtual void ANCHOR();  // Out-of-line virtual method to give class a home.
       protected:
         friend class SelectionDAG;
      -  ExternalSymbolSDNode(bool isTarget, const char *Sym, MVT VT)
      -    : SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol,
      -             getSDVTList(VT)), Symbol(Sym) {
      -  }
      +  SymbolSDNode(bool isTarget, const char *Sym, MVT VT,
      +               GlobalValue::LinkageTypes L)
      +    : SDNode(isTarget ? ISD::TargetSymbol : ISD::Symbol,
      +             getSDVTList(VT)), Symbol(Sym), Linkage(L) {}
       public:
      -
         const char *getSymbol() const { return Symbol; }
      +  GlobalValue::LinkageTypes getLinkage() const { return Linkage; }
       
      -  static bool classof(const ExternalSymbolSDNode *) { return true; }
      +  static bool classof(const SymbolSDNode *) { return true; }
         static bool classof(const SDNode *N) {
      -    return N->getOpcode() == ISD::ExternalSymbol ||
      -           N->getOpcode() == ISD::TargetExternalSymbol;
      +    return N->getOpcode() == ISD::Symbol ||
      +           N->getOpcode() == ISD::TargetSymbol;
         }
       };
       
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Sep 16 16:12:30 2008
      @@ -799,7 +799,7 @@
         case ISD::TargetConstantPool:
         case ISD::TargetGlobalAddress:
         case ISD::TargetGlobalTLSAddress:
      -  case ISD::TargetExternalSymbol:
      +  case ISD::TargetSymbol:
         case ISD::VALUETYPE:
         case ISD::SRCVALUE:
         case ISD::MEMOPERAND:
      @@ -832,7 +832,7 @@
         case ISD::GLOBAL_OFFSET_TABLE:
         case ISD::GlobalAddress:
         case ISD::GlobalTLSAddress:
      -  case ISD::ExternalSymbol:
      +  case ISD::Symbol:
         case ISD::ConstantPool:
         case ISD::JumpTable: // Nothing to do.
           switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) {
      @@ -3979,7 +3979,7 @@
             std::pair CallResult =
               TLI.LowerCallTo(Tmp1, Type::VoidTy,
                               false, false, false, CallingConv::C, false,
      -                        DAG.getExternalSymbol("abort", TLI.getPointerTy()),
      +                        DAG.getSymbol("abort", TLI.getPointerTy()),
                               Args, DAG);
             Result = CallResult.second;
             break;
      @@ -5293,8 +5293,9 @@
           Entry.isZExt = !isSigned;
           Args.push_back(Entry);
         }
      -  SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
      -                                           TLI.getPointerTy());
      +
      +  SDValue Callee = DAG.getSymbol(TLI.getLibcallName(LC),
      +                                 TLI.getPointerTy());
       
         // Splice the libcall in wherever FindInputOutputChains tells us to.
         const Type *RetTy = Node->getValueType(0).getTypeForMVT();
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Tue Sep 16 16:12:30 2008
      @@ -623,8 +623,8 @@
           Entry.isZExt = !isSigned;
           Args.push_back(Entry);
         }
      -  SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
      -                                           TLI.getPointerTy());
      +
      +  SDValue Callee = DAG.getSymbol(TLI.getLibcallName(LC), TLI.getPointerTy());
       
         const Type *RetTy = RetVT.getTypeForMVT();
         std::pair CallInfo =
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp Tue Sep 16 16:12:30 2008
      @@ -288,7 +288,7 @@
           else
             Idx = ConstPool->getConstantPoolIndex(CP->getConstVal(), Align);
           MI->addOperand(MachineOperand::CreateCPI(Idx, Offset));
      -  } else if (ExternalSymbolSDNode *ES = dyn_cast(Op)) {
      +  } else if (SymbolSDNode *ES = dyn_cast(Op)) {
           MI->addOperand(MachineOperand::CreateES(ES->getSymbol()));
         } else {
           assert(Op.getValueType() != MVT::Other &&
      @@ -571,8 +571,7 @@
           MachineInstr *MI = BuildMI(*MF, TII->get(TargetInstrInfo::INLINEASM));
       
           // Add the asm string as an external symbol operand.
      -    const char *AsmStr =
      -      cast(Node->getOperand(1))->getSymbol();
      +    const char *AsmStr = cast(Node->getOperand(1))->getSymbol();
           MI->addOperand(MachineOperand::CreateES(AsmStr));
             
           // Add all of the operand registers to the instruction.
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 16 16:12:30 2008
      @@ -614,12 +614,11 @@
           Erased = CondCodeNodes[cast(N)->get()] != 0;
           CondCodeNodes[cast(N)->get()] = 0;
           break;
      -  case ISD::ExternalSymbol:
      -    Erased = ExternalSymbols.erase(cast(N)->getSymbol());
      +  case ISD::Symbol:
      +    Erased = Symbols.erase(cast(N)->getSymbol());
           break;
      -  case ISD::TargetExternalSymbol:
      -    Erased =
      -      TargetExternalSymbols.erase(cast(N)->getSymbol());
      +  case ISD::TargetSymbol:
      +    Erased = TargetSymbols.erase(cast(N)->getSymbol());
           break;
         case ISD::VALUETYPE: {
           MVT VT = cast(N)->getVT();
      @@ -842,8 +841,8 @@
         CSEMap.clear();
       
         ExtendedValueTypeNodes.clear();
      -  ExternalSymbols.clear();
      -  TargetExternalSymbols.clear();
      +  Symbols.clear();
      +  TargetSymbols.clear();
         std::fill(CondCodeNodes.begin(), CondCodeNodes.end(),
                   static_cast(0));
         std::fill(ValueTypeNodes.begin(), ValueTypeNodes.end(),
      @@ -1098,20 +1097,22 @@
         return SDValue(N, 0);
       }
       
      -SDValue SelectionDAG::getExternalSymbol(const char *Sym, MVT VT) {
      -  SDNode *&N = ExternalSymbols[Sym];
      +SDValue SelectionDAG::getSymbol(const char *Sym, MVT VT,
      +                                GlobalValue::LinkageTypes LT) {
      +  SDNode *&N = Symbols[Sym];
         if (N) return SDValue(N, 0);
      -  N = NodeAllocator.Allocate();
      -  new (N) ExternalSymbolSDNode(false, Sym, VT);
      +  N = NodeAllocator.Allocate();
      +  new (N) SymbolSDNode(false, Sym, VT, LT);
         AllNodes.push_back(N);
         return SDValue(N, 0);
       }
       
      -SDValue SelectionDAG::getTargetExternalSymbol(const char *Sym, MVT VT) {
      -  SDNode *&N = TargetExternalSymbols[Sym];
      +SDValue SelectionDAG::getTargetSymbol(const char *Sym, MVT VT,
      +                                      GlobalValue::LinkageTypes LT) {
      +  SDNode *&N = TargetSymbols[Sym];
         if (N) return SDValue(N, 0);
      -  N = NodeAllocator.Allocate();
      -  new (N) ExternalSymbolSDNode(true, Sym, VT);
      +  N = NodeAllocator.Allocate();
      +  new (N) SymbolSDNode(true, Sym, VT, LT);
         AllNodes.push_back(N);
         return SDValue(N, 0);
       }
      @@ -3098,7 +3099,7 @@
         std::pair CallResult =
           TLI.LowerCallTo(Chain, Type::VoidTy,
                           false, false, false, CallingConv::C, false,
      -                    getExternalSymbol("memcpy", TLI.getPointerTy()),
      +                    getSymbol("memcpy", TLI.getPointerTy()),
                           Args, *this);
         return CallResult.second;
       }
      @@ -3143,7 +3144,7 @@
         std::pair CallResult =
           TLI.LowerCallTo(Chain, Type::VoidTy,
                           false, false, false, CallingConv::C, false,
      -                    getExternalSymbol("memmove", TLI.getPointerTy()),
      +                    getSymbol("memmove", TLI.getPointerTy()),
                           Args, *this);
         return CallResult.second;
       }
      @@ -3194,7 +3195,7 @@
         std::pair CallResult =
           TLI.LowerCallTo(Chain, Type::VoidTy,
                           false, false, false, CallingConv::C, false,
      -                    getExternalSymbol("memset", TLI.getPointerTy()),
      +                    getSymbol("memset", TLI.getPointerTy()),
                           Args, *this);
         return CallResult.second;
       }
      @@ -4610,7 +4611,7 @@
       void RegisterSDNode::ANCHOR() {}
       void DbgStopPointSDNode::ANCHOR() {}
       void LabelSDNode::ANCHOR() {}
      -void ExternalSymbolSDNode::ANCHOR() {}
      +void SymbolSDNode::ANCHOR() {}
       void CondCodeSDNode::ANCHOR() {}
       void ARG_FLAGSSDNode::ANCHOR() {}
       void VTSDNode::ANCHOR() {}
      @@ -4914,14 +4915,14 @@
         case ISD::FrameIndex:    return "FrameIndex";
         case ISD::JumpTable:     return "JumpTable";
         case ISD::GLOBAL_OFFSET_TABLE: return "GLOBAL_OFFSET_TABLE";
      -  case ISD::RETURNADDR: return "RETURNADDR";
      -  case ISD::FRAMEADDR: return "FRAMEADDR";
      +  case ISD::RETURNADDR:    return "RETURNADDR";
      +  case ISD::FRAMEADDR:     return "FRAMEADDR";
         case ISD::FRAME_TO_ARGS_OFFSET: return "FRAME_TO_ARGS_OFFSET";
         case ISD::EXCEPTIONADDR: return "EXCEPTIONADDR";
      -  case ISD::EHSELECTION: return "EHSELECTION";
      -  case ISD::EH_RETURN: return "EH_RETURN";
      +  case ISD::EHSELECTION:   return "EHSELECTION";
      +  case ISD::EH_RETURN:     return "EH_RETURN";
         case ISD::ConstantPool:  return "ConstantPool";
      -  case ISD::ExternalSymbol: return "ExternalSymbol";
      +  case ISD::Symbol:        return "Symbol";
         case ISD::INTRINSIC_WO_CHAIN: {
           unsigned IID = cast(getOperand(0))->getZExtValue();
           return Intrinsic::getName((Intrinsic::ID)IID);
      @@ -4940,7 +4941,7 @@
         case ISD::TargetFrameIndex: return "TargetFrameIndex";
         case ISD::TargetJumpTable:  return "TargetJumpTable";
         case ISD::TargetConstantPool:  return "TargetConstantPool";
      -  case ISD::TargetExternalSymbol: return "TargetExternalSymbol";
      +  case ISD::TargetSymbol:  return "TargetSymbol";
       
         case ISD::CopyToReg:     return "CopyToReg";
         case ISD::CopyFromReg:   return "CopyFromReg";
      @@ -5230,9 +5231,23 @@
           } else {
             OS << " #" << R->getReg();
           }
      -  } else if (const ExternalSymbolSDNode *ES =
      -             dyn_cast(this)) {
      -    OS << "'" << ES->getSymbol() << "'";
      +  } else if (const SymbolSDNode *S =
      +             dyn_cast(this)) {
      +    OS << "'" << S->getSymbol() << "' ";
      +
      +    switch (S->getLinkage()) {
      +    default: assert(0 && "Invalid linkage type!"); break;
      +    case GlobalValue::ExternalLinkage:       OS << "[external]"; break;
      +    case GlobalValue::LinkOnceLinkage:       OS << "[once]"; break;
      +    case GlobalValue::WeakLinkage:           OS << "[weak]"; break;
      +    case GlobalValue::AppendingLinkage:      OS << "[appending]"; break;
      +    case GlobalValue::InternalLinkage:       OS << "[internal]"; break;
      +    case GlobalValue::DLLImportLinkage:      OS << "[dllimport]"; break;
      +    case GlobalValue::DLLExportLinkage:      OS << "[dllexport]"; break;
      +    case GlobalValue::ExternalWeakLinkage:   OS << "[externweak]"; break;
      +    case GlobalValue::GhostLinkage:          OS << "[ghost]"; break;
      +    case GlobalValue::CommonLinkage:         OS << "[common]"; break;
      +    }
         } else if (const SrcValueSDNode *M = dyn_cast(this)) {
           if (M->getValue())
             OS << "<" << M->getValue() << ">";
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Tue Sep 16 16:12:30 2008
      @@ -4293,7 +4293,7 @@
         if (!RenameFn)
           Callee = getValue(I.getOperand(0));
         else
      -    Callee = DAG.getExternalSymbol(RenameFn, TLI.getPointerTy());
      +    Callee = DAG.getSymbol(RenameFn, TLI.getPointerTy());
       
         LowerCallTo(&I, Callee, I.isTailCall());
       }
      @@ -4888,7 +4888,7 @@
         std::vector AsmNodeOperands;
         AsmNodeOperands.push_back(SDValue());  // reserve space for input chain
         AsmNodeOperands.push_back(
      -          DAG.getTargetExternalSymbol(IA->getAsmString().c_str(), MVT::Other));
      +          DAG.getTargetSymbol(IA->getAsmString().c_str(), MVT::Other));
         
         
         // Loop over all of the inputs, copying the operand values into the
      @@ -5139,7 +5139,7 @@
       
         std::pair Result =
           TLI.LowerCallTo(getRoot(), I.getType(), false, false, false, CallingConv::C,
      -                    PerformTailCallOpt, DAG.getExternalSymbol("malloc", IntPtr),
      +                    PerformTailCallOpt, DAG.getSymbol("malloc", IntPtr),
                           Args, DAG);
         setValue(&I, Result.first);  // Pointers always fit in registers
         DAG.setRoot(Result.second);
      @@ -5155,7 +5155,7 @@
         std::pair Result =
           TLI.LowerCallTo(getRoot(), Type::VoidTy, false, false, false,
                           CallingConv::C, PerformTailCallOpt,
      -                    DAG.getExternalSymbol("free", IntPtr), Args, DAG);
      +                    DAG.getSymbol("free", IntPtr), Args, DAG);
         DAG.setRoot(Result.second);
       }
       
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Tue Sep 16 16:12:30 2008
      @@ -185,9 +185,8 @@
             Op += ", isVarArg";
           if (C->isTailCall())
             Op += ", isTailCall";
      -  } else if (const ExternalSymbolSDNode *ES =
      -             dyn_cast(Node)) {
      -    Op += "'" + std::string(ES->getSymbol()) + "'";
      +  } else if (const SymbolSDNode *S = dyn_cast(Node)) {
      +    Op += "'" + std::string(S->getSymbol()) + "'";
         } else if (const SrcValueSDNode *M = dyn_cast(Node)) {
           if (M->getValue())
             Op += "<" + M->getValue()->getName() + ">";
      
      Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Sep 16 16:12:30 2008
      @@ -531,9 +531,9 @@
           InFlag = Chain.getValue(1);
         }
       
      -  // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
      -  // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
      -  // node so that legalize doesn't hack it.
      +  // If the callee is a GlobalAddress/Symbol node (quite common, every direct
      +  // call is) turn it into a TargetGlobalAddress/TargetSymbol node so that
      +  // legalize doesn't hack it.
         bool isDirect = false;
         bool isARMFunc = false;
         bool isLocalARMFunc = false;
      @@ -558,7 +558,7 @@
             Callee = DAG.getNode(ARMISD::PIC_ADD, getPointerTy(), Callee, PICLabel);
          } else
             Callee = DAG.getTargetGlobalAddress(GV, getPointerTy());
      -  } else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) {
      +  } else if (SymbolSDNode *S = dyn_cast(Callee)) {
           isDirect = true;
           bool isStub = Subtarget->isTargetDarwin() &&
                         getTargetMachine().getRelocationModel() != Reloc::Static;
      @@ -574,7 +574,7 @@
             SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex++, MVT::i32);
             Callee = DAG.getNode(ARMISD::PIC_ADD, getPointerTy(), Callee, PICLabel);
           } else
      -      Callee = DAG.getTargetExternalSymbol(Sym, getPointerTy());
      +      Callee = DAG.getTargetSymbol(Sym, getPointerTy(), S->getLinkage());
         }
       
         // FIXME: handle tail calls differently.
      @@ -715,12 +715,11 @@
         return DAG.getNode(ARMISD::RET_FLAG, MVT::Other, Copy, Copy.getValue(1));
       }
       
      -// ConstantPool, JumpTable, GlobalAddress, and ExternalSymbol are lowered as 
      -// their target countpart wrapped in the ARMISD::Wrapper node. Suppose N is
      -// one of the above mentioned nodes. It has to be wrapped because otherwise
      -// Select(N) returns N. So the raw TargetGlobalAddress nodes, etc. can only
      -// be used to form addressing mode. These wrapped nodes will be selected
      -// into MOVi.
      +// ConstantPool, JumpTable, GlobalAddress, and Symbol are lowered as their
      +// target countpart wrapped in the ARMISD::Wrapper node. Suppose N is one of the
      +// above mentioned nodes. It has to be wrapped because otherwise Select(N)
      +// returns N. So the raw TargetGlobalAddress nodes, etc. can only be used to
      +// form addressing mode. These wrapped nodes will be selected into MOVi.
       static SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) {
         MVT PtrVT = Op.getValueType();
         ConstantPoolSDNode *CP = cast(Op);
      @@ -760,7 +759,7 @@
         std::pair CallResult =
           LowerCallTo(Chain, (const Type *) Type::Int32Ty, false, false, false,
                       CallingConv::C, false,
      -                DAG.getExternalSymbol("__tls_get_addr", PtrVT), Args, DAG);
      +                DAG.getSymbol("__tls_get_addr", PtrVT), Args, DAG);
         return CallResult.first;
       }
       
      
      Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Tue Sep 16 16:12:30 2008
      @@ -125,12 +125,11 @@
         setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);
         setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Expand);
       
      -  // We want to legalize GlobalAddress and ConstantPool and
      -  // ExternalSymbols nodes into the appropriate instructions to
      -  // materialize the address.
      +  // We want to legalize GlobalAddress and ConstantPool and Symbols nodes into
      +  // the appropriate instructions to materialize the address.
         setOperationAction(ISD::GlobalAddress,  MVT::i64, Custom);
         setOperationAction(ISD::ConstantPool,   MVT::i64, Custom);
      -  setOperationAction(ISD::ExternalSymbol, MVT::i64, Custom);
      +  setOperationAction(ISD::Symbol, MVT::i64, Custom);
         setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom);
       
         setOperationAction(ISD::VASTART, MVT::Other, Custom);
      @@ -491,13 +490,13 @@
             return DAG.getNode(AlphaISD::RelLit, MVT::i64, GA, 
                                DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, MVT::i64));
         }
      -  case ISD::ExternalSymbol: {
      +  case ISD::Symbol: {
      +    SymbolSDNode *S = cast(Op);
           return DAG.getNode(AlphaISD::RelLit, MVT::i64, 
      -                       DAG.getTargetExternalSymbol(cast(Op)
      -                                                   ->getSymbol(), MVT::i64),
      +                       DAG.getTargetSymbol(S->getSymbol(), MVT::i64,
      +                                           S->getLinkage()),
                              DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, MVT::i64));
         }
      -
         case ISD::UREM:
         case ISD::SREM:
           //Expand only on constant case
      @@ -526,7 +525,7 @@
             }
             SDValue Tmp1 = Op.getOperand(0),
               Tmp2 = Op.getOperand(1),
      -        Addr = DAG.getExternalSymbol(opstr, MVT::i64);
      +        Addr = DAG.getSymbol(opstr, MVT::i64);
             return DAG.getNode(AlphaISD::DivCall, MVT::i64, Addr, Tmp1, Tmp2);
           }
           break;
      
      Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Tue Sep 16 16:12:30 2008
      @@ -92,12 +92,12 @@
                   || Opc == ISD::GlobalTLSAddress
                   || Opc == ISD::JumpTable
                   || Opc == ISD::ConstantPool
      -            || Opc == ISD::ExternalSymbol
      +            || Opc == ISD::Symbol
                   || Opc == ISD::TargetGlobalAddress
                   || Opc == ISD::TargetGlobalTLSAddress
                   || Opc == ISD::TargetJumpTable
                   || Opc == ISD::TargetConstantPool
      -            || Opc == ISD::TargetExternalSymbol
      +            || Opc == ISD::TargetSymbol
                   || Opc == SPUISD::AFormAddr);
         }
       
      @@ -1201,9 +1201,9 @@
         SmallVector Ops;
         unsigned CallOpc = SPUISD::CALL;
       
      -  // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
      -  // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
      -  // node so that legalize doesn't hack it.
      +  // If the callee is a GlobalAddress/Symbol node (quite common, every direct
      +  // call is) turn it into a TargetGlobalAddress/TargetSymbol node so that
      +  // legalize doesn't hack it.
         if (GlobalAddressSDNode *G = dyn_cast(Callee)) {
           GlobalValue *GV = G->getGlobal();
           MVT CalleeVT = Callee.getValueType();
      @@ -1229,8 +1229,9 @@
             // address pairs:
             Callee = DAG.getNode(SPUISD::IndirectAddr, PtrVT, GA, Zero);
           }
      -  } else if (ExternalSymbolSDNode *S = dyn_cast(Callee))
      -    Callee = DAG.getExternalSymbol(S->getSymbol(), Callee.getValueType());
      +  } else if (SymbolSDNode *S = dyn_cast(Callee))
      +    Callee = DAG.getSymbol(S->getSymbol(), Callee.getValueType(),
      +                           S->getLinkage());
         else if (SDNode *Dest = isLSAAddress(Callee, DAG)) {
           // If this is an absolute destination address that appears to be a legal
           // local store address, use the munged value.
      
      Modified: llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp (original)
      +++ llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp Tue Sep 16 16:12:30 2008
      @@ -329,7 +329,7 @@
             dyn_cast(N->getOperand(1))) {
             CallOpcode = IA64::BRCALL_IPREL_GA;
             CallOperand = CurDAG->getTargetGlobalAddress(GASD->getGlobal(), MVT::i64);
      -    } else if (isa(N->getOperand(1))) {
      +    } else if (isa(N->getOperand(1))) {
             // FIXME: we currently NEED this case for correctness, to avoid
             // "non-pic code with imm reloc.n against dynamic symbol" errors
           CallOpcode = IA64::BRCALL_IPREL_ES;
      @@ -448,9 +448,9 @@
         }
         
       /* XXX
      -   case ISD::ExternalSymbol: {
      -     SDValue EA = CurDAG->getTargetExternalSymbol(
      -       cast(N)->getSymbol(),
      +   case ISD::Symbol: {
      +     SDValue EA = CurDAG->getTargetSymbol(
      +       cast(N)->getSymbol(),
              MVT::i64);
            SDValue Tmp = CurDAG->getTargetNode(IA64::ADDL_EA, MVT::i64, 
                                                  CurDAG->getRegister(IA64::r1,
      
      Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original)
      +++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Tue Sep 16 16:12:30 2008
      @@ -159,7 +159,7 @@
             return true;
           }
         } else {
      -    if ((Addr.getOpcode() == ISD::TargetExternalSymbol ||
      +    if ((Addr.getOpcode() == ISD::TargetSymbol ||
               Addr.getOpcode() == ISD::TargetGlobalAddress))
             return false;
         }    
      @@ -354,7 +354,7 @@
               SDValue InFlag(0, 0);
       
               if ( (isa(Callee)) ||
      -             (isa(Callee)) )
      +             (isa(Callee)) )
               {
                 /// Direct call for global addresses and external symbols
                 SDValue GPReg = CurDAG->getRegister(Mips::GP, MVT::i32);
      
      Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Tue Sep 16 16:12:30 2008
      @@ -684,14 +684,14 @@
           InFlag = Chain.getValue(1);
         }
       
      -  // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
      -  // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol 
      -  // node so that legalize doesn't hack it. 
      +  // If the callee is a GlobalAddress/Symbol node (quite common, every direct
      +  // call is) turn it into a TargetGlobalAddress/TargetSymbol node so that
      +  // legalize doesn't hack it.
         if (GlobalAddressSDNode *G = dyn_cast(Callee)) 
           Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy());
      -  else if (ExternalSymbolSDNode *S = dyn_cast(Callee))
      -    Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy());
      -
      +  else if (SymbolSDNode *S = dyn_cast(Callee))
      +    Callee = DAG.getTargetSymbol(S->getSymbol(), getPointerTy(),
      +                                 S->getLinkage());
       
         // MipsJmpLink = #chain, #target_address, #opt_in_flags...
         //             = Chain, Callee, Reg#1, Reg#2, ...  
      
      Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Tue Sep 16 16:12:30 2008
      @@ -2462,13 +2462,14 @@
         SmallVector Ops;
         unsigned CallOpc = isMachoABI? PPCISD::CALL_Macho : PPCISD::CALL_ELF;
         
      -  // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
      -  // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
      -  // node so that legalize doesn't hack it.
      +  // If the callee is a GlobalAddress/Symbol node (quite common, every direct
      +  // call is) turn it into a TargetGlobalAddress/TargetSymbol node so that
      +  // legalize doesn't hack it.
         if (GlobalAddressSDNode *G = dyn_cast(Callee))
           Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType());
      -  else if (ExternalSymbolSDNode *S = dyn_cast(Callee))
      -    Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee.getValueType());
      +  else if (SymbolSDNode *S = dyn_cast(Callee))
      +    Callee = DAG.getTargetSymbol(S->getSymbol(), Callee.getValueType(),
      +                                 S->getLinkage());
         else if (SDNode *Dest = isBLACompatibleAddress(Callee, DAG))
           // If this is an absolute destination address, use the munged value.
           Callee = SDValue(Dest, 0);
      @@ -2593,7 +2594,7 @@
       
           assert(((TargetAddress.getOpcode() == ISD::Register &&
                    cast(TargetAddress)->getReg() == PPC::CTR) ||
      -            TargetAddress.getOpcode() == ISD::TargetExternalSymbol ||
      +            TargetAddress.getOpcode() == ISD::TargetSymbol ||
                   TargetAddress.getOpcode() == ISD::TargetGlobalAddress ||
                   isa(TargetAddress)) &&
           "Expecting an global address, external symbol, absolute value or register");
      @@ -3414,7 +3415,7 @@
       static SDValue GeneratePerfectShuffle(unsigned PFEntry, SDValue LHS,
                                               SDValue RHS, SelectionDAG &DAG) {
         unsigned OpNum = (PFEntry >> 26) & 0x0F;
      -  unsigned LHSID  = (PFEntry >> 13) & ((1 << 13)-1);
      +  unsigned LHSID = (PFEntry >> 13) & ((1 << 13)-1);
         unsigned RHSID = (PFEntry >>  0) & ((1 << 13)-1);
         
         enum {
      
      Modified: llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp (original)
      +++ llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp Tue Sep 16 16:12:30 2008
      @@ -77,7 +77,7 @@
           Offset = CurDAG->getTargetConstant(0, MVT::i32);
           return true;
         }
      -  if (Addr.getOpcode() == ISD::TargetExternalSymbol ||
      +  if (Addr.getOpcode() == ISD::TargetSymbol ||
             Addr.getOpcode() == ISD::TargetGlobalAddress)
           return false;  // direct calls.
         
      @@ -114,7 +114,7 @@
       bool SparcDAGToDAGISel::SelectADDRrr(SDValue Op, SDValue Addr,
                                            SDValue &R1,  SDValue &R2) {
         if (Addr.getOpcode() == ISD::FrameIndex) return false;
      -  if (Addr.getOpcode() == ISD::TargetExternalSymbol ||
      +  if (Addr.getOpcode() == ISD::TargetSymbol ||
             Addr.getOpcode() == ISD::TargetGlobalAddress)
           return false;  // direct calls.
         
      
      Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Tue Sep 16 16:12:30 2008
      @@ -407,11 +407,11 @@
       
         // If the callee is a GlobalAddress node (quite common, every direct call is)
         // turn it into a TargetGlobalAddress node so that legalize doesn't hack it.
      -  // Likewise ExternalSymbol -> TargetExternalSymbol.
      +  // Likewise Symbol -> TargetSymbol.
         if (GlobalAddressSDNode *G = dyn_cast(Callee))
           Callee = DAG.getTargetGlobalAddress(G->getGlobal(), MVT::i32);
      -  else if (ExternalSymbolSDNode *E = dyn_cast(Callee))
      -    Callee = DAG.getTargetExternalSymbol(E->getSymbol(), MVT::i32);
      +  else if (SymbolSDNode *S = dyn_cast(Callee))
      +    Callee = DAG.getTargetSymbol(S->getSymbol(), MVT::i32, S->getLinkage());
       
         std::vector NodeTys;
         NodeTys.push_back(MVT::Other);   // Returns a chain
      
      Modified: llvm/trunk/lib/Target/TargetSelectionDAG.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetSelectionDAG.td?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/TargetSelectionDAG.td (original)
      +++ llvm/trunk/lib/Target/TargetSelectionDAG.td Tue Sep 16 16:12:30 2008
      @@ -265,10 +265,10 @@
                                "FrameIndexSDNode">;
       def tframeindex : SDNode<"ISD::TargetFrameIndex",     SDTPtrLeaf, [],
                                "FrameIndexSDNode">;
      -def externalsym : SDNode<"ISD::ExternalSymbol",       SDTPtrLeaf, [],
      -                         "ExternalSymbolSDNode">;
      -def texternalsym: SDNode<"ISD::TargetExternalSymbol", SDTPtrLeaf, [],
      -                         "ExternalSymbolSDNode">;
      +def externalsym : SDNode<"ISD::Symbol",               SDTPtrLeaf, [],
      +                         "SymbolSDNode">;
      +def texternalsym: SDNode<"ISD::TargetSymbol",         SDTPtrLeaf, [],
      +                         "SymbolSDNode">;
       
       def add        : SDNode<"ISD::ADD"       , SDTIntBinOp   ,
                               [SDNPCommutative, SDNPAssociative]>;
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Sep 16 16:12:30 2008
      @@ -207,7 +207,7 @@
               Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i32,
                                                    AM.Align, AM.Disp);
             else if (AM.ES)
      -        Disp = CurDAG->getTargetExternalSymbol(AM.ES, MVT::i32);
      +        Disp = CurDAG->getTargetSymbol(AM.ES, MVT::i32);
             else if (AM.JT != -1)
               Disp = CurDAG->getTargetJumpTable(AM.JT, MVT::i32);
             else
      @@ -835,7 +835,7 @@
               AM.isRIPRel = TM.getRelocationModel() != Reloc::Static &&
                 Subtarget->isPICStyleRIPRel();
               return false;
      -      } else if (ExternalSymbolSDNode *S =dyn_cast(N0)) {
      +      } else if (SymbolSDNode *S = dyn_cast(N0)) {
               AM.ES = S->getSymbol();
               AM.isRIPRel = TM.getRelocationModel() != Reloc::Static &&
                 Subtarget->isPICStyleRIPRel();
      @@ -1292,7 +1292,7 @@
                 N1.getOpcode() == ISD::Constant) {
               unsigned Offset = (unsigned)cast(N1)->getZExtValue();
               SDValue C(0, 0);
      -        // TODO: handle ExternalSymbolSDNode.
      +        // TODO: handle SymbolSDNode.
               if (GlobalAddressSDNode *G =
                   dyn_cast(N0.getOperand(0))) {
                 C = CurDAG->getTargetGlobalAddress(G->getGlobal(), PtrVT,
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Sep 16 16:12:30 2008
      @@ -268,12 +268,12 @@
         setOperationAction(ISD::GlobalTLSAddress, MVT::i32  , Custom);
         if (Subtarget->is64Bit())
           setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom);
      -  setOperationAction(ISD::ExternalSymbol  , MVT::i32  , Custom);
      +  setOperationAction(ISD::Symbol          , MVT::i32  , Custom);
         if (Subtarget->is64Bit()) {
           setOperationAction(ISD::ConstantPool  , MVT::i64  , Custom);
           setOperationAction(ISD::JumpTable     , MVT::i64  , Custom);
           setOperationAction(ISD::GlobalAddress , MVT::i64  , Custom);
      -    setOperationAction(ISD::ExternalSymbol, MVT::i64  , Custom);
      +    setOperationAction(ISD::Symbol        , MVT::i64  , Custom);
         }
         // 64-bit addm sub, shl, sra, srl (iff 32-bit x86)
         setOperationAction(ISD::SHL_PARTS       , MVT::i32  , Custom);
      @@ -892,7 +892,7 @@
           assert(((TargetAddress.getOpcode() == ISD::Register &&
                      (cast(TargetAddress)->getReg() == X86::ECX ||
                       cast(TargetAddress)->getReg() == X86::R9)) ||
      -              TargetAddress.getOpcode() == ISD::TargetExternalSymbol ||
      +              TargetAddress.getOpcode() == ISD::TargetSymbol ||
                     TargetAddress.getOpcode() == ISD::TargetGlobalAddress) && 
                    "Expecting an global address, external symbol, or register");
           assert(StackAdjustment.getOpcode() == ISD::Constant &&
      @@ -1608,8 +1608,8 @@
           if (G &&  !G->getGlobal()->hasHiddenVisibility() &&
               !G->getGlobal()->hasProtectedVisibility())
             Callee =  LowerGlobalAddress(Callee, DAG);
      -    else if (isa(Callee))
      -      Callee = LowerExternalSymbol(Callee,DAG);
      +    else if (isa(Callee))
      +      Callee = LowerExternalSymbol(Callee, DAG);
         }
       
         if (Is64Bit && isVarArg) {
      @@ -1697,8 +1697,9 @@
           if (!Subtarget->GVRequiresExtraLoad(G->getGlobal(),
                                               getTargetMachine(), true))
             Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy());
      -  } else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) {
      -    Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy());
      +  } else if (SymbolSDNode *S = dyn_cast(Callee)) {
      +    Callee = DAG.getTargetSymbol(S->getSymbol(), getPointerTy(),
      +                                 S->getLinkage());
         } else if (IsTailCall) {
           unsigned Opc = Is64Bit ? X86::R9 : X86::ECX;
       
      @@ -4286,12 +4287,11 @@
                            DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, AnyExt));
       }
       
      -// ConstantPool, JumpTable, GlobalAddress, and ExternalSymbol are lowered as
      -// their target countpart wrapped in the X86ISD::Wrapper node. Suppose N is
      -// one of the above mentioned nodes. It has to be wrapped because otherwise
      -// Select(N) returns N. So the raw TargetGlobalAddress nodes, etc. can only
      -// be used to form addressing mode. These wrapped nodes will be selected
      -// into MOV32ri.
      +// ConstantPool, JumpTable, GlobalAddress, and Symbol are lowered as their
      +// target countpart wrapped in the X86ISD::Wrapper node. Suppose N is one of the
      +// above mentioned nodes. It has to be wrapped because otherwise Select(N)
      +// returns N. So the raw TargetGlobalAddress nodes, etc. can only be used to
      +// form addressing mode. These wrapped nodes will be selected into MOV32ri.
       SDValue
       X86TargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) {
         ConstantPoolSDNode *CP = cast(Op);
      @@ -4362,8 +4362,7 @@
       
         NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
         SDValue Ops1[] = { Chain,
      -                      DAG.getTargetExternalSymbol("___tls_get_addr",
      -                                                  PtrVT),
      +                      DAG.getTargetSymbol("___tls_get_addr", PtrVT),
                             DAG.getRegister(X86::EAX, PtrVT),
                             DAG.getRegister(X86::EBX, PtrVT),
                             InFlag };
      @@ -4396,8 +4395,7 @@
       
         NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
         SDValue Ops1[] = { Chain,
      -                      DAG.getTargetExternalSymbol("__tls_get_addr",
      -                                                  PtrVT),
      +                      DAG.getTargetSymbol("__tls_get_addr", PtrVT),
                             DAG.getRegister(X86::RDI, PtrVT),
                             InFlag };
         Chain = DAG.getNode(X86ISD::CALL, NodeTys, Ops1, 4);
      @@ -4449,8 +4447,9 @@
       
       SDValue
       X86TargetLowering::LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) {
      -  const char *Sym = cast(Op)->getSymbol();
      -  SDValue Result = DAG.getTargetExternalSymbol(Sym, getPointerTy());
      +  SymbolSDNode *Sym = cast(Op);
      +  SDValue Result = DAG.getTargetSymbol(Sym->getSymbol(), getPointerTy(),
      +                                       Sym->getLinkage());
         Result = DAG.getNode(X86ISD::Wrapper, getPointerTy(), Result);
         // With PIC, the address is actually $g + Offset.
         if (getTargetMachine().getRelocationModel() == Reloc::PIC_ &&
      @@ -5054,7 +5053,7 @@
       
         SDVTList  NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
         SDValue Ops[] = { Chain,
      -                      DAG.getTargetExternalSymbol("_alloca", IntPtr),
      +                      DAG.getTargetSymbol("_alloca", IntPtr),
                             DAG.getRegister(X86::EAX, IntPtr),
                             DAG.getRegister(X86StackPtr, SPTy),
                             Flag };
      @@ -5104,7 +5103,7 @@
             Args.push_back(Entry);
             std::pair CallResult =
               LowerCallTo(Chain, Type::VoidTy, false, false, false, CallingConv::C,
      -                    false, DAG.getExternalSymbol(bzeroEntry, IntPtr),
      +                    false, DAG.getSymbol(bzeroEntry, IntPtr),
                           Args, DAG);
             return CallResult.second;
           }
      @@ -5977,7 +5976,7 @@
         case ISD::ConstantPool:       return LowerConstantPool(Op, DAG);
         case ISD::GlobalAddress:      return LowerGlobalAddress(Op, DAG);
         case ISD::GlobalTLSAddress:   return LowerGlobalTLSAddress(Op, DAG);
      -  case ISD::ExternalSymbol:     return LowerExternalSymbol(Op, DAG);
      +  case ISD::Symbol:             return LowerExternalSymbol(Op, DAG);
         case ISD::SHL_PARTS:
         case ISD::SRA_PARTS:
         case ISD::SRL_PARTS:          return LowerShift(Op, DAG);
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Sep 16 16:12:30 2008
      @@ -145,8 +145,8 @@
             /// at function entry, used for PIC code.
             GlobalBaseReg,
       
      -      /// Wrapper - A wrapper node for TargetConstantPool,
      -      /// TargetExternalSymbol, and TargetGlobalAddress.
      +      /// Wrapper - A wrapper node for TargetConstantPool, TargetSymbol, and
      +      /// TargetGlobalAddress.
             Wrapper,
       
             /// WrapperRIP - Special wrapper used under X86-64 PIC mode for RIP
      
      Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original)
      +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Sep 16 16:12:30 2008
      @@ -1192,7 +1192,7 @@
       // Non-Instruction Patterns
       //===----------------------------------------------------------------------===//
       
      -// ConstantPool GlobalAddress, ExternalSymbol, and JumpTable
      +// ConstantPool GlobalAddress, Symbol, and JumpTable
       def : Pat<(i64 (X86Wrapper tconstpool  :$dst)),
                 (MOV64ri tconstpool  :$dst)>, Requires<[NotSmallCode]>;
       def : Pat<(i64 (X86Wrapper tjumptable  :$dst)),
      
      Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
      +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 16 16:12:30 2008
      @@ -2703,7 +2703,7 @@
       // Non-Instruction Patterns
       //===----------------------------------------------------------------------===//
       
      -// ConstantPool GlobalAddress, ExternalSymbol, and JumpTable
      +// ConstantPool GlobalAddress, Symbol, and JumpTable
       def : Pat<(i32 (X86Wrapper tconstpool  :$dst)), (MOV32ri tconstpool  :$dst)>;
       def : Pat<(i32 (X86Wrapper tjumptable  :$dst)), (MOV32ri tjumptable  :$dst)>;
       def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)),(MOV32ri tglobaltlsaddr:$dst)>;
      
      Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=56249&r1=56248&r2=56249&view=diff
      
      ==============================================================================
      --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original)
      +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Tue Sep 16 16:12:30 2008
      @@ -802,11 +802,11 @@
               NodeOps.push_back(Val);
             } else if (!N->isLeaf() && N->getOperator()->getName() == "texternalsym"){
               Record *Op = OperatorMap[N->getName()];
      -        // Transform ExternalSymbol to TargetExternalSymbol
      +        // Transform Symbol to TargetSymbol
               if (Op && Op->getName() == "externalsym") {
                 std::string TmpVar = "Tmp"+utostr(ResNo);
                 emitCode("SDValue " + TmpVar + " = CurDAG->getTarget"
      -                   "ExternalSymbol(cast(" +
      +                   "Symbol(cast(" +
                          Val + ")->getSymbol(), " +
                          getEnumName(N->getTypeNum(0)) + ");");
                 // Add Tmp to VariableMap, so that we don't multiply select
      @@ -1949,7 +1949,7 @@
            << "  case ISD::TargetConstantFP:\n"
            << "  case ISD::TargetConstantPool:\n"
            << "  case ISD::TargetFrameIndex:\n"
      -     << "  case ISD::TargetExternalSymbol:\n"
      +     << "  case ISD::TargetSymbol:\n"
            << "  case ISD::TargetJumpTable:\n"
            << "  case ISD::TargetGlobalTLSAddress:\n"
            << "  case ISD::TargetGlobalAddress: {\n"
      
      
      
      
      From gohman at apple.com  Tue Sep 16 16:18:22 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Tue, 16 Sep 2008 21:18:22 -0000
      Subject: [llvm-commits] [llvm] r56250 -
      	/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
      Message-ID: <200809162118.m8GLIMRJ012202@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Tue Sep 16 16:18:22 2008
      New Revision: 56250
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56250&view=rev
      Log:
      Include the alignment value when displaying ConstantPoolSDNodes.
      
      Modified:
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=56250&r1=56249&r2=56250&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Tue Sep 16 16:18:22 2008
      @@ -158,6 +158,7 @@
               Op += '>';
             }
           }
      +    Op += " A=" + itostr(1 << CP->getAlignment());
         } else if (const BasicBlockSDNode *BBDN = dyn_cast(Node)) {
           Op = "BB: ";
           const Value *LBB = (const Value*)BBDN->getBasicBlock()->getBasicBlock();
      
      
      
      
      From isanbard at gmail.com  Tue Sep 16 16:48:13 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Tue, 16 Sep 2008 21:48:13 -0000
      Subject: [llvm-commits] [llvm] r56251 - in /llvm/trunk:
       include/llvm/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/ lib/Target/ARM/
       lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/Mips/
       lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ utils/TableGen/
      Message-ID: <200809162148.m8GLmEOu013157@zion.cs.uiuc.edu>
      
      Author: void
      Date: Tue Sep 16 16:48:12 2008
      New Revision: 56251
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56251&view=rev
      Log:
      Reverting r56249. On further investigation, this functionality isn't needed.
      
      Apologies for the thrashing.
      
      Modified:
          llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
          llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
          llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
          llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
          llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
          llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp
          llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
          llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp
          llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp
          llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
          llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
          llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp
          llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
          llvm/trunk/lib/Target/TargetSelectionDAG.td
          llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
          llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
          llvm/trunk/lib/Target/X86/X86ISelLowering.h
          llvm/trunk/lib/Target/X86/X86Instr64bit.td
          llvm/trunk/lib/Target/X86/X86InstrInfo.td
          llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
      
      Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Tue Sep 16 16:48:12 2008
      @@ -278,7 +278,7 @@
             if (isa(Node))     return true;
             if (isa(Node))   return true;
             if (isa(Node))      return true;
      -      if (isa(Node))         return true;
      +      if (isa(Node)) return true;
             if (isa(Node))     return true;
             if (Node->getOpcode() == ISD::EntryToken) return true;
             return false;
      
      Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Tue Sep 16 16:48:12 2008
      @@ -282,11 +282,8 @@
           return getConstantPool(C, VT, Align, Offset, true);
         }
         SDValue getBasicBlock(MachineBasicBlock *MBB);
      -  SDValue getSymbol(const char *Sym, MVT VT,
      -                   GlobalValue::LinkageTypes LT = GlobalValue::ExternalLinkage);
      -  SDValue getTargetSymbol(const char *Sym, MVT VT,
      -                          GlobalValue::LinkageTypes LT =
      -                            GlobalValue::ExternalLinkage);
      +  SDValue getExternalSymbol(const char *Sym, MVT VT);
      +  SDValue getTargetExternalSymbol(const char *Sym, MVT VT);
         SDValue getArgFlags(ISD::ArgFlagsTy Flags);
         SDValue getValueType(MVT);
         SDValue getRegister(unsigned Reg, MVT VT);
      @@ -761,8 +758,8 @@
       
         std::vector ValueTypeNodes;
         std::map ExtendedValueTypeNodes;
      -  StringMap Symbols;
      -  StringMap TargetSymbols;
      +  StringMap ExternalSymbols;
      +  StringMap TargetExternalSymbols;
       };
       
       template <> struct GraphTraits : public GraphTraits {
      
      Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Tue Sep 16 16:48:12 2008
      @@ -21,7 +21,6 @@
       
       #include "llvm/Value.h"
       #include "llvm/Constants.h"
      -#include "llvm/GlobalValue.h"
       #include "llvm/ADT/FoldingSet.h"
       #include "llvm/ADT/GraphTraits.h"
       #include "llvm/ADT/iterator.h"
      @@ -90,7 +89,7 @@
           BasicBlock, VALUETYPE, ARG_FLAGS, CONDCODE, Register,
           Constant, ConstantFP,
           GlobalAddress, GlobalTLSAddress, FrameIndex,
      -    JumpTable, ConstantPool, Symbol,
      +    JumpTable, ConstantPool, ExternalSymbol,
       
           // The address of the GOT
           GLOBAL_OFFSET_TABLE,
      @@ -134,7 +133,7 @@
           TargetFrameIndex,
           TargetJumpTable,
           TargetConstantPool,
      -    TargetSymbol,
      +    TargetExternalSymbol,
           
           /// RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...)
           /// This node represents a target intrinsic function with no side effects.
      @@ -488,7 +487,7 @@
           // INLINEASM - Represents an inline asm block.  This node always has two
           // return values: a chain and a flag result.  The inputs are as follows:
           //   Operand #0   : Input chain.
      -    //   Operand #1   : A SymbolSDNode with a pointer to the asm string.
      +    //   Operand #1   : a ExternalSymbolSDNode with a pointer to the asm string.
           //   Operand #2n+2: A RegisterNode.
           //   Operand #2n+3: A TargetConstant, indicating if the reg is a use/def
           //   Operand #last: Optional, an incoming flag.
      @@ -2046,24 +2045,23 @@
         }
       };
       
      -class SymbolSDNode : public SDNode {
      +class ExternalSymbolSDNode : public SDNode {
         const char *Symbol;
      -  GlobalValue::LinkageTypes Linkage;
         virtual void ANCHOR();  // Out-of-line virtual method to give class a home.
       protected:
         friend class SelectionDAG;
      -  SymbolSDNode(bool isTarget, const char *Sym, MVT VT,
      -               GlobalValue::LinkageTypes L)
      -    : SDNode(isTarget ? ISD::TargetSymbol : ISD::Symbol,
      -             getSDVTList(VT)), Symbol(Sym), Linkage(L) {}
      +  ExternalSymbolSDNode(bool isTarget, const char *Sym, MVT VT)
      +    : SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol,
      +             getSDVTList(VT)), Symbol(Sym) {
      +  }
       public:
      +
         const char *getSymbol() const { return Symbol; }
      -  GlobalValue::LinkageTypes getLinkage() const { return Linkage; }
       
      -  static bool classof(const SymbolSDNode *) { return true; }
      +  static bool classof(const ExternalSymbolSDNode *) { return true; }
         static bool classof(const SDNode *N) {
      -    return N->getOpcode() == ISD::Symbol ||
      -           N->getOpcode() == ISD::TargetSymbol;
      +    return N->getOpcode() == ISD::ExternalSymbol ||
      +           N->getOpcode() == ISD::TargetExternalSymbol;
         }
       };
       
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Sep 16 16:48:12 2008
      @@ -799,7 +799,7 @@
         case ISD::TargetConstantPool:
         case ISD::TargetGlobalAddress:
         case ISD::TargetGlobalTLSAddress:
      -  case ISD::TargetSymbol:
      +  case ISD::TargetExternalSymbol:
         case ISD::VALUETYPE:
         case ISD::SRCVALUE:
         case ISD::MEMOPERAND:
      @@ -832,7 +832,7 @@
         case ISD::GLOBAL_OFFSET_TABLE:
         case ISD::GlobalAddress:
         case ISD::GlobalTLSAddress:
      -  case ISD::Symbol:
      +  case ISD::ExternalSymbol:
         case ISD::ConstantPool:
         case ISD::JumpTable: // Nothing to do.
           switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) {
      @@ -3979,7 +3979,7 @@
             std::pair CallResult =
               TLI.LowerCallTo(Tmp1, Type::VoidTy,
                               false, false, false, CallingConv::C, false,
      -                        DAG.getSymbol("abort", TLI.getPointerTy()),
      +                        DAG.getExternalSymbol("abort", TLI.getPointerTy()),
                               Args, DAG);
             Result = CallResult.second;
             break;
      @@ -5293,9 +5293,8 @@
           Entry.isZExt = !isSigned;
           Args.push_back(Entry);
         }
      -
      -  SDValue Callee = DAG.getSymbol(TLI.getLibcallName(LC),
      -                                 TLI.getPointerTy());
      +  SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
      +                                           TLI.getPointerTy());
       
         // Splice the libcall in wherever FindInputOutputChains tells us to.
         const Type *RetTy = Node->getValueType(0).getTypeForMVT();
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Tue Sep 16 16:48:12 2008
      @@ -623,8 +623,8 @@
           Entry.isZExt = !isSigned;
           Args.push_back(Entry);
         }
      -
      -  SDValue Callee = DAG.getSymbol(TLI.getLibcallName(LC), TLI.getPointerTy());
      +  SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
      +                                           TLI.getPointerTy());
       
         const Type *RetTy = RetVT.getTypeForMVT();
         std::pair CallInfo =
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp Tue Sep 16 16:48:12 2008
      @@ -288,7 +288,7 @@
           else
             Idx = ConstPool->getConstantPoolIndex(CP->getConstVal(), Align);
           MI->addOperand(MachineOperand::CreateCPI(Idx, Offset));
      -  } else if (SymbolSDNode *ES = dyn_cast(Op)) {
      +  } else if (ExternalSymbolSDNode *ES = dyn_cast(Op)) {
           MI->addOperand(MachineOperand::CreateES(ES->getSymbol()));
         } else {
           assert(Op.getValueType() != MVT::Other &&
      @@ -571,7 +571,8 @@
           MachineInstr *MI = BuildMI(*MF, TII->get(TargetInstrInfo::INLINEASM));
       
           // Add the asm string as an external symbol operand.
      -    const char *AsmStr = cast(Node->getOperand(1))->getSymbol();
      +    const char *AsmStr =
      +      cast(Node->getOperand(1))->getSymbol();
           MI->addOperand(MachineOperand::CreateES(AsmStr));
             
           // Add all of the operand registers to the instruction.
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 16 16:48:12 2008
      @@ -614,11 +614,12 @@
           Erased = CondCodeNodes[cast(N)->get()] != 0;
           CondCodeNodes[cast(N)->get()] = 0;
           break;
      -  case ISD::Symbol:
      -    Erased = Symbols.erase(cast(N)->getSymbol());
      +  case ISD::ExternalSymbol:
      +    Erased = ExternalSymbols.erase(cast(N)->getSymbol());
           break;
      -  case ISD::TargetSymbol:
      -    Erased = TargetSymbols.erase(cast(N)->getSymbol());
      +  case ISD::TargetExternalSymbol:
      +    Erased =
      +      TargetExternalSymbols.erase(cast(N)->getSymbol());
           break;
         case ISD::VALUETYPE: {
           MVT VT = cast(N)->getVT();
      @@ -841,8 +842,8 @@
         CSEMap.clear();
       
         ExtendedValueTypeNodes.clear();
      -  Symbols.clear();
      -  TargetSymbols.clear();
      +  ExternalSymbols.clear();
      +  TargetExternalSymbols.clear();
         std::fill(CondCodeNodes.begin(), CondCodeNodes.end(),
                   static_cast(0));
         std::fill(ValueTypeNodes.begin(), ValueTypeNodes.end(),
      @@ -1097,22 +1098,20 @@
         return SDValue(N, 0);
       }
       
      -SDValue SelectionDAG::getSymbol(const char *Sym, MVT VT,
      -                                GlobalValue::LinkageTypes LT) {
      -  SDNode *&N = Symbols[Sym];
      +SDValue SelectionDAG::getExternalSymbol(const char *Sym, MVT VT) {
      +  SDNode *&N = ExternalSymbols[Sym];
         if (N) return SDValue(N, 0);
      -  N = NodeAllocator.Allocate();
      -  new (N) SymbolSDNode(false, Sym, VT, LT);
      +  N = NodeAllocator.Allocate();
      +  new (N) ExternalSymbolSDNode(false, Sym, VT);
         AllNodes.push_back(N);
         return SDValue(N, 0);
       }
       
      -SDValue SelectionDAG::getTargetSymbol(const char *Sym, MVT VT,
      -                                      GlobalValue::LinkageTypes LT) {
      -  SDNode *&N = TargetSymbols[Sym];
      +SDValue SelectionDAG::getTargetExternalSymbol(const char *Sym, MVT VT) {
      +  SDNode *&N = TargetExternalSymbols[Sym];
         if (N) return SDValue(N, 0);
      -  N = NodeAllocator.Allocate();
      -  new (N) SymbolSDNode(true, Sym, VT, LT);
      +  N = NodeAllocator.Allocate();
      +  new (N) ExternalSymbolSDNode(true, Sym, VT);
         AllNodes.push_back(N);
         return SDValue(N, 0);
       }
      @@ -3099,7 +3098,7 @@
         std::pair CallResult =
           TLI.LowerCallTo(Chain, Type::VoidTy,
                           false, false, false, CallingConv::C, false,
      -                    getSymbol("memcpy", TLI.getPointerTy()),
      +                    getExternalSymbol("memcpy", TLI.getPointerTy()),
                           Args, *this);
         return CallResult.second;
       }
      @@ -3144,7 +3143,7 @@
         std::pair CallResult =
           TLI.LowerCallTo(Chain, Type::VoidTy,
                           false, false, false, CallingConv::C, false,
      -                    getSymbol("memmove", TLI.getPointerTy()),
      +                    getExternalSymbol("memmove", TLI.getPointerTy()),
                           Args, *this);
         return CallResult.second;
       }
      @@ -3195,7 +3194,7 @@
         std::pair CallResult =
           TLI.LowerCallTo(Chain, Type::VoidTy,
                           false, false, false, CallingConv::C, false,
      -                    getSymbol("memset", TLI.getPointerTy()),
      +                    getExternalSymbol("memset", TLI.getPointerTy()),
                           Args, *this);
         return CallResult.second;
       }
      @@ -4611,7 +4610,7 @@
       void RegisterSDNode::ANCHOR() {}
       void DbgStopPointSDNode::ANCHOR() {}
       void LabelSDNode::ANCHOR() {}
      -void SymbolSDNode::ANCHOR() {}
      +void ExternalSymbolSDNode::ANCHOR() {}
       void CondCodeSDNode::ANCHOR() {}
       void ARG_FLAGSSDNode::ANCHOR() {}
       void VTSDNode::ANCHOR() {}
      @@ -4915,14 +4914,14 @@
         case ISD::FrameIndex:    return "FrameIndex";
         case ISD::JumpTable:     return "JumpTable";
         case ISD::GLOBAL_OFFSET_TABLE: return "GLOBAL_OFFSET_TABLE";
      -  case ISD::RETURNADDR:    return "RETURNADDR";
      -  case ISD::FRAMEADDR:     return "FRAMEADDR";
      +  case ISD::RETURNADDR: return "RETURNADDR";
      +  case ISD::FRAMEADDR: return "FRAMEADDR";
         case ISD::FRAME_TO_ARGS_OFFSET: return "FRAME_TO_ARGS_OFFSET";
         case ISD::EXCEPTIONADDR: return "EXCEPTIONADDR";
      -  case ISD::EHSELECTION:   return "EHSELECTION";
      -  case ISD::EH_RETURN:     return "EH_RETURN";
      +  case ISD::EHSELECTION: return "EHSELECTION";
      +  case ISD::EH_RETURN: return "EH_RETURN";
         case ISD::ConstantPool:  return "ConstantPool";
      -  case ISD::Symbol:        return "Symbol";
      +  case ISD::ExternalSymbol: return "ExternalSymbol";
         case ISD::INTRINSIC_WO_CHAIN: {
           unsigned IID = cast(getOperand(0))->getZExtValue();
           return Intrinsic::getName((Intrinsic::ID)IID);
      @@ -4941,7 +4940,7 @@
         case ISD::TargetFrameIndex: return "TargetFrameIndex";
         case ISD::TargetJumpTable:  return "TargetJumpTable";
         case ISD::TargetConstantPool:  return "TargetConstantPool";
      -  case ISD::TargetSymbol:  return "TargetSymbol";
      +  case ISD::TargetExternalSymbol: return "TargetExternalSymbol";
       
         case ISD::CopyToReg:     return "CopyToReg";
         case ISD::CopyFromReg:   return "CopyFromReg";
      @@ -5231,23 +5230,9 @@
           } else {
             OS << " #" << R->getReg();
           }
      -  } else if (const SymbolSDNode *S =
      -             dyn_cast(this)) {
      -    OS << "'" << S->getSymbol() << "' ";
      -
      -    switch (S->getLinkage()) {
      -    default: assert(0 && "Invalid linkage type!"); break;
      -    case GlobalValue::ExternalLinkage:       OS << "[external]"; break;
      -    case GlobalValue::LinkOnceLinkage:       OS << "[once]"; break;
      -    case GlobalValue::WeakLinkage:           OS << "[weak]"; break;
      -    case GlobalValue::AppendingLinkage:      OS << "[appending]"; break;
      -    case GlobalValue::InternalLinkage:       OS << "[internal]"; break;
      -    case GlobalValue::DLLImportLinkage:      OS << "[dllimport]"; break;
      -    case GlobalValue::DLLExportLinkage:      OS << "[dllexport]"; break;
      -    case GlobalValue::ExternalWeakLinkage:   OS << "[externweak]"; break;
      -    case GlobalValue::GhostLinkage:          OS << "[ghost]"; break;
      -    case GlobalValue::CommonLinkage:         OS << "[common]"; break;
      -    }
      +  } else if (const ExternalSymbolSDNode *ES =
      +             dyn_cast(this)) {
      +    OS << "'" << ES->getSymbol() << "'";
         } else if (const SrcValueSDNode *M = dyn_cast(this)) {
           if (M->getValue())
             OS << "<" << M->getValue() << ">";
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Tue Sep 16 16:48:12 2008
      @@ -4293,7 +4293,7 @@
         if (!RenameFn)
           Callee = getValue(I.getOperand(0));
         else
      -    Callee = DAG.getSymbol(RenameFn, TLI.getPointerTy());
      +    Callee = DAG.getExternalSymbol(RenameFn, TLI.getPointerTy());
       
         LowerCallTo(&I, Callee, I.isTailCall());
       }
      @@ -4888,7 +4888,7 @@
         std::vector AsmNodeOperands;
         AsmNodeOperands.push_back(SDValue());  // reserve space for input chain
         AsmNodeOperands.push_back(
      -          DAG.getTargetSymbol(IA->getAsmString().c_str(), MVT::Other));
      +          DAG.getTargetExternalSymbol(IA->getAsmString().c_str(), MVT::Other));
         
         
         // Loop over all of the inputs, copying the operand values into the
      @@ -5139,7 +5139,7 @@
       
         std::pair Result =
           TLI.LowerCallTo(getRoot(), I.getType(), false, false, false, CallingConv::C,
      -                    PerformTailCallOpt, DAG.getSymbol("malloc", IntPtr),
      +                    PerformTailCallOpt, DAG.getExternalSymbol("malloc", IntPtr),
                           Args, DAG);
         setValue(&I, Result.first);  // Pointers always fit in registers
         DAG.setRoot(Result.second);
      @@ -5155,7 +5155,7 @@
         std::pair Result =
           TLI.LowerCallTo(getRoot(), Type::VoidTy, false, false, false,
                           CallingConv::C, PerformTailCallOpt,
      -                    DAG.getSymbol("free", IntPtr), Args, DAG);
      +                    DAG.getExternalSymbol("free", IntPtr), Args, DAG);
         DAG.setRoot(Result.second);
       }
       
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Tue Sep 16 16:48:12 2008
      @@ -186,8 +186,9 @@
             Op += ", isVarArg";
           if (C->isTailCall())
             Op += ", isTailCall";
      -  } else if (const SymbolSDNode *S = dyn_cast(Node)) {
      -    Op += "'" + std::string(S->getSymbol()) + "'";
      +  } else if (const ExternalSymbolSDNode *ES =
      +             dyn_cast(Node)) {
      +    Op += "'" + std::string(ES->getSymbol()) + "'";
         } else if (const SrcValueSDNode *M = dyn_cast(Node)) {
           if (M->getValue())
             Op += "<" + M->getValue()->getName() + ">";
      
      Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Sep 16 16:48:12 2008
      @@ -531,9 +531,9 @@
           InFlag = Chain.getValue(1);
         }
       
      -  // If the callee is a GlobalAddress/Symbol node (quite common, every direct
      -  // call is) turn it into a TargetGlobalAddress/TargetSymbol node so that
      -  // legalize doesn't hack it.
      +  // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
      +  // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
      +  // node so that legalize doesn't hack it.
         bool isDirect = false;
         bool isARMFunc = false;
         bool isLocalARMFunc = false;
      @@ -558,7 +558,7 @@
             Callee = DAG.getNode(ARMISD::PIC_ADD, getPointerTy(), Callee, PICLabel);
          } else
             Callee = DAG.getTargetGlobalAddress(GV, getPointerTy());
      -  } else if (SymbolSDNode *S = dyn_cast(Callee)) {
      +  } else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) {
           isDirect = true;
           bool isStub = Subtarget->isTargetDarwin() &&
                         getTargetMachine().getRelocationModel() != Reloc::Static;
      @@ -574,7 +574,7 @@
             SDValue PICLabel = DAG.getConstant(ARMPCLabelIndex++, MVT::i32);
             Callee = DAG.getNode(ARMISD::PIC_ADD, getPointerTy(), Callee, PICLabel);
           } else
      -      Callee = DAG.getTargetSymbol(Sym, getPointerTy(), S->getLinkage());
      +      Callee = DAG.getTargetExternalSymbol(Sym, getPointerTy());
         }
       
         // FIXME: handle tail calls differently.
      @@ -715,11 +715,12 @@
         return DAG.getNode(ARMISD::RET_FLAG, MVT::Other, Copy, Copy.getValue(1));
       }
       
      -// ConstantPool, JumpTable, GlobalAddress, and Symbol are lowered as their
      -// target countpart wrapped in the ARMISD::Wrapper node. Suppose N is one of the
      -// above mentioned nodes. It has to be wrapped because otherwise Select(N)
      -// returns N. So the raw TargetGlobalAddress nodes, etc. can only be used to
      -// form addressing mode. These wrapped nodes will be selected into MOVi.
      +// ConstantPool, JumpTable, GlobalAddress, and ExternalSymbol are lowered as 
      +// their target countpart wrapped in the ARMISD::Wrapper node. Suppose N is
      +// one of the above mentioned nodes. It has to be wrapped because otherwise
      +// Select(N) returns N. So the raw TargetGlobalAddress nodes, etc. can only
      +// be used to form addressing mode. These wrapped nodes will be selected
      +// into MOVi.
       static SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) {
         MVT PtrVT = Op.getValueType();
         ConstantPoolSDNode *CP = cast(Op);
      @@ -759,7 +760,7 @@
         std::pair CallResult =
           LowerCallTo(Chain, (const Type *) Type::Int32Ty, false, false, false,
                       CallingConv::C, false,
      -                DAG.getSymbol("__tls_get_addr", PtrVT), Args, DAG);
      +                DAG.getExternalSymbol("__tls_get_addr", PtrVT), Args, DAG);
         return CallResult.first;
       }
       
      
      Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Tue Sep 16 16:48:12 2008
      @@ -125,11 +125,12 @@
         setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);
         setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Expand);
       
      -  // We want to legalize GlobalAddress and ConstantPool and Symbols nodes into
      -  // the appropriate instructions to materialize the address.
      +  // We want to legalize GlobalAddress and ConstantPool and
      +  // ExternalSymbols nodes into the appropriate instructions to
      +  // materialize the address.
         setOperationAction(ISD::GlobalAddress,  MVT::i64, Custom);
         setOperationAction(ISD::ConstantPool,   MVT::i64, Custom);
      -  setOperationAction(ISD::Symbol, MVT::i64, Custom);
      +  setOperationAction(ISD::ExternalSymbol, MVT::i64, Custom);
         setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom);
       
         setOperationAction(ISD::VASTART, MVT::Other, Custom);
      @@ -490,13 +491,13 @@
             return DAG.getNode(AlphaISD::RelLit, MVT::i64, GA, 
                                DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, MVT::i64));
         }
      -  case ISD::Symbol: {
      -    SymbolSDNode *S = cast(Op);
      +  case ISD::ExternalSymbol: {
           return DAG.getNode(AlphaISD::RelLit, MVT::i64, 
      -                       DAG.getTargetSymbol(S->getSymbol(), MVT::i64,
      -                                           S->getLinkage()),
      +                       DAG.getTargetExternalSymbol(cast(Op)
      +                                                   ->getSymbol(), MVT::i64),
                              DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, MVT::i64));
         }
      +
         case ISD::UREM:
         case ISD::SREM:
           //Expand only on constant case
      @@ -525,7 +526,7 @@
             }
             SDValue Tmp1 = Op.getOperand(0),
               Tmp2 = Op.getOperand(1),
      -        Addr = DAG.getSymbol(opstr, MVT::i64);
      +        Addr = DAG.getExternalSymbol(opstr, MVT::i64);
             return DAG.getNode(AlphaISD::DivCall, MVT::i64, Addr, Tmp1, Tmp2);
           }
           break;
      
      Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Tue Sep 16 16:48:12 2008
      @@ -92,12 +92,12 @@
                   || Opc == ISD::GlobalTLSAddress
                   || Opc == ISD::JumpTable
                   || Opc == ISD::ConstantPool
      -            || Opc == ISD::Symbol
      +            || Opc == ISD::ExternalSymbol
                   || Opc == ISD::TargetGlobalAddress
                   || Opc == ISD::TargetGlobalTLSAddress
                   || Opc == ISD::TargetJumpTable
                   || Opc == ISD::TargetConstantPool
      -            || Opc == ISD::TargetSymbol
      +            || Opc == ISD::TargetExternalSymbol
                   || Opc == SPUISD::AFormAddr);
         }
       
      @@ -1201,9 +1201,9 @@
         SmallVector Ops;
         unsigned CallOpc = SPUISD::CALL;
       
      -  // If the callee is a GlobalAddress/Symbol node (quite common, every direct
      -  // call is) turn it into a TargetGlobalAddress/TargetSymbol node so that
      -  // legalize doesn't hack it.
      +  // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
      +  // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
      +  // node so that legalize doesn't hack it.
         if (GlobalAddressSDNode *G = dyn_cast(Callee)) {
           GlobalValue *GV = G->getGlobal();
           MVT CalleeVT = Callee.getValueType();
      @@ -1229,9 +1229,8 @@
             // address pairs:
             Callee = DAG.getNode(SPUISD::IndirectAddr, PtrVT, GA, Zero);
           }
      -  } else if (SymbolSDNode *S = dyn_cast(Callee))
      -    Callee = DAG.getSymbol(S->getSymbol(), Callee.getValueType(),
      -                           S->getLinkage());
      +  } else if (ExternalSymbolSDNode *S = dyn_cast(Callee))
      +    Callee = DAG.getExternalSymbol(S->getSymbol(), Callee.getValueType());
         else if (SDNode *Dest = isLSAAddress(Callee, DAG)) {
           // If this is an absolute destination address that appears to be a legal
           // local store address, use the munged value.
      
      Modified: llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp (original)
      +++ llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp Tue Sep 16 16:48:12 2008
      @@ -329,7 +329,7 @@
             dyn_cast(N->getOperand(1))) {
             CallOpcode = IA64::BRCALL_IPREL_GA;
             CallOperand = CurDAG->getTargetGlobalAddress(GASD->getGlobal(), MVT::i64);
      -    } else if (isa(N->getOperand(1))) {
      +    } else if (isa(N->getOperand(1))) {
             // FIXME: we currently NEED this case for correctness, to avoid
             // "non-pic code with imm reloc.n against dynamic symbol" errors
           CallOpcode = IA64::BRCALL_IPREL_ES;
      @@ -448,9 +448,9 @@
         }
         
       /* XXX
      -   case ISD::Symbol: {
      -     SDValue EA = CurDAG->getTargetSymbol(
      -       cast(N)->getSymbol(),
      +   case ISD::ExternalSymbol: {
      +     SDValue EA = CurDAG->getTargetExternalSymbol(
      +       cast(N)->getSymbol(),
              MVT::i64);
            SDValue Tmp = CurDAG->getTargetNode(IA64::ADDL_EA, MVT::i64, 
                                                  CurDAG->getRegister(IA64::r1,
      
      Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original)
      +++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Tue Sep 16 16:48:12 2008
      @@ -159,7 +159,7 @@
             return true;
           }
         } else {
      -    if ((Addr.getOpcode() == ISD::TargetSymbol ||
      +    if ((Addr.getOpcode() == ISD::TargetExternalSymbol ||
               Addr.getOpcode() == ISD::TargetGlobalAddress))
             return false;
         }    
      @@ -354,7 +354,7 @@
               SDValue InFlag(0, 0);
       
               if ( (isa(Callee)) ||
      -             (isa(Callee)) )
      +             (isa(Callee)) )
               {
                 /// Direct call for global addresses and external symbols
                 SDValue GPReg = CurDAG->getRegister(Mips::GP, MVT::i32);
      
      Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Tue Sep 16 16:48:12 2008
      @@ -684,14 +684,14 @@
           InFlag = Chain.getValue(1);
         }
       
      -  // If the callee is a GlobalAddress/Symbol node (quite common, every direct
      -  // call is) turn it into a TargetGlobalAddress/TargetSymbol node so that
      -  // legalize doesn't hack it.
      +  // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
      +  // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol 
      +  // node so that legalize doesn't hack it. 
         if (GlobalAddressSDNode *G = dyn_cast(Callee)) 
           Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy());
      -  else if (SymbolSDNode *S = dyn_cast(Callee))
      -    Callee = DAG.getTargetSymbol(S->getSymbol(), getPointerTy(),
      -                                 S->getLinkage());
      +  else if (ExternalSymbolSDNode *S = dyn_cast(Callee))
      +    Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy());
      +
       
         // MipsJmpLink = #chain, #target_address, #opt_in_flags...
         //             = Chain, Callee, Reg#1, Reg#2, ...  
      
      Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Tue Sep 16 16:48:12 2008
      @@ -2462,14 +2462,13 @@
         SmallVector Ops;
         unsigned CallOpc = isMachoABI? PPCISD::CALL_Macho : PPCISD::CALL_ELF;
         
      -  // If the callee is a GlobalAddress/Symbol node (quite common, every direct
      -  // call is) turn it into a TargetGlobalAddress/TargetSymbol node so that
      -  // legalize doesn't hack it.
      +  // If the callee is a GlobalAddress/ExternalSymbol node (quite common, every
      +  // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
      +  // node so that legalize doesn't hack it.
         if (GlobalAddressSDNode *G = dyn_cast(Callee))
           Callee = DAG.getTargetGlobalAddress(G->getGlobal(), Callee.getValueType());
      -  else if (SymbolSDNode *S = dyn_cast(Callee))
      -    Callee = DAG.getTargetSymbol(S->getSymbol(), Callee.getValueType(),
      -                                 S->getLinkage());
      +  else if (ExternalSymbolSDNode *S = dyn_cast(Callee))
      +    Callee = DAG.getTargetExternalSymbol(S->getSymbol(), Callee.getValueType());
         else if (SDNode *Dest = isBLACompatibleAddress(Callee, DAG))
           // If this is an absolute destination address, use the munged value.
           Callee = SDValue(Dest, 0);
      @@ -2594,7 +2593,7 @@
       
           assert(((TargetAddress.getOpcode() == ISD::Register &&
                    cast(TargetAddress)->getReg() == PPC::CTR) ||
      -            TargetAddress.getOpcode() == ISD::TargetSymbol ||
      +            TargetAddress.getOpcode() == ISD::TargetExternalSymbol ||
                   TargetAddress.getOpcode() == ISD::TargetGlobalAddress ||
                   isa(TargetAddress)) &&
           "Expecting an global address, external symbol, absolute value or register");
      @@ -3415,7 +3414,7 @@
       static SDValue GeneratePerfectShuffle(unsigned PFEntry, SDValue LHS,
                                               SDValue RHS, SelectionDAG &DAG) {
         unsigned OpNum = (PFEntry >> 26) & 0x0F;
      -  unsigned LHSID = (PFEntry >> 13) & ((1 << 13)-1);
      +  unsigned LHSID  = (PFEntry >> 13) & ((1 << 13)-1);
         unsigned RHSID = (PFEntry >>  0) & ((1 << 13)-1);
         
         enum {
      
      Modified: llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp (original)
      +++ llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp Tue Sep 16 16:48:12 2008
      @@ -77,7 +77,7 @@
           Offset = CurDAG->getTargetConstant(0, MVT::i32);
           return true;
         }
      -  if (Addr.getOpcode() == ISD::TargetSymbol ||
      +  if (Addr.getOpcode() == ISD::TargetExternalSymbol ||
             Addr.getOpcode() == ISD::TargetGlobalAddress)
           return false;  // direct calls.
         
      @@ -114,7 +114,7 @@
       bool SparcDAGToDAGISel::SelectADDRrr(SDValue Op, SDValue Addr,
                                            SDValue &R1,  SDValue &R2) {
         if (Addr.getOpcode() == ISD::FrameIndex) return false;
      -  if (Addr.getOpcode() == ISD::TargetSymbol ||
      +  if (Addr.getOpcode() == ISD::TargetExternalSymbol ||
             Addr.getOpcode() == ISD::TargetGlobalAddress)
           return false;  // direct calls.
         
      
      Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Tue Sep 16 16:48:12 2008
      @@ -407,11 +407,11 @@
       
         // If the callee is a GlobalAddress node (quite common, every direct call is)
         // turn it into a TargetGlobalAddress node so that legalize doesn't hack it.
      -  // Likewise Symbol -> TargetSymbol.
      +  // Likewise ExternalSymbol -> TargetExternalSymbol.
         if (GlobalAddressSDNode *G = dyn_cast(Callee))
           Callee = DAG.getTargetGlobalAddress(G->getGlobal(), MVT::i32);
      -  else if (SymbolSDNode *S = dyn_cast(Callee))
      -    Callee = DAG.getTargetSymbol(S->getSymbol(), MVT::i32, S->getLinkage());
      +  else if (ExternalSymbolSDNode *E = dyn_cast(Callee))
      +    Callee = DAG.getTargetExternalSymbol(E->getSymbol(), MVT::i32);
       
         std::vector NodeTys;
         NodeTys.push_back(MVT::Other);   // Returns a chain
      
      Modified: llvm/trunk/lib/Target/TargetSelectionDAG.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetSelectionDAG.td?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/TargetSelectionDAG.td (original)
      +++ llvm/trunk/lib/Target/TargetSelectionDAG.td Tue Sep 16 16:48:12 2008
      @@ -265,10 +265,10 @@
                                "FrameIndexSDNode">;
       def tframeindex : SDNode<"ISD::TargetFrameIndex",     SDTPtrLeaf, [],
                                "FrameIndexSDNode">;
      -def externalsym : SDNode<"ISD::Symbol",               SDTPtrLeaf, [],
      -                         "SymbolSDNode">;
      -def texternalsym: SDNode<"ISD::TargetSymbol",         SDTPtrLeaf, [],
      -                         "SymbolSDNode">;
      +def externalsym : SDNode<"ISD::ExternalSymbol",       SDTPtrLeaf, [],
      +                         "ExternalSymbolSDNode">;
      +def texternalsym: SDNode<"ISD::TargetExternalSymbol", SDTPtrLeaf, [],
      +                         "ExternalSymbolSDNode">;
       
       def add        : SDNode<"ISD::ADD"       , SDTIntBinOp   ,
                               [SDNPCommutative, SDNPAssociative]>;
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Sep 16 16:48:12 2008
      @@ -207,7 +207,7 @@
               Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i32,
                                                    AM.Align, AM.Disp);
             else if (AM.ES)
      -        Disp = CurDAG->getTargetSymbol(AM.ES, MVT::i32);
      +        Disp = CurDAG->getTargetExternalSymbol(AM.ES, MVT::i32);
             else if (AM.JT != -1)
               Disp = CurDAG->getTargetJumpTable(AM.JT, MVT::i32);
             else
      @@ -835,7 +835,7 @@
               AM.isRIPRel = TM.getRelocationModel() != Reloc::Static &&
                 Subtarget->isPICStyleRIPRel();
               return false;
      -      } else if (SymbolSDNode *S = dyn_cast(N0)) {
      +      } else if (ExternalSymbolSDNode *S =dyn_cast(N0)) {
               AM.ES = S->getSymbol();
               AM.isRIPRel = TM.getRelocationModel() != Reloc::Static &&
                 Subtarget->isPICStyleRIPRel();
      @@ -1292,7 +1292,7 @@
                 N1.getOpcode() == ISD::Constant) {
               unsigned Offset = (unsigned)cast(N1)->getZExtValue();
               SDValue C(0, 0);
      -        // TODO: handle SymbolSDNode.
      +        // TODO: handle ExternalSymbolSDNode.
               if (GlobalAddressSDNode *G =
                   dyn_cast(N0.getOperand(0))) {
                 C = CurDAG->getTargetGlobalAddress(G->getGlobal(), PtrVT,
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Sep 16 16:48:12 2008
      @@ -268,12 +268,12 @@
         setOperationAction(ISD::GlobalTLSAddress, MVT::i32  , Custom);
         if (Subtarget->is64Bit())
           setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom);
      -  setOperationAction(ISD::Symbol          , MVT::i32  , Custom);
      +  setOperationAction(ISD::ExternalSymbol  , MVT::i32  , Custom);
         if (Subtarget->is64Bit()) {
           setOperationAction(ISD::ConstantPool  , MVT::i64  , Custom);
           setOperationAction(ISD::JumpTable     , MVT::i64  , Custom);
           setOperationAction(ISD::GlobalAddress , MVT::i64  , Custom);
      -    setOperationAction(ISD::Symbol        , MVT::i64  , Custom);
      +    setOperationAction(ISD::ExternalSymbol, MVT::i64  , Custom);
         }
         // 64-bit addm sub, shl, sra, srl (iff 32-bit x86)
         setOperationAction(ISD::SHL_PARTS       , MVT::i32  , Custom);
      @@ -892,7 +892,7 @@
           assert(((TargetAddress.getOpcode() == ISD::Register &&
                      (cast(TargetAddress)->getReg() == X86::ECX ||
                       cast(TargetAddress)->getReg() == X86::R9)) ||
      -              TargetAddress.getOpcode() == ISD::TargetSymbol ||
      +              TargetAddress.getOpcode() == ISD::TargetExternalSymbol ||
                     TargetAddress.getOpcode() == ISD::TargetGlobalAddress) && 
                    "Expecting an global address, external symbol, or register");
           assert(StackAdjustment.getOpcode() == ISD::Constant &&
      @@ -1608,8 +1608,8 @@
           if (G &&  !G->getGlobal()->hasHiddenVisibility() &&
               !G->getGlobal()->hasProtectedVisibility())
             Callee =  LowerGlobalAddress(Callee, DAG);
      -    else if (isa(Callee))
      -      Callee = LowerExternalSymbol(Callee, DAG);
      +    else if (isa(Callee))
      +      Callee = LowerExternalSymbol(Callee,DAG);
         }
       
         if (Is64Bit && isVarArg) {
      @@ -1697,9 +1697,8 @@
           if (!Subtarget->GVRequiresExtraLoad(G->getGlobal(),
                                               getTargetMachine(), true))
             Callee = DAG.getTargetGlobalAddress(G->getGlobal(), getPointerTy());
      -  } else if (SymbolSDNode *S = dyn_cast(Callee)) {
      -    Callee = DAG.getTargetSymbol(S->getSymbol(), getPointerTy(),
      -                                 S->getLinkage());
      +  } else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) {
      +    Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy());
         } else if (IsTailCall) {
           unsigned Opc = Is64Bit ? X86::R9 : X86::ECX;
       
      @@ -4287,11 +4286,12 @@
                            DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, AnyExt));
       }
       
      -// ConstantPool, JumpTable, GlobalAddress, and Symbol are lowered as their
      -// target countpart wrapped in the X86ISD::Wrapper node. Suppose N is one of the
      -// above mentioned nodes. It has to be wrapped because otherwise Select(N)
      -// returns N. So the raw TargetGlobalAddress nodes, etc. can only be used to
      -// form addressing mode. These wrapped nodes will be selected into MOV32ri.
      +// ConstantPool, JumpTable, GlobalAddress, and ExternalSymbol are lowered as
      +// their target countpart wrapped in the X86ISD::Wrapper node. Suppose N is
      +// one of the above mentioned nodes. It has to be wrapped because otherwise
      +// Select(N) returns N. So the raw TargetGlobalAddress nodes, etc. can only
      +// be used to form addressing mode. These wrapped nodes will be selected
      +// into MOV32ri.
       SDValue
       X86TargetLowering::LowerConstantPool(SDValue Op, SelectionDAG &DAG) {
         ConstantPoolSDNode *CP = cast(Op);
      @@ -4362,7 +4362,8 @@
       
         NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
         SDValue Ops1[] = { Chain,
      -                      DAG.getTargetSymbol("___tls_get_addr", PtrVT),
      +                      DAG.getTargetExternalSymbol("___tls_get_addr",
      +                                                  PtrVT),
                             DAG.getRegister(X86::EAX, PtrVT),
                             DAG.getRegister(X86::EBX, PtrVT),
                             InFlag };
      @@ -4395,7 +4396,8 @@
       
         NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
         SDValue Ops1[] = { Chain,
      -                      DAG.getTargetSymbol("__tls_get_addr", PtrVT),
      +                      DAG.getTargetExternalSymbol("__tls_get_addr",
      +                                                  PtrVT),
                             DAG.getRegister(X86::RDI, PtrVT),
                             InFlag };
         Chain = DAG.getNode(X86ISD::CALL, NodeTys, Ops1, 4);
      @@ -4447,9 +4449,8 @@
       
       SDValue
       X86TargetLowering::LowerExternalSymbol(SDValue Op, SelectionDAG &DAG) {
      -  SymbolSDNode *Sym = cast(Op);
      -  SDValue Result = DAG.getTargetSymbol(Sym->getSymbol(), getPointerTy(),
      -                                       Sym->getLinkage());
      +  const char *Sym = cast(Op)->getSymbol();
      +  SDValue Result = DAG.getTargetExternalSymbol(Sym, getPointerTy());
         Result = DAG.getNode(X86ISD::Wrapper, getPointerTy(), Result);
         // With PIC, the address is actually $g + Offset.
         if (getTargetMachine().getRelocationModel() == Reloc::PIC_ &&
      @@ -5053,7 +5054,7 @@
       
         SDVTList  NodeTys = DAG.getVTList(MVT::Other, MVT::Flag);
         SDValue Ops[] = { Chain,
      -                      DAG.getTargetSymbol("_alloca", IntPtr),
      +                      DAG.getTargetExternalSymbol("_alloca", IntPtr),
                             DAG.getRegister(X86::EAX, IntPtr),
                             DAG.getRegister(X86StackPtr, SPTy),
                             Flag };
      @@ -5103,7 +5104,7 @@
             Args.push_back(Entry);
             std::pair CallResult =
               LowerCallTo(Chain, Type::VoidTy, false, false, false, CallingConv::C,
      -                    false, DAG.getSymbol(bzeroEntry, IntPtr),
      +                    false, DAG.getExternalSymbol(bzeroEntry, IntPtr),
                           Args, DAG);
             return CallResult.second;
           }
      @@ -5976,7 +5977,7 @@
         case ISD::ConstantPool:       return LowerConstantPool(Op, DAG);
         case ISD::GlobalAddress:      return LowerGlobalAddress(Op, DAG);
         case ISD::GlobalTLSAddress:   return LowerGlobalTLSAddress(Op, DAG);
      -  case ISD::Symbol:             return LowerExternalSymbol(Op, DAG);
      +  case ISD::ExternalSymbol:     return LowerExternalSymbol(Op, DAG);
         case ISD::SHL_PARTS:
         case ISD::SRA_PARTS:
         case ISD::SRL_PARTS:          return LowerShift(Op, DAG);
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Tue Sep 16 16:48:12 2008
      @@ -145,8 +145,8 @@
             /// at function entry, used for PIC code.
             GlobalBaseReg,
       
      -      /// Wrapper - A wrapper node for TargetConstantPool, TargetSymbol, and
      -      /// TargetGlobalAddress.
      +      /// Wrapper - A wrapper node for TargetConstantPool,
      +      /// TargetExternalSymbol, and TargetGlobalAddress.
             Wrapper,
       
             /// WrapperRIP - Special wrapper used under X86-64 PIC mode for RIP
      
      Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original)
      +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Sep 16 16:48:12 2008
      @@ -1192,7 +1192,7 @@
       // Non-Instruction Patterns
       //===----------------------------------------------------------------------===//
       
      -// ConstantPool GlobalAddress, Symbol, and JumpTable
      +// ConstantPool GlobalAddress, ExternalSymbol, and JumpTable
       def : Pat<(i64 (X86Wrapper tconstpool  :$dst)),
                 (MOV64ri tconstpool  :$dst)>, Requires<[NotSmallCode]>;
       def : Pat<(i64 (X86Wrapper tjumptable  :$dst)),
      
      Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
      +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 16 16:48:12 2008
      @@ -2703,7 +2703,7 @@
       // Non-Instruction Patterns
       //===----------------------------------------------------------------------===//
       
      -// ConstantPool GlobalAddress, Symbol, and JumpTable
      +// ConstantPool GlobalAddress, ExternalSymbol, and JumpTable
       def : Pat<(i32 (X86Wrapper tconstpool  :$dst)), (MOV32ri tconstpool  :$dst)>;
       def : Pat<(i32 (X86Wrapper tjumptable  :$dst)), (MOV32ri tjumptable  :$dst)>;
       def : Pat<(i32 (X86Wrapper tglobaltlsaddr:$dst)),(MOV32ri tglobaltlsaddr:$dst)>;
      
      Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=56251&r1=56250&r2=56251&view=diff
      
      ==============================================================================
      --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original)
      +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Tue Sep 16 16:48:12 2008
      @@ -802,11 +802,11 @@
               NodeOps.push_back(Val);
             } else if (!N->isLeaf() && N->getOperator()->getName() == "texternalsym"){
               Record *Op = OperatorMap[N->getName()];
      -        // Transform Symbol to TargetSymbol
      +        // Transform ExternalSymbol to TargetExternalSymbol
               if (Op && Op->getName() == "externalsym") {
                 std::string TmpVar = "Tmp"+utostr(ResNo);
                 emitCode("SDValue " + TmpVar + " = CurDAG->getTarget"
      -                   "Symbol(cast(" +
      +                   "ExternalSymbol(cast(" +
                          Val + ")->getSymbol(), " +
                          getEnumName(N->getTypeNum(0)) + ");");
                 // Add Tmp to VariableMap, so that we don't multiply select
      @@ -1949,7 +1949,7 @@
            << "  case ISD::TargetConstantFP:\n"
            << "  case ISD::TargetConstantPool:\n"
            << "  case ISD::TargetFrameIndex:\n"
      -     << "  case ISD::TargetSymbol:\n"
      +     << "  case ISD::TargetExternalSymbol:\n"
            << "  case ISD::TargetJumpTable:\n"
            << "  case ISD::TargetGlobalTLSAddress:\n"
            << "  case ISD::TargetGlobalAddress: {\n"
      
      
      
      
      From isanbard at gmail.com  Tue Sep 16 17:01:17 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Tue, 16 Sep 2008 22:01:17 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56252 -
      	/llvm-gcc-4.2/trunk/gcc/common.opt
      Message-ID: <200809162201.m8GM1HwW013570@zion.cs.uiuc.edu>
      
      Author: void
      Date: Tue Sep 16 17:01:17 2008
      New Revision: 56252
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56252&view=rev
      Log:
      Fix comment line.
      
      Modified:
          llvm-gcc-4.2/trunk/gcc/common.opt
      
      Modified: llvm-gcc-4.2/trunk/gcc/common.opt
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/common.opt?rev=56252&r1=56251&r2=56252&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/common.opt (original)
      +++ llvm-gcc-4.2/trunk/gcc/common.opt Tue Sep 16 17:01:17 2008
      @@ -229,8 +229,7 @@
       ; single-precision floating-point numbers.
       flimited-precision=
       Common RejectNegative Joined UInteger Var(flag_limited_precision) Init(0)
      -Calculate the approximate value of logf, log2f, log10f, expf, exp2f, and
      -powf(10,x) to the given bit precision.
      +Calculate the approximate value of logf, log2f, log10f, expf, exp2f, and powf(10,x) to the given bit precision.
       
       ; Debug pass manager
       fdebug-pass-structure
      
      
      
      
      From gohman at apple.com  Tue Sep 16 17:02:25 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Tue, 16 Sep 2008 15:02:25 -0700
      Subject: [llvm-commits] [PATCH] align constant pool loads using
      	preferred alignment
      In-Reply-To: <48CFF5CD.5050102@rapidmind.com>
      References: <48CFF5CD.5050102@rapidmind.com>
      Message-ID: <28743604-0ED1-4A68-B934-9BFFE496C1FB@apple.com>
      
      Committed, thanks! I did make a few cosmetic changes to
      enforce our 80-column limit.
      
      I was surprised to see that ConstantPoolSDNode's alignment
      argument is a log2 value, but that apparently what that
      code is expecting.
      
      It looks like the code in ScheduleDAGEmit.cpp that handles
      the alignment==0 case for ConstantPoolSDNode is no longer
      needed. Does that seem right to you?
      
      Thanks,
      
      Dan
      
      On Sep 16, 2008, at 11:07 AM, Paul Redmond wrote:
      
      > Hi,
      >
      > As suggested by Dan Gohman:
      >
      > This patch changes SelectionDAG::getConstantPool to always set the  
      > alignment of the ConstantPoolSDNode using the target's preferred  
      > alignment for the constant type.
      >
      > In LegalizeDAG, when performing loads from the constant pool, the  
      > ConstantPoolSDNode's alignment is used in the calls to getLoad and  
      > getExtLoad.
      >
      > This change prevents SelectionDAG::getLoad/getExtLoad from  
      > incorrectly choosing the ABI alignment for constant pool loads when  
      > Alignment == 0. The incorrect alignment is only a performance issue  
      > when ABI alignment does not equal preferred alignment (i.e., on x86  
      > it was generating MOVUPS instead of MOVAPS for v4f32 constant loads  
      > when the default ABI alignment for 128bit vectors is forced to 1  
      > byte.)
      >
      > thanks,
      > Paul
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From gohman at apple.com  Tue Sep 16 17:05:41 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Tue, 16 Sep 2008 22:05:41 -0000
      Subject: [llvm-commits] [llvm] r56253 - in
       /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp SelectionDAG.cpp
      Message-ID: <200809162205.m8GM5fSl013698@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Tue Sep 16 17:05:41 2008
      New Revision: 56253
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56253&view=rev
      Log:
      Change SelectionDAG::getConstantPool to always set the alignment of the
      ConstantPoolSDNode, using the target's preferred alignment for the
      constant type.
      
      In LegalizeDAG, when performing loads from the constant pool, the
      ConstantPoolSDNode's alignment is used in the calls to getLoad and
      getExtLoad.
      
      This change prevents SelectionDAG::getLoad/getExtLoad from incorrectly
      choosing the ABI alignment for constant pool loads when Alignment == 0.
      The incorrect alignment is only a performance issue when ABI alignment
      does not equal preferred alignment (i.e., on x86 it was generating
      MOVUPS instead of MOVAPS for v4f32 constant loads when the default ABI
      alignment for 128bit vectors is forced to 1 byte.)
      
      Patch by Paul Redmond!
      
      Modified:
          llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=56253&r1=56252&r2=56253&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Sep 16 17:05:41 2008
      @@ -467,12 +467,13 @@
         }
       
         SDValue CPIdx = DAG.getConstantPool(LLVMC, TLI.getPointerTy());
      +  unsigned Alignment = 1 << cast(CPIdx)->getAlignment();
         if (Extend)
           return DAG.getExtLoad(ISD::EXTLOAD, OrigVT, DAG.getEntryNode(),
                                 CPIdx, PseudoSourceValue::getConstantPool(),
      -                          0, VT);
      +                          0, VT, false, Alignment);
         return DAG.getLoad(OrigVT, DAG.getEntryNode(), CPIdx,
      -                     PseudoSourceValue::getConstantPool(), 0);
      +                     PseudoSourceValue::getConstantPool(), 0, false, Alignment);
       }
       
       
      @@ -4997,8 +4998,10 @@
           }
           Constant *CP = ConstantVector::get(CV);
           SDValue CPIdx = DAG.getConstantPool(CP, TLI.getPointerTy());
      +    unsigned Alignment = 1 << cast(CPIdx)->getAlignment();
           return DAG.getLoad(VT, DAG.getEntryNode(), CPIdx,
      -                       PseudoSourceValue::getConstantPool(), 0);
      +                       PseudoSourceValue::getConstantPool(), 0,
      +                       false, Alignment);
         }
         
         if (SplatValue.getNode()) {   // Splat of one value?
      @@ -5433,17 +5436,19 @@
           static Constant *FudgeFactor = ConstantInt::get(Type::Int64Ty, FF);
       
           SDValue CPIdx = DAG.getConstantPool(FudgeFactor, TLI.getPointerTy());
      +    unsigned Alignment = 1 << cast(CPIdx)->getAlignment();
           CPIdx = DAG.getNode(ISD::ADD, TLI.getPointerTy(), CPIdx, CstOffset);
           SDValue FudgeInReg;
           if (DestTy == MVT::f32)
             FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), CPIdx,
      -                               PseudoSourceValue::getConstantPool(), 0);
      +                               PseudoSourceValue::getConstantPool(), 0,
      +                               false, Alignment);
           else if (DestTy.bitsGT(MVT::f32))
             // FIXME: Avoid the extend by construction the right constantpool?
             FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, DestTy, DAG.getEntryNode(),
                                         CPIdx,
                                         PseudoSourceValue::getConstantPool(), 0,
      -                                  MVT::f32);
      +                                  MVT::f32, false, Alignment);
           else 
             assert(0 && "Unexpected conversion");
       
      @@ -5582,17 +5587,19 @@
         static Constant *FudgeFactor = ConstantInt::get(Type::Int64Ty, FF);
       
         SDValue CPIdx = DAG.getConstantPool(FudgeFactor, TLI.getPointerTy());
      +  unsigned Alignment = 1 << cast(CPIdx)->getAlignment();
         CPIdx = DAG.getNode(ISD::ADD, TLI.getPointerTy(), CPIdx, CstOffset);
         SDValue FudgeInReg;
         if (DestVT == MVT::f32)
           FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), CPIdx,
      -                             PseudoSourceValue::getConstantPool(), 0);
      +                             PseudoSourceValue::getConstantPool(), 0,
      +                             false, Alignment);
         else {
           FudgeInReg =
             LegalizeOp(DAG.getExtLoad(ISD::EXTLOAD, DestVT,
                                       DAG.getEntryNode(), CPIdx,
                                       PseudoSourceValue::getConstantPool(), 0,
      -                                MVT::f32));
      +                                MVT::f32, false, Alignment));
         }
       
         return DAG.getNode(ISD::FADD, DestVT, Tmp1, FudgeInReg);
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=56253&r1=56252&r2=56253&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 16 17:05:41 2008
      @@ -1019,6 +1019,9 @@
       SDValue SelectionDAG::getConstantPool(Constant *C, MVT VT,
                                             unsigned Alignment, int Offset,
                                             bool isTarget) {
      +  if (Alignment == 0)
      +    Alignment =
      +      TLI.getTargetData()->getPreferredTypeAlignmentShift(C->getType());
         unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
         FoldingSetNodeID ID;
         AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
      @@ -1039,6 +1042,9 @@
       SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, MVT VT,
                                             unsigned Alignment, int Offset,
                                             bool isTarget) {
      +  if (Alignment == 0)
      +    Alignment =
      +      TLI.getTargetData()->getPreferredTypeAlignmentShift(C->getType());
         unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool;
         FoldingSetNodeID ID;
         AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
      
      
      
      
      From dpatel at apple.com  Tue Sep 16 17:25:14 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Tue, 16 Sep 2008 22:25:14 -0000
      Subject: [llvm-commits] [llvm] r56255 - /llvm/trunk/tools/opt/opt.cpp
      Message-ID: <200809162225.m8GMPEhG014334@zion.cs.uiuc.edu>
      
      Author: dpatel
      Date: Tue Sep 16 17:25:14 2008
      New Revision: 56255
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56255&view=rev
      Log:
      Add -O1, -O2 and -O3 that matches llvm-gcc's -O1, -O2 and -O3 respectively.
      
      
      Modified:
          llvm/trunk/tools/opt/opt.cpp
      
      Modified: llvm/trunk/tools/opt/opt.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=56255&r1=56254&r2=56255&view=diff
      
      ==============================================================================
      --- llvm/trunk/tools/opt/opt.cpp (original)
      +++ llvm/trunk/tools/opt/opt.cpp Tue Sep 16 17:25:14 2008
      @@ -13,6 +13,7 @@
       //===----------------------------------------------------------------------===//
       
       #include "llvm/Module.h"
      +#include "llvm/ModuleProvider.h"
       #include "llvm/PassManager.h"
       #include "llvm/CallGraphSCCPass.h"
       #include "llvm/Bitcode/ReaderWriter.h"
      @@ -85,6 +86,26 @@
                          cl::desc("Include the standard compile time optimizations"));
       
       static cl::opt
      +OptLevelO1("O1",
      +           cl::desc("Optimization level 1. Similar to llvm-gcc -O1"));
      +
      +static cl::opt
      +OptLevelO2("O2",
      +           cl::desc("Optimization level 1. Similar to llvm-gcc -O2"));
      +
      +static cl::opt
      +OptLevelO3("O3",
      +           cl::desc("Optimization level 1. Similar to llvm-gcc -O3"));
      +
      +static cl::opt
      +UnitAtATime("funit-at-a-time",
      +            cl::desc("Enable IPO. This is same is llvm-gcc's -funit-at-a-time"));
      +
      +static cl::opt
      +DisableSimplifyLibCalls("disable-simplify-libcalls",
      +                        cl::desc("Disable simplify libcalls"));
      +
      +static cl::opt
       Quiet("q", cl::desc("Obsolete option"), cl::Hidden);
       
       static cl::alias
      @@ -237,6 +258,88 @@
         if (VerifyEach) PM.add(createVerifierPass());
       }
       
      +/// AddOptimizationPasses - This routine adds optimization passes 
      +/// based on selected optimization level, OptLevel. This routine 
      +/// duplicates llvm-gcc behaviour.
      +///
      +/// OptLevel - Optimization Level
      +/// PruneEH - Add PruneEHPass, if set.
      +/// UnrollLoop - Unroll loops, if set.
      +  void AddOptimizationPasses(PassManager &MPM, FunctionPassManager &FPM,
      +                             unsigned OptLevel) {
      +
      +  if (OptLevel == 0) 
      +    return;
      +
      +  FPM.add(createCFGSimplificationPass());
      +  if (OptLevel == 1)
      +    FPM.add(createPromoteMemoryToRegisterPass());
      +  else
      +    FPM.add(createScalarReplAggregatesPass());
      +  FPM.add(createInstructionCombiningPass());
      +
      +  if (UnitAtATime)
      +    MPM.add(createRaiseAllocationsPass());      // call %malloc -> malloc inst
      +  MPM.add(createCFGSimplificationPass());       // Clean up disgusting code
      +  MPM.add(createPromoteMemoryToRegisterPass()); // Kill useless allocas
      +  if (UnitAtATime) {
      +    MPM.add(createGlobalOptimizerPass());       // OptLevel out global vars
      +    MPM.add(createGlobalDCEPass());             // Remove unused fns and globs
      +    MPM.add(createIPConstantPropagationPass()); // IP Constant Propagation
      +    MPM.add(createDeadArgEliminationPass());    // Dead argument elimination
      +  }
      +  MPM.add(createInstructionCombiningPass());    // Clean up after IPCP & DAE
      +  MPM.add(createCFGSimplificationPass());       // Clean up after IPCP & DAE
      +  if (UnitAtATime)
      +    MPM.add(createPruneEHPass());               // Remove dead EH info
      +  if (OptLevel > 1)
      +    MPM.add(createFunctionInliningPass());      // Inline small functions
      +  if (OptLevel > 2)
      +    MPM.add(createArgumentPromotionPass());   // Scalarize uninlined fn args
      +  if (!DisableSimplifyLibCalls)
      +    MPM.add(createSimplifyLibCallsPass());    // Library Call Optimizations
      +  MPM.add(createInstructionCombiningPass());  // Cleanup for scalarrepl.
      +  MPM.add(createJumpThreadingPass());         // Thread jumps.
      +  MPM.add(createCFGSimplificationPass());     // Merge & remove BBs
      +  MPM.add(createScalarReplAggregatesPass());  // Break up aggregate allocas
      +  MPM.add(createInstructionCombiningPass());  // Combine silly seq's
      +  MPM.add(createCondPropagationPass());       // Propagate conditionals
      +  MPM.add(createTailCallEliminationPass());   // Eliminate tail calls
      +  MPM.add(createCFGSimplificationPass());     // Merge & remove BBs
      +  MPM.add(createReassociatePass());           // Reassociate expressions
      +  MPM.add(createLoopRotatePass());            // Rotate Loop
      +  MPM.add(createLICMPass());                  // Hoist loop invariants
      +  MPM.add(createLoopUnswitchPass());
      +  MPM.add(createLoopIndexSplitPass());        // Split loop index
      +  MPM.add(createInstructionCombiningPass());  
      +  MPM.add(createIndVarSimplifyPass());        // Canonicalize indvars
      +  MPM.add(createLoopDeletionPass());          // Delete dead loops
      +  if (OptLevel > 1)
      +    MPM.add(createLoopUnrollPass());          // Unroll small loops
      +  MPM.add(createInstructionCombiningPass());  // Clean up after the unroller
      +  MPM.add(createGVNPass());                   // Remove redundancies
      +  MPM.add(createMemCpyOptPass());             // Remove memcpy / form memset
      +  MPM.add(createSCCPPass());                  // Constant prop with SCCP
      +  
      +  // Run instcombine after redundancy elimination to exploit opportunities
      +  // opened up by them.
      +  MPM.add(createInstructionCombiningPass());
      +  MPM.add(createCondPropagationPass());       // Propagate conditionals
      +  MPM.add(createDeadStoreEliminationPass());  // Delete dead stores
      +  MPM.add(createAggressiveDCEPass());   // Delete dead instructions
      +  MPM.add(createCFGSimplificationPass());     // Merge & remove BBs
      +  
      +  if (UnitAtATime) {
      +    MPM.add(createStripDeadPrototypesPass());   // Get rid of dead prototypes
      +    MPM.add(createDeadTypeEliminationPass());   // Eliminate dead types
      +  }
      +  
      +  if (OptLevel > 1 && UnitAtATime)
      +    MPM.add(createConstantMergePass());       // Merge dup global constants 
      +  
      +  return;
      +}
      +
       void AddStandardCompilePasses(PassManager &PM) {
         PM.add(createVerifierPass());                  // Verify that input is correct
       
      @@ -378,6 +481,12 @@
           // Add an appropriate TargetData instance for this module...
           Passes.add(new TargetData(M.get()));
       
      +    FunctionPassManager *FPasses = NULL;
      +    if (OptLevelO1 || OptLevelO2 || OptLevelO3) {
      +      FPasses = new FunctionPassManager(new ExistingModuleProvider(M.get()));
      +      FPasses->add(new TargetData(M.get()));
      +    }
      +      
           // If the -strip-debug command line option was specified, add it.  If
           // -std-compile-opts was also specified, it will handle StripDebug.
           if (StripDebug && !StandardCompileOpts)
      @@ -393,6 +502,21 @@
               StandardCompileOpts = false;
             }
             
      +      if (OptLevelO1 && OptLevelO1.getPosition() < PassList.getPosition(i)) {
      +        AddOptimizationPasses(Passes, *FPasses, 1);
      +        OptLevelO1 = false;
      +      }
      +
      +      if (OptLevelO2 && OptLevelO2.getPosition() < PassList.getPosition(i)) {
      +        AddOptimizationPasses(Passes, *FPasses, 2);
      +        OptLevelO2 = false;
      +      }
      +
      +      if (OptLevelO3 && OptLevelO3.getPosition() < PassList.getPosition(i)) {
      +        AddOptimizationPasses(Passes, *FPasses, 3);
      +        OptLevelO3 = false;
      +      }
      +
             const PassInfo *PassInf = PassList[i];
             Pass *P = 0;
             if (PassInf->getNormalCtor())
      @@ -427,6 +551,24 @@
             StandardCompileOpts = false;
           }    
       
      +    if (OptLevelO1) {
      +        AddOptimizationPasses(Passes, *FPasses, 1);
      +      }
      +
      +    if (OptLevelO2) {
      +        AddOptimizationPasses(Passes, *FPasses, 2);
      +      }
      +
      +    if (OptLevelO3) {
      +        AddOptimizationPasses(Passes, *FPasses, 3);
      +      }
      +
      +    if (OptLevelO1 || OptLevelO2 || OptLevelO3) {
      +      for (Module::iterator I = M.get()->begin(), E = M.get()->end();
      +           I != E; ++I)
      +        FPasses->run(*I);
      +    }
      +
           // Check that the module is well formed on completion of optimization
           if (!NoVerify && !VerifyEach)
             Passes.add(createVerifierPass());
      
      
      
      
      From dpatel at apple.com  Tue Sep 16 17:26:45 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Tue, 16 Sep 2008 22:26:45 -0000
      Subject: [llvm-commits] [llvm] r56256 - in /llvm/trunk:
       include/llvm/PassManagerUtils.h utils/PassManagerUtils.cpp
      Message-ID: <200809162226.m8GMQj2P014388@zion.cs.uiuc.edu>
      
      Author: dpatel
      Date: Tue Sep 16 17:26:44 2008
      New Revision: 56256
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56256&view=rev
      Log:
      Remove.
      
      Removed:
          llvm/trunk/include/llvm/PassManagerUtils.h
          llvm/trunk/utils/PassManagerUtils.cpp
      
      Removed: llvm/trunk/include/llvm/PassManagerUtils.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagerUtils.h?rev=56255&view=auto
      
      ==============================================================================
      --- llvm/trunk/include/llvm/PassManagerUtils.h (original)
      +++ llvm/trunk/include/llvm/PassManagerUtils.h (removed)
      @@ -1,36 +0,0 @@
      -//===-- llvm/Support/PassManagerUtils.h -------------------------*- C++ -*-===//
      -//
      -//                     The LLVM Compiler Infrastructure
      -//
      -// This file is distributed under the University of Illinois Open Source
      -// License. See LICENSE.TXT for details.
      -//
      -//===----------------------------------------------------------------------===//
      -//
      -// This file provides interface to pass manager utilities.
      -//
      -//===----------------------------------------------------------------------===//
      -
      -namespace llvm {
      -
      -class FunctionPassManager;
      -class PassManager;
      -
      -/// AddOptimizationPasses - This routine adds optimization passes 
      -/// based on selected optimization level, OptLevel. This routine is
      -/// used by llvm-gcc and other tools.
      -///
      -/// OptLevel - Optimization Level
      -/// EnableIPO - Enables IPO passes. llvm-gcc enables this when
      -///             flag_unit_at_a_time is set.
      -/// InlinerSelection - 1 : Add function inliner.
      -///                  - 2 : Add AlwaysInliner.
      -/// OptLibCalls - Simplify lib calls, if set.
      -/// PruneEH - Add PruneEHPass, if set.
      -/// UnrollLoop - Unroll loops, if set.
      -void AddOptimizationPasses(FunctionPassManager &FPM, PassManager &MPM,
      -                           unsigned OptLevel, bool EnableIPO,
      -                           unsigned InlinerSelection, bool OptLibCalls,
      -                           bool PruneEH, bool UnrollLoop);
      -
      -}
      
      Removed: llvm/trunk/utils/PassManagerUtils.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/PassManagerUtils.cpp?rev=56255&view=auto
      
      ==============================================================================
      --- llvm/trunk/utils/PassManagerUtils.cpp (original)
      +++ llvm/trunk/utils/PassManagerUtils.cpp (removed)
      @@ -1,108 +0,0 @@
      -//===-- PassManagerUtils.cpp - --------------------------------------------===//
      -//
      -//                     The LLVM Compiler Infrastructure
      -//
      -// This file is distributed under the University of Illinois Open Source
      -// License. See LICENSE.TXT for details.
      -//
      -//===----------------------------------------------------------------------===//
      -//
      -// This file implements pass manager utiliy routines.
      -//
      -//===----------------------------------------------------------------------===//
      -
      -#include "llvm/PassManagerUtils.h"
      -#include "llvm/PassManagers.h"
      -#include "llvm/Transforms/Scalar.h"
      -#include "llvm/Transforms/IPO.h"
      -#include "llvm/Analysis/LoopPass.h"
      -
      -/// AddOptimizationPasses - This routine adds optimization passes 
      -/// based on selected optimization level, OptLevel. This routine is
      -/// used by llvm-gcc and other tools.
      -///
      -/// OptLevel - Optimization Level
      -/// EnableIPO - Enables IPO passes. llvm-gcc enables this when
      -///             flag_unit_at_a_time is set.
      -/// InlinerSelection - 1 : Add function inliner.
      -///                  - 2 : Add AlwaysInliner.
      -/// OptLibCalls - Simplify lib calls, if set.
      -/// PruneEH - Add PruneEHPass, if set.
      -/// UnrollLoop - Unroll loops, if set.
      -void llvm::AddOptimizationPasses(FunctionPassManager &FPM, PassManager &MPM,
      -                                 unsigned OptLevel, bool EnableIPO,
      -                                 unsigned InlinerSelection, bool OptLibCalls,
      -                                 bool PruneEH, bool UnrollLoop) {
      -  if (OptLevel == 0) 
      -    return;
      -
      -  FPM.add(createCFGSimplificationPass());
      -  if (OptLevel == 1)
      -    FPM.add(createPromoteMemoryToRegisterPass());
      -  else
      -    FPM.add(createScalarReplAggregatesPass());
      -  FPM.add(createInstructionCombiningPass());
      -
      -  if (EnableIPO)
      -    MPM.add(createRaiseAllocationsPass());      // call %malloc -> malloc inst
      -  MPM.add(createCFGSimplificationPass());       // Clean up disgusting code
      -  MPM.add(createPromoteMemoryToRegisterPass()); // Kill useless allocas
      -  if (EnableIPO) {
      -    MPM.add(createGlobalOptimizerPass());       // OptLevel out global vars
      -    MPM.add(createGlobalDCEPass());             // Remove unused fns and globs
      -    MPM.add(createIPConstantPropagationPass()); // IP Constant Propagation
      -    MPM.add(createDeadArgEliminationPass());    // Dead argument elimination
      -  }
      -  MPM.add(createInstructionCombiningPass());    // Clean up after IPCP & DAE
      -  MPM.add(createCFGSimplificationPass());       // Clean up after IPCP & DAE
      -  if (EnableIPO && PruneEH)
      -    MPM.add(createPruneEHPass());               // Remove dead EH info
      -  if (InlinerSelection == 1)                    // respect -fno-inline-functions
      -    MPM.add(createFunctionInliningPass());      // Inline small functions
      -  else if (InlinerSelection == 2)
      -    MPM.add(createAlwaysInlinerPass());         // Inline always_inline functions
      -  if (OptLevel > 2)
      -    MPM.add(createArgumentPromotionPass());   // Scalarize uninlined fn args
      -  if (OptLibCalls)
      -    MPM.add(createSimplifyLibCallsPass());    // Library Call Optimizations
      -  MPM.add(createInstructionCombiningPass());  // Cleanup for scalarrepl.
      -  MPM.add(createJumpThreadingPass());         // Thread jumps.
      -  MPM.add(createCFGSimplificationPass());     // Merge & remove BBs
      -  MPM.add(createScalarReplAggregatesPass());  // Break up aggregate allocas
      -  MPM.add(createInstructionCombiningPass());  // Combine silly seq's
      -  MPM.add(createCondPropagationPass());       // Propagate conditionals
      -  MPM.add(createTailCallEliminationPass());   // Eliminate tail calls
      -  MPM.add(createCFGSimplificationPass());     // Merge & remove BBs
      -  MPM.add(createReassociatePass());           // Reassociate expressions
      -  MPM.add(createLoopRotatePass());            // Rotate Loop
      -  MPM.add(createLICMPass());                  // Hoist loop invariants
      -  MPM.add(createLoopUnswitchPass());
      -  MPM.add(createLoopIndexSplitPass());        // Split loop index
      -  MPM.add(createInstructionCombiningPass());  
      -  MPM.add(createIndVarSimplifyPass());        // Canonicalize indvars
      -  MPM.add(createLoopDeletionPass());          // Delete dead loops
      -  if (UnrollLoop)
      -    MPM.add(createLoopUnrollPass());          // Unroll small loops
      -  MPM.add(createInstructionCombiningPass());  // Clean up after the unroller
      -  MPM.add(createGVNPass());                   // Remove redundancies
      -  MPM.add(createMemCpyOptPass());             // Remove memcpy / form memset
      -  MPM.add(createSCCPPass());                  // Constant prop with SCCP
      -  
      -  // Run instcombine after redundancy elimination to exploit opportunities
      -  // opened up by them.
      -  MPM.add(createInstructionCombiningPass());
      -  MPM.add(createCondPropagationPass());       // Propagate conditionals
      -  MPM.add(createDeadStoreEliminationPass());  // Delete dead stores
      -  MPM.add(createAggressiveDCEPass());   // Delete dead instructions
      -  MPM.add(createCFGSimplificationPass());     // Merge & remove BBs
      -  
      -  if (EnableIPO) {
      -    MPM.add(createStripDeadPrototypesPass());   // Get rid of dead prototypes
      -    MPM.add(createDeadTypeEliminationPass());   // Eliminate dead types
      -  }
      -  
      -  if (OptLevel > 1 && EnableIPO)
      -    MPM.add(createConstantMergePass());       // Merge dup global constants 
      -  
      -  return;
      -}
      
      
      
      
      From isanbard at gmail.com  Tue Sep 16 17:39:13 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Tue, 16 Sep 2008 15:39:13 -0700
      Subject: [llvm-commits] [llvm] r56255 - /llvm/trunk/tools/opt/opt.cpp
      In-Reply-To: <200809162225.m8GMPEhG014334@zion.cs.uiuc.edu>
      References: <200809162225.m8GMPEhG014334@zion.cs.uiuc.edu>
      Message-ID: <16e5fdf90809161539l16d8df9et45169532c8c31448@mail.gmail.com>
      
      On Tue, Sep 16, 2008 at 3:25 PM, Devang Patel  wrote:
      >  static cl::opt
      > +OptLevelO1("O1",
      > +           cl::desc("Optimization level 1. Similar to llvm-gcc -O1"));
      > +
      > +static cl::opt
      > +OptLevelO2("O2",
      > +           cl::desc("Optimization level 1. Similar to llvm-gcc -O2"));
      > +
      > +static cl::opt
      > +OptLevelO3("O3",
      > +           cl::desc("Optimization level 1. Similar to llvm-gcc -O3"));
      > +
      
      You'll probably want to change the descriptions for each of those. :-)
      
      -bw
      
      
      From evan.cheng at apple.com  Tue Sep 16 18:12:11 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Tue, 16 Sep 2008 23:12:11 -0000
      Subject: [llvm-commits] [llvm] r56258 -
      	/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      Message-ID: <200809162312.m8GNCBZj015813@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Tue Sep 16 18:12:11 2008
      New Revision: 56258
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56258&view=rev
      Log:
      When converting a CopyFromReg to a copy instruction, use the register class of its uses to determine the right destination register class of the copy. This is important for targets where a physical register may belong to multiple register classes.
      
      Modified:
          llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp?rev=56258&r1=56257&r2=56258&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp Tue Sep 16 18:12:11 2008
      @@ -65,6 +65,7 @@
         // If the node is only used by a CopyToReg and the dest reg is a vreg, use
         // the CopyToReg'd destination register instead of creating a new vreg.
         bool MatchReg = true;
      +  const TargetRegisterClass *UseRC = NULL;
         for (SDNode::use_iterator UI = Node->use_begin(), E = Node->use_end();
              UI != E; ++UI) {
           SDNode *User = *UI;
      @@ -84,8 +85,19 @@
               if (Op.getNode() != Node || Op.getResNo() != ResNo)
                 continue;
               MVT VT = Node->getValueType(Op.getResNo());
      -        if (VT != MVT::Other && VT != MVT::Flag)
      -          Match = false;
      +        if (VT == MVT::Other || VT == MVT::Flag)
      +          continue;
      +        Match = false;
      +        if (User->isMachineOpcode()) {
      +          const TargetInstrDesc &II = TII->get(User->getMachineOpcode());
      +          const TargetRegisterClass *RC =
      +            getInstrOperandRegClass(TRI,TII,II,i+II.getNumDefs());
      +          if (!UseRC)
      +            UseRC = RC;
      +          else if (RC)
      +            assert(UseRC == RC &&
      +                   "Multiple uses expecting different register classes!");
      +        }
             }
           }
           MatchReg &= Match;
      @@ -93,14 +105,18 @@
             break;
         }
       
      +  MVT VT = Node->getValueType(ResNo);
         const TargetRegisterClass *SrcRC = 0, *DstRC = 0;
      -  SrcRC = TRI->getPhysicalRegisterRegClass(SrcReg, Node->getValueType(ResNo));
      +  SrcRC = TRI->getPhysicalRegisterRegClass(SrcReg, VT);
         
         // Figure out the register class to create for the destreg.
         if (VRBase) {
           DstRC = MRI.getRegClass(VRBase);
      +  } else if (UseRC) {
      +    assert(UseRC->hasType(VT) && "Incompatible phys register def and uses!");
      +    DstRC = UseRC;
         } else {
      -    DstRC = TLI->getRegClassFor(Node->getValueType(ResNo));
      +    DstRC = TLI->getRegClassFor(VT);
         }
           
         // If all uses are reading from the src physical register and copying the
      @@ -110,7 +126,10 @@
         } else {
           // Create the reg, emit the copy.
           VRBase = MRI.createVirtualRegister(DstRC);
      -    TII->copyRegToReg(*BB, BB->end(), VRBase, SrcReg, DstRC, SrcRC);
      +    bool Emitted =
      +      TII->copyRegToReg(*BB, BB->end(), VRBase, SrcReg, DstRC, SrcRC);
      +    Emitted = Emitted; // Silence compiler warning.
      +    assert(Emitted && "Unable to issue a copy instruction!");
         }
       
         SDValue Op(Node, ResNo);
      
      
      
      
      From kremenek at apple.com  Tue Sep 16 18:55:55 2008
      From: kremenek at apple.com (Ted Kremenek)
      Date: Tue, 16 Sep 2008 23:55:55 -0000
      Subject: [llvm-commits] [llvm] r56263 - /llvm/tags/checker/checker-92/
      Message-ID: <200809162355.m8GNtt1g017524@zion.cs.uiuc.edu>
      
      Author: kremenek
      Date: Tue Sep 16 18:55:55 2008
      New Revision: 56263
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56263&view=rev
      Log:
      Tagging checker-92.
      
      Added:
          llvm/tags/checker/checker-92/
            - copied from r56262, llvm/trunk/
      
      
      
      From dpatel at apple.com  Tue Sep 16 19:01:04 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Wed, 17 Sep 2008 00:01:04 -0000
      Subject: [llvm-commits] [llvm] r56265 - /llvm/trunk/tools/opt/opt.cpp
      Message-ID: <200809170001.m8H014O4017713@zion.cs.uiuc.edu>
      
      Author: dpatel
      Date: Tue Sep 16 19:01:04 2008
      New Revision: 56265
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56265&view=rev
      Log:
      Fix cut-n-pasto.
      
      Modified:
          llvm/trunk/tools/opt/opt.cpp
      
      Modified: llvm/trunk/tools/opt/opt.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=56265&r1=56264&r2=56265&view=diff
      
      ==============================================================================
      --- llvm/trunk/tools/opt/opt.cpp (original)
      +++ llvm/trunk/tools/opt/opt.cpp Tue Sep 16 19:01:04 2008
      @@ -91,11 +91,11 @@
       
       static cl::opt
       OptLevelO2("O2",
      -           cl::desc("Optimization level 1. Similar to llvm-gcc -O2"));
      +           cl::desc("Optimization level 2. Similar to llvm-gcc -O2"));
       
       static cl::opt
       OptLevelO3("O3",
      -           cl::desc("Optimization level 1. Similar to llvm-gcc -O3"));
      +           cl::desc("Optimization level 3. Similar to llvm-gcc -O3"));
       
       static cl::opt
       UnitAtATime("funit-at-a-time",
      
      
      
      
      From isanbard at gmail.com  Tue Sep 16 19:30:57 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Wed, 17 Sep 2008 00:30:57 -0000
      Subject: [llvm-commits] [llvm] r56267 - in /llvm/trunk:
       lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.h
       test/CodeGen/PowerPC/trampoline.ll
      Message-ID: <200809170030.m8H0UvXK018801@zion.cs.uiuc.edu>
      
      Author: void
      Date: Tue Sep 16 19:30:57 2008
      New Revision: 56267
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56267&view=rev
      Log:
      Add trampoline support to PPC. GCC simply calls the "__trampoline_setup"
      function with appropriate parameters. This allows us to support blocks on PPC.
      
      Added:
          llvm/trunk/test/CodeGen/PowerPC/trampoline.ll
      Modified:
          llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
          llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h
      
      Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=56267&r1=56266&r2=56267&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Tue Sep 16 19:30:57 2008
      @@ -196,7 +196,10 @@
       
         // TRAP is legal.
         setOperationAction(ISD::TRAP, MVT::Other, Legal);
      -    
      +
      +  // TRAMPOLINE is custom lowered.
      +  setOperationAction(ISD::TRAMPOLINE, MVT::Other, Custom);
      +
         // VASTART needs to be custom lowered to use the VarArgsFrameIndex
         setOperationAction(ISD::VASTART           , MVT::Other, Custom);
         
      @@ -1220,12 +1223,50 @@
         return SDValue(); // Not reached
       }
       
      +SDValue PPCTargetLowering::LowerTRAMPOLINE(SDValue Op, SelectionDAG &DAG) {
      +  SDValue Chain = Op.getOperand(0);
      +  SDValue Trmp = Op.getOperand(1); // trampoline
      +  SDValue FPtr = Op.getOperand(2); // nested function
      +  SDValue Nest = Op.getOperand(3); // 'nest' parameter value
      +
      +  MVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy();
      +  bool isPPC64 = (PtrVT == MVT::i64);
      +  const Type *IntPtrTy =
      +    DAG.getTargetLoweringInfo().getTargetData()->getIntPtrType();
      +
      +  TargetLowering::ArgListTy Args; 
      +  TargetLowering::ArgListEntry Entry;
      +
      +  Entry.Ty = IntPtrTy;
      +  Entry.Node = Trmp; Args.push_back(Entry);
      +
      +  // TrampSize == (isPPC64 ? 48 : 40);
      +  Entry.Node = DAG.getConstant(isPPC64 ? 48 : 40,
      +                               isPPC64 ? MVT::i64 : MVT::i32);
      +  Args.push_back(Entry);
      +
      +  Entry.Node = FPtr; Args.push_back(Entry);
      +  Entry.Node = Nest; Args.push_back(Entry);
      +  
      +  // Lower to a call to __trampoline_setup(Trmp, TrampSize, FPtr, ctx_reg)
      +  std::pair CallResult =
      +    LowerCallTo(Chain, Op.getValueType().getTypeForMVT(), false, false,
      +                false, CallingConv::C, false,
      +                DAG.getExternalSymbol("__trampoline_setup", PtrVT),
      +                Args, DAG);
      +
      +  SDValue Ops[] =
      +    { CallResult.first, CallResult.second };
      +
      +  return DAG.getMergeValues(Ops, 2, false);
      +}
      +
       SDValue PPCTargetLowering::LowerVASTART(SDValue Op, SelectionDAG &DAG,
      -                              int VarArgsFrameIndex,
      -                              int VarArgsStackOffset,
      -                              unsigned VarArgsNumGPR,
      -                              unsigned VarArgsNumFPR,
      -                              const PPCSubtarget &Subtarget) {
      +                                        int VarArgsFrameIndex,
      +                                        int VarArgsStackOffset,
      +                                        unsigned VarArgsNumGPR,
      +                                        unsigned VarArgsNumFPR,
      +                                        const PPCSubtarget &Subtarget) {
       
         if (Subtarget.isMachoABI()) {
           // vastart just stores the address of the VarArgsFrameIndex slot into the
      @@ -3414,7 +3455,7 @@
       static SDValue GeneratePerfectShuffle(unsigned PFEntry, SDValue LHS,
                                               SDValue RHS, SelectionDAG &DAG) {
         unsigned OpNum = (PFEntry >> 26) & 0x0F;
      -  unsigned LHSID  = (PFEntry >> 13) & ((1 << 13)-1);
      +  unsigned LHSID = (PFEntry >> 13) & ((1 << 13)-1);
         unsigned RHSID = (PFEntry >>  0) & ((1 << 13)-1);
         
         enum {
      @@ -3807,6 +3848,7 @@
         case ISD::GlobalTLSAddress:   return LowerGlobalTLSAddress(Op, DAG);
         case ISD::JumpTable:          return LowerJumpTable(Op, DAG);
         case ISD::SETCC:              return LowerSETCC(Op, DAG);
      +  case ISD::TRAMPOLINE:         return LowerTRAMPOLINE(Op, DAG);
         case ISD::VASTART:            
           return LowerVASTART(Op, DAG, VarArgsFrameIndex, VarArgsStackOffset,
                               VarArgsNumGPR, VarArgsNumFPR, PPCSubTarget);
      
      Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=56267&r1=56266&r2=56267&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h (original)
      +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h Tue Sep 16 19:30:57 2008
      @@ -343,6 +343,7 @@
           SDValue LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG);
           SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG);
           SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG);
      +    SDValue LowerTRAMPOLINE(SDValue Op, SelectionDAG &DAG);
           SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG,
                                  int VarArgsFrameIndex, int VarArgsStackOffset,
                                  unsigned VarArgsNumGPR, unsigned VarArgsNumFPR,
      
      Added: llvm/trunk/test/CodeGen/PowerPC/trampoline.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/trampoline.ll?rev=56267&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/PowerPC/trampoline.ll (added)
      +++ llvm/trunk/test/CodeGen/PowerPC/trampoline.ll Tue Sep 16 19:30:57 2008
      @@ -0,0 +1,166 @@
      +; RUN: llvm-as < %s | llc -march=ppc32 | grep {__trampoline_setup}
      +
      +module asm "\09.lazy_reference .objc_class_name_NSImageRep"
      +module asm "\09.objc_class_name_NSBitmapImageRep=0"
      +module asm "\09.globl .objc_class_name_NSBitmapImageRep"
      +	%struct.CGImage = type opaque
      +	%"struct.FRAME.-[NSBitmapImageRep copyWithZone:]" = type { %struct.NSBitmapImageRep*, void (%struct.__block_1*, %struct.CGImage*)* }
      +	%struct.NSBitmapImageRep = type { %struct.NSImageRep }
      +	%struct.NSImageRep = type {  }
      +	%struct.NSZone = type opaque
      +	%struct.__block_1 = type { %struct.__invoke_impl, %struct.NSZone*, %struct.NSBitmapImageRep** }
      +	%struct.__builtin_trampoline = type { [40 x i8] }
      +	%struct.__invoke_impl = type { i8*, i32, i32, i8* }
      +	%struct._objc__method_prototype_list = type opaque
      +	%struct._objc_class = type { %struct._objc_class*, %struct._objc_class*, i8*, i32, i32, i32, %struct._objc_ivar_list*, %struct._objc_method_list*, %struct.objc_cache*, %struct._objc_protocol**, i8*, %struct._objc_class_ext* }
      +	%struct._objc_class_ext = type opaque
      +	%struct._objc_ivar_list = type opaque
      +	%struct._objc_method = type { %struct.objc_selector*, i8*, i8* }
      +	%struct._objc_method_list = type opaque
      +	%struct._objc_module = type { i32, i32, i8*, %struct._objc_symtab* }
      +	%struct._objc_protocol = type { %struct._objc_protocol_extension*, i8*, %struct._objc_protocol**, %struct._objc__method_prototype_list*, %struct._objc__method_prototype_list* }
      +	%struct._objc_protocol_extension = type opaque
      +	%struct._objc_super = type { %struct.objc_object*, %struct._objc_class* }
      +	%struct._objc_symtab = type { i32, %struct.objc_selector**, i16, i16, [1 x i8*] }
      +	%struct.anon = type { %struct._objc__method_prototype_list*, i32, [1 x %struct._objc_method] }
      +	%struct.objc_cache = type opaque
      +	%struct.objc_object = type opaque
      +	%struct.objc_selector = type opaque
      +	%struct.objc_super = type opaque
      + at _NSConcreteStackBlock = external global i8*		;  [#uses=1]
      +@"\01L_OBJC_SELECTOR_REFERENCES_1" = internal global %struct.objc_selector* bitcast ([34 x i8]* @"\01L_OBJC_METH_VAR_NAME_1" to %struct.objc_selector*), section "__OBJC,__message_refs,literal_pointers,no_dead_strip"		; <%struct.objc_selector**> [#uses=2]
      +@"\01L_OBJC_CLASS_NSBitmapImageRep" = internal global %struct._objc_class { %struct._objc_class* @"\01L_OBJC_METACLASS_NSBitmapImageRep", %struct._objc_class* bitcast ([11 x i8]* @"\01L_OBJC_CLASS_NAME_1" to %struct._objc_class*), i8* getelementptr ([17 x i8]* @"\01L_OBJC_CLASS_NAME_0", i32 0, i32 0), i32 0, i32 1, i32 0, %struct._objc_ivar_list* null, %struct._objc_method_list* bitcast ({ i8*, i32, [1 x %struct._objc_method] }* @"\01L_OBJC_INSTANCE_METHODS_NSBitmapImageRep" to %struct._objc_method_list*), %struct.objc_cache* null, %struct._objc_protocol** null, i8* null, %struct._objc_class_ext* null }, section "__OBJC,__class,regular,no_dead_strip"		; <%struct._objc_class*> [#uses=3]
      +@"\01L_OBJC_SELECTOR_REFERENCES_0" = internal global %struct.objc_selector* bitcast ([14 x i8]* @"\01L_OBJC_METH_VAR_NAME_0" to %struct.objc_selector*), section "__OBJC,__message_refs,literal_pointers,no_dead_strip"		; <%struct.objc_selector**> [#uses=2]
      +@"\01L_OBJC_SYMBOLS" = internal global { i32, %struct.objc_selector**, i16, i16, [1 x %struct._objc_class*] } { i32 0, %struct.objc_selector** null, i16 1, i16 0, [1 x %struct._objc_class*] [ %struct._objc_class* @"\01L_OBJC_CLASS_NSBitmapImageRep" ] }, section "__OBJC,__symbols,regular,no_dead_strip"		; <{ i32, %struct.objc_selector**, i16, i16, [1 x %struct._objc_class*] }*> [#uses=2]
      +@"\01L_OBJC_METH_VAR_NAME_0" = internal global [14 x i8] c"copyWithZone:\00", section "__TEXT,__cstring,cstring_literals", align 4		; <[14 x i8]*> [#uses=2]
      +@"\01L_OBJC_METH_VAR_TYPE_0" = internal global [20 x i8] c"@12 at 0:4^{_NSZone=}8\00", section "__TEXT,__cstring,cstring_literals", align 4		; <[20 x i8]*> [#uses=1]
      +@"\01L_OBJC_INSTANCE_METHODS_NSBitmapImageRep" = internal global { i8*, i32, [1 x %struct._objc_method] } { i8* null, i32 1, [1 x %struct._objc_method] [ %struct._objc_method { %struct.objc_selector* bitcast ([14 x i8]* @"\01L_OBJC_METH_VAR_NAME_0" to %struct.objc_selector*), i8* getelementptr ([20 x i8]* @"\01L_OBJC_METH_VAR_TYPE_0", i32 0, i32 0), i8* bitcast (%struct.objc_object* (%struct.NSBitmapImageRep*, %struct.objc_selector*, %struct.NSZone*)* @"-[NSBitmapImageRep copyWithZone:]" to i8*) } ] }, section "__OBJC,__inst_meth,regular,no_dead_strip"		; <{ i8*, i32, [1 x %struct._objc_method] }*> [#uses=2]
      +@"\01L_OBJC_CLASS_NAME_0" = internal global [17 x i8] c"NSBitmapImageRep\00", section "__TEXT,__cstring,cstring_literals", align 4		; <[17 x i8]*> [#uses=1]
      +@"\01L_OBJC_CLASS_NAME_1" = internal global [11 x i8] c"NSImageRep\00", section "__TEXT,__cstring,cstring_literals", align 4		; <[11 x i8]*> [#uses=2]
      +@"\01L_OBJC_METACLASS_NSBitmapImageRep" = internal global %struct._objc_class { %struct._objc_class* bitcast ([11 x i8]* @"\01L_OBJC_CLASS_NAME_1" to %struct._objc_class*), %struct._objc_class* bitcast ([11 x i8]* @"\01L_OBJC_CLASS_NAME_1" to %struct._objc_class*), i8* getelementptr ([17 x i8]* @"\01L_OBJC_CLASS_NAME_0", i32 0, i32 0), i32 0, i32 2, i32 48, %struct._objc_ivar_list* null, %struct._objc_method_list* null, %struct.objc_cache* null, %struct._objc_protocol** null, i8* null, %struct._objc_class_ext* null }, section "__OBJC,__meta_class,regular,no_dead_strip"		; <%struct._objc_class*> [#uses=2]
      +@"\01L_OBJC_METH_VAR_NAME_1" = internal global [34 x i8] c"_performBlockUsingBackingCGImage:\00", section "__TEXT,__cstring,cstring_literals", align 4		; <[34 x i8]*> [#uses=2]
      +@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] zeroinitializer, section "__OBJC, __image_info,regular"		; <[2 x i32]*> [#uses=1]
      +@"\01L_OBJC_CLASS_NAME_2" = internal global [1 x i8] zeroinitializer, section "__TEXT,__cstring,cstring_literals", align 4		; <[1 x i8]*> [#uses=1]
      +@"\01L_OBJC_MODULES" = internal global %struct._objc_module { i32 7, i32 16, i8* getelementptr ([1 x i8]* @"\01L_OBJC_CLASS_NAME_2", i32 0, i32 0), %struct._objc_symtab* bitcast ({ i32, %struct.objc_selector**, i16, i16, [1 x %struct._objc_class*] }* @"\01L_OBJC_SYMBOLS" to %struct._objc_symtab*) }, section "__OBJC,__module_info,regular,no_dead_strip"		; <%struct._objc_module*> [#uses=1]
      + at llvm.used = appending global [14 x i8*] [ i8* bitcast (%struct.objc_selector** @"\01L_OBJC_SELECTOR_REFERENCES_1" to i8*), i8* bitcast (%struct._objc_class* @"\01L_OBJC_CLASS_NSBitmapImageRep" to i8*), i8* bitcast (%struct.objc_selector** @"\01L_OBJC_SELECTOR_REFERENCES_0" to i8*), i8* bitcast ({ i32, %struct.objc_selector**, i16, i16, [1 x %struct._objc_class*] }* @"\01L_OBJC_SYMBOLS" to i8*), i8* getelementptr ([14 x i8]* @"\01L_OBJC_METH_VAR_NAME_0", i32 0, i32 0), i8* getelementptr ([20 x i8]* @"\01L_OBJC_METH_VAR_TYPE_0", i32 0, i32 0), i8* bitcast ({ i8*, i32, [1 x %struct._objc_method] }* @"\01L_OBJC_INSTANCE_METHODS_NSBitmapImageRep" to i8*), i8* getelementptr ([17 x i8]* @"\01L_OBJC_CLASS_NAME_0", i32 0, i32 0), i8* getelementptr ([11 x i8]* @"\01L_OBJC_CLASS_NAME_1", i32 0, i32 0), i8* bitcast (%struct._objc_class* @"\01L_OBJC_METACLASS_NSBitmapImageRep" to i8*), i8* getelementptr ([34 x i8]* @"\01L_OBJC_METH_VAR_NAME_1", i32 0, i32 0), i8* bitcast ([2 x i32]* @"!
       \01L_OBJC_IMAGE_INFO" to i8*), i8* getelementptr ([1 x i8]* @"\01L_OBJC_CLASS_NAME_2", i32 0, i32 0), i8* bitcast (%struct._objc_module* @"\01L_OBJC_MODULES" to i8*) ], section "llvm.metadata"		; <[14 x i8*]*> [#uses=0]
      +
      +define internal %struct.objc_object* @"-[NSBitmapImageRep copyWithZone:]"(%struct.NSBitmapImageRep* %self, %struct.objc_selector* %_cmd, %struct.NSZone* %zone) nounwind {
      +entry:
      +	%self_addr = alloca %struct.NSBitmapImageRep*		; <%struct.NSBitmapImageRep**> [#uses=2]
      +	%_cmd_addr = alloca %struct.objc_selector*		; <%struct.objc_selector**> [#uses=1]
      +	%zone_addr = alloca %struct.NSZone*		; <%struct.NSZone**> [#uses=2]
      +	%retval = alloca %struct.objc_object*		; <%struct.objc_object**> [#uses=1]
      +	%__block_holder_tmp_1.0 = alloca %struct.__block_1		; <%struct.__block_1*> [#uses=7]
      +	%new = alloca %struct.NSBitmapImageRep*		; <%struct.NSBitmapImageRep**> [#uses=2]
      +	%self.1 = alloca %struct.objc_object*		; <%struct.objc_object**> [#uses=2]
      +	%0 = alloca i8*		;  [#uses=2]
      +	%TRAMP.9 = alloca %struct.__builtin_trampoline, align 4		; <%struct.__builtin_trampoline*> [#uses=1]
      +	%1 = alloca void (%struct.__block_1*, %struct.CGImage*)*		;  [#uses=2]
      +	%2 = alloca %struct.NSBitmapImageRep*		; <%struct.NSBitmapImageRep**> [#uses=2]
      +	%FRAME.7 = alloca %"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"		; <%"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"*> [#uses=5]
      +	%"alloca point" = bitcast i32 0 to i32		;  [#uses=0]
      +	store %struct.NSBitmapImageRep* %self, %struct.NSBitmapImageRep** %self_addr
      +	store %struct.objc_selector* %_cmd, %struct.objc_selector** %_cmd_addr
      +	store %struct.NSZone* %zone, %struct.NSZone** %zone_addr
      +	%3 = getelementptr %"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"* %FRAME.7, i32 0, i32 0		; <%struct.NSBitmapImageRep**> [#uses=1]
      +	%4 = load %struct.NSBitmapImageRep** %self_addr, align 4		; <%struct.NSBitmapImageRep*> [#uses=1]
      +	store %struct.NSBitmapImageRep* %4, %struct.NSBitmapImageRep** %3, align 4
      +	%TRAMP.91 = bitcast %struct.__builtin_trampoline* %TRAMP.9 to i8*		;  [#uses=1]
      +	%FRAME.72 = bitcast %"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"* %FRAME.7 to i8*		;  [#uses=1]
      +	%tramp = call i8* @llvm.init.trampoline(i8* %TRAMP.91, i8* bitcast (void (%"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"*, %struct.__block_1*, %struct.CGImage*)* @__helper_1.1632 to i8*), i8* %FRAME.72)		;  [#uses=1]
      +	store i8* %tramp, i8** %0, align 4
      +	%5 = getelementptr %"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"* %FRAME.7, i32 0, i32 1		;  [#uses=1]
      +	%6 = load i8** %0, align 4		;  [#uses=1]
      +	%7 = bitcast i8* %6 to void (%struct.__block_1*, %struct.CGImage*)*		;  [#uses=1]
      +	store void (%struct.__block_1*, %struct.CGImage*)* %7, void (%struct.__block_1*, %struct.CGImage*)** %5, align 4
      +	store %struct.NSBitmapImageRep* null, %struct.NSBitmapImageRep** %new, align 4
      +	%8 = getelementptr %struct.__block_1* %__block_holder_tmp_1.0, i32 0, i32 0		; <%struct.__invoke_impl*> [#uses=1]
      +	%9 = getelementptr %struct.__invoke_impl* %8, i32 0, i32 0		;  [#uses=1]
      +	store i8* bitcast (i8** @_NSConcreteStackBlock to i8*), i8** %9, align 4
      +	%10 = getelementptr %struct.__block_1* %__block_holder_tmp_1.0, i32 0, i32 0		; <%struct.__invoke_impl*> [#uses=1]
      +	%11 = getelementptr %struct.__invoke_impl* %10, i32 0, i32 1		;  [#uses=1]
      +	store i32 67108864, i32* %11, align 4
      +	%12 = getelementptr %struct.__block_1* %__block_holder_tmp_1.0, i32 0, i32 0		; <%struct.__invoke_impl*> [#uses=1]
      +	%13 = getelementptr %struct.__invoke_impl* %12, i32 0, i32 2		;  [#uses=1]
      +	store i32 24, i32* %13, align 4
      +	%14 = getelementptr %"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"* %FRAME.7, i32 0, i32 1		;  [#uses=1]
      +	%15 = load void (%struct.__block_1*, %struct.CGImage*)** %14, align 4		;  [#uses=1]
      +	store void (%struct.__block_1*, %struct.CGImage*)* %15, void (%struct.__block_1*, %struct.CGImage*)** %1, align 4
      +	%16 = getelementptr %struct.__block_1* %__block_holder_tmp_1.0, i32 0, i32 0		; <%struct.__invoke_impl*> [#uses=1]
      +	%17 = getelementptr %struct.__invoke_impl* %16, i32 0, i32 3		;  [#uses=1]
      +	%18 = load void (%struct.__block_1*, %struct.CGImage*)** %1, align 4		;  [#uses=1]
      +	%19 = bitcast void (%struct.__block_1*, %struct.CGImage*)* %18 to i8*		;  [#uses=1]
      +	store i8* %19, i8** %17, align 4
      +	%20 = getelementptr %struct.__block_1* %__block_holder_tmp_1.0, i32 0, i32 1		; <%struct.NSZone**> [#uses=1]
      +	%21 = load %struct.NSZone** %zone_addr, align 4		; <%struct.NSZone*> [#uses=1]
      +	store %struct.NSZone* %21, %struct.NSZone** %20, align 4
      +	%22 = getelementptr %struct.__block_1* %__block_holder_tmp_1.0, i32 0, i32 2		; <%struct.NSBitmapImageRep***> [#uses=1]
      +	store %struct.NSBitmapImageRep** %new, %struct.NSBitmapImageRep*** %22, align 4
      +	%23 = getelementptr %"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"* %FRAME.7, i32 0, i32 0		; <%struct.NSBitmapImageRep**> [#uses=1]
      +	%24 = load %struct.NSBitmapImageRep** %23, align 4		; <%struct.NSBitmapImageRep*> [#uses=1]
      +	store %struct.NSBitmapImageRep* %24, %struct.NSBitmapImageRep** %2, align 4
      +	%25 = load %struct.NSBitmapImageRep** %2, align 4		; <%struct.NSBitmapImageRep*> [#uses=1]
      +	%26 = bitcast %struct.NSBitmapImageRep* %25 to %struct.objc_object*		; <%struct.objc_object*> [#uses=1]
      +	store %struct.objc_object* %26, %struct.objc_object** %self.1, align 4
      +	%27 = load %struct.objc_selector** @"\01L_OBJC_SELECTOR_REFERENCES_1", align 4		; <%struct.objc_selector*> [#uses=1]
      +	%__block_holder_tmp_1.03 = bitcast %struct.__block_1* %__block_holder_tmp_1.0 to void (%struct.CGImage*)*		;  [#uses=1]
      +	%28 = load %struct.objc_object** %self.1, align 4		; <%struct.objc_object*> [#uses=1]
      +	%29 = call %struct.objc_object* (%struct.objc_object*, %struct.objc_selector*, ...)* inttoptr (i64 4294901504 to %struct.objc_object* (%struct.objc_object*, %struct.objc_selector*, ...)*)(%struct.objc_object* %28, %struct.objc_selector* %27, void (%struct.CGImage*)* %__block_holder_tmp_1.03) nounwind		; <%struct.objc_object*> [#uses=0]
      +	br label %return
      +
      +return:		; preds = %entry
      +	%retval5 = load %struct.objc_object** %retval		; <%struct.objc_object*> [#uses=1]
      +	ret %struct.objc_object* %retval5
      +}
      +
      +declare i8* @llvm.init.trampoline(i8*, i8*, i8*) nounwind
      +
      +define internal void @__helper_1.1632(%"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"* nest %CHAIN.8, %struct.__block_1* %_self, %struct.CGImage* %cgImage) nounwind {
      +entry:
      +	%CHAIN.8_addr = alloca %"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"*		; <%"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"**> [#uses=2]
      +	%_self_addr = alloca %struct.__block_1*		; <%struct.__block_1**> [#uses=3]
      +	%cgImage_addr = alloca %struct.CGImage*		; <%struct.CGImage**> [#uses=1]
      +	%zone = alloca %struct.NSZone*		; <%struct.NSZone**> [#uses=2]
      +	%objc_super = alloca %struct._objc_super		; <%struct._objc_super*> [#uses=3]
      +	%new = alloca %struct.NSBitmapImageRep**		; <%struct.NSBitmapImageRep***> [#uses=2]
      +	%objc_super.5 = alloca %struct.objc_super*		; <%struct.objc_super**> [#uses=2]
      +	%0 = alloca %struct.NSBitmapImageRep*		; <%struct.NSBitmapImageRep**> [#uses=2]
      +	%"alloca point" = bitcast i32 0 to i32		;  [#uses=0]
      +	store %"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"* %CHAIN.8, %"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"** %CHAIN.8_addr
      +	store %struct.__block_1* %_self, %struct.__block_1** %_self_addr
      +	store %struct.CGImage* %cgImage, %struct.CGImage** %cgImage_addr
      +	%1 = load %struct.__block_1** %_self_addr, align 4		; <%struct.__block_1*> [#uses=1]
      +	%2 = getelementptr %struct.__block_1* %1, i32 0, i32 2		; <%struct.NSBitmapImageRep***> [#uses=1]
      +	%3 = load %struct.NSBitmapImageRep*** %2, align 4		; <%struct.NSBitmapImageRep**> [#uses=1]
      +	store %struct.NSBitmapImageRep** %3, %struct.NSBitmapImageRep*** %new, align 4
      +	%4 = load %struct.__block_1** %_self_addr, align 4		; <%struct.__block_1*> [#uses=1]
      +	%5 = getelementptr %struct.__block_1* %4, i32 0, i32 1		; <%struct.NSZone**> [#uses=1]
      +	%6 = load %struct.NSZone** %5, align 4		; <%struct.NSZone*> [#uses=1]
      +	store %struct.NSZone* %6, %struct.NSZone** %zone, align 4
      +	%7 = load %"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"** %CHAIN.8_addr, align 4		; <%"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"*> [#uses=1]
      +	%8 = getelementptr %"struct.FRAME.-[NSBitmapImageRep copyWithZone:]"* %7, i32 0, i32 0		; <%struct.NSBitmapImageRep**> [#uses=1]
      +	%9 = load %struct.NSBitmapImageRep** %8, align 4		; <%struct.NSBitmapImageRep*> [#uses=1]
      +	store %struct.NSBitmapImageRep* %9, %struct.NSBitmapImageRep** %0, align 4
      +	%10 = load %struct.NSBitmapImageRep** %0, align 4		; <%struct.NSBitmapImageRep*> [#uses=1]
      +	%11 = bitcast %struct.NSBitmapImageRep* %10 to %struct.objc_object*		; <%struct.objc_object*> [#uses=1]
      +	%12 = getelementptr %struct._objc_super* %objc_super, i32 0, i32 0		; <%struct.objc_object**> [#uses=1]
      +	store %struct.objc_object* %11, %struct.objc_object** %12, align 4
      +	%13 = load %struct._objc_class** getelementptr (%struct._objc_class* @"\01L_OBJC_CLASS_NSBitmapImageRep", i32 0, i32 1), align 4		; <%struct._objc_class*> [#uses=1]
      +	%14 = getelementptr %struct._objc_super* %objc_super, i32 0, i32 1		; <%struct._objc_class**> [#uses=1]
      +	store %struct._objc_class* %13, %struct._objc_class** %14, align 4
      +	%objc_super1 = bitcast %struct._objc_super* %objc_super to %struct.objc_super*		; <%struct.objc_super*> [#uses=1]
      +	store %struct.objc_super* %objc_super1, %struct.objc_super** %objc_super.5, align 4
      +	%15 = load %struct.objc_selector** @"\01L_OBJC_SELECTOR_REFERENCES_0", align 4		; <%struct.objc_selector*> [#uses=1]
      +	%16 = load %struct.objc_super** %objc_super.5, align 4		; <%struct.objc_super*> [#uses=1]
      +	%17 = load %struct.NSZone** %zone, align 4		; <%struct.NSZone*> [#uses=1]
      +	%18 = call %struct.objc_object* (%struct.objc_super*, %struct.objc_selector*, ...)* @objc_msgSendSuper(%struct.objc_super* %16, %struct.objc_selector* %15, %struct.NSZone* %17) nounwind		; <%struct.objc_object*> [#uses=1]
      +	%19 = bitcast %struct.objc_object* %18 to %struct.NSBitmapImageRep*		; <%struct.NSBitmapImageRep*> [#uses=1]
      +	%20 = load %struct.NSBitmapImageRep*** %new, align 4		; <%struct.NSBitmapImageRep**> [#uses=1]
      +	store %struct.NSBitmapImageRep* %19, %struct.NSBitmapImageRep** %20, align 4
      +	br label %return
      +
      +return:		; preds = %entry
      +	ret void
      +}
      +
      +declare %struct.objc_object* @objc_msgSendSuper(%struct.objc_super*, %struct.objc_selector*, ...)
      
      
      
      
      From gohman at apple.com  Tue Sep 16 19:43:24 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Wed, 17 Sep 2008 00:43:24 -0000
      Subject: [llvm-commits] [llvm] r56268 - in /llvm/trunk:
       include/llvm/CodeGen/LinkAllCodegenComponents.h
       include/llvm/CodeGen/Passes.h lib/CodeGen/DeadMachineInstructionElim.cpp
      Message-ID: <200809170043.m8H0hPQK019214@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Tue Sep 16 19:43:24 2008
      New Revision: 56268
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56268&view=rev
      Log:
      Add a new MachineInstr-level DCE pass. It is very simple, and is intended to
      be used with fast-isel.
      
      Added:
          llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp
      Modified:
          llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h
          llvm/trunk/include/llvm/CodeGen/Passes.h
      
      Modified: llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h?rev=56268&r1=56267&r2=56268&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h Tue Sep 16 19:43:24 2008
      @@ -29,6 +29,8 @@
             if (std::getenv("bar") != (char*) -1)
               return;
       
      +      (void) llvm::createDeadMachineInstructionElimPass();
      +
             (void) llvm::createSimpleRegisterAllocator();
             (void) llvm::createLocalRegisterAllocator();
             (void) llvm::createBigBlockRegisterAllocator();
      
      Modified: llvm/trunk/include/llvm/CodeGen/Passes.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=56268&r1=56267&r2=56268&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/Passes.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/Passes.h Tue Sep 16 19:43:24 2008
      @@ -75,6 +75,11 @@
         /// machine basic blocks.
         extern const PassInfo *const UnreachableMachineBlockElimID;
       
      +  /// DeadMachineInstructionElim pass - This pass removes dead machine
      +  /// instructions.
      +  ///
      +  FunctionPass *createDeadMachineInstructionElimPass();
      +
         /// Creates a register allocator as the user specified on the command line.
         ///
         FunctionPass *createRegisterAllocator();
      
      Added: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp?rev=56268&view=auto
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp (added)
      +++ llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Tue Sep 16 19:43:24 2008
      @@ -0,0 +1,99 @@
      +//===- DeadMachineInstructionElim.cpp - Remove dead machine instructions --===//
      +//
      +//                     The LLVM Compiler Infrastructure
      +//
      +// This file is distributed under the University of Illinois Open Source
      +// License. See LICENSE.TXT for details.
      +//
      +//===----------------------------------------------------------------------===//
      +//
      +// This is an extremely simple MachineInstr-level dead-code-elimination pass.
      +//
      +//===----------------------------------------------------------------------===//
      +
      +#include "llvm/CodeGen/Passes.h"
      +#include "llvm/Pass.h"
      +#include "llvm/CodeGen/MachineFunctionPass.h"
      +#include "llvm/CodeGen/MachineRegisterInfo.h"
      +#include "llvm/Support/Compiler.h"
      +#include "llvm/Target/TargetInstrInfo.h"
      +#include "llvm/Target/TargetMachine.h"
      +using namespace llvm;
      +
      +namespace {
      +  class VISIBILITY_HIDDEN DeadMachineInstructionElim : 
      +        public MachineFunctionPass {
      +    virtual bool runOnMachineFunction(MachineFunction &MF);
      +    
      +  public:
      +    static char ID; // Pass identification, replacement for typeid
      +    DeadMachineInstructionElim() : MachineFunctionPass(&ID) {}
      +  };
      +}
      +char DeadMachineInstructionElim::ID = 0;
      +
      +static RegisterPass
      +Y("dead-mi-elimination",
      +  "Remove dead machine instructions");
      +
      +FunctionPass *llvm::createDeadMachineInstructionElimPass() {
      +  return new DeadMachineInstructionElim();
      +}
      +
      +bool DeadMachineInstructionElim::runOnMachineFunction(MachineFunction &MF) {
      +  bool AnyChanges = false;
      +  const MachineRegisterInfo &MRI = MF.getRegInfo();
      +  const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo();
      +  bool SawStore = true;
      +
      +  // Loop over all instructions in all blocks, from bottom to top, so that it's
      +  // more likely that chains of dependent but ultimately dead instructions will
      +  // be cleaned up.
      +  for (MachineFunction::reverse_iterator I = MF.rbegin(), E = MF.rend();
      +       I != E; ++I) {
      +    MachineBasicBlock *MBB = &*I;
      +    for (MachineBasicBlock::reverse_iterator MII = MBB->rbegin(),
      +         MIE = MBB->rend(); MII != MIE; ) {
      +      MachineInstr *MI = &*MII;
      +
      +      // Don't delete instructions with side effects.
      +      if (MI->isSafeToMove(&TII, SawStore)) {
      +        // Examine each operand.
      +        bool AllDefsDead = true;
      +        for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
      +          const MachineOperand &MO = MI->getOperand(i);
      +          if (MO.isRegister() && MO.isDef()) {
      +            unsigned Reg = MO.getReg();
      +            if (TargetRegisterInfo::isPhysicalRegister(Reg) ||
      +                !MRI.use_empty(Reg)) {
      +              // This def has a use. Don't delete the instruction!
      +              AllDefsDead = false;
      +              break;
      +            }
      +          }
      +        }
      +
      +        // If there are no defs with uses, the instruction is dead.
      +        if (AllDefsDead) {
      +          // Clear out the operands to take the registers out of their
      +          // use chains.
      +          while (unsigned Num = MI->getNumOperands())
      +            MI->RemoveOperand(Num-1);
      +
      +          // Delete the actual instruction.
      +          AnyChanges = true;
      +          MI->eraseFromParent();
      +          MIE = MBB->rend();
      +          // MII is now pointing to the next instruction to process,
      +          // so don't increment it.
      +          continue;
      +        }
      +      }
      +      // We didn't delete the current instruction, so increment MII to
      +      // the next one.
      +      ++MII;
      +    }
      +  }
      +
      +  return AnyChanges;
      +}
      
      
      
      
      From gohman at apple.com  Tue Sep 16 20:39:10 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Wed, 17 Sep 2008 01:39:10 -0000
      Subject: [llvm-commits] [llvm] r56270 -
      	/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
      Message-ID: <200809170139.m8H1dApI020944@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Tue Sep 16 20:39:10 2008
      New Revision: 56270
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56270&view=rev
      Log:
      Simplify and generalize X86DAGToDAGISel::CanBeFoldedBy, and draw
      up some new ascii art to illustrate what it does. This change
      currently has no effect on generated code.
      
      Modified:
          llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=56270&r1=56269&r2=56270&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Sep 16 20:39:10 2008
      @@ -268,7 +268,7 @@
       /// non-immediate use of "Def". This function recursively traversing
       /// up the operand chain ignoring certain nodes.
       static void findNonImmUse(SDNode *Use, SDNode* Def, SDNode *ImmedUse,
      -                          SDNode *Root, SDNode *Skip, bool &found,
      +                          SDNode *Root, bool &found,
                                 SmallPtrSet &Visited) {
         if (found ||
             Use->getNodeId() > Def->getNodeId() ||
      @@ -277,26 +277,16 @@
         
         for (unsigned i = 0, e = Use->getNumOperands(); !found && i != e; ++i) {
           SDNode *N = Use->getOperand(i).getNode();
      -    if (N == Skip)
      -      continue;
           if (N == Def) {
      -      if (Use == ImmedUse)
      +      if (Use == ImmedUse || Use == Root)
               continue;  // We are not looking for immediate use.
      -      if (Use == Root) {
      -        // Must be a chain reading node where it is possible to reach its own
      -        // chain operand through a path started from another operand.
      -        assert(Use->getOpcode() == ISD::STORE ||
      -               Use->getOpcode() == X86ISD::CMP ||
      -               Use->getOpcode() == ISD::INTRINSIC_W_CHAIN ||
      -               Use->getOpcode() == ISD::INTRINSIC_VOID);
      -        continue;
      -      }
      +      assert(N != Root);
             found = true;
             break;
           }
       
           // Traverse up the operand chain.
      -    findNonImmUse(N, Def, ImmedUse, Root, Skip, found, Visited);
      +    findNonImmUse(N, Def, ImmedUse, Root, found, Visited);
         }
       }
       
      @@ -309,11 +299,10 @@
       /// have one non-chain use, we only need to watch out for load/op/store
       /// and load/op/cmp case where the root (store / cmp) may reach the load via
       /// its chain operand.
      -static inline bool isNonImmUse(SDNode *Root, SDNode *Def, SDNode *ImmedUse,
      -                               SDNode *Skip = NULL) {
      +static inline bool isNonImmUse(SDNode *Root, SDNode *Def, SDNode *ImmedUse) {
         SmallPtrSet Visited;
         bool found = false;
      -  findNonImmUse(Root, Def, ImmedUse, Root, Skip, found, Visited);
      +  findNonImmUse(Root, Def, ImmedUse, Root, found, Visited);
         return found;
       }
       
      @@ -321,55 +310,58 @@
       bool X86DAGToDAGISel::CanBeFoldedBy(SDNode *N, SDNode *U, SDNode *Root) const {
         if (Fast) return false;
       
      -  // If U use can somehow reach N through another path then U can't fold N or
      -  // it will create a cycle. e.g. In the following diagram, U can reach N
      -  // through X. If N is folded into into U, then X is both a predecessor and
      -  // a successor of U.
      +  // If Root use can somehow reach N through a path that that doesn't contain
      +  // U then folding N would create a cycle. e.g. In the following
      +  // diagram, Root can reach N through X. If N is folded into into Root, then
      +  // X is both a predecessor and a successor of U.
         //
      -  //         [ N ]
      -  //         ^  ^
      -  //         |  |
      -  //        /   \---
      -  //      /        [X]
      -  //      |         ^
      -  //     [U]--------|
      -
      -  if (isNonImmUse(Root, N, U))
      -    return false;
      -
      -  // If U produces a flag, then it gets (even more) interesting. Since it
      -  // would have been "glued" together with its flag use, we need to check if
      -  // it might reach N:
      +  //          [N*]           //
      +  //         ^   ^           //
      +  //        /     \          //
      +  //      [U*]    [X]?       //
      +  //        ^     ^          //
      +  //         \   /           //
      +  //          \ /            //
      +  //         [Root*]         //
         //
      -  //       [ N ]
      -  //        ^ ^
      -  //        | |
      -  //       [U] \--
      -  //        ^   [TF]
      -  //        |    ^
      -  //        |    |
      -  //         \  /
      -  //          [FU]
      +  // * indicates nodes to be folded together.
         //
      -  // If FU (flag use) indirectly reach N (the load), and U fold N (call it
      -  // NU), then TF is a predecessor of FU and a successor of NU. But since
      -  // NU and FU are flagged together, this effectively creates a cycle.
      -  bool HasFlagUse = false;
      +  // If Root produces a flag, then it gets (even more) interesting. Since it
      +  // will be "glued" together with its flag use in the scheduler, we need to
      +  // check if it might reach N.
      +  //
      +  //          [N*]           //
      +  //         ^   ^           //
      +  //        /     \          //
      +  //      [U*]    [X]?       //
      +  //        ^       ^        //
      +  //         \       \       //
      +  //          \      |       //
      +  //         [Root*] |       //
      +  //          ^      |       //
      +  //          f      |       //
      +  //          |      /       //
      +  //         [Y]    /        //
      +  //           ^   /         //
      +  //           f  /          //
      +  //           | /           //
      +  //          [FU]           //
      +  //
      +  // If FU (flag use) indirectly reaches N (the load), and Root folds N
      +  // (call it Fold), then X is a predecessor of FU and a successor of
      +  // Fold. But since Fold and FU are flagged together, this will create
      +  // a cycle in the scheduling graph.
      +
         MVT VT = Root->getValueType(Root->getNumValues()-1);
      -  while ((VT == MVT::Flag && !Root->use_empty())) {
      +  while (VT == MVT::Flag) {
           SDNode *FU = findFlagUse(Root);
           if (FU == NULL)
             break;
      -    else {
      -      Root = FU;
      -      HasFlagUse = true;
      -    }
      +    Root = FU;
           VT = Root->getValueType(Root->getNumValues()-1);
         }
       
      -  if (HasFlagUse)
      -    return !isNonImmUse(Root, N, Root, U);
      -  return true;
      +  return !isNonImmUse(Root, N, U);
       }
       
       /// MoveBelowTokenFactor - Replace TokenFactor operand with load's chain operand
      
      
      
      
      From isanbard at gmail.com  Tue Sep 16 22:10:27 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Wed, 17 Sep 2008 03:10:27 -0000
      Subject: [llvm-commits] [llvm] r56272 - /llvm/tags/Apple/llvmCore-2069/
      Message-ID: <200809170310.m8H3ARKn023752@zion.cs.uiuc.edu>
      
      Author: void
      Date: Tue Sep 16 22:10:24 2008
      New Revision: 56272
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56272&view=rev
      Log:
      Creating llvmCore-2069 branch
      
      Added:
          llvm/tags/Apple/llvmCore-2069/
            - copied from r56271, llvm/trunk/
      
      
      
      From isanbard at gmail.com  Tue Sep 16 22:10:34 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Wed, 17 Sep 2008 03:10:34 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56273 -
      	/llvm-gcc-4.2/tags/Apple/llvmgcc42-2069/
      Message-ID: <200809170310.m8H3AYjI023766@zion.cs.uiuc.edu>
      
      Author: void
      Date: Tue Sep 16 22:10:33 2008
      New Revision: 56273
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56273&view=rev
      Log:
      Creating llvmgcc42-2069 branch
      
      Added:
          llvm-gcc-4.2/tags/Apple/llvmgcc42-2069/
            - copied from r56272, llvm-gcc-4.2/trunk/
      
      
      
      From evan.cheng at apple.com  Tue Sep 16 23:13:22 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Tue, 16 Sep 2008 21:13:22 -0700
      Subject: [llvm-commits] [llvm] r56270 -
      	/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
      In-Reply-To: <200809170139.m8H1dApI020944@zion.cs.uiuc.edu>
      References: <200809170139.m8H1dApI020944@zion.cs.uiuc.edu>
      Message-ID: 
      
      Nice art work! :-)
      
      On Sep 16, 2008, at 6:39 PM, Dan Gohman wrote:
      
      >
      > -        // Must be a chain reading node where it is possible to  
      > reach its own
      > -        // chain operand through a path started from another operand.
      > -        assert(Use->getOpcode() == ISD::STORE ||
      > -               Use->getOpcode() == X86ISD::CMP ||
      > -               Use->getOpcode() == ISD::INTRINSIC_W_CHAIN ||
      > -               Use->getOpcode() == ISD::INTRINSIC_VOID);
      > -        continue;
      > -      }
      >
      > +      assert(N != Root);
      
      Why remove the assertion?
      
      Evan
      
      >
      >       found = true;
      >       break;
      >     }
      >
      >     // Traverse up the operand chain.
      > -    findNonImmUse(N, Def, ImmedUse, Root, Skip, found, Visited);
      > +    findNonImmUse(N, Def, ImmedUse, Root, found, Visited);
      >   }
      > }
      >
      > @@ -309,11 +299,10 @@
      > /// have one non-chain use, we only need to watch out for load/op/ 
      > store
      > /// and load/op/cmp case where the root (store / cmp) may reach the  
      > load via
      > /// its chain operand.
      > -static inline bool isNonImmUse(SDNode *Root, SDNode *Def, SDNode  
      > *ImmedUse,
      > -                               SDNode *Skip = NULL) {
      > +static inline bool isNonImmUse(SDNode *Root, SDNode *Def, SDNode  
      > *ImmedUse) {
      >   SmallPtrSet Visited;
      >   bool found = false;
      > -  findNonImmUse(Root, Def, ImmedUse, Root, Skip, found, Visited);
      > +  findNonImmUse(Root, Def, ImmedUse, Root, found, Visited);
      >   return found;
      > }
      >
      > @@ -321,55 +310,58 @@
      > bool X86DAGToDAGISel::CanBeFoldedBy(SDNode *N, SDNode *U, SDNode  
      > *Root) const {
      >   if (Fast) return false;
      >
      > -  // If U use can somehow reach N through another path then U can't  
      > fold N or
      > -  // it will create a cycle. e.g. In the following diagram, U can  
      > reach N
      > -  // through X. If N is folded into into U, then X is both a  
      > predecessor and
      > -  // a successor of U.
      > +  // If Root use can somehow reach N through a path that that  
      > doesn't contain
      > +  // U then folding N would create a cycle. e.g. In the following
      > +  // diagram, Root can reach N through X. If N is folded into into  
      > Root, then
      > +  // X is both a predecessor and a successor of U.
      >   //
      > -  //         [ N ]
      > -  //         ^  ^
      > -  //         |  |
      > -  //        /   \---
      > -  //      /        [X]
      > -  //      |         ^
      > -  //     [U]--------|
      > -
      > -  if (isNonImmUse(Root, N, U))
      > -    return false;
      > -
      > -  // If U produces a flag, then it gets (even more) interesting.  
      > Since it
      > -  // would have been "glued" together with its flag use, we need to  
      > check if
      > -  // it might reach N:
      > +  //          [N*]           //
      > +  //         ^   ^           //
      > +  //        /     \          //
      > +  //      [U*]    [X]?       //
      > +  //        ^     ^          //
      > +  //         \   /           //
      > +  //          \ /            //
      > +  //         [Root*]         //
      >   //
      > -  //       [ N ]
      > -  //        ^ ^
      > -  //        | |
      > -  //       [U] \--
      > -  //        ^   [TF]
      > -  //        |    ^
      > -  //        |    |
      > -  //         \  /
      > -  //          [FU]
      > +  // * indicates nodes to be folded together.
      >   //
      > -  // If FU (flag use) indirectly reach N (the load), and U fold N  
      > (call it
      > -  // NU), then TF is a predecessor of FU and a successor of NU. But  
      > since
      > -  // NU and FU are flagged together, this effectively creates a  
      > cycle.
      > -  bool HasFlagUse = false;
      > +  // If Root produces a flag, then it gets (even more) interesting.  
      > Since it
      > +  // will be "glued" together with its flag use in the scheduler,  
      > we need to
      > +  // check if it might reach N.
      > +  //
      > +  //          [N*]           //
      > +  //         ^   ^           //
      > +  //        /     \          //
      > +  //      [U*]    [X]?       //
      > +  //        ^       ^        //
      > +  //         \       \       //
      > +  //          \      |       //
      > +  //         [Root*] |       //
      > +  //          ^      |       //
      > +  //          f      |       //
      > +  //          |      /       //
      > +  //         [Y]    /        //
      > +  //           ^   /         //
      > +  //           f  /          //
      > +  //           | /           //
      > +  //          [FU]           //
      > +  //
      > +  // If FU (flag use) indirectly reaches N (the load), and Root  
      > folds N
      > +  // (call it Fold), then X is a predecessor of FU and a successor of
      > +  // Fold. But since Fold and FU are flagged together, this will  
      > create
      > +  // a cycle in the scheduling graph.
      > +
      >   MVT VT = Root->getValueType(Root->getNumValues()-1);
      > -  while ((VT == MVT::Flag && !Root->use_empty())) {
      > +  while (VT == MVT::Flag) {
      >     SDNode *FU = findFlagUse(Root);
      >     if (FU == NULL)
      >       break;
      > -    else {
      > -      Root = FU;
      > -      HasFlagUse = true;
      > -    }
      > +    Root = FU;
      >     VT = Root->getValueType(Root->getNumValues()-1);
      >   }
      >
      > -  if (HasFlagUse)
      > -    return !isNonImmUse(Root, N, Root, U);
      > -  return true;
      > +  return !isNonImmUse(Root, N, U);
      > }
      >
      > /// MoveBelowTokenFactor - Replace TokenFactor operand with load's  
      > chain operand
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From baldrick at free.fr  Wed Sep 17 01:20:49 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Wed, 17 Sep 2008 08:20:49 +0200
      Subject: [llvm-commits] [llvm] r56255 - /llvm/trunk/tools/opt/opt.cpp
      In-Reply-To: <200809162225.m8GMPEhG014334@zion.cs.uiuc.edu>
      References: <200809162225.m8GMPEhG014334@zion.cs.uiuc.edu>
      Message-ID: <200809170820.50181.baldrick@free.fr>
      
      Hi Devang,
      
      > +            cl::desc("Enable IPO. This is same is llvm-gcc's -funit-at-a-time"));
      
      This is same is -> This is the same as
      
      
      > +DisableSimplifyLibCalls("disable-simplify-libcalls",
      > +                        cl::desc("Disable simplify libcalls"));
      
      The pass name has a hyphen, so how about: Disable simplify-libcalls
      
      > +/// PruneEH - Add PruneEHPass, if set.
      
      This line can go.
      
      > +/// UnrollLoop - Unroll loops, if set.
      
      This doesn't seem to exist.
      
      Also, to decrease code duplication, how about:
      (1) have -std-compile-opts call this with -O3 and IPO
      rather than scheduling it's own list of passes,
      (2) stick this in a library somewhere and have llvm-gcc use it too.
      
      Ciao,
      
      Duncan.
      
      
      From baldrick at free.fr  Wed Sep 17 01:28:25 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Wed, 17 Sep 2008 08:28:25 +0200
      Subject: [llvm-commits] [llvm] r56267 - in /llvm/trunk:
      	lib/Target/PowerPC/PPCISelLowering.cpp
      	lib/Target/PowerPC/PPCISelLowering.h
      	test/CodeGen/PowerPC/trampoline.ll
      In-Reply-To: <200809170030.m8H0UvXK018801@zion.cs.uiuc.edu>
      References: <200809170030.m8H0UvXK018801@zion.cs.uiuc.edu>
      Message-ID: <200809170828.25481.baldrick@free.fr>
      
      Hi Bill,
      
      > Add trampoline support to PPC. GCC simply calls the "__trampoline_setup"
      > function with appropriate parameters. This allows us to support blocks on PPC.
      
      glad to see trampolines coming in useful!  I was surprised to see
      this though: I thought the whole point of blocks is that it doesn't
      need trampolines...
      
      Ciao,
      
      Duncan.
      
      
      From evan.cheng at apple.com  Wed Sep 17 01:29:53 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Wed, 17 Sep 2008 06:29:53 -0000
      Subject: [llvm-commits] [llvm] r56275 -
      	/llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
      Message-ID: <200809170629.m8H6Trt1030167@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Wed Sep 17 01:29:52 2008
      New Revision: 56275
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56275&view=rev
      Log:
      Add instruction names as comments to InstBits entries.
      
      Modified:
          llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
      
      Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.cpp?rev=56275&r1=56274&r2=56275&view=diff
      
      ==============================================================================
      --- llvm/trunk/utils/TableGen/CodeEmitterGen.cpp (original)
      +++ llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Wed Sep 17 01:29:52 2008
      @@ -100,8 +100,6 @@
           const CodeGenInstruction *CGI = *IN;
           Record *R = CGI->TheDef;
           
      -    if (IN != NumberedInstructions.begin()) o << ",\n";
      -    
           if (R->getName() == "PHI" ||
               R->getName() == "INLINEASM" ||
               R->getName() == "DBG_LABEL" ||
      @@ -112,7 +110,7 @@
               R->getName() == "INSERT_SUBREG" ||
               R->getName() == "IMPLICIT_DEF" ||
               R->getName() == "SUBREG_TO_REG") {
      -      o << "    0U";
      +      o << "    0U,\n";
             continue;
           }
           
      @@ -125,9 +123,9 @@
               Value |= B->getValue() << (e-i-1);
             }
           }
      -    o << "    " << Value << "U";
      +    o << "    " << Value << "U," << '\t' << "// " << R->getName() << "\n";
         }
      -  o << "\n  };\n";
      +  o << "    0U\n  };\n";
         
         // Map to accumulate all the cases.
         std::map > CaseMap;
      
      
      
      
      From evan.cheng at apple.com  Wed Sep 17 02:16:21 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Wed, 17 Sep 2008 07:16:21 -0000
      Subject: [llvm-commits] [llvm] r56276 -
      	/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
      Message-ID: <200809170716.m8H7GL5A031652@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Wed Sep 17 02:16:21 2008
      New Revision: 56276
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56276&view=rev
      Log:
      Specify instruction encoding using range list to avoid endianess issues.
      
      Modified:
          llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
      
      Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=56276&r1=56275&r2=56276&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original)
      +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Wed Sep 17 02:16:21 2008
      @@ -142,21 +142,21 @@
         : I {
         let Inst{24}    = 1; // L bit
      -  let Inst{25-27} = 5;
      +  let Inst{25-27} = {1,0,1};
       }
       class ABLI opcod, dag oops, dag iops, Format f, string asm,
                 list pattern>
         : XI {
         let Inst{24}    = 1; // L bit
      -  let Inst{25-27} = 5;
      +  let Inst{25-27} = {1,0,1};
       }
       class ABLXI opcod, dag oops, dag iops, Format f, string asm,
                 list pattern>
         : XI {
      -  let Inst{4-7}   = 3;
      -  let Inst{20-27} = 0x12;
      +  let Inst{4-7}   = {1,1,0,0};
      +  let Inst{20-27} = {0,1,0,0,1,0,0,0};
       }
       // FIXME: BX
       class AXIx2 opcod, dag oops, dag iops, Format f, string asm,
      @@ -168,14 +168,14 @@
         : XI {
         let Inst{24}    = 0; // L bit
      -  let Inst{25-27} = 5;
      +  let Inst{25-27} = {1,0,1};
       }
       class ABccI opcod, dag oops, dag iops, Format f, string opc,
                string asm, list pattern>
         : I {
         let Inst{24}    = 0; // L bit
      -  let Inst{25-27} = 5;
      +  let Inst{25-27} = {1,0,1};
       }
       
       // BR_JT instructions
      @@ -184,25 +184,26 @@
         : XI {
         let Inst{20}    = 0; // S Bit
      -  let Inst{21-24} = 0xd;
      -  let Inst{26-27} = 0;
      +  let Inst{21-24} = {1,0,1,1};
      +  let Inst{26-27} = {0,0};
       }
      -// == ldr pc
      +// == add pc
       class JTI1 opcod, dag oops, dag iops, string asm, list pattern>
         : XI {
      -  let Inst{20}    = 1; // L bit
      -  let Inst{21}    = 0; // W bit
      -  let Inst{22}    = 0; // B bit
      -  let Inst{24}    = 1; // P bit
      +  let Inst{20}    = 0; // S bit
      +  let Inst{21-24} = {0,0,1,0};
      +  let Inst{26-27} = {0,0};
       }
      -// == add pc
      +// == ldr pc
       class JTI2 opcod, dag oops, dag iops, string asm, list pattern>
         : XI {
      -  let Inst{20}    = 0; // S bit
      -  let Inst{21-24} = 4;
      -  let Inst{26-27} = 0;
      +  let Inst{20}    = 1; // L bit
      +  let Inst{21}    = 0; // W bit
      +  let Inst{22}    = 0; // B bit
      +  let Inst{24}    = 1; // P bit
      +  let Inst{26-27} = {0,0};
       }
       
       
      @@ -212,21 +213,21 @@
         : I {
         let Inst{21-24} = opcod;
      -  let Inst{26-27} = 0;
      +  let Inst{26-27} = {0,0};
       }
       class AsI1 opcod, dag oops, dag iops, Format f, string opc,
                  string asm, list pattern>
         : sI {
         let Inst{21-24} = opcod;
      -  let Inst{26-27} = 0;
      +  let Inst{26-27} = {0,0};
       }
       class AXI1 opcod, dag oops, dag iops, Format f, string asm,
                  list pattern>
         : XI {
         let Inst{21-24} = opcod;
      -  let Inst{26-27} = 0;
      +  let Inst{26-27} = {0,0};
       }
       class AI1x2 opcod, dag oops, dag iops, Format f, string opc,
                   string asm, list pattern>
      @@ -239,7 +240,7 @@
                 string asm, list pattern>
         : I {
      -  let Inst{26-27} = 1;
      +  let Inst{26-27} = {1,0};
       }
       class AXI2 opcod, dag oops, dag iops, Format f, string asm,
                  list pattern>
      @@ -642,7 +643,7 @@
                 string asm, list pattern>
         : I {
      -  let Inst{25-27} = 0x4;
      +  let Inst{25-27} = {0,0,1};
       }
       class AXI4ld opcod, dag oops, dag iops, Format f, string asm,
                  list pattern>
      @@ -650,7 +651,7 @@
              "", pattern> {
         let Inst{20}    = 1; // L bit
         let Inst{22}    = 0; // S bit
      -  let Inst{25-27} = 0x4;
      +  let Inst{25-27} = {0,0,1};
       }
       class AXI4ldpc opcod, dag oops, dag iops, Format f, string asm,
                  list pattern>
      @@ -658,7 +659,7 @@
              "", pattern> {
         let Inst{20}    = 1; // L bit
         let Inst{22}    = 1; // S bit
      -  let Inst{25-27} = 0x4;
      +  let Inst{25-27} = {0,0,1};
       }
       class AXI4st opcod, dag oops, dag iops, Format f, string asm,
                  list pattern>
      @@ -666,7 +667,7 @@
              "", pattern> {
         let Inst{20}    = 0; // L bit
         let Inst{22}    = 0; // S bit
      -  let Inst{25-27} = 0x4;
      +  let Inst{25-27} = {0,0,1};
       }
       
       
      
      
      
      
      From evan.cheng at apple.com  Wed Sep 17 02:53:39 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Wed, 17 Sep 2008 07:53:39 -0000
      Subject: [llvm-commits] [llvm] r56277 - in /llvm/trunk/lib/Target/ARM:
       ARMCodeEmitter.cpp ARMInstrFormats.td ARMInstrInfo.td
      Message-ID: <200809170753.m8H7rdBT007835@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Wed Sep 17 02:53:38 2008
      New Revision: 56277
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56277&view=rev
      Log:
      Fix addrmode1 instruction encodings; fix bx_ret encoding.
      
      Modified:
          llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp
          llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
          llvm/trunk/lib/Target/ARM/ARMInstrInfo.td
      
      Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=56277&r1=56276&r2=56277&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original)
      +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Wed Sep 17 02:53:38 2008
      @@ -260,8 +260,8 @@
           break;
         }
         case ARMII::BranchMisc: {
      -    // Set bit[19:8] to 0xFFF
      -    Binary |= 0xfff << 8;
      +    if (TID.Opcode == ARM::BX)
      +      abort(); // FIXME
           if (TID.Opcode == ARM::BX_RET)
             Binary |= 0xe; // the return register is LR
           else 
      
      Modified: llvm/trunk/lib/Target/ARM/ARMInstrFormats.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td?rev=56277&r1=56276&r2=56277&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/ARM/ARMInstrFormats.td (original)
      +++ llvm/trunk/lib/Target/ARM/ARMInstrFormats.td Wed Sep 17 02:53:38 2008
      @@ -151,13 +151,6 @@
         let Inst{24}    = 1; // L bit
         let Inst{25-27} = {1,0,1};
       }
      -class ABLXI opcod, dag oops, dag iops, Format f, string asm,
      -          list pattern>
      -  : XI {
      -  let Inst{4-7}   = {1,1,0,0};
      -  let Inst{20-27} = {0,1,0,0,1,0,0,0};
      -}
       // FIXME: BX
       class AXIx2 opcod, dag oops, dag iops, Format f, string asm,
                   list pattern>
      
      Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=56277&r1=56276&r2=56277&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original)
      +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Wed Sep 17 02:53:38 2008
      @@ -520,7 +520,11 @@
       //
       
       let isReturn = 1, isTerminator = 1 in
      -  def BX_RET : AI<0x1, (outs), (ins), BranchMisc, "bx", " lr", [(ARMretflag)]>;
      +  def BX_RET : AI<0x0, (outs), (ins), BranchMisc, "bx", " lr", [(ARMretflag)]> {
      +  let Inst{4-7}   = {1,0,0,0};
      +  let Inst{8-19}  = {1,1,1,1,1,1,1,1,1,1,1,1};
      +  let Inst{20-27} = {0,1,0,0,1,0,0,0};
      +}
       
       // FIXME: remove when we have a way to marking a MI with these properties.
       // FIXME: $dst1 should be a def. But the extra ops must be in the end of the
      @@ -543,9 +547,14 @@
                          [(ARMcall_pred tglobaladdr:$func)]>;
       
         // ARMv5T and above
      -  def BLX : ABLXI<0x2, (outs), (ins GPR:$func, variable_ops), BranchMisc,
      +  def BLX : AXI<0x0, (outs), (ins GPR:$func, variable_ops), BranchMisc,
                       "blx $func",
      -                [(ARMcall GPR:$func)]>, Requires<[IsARM, HasV5T]>;
      +                [(ARMcall GPR:$func)]>, Requires<[IsARM, HasV5T]> {
      +    let Inst{4-7}   = {1,1,0,0};
      +    let Inst{8-19}  = {1,1,1,1,1,1,1,1,1,1,1,1};
      +    let Inst{20-27} = {0,1,0,0,1,0,0,0};
      +  }
      +
         let Uses = [LR] in {
           // ARMv4T
           def BX : AXIx2<0x0, (outs), (ins GPR:$func, variable_ops),
      @@ -743,16 +752,16 @@
       //  Move Instructions.
       //
       
      -def MOVr : AsI1<0xD, (outs GPR:$dst), (ins GPR:$src), DPRdReg,
      +def MOVr : AsI1<{1,0,1,1}, (outs GPR:$dst), (ins GPR:$src), DPRdReg,
                        "mov", " $dst, $src", []>;
      -def MOVs : AsI1<0xD, (outs GPR:$dst), (ins so_reg:$src), DPRdSoReg,
      +def MOVs : AsI1<{1,0,1,1}, (outs GPR:$dst), (ins so_reg:$src), DPRdSoReg,
                        "mov", " $dst, $src", [(set GPR:$dst, so_reg:$src)]>;
       
       let isReMaterializable = 1 in
      -def MOVi : AsI1<0xD, (outs GPR:$dst), (ins so_imm:$src), DPRdIm,
      +def MOVi : AsI1<{1,0,1,1}, (outs GPR:$dst), (ins so_imm:$src), DPRdIm,
                        "mov", " $dst, $src", [(set GPR:$dst, so_imm:$src)]>;
       
      -def MOVrx : AsI1<0xD, (outs GPR:$dst), (ins GPR:$src), DPRdMisc,
      +def MOVrx : AsI1<{1,0,1,1}, (outs GPR:$dst), (ins GPR:$src), DPRdMisc,
                        "mov", " $dst, $src, rrx",
                        [(set GPR:$dst, (ARMrrx GPR:$src))]>;
       
      @@ -760,10 +769,10 @@
       // due to flag operands.
       
       let Defs = [CPSR] in {
      -def MOVsrl_flag : AI1<0xD, (outs GPR:$dst), (ins GPR:$src), DPRdMisc,
      +def MOVsrl_flag : AI1<{1,0,1,1}, (outs GPR:$dst), (ins GPR:$src), DPRdMisc,
                             "mov", "s $dst, $src, lsr #1",
                             [(set GPR:$dst, (ARMsrl_flag GPR:$src))]>;
      -def MOVsra_flag : AI1<0xD, (outs GPR:$dst), (ins GPR:$src), DPRdMisc,
      +def MOVsra_flag : AI1<{1,0,1,1}, (outs GPR:$dst), (ins GPR:$src), DPRdMisc,
                             "mov", "s $dst, $src, asr #1",
                             [(set GPR:$dst, (ARMsra_flag GPR:$src))]>;
       }
      @@ -811,42 +820,48 @@
       //  Arithmetic Instructions.
       //
       
      -defm ADD  : AsI1_bin_irs<0x4, "add", BinOpFrag<(add  node:$LHS, node:$RHS)>>;
      -defm SUB  : AsI1_bin_irs<0x2, "sub", BinOpFrag<(sub  node:$LHS, node:$RHS)>>;
      +defm ADD  : AsI1_bin_irs<{0,0,1,0}, "add",
      +                         BinOpFrag<(add  node:$LHS, node:$RHS)>>;
      +defm SUB  : AsI1_bin_irs<{0,1,0,0}, "sub",
      +                         BinOpFrag<(sub  node:$LHS, node:$RHS)>>;
       
       // ADD and SUB with 's' bit set.
      -defm ADDS : ASI1_bin_s_irs<0x4, "add", BinOpFrag<(addc node:$LHS, node:$RHS)>>;
      -defm SUBS : ASI1_bin_s_irs<0x2, "sub", BinOpFrag<(subc node:$LHS, node:$RHS)>>;
      +defm ADDS : ASI1_bin_s_irs<{0,0,1,0}, "add",
      +                           BinOpFrag<(addc node:$LHS, node:$RHS)>>;
      +defm SUBS : ASI1_bin_s_irs<{0,1,0,0}, "sub",
      +                           BinOpFrag<(subc node:$LHS, node:$RHS)>>;
       
       // FIXME: Do not allow ADC / SBC to be predicated for now.
      -defm ADC  : AsXI1_bin_c_irs<0x5, "adc", BinOpFrag<(adde node:$LHS, node:$RHS)>>;
      -defm SBC  : AsXI1_bin_c_irs<0x6, "sbc", BinOpFrag<(sube node:$LHS, node:$RHS)>>;
      +defm ADC  : AsXI1_bin_c_irs<{1,0,1,0}, "adc",
      +                            BinOpFrag<(adde node:$LHS, node:$RHS)>>;
      +defm SBC  : AsXI1_bin_c_irs<{0,1,1,0}, "sbc",
      +                            BinOpFrag<(sube node:$LHS, node:$RHS)>>;
       
       // These don't define reg/reg forms, because they are handled above.
      -def RSBri : AsI1<0x3, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPRIm,
      +def RSBri : AsI1<{1,1,0,0}, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPRIm,
                         "rsb", " $dst, $a, $b",
                         [(set GPR:$dst, (sub so_imm:$b, GPR:$a))]>;
       
      -def RSBrs : AsI1<0x3, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPRSoReg,
      +def RSBrs : AsI1<{1,1,0,0}, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPRSoReg,
                         "rsb", " $dst, $a, $b",
                         [(set GPR:$dst, (sub so_reg:$b, GPR:$a))]>;
       
       // RSB with 's' bit set.
       let Defs = [CPSR] in {
      -def RSBSri : AI1<0x3, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPRIm,
      +def RSBSri : AI1<{1,1,0,0}, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPRIm,
                        "rsb", "s $dst, $a, $b",
                        [(set GPR:$dst, (subc so_imm:$b, GPR:$a))]>;
      -def RSBSrs : AI1<0x3, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPRSoReg,
      +def RSBSrs : AI1<{1,1,0,0}, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPRSoReg,
                        "rsb", "s $dst, $a, $b",
                        [(set GPR:$dst, (subc so_reg:$b, GPR:$a))]>;
       }
       
       // FIXME: Do not allow RSC to be predicated for now. But they can set CPSR.
       let Uses = [CPSR] in {
      -def RSCri : AXI1<0x7, (outs GPR:$dst), (ins GPR:$a, so_imm:$b, cc_out:$s),
      +def RSCri : AXI1<{1,1,1,0}, (outs GPR:$dst), (ins GPR:$a, so_imm:$b, cc_out:$s),
                        DPRIm, "rsc${s} $dst, $a, $b",
                        [(set GPR:$dst, (sube so_imm:$b, GPR:$a))]>;
      -def RSCrs : AXI1<0x7, (outs GPR:$dst), (ins GPR:$a, so_reg:$b, cc_out:$s),
      +def RSCrs : AXI1<{1,1,1,0}, (outs GPR:$dst), (ins GPR:$a, so_reg:$b, cc_out:$s),
                        DPRSoReg, "rsc${s} $dst, $a, $b",
                        [(set GPR:$dst, (sube so_reg:$b, GPR:$a))]>;
       }
      @@ -871,17 +886,21 @@
       //  Bitwise Instructions.
       //
       
      -defm AND   : AsI1_bin_irs<0x0, "and", BinOpFrag<(and node:$LHS, node:$RHS)>>;
      -defm ORR   : AsI1_bin_irs<0xC, "orr", BinOpFrag<(or  node:$LHS, node:$RHS)>>;
      -defm EOR   : AsI1_bin_irs<0x1, "eor", BinOpFrag<(xor node:$LHS, node:$RHS)>>;
      -defm BIC   : AsI1_bin_irs<0xE, "bic", BinOpFrag<(and node:$LHS, (not node:$RHS))>>;
      +defm AND   : AsI1_bin_irs<{0,0,0,0}, "and",
      +                          BinOpFrag<(and node:$LHS, node:$RHS)>>;
      +defm ORR   : AsI1_bin_irs<{0,0,1,1}, "orr",
      +                          BinOpFrag<(or  node:$LHS, node:$RHS)>>;
      +defm EOR   : AsI1_bin_irs<{1,0,0,0}, "eor",
      +                          BinOpFrag<(xor node:$LHS, node:$RHS)>>;
      +defm BIC   : AsI1_bin_irs<{0,1,1,1}, "bic",
      +                          BinOpFrag<(and node:$LHS, (not node:$RHS))>>;
       
      -def  MVNr  : AsI1<0xE, (outs GPR:$dst), (ins GPR:$src), DPRdReg,
      +def  MVNr  : AsI1<{1,1,1,1}, (outs GPR:$dst), (ins GPR:$src), DPRdReg,
                         "mvn", " $dst, $src", [(set GPR:$dst, (not GPR:$src))]>;
      -def  MVNs  : AsI1<0xE, (outs GPR:$dst), (ins so_reg:$src), DPRdSoReg,
      +def  MVNs  : AsI1<{1,1,1,1}, (outs GPR:$dst), (ins so_reg:$src), DPRdSoReg,
                         "mvn", " $dst, $src", [(set GPR:$dst, (not so_reg:$src))]>;
       let isReMaterializable = 1 in
      -def  MVNi  : AsI1<0xE, (outs GPR:$dst), (ins so_imm:$imm), DPRdIm,
      +def  MVNi  : AsI1<{1,1,1,1}, (outs GPR:$dst), (ins so_imm:$imm), DPRdIm,
                         "mvn", " $dst, $imm", [(set GPR:$dst, so_imm_not:$imm)]>;
       
       def : ARMPat<(and   GPR:$src, so_imm_not:$imm),
      
      
      
      
      From paul at rapidmind.com  Wed Sep 17 09:50:45 2008
      From: paul at rapidmind.com (Paul Redmond)
      Date: Wed, 17 Sep 2008 10:50:45 -0400
      Subject: [llvm-commits] [PATCH] align constant pool loads
       using	preferred alignment
      In-Reply-To: <28743604-0ED1-4A68-B934-9BFFE496C1FB@apple.com>
      References: <48CFF5CD.5050102@rapidmind.com>
      	<28743604-0ED1-4A68-B934-9BFFE496C1FB@apple.com>
      Message-ID: <48D11945.2080105@rapidmind.com>
      
      Dan Gohman wrote:
      > I was surprised to see that ConstantPoolSDNode's alignment
      > argument is a log2 value, but that apparently what that
      > code is expecting.
      >   
      I made that mistake at first. Perhaps getAlignment can be renamed 
      getAlignmentShift?
      > It looks like the code in ScheduleDAGEmit.cpp that handles
      > the alignment==0 case for ConstantPoolSDNode is no longer
      > needed. Does that seem right to you?
      >   
      Yes, I believe that can be removed.
      
      Paul
      
      
      From gohman at apple.com  Wed Sep 17 10:25:51 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Wed, 17 Sep 2008 15:25:51 -0000
      Subject: [llvm-commits] [llvm] r56281 -
      	/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
      Message-ID: <200809171525.m8HFPqTW000565@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Wed Sep 17 10:25:49 2008
      New Revision: 56281
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56281&view=rev
      Log:
      Don't worry about clobbering physical register defs that aren't used.
      
      Modified:
          llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=56281&r1=56280&r2=56281&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Wed Sep 17 10:25:49 2008
      @@ -1709,6 +1709,8 @@
           MVT VT = N->getValueType(i);
           if (VT == MVT::Flag || VT == MVT::Other)
             continue;
      +    if (!N->hasAnyUseOfValue(i))
      +      continue;
           unsigned Reg = ImpDefs[i - NumDefs];
           for (;*SUImpDefs; ++SUImpDefs) {
             unsigned SUReg = *SUImpDefs;
      
      
      
      
      From dpatel at apple.com  Wed Sep 17 11:01:42 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Wed, 17 Sep 2008 16:01:42 -0000
      Subject: [llvm-commits] [llvm] r56282 - /llvm/trunk/tools/opt/opt.cpp
      Message-ID: <200809171601.m8HG1gh4001826@zion.cs.uiuc.edu>
      
      Author: dpatel
      Date: Wed Sep 17 11:01:39 2008
      New Revision: 56282
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56282&view=rev
      Log:
      Fix comments, help messages.
      
      Modified:
          llvm/trunk/tools/opt/opt.cpp
      
      Modified: llvm/trunk/tools/opt/opt.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=56282&r1=56281&r2=56282&view=diff
      
      ==============================================================================
      --- llvm/trunk/tools/opt/opt.cpp (original)
      +++ llvm/trunk/tools/opt/opt.cpp Wed Sep 17 11:01:39 2008
      @@ -99,11 +99,11 @@
       
       static cl::opt
       UnitAtATime("funit-at-a-time",
      -            cl::desc("Enable IPO. This is same is llvm-gcc's -funit-at-a-time"));
      +            cl::desc("Enable IPO. This is same as llvm-gcc's -funit-at-a-time"));
       
       static cl::opt
       DisableSimplifyLibCalls("disable-simplify-libcalls",
      -                        cl::desc("Disable simplify libcalls"));
      +                        cl::desc("Disable simplify-libcalls"));
       
       static cl::opt
       Quiet("q", cl::desc("Obsolete option"), cl::Hidden);
      @@ -263,8 +263,6 @@
       /// duplicates llvm-gcc behaviour.
       ///
       /// OptLevel - Optimization Level
      -/// PruneEH - Add PruneEHPass, if set.
      -/// UnrollLoop - Unroll loops, if set.
         void AddOptimizationPasses(PassManager &MPM, FunctionPassManager &FPM,
                                    unsigned OptLevel) {
       
      
      
      
      
      From dpatel at apple.com  Wed Sep 17 11:05:41 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Wed, 17 Sep 2008 09:05:41 -0700
      Subject: [llvm-commits] [llvm] r56255 - /llvm/trunk/tools/opt/opt.cpp
      In-Reply-To: <200809170820.50181.baldrick@free.fr>
      References: <200809162225.m8GMPEhG014334@zion.cs.uiuc.edu>
      	<200809170820.50181.baldrick@free.fr>
      Message-ID: <6D3040B2-EA0A-43C4-9A34-0DDE4B94471F@apple.com>
      
      
      On Sep 16, 2008, at 11:20 PM, Duncan Sands wrote:
      
      > Hi Devang,
      >
      >> +            cl::desc("Enable IPO. This is same is llvm-gcc's - 
      >> funit-at-a-time"));
      >
      > This is same is -> This is the same as
      
      fixed
      
      >
      >> +DisableSimplifyLibCalls("disable-simplify-libcalls",
      >> +                        cl::desc("Disable simplify libcalls"));
      >
      > The pass name has a hyphen, so how about: Disable simplify-libcalls
      
      ok :)
      
      >
      >
      >> +/// PruneEH - Add PruneEHPass, if set.
      >
      > This line can go.
      
      gone
      
      >> +/// UnrollLoop - Unroll loops, if set.
      >
      > This doesn't seem to exist.
      
      fixed.
      
      > Also, to decrease code duplication, how about:
      > (1) have -std-compile-opts call this with -O3 and IPO
      > rather than scheduling it's own list of passes,
      
      Feel free.
      
      > (2) stick this in a library somewhere and have llvm-gcc use it too.
      
      I tried. Remember PassManagerUtils.cpp's short lived existence ? :)  
      This causes circular dependencies, unless you create a separate new  
      library for just one routine. Feel free to fix this, if you're  
      inclined to do so. Extra bonus points if you also cover pass sequence  
      selection from llvm-ld and lto :)
      
      -
      Devang
      
      
      
      From ggreif at gmail.com  Wed Sep 17 11:41:58 2008
      From: ggreif at gmail.com (Gabor Greif)
      Date: Wed, 17 Sep 2008 16:41:58 -0000
      Subject: [llvm-commits] [llvm] r56283 -
      	/llvm/branches/ggreif/use-diet/lib/VMCore/Value.cpp
      Message-ID: <200809171641.m8HGfwAx003671@zion.cs.uiuc.edu>
      
      Author: ggreif
      Date: Wed Sep 17 11:41:57 2008
      New Revision: 56283
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56283&view=rev
      Log:
      fix dereferencing of tagged pointer
      
      Modified:
          llvm/branches/ggreif/use-diet/lib/VMCore/Value.cpp
      
      Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Value.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/Value.cpp?rev=56283&r1=56282&r2=56283&view=diff
      
      ==============================================================================
      --- llvm/branches/ggreif/use-diet/lib/VMCore/Value.cpp (original)
      +++ llvm/branches/ggreif/use-diet/lib/VMCore/Value.cpp Wed Sep 17 11:41:57 2008
      @@ -287,7 +287,7 @@
       //
       void Value::uncheckedReplaceAllUsesWith(Value *New) {
         while (!use_empty()) {
      -    Use &U = *UseList;
      +    Use &U = *use_begin().U;
           // Must handle Constants specially, we cannot call replaceUsesOfWith on a
           // constant because they are uniqued.
           if (Constant *C = dyn_cast(U.getUser())) {
      
      
      
      
      From dpatel at apple.com  Wed Sep 17 12:53:50 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Wed, 17 Sep 2008 17:53:50 -0000
      Subject: [llvm-commits] [llvm] r56284 - in /llvm/trunk:
       lib/Transforms/Scalar/LoopIndexSplit.cpp
       test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll
       test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll
       test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll
      Message-ID: <200809171753.m8HHroKb006520@zion.cs.uiuc.edu>
      
      Author: dpatel
      Date: Wed Sep 17 12:53:47 2008
      New Revision: 56284
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56284&view=rev
      Log:
      Do not ignore iv uses outside the loop.
      This one slipped through cracks very well.
      
      Added:
          llvm/trunk/test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll
      Modified:
          llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
          llvm/trunk/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll
          llvm/trunk/test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll
      
      Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=56284&r1=56283&r2=56284&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
      +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Wed Sep 17 12:53:47 2008
      @@ -111,6 +111,10 @@
           /// instruction then loop body is executed only for one iteration. In
           /// such case eliminate loop structure surrounding this loop body. For
           bool processOneIterationLoop(SplitInfo &SD);
      +    
      +    /// isOneIterationLoop - Return true if split condition is EQ and 
      +    /// the IV is not used outside the loop.
      +    bool isOneIterationLoop(ICmpInst *CI);
       
           void updateLoopBounds(ICmpInst *CI);
           /// updateLoopIterationSpace - Current loop body is covered by an AND
      @@ -248,7 +252,7 @@
               SI = SplitData.erase(Delete_SI);
             }
           }
      -    else if (CI && CI->getPredicate() == ICmpInst::ICMP_EQ) {
      +    else if (isOneIterationLoop(CI)) {
             Changed = processOneIterationLoop(SD);
             if (Changed) {
               ++NumIndexSplit;
      @@ -276,6 +280,22 @@
         return Changed;
       }
       
      +/// isOneIterationLoop - Return true if split condition is EQ and 
      +/// the IV is not used outside the loop.
      +bool LoopIndexSplit::isOneIterationLoop(ICmpInst *CI) {
      +  if (!CI)
      +    return false;
      +  if (CI->getPredicate() != ICmpInst::ICMP_EQ)
      +    return false;
      +
      +  Value *Incr = IndVar->getIncomingValueForBlock(L->getLoopLatch());
      +  for (Value::use_iterator UI = Incr->use_begin(), E = Incr->use_end(); 
      +       UI != E; ++UI)
      +    if (!L->contains(cast(*UI)->getParent()))
      +      return false;
      +
      +  return true;
      +}
       /// Return true if V is a induction variable or induction variable's
       /// increment for loop L.
       void LoopIndexSplit::findIndVar(Value *V, Loop *L) {
      
      Modified: llvm/trunk/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll?rev=56284&r1=56283&r2=56284&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll (original)
      +++ llvm/trunk/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll Wed Sep 17 12:53:47 2008
      @@ -1,5 +1,4 @@
      -; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | grep tmp8 | count 3
      -; count 3 = increment + phi + store
      +; RUN: llvm-as < %s | opt -loop-index-split -stats -disable-output | not grep "loop-index-split"
       ;PR2294
       @g_2 = external global i16		;  [#uses=4]
       @g_5 = external global i32		;  [#uses=1]
      
      Added: llvm/trunk/test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll?rev=56284&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll (added)
      +++ llvm/trunk/test/Transforms/LoopIndexSplit/2008-09-17-IVUse.ll Wed Sep 17 12:53:47 2008
      @@ -0,0 +1,78 @@
      +; RUN: llvm-as < %s | opt -loop-index-split -stats -disable-output | not grep "loop-index-split"
      +; PR 2791
      + at g_40 = common global i32 0		;  [#uses=1]
      + at g_192 = common global i32 0		;  [#uses=2]
      +@"\01LC" = internal constant [4 x i8] c"%d\0A\00"		; <[4 x i8]*> [#uses=1]
      +
      +define void @func_29() nounwind {
      +entry:
      +	%0 = load i32* @g_40, align 4		;  [#uses=1]
      +	%1 = icmp eq i32 %0, 0		;  [#uses=1]
      +	%g_192.promoted = load i32* @g_192		;  [#uses=0]
      +	br i1 %1, label %entry.split.us, label %entry.split
      +
      +entry.split.us:		; preds = %entry
      +	br label %bb.us
      +
      +bb.us:		; preds = %bb5.us, %entry.split.us
      +	%i.0.reg2mem.0.us = phi i32 [ 0, %entry.split.us ], [ %3, %bb5.us ]		;  [#uses=2]
      +	%2 = icmp eq i32 %i.0.reg2mem.0.us, 0		;  [#uses=1]
      +	br i1 %2, label %bb1.us, label %bb5.us
      +
      +bb5.us:		; preds = %bb1.us, %bb4.us, %bb.us
      +	%iftmp.0.0.us = phi i32 [ 0, %bb4.us ], [ 1, %bb.us ], [ 1, %bb1.us ]		;  [#uses=1]
      +	%3 = add i32 %i.0.reg2mem.0.us, 1		;  [#uses=3]
      +	%4 = icmp ult i32 %3, 10		;  [#uses=1]
      +	br i1 %4, label %bb.us, label %bb8.us
      +
      +bb4.us:		; preds = %bb1.us
      +	br label %bb5.us
      +
      +bb1.us:		; preds = %bb.us
      +	br i1 true, label %bb4.us, label %bb5.us
      +
      +bb8.us:		; preds = %bb5.us
      +	%iftmp.0.0.lcssa.us = phi i32 [ %iftmp.0.0.us, %bb5.us ]		;  [#uses=1]
      +	%.lcssa.us = phi i32 [ %3, %bb5.us ]		;  [#uses=1]
      +	br label %bb8.split
      +
      +entry.split:		; preds = %entry
      +	br label %bb
      +
      +bb:		; preds = %bb5, %entry.split
      +	%i.0.reg2mem.0 = phi i32 [ 0, %entry.split ], [ %6, %bb5 ]		;  [#uses=2]
      +	%5 = icmp eq i32 %i.0.reg2mem.0, 0		;  [#uses=1]
      +	br i1 %5, label %bb1, label %bb5
      +
      +bb1:		; preds = %bb
      +	br i1 false, label %bb4, label %bb5
      +
      +bb4:		; preds = %bb1
      +	br label %bb5
      +
      +bb5:		; preds = %bb1, %bb, %bb4
      +	%iftmp.0.0 = phi i32 [ 0, %bb4 ], [ 1, %bb ], [ 1, %bb1 ]		;  [#uses=1]
      +	%6 = add i32 %i.0.reg2mem.0, 1		;  [#uses=3]
      +	%7 = icmp ult i32 %6, 10		;  [#uses=1]
      +	br i1 %7, label %bb, label %bb8
      +
      +bb8:		; preds = %bb5
      +	%iftmp.0.0.lcssa = phi i32 [ %iftmp.0.0, %bb5 ]		;  [#uses=1]
      +	%.lcssa = phi i32 [ %6, %bb5 ]		;  [#uses=1]
      +	br label %bb8.split
      +
      +bb8.split:		; preds = %bb8.us, %bb8
      +	%iftmp.0.0.lcssa.us-lcssa = phi i32 [ %iftmp.0.0.lcssa, %bb8 ], [ %iftmp.0.0.lcssa.us, %bb8.us ]		;  [#uses=1]
      +	%.lcssa.us-lcssa = phi i32 [ %.lcssa, %bb8 ], [ %.lcssa.us, %bb8.us ]		;  [#uses=1]
      +	store i32 %iftmp.0.0.lcssa.us-lcssa, i32* @g_192
      +	%8 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @"\01LC", i32 0, i32 0), i32 %.lcssa.us-lcssa ) nounwind		;  [#uses=0]
      +	ret void
      +}
      +
      +declare i32 @printf(i8*, ...) nounwind
      +
      +define i32 @main() nounwind {
      +entry:
      +	call void @func_29( ) nounwind
      +	ret i32 0
      +}
      
      Modified: llvm/trunk/test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll?rev=56284&r1=56283&r2=56284&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll (original)
      +++ llvm/trunk/test/Transforms/LoopIndexSplit/OneIterLoop3-2007-08-17.ll Wed Sep 17 12:53:47 2008
      @@ -1,6 +1,5 @@
       ; Loop is elimianted. Save last value assignments, including induction variable.
      -; RUN: llvm-as < %s | opt -loop-index-split -disable-output -stats |& \
      -; RUN: grep "loop-index-split" | count 1
      +; RUN: llvm-as < %s | opt -loop-index-split -disable-output -stats | not grep "loop-index-split"
       
       declare i32 @foo(i32)
       declare i32 @bar(i32, i32)
      
      
      
      
      From dpatel at apple.com  Wed Sep 17 13:21:49 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Wed, 17 Sep 2008 18:21:49 -0000
      Subject: [llvm-commits] [llvm] r56286 - in /llvm/trunk:
       lib/Transforms/Utils/SimplifyCFG.cpp
       test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll
      Message-ID: <200809171821.m8HILowg007540@zion.cs.uiuc.edu>
      
      Author: dpatel
      Date: Wed Sep 17 13:21:49 2008
      New Revision: 56286
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56286&view=rev
      Log:
      Do not hoist instruction above branch condition. The instruction may use branch condition.
      
      Added:
          llvm/trunk/test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll
      Modified:
          llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
      
      Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=56286&r1=56285&r2=56286&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
      +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Wed Sep 17 13:21:49 2008
      @@ -1046,15 +1046,8 @@
             return false;
         }
       
      -  // If we get here, we can hoist the instruction. Try to place it before the
      -  // icmp instruction preceeding the conditional branch.
      -  BasicBlock::iterator InsertPos = BI;
      -  if (InsertPos != BIParent->begin())
      -    --InsertPos;
      -  if (InsertPos == BrCond && !isa(BrCond))
      -    BIParent->getInstList().splice(InsertPos, BB1->getInstList(), I);
      -  else
      -    BIParent->getInstList().splice(BI, BB1->getInstList(), I);
      +  // If we get here, we can hoist the instruction. 
      +  BIParent->getInstList().splice(BI, BB1->getInstList(), I);
       
         // Create a select whose true value is the speculatively executed value and
         // false value is the previously determined FalseV.
      
      Added: llvm/trunk/test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll?rev=56286&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll (added)
      +++ llvm/trunk/test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll Wed Sep 17 13:21:49 2008
      @@ -0,0 +1,18 @@
      +; RUN: llvm-as < %s | opt -simplifycfg -disable-output
      +; PR 2800
      +
      +define void @foo() {
      +start:
      +	%tmp = call i1 @bar( )		;  [#uses=4]
      +	br i1 %tmp, label %brtrue, label %brfalse
      +
      +brtrue:		; preds = %start
      +	%tmpnew = and i1 %tmp, %tmp		;  [#uses=1]
      +	br label %brfalse
      +
      +brfalse:		; preds = %brtrue, %start
      +	%andandtmp.0 = phi i1 [ %tmp, %start ], [ %tmpnew, %brtrue ]		;  [#uses=0]
      +	ret void
      +}
      +
      +declare i1 @bar()
      
      
      
      
      From evan.cheng at apple.com  Wed Sep 17 13:36:25 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Wed, 17 Sep 2008 18:36:25 -0000
      Subject: [llvm-commits] [llvm] r56287 - in /llvm/trunk:
       lib/CodeGen/SimpleRegisterCoalescing.cpp
       test/CodeGen/ARM/2008-09-17-CoalescerBug.ll
      Message-ID: <200809171836.m8HIaQSa008115@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Wed Sep 17 13:36:25 2008
      New Revision: 56287
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56287&view=rev
      Log:
      Unallocatable registers do not have live intervals.
      
      Added:
          llvm/trunk/test/CodeGen/ARM/2008-09-17-CoalescerBug.ll
      Modified:
          llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=56287&r1=56286&r2=56287&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Wed Sep 17 13:36:25 2008
      @@ -568,7 +568,9 @@
           unsigned CopySrcReg, CopyDstReg;
           if (TID.getNumDefs() == 1 && TID.getNumOperands() > 2 &&
               tii_->isMoveInstr(*UseMI, CopySrcReg, CopyDstReg) &&
      -        CopySrcReg != CopyDstReg) {
      +        CopySrcReg != CopyDstReg &&
      +        (TargetRegisterInfo::isVirtualRegister(CopyDstReg) ||
      +         allocatableRegs_[CopyDstReg])) {
             LiveInterval &LI = li_->getInterval(CopyDstReg);
             unsigned DefIdx = li_->getDefIndex(li_->getInstructionIndex(UseMI));
             const LiveRange *DLR = LI.getLiveRangeContaining(DefIdx);
      
      Added: llvm/trunk/test/CodeGen/ARM/2008-09-17-CoalescerBug.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2008-09-17-CoalescerBug.ll?rev=56287&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/ARM/2008-09-17-CoalescerBug.ll (added)
      +++ llvm/trunk/test/CodeGen/ARM/2008-09-17-CoalescerBug.ll Wed Sep 17 13:36:25 2008
      @@ -0,0 +1,17 @@
      +; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin
      +
      +define void @gcov_exit() nounwind {
      +entry:
      +	br i1 false, label %bb24, label %bb33.thread
      +
      +bb24:		; preds = %entry
      +	br label %bb39
      +
      +bb33.thread:		; preds = %entry
      +	%0 = alloca i8, i32 0		;  [#uses=1]
      +	br label %bb39
      +
      +bb39:		; preds = %bb33.thread, %bb24
      +	%.reg2mem.0 = phi i8* [ %0, %bb33.thread ], [ null, %bb24 ]		;  [#uses=0]
      +	ret void
      +}
      
      
      
      
      From isanbard at gmail.com  Wed Sep 17 14:34:51 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Wed, 17 Sep 2008 12:34:51 -0700
      Subject: [llvm-commits] [llvm] r56267 - in /llvm/trunk:
      	lib/Target/PowerPC/PPCISelLowering.cpp
      	lib/Target/PowerPC/PPCISelLowering.h
      	test/CodeGen/PowerPC/trampoline.ll
      In-Reply-To: <200809170828.25481.baldrick@free.fr>
      References: <200809170030.m8H0UvXK018801@zion.cs.uiuc.edu>
      	<200809170828.25481.baldrick@free.fr>
      Message-ID: <16e5fdf90809171234g26b712b8m4914a08278a9b76d@mail.gmail.com>
      
      On Tue, Sep 16, 2008 at 11:28 PM, Duncan Sands  wrote:
      > Hi Bill,
      >
      >> Add trampoline support to PPC. GCC simply calls the "__trampoline_setup"
      >> function with appropriate parameters. This allows us to support blocks on PPC.
      >
      > glad to see trampolines coming in useful!  I was surprised to see
      > this though: I thought the whole point of blocks is that it doesn't
      > need trampolines...
      >
      It might be an implementation detail for PPC. I need to check with the
      person who implemented it in our GCC branch to see if this was
      intentional...
      
      -bw
      
      
      From clattner at apple.com  Wed Sep 17 16:09:13 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Wed, 17 Sep 2008 14:09:13 -0700
      Subject: [llvm-commits] [llvm] r56267 - in /llvm/trunk:
      	lib/Target/PowerPC/PPCISelLowering.cpp	lib/Target/PowerPC/PPCISelLowering.h
      	test/CodeGen/PowerPC/trampoline.ll
      In-Reply-To: <16e5fdf90809171234g26b712b8m4914a08278a9b76d@mail.gmail.com>
      References: <200809170030.m8H0UvXK018801@zion.cs.uiuc.edu>
      	<200809170828.25481.baldrick@free.fr>
      	<16e5fdf90809171234g26b712b8m4914a08278a9b76d@mail.gmail.com>
      Message-ID: <73929CF6-CB25-437C-A5A6-44EEA41E7024@apple.com>
      
      
      On Sep 17, 2008, at 12:34 PM, Bill Wendling wrote:
      
      > On Tue, Sep 16, 2008 at 11:28 PM, Duncan Sands   
      > wrote:
      >> Hi Bill,
      >>
      >>> Add trampoline support to PPC. GCC simply calls the  
      >>> "__trampoline_setup"
      >>> function with appropriate parameters. This allows us to support  
      >>> blocks on PPC.
      >>
      >> glad to see trampolines coming in useful!  I was surprised to see
      >> this though: I thought the whole point of blocks is that it doesn't
      >> need trampolines...
      >>
      > It might be an implementation detail for PPC. I need to check with the
      > person who implemented it in our GCC branch to see if this was
      > intentional...
      
      This was a bug that has already been fixed in the apple gcc, we just  
      haven't merged in the fix yet.  Blocks are implemented internally with  
      the same GCC machinery that nested functions use, but trampolines  
      should never ever be generated.
      
      -Chris
      
      
      
      From dalej at apple.com  Wed Sep 17 16:13:12 2008
      From: dalej at apple.com (Dale Johannesen)
      Date: Wed, 17 Sep 2008 21:13:12 -0000
      Subject: [llvm-commits] [llvm] r56290 - in /llvm/trunk:
       include/llvm/CodeGen/LiveIntervalAnalysis.h
       include/llvm/CodeGen/MachineOperand.h include/llvm/CodeGen/ScheduleDAG.h
       lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/LiveIntervalAnalysis.cpp
       lib/CodeGen/MachineInstr.cpp lib/CodeGen/RegAllocLinearScan.cpp
       lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
       lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
       lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
       test/CodeGen/X86/2008-09-17-inline-asm-1.ll
      Message-ID: <200809172113.m8HLDDWK014018@zion.cs.uiuc.edu>
      
      Author: johannes
      Date: Wed Sep 17 16:13:11 2008
      New Revision: 56290
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56290&view=rev
      Log:
      Add a bit to mark operands of asm's that conflict
      with an earlyclobber operand elsewhere.  Propagate
      this bit and the earlyclobber bit through SDISel.
      Change linear-scan RA not to allocate regs in a way 
      that conflicts with an earlyclobber.  See also comments.
      
      
      Added:
          llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll
      Modified:
          llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
          llvm/trunk/include/llvm/CodeGen/MachineOperand.h
          llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
          llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
          llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
          llvm/trunk/lib/CodeGen/MachineInstr.cpp
          llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
      
      Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=56290&r1=56289&r2=56290&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Wed Sep 17 16:13:11 2008
      @@ -28,6 +28,7 @@
       #include "llvm/ADT/SmallVector.h"
       #include "llvm/Support/Allocator.h"
       #include 
      +#include 
       
       namespace llvm {
       
      @@ -64,6 +65,22 @@
           AliasAnalysis *aa_;
           LiveVariables* lv_;
       
      +    /// AsmsWithEarlyClobber - maps a virtual register number to all the
      +    /// inline asm's that have the register marked earlyclobber.
      +    /// 
      +    std::multimap AsmsThatEarlyClobber;
      +
      +    /// AsmsWithEarlyClobberConflict - maps a virtual register number
      +    /// to all the inline asm's that have earlyclobber operands elsewhere
      +    /// and use the register as a (non-earlyclobber) input.
      +    ///
      +    /// Note: earlyclobber operands may not be assigned the same register as
      +    /// each other, or as earlyclobber-conflict operands.  However two
      +    /// earlyclobber-conflict operands may be assigned the same register if
      +    /// they happen to contain the same value.
      +    /// 
      +    std::multimap AsmsWithEarlyClobberConflict;
      +
           /// Special pool allocator for VNInfo's (LiveInterval val#).
           ///
           BumpPtrAllocator VNInfoAllocator;
      @@ -336,6 +353,11 @@
           unsigned getNumConflictsWithPhysReg(const LiveInterval &li,
                                               unsigned PhysReg) const;
       
      +    /// noEarlyclobberConflict - see whether virtual reg VReg has a conflict
      +    /// with hard reg HReg because HReg is used as an earlyclobber register in
      +    /// asm that also has VReg live into or across it.
      +    bool noEarlyclobberConflict(unsigned VReg, VirtRegMap &vrm, unsigned HReg);
      +
           /// computeNumbering - Compute the index numbering.
           void computeNumbering();
       
      
      Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=56290&r1=56289&r2=56290&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Wed Sep 17 16:13:11 2008
      @@ -73,6 +73,12 @@
         /// for description of earlyclobber.
         bool IsEarlyClobber : 1;
       
      +  /// OverlapsEarlyClobber - True if this MO_Register operand is used as an
      +  /// input to an inline asm that has the earlyclobber bit set on some other
      +  /// operand.  Flag is not valid for any other case.   See gcc doc
      +  /// for description of earlyclobber.
      +  bool OverlapsEarlyClobber : 1;
      +
         /// SubReg - Subregister number, only valid for MO_Register.  A value of 0
         /// indicates the MO_Register has no subReg.
         unsigned char SubReg;
      @@ -182,6 +188,11 @@
           return IsEarlyClobber;
         }
       
      +  bool overlapsEarlyClobber() const {
      +    assert(isRegister() && "Wrong MachineOperand accessor");
      +    return OverlapsEarlyClobber;
      +  }
      +
         /// getNextOperandForReg - Return the next MachineOperand in the function that
         /// uses or defines this register.
         MachineOperand *getNextOperandForReg() const {
      @@ -232,6 +243,11 @@
           IsEarlyClobber = Val;
         }
       
      +  void setOverlapsEarlyClobber(bool Val = true) {
      +    assert(isRegister() && "Wrong MachineOperand accessor");
      +    OverlapsEarlyClobber = Val;
      +  }
      +
         //===--------------------------------------------------------------------===//
         // Accessors for various operand types.
         //===--------------------------------------------------------------------===//
      @@ -337,13 +353,15 @@
         static MachineOperand CreateReg(unsigned Reg, bool isDef, bool isImp = false,
                                         bool isKill = false, bool isDead = false,
                                         unsigned SubReg = 0,
      -                                  bool isEarlyClobber = false) {
      +                                  bool isEarlyClobber = false,
      +                                  bool overlapsEarlyClobber = false) {
           MachineOperand Op(MachineOperand::MO_Register);
           Op.IsDef = isDef;
           Op.IsImp = isImp;
           Op.IsKill = isKill;
           Op.IsDead = isDead;
           Op.IsEarlyClobber = isEarlyClobber;
      +    Op.OverlapsEarlyClobber = overlapsEarlyClobber;
           Op.Contents.Reg.RegNo = Reg;
           Op.Contents.Reg.Prev = 0;
           Op.Contents.Reg.Next = 0;
      @@ -390,6 +408,7 @@
           IsKill   = MO.IsKill;
           IsDead   = MO.IsDead;
           IsEarlyClobber = MO.IsEarlyClobber;
      +    OverlapsEarlyClobber = MO.OverlapsEarlyClobber;
           SubReg   = MO.SubReg;
           ParentMI = MO.ParentMI;
           Contents = MO.Contents;
      
      Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=56290&r1=56289&r2=56290&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Wed Sep 17 16:13:11 2008
      @@ -361,7 +361,8 @@
       
           void AddOperand(MachineInstr *MI, SDValue Op, unsigned IIOpNum,
                           const TargetInstrDesc *II,
      -                    DenseMap &VRBaseMap);
      +                    DenseMap &VRBaseMap,
      +                    bool overlapsEarlyClobber = false);
       
           void AddMemOperand(MachineInstr *MI, const MachineMemOperand &MO);
       
      
      Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=56290&r1=56289&r2=56290&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
      +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Sep 17 16:13:11 2008
      @@ -1325,7 +1325,8 @@
                                        false, false, false);
                 else {
                   AsmPrinter *AP = const_cast(this);
      -            if ((OpFlags & 7) == 4 /*ADDR MODE*/) {
      +            if ((OpFlags & 7) == 4 /*ADDR MODE*/ ||
      +                (OpFlags & 7) == 7) /*ADDR MODE OVERLAPS EARLYCLOBBER*/ {
                     Error = AP->PrintAsmMemoryOperand(MI, OpNo, AsmPrinterVariant,
                                                       Modifier[0] ? Modifier : 0);
                   } else {
      
      Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=56290&r1=56289&r2=56290&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
      +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Sep 17 16:13:11 2008
      @@ -673,7 +673,10 @@
       /// registers. for some ordering of the machine instructions [1,N] a
       /// live interval is an interval [i, j) where 1 <= i <= j < N for
       /// which a variable is live
      -void LiveIntervals::computeIntervals() {
      +void LiveIntervals::computeIntervals() { 
      +  AsmsThatEarlyClobber.clear();
      +  AsmsWithEarlyClobberConflict.clear();
      +
         DOUT << "********** COMPUTING LIVE INTERVALS **********\n"
              << "********** Function: "
              << ((Value*)mf_->getFunction())->getName() << '\n';
      @@ -710,8 +713,17 @@
             for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
               MachineOperand &MO = MI->getOperand(i);
               // handle register defs - build intervals
      -        if (MO.isRegister() && MO.getReg() && MO.isDef())
      +        if (MO.isRegister() && MO.getReg() && MO.isDef()) {
                 handleRegisterDef(MBB, MI, MIIndex, MO, i);
      +          if (MO.isEarlyClobber()) {
      +            AsmsThatEarlyClobber.insert(std::make_pair(MO.getReg(), MI));
      +          }
      +        }
      +        if (MO.isRegister() && !MO.isDef() &&
      +            MO.getReg() && TargetRegisterInfo::isVirtualRegister(MO.getReg()) &&
      +            MO.overlapsEarlyClobber()) {
      +          AsmsWithEarlyClobberConflict.insert(std::make_pair(MO.getReg(), MI));
      +        }
             }
             
             MIIndex += InstrSlots::NUM;
      @@ -740,6 +752,72 @@
         return ResVal;
       }
       
      +/// noEarlyclobberConflict - see whether virtual reg VReg has a conflict with
      +/// hard reg HReg because of earlyclobbers.  
      +///
      +/// Earlyclobber operands may not be assigned the same register as
      +/// each other, or as earlyclobber-conflict operands (i.e. those that
      +/// are non-earlyclobbered inputs to an asm that also has earlyclobbers).
      +///
      +/// Thus there are two cases to check for:
      +/// 1.  VReg is an earlyclobber-conflict register and HReg is an earlyclobber
      +/// register in some asm that also has VReg as an input.
      +/// 2.  VReg is an earlyclobber register and HReg is an earlyclobber-conflict
      +/// input elsewhere in some asm.
      +/// In both cases HReg can be assigned by the user, or assigned early in
      +/// register allocation.
      +/// 
      +/// Dropping the distinction between earlyclobber and earlyclobber-conflict,
      +/// keeping only one multimap, looks promising, but two earlyclobber-conflict
      +/// operands may be assigned the same register if they happen to contain the 
      +/// same value, and that implementation would prevent this.
      +///
      +bool LiveIntervals::noEarlyclobberConflict(unsigned VReg, VirtRegMap &vrm,
      +                                           unsigned HReg) {
      +  typedef std::multimap::iterator It;
      +
      +  // Short circuit the most common case.
      +  if (AsmsWithEarlyClobberConflict.size()!=0) {
      +    std::pair x = AsmsWithEarlyClobberConflict.equal_range(VReg);
      +    for (It I = x.first; I!=x.second; I++) {
      +      MachineInstr* MI = I->second;
      +      for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
      +        MachineOperand &MO = MI->getOperand(i);
      +        if (MO.isRegister() && MO.isEarlyClobber()) {
      +          unsigned PhysReg = MO.getReg();
      +          if (PhysReg && TargetRegisterInfo::isVirtualRegister(PhysReg)) {
      +            if (!vrm.hasPhys(PhysReg))
      +              continue;
      +            PhysReg = vrm.getPhys(PhysReg);
      +          }
      +          if (PhysReg==HReg)
      +            return false;
      +        }
      +      }
      +    }
      +  }
      +  // Short circuit the most common case.
      +  if (AsmsThatEarlyClobber.size()!=0) {
      +    std::pair x = AsmsThatEarlyClobber.equal_range(VReg);
      +    for (It I = x.first; I!=x.second; I++) {
      +      MachineInstr* MI = I->second;
      +      for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
      +        MachineOperand &MO = MI->getOperand(i);
      +        if (MO.isRegister() && MO.overlapsEarlyClobber()) {
      +          unsigned PhysReg = MO.getReg();
      +          if (PhysReg && TargetRegisterInfo::isVirtualRegister(PhysReg)) {
      +            if (!vrm.hasPhys(PhysReg))
      +              continue;
      +            PhysReg = vrm.getPhys(PhysReg);
      +          }
      +          if (PhysReg==HReg)
      +            return false;
      +        }
      +      }
      +    }
      +  }
      +  return true;
      +}
       
       LiveInterval* LiveIntervals::createInterval(unsigned reg) {
         float Weight = TargetRegisterInfo::isPhysicalRegister(reg) ?
      
      Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=56290&r1=56289&r2=56290&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
      +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed Sep 17 16:13:11 2008
      @@ -109,6 +109,7 @@
         // register's use/def lists.
         if (isRegister()) {
           assert(!isEarlyClobber());
      +    assert(!isEarlyClobber() && !overlapsEarlyClobber());
           setReg(Reg);
         } else {
           // Otherwise, change this to a register and set the reg#.
      @@ -128,6 +129,7 @@
         IsKill = isKill;
         IsDead = isDead;
         IsEarlyClobber = false;
      +  OverlapsEarlyClobber = false;
         SubReg = 0;
       }
       
      @@ -183,13 +185,20 @@
               OS << "%mreg" << getReg();
           }
             
      -    if (isDef() || isKill() || isDead() || isImplicit() || isEarlyClobber()) {
      +    if (isDef() || isKill() || isDead() || isImplicit() || isEarlyClobber() ||
      +        overlapsEarlyClobber()) {
             OS << "<";
             bool NeedComma = false;
      +      if (overlapsEarlyClobber()) {
      +        NeedComma = true;
      +        OS << "overlapsearly";
      +      }
             if (isImplicit()) {
      +        if (NeedComma) OS << ",";
               OS << (isDef() ? "imp-def" : "imp-use");
               NeedComma = true;
             } else if (isDef()) {
      +        if (NeedComma) OS << ",";
               if (isEarlyClobber())
                 OS << "earlyclobber,";
               OS << "def";
      
      Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56290&r1=56289&r2=56290&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
      +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Wed Sep 17 16:13:11 2008
      @@ -1050,7 +1050,8 @@
         TargetRegisterClass::iterator E = RC->allocation_order_end(*mf_);
         assert(I != E && "No allocatable register in this register class!");
         for (; I != E; ++I)
      -    if (prt_->isRegAvail(*I)) {
      +    if (prt_->isRegAvail(*I) && 
      +        li_->noEarlyclobberConflict(cur->reg, *vrm_, *I)) {
             FreeReg = *I;
             if (FreeReg < inactiveCounts.size())
               FreeRegInactiveCount = inactiveCounts[FreeReg];
      @@ -1070,7 +1071,8 @@
         for (; I != E; ++I) {
           unsigned Reg = *I;
           if (prt_->isRegAvail(Reg) && Reg < inactiveCounts.size() &&
      -        FreeRegInactiveCount < inactiveCounts[Reg]) {
      +        FreeRegInactiveCount < inactiveCounts[Reg] &&
      +        li_->noEarlyclobberConflict(cur->reg, *vrm_, Reg)) {
             FreeReg = Reg;
             FreeRegInactiveCount = inactiveCounts[Reg];
             if (FreeRegInactiveCount == MaxInactiveCount)
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp?rev=56290&r1=56289&r2=56290&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp Wed Sep 17 16:13:11 2008
      @@ -231,7 +231,8 @@
       void ScheduleDAG::AddOperand(MachineInstr *MI, SDValue Op,
                                    unsigned IIOpNum,
                                    const TargetInstrDesc *II,
      -                             DenseMap &VRBaseMap) {
      +                             DenseMap &VRBaseMap,
      +                             bool overlapsEarlyClobber) {
         if (Op.isMachineOpcode()) {
           // Note that this case is redundant with the final else block, but we
           // include it because it is the most common and it makes the logic
      @@ -244,7 +245,9 @@
           const TargetInstrDesc &TID = MI->getDesc();
           bool isOptDef = IIOpNum < TID.getNumOperands() &&
             TID.OpInfo[IIOpNum].isOptionalDef();
      -    MI->addOperand(MachineOperand::CreateReg(VReg, isOptDef));
      +    MI->addOperand(MachineOperand::CreateReg(VReg, isOptDef, false, false,
      +                                             false, 0, false,
      +                                             overlapsEarlyClobber));
           
           // Verify that it is right.
           assert(TargetRegisterInfo::isVirtualRegister(VReg) && "Not a vreg?");
      @@ -278,7 +281,9 @@
           const ConstantFP *CFP = F->getConstantFPValue();
           MI->addOperand(MachineOperand::CreateFPImm(CFP));
         } else if (RegisterSDNode *R = dyn_cast(Op)) {
      -    MI->addOperand(MachineOperand::CreateReg(R->getReg(), false));
      +    MI->addOperand(MachineOperand::CreateReg(R->getReg(), false, false,
      +                                             false, false, 0, false,
      +                                             overlapsEarlyClobber));
         } else if (GlobalAddressSDNode *TGA = dyn_cast(Op)) {
           MI->addOperand(MachineOperand::CreateGA(TGA->getGlobal(),TGA->getOffset()));
         } else if (BasicBlockSDNode *BB = dyn_cast(Op)) {
      @@ -314,7 +319,9 @@
                  Op.getValueType() != MVT::Flag &&
                  "Chain and flag operands should occur at end of operand list!");
           unsigned VReg = getVR(Op, VRBaseMap);
      -    MI->addOperand(MachineOperand::CreateReg(VReg, false));
      +    MI->addOperand(MachineOperand::CreateReg(VReg, false, false,
      +                                             false, false, 0, false,
      +                                             overlapsEarlyClobber));
           
           // Verify that it is right.  Note that the reg class of the physreg and the
           // vreg don't necessarily need to match, but the target copy insertion has
      @@ -596,6 +603,7 @@
             
           // Add all of the operand registers to the instruction.
           for (unsigned i = 2; i != NumOps;) {
      +      bool overlapsEarlyClobber = false;
             unsigned Flags =
               cast(Node->getOperand(i))->getZExtValue();
             unsigned NumVals = Flags >> 3;
      @@ -618,13 +626,18 @@
                                                          false, 0, true));
               }
               break;
      +      case 7:  // Addressing mode overlapping earlyclobber.
      +      case 5:  // Use of register overlapping earlyclobber.
      +        overlapsEarlyClobber = true;
      +        // fall through
             case 1:  // Use of register.
             case 3:  // Immediate.
             case 4:  // Addressing mode.
               // The addressing mode has been selected, just add all of the
               // operands to the machine instruction.
               for (; NumVals; --NumVals, ++i)
      -          AddOperand(MI, Node->getOperand(i), 0, 0, VRBaseMap);
      +          AddOperand(MI, Node->getOperand(i), 0, 0, VRBaseMap, 
      +                     overlapsEarlyClobber);
               break;
             }
           }
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=56290&r1=56289&r2=56290&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed Sep 17 16:13:11 2008
      @@ -4909,8 +4909,10 @@
               assert(OpInfo.isIndirect && "Memory output must be indirect operand");
       
               // Add information to the INLINEASM node to know about this output.
      -        unsigned ResOpType = 4/*MEM*/ | (1 << 3);
      -        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType, 
      +        unsigned ResOpType = SawEarlyClobber ? 
      +                                  7 /* MEM OVERLAPS EARLYCLOBBER */ :
      +                                  4/*MEM*/;
      +        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType | (1<<3), 
                                                               TLI.getPointerTy()));
               AsmNodeOperands.push_back(OpInfo.CallOperand);
               break;
      @@ -4963,7 +4965,8 @@
                   cast(AsmNodeOperands[CurOp])->getZExtValue();
                 assert(((NumOps & 7) == 2 /*REGDEF*/ ||
                         (NumOps & 7) == 6 /*EARLYCLOBBER REGDEF*/ ||
      -                  (NumOps & 7) == 4 /*MEM*/) &&
      +                  (NumOps & 7) == 4 /*MEM*/ ||
      +                  (NumOps & 7) == 7 /*MEM OVERLAPS EARLYCLOBBER*/) &&
                        "Skipped past definitions?");
                 CurOp += (NumOps>>3)+1;
               }
      @@ -4985,14 +4988,17 @@
               
                 // Use the produced MatchedRegs object to 
                 MatchedRegs.getCopyToRegs(InOperandVal, DAG, Chain, &Flag);
      -          MatchedRegs.AddInlineAsmOperands(1 /*REGUSE*/, DAG, AsmNodeOperands);
      +          MatchedRegs.AddInlineAsmOperands(SawEarlyClobber ? 
      +                                           1 /*REGUSE*/ :
      +                                           5 /*REGUSE OVERLAPS EARLYCLOBBER*/, 
      +                                           DAG, AsmNodeOperands);
                 break;
               } else {
      -          assert((NumOps & 7) == 4/*MEM*/ && "Unknown matching constraint!");
      +          assert(((NumOps & 7) == 7/*MEM OVERLAPS EARLYCLOBBER */ ||
      +                  (NumOps & 7) == 4) && "Unknown matching constraint!");
                 assert((NumOps >> 3) == 1 && "Unexpected number of operands"); 
                 // Add information to the INLINEASM node to know about this input.
      -          unsigned ResOpType = 4/*MEM*/ | (1 << 3);
      -          AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType,
      +          AsmNodeOperands.push_back(DAG.getTargetConstant(NumOps,
                                                                 TLI.getPointerTy()));
                 AsmNodeOperands.push_back(AsmNodeOperands[CurOp+1]);
                 break;
      @@ -5024,8 +5030,10 @@
                      "Memory operands expect pointer values");
                      
               // Add information to the INLINEASM node to know about this input.
      -        unsigned ResOpType = 4/*MEM*/ | (1 << 3);
      -        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType,
      +        unsigned ResOpType = SawEarlyClobber ? 
      +                                7 /* MEM OVERLAPS EARLYCLOBBER */ : 
      +                                4/*MEM*/;
      +        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType | (1<<3),
                                                               TLI.getPointerTy()));
               AsmNodeOperands.push_back(InOperandVal);
               break;
      @@ -5043,16 +5051,18 @@
       
             OpInfo.AssignedRegs.getCopyToRegs(InOperandVal, DAG, Chain, &Flag);
             
      -      OpInfo.AssignedRegs.AddInlineAsmOperands(1/*REGUSE*/, DAG,
      -                                               AsmNodeOperands);
      +      OpInfo.AssignedRegs.AddInlineAsmOperands(SawEarlyClobber ?
      +                                           5 /*REGUSE OVERLAPS EARLYCLOBBER*/:
      +                                           1/*REGUSE*/,
      +                                           DAG, AsmNodeOperands);
             break;
           }
           case InlineAsm::isClobber: {
             // Add the clobbered value to the operand list, so that the register
             // allocator is aware that the physreg got clobbered.
             if (!OpInfo.AssignedRegs.Regs.empty())
      -        OpInfo.AssignedRegs.AddInlineAsmOperands(2/*REGDEF*/, DAG,
      -                                                 AsmNodeOperands);
      +        OpInfo.AssignedRegs.AddInlineAsmOperands(6 /* EARLYCLOBBER REGDEF */,
      +                                                 DAG, AsmNodeOperands);
             break;
           }
           }
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=56290&r1=56289&r2=56290&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Sep 17 16:13:11 2008
      @@ -1113,7 +1113,8 @@
         
         while (i != e) {
           unsigned Flags = cast(InOps[i])->getZExtValue();
      -    if ((Flags & 7) != 4 /*MEM*/) {
      +    if ((Flags & 7) != 4 /*MEM*/ &&
      +        (Flags & 7) != 7 /*MEM OVERLAPS EARLYCLOBBER*/) {
             // Just skip over this operand, copying the operands verbatim.
             Ops.insert(Ops.end(), InOps.begin()+i, InOps.begin()+i+(Flags >> 3) + 1);
             i += (Flags >> 3) + 1;
      @@ -1128,7 +1129,7 @@
             
             // Add this to the output node.
             MVT IntPtrTy = CurDAG->getTargetLoweringInfo().getPointerTy();
      -      Ops.push_back(CurDAG->getTargetConstant(4/*MEM*/ | (SelOps.size() << 3),
      +      Ops.push_back(CurDAG->getTargetConstant((Flags & 7) | (SelOps.size()<< 3),
                                                     IntPtrTy));
             Ops.insert(Ops.end(), SelOps.begin(), SelOps.end());
             i += 2;
      
      Added: llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll?rev=56290&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll (added)
      +++ llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll Wed Sep 17 16:13:11 2008
      @@ -0,0 +1,24 @@
      +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl %eax, %eax"
      +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl %edx, %edx"
      +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl (%eax), %eax"
      +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl (%edx), %edx"
      +
      +; %0 must not be put in EAX or EDX.
      +; In the first asm, $0 and $2 must not be put in EAX.
      +; In the second asm, $0 and $2 must not be put in EDX.
      +; This is kind of hard to test thoroughly, but the things above should continue
      +; to pass, I think.
      +; ModuleID = ''
      +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
      +target triple = "i386-apple-darwin8"
      + at x = common global i32 0		;  [#uses=1]
      +
      +define i32 @aci(i32* %pw) nounwind {
      +entry:
      +	%0 = load i32* @x, align 4		;  [#uses=1]
      +	%asmtmp = tail call { i32, i32 } asm "movl $0, %eax\0A\090:\0A\09test %eax, %eax\0A\09je 1f\0A\09movl %eax, $2\0A\09incl $2\0A\09lock\0A\09cmpxchgl $2, $0\0A\09jne 0b\0A\091:", "=*m,=&{ax},=&r,*m,~{dirflag},~{fpsr},~{flags},~{memory},~{cc}"(i32* %pw, i32* %pw) nounwind		; <{ i32, i32 }> [#uses=0]
      +	%asmtmp2 = tail call { i32, i32 } asm "movl $0, %edx\0A\090:\0A\09test %edx, %edx\0A\09je 1f\0A\09movl %edx, $2\0A\09incl $2\0A\09lock\0A\09cmpxchgl $2, $0\0A\09jne 0b\0A\091:", "=*m,=&{dx},=&r,*m,~{dirflag},~{fpsr},~{flags},~{memory},~{cc}"(i32* %pw, i32* %pw) nounwind		; <{ i32, i32 }> [#uses=1]
      +	%asmresult3 = extractvalue { i32, i32 } %asmtmp2, 0		;  [#uses=1]
      +	%1 = add i32 %asmresult3, %0		;  [#uses=1]
      +	ret i32 %1
      +}
      
      
      
      
      From gohman at apple.com  Wed Sep 17 16:18:50 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Wed, 17 Sep 2008 21:18:50 -0000
      Subject: [llvm-commits] [llvm] r56292 -
      	/llvm/trunk/lib/Target/X86/X86FastISel.cpp
      Message-ID: <200809172118.m8HLIoRS014197@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Wed Sep 17 16:18:49 2008
      New Revision: 56292
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56292&view=rev
      Log:
      FastISel: For calls, prefer using the callee's address as a constant
      over having it in a register. And wait until after checking type
      legality before requesting that the callee address be placed in a
      register. Also, fix support for calls with void return type.
      
      This speeds up fast-isel isel time by about 15% and reduces
      instruction counts by about 3% overall on certain testcases. It also
      changes many indirect calls to direct calls.
      
      Modified:
          llvm/trunk/lib/Target/X86/X86FastISel.cpp
      
      Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=56292&r1=56291&r2=56292&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Wed Sep 17 16:18:49 2008
      @@ -748,15 +748,6 @@
             return false;
         }
       
      -  // Materialize callee address in a register. FIXME: GV address can be
      -  // handled with a CALLpcrel32 instead.
      -  unsigned CalleeOp = getRegForValue(Callee);
      -  if (CalleeOp == 0) {
      -    if (!isa(Callee) || !X86SelectConstAddr(Callee, CalleeOp, true))
      -      // Unhandled operand. Halt "fast" selection and bail.
      -      return false;    
      -  }
      -
         // Handle only C and fastcc calling conventions for now.
         CallSite CS(CI);
         unsigned CC = CS.getCallingConv();
      @@ -774,9 +765,21 @@
         // Handle *simple* calls for now.
         const Type *RetTy = CS.getType();
         MVT RetVT;
      -  if (!isTypeLegal(RetTy, TLI, RetVT, true))
      +  if (RetTy == Type::VoidTy)
      +    RetVT = MVT::isVoid;
      +  else if (!isTypeLegal(RetTy, TLI, RetVT, true))
           return false;
       
      +  // Materialize callee address in a register. FIXME: GV address can be
      +  // handled with a CALLpcrel32 instead.
      +  unsigned CalleeOp = 0;
      +  if (!isa(Callee) || !X86SelectConstAddr(Callee, CalleeOp, true)) {
      +    CalleeOp = getRegForValue(Callee);
      +    if (CalleeOp == 0)
      +      // Unhandled operand. Halt "fast" selection and bail.
      +      return false;    
      +  }
      +
         // Allow calls which produce i1 results.
         bool AndToI1 = false;
         if (RetVT == MVT::i1) {
      
      
      
      
      From tonic at nondot.org  Wed Sep 17 17:52:10 2008
      From: tonic at nondot.org (Tanya Lattner)
      Date: Wed, 17 Sep 2008 17:52:10 -0500
      Subject: [llvm-commits] CVS: llvm-www/demo/index.cgi
      Message-ID: <200809172252.m8HMqAfg018236@zion.cs.uiuc.edu>
      
      
      
      Changes in directory llvm-www/demo:
      
      index.cgi updated: 1.87 -> 1.88
      ---
      Log message:
      
      Should be argv[1] not argv[0].
      
      
      ---
      Diffs of the changes:  (+1 -1)
      
       index.cgi |    2 +-
       1 files changed, 1 insertion(+), 1 deletion(-)
      
      
      Index: llvm-www/demo/index.cgi
      diff -u llvm-www/demo/index.cgi:1.87 llvm-www/demo/index.cgi:1.88
      --- llvm-www/demo/index.cgi:1.87	Mon Jun  9 15:08:17 2008
      +++ llvm-www/demo/index.cgi	Wed Sep 17 17:51:20 2008
      @@ -33,7 +33,7 @@
                        "int factorial(int X) {\n  if (X == 0) return 1;\n" .
                        "  return X*factorial(X-1);\n}\n\n" .
                        "int main(int argc, char **argv) {\n" .
      -                 "  printf(\"%d\\n\", factorial(atoi(argv[0])));\n}\n";
      +                 "  printf(\"%d\\n\", factorial(atoi(argv[1])));\n}\n";
       
       sub getname {
           my ($extension) = @_;
      
      
      
      
      
      From evan.cheng at apple.com  Thu Sep 18 02:24:34 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Thu, 18 Sep 2008 07:24:34 -0000
      Subject: [llvm-commits] [llvm] r56299 -
      	/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
      Message-ID: <200809180724.m8I7OY1K002745@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Thu Sep 18 02:24:33 2008
      New Revision: 56299
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56299&view=rev
      Log:
      Cosmetic.
      
      Modified:
          llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
      
      Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=56299&r1=56298&r2=56299&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original)
      +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Thu Sep 18 02:24:33 2008
      @@ -37,15 +37,17 @@
       ///
       namespace {
       class ARMDAGToDAGISel : public SelectionDAGISel {
      -  ARMTargetLowering Lowering;
      +  ARMTargetMachine &TM;
      +
      +  ARMTargetLowering ARMLowering;
       
         /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
         /// make the right decision when generating code for different targets.
         const ARMSubtarget *Subtarget;
       
       public:
      -  explicit ARMDAGToDAGISel(ARMTargetMachine &TM)
      -    : SelectionDAGISel(Lowering), Lowering(TM),
      +  explicit ARMDAGToDAGISel(ARMTargetMachine &tm)
      +    : SelectionDAGISel(ARMLowering), TM(tm), ARMLowering(tm),
           Subtarget(&TM.getSubtarget()) {
         }
       
      
      
      
      
      From evan.cheng at apple.com  Thu Sep 18 02:27:23 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Thu, 18 Sep 2008 07:27:23 -0000
      Subject: [llvm-commits] [llvm] r56300 -
      	/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
      Message-ID: <200809180727.m8I7RO2l002827@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Thu Sep 18 02:27:23 2008
      New Revision: 56300
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56300&view=rev
      Log:
      Clean up.
      
      Modified:
          llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
      
      Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=56300&r1=56299&r2=56300&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original)
      +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Thu Sep 18 02:27:23 2008
      @@ -44,7 +44,7 @@
       namespace {
         struct VISIBILITY_HIDDEN ARMAsmPrinter : public AsmPrinter {
           ARMAsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
      -      : AsmPrinter(O, TM, T), DW(O, this, T), MMI(NULL), AFI(NULL), 
      +      : AsmPrinter(O, TM, T), DW(O, this, T), MMI(NULL), AFI(NULL), MCP(NULL),
               InCPMode(false) {
             Subtarget = &TM.getSubtarget();
           }
      @@ -57,9 +57,13 @@
           const ARMSubtarget *Subtarget;
       
           /// AFI - Keep a pointer to ARMFunctionInfo for the current
      -    /// MachineFunction
      +    /// MachineFunction.
           ARMFunctionInfo *AFI;
       
      +    /// MCP - Keep a pointer to constantpool entries of the current
      +    /// MachineFunction.
      +    const MachineConstantPool *MCP;
      +
           /// We name each basic block in a Function with a unique number, so
           /// that we can consistently refer to them later. This is cleared
           /// at the beginning of each call to runOnMachineFunction().
      @@ -185,6 +189,7 @@
       ///
       bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
         AFI = MF.getInfo();
      +  MCP = MF.getConstantPool();
       
         SetupMachineFunction(MF);
         O << "\n";
      @@ -670,8 +675,7 @@
           assert(!strcmp(Modifier, "cpentry") && "Unknown modifier for CPE");
           unsigned CPI = MI->getOperand(OpNo).getIndex();
       
      -    const MachineConstantPoolEntry &MCPE =  // Chasing pointers is fun?
      -      MI->getParent()->getParent()->getConstantPool()->getConstants()[CPI];
      +    const MachineConstantPoolEntry &MCPE = MCP->getConstants()[CPI];
           
           if (MCPE.isMachineConstantPoolEntry()) {
             EmitMachineConstantPoolValue(MCPE.Val.MachineCPVal);
      
      
      
      
      From evan.cheng at apple.com  Thu Sep 18 02:28:19 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Thu, 18 Sep 2008 07:28:19 -0000
      Subject: [llvm-commits] [llvm] r56301 -
      	/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp
      Message-ID: <200809180728.m8I7SJn2002868@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Thu Sep 18 02:28:19 2008
      New Revision: 56301
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56301&view=rev
      Log:
      Duh. Default to ARMCC::AL (always).
      
      Modified:
          llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp
      
      Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=56301&r1=56300&r2=56301&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original)
      +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Thu Sep 18 02:28:19 2008
      @@ -22,6 +22,7 @@
       #include "llvm/Function.h"
       #include "llvm/PassManager.h"
       #include "llvm/CodeGen/MachineCodeEmitter.h"
      +#include "llvm/CodeGen/MachineConstantPool.h"
       #include "llvm/CodeGen/MachineFunctionPass.h"
       #include "llvm/CodeGen/MachineInstr.h"
       #include "llvm/CodeGen/Passes.h"
      @@ -34,19 +35,21 @@
       
       namespace {
         class VISIBILITY_HIDDEN ARMCodeEmitter : public MachineFunctionPass {
      -    const ARMInstrInfo  *II;
      -    const TargetData    *TD;
      -    TargetMachine       &TM;
      -    MachineCodeEmitter  &MCE;
      +    ARMJITInfo                *JTI;
      +    const ARMInstrInfo        *II;
      +    const TargetData          *TD;
      +    TargetMachine             &TM;
      +    MachineCodeEmitter        &MCE;
      +    const MachineConstantPool *MCP;
         public:
           static char ID;
           explicit ARMCodeEmitter(TargetMachine &tm, MachineCodeEmitter &mce)
      -      : MachineFunctionPass(&ID), II(0), TD(0), TM(tm),
      -      MCE(mce) {}
      +      : MachineFunctionPass(&ID), JTI(0), II(0), TD(0), TM(tm),
      +      MCE(mce), MCP(0) {}
           ARMCodeEmitter(TargetMachine &tm, MachineCodeEmitter &mce,
                   const ARMInstrInfo &ii, const TargetData &td)
      -      : MachineFunctionPass(&ID), II(&ii), TD(&td), TM(tm),
      -      MCE(mce) {}
      +      : MachineFunctionPass(&ID), JTI(0), II(&ii), TD(&td), TM(tm),
      +      MCE(mce), MCP(0) {}
       
           bool runOnMachineFunction(MachineFunction &MF);
       
      @@ -57,6 +60,11 @@
           void emitInstruction(const MachineInstr &MI);
       
         private:
      +
      +    void emitConstPoolInstruction(const MachineInstr &MI);
      +
      +    void emitPseudoInstruction(const MachineInstr &MI);
      +
           unsigned getAddrModeNoneInstrBinary(const MachineInstr &MI,
                                               const TargetInstrDesc &TID,
                                               unsigned Binary);
      @@ -111,11 +119,12 @@
       
           /// Routines that handle operands which add machine relocations which are
           /// fixed up by the JIT fixup stage.
      -    void emitGlobalAddressForCall(GlobalValue *GV, bool DoesntNeedStub);
      +    void emitGlobalAddress(GlobalValue *GV, unsigned Reloc,
      +                           bool DoesntNeedStub);
           void emitExternalSymbolAddress(const char *ES, unsigned Reloc);
           void emitConstPoolAddress(unsigned CPI, unsigned Reloc,
                                     int Disp = 0, unsigned PCAdj = 0 );
      -    void emitJumpTableAddress(unsigned JTI, unsigned Reloc,
      +    void emitJumpTableAddress(unsigned JTIndex, unsigned Reloc,
                                     unsigned PCAdj = 0);
           void emitGlobalConstant(const Constant *CV);
           void emitMachineBasicBlock(MachineBasicBlock *BB);
      @@ -136,6 +145,8 @@
                "JIT relocation model must be set to static or default!");
         II = ((ARMTargetMachine&)MF.getTarget()).getInstrInfo();
         TD = ((ARMTargetMachine&)MF.getTarget()).getTargetData();
      +  JTI = ((ARMTargetMachine&)MF.getTarget()).getJITInfo();
      +  MCP = MF.getConstantPool();
       
         do {
           DOUT << "JITTing function '" << MF.getFunction()->getName() << "'\n";
      @@ -175,7 +186,7 @@
         else if (MO.isImmediate())
           return static_cast(MO.getImm());
         else if (MO.isGlobalAddress())
      -    emitGlobalAddressForCall(MO.getGlobal(), false);
      +    emitGlobalAddress(MO.getGlobal(), ARM::reloc_arm_branch, false);
         else if (MO.isExternalSymbol())
           emitExternalSymbolAddress(MO.getSymbolName(), ARM::reloc_arm_relative);
         else if (MO.isConstantPoolIndex())
      @@ -191,14 +202,12 @@
         return 0;
       }
       
      -/// emitGlobalAddressForCall - Emit the specified address to the code stream
      -/// assuming this is part of a function call, which is PC relative.
      +/// emitGlobalAddress - Emit the specified address to the code stream.
       ///
      -void ARMCodeEmitter::emitGlobalAddressForCall(GlobalValue *GV,
      -                                              bool DoesntNeedStub) {
      +void ARMCodeEmitter::emitGlobalAddress(GlobalValue *GV,
      +                                       unsigned Reloc, bool DoesntNeedStub) {
         MCE.addRelocation(MachineRelocation::getGV(MCE.getCurrentPCOffset(),
      -                                             ARM::reloc_arm_branch, GV, 0,
      -                                             DoesntNeedStub));
      +                                             Reloc, GV, 0, DoesntNeedStub));
       }
       
       /// emitExternalSymbolAddress - Arrange for the address of an external symbol to
      @@ -222,10 +231,10 @@
       /// emitJumpTableAddress - Arrange for the address of a jump table to
       /// be emitted to the current location in the function, and allow it to be PC
       /// relative.
      -void ARMCodeEmitter::emitJumpTableAddress(unsigned JTI, unsigned Reloc,
      +void ARMCodeEmitter::emitJumpTableAddress(unsigned JTIndex, unsigned Reloc,
                                                 unsigned PCAdj /* = 0 */) {
         MCE.addRelocation(MachineRelocation::getJumpTable(MCE.getCurrentPCOffset(),
      -                                                    Reloc, JTI, PCAdj));
      +                                                    Reloc, JTIndex, PCAdj));
       }
       
       /// emitMachineBasicBlock - Emit the specified address basic block.
      @@ -238,12 +247,18 @@
         DOUT << MI;
       
         NumEmitted++;  // Keep track of the # of mi's emitted
      -  MCE.emitWordLE(getInstrBinary(MI));
      +  if ((MI.getDesc().TSFlags & ARMII::FormMask) == ARMII::Pseudo)
      +    emitPseudoInstruction(MI);
      +  else
      +    MCE.emitWordLE(getInstrBinary(MI));
       }
       
       unsigned ARMCodeEmitter::getAddrModeNoneInstrBinary(const MachineInstr &MI,
                                                           const TargetInstrDesc &TID,
                                                           unsigned Binary) {
      +  // FIXME: Assume CC is AL for now.
      +  Binary |= ARMCC::AL << 28;
      +
         switch (TID.TSFlags & ARMII::FormMask) {
         default:
           assert(0 && "Unknown instruction subtype!");
      @@ -342,12 +357,27 @@
         return 0;
       }
       
      +void ARMCodeEmitter::emitConstPoolInstruction(const MachineInstr &MI) {
      +  // FIXME
      +}
      +
      +void ARMCodeEmitter::emitPseudoInstruction(const MachineInstr &MI) {
      +  unsigned Opcode = MI.getDesc().Opcode;
      +  switch (Opcode) {
      +  default:
      +    abort(); // FIXME:
      +  case ARM::CONSTPOOL_ENTRY: {
      +    emitConstPoolInstruction(MI);
      +    break;
      +  }
      +  }
      +}
      +
       unsigned ARMCodeEmitter::getAddrMode1InstrBinary(const MachineInstr &MI,
                                                        const TargetInstrDesc &TID,
                                                        unsigned Binary) {
      -  unsigned Format = TID.TSFlags & ARMII::FormMask;
      -  if (Format == ARMII::Pseudo)
      -    abort(); // FIXME
      +  // FIXME: Assume CC is AL for now.
      +  Binary |= ARMCC::AL << 28;
       
         // Encode S bit if MI modifies CPSR.
         Binary |= getAddrMode1SBit(MI, TID);
      @@ -361,6 +391,7 @@
         }
       
         // Encode first non-shifter register operand if ther is one.
      +  unsigned Format = TID.TSFlags & ARMII::FormMask;
         bool isUnary = (Format == ARMII::DPRdMisc  ||
                         Format == ARMII::DPRdIm    ||
                         Format == ARMII::DPRdReg   ||
      @@ -401,6 +432,9 @@
       unsigned ARMCodeEmitter::getAddrMode2InstrBinary(const MachineInstr &MI,
                                                        const TargetInstrDesc &TID,
                                                        unsigned Binary) {
      +  // FIXME: Assume CC is AL for now.
      +  Binary |= ARMCC::AL << 28;
      +
         // Set first operand
         Binary |= getMachineOpValue(MI, 0) << ARMII::RegRdShift;
       
      @@ -439,6 +473,9 @@
       unsigned ARMCodeEmitter::getAddrMode3InstrBinary(const MachineInstr &MI,
                                                        const TargetInstrDesc &TID,
                                                        unsigned Binary) {
      +  // FIXME: Assume CC is AL for now.
      +  Binary |= ARMCC::AL << 28;
      +
         // Set first operand
         Binary |= getMachineOpValue(MI, 0) << ARMII::RegRdShift;
       
      @@ -473,6 +510,9 @@
       unsigned ARMCodeEmitter::getAddrMode4InstrBinary(const MachineInstr &MI,
                                                        const TargetInstrDesc &TID,
                                                        unsigned Binary) {
      +  // FIXME: Assume CC is AL for now.
      +  Binary |= ARMCC::AL << 28;
      +
         // Set first operand
         Binary |= getMachineOpValue(MI, 0) << ARMII::RegRnShift;
       
      
      
      
      
      From evan.cheng at apple.com  Thu Sep 18 02:54:21 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Thu, 18 Sep 2008 07:54:21 -0000
      Subject: [llvm-commits] [llvm] r56303 - in /llvm/trunk:
       include/llvm/System/Memory.h lib/ExecutionEngine/ExecutionEngine.cpp
       lib/ExecutionEngine/JIT/JITEmitter.cpp
       lib/ExecutionEngine/JIT/JITMemoryManager.cpp lib/System/Memory.cpp
       lib/System/Unix/Memory.inc
      Message-ID: <200809180754.m8I7sLr7009561@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Thu Sep 18 02:54:21 2008
      New Revision: 56303
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56303&view=rev
      Log:
      Preliminary support for systems which require changing JIT memory regions privilege from read / write to read / executable.
      
      Modified:
          llvm/trunk/include/llvm/System/Memory.h
          llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
          llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
          llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
          llvm/trunk/lib/System/Memory.cpp
          llvm/trunk/lib/System/Unix/Memory.inc
      
      Modified: llvm/trunk/include/llvm/System/Memory.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Memory.h?rev=56303&r1=56302&r2=56303&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/System/Memory.h (original)
      +++ llvm/trunk/include/llvm/System/Memory.h Thu Sep 18 02:54:21 2008
      @@ -69,6 +69,11 @@
           /// that has been emitted it must invalidate the instruction cache on some
           /// platforms.
           static void InvalidateInstructionCache(const void *Addr, size_t Len);
      +
      +    /// SetRXPrivilege - Before the JIT can run a block of code, it has to be
      +    /// given read and executable privilege. Return true if it is already r-x
      +    /// or the system is able to change its previlege.
      +    static bool SetRXPrivilege(const void *Addr, size_t Size);
         };
       }
       }
      
      Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=56303&r1=56302&r2=56303&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
      +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Thu Sep 18 02:54:21 2008
      @@ -86,7 +86,8 @@
       /// existing data in memory.
       void ExecutionEngine::addGlobalMapping(const GlobalValue *GV, void *Addr) {
         MutexGuard locked(lock);
      -  
      +
      +  DOUT << "Map " << *GV << " to " << Addr << "\n";  
         void *&CurVal = state.getGlobalAddressMap(locked)[GV];
         assert((CurVal == 0 || Addr == 0) && "GlobalMapping already established!");
         CurVal = Addr;
      
      Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=56303&r1=56302&r2=56303&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
      +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Sep 18 02:54:21 2008
      @@ -925,6 +925,9 @@
              << Relocations.size() << " relocations\n";
         Relocations.clear();
       
      +  // Mark code region readable and executable if it's not so already.
      +  sys::Memory::SetRXPrivilege(FnStart, FnEnd-FnStart);
      +
       #ifndef NDEBUG
         {
         DOUT << std::hex;
      
      Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp?rev=56303&r1=56302&r2=56303&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp (original)
      +++ llvm/trunk/lib/ExecutionEngine/JIT/JITMemoryManager.cpp Thu Sep 18 02:54:21 2008
      @@ -370,7 +370,11 @@
       
       DefaultJITMemoryManager::DefaultJITMemoryManager() {
         // Allocate a 16M block of memory for functions.
      +#if defined(__APPLE__) && defined(__arm__)
      +  sys::MemoryBlock MemBlock = getNewMemoryBlock(4 << 20);
      +#else
         sys::MemoryBlock MemBlock = getNewMemoryBlock(16 << 20);
      +#endif
       
         unsigned char *MemBase = static_cast(MemBlock.base());
       
      
      Modified: llvm/trunk/lib/System/Memory.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Memory.cpp?rev=56303&r1=56302&r2=56303&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/System/Memory.cpp (original)
      +++ llvm/trunk/lib/System/Memory.cpp Thu Sep 18 02:54:21 2008
      @@ -58,3 +58,14 @@
       #endif  // end PPC
       
       }
      +
      +bool llvm::sys::Memory::SetRXPrivilege(const void *Addr, size_t Size) {
      +#if defined(__APPLE__) && defined(__arm__)
      +  kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)Addr,
      +                                (vm_size_t)Size, 0,
      +                                VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_COPY);
      +  return KERN_SUCCESS == kr;
      +#else
      +  return true;
      +#endif
      +}
      
      Modified: llvm/trunk/lib/System/Unix/Memory.inc
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Memory.inc?rev=56303&r1=56302&r2=56303&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/System/Unix/Memory.inc (original)
      +++ llvm/trunk/lib/System/Unix/Memory.inc Thu Sep 18 02:54:21 2008
      @@ -18,6 +18,10 @@
       #include 
       #endif
       
      +#ifdef __APPLE__
      +#include 
      +#endif
      +
       /// AllocateRWX - Allocate a slab of memory with read/write/execute
       /// permissions.  This is typically used for JIT applications where we want
       /// to emit code to the memory then jump to it.  Getting this type of memory
      @@ -52,8 +56,13 @@
         void* start = NearBlock ? (unsigned char*)NearBlock->base() + 
                                   NearBlock->size() : 0;
       
      +#if defined(__APPLE__) && defined(__arm__)
      +  void *pa = ::mmap(start, pageSize*NumPages, PROT_READ|PROT_EXEC,
      +                    flags, fd, 0);
      +#else
         void *pa = ::mmap(start, pageSize*NumPages, PROT_READ|PROT_WRITE|PROT_EXEC,
                           flags, fd, 0);
      +#endif
         if (pa == MAP_FAILED) {
           if (NearBlock) //Try again without a near hint
             return AllocateRWX(NumBytes, 0);
      @@ -61,9 +70,29 @@
           MakeErrMsg(ErrMsg, "Can't allocate RWX Memory");
           return MemoryBlock();
         }
      +
      +#if defined(__APPLE__) && defined(__arm__)
      +  kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)pa,
      +                                (vm_size_t)(pageSize*NumPages), 0,
      +                                VM_PROT_READ | VM_PROT_EXECUTE | VM_PROT_COPY);
      +  if (KERN_SUCCESS != kr) {
      +    MakeErrMsg(ErrMsg, "vm_protect max RWX failed\n");
      +    return sys::MemoryBlock();
      +  }
      +
      +  kr = vm_protect(mach_task_self(), (vm_address_t)pa,
      +                  (vm_size_t)(pageSize*NumPages), 0,
      +                  VM_PROT_READ | VM_PROT_WRITE);
      +  if (KERN_SUCCESS != kr) {
      +    MakeErrMsg(ErrMsg, "vm_protect RW failed\n");
      +    return sys::MemoryBlock();
      +  }
      +#endif
      +
         MemoryBlock result;
         result.Address = pa;
         result.Size = NumPages*pageSize;
      +
         return result;
       }
       
      
      
      
      
      From ggreif at gmail.com  Thu Sep 18 11:14:18 2008
      From: ggreif at gmail.com (Gabor Greif)
      Date: Thu, 18 Sep 2008 16:14:18 -0000
      Subject: [llvm-commits] [llvm] r56306 - in /llvm/branches/ggreif/use-diet:
       include/llvm/Use.h lib/VMCore/getValue.cpp
      Message-ID: <200809181614.m8IGEIN5029676@zion.cs.uiuc.edu>
      
      Author: ggreif
      Date: Thu Sep 18 11:14:17 2008
      New Revision: 56306
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56306&view=rev
      Log:
      unleash __builtin_prefetch
      
      Modified:
          llvm/branches/ggreif/use-diet/include/llvm/Use.h
          llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
      
      Modified: llvm/branches/ggreif/use-diet/include/llvm/Use.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/Use.h?rev=56306&r1=56305&r2=56306&view=diff
      
      ==============================================================================
      --- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original)
      +++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Thu Sep 18 11:14:17 2008
      @@ -155,7 +155,7 @@
           *List = this;
         }
         void removeFromList() {
      -    // __builtin_prefetch(Next);
      +    __builtin_prefetch(Next);
           Use **StrippedPrev = stripTag(Prev);
           Use *StrippedNext(getNext());
           if (isStop(Next))
      
      Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp?rev=56306&r1=56305&r2=56306&view=diff
      
      ==============================================================================
      --- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original)
      +++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Thu Sep 18 11:14:17 2008
      @@ -81,7 +81,7 @@
         int Cushion = requiredSteps;
       
         Use *Next(U->Next);
      -  // __builtin_prefetch(Next);
      +  __builtin_prefetch(Next);
         Use::NextPtrTag Tag(extractTag(Next));
         Next = stripTag(Next);
       
      @@ -104,7 +104,7 @@
                 default:
                     Acc = (Acc << 1) | (Tag & 1);
                     Next = Next->Next;
      -              // __builtin_prefetch(Next);
      +              __builtin_prefetch(Next);
                     --Cushion;
                     Tag = extractTag(Next);
                     Next = stripTag(Next);
      @@ -128,7 +128,7 @@
                       return reinterpret_cast(Acc << spareBits);
       
                   Next = Next->Next;
      -            // __builtin_prefetch(Next);
      +            __builtin_prefetch(Next);
                   --Cushion;
                   Tag = extractTag(Next);
                   Next = stripTag(Next);
      @@ -159,7 +159,7 @@
           // fall through
           default:
               Next = Next->Next;
      -        // __builtin_prefetch(Next);
      +        __builtin_prefetch(Next);
               --Cushion;
               Tag = extractTag(Next);
               Next = stripTag(Next);
      @@ -191,7 +191,7 @@
                   }
       
                   Next = Next->Next;
      -            // __builtin_prefetch(Next);
      +            __builtin_prefetch(Next);
                   U = stripTag(U->Next);
                   Tag = extractTag(Next);
                   Next = stripTag(Next);
      @@ -215,7 +215,7 @@
           // fall through
           default:
               Next = Next->Next;
      -        // __builtin_prefetch(Next);
      +        __builtin_prefetch(Next);
               U = stripTag(U->Next);
               Tag = extractTag(Next);
               Next = stripTag(Next);
      @@ -237,7 +237,7 @@
             return reinterpret_cast(Acc << spareBits);
       
           Use *Next(U->Next);
      -    // __builtin_prefetch(Next);
      +    __builtin_prefetch(Next);
           Use::NextPtrTag Tag(extractTag(Next));
           Next = stripTag(Next);
           switch (Tag) {
      @@ -256,7 +256,7 @@
       }; // class UseWaymark
       
       Value *Use::getValue() const {
      -  // __builtin_prefetch(Next);
      +  __builtin_prefetch(Next);
         NextPtrTag Tag(extractTag(Next));
         switch (Tag) {
         case fullStopTagN:
      
      
      
      
      From gohman at apple.com  Thu Sep 18 11:26:28 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Thu, 18 Sep 2008 16:26:28 -0000
      Subject: [llvm-commits] [llvm] r56307 - in /llvm/trunk:
       include/llvm/CodeGen/LinkAllCodegenComponents.h
       include/llvm/CodeGen/ScheduleDAG.h
       lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
      Message-ID: <200809181626.m8IGQTKo030214@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Thu Sep 18 11:26:26 2008
      New Revision: 56307
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56307&view=rev
      Log:
      Add a new "fast" scheduler. This is currently basically just a
      copy of the BURRList scheduler, but with several parts ripped
      out, such as backtracking, online topological sort maintenance
      (needed by backtracking), the priority queue, and Sethi-Ullman
      number computation and maintenance (needed by the priority
      queue). As a result of all this, it generates somewhat lower
      quality code, but that's its tradeoff for running about 30%
      faster than list-burr in -fast mode in many cases.
      
      This is somewhat experimental. Moving forward, major pieces of
      this can be refactored with pieces in common with
      ScheduleDAGRRList.cpp.
      
      Added:
          llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
      Modified:
          llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h
          llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
      
      Modified: llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h?rev=56307&r1=56306&r2=56307&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h Thu Sep 18 11:26:26 2008
      @@ -44,6 +44,7 @@
             (void) llvm::createBURRListDAGScheduler(NULL, NULL, NULL, false);
             (void) llvm::createTDRRListDAGScheduler(NULL, NULL, NULL, false);
             (void) llvm::createTDListDAGScheduler(NULL, NULL, NULL, false);
      +      (void) llvm::createFastDAGScheduler(NULL, NULL, NULL, false);
             (void) llvm::createDefaultScheduler(NULL, NULL, NULL, false);
       
           }
      
      Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=56307&r1=56306&r2=56307&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Thu Sep 18 11:26:26 2008
      @@ -414,6 +414,13 @@
                                               MachineBasicBlock *BB,
                                               bool Fast);
                                               
      +  /// createFastDAGScheduler - This creates a "fast" scheduler.
      +  ///
      +  ScheduleDAG *createFastDAGScheduler(SelectionDAGISel *IS,
      +                                      SelectionDAG *DAG,
      +                                      MachineBasicBlock *BB,
      +                                      bool Fast);
      +
         /// createDefaultScheduler - This creates an instruction scheduler appropriate
         /// for the target.
         ScheduleDAG* createDefaultScheduler(SelectionDAGISel *IS,
      
      Added: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp?rev=56307&view=auto
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp (added)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp Thu Sep 18 11:26:26 2008
      @@ -0,0 +1,654 @@
      +//===----- ScheduleDAGFast.cpp - Fast poor list scheduler -----------------===//
      +//
      +//                     The LLVM Compiler Infrastructure
      +//
      +// This file is distributed under the University of Illinois Open Source
      +// License. See LICENSE.TXT for details.
      +//
      +//===----------------------------------------------------------------------===//
      +//
      +// This implements a fast scheduler.
      +//
      +//===----------------------------------------------------------------------===//
      +
      +#define DEBUG_TYPE "pre-RA-sched"
      +#include "llvm/CodeGen/ScheduleDAG.h"
      +#include "llvm/CodeGen/SchedulerRegistry.h"
      +#include "llvm/Target/TargetRegisterInfo.h"
      +#include "llvm/Target/TargetData.h"
      +#include "llvm/Target/TargetMachine.h"
      +#include "llvm/Target/TargetInstrInfo.h"
      +#include "llvm/Support/Debug.h"
      +#include "llvm/Support/Compiler.h"
      +#include "llvm/ADT/SmallSet.h"
      +#include "llvm/ADT/Statistic.h"
      +#include "llvm/ADT/STLExtras.h"
      +#include "llvm/Support/CommandLine.h"
      +using namespace llvm;
      +
      +STATISTIC(NumUnfolds,    "Number of nodes unfolded");
      +STATISTIC(NumDups,       "Number of duplicated nodes");
      +STATISTIC(NumCCCopies,   "Number of cross class copies");
      +
      +static RegisterScheduler
      +  fastDAGScheduler("fast", "  Fast suboptimal list scheduling",
      +                   createFastDAGScheduler);
      +
      +namespace {
      +  /// FastPriorityQueue - A degenerate priority queue that considers
      +  /// all nodes to have the same priority.
      +  ///
      +  struct VISIBILITY_HIDDEN FastPriorityQueue {
      +    std::vector Queue;
      +
      +    bool empty() const { return Queue.empty(); }
      +    
      +    void push(SUnit *U) {
      +      Queue.push_back(U);
      +    }
      +
      +    SUnit *pop() {
      +      if (empty()) return NULL;
      +      SUnit *V = Queue.back();
      +      Queue.pop_back();
      +      return V;
      +    }
      +  };
      +
      +//===----------------------------------------------------------------------===//
      +/// ScheduleDAGFast - The actual "fast" list scheduler implementation.
      +///
      +class VISIBILITY_HIDDEN ScheduleDAGFast : public ScheduleDAG {
      +private:
      +  /// AvailableQueue - The priority queue to use for the available SUnits.
      +  FastPriorityQueue AvailableQueue;
      +
      +  /// LiveRegs / LiveRegDefs - A set of physical registers and their definition
      +  /// that are "live". These nodes must be scheduled before any other nodes that
      +  /// modifies the registers can be scheduled.
      +  SmallSet LiveRegs;
      +  std::vector LiveRegDefs;
      +  std::vector LiveRegCycles;
      +
      +public:
      +  ScheduleDAGFast(SelectionDAG &dag, MachineBasicBlock *bb,
      +                  const TargetMachine &tm)
      +    : ScheduleDAG(dag, bb, tm) {}
      +
      +  void Schedule();
      +
      +  /// AddPred - This adds the specified node X as a predecessor of 
      +  /// the current node Y if not already.
      +  /// This returns true if this is a new predecessor.
      +  bool AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool isSpecial,
      +               unsigned PhyReg = 0, int Cost = 1);
      +
      +  /// RemovePred - This removes the specified node N from the predecessors of 
      +  /// the current node M.
      +  bool RemovePred(SUnit *M, SUnit *N, bool isCtrl, bool isSpecial);
      +
      +private:
      +  void ReleasePred(SUnit*, bool, unsigned);
      +  void ScheduleNodeBottomUp(SUnit*, unsigned);
      +  SUnit *CopyAndMoveSuccessors(SUnit*);
      +  void InsertCCCopiesAndMoveSuccs(SUnit*, unsigned,
      +                                  const TargetRegisterClass*,
      +                                  const TargetRegisterClass*,
      +                                  SmallVector&);
      +  bool DelayForLiveRegsBottomUp(SUnit*, SmallVector&);
      +  void ListScheduleBottomUp();
      +
      +  /// CreateNewSUnit - Creates a new SUnit and returns a pointer to it.
      +  SUnit *CreateNewSUnit(SDNode *N) {
      +    SUnit *NewNode = NewSUnit(N);
      +    return NewNode;
      +  }
      +
      +  /// CreateClone - Creates a new SUnit from an existing one.
      +  SUnit *CreateClone(SUnit *N) {
      +    SUnit *NewNode = Clone(N);
      +    return NewNode;
      +  }
      +};
      +}  // end anonymous namespace
      +
      +
      +/// Schedule - Schedule the DAG using list scheduling.
      +void ScheduleDAGFast::Schedule() {
      +  DOUT << "********** List Scheduling **********\n";
      +
      +  LiveRegDefs.resize(TRI->getNumRegs(), NULL);  
      +  LiveRegCycles.resize(TRI->getNumRegs(), 0);
      +
      +  // Build scheduling units.
      +  BuildSchedUnits();
      +
      +  DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
      +          SUnits[su].dumpAll(&DAG));
      +
      +  // Execute the actual scheduling loop.
      +  ListScheduleBottomUp();
      +}
      +
      +//===----------------------------------------------------------------------===//
      +//  Bottom-Up Scheduling
      +//===----------------------------------------------------------------------===//
      +
      +/// ReleasePred - Decrement the NumSuccsLeft count of a predecessor. Add it to
      +/// the AvailableQueue if the count reaches zero. Also update its cycle bound.
      +void ScheduleDAGFast::ReleasePred(SUnit *PredSU, bool isChain, 
      +                                  unsigned CurCycle) {
      +  // FIXME: the distance between two nodes is not always == the predecessor's
      +  // latency. For example, the reader can very well read the register written
      +  // by the predecessor later than the issue cycle. It also depends on the
      +  // interrupt model (drain vs. freeze).
      +  PredSU->CycleBound = std::max(PredSU->CycleBound, CurCycle + PredSU->Latency);
      +
      +  --PredSU->NumSuccsLeft;
      +  
      +#ifndef NDEBUG
      +  if (PredSU->NumSuccsLeft < 0) {
      +    cerr << "*** List scheduling failed! ***\n";
      +    PredSU->dump(&DAG);
      +    cerr << " has been released too many times!\n";
      +    assert(0);
      +  }
      +#endif
      +  
      +  if (PredSU->NumSuccsLeft == 0) {
      +    PredSU->isAvailable = true;
      +    AvailableQueue.push(PredSU);
      +  }
      +}
      +
      +/// ScheduleNodeBottomUp - Add the node to the schedule. Decrement the pending
      +/// count of its predecessors. If a predecessor pending count is zero, add it to
      +/// the Available queue.
      +void ScheduleDAGFast::ScheduleNodeBottomUp(SUnit *SU, unsigned CurCycle) {
      +  DOUT << "*** Scheduling [" << CurCycle << "]: ";
      +  DEBUG(SU->dump(&DAG));
      +  SU->Cycle = CurCycle;
      +
      +  // Bottom up: release predecessors
      +  for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
      +       I != E; ++I) {
      +    ReleasePred(I->Dep, I->isCtrl, CurCycle);
      +    if (I->Cost < 0)  {
      +      // This is a physical register dependency and it's impossible or
      +      // expensive to copy the register. Make sure nothing that can 
      +      // clobber the register is scheduled between the predecessor and
      +      // this node.
      +      if (LiveRegs.insert(I->Reg)) {
      +        LiveRegDefs[I->Reg] = I->Dep;
      +        LiveRegCycles[I->Reg] = CurCycle;
      +      }
      +    }
      +  }
      +
      +  // Release all the implicit physical register defs that are live.
      +  for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
      +       I != E; ++I) {
      +    if (I->Cost < 0)  {
      +      if (LiveRegCycles[I->Reg] == I->Dep->Cycle) {
      +        LiveRegs.erase(I->Reg);
      +        assert(LiveRegDefs[I->Reg] == SU &&
      +               "Physical register dependency violated?");
      +        LiveRegDefs[I->Reg] = NULL;
      +        LiveRegCycles[I->Reg] = 0;
      +      }
      +    }
      +  }
      +
      +  SU->isScheduled = true;
      +}
      +
      +/// AddPred - adds an edge from SUnit X to SUnit Y.
      +bool ScheduleDAGFast::AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool isSpecial,
      +                              unsigned PhyReg, int Cost) {
      +  return Y->addPred(X, isCtrl, isSpecial, PhyReg, Cost);
      +}
      +
      +/// RemovePred - This removes the specified node N from the predecessors of 
      +/// the current node M.
      +bool ScheduleDAGFast::RemovePred(SUnit *M, SUnit *N, 
      +                                 bool isCtrl, bool isSpecial) {
      +  return M->removePred(N, isCtrl, isSpecial);
      +}
      +
      +/// CopyAndMoveSuccessors - Clone the specified node and move its scheduled
      +/// successors to the newly created node.
      +SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
      +  if (SU->FlaggedNodes.size())
      +    return NULL;
      +
      +  SDNode *N = SU->Node;
      +  if (!N)
      +    return NULL;
      +
      +  SUnit *NewSU;
      +  bool TryUnfold = false;
      +  for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) {
      +    MVT VT = N->getValueType(i);
      +    if (VT == MVT::Flag)
      +      return NULL;
      +    else if (VT == MVT::Other)
      +      TryUnfold = true;
      +  }
      +  for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
      +    const SDValue &Op = N->getOperand(i);
      +    MVT VT = Op.getNode()->getValueType(Op.getResNo());
      +    if (VT == MVT::Flag)
      +      return NULL;
      +  }
      +
      +  if (TryUnfold) {
      +    SmallVector NewNodes;
      +    if (!TII->unfoldMemoryOperand(DAG, N, NewNodes))
      +      return NULL;
      +
      +    DOUT << "Unfolding SU # " << SU->NodeNum << "\n";
      +    assert(NewNodes.size() == 2 && "Expected a load folding node!");
      +
      +    N = NewNodes[1];
      +    SDNode *LoadNode = NewNodes[0];
      +    unsigned NumVals = N->getNumValues();
      +    unsigned OldNumVals = SU->Node->getNumValues();
      +    for (unsigned i = 0; i != NumVals; ++i)
      +      DAG.ReplaceAllUsesOfValueWith(SDValue(SU->Node, i), SDValue(N, i));
      +    DAG.ReplaceAllUsesOfValueWith(SDValue(SU->Node, OldNumVals-1),
      +                                  SDValue(LoadNode, 1));
      +
      +    SUnit *NewSU = CreateNewSUnit(N);
      +    assert(N->getNodeId() == -1 && "Node already inserted!");
      +    N->setNodeId(NewSU->NodeNum);
      +      
      +    const TargetInstrDesc &TID = TII->get(N->getMachineOpcode());
      +    for (unsigned i = 0; i != TID.getNumOperands(); ++i) {
      +      if (TID.getOperandConstraint(i, TOI::TIED_TO) != -1) {
      +        NewSU->isTwoAddress = true;
      +        break;
      +      }
      +    }
      +    if (TID.isCommutable())
      +      NewSU->isCommutable = true;
      +    // FIXME: Calculate height / depth and propagate the changes?
      +    NewSU->Depth = SU->Depth;
      +    NewSU->Height = SU->Height;
      +    ComputeLatency(NewSU);
      +
      +    // LoadNode may already exist. This can happen when there is another
      +    // load from the same location and producing the same type of value
      +    // but it has different alignment or volatileness.
      +    bool isNewLoad = true;
      +    SUnit *LoadSU;
      +    if (LoadNode->getNodeId() != -1) {
      +      LoadSU = &SUnits[LoadNode->getNodeId()];
      +      isNewLoad = false;
      +    } else {
      +      LoadSU = CreateNewSUnit(LoadNode);
      +      LoadNode->setNodeId(LoadSU->NodeNum);
      +
      +      LoadSU->Depth = SU->Depth;
      +      LoadSU->Height = SU->Height;
      +      ComputeLatency(LoadSU);
      +    }
      +
      +    SUnit *ChainPred = NULL;
      +    SmallVector ChainSuccs;
      +    SmallVector LoadPreds;
      +    SmallVector NodePreds;
      +    SmallVector NodeSuccs;
      +    for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
      +         I != E; ++I) {
      +      if (I->isCtrl)
      +        ChainPred = I->Dep;
      +      else if (I->Dep->Node && I->Dep->Node->isOperandOf(LoadNode))
      +        LoadPreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false, false));
      +      else
      +        NodePreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false, false));
      +    }
      +    for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
      +         I != E; ++I) {
      +      if (I->isCtrl)
      +        ChainSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
      +                                  I->isCtrl, I->isSpecial));
      +      else
      +        NodeSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
      +                                 I->isCtrl, I->isSpecial));
      +    }
      +
      +    if (ChainPred) {
      +      RemovePred(SU, ChainPred, true, false);
      +      if (isNewLoad)
      +        AddPred(LoadSU, ChainPred, true, false);
      +    }
      +    for (unsigned i = 0, e = LoadPreds.size(); i != e; ++i) {
      +      SDep *Pred = &LoadPreds[i];
      +      RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isSpecial);
      +      if (isNewLoad) {
      +        AddPred(LoadSU, Pred->Dep, Pred->isCtrl, Pred->isSpecial,
      +                Pred->Reg, Pred->Cost);
      +      }
      +    }
      +    for (unsigned i = 0, e = NodePreds.size(); i != e; ++i) {
      +      SDep *Pred = &NodePreds[i];
      +      RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isSpecial);
      +      AddPred(NewSU, Pred->Dep, Pred->isCtrl, Pred->isSpecial,
      +              Pred->Reg, Pred->Cost);
      +    }
      +    for (unsigned i = 0, e = NodeSuccs.size(); i != e; ++i) {
      +      SDep *Succ = &NodeSuccs[i];
      +      RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isSpecial);
      +      AddPred(Succ->Dep, NewSU, Succ->isCtrl, Succ->isSpecial,
      +              Succ->Reg, Succ->Cost);
      +    }
      +    for (unsigned i = 0, e = ChainSuccs.size(); i != e; ++i) {
      +      SDep *Succ = &ChainSuccs[i];
      +      RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isSpecial);
      +      if (isNewLoad) {
      +        AddPred(Succ->Dep, LoadSU, Succ->isCtrl, Succ->isSpecial,
      +                Succ->Reg, Succ->Cost);
      +      }
      +    } 
      +    if (isNewLoad) {
      +      AddPred(NewSU, LoadSU, false, false);
      +    }
      +
      +    ++NumUnfolds;
      +
      +    if (NewSU->NumSuccsLeft == 0) {
      +      NewSU->isAvailable = true;
      +      return NewSU;
      +    }
      +    SU = NewSU;
      +  }
      +
      +  DOUT << "Duplicating SU # " << SU->NodeNum << "\n";
      +  NewSU = CreateClone(SU);
      +
      +  // New SUnit has the exact same predecessors.
      +  for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
      +       I != E; ++I)
      +    if (!I->isSpecial) {
      +      AddPred(NewSU, I->Dep, I->isCtrl, false, I->Reg, I->Cost);
      +      NewSU->Depth = std::max(NewSU->Depth, I->Dep->Depth+1);
      +    }
      +
      +  // Only copy scheduled successors. Cut them from old node's successor
      +  // list and move them over.
      +  SmallVector, 4> DelDeps;
      +  for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
      +       I != E; ++I) {
      +    if (I->isSpecial)
      +      continue;
      +    if (I->Dep->isScheduled) {
      +      NewSU->Height = std::max(NewSU->Height, I->Dep->Height+1);
      +      AddPred(I->Dep, NewSU, I->isCtrl, false, I->Reg, I->Cost);
      +      DelDeps.push_back(std::make_pair(I->Dep, I->isCtrl));
      +    }
      +  }
      +  for (unsigned i = 0, e = DelDeps.size(); i != e; ++i) {
      +    SUnit *Succ = DelDeps[i].first;
      +    bool isCtrl = DelDeps[i].second;
      +    RemovePred(Succ, SU, isCtrl, false);
      +  }
      +
      +  ++NumDups;
      +  return NewSU;
      +}
      +
      +/// InsertCCCopiesAndMoveSuccs - Insert expensive cross register class copies
      +/// and move all scheduled successors of the given SUnit to the last copy.
      +void ScheduleDAGFast::InsertCCCopiesAndMoveSuccs(SUnit *SU, unsigned Reg,
      +                                              const TargetRegisterClass *DestRC,
      +                                              const TargetRegisterClass *SrcRC,
      +                                               SmallVector &Copies) {
      +  SUnit *CopyFromSU = CreateNewSUnit(NULL);
      +  CopyFromSU->CopySrcRC = SrcRC;
      +  CopyFromSU->CopyDstRC = DestRC;
      +
      +  SUnit *CopyToSU = CreateNewSUnit(NULL);
      +  CopyToSU->CopySrcRC = DestRC;
      +  CopyToSU->CopyDstRC = SrcRC;
      +
      +  // Only copy scheduled successors. Cut them from old node's successor
      +  // list and move them over.
      +  SmallVector, 4> DelDeps;
      +  for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
      +       I != E; ++I) {
      +    if (I->isSpecial)
      +      continue;
      +    if (I->Dep->isScheduled) {
      +      AddPred(I->Dep, CopyToSU, I->isCtrl, false, I->Reg, I->Cost);
      +      DelDeps.push_back(std::make_pair(I->Dep, I->isCtrl));
      +    }
      +  }
      +  for (unsigned i = 0, e = DelDeps.size(); i != e; ++i) {
      +    SUnit *Succ = DelDeps[i].first;
      +    bool isCtrl = DelDeps[i].second;
      +    RemovePred(Succ, SU, isCtrl, false);
      +  }
      +
      +  AddPred(CopyFromSU, SU, false, false, Reg, -1);
      +  AddPred(CopyToSU, CopyFromSU, false, false, Reg, 1);
      +
      +  Copies.push_back(CopyFromSU);
      +  Copies.push_back(CopyToSU);
      +
      +  ++NumCCCopies;
      +}
      +
      +/// getPhysicalRegisterVT - Returns the ValueType of the physical register
      +/// definition of the specified node.
      +/// FIXME: Move to SelectionDAG?
      +static MVT getPhysicalRegisterVT(SDNode *N, unsigned Reg,
      +                                 const TargetInstrInfo *TII) {
      +  const TargetInstrDesc &TID = TII->get(N->getMachineOpcode());
      +  assert(TID.ImplicitDefs && "Physical reg def must be in implicit def list!");
      +  unsigned NumRes = TID.getNumDefs();
      +  for (const unsigned *ImpDef = TID.getImplicitDefs(); *ImpDef; ++ImpDef) {
      +    if (Reg == *ImpDef)
      +      break;
      +    ++NumRes;
      +  }
      +  return N->getValueType(NumRes);
      +}
      +
      +/// DelayForLiveRegsBottomUp - Returns true if it is necessary to delay
      +/// scheduling of the given node to satisfy live physical register dependencies.
      +/// If the specific node is the last one that's available to schedule, do
      +/// whatever is necessary (i.e. backtracking or cloning) to make it possible.
      +bool ScheduleDAGFast::DelayForLiveRegsBottomUp(SUnit *SU,
      +                                               SmallVector &LRegs){
      +  if (LiveRegs.empty())
      +    return false;
      +
      +  SmallSet RegAdded;
      +  // If this node would clobber any "live" register, then it's not ready.
      +  for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end();
      +       I != E; ++I) {
      +    if (I->Cost < 0)  {
      +      unsigned Reg = I->Reg;
      +      if (LiveRegs.count(Reg) && LiveRegDefs[Reg] != I->Dep) {
      +        if (RegAdded.insert(Reg))
      +          LRegs.push_back(Reg);
      +      }
      +      for (const unsigned *Alias = TRI->getAliasSet(Reg);
      +           *Alias; ++Alias)
      +        if (LiveRegs.count(*Alias) && LiveRegDefs[*Alias] != I->Dep) {
      +          if (RegAdded.insert(*Alias))
      +            LRegs.push_back(*Alias);
      +        }
      +    }
      +  }
      +
      +  for (unsigned i = 0, e = SU->FlaggedNodes.size()+1; i != e; ++i) {
      +    SDNode *Node = (i == 0) ? SU->Node : SU->FlaggedNodes[i-1];
      +    if (!Node || !Node->isMachineOpcode())
      +      continue;
      +    const TargetInstrDesc &TID = TII->get(Node->getMachineOpcode());
      +    if (!TID.ImplicitDefs)
      +      continue;
      +    for (const unsigned *Reg = TID.ImplicitDefs; *Reg; ++Reg) {
      +      if (LiveRegs.count(*Reg) && LiveRegDefs[*Reg] != SU) {
      +        if (RegAdded.insert(*Reg))
      +          LRegs.push_back(*Reg);
      +      }
      +      for (const unsigned *Alias = TRI->getAliasSet(*Reg);
      +           *Alias; ++Alias)
      +        if (LiveRegs.count(*Alias) && LiveRegDefs[*Alias] != SU) {
      +          if (RegAdded.insert(*Alias))
      +            LRegs.push_back(*Alias);
      +        }
      +    }
      +  }
      +  return !LRegs.empty();
      +}
      +
      +
      +/// ListScheduleBottomUp - The main loop of list scheduling for bottom-up
      +/// schedulers.
      +void ScheduleDAGFast::ListScheduleBottomUp() {
      +  unsigned CurCycle = 0;
      +  // Add root to Available queue.
      +  if (!SUnits.empty()) {
      +    SUnit *RootSU = &SUnits[DAG.getRoot().getNode()->getNodeId()];
      +    assert(RootSU->Succs.empty() && "Graph root shouldn't have successors!");
      +    RootSU->isAvailable = true;
      +    AvailableQueue.push(RootSU);
      +  }
      +
      +  // While Available queue is not empty, grab the node with the highest
      +  // priority. If it is not ready put it back.  Schedule the node.
      +  SmallVector NotReady;
      +  DenseMap > LRegsMap;
      +  Sequence.reserve(SUnits.size());
      +  while (!AvailableQueue.empty()) {
      +    bool Delayed = false;
      +    LRegsMap.clear();
      +    SUnit *CurSU = AvailableQueue.pop();
      +    while (CurSU) {
      +      if (CurSU->CycleBound <= CurCycle) {
      +        SmallVector LRegs;
      +        if (!DelayForLiveRegsBottomUp(CurSU, LRegs))
      +          break;
      +        Delayed = true;
      +        LRegsMap.insert(std::make_pair(CurSU, LRegs));
      +      }
      +
      +      CurSU->isPending = true;  // This SU is not in AvailableQueue right now.
      +      NotReady.push_back(CurSU);
      +      CurSU = AvailableQueue.pop();
      +    }
      +
      +    // All candidates are delayed due to live physical reg dependencies.
      +    // Try code duplication or inserting cross class copies
      +    // to resolve it.
      +    if (Delayed && !CurSU) {
      +      if (!CurSU) {
      +        // Try duplicating the nodes that produces these
      +        // "expensive to copy" values to break the dependency. In case even
      +        // that doesn't work, insert cross class copies.
      +        SUnit *TrySU = NotReady[0];
      +        SmallVector &LRegs = LRegsMap[TrySU];
      +        assert(LRegs.size() == 1 && "Can't handle this yet!");
      +        unsigned Reg = LRegs[0];
      +        SUnit *LRDef = LiveRegDefs[Reg];
      +        SUnit *NewDef = CopyAndMoveSuccessors(LRDef);
      +        if (!NewDef) {
      +          // Issue expensive cross register class copies.
      +          MVT VT = getPhysicalRegisterVT(LRDef->Node, Reg, TII);
      +          const TargetRegisterClass *RC =
      +            TRI->getPhysicalRegisterRegClass(Reg, VT);
      +          const TargetRegisterClass *DestRC = TRI->getCrossCopyRegClass(RC);
      +          if (!DestRC) {
      +            assert(false && "Don't know how to copy this physical register!");
      +            abort();
      +          }
      +          SmallVector Copies;
      +          InsertCCCopiesAndMoveSuccs(LRDef, Reg, DestRC, RC, Copies);
      +          DOUT << "Adding an edge from SU # " << TrySU->NodeNum
      +               << " to SU #" << Copies.front()->NodeNum << "\n";
      +          AddPred(TrySU, Copies.front(), true, true);
      +          NewDef = Copies.back();
      +        }
      +
      +        DOUT << "Adding an edge from SU # " << NewDef->NodeNum
      +             << " to SU #" << TrySU->NodeNum << "\n";
      +        LiveRegDefs[Reg] = NewDef;
      +        AddPred(NewDef, TrySU, true, true);
      +        TrySU->isAvailable = false;
      +        CurSU = NewDef;
      +      }
      +
      +      if (!CurSU) {
      +        assert(false && "Unable to resolve live physical register dependencies!");
      +        abort();
      +      }
      +    }
      +
      +    // Add the nodes that aren't ready back onto the available list.
      +    for (unsigned i = 0, e = NotReady.size(); i != e; ++i) {
      +      NotReady[i]->isPending = false;
      +      // May no longer be available due to backtracking.
      +      if (NotReady[i]->isAvailable)
      +        AvailableQueue.push(NotReady[i]);
      +    }
      +    NotReady.clear();
      +
      +    if (!CurSU)
      +      Sequence.push_back(0);
      +    else {
      +      ScheduleNodeBottomUp(CurSU, CurCycle);
      +      Sequence.push_back(CurSU);
      +    }
      +    ++CurCycle;
      +  }
      +
      +  // Reverse the order if it is bottom up.
      +  std::reverse(Sequence.begin(), Sequence.end());
      +  
      +  
      +#ifndef NDEBUG
      +  // Verify that all SUnits were scheduled.
      +  bool AnyNotSched = false;
      +  unsigned DeadNodes = 0;
      +  unsigned Noops = 0;
      +  for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
      +    if (!SUnits[i].isScheduled) {
      +      if (SUnits[i].NumPreds == 0 && SUnits[i].NumSuccs == 0) {
      +        ++DeadNodes;
      +        continue;
      +      }
      +      if (!AnyNotSched)
      +        cerr << "*** List scheduling failed! ***\n";
      +      SUnits[i].dump(&DAG);
      +      cerr << "has not been scheduled!\n";
      +      AnyNotSched = true;
      +    }
      +    if (SUnits[i].NumSuccsLeft != 0) {
      +      if (!AnyNotSched)
      +        cerr << "*** List scheduling failed! ***\n";
      +      SUnits[i].dump(&DAG);
      +      cerr << "has successors left!\n";
      +      AnyNotSched = true;
      +    }
      +  }
      +  for (unsigned i = 0, e = Sequence.size(); i != e; ++i)
      +    if (!Sequence[i])
      +      ++Noops;
      +  assert(!AnyNotSched);
      +  assert(Sequence.size() + DeadNodes - Noops == SUnits.size() &&
      +         "The number of nodes scheduled doesn't match the expected number!");
      +#endif
      +}
      +
      +//===----------------------------------------------------------------------===//
      +//                         Public Constructor Functions
      +//===----------------------------------------------------------------------===//
      +
      +llvm::ScheduleDAG* llvm::createFastDAGScheduler(SelectionDAGISel *IS,
      +                                                SelectionDAG *DAG,
      +                                                MachineBasicBlock *BB, bool) {
      +  return new ScheduleDAGFast(*DAG, BB, DAG->getTarget());
      +}
      
      
      
      
      From evan.cheng at apple.com  Thu Sep 18 11:47:47 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Thu, 18 Sep 2008 09:47:47 -0700
      Subject: [llvm-commits] [llvm] r56307 - in /llvm/trunk:
      	include/llvm/CodeGen/LinkAllCodegenComponents.h
      	include/llvm/CodeGen/ScheduleDAG.h
      	lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
      In-Reply-To: <200809181626.m8IGQTKo030214@zion.cs.uiuc.edu>
      References: <200809181626.m8IGQTKo030214@zion.cs.uiuc.edu>
      Message-ID: <48A9BBBB-728D-4BFB-B915-E0B827F3F44F@apple.com>
      
      How does this deal with physical register dependencies?
      
      Evan
      
      On Sep 18, 2008, at 9:26 AM, Dan Gohman wrote:
      
      > Author: djg
      > Date: Thu Sep 18 11:26:26 2008
      > New Revision: 56307
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=56307&view=rev
      > Log:
      > Add a new "fast" scheduler. This is currently basically just a
      > copy of the BURRList scheduler, but with several parts ripped
      > out, such as backtracking, online topological sort maintenance
      > (needed by backtracking), the priority queue, and Sethi-Ullman
      > number computation and maintenance (needed by the priority
      > queue). As a result of all this, it generates somewhat lower
      > quality code, but that's its tradeoff for running about 30%
      > faster than list-burr in -fast mode in many cases.
      >
      > This is somewhat experimental. Moving forward, major pieces of
      > this can be refactored with pieces in common with
      > ScheduleDAGRRList.cpp.
      >
      > Added:
      >    llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
      > Modified:
      >    llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h
      >    llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
      >
      > Modified: llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h?rev=56307&r1=56306&r2=56307&view=diff
      >
      > =
      > =
      > =
      > =
      > =
      > =
      > =
      > =
      > ======================================================================
      > --- llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h  
      > (original)
      > +++ llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h Thu  
      > Sep 18 11:26:26 2008
      > @@ -44,6 +44,7 @@
      >       (void) llvm::createBURRListDAGScheduler(NULL, NULL, NULL,  
      > false);
      >       (void) llvm::createTDRRListDAGScheduler(NULL, NULL, NULL,  
      > false);
      >       (void) llvm::createTDListDAGScheduler(NULL, NULL, NULL, false);
      > +      (void) llvm::createFastDAGScheduler(NULL, NULL, NULL, false);
      >       (void) llvm::createDefaultScheduler(NULL, NULL, NULL, false);
      >
      >     }
      >
      > Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=56307&r1=56306&r2=56307&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original)
      > +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Thu Sep 18  
      > 11:26:26 2008
      > @@ -414,6 +414,13 @@
      >                                         MachineBasicBlock *BB,
      >                                         bool Fast);
      >
      > +  /// createFastDAGScheduler - This creates a "fast" scheduler.
      > +  ///
      > +  ScheduleDAG *createFastDAGScheduler(SelectionDAGISel *IS,
      > +                                      SelectionDAG *DAG,
      > +                                      MachineBasicBlock *BB,
      > +                                      bool Fast);
      > +
      >   /// createDefaultScheduler - This creates an instruction scheduler  
      > appropriate
      >   /// for the target.
      >   ScheduleDAG* createDefaultScheduler(SelectionDAGISel *IS,
      >
      > Added: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp?rev=56307&view=auto
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp (added)
      > +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp Thu Sep  
      > 18 11:26:26 2008
      > @@ -0,0 +1,654 @@
      > +//===----- ScheduleDAGFast.cpp - Fast poor list scheduler  
      > -----------------===//
      > +//
      > +//                     The LLVM Compiler Infrastructure
      > +//
      > +// This file is distributed under the University of Illinois Open  
      > Source
      > +// License. See LICENSE.TXT for details.
      > +//
      > +// 
      > = 
      > = 
      > = 
      > ----------------------------------------------------------------------= 
      > ==//
      > +//
      > +// This implements a fast scheduler.
      > +//
      > +// 
      > = 
      > = 
      > = 
      > ----------------------------------------------------------------------= 
      > ==//
      > +
      > +#define DEBUG_TYPE "pre-RA-sched"
      > +#include "llvm/CodeGen/ScheduleDAG.h"
      > +#include "llvm/CodeGen/SchedulerRegistry.h"
      > +#include "llvm/Target/TargetRegisterInfo.h"
      > +#include "llvm/Target/TargetData.h"
      > +#include "llvm/Target/TargetMachine.h"
      > +#include "llvm/Target/TargetInstrInfo.h"
      > +#include "llvm/Support/Debug.h"
      > +#include "llvm/Support/Compiler.h"
      > +#include "llvm/ADT/SmallSet.h"
      > +#include "llvm/ADT/Statistic.h"
      > +#include "llvm/ADT/STLExtras.h"
      > +#include "llvm/Support/CommandLine.h"
      > +using namespace llvm;
      > +
      > +STATISTIC(NumUnfolds,    "Number of nodes unfolded");
      > +STATISTIC(NumDups,       "Number of duplicated nodes");
      > +STATISTIC(NumCCCopies,   "Number of cross class copies");
      > +
      > +static RegisterScheduler
      > +  fastDAGScheduler("fast", "  Fast suboptimal list scheduling",
      > +                   createFastDAGScheduler);
      > +
      > +namespace {
      > +  /// FastPriorityQueue - A degenerate priority queue that considers
      > +  /// all nodes to have the same priority.
      > +  ///
      > +  struct VISIBILITY_HIDDEN FastPriorityQueue {
      > +    std::vector Queue;
      > +
      > +    bool empty() const { return Queue.empty(); }
      > +
      > +    void push(SUnit *U) {
      > +      Queue.push_back(U);
      > +    }
      > +
      > +    SUnit *pop() {
      > +      if (empty()) return NULL;
      > +      SUnit *V = Queue.back();
      > +      Queue.pop_back();
      > +      return V;
      > +    }
      > +  };
      > +
      > +// 
      > = 
      > = 
      > = 
      > ----------------------------------------------------------------------= 
      > ==//
      > +/// ScheduleDAGFast - The actual "fast" list scheduler  
      > implementation.
      > +///
      > +class VISIBILITY_HIDDEN ScheduleDAGFast : public ScheduleDAG {
      > +private:
      > +  /// AvailableQueue - The priority queue to use for the available  
      > SUnits.
      > +  FastPriorityQueue AvailableQueue;
      > +
      > +  /// LiveRegs / LiveRegDefs - A set of physical registers and  
      > their definition
      > +  /// that are "live". These nodes must be scheduled before any  
      > other nodes that
      > +  /// modifies the registers can be scheduled.
      > +  SmallSet LiveRegs;
      > +  std::vector LiveRegDefs;
      > +  std::vector LiveRegCycles;
      > +
      > +public:
      > +  ScheduleDAGFast(SelectionDAG &dag, MachineBasicBlock *bb,
      > +                  const TargetMachine &tm)
      > +    : ScheduleDAG(dag, bb, tm) {}
      > +
      > +  void Schedule();
      > +
      > +  /// AddPred - This adds the specified node X as a predecessor of
      > +  /// the current node Y if not already.
      > +  /// This returns true if this is a new predecessor.
      > +  bool AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool isSpecial,
      > +               unsigned PhyReg = 0, int Cost = 1);
      > +
      > +  /// RemovePred - This removes the specified node N from the  
      > predecessors of
      > +  /// the current node M.
      > +  bool RemovePred(SUnit *M, SUnit *N, bool isCtrl, bool isSpecial);
      > +
      > +private:
      > +  void ReleasePred(SUnit*, bool, unsigned);
      > +  void ScheduleNodeBottomUp(SUnit*, unsigned);
      > +  SUnit *CopyAndMoveSuccessors(SUnit*);
      > +  void InsertCCCopiesAndMoveSuccs(SUnit*, unsigned,
      > +                                  const TargetRegisterClass*,
      > +                                  const TargetRegisterClass*,
      > +                                  SmallVector&);
      > +  bool DelayForLiveRegsBottomUp(SUnit*, SmallVector&);
      > +  void ListScheduleBottomUp();
      > +
      > +  /// CreateNewSUnit - Creates a new SUnit and returns a pointer to  
      > it.
      > +  SUnit *CreateNewSUnit(SDNode *N) {
      > +    SUnit *NewNode = NewSUnit(N);
      > +    return NewNode;
      > +  }
      > +
      > +  /// CreateClone - Creates a new SUnit from an existing one.
      > +  SUnit *CreateClone(SUnit *N) {
      > +    SUnit *NewNode = Clone(N);
      > +    return NewNode;
      > +  }
      > +};
      > +}  // end anonymous namespace
      > +
      > +
      > +/// Schedule - Schedule the DAG using list scheduling.
      > +void ScheduleDAGFast::Schedule() {
      > +  DOUT << "********** List Scheduling **********\n";
      > +
      > +  LiveRegDefs.resize(TRI->getNumRegs(), NULL);
      > +  LiveRegCycles.resize(TRI->getNumRegs(), 0);
      > +
      > +  // Build scheduling units.
      > +  BuildSchedUnits();
      > +
      > +  DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
      > +          SUnits[su].dumpAll(&DAG));
      > +
      > +  // Execute the actual scheduling loop.
      > +  ListScheduleBottomUp();
      > +}
      > +
      > +// 
      > = 
      > = 
      > = 
      > ----------------------------------------------------------------------= 
      > ==//
      > +//  Bottom-Up Scheduling
      > +// 
      > = 
      > = 
      > = 
      > ----------------------------------------------------------------------= 
      > ==//
      > +
      > +/// ReleasePred - Decrement the NumSuccsLeft count of a  
      > predecessor. Add it to
      > +/// the AvailableQueue if the count reaches zero. Also update its  
      > cycle bound.
      > +void ScheduleDAGFast::ReleasePred(SUnit *PredSU, bool isChain,
      > +                                  unsigned CurCycle) {
      > +  // FIXME: the distance between two nodes is not always == the  
      > predecessor's
      > +  // latency. For example, the reader can very well read the  
      > register written
      > +  // by the predecessor later than the issue cycle. It also depends  
      > on the
      > +  // interrupt model (drain vs. freeze).
      > +  PredSU->CycleBound = std::max(PredSU->CycleBound, CurCycle +  
      > PredSU->Latency);
      > +
      > +  --PredSU->NumSuccsLeft;
      > +
      > +#ifndef NDEBUG
      > +  if (PredSU->NumSuccsLeft < 0) {
      > +    cerr << "*** List scheduling failed! ***\n";
      > +    PredSU->dump(&DAG);
      > +    cerr << " has been released too many times!\n";
      > +    assert(0);
      > +  }
      > +#endif
      > +
      > +  if (PredSU->NumSuccsLeft == 0) {
      > +    PredSU->isAvailable = true;
      > +    AvailableQueue.push(PredSU);
      > +  }
      > +}
      > +
      > +/// ScheduleNodeBottomUp - Add the node to the schedule. Decrement  
      > the pending
      > +/// count of its predecessors. If a predecessor pending count is  
      > zero, add it to
      > +/// the Available queue.
      > +void ScheduleDAGFast::ScheduleNodeBottomUp(SUnit *SU, unsigned  
      > CurCycle) {
      > +  DOUT << "*** Scheduling [" << CurCycle << "]: ";
      > +  DEBUG(SU->dump(&DAG));
      > +  SU->Cycle = CurCycle;
      > +
      > +  // Bottom up: release predecessors
      > +  for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU- 
      > >Preds.end();
      > +       I != E; ++I) {
      > +    ReleasePred(I->Dep, I->isCtrl, CurCycle);
      > +    if (I->Cost < 0)  {
      > +      // This is a physical register dependency and it's impossible  
      > or
      > +      // expensive to copy the register. Make sure nothing that can
      > +      // clobber the register is scheduled between the predecessor  
      > and
      > +      // this node.
      > +      if (LiveRegs.insert(I->Reg)) {
      > +        LiveRegDefs[I->Reg] = I->Dep;
      > +        LiveRegCycles[I->Reg] = CurCycle;
      > +      }
      > +    }
      > +  }
      > +
      > +  // Release all the implicit physical register defs that are live.
      > +  for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU- 
      > >Succs.end();
      > +       I != E; ++I) {
      > +    if (I->Cost < 0)  {
      > +      if (LiveRegCycles[I->Reg] == I->Dep->Cycle) {
      > +        LiveRegs.erase(I->Reg);
      > +        assert(LiveRegDefs[I->Reg] == SU &&
      > +               "Physical register dependency violated?");
      > +        LiveRegDefs[I->Reg] = NULL;
      > +        LiveRegCycles[I->Reg] = 0;
      > +      }
      > +    }
      > +  }
      > +
      > +  SU->isScheduled = true;
      > +}
      > +
      > +/// AddPred - adds an edge from SUnit X to SUnit Y.
      > +bool ScheduleDAGFast::AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool  
      > isSpecial,
      > +                              unsigned PhyReg, int Cost) {
      > +  return Y->addPred(X, isCtrl, isSpecial, PhyReg, Cost);
      > +}
      > +
      > +/// RemovePred - This removes the specified node N from the  
      > predecessors of
      > +/// the current node M.
      > +bool ScheduleDAGFast::RemovePred(SUnit *M, SUnit *N,
      > +                                 bool isCtrl, bool isSpecial) {
      > +  return M->removePred(N, isCtrl, isSpecial);
      > +}
      > +
      > +/// CopyAndMoveSuccessors - Clone the specified node and move its  
      > scheduled
      > +/// successors to the newly created node.
      > +SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
      > +  if (SU->FlaggedNodes.size())
      > +    return NULL;
      > +
      > +  SDNode *N = SU->Node;
      > +  if (!N)
      > +    return NULL;
      > +
      > +  SUnit *NewSU;
      > +  bool TryUnfold = false;
      > +  for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) {
      > +    MVT VT = N->getValueType(i);
      > +    if (VT == MVT::Flag)
      > +      return NULL;
      > +    else if (VT == MVT::Other)
      > +      TryUnfold = true;
      > +  }
      > +  for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
      > +    const SDValue &Op = N->getOperand(i);
      > +    MVT VT = Op.getNode()->getValueType(Op.getResNo());
      > +    if (VT == MVT::Flag)
      > +      return NULL;
      > +  }
      > +
      > +  if (TryUnfold) {
      > +    SmallVector NewNodes;
      > +    if (!TII->unfoldMemoryOperand(DAG, N, NewNodes))
      > +      return NULL;
      > +
      > +    DOUT << "Unfolding SU # " << SU->NodeNum << "\n";
      > +    assert(NewNodes.size() == 2 && "Expected a load folding node!");
      > +
      > +    N = NewNodes[1];
      > +    SDNode *LoadNode = NewNodes[0];
      > +    unsigned NumVals = N->getNumValues();
      > +    unsigned OldNumVals = SU->Node->getNumValues();
      > +    for (unsigned i = 0; i != NumVals; ++i)
      > +      DAG.ReplaceAllUsesOfValueWith(SDValue(SU->Node, i),  
      > SDValue(N, i));
      > +    DAG.ReplaceAllUsesOfValueWith(SDValue(SU->Node, OldNumVals-1),
      > +                                  SDValue(LoadNode, 1));
      > +
      > +    SUnit *NewSU = CreateNewSUnit(N);
      > +    assert(N->getNodeId() == -1 && "Node already inserted!");
      > +    N->setNodeId(NewSU->NodeNum);
      > +
      > +    const TargetInstrDesc &TID = TII->get(N->getMachineOpcode());
      > +    for (unsigned i = 0; i != TID.getNumOperands(); ++i) {
      > +      if (TID.getOperandConstraint(i, TOI::TIED_TO) != -1) {
      > +        NewSU->isTwoAddress = true;
      > +        break;
      > +      }
      > +    }
      > +    if (TID.isCommutable())
      > +      NewSU->isCommutable = true;
      > +    // FIXME: Calculate height / depth and propagate the changes?
      > +    NewSU->Depth = SU->Depth;
      > +    NewSU->Height = SU->Height;
      > +    ComputeLatency(NewSU);
      > +
      > +    // LoadNode may already exist. This can happen when there is  
      > another
      > +    // load from the same location and producing the same type of  
      > value
      > +    // but it has different alignment or volatileness.
      > +    bool isNewLoad = true;
      > +    SUnit *LoadSU;
      > +    if (LoadNode->getNodeId() != -1) {
      > +      LoadSU = &SUnits[LoadNode->getNodeId()];
      > +      isNewLoad = false;
      > +    } else {
      > +      LoadSU = CreateNewSUnit(LoadNode);
      > +      LoadNode->setNodeId(LoadSU->NodeNum);
      > +
      > +      LoadSU->Depth = SU->Depth;
      > +      LoadSU->Height = SU->Height;
      > +      ComputeLatency(LoadSU);
      > +    }
      > +
      > +    SUnit *ChainPred = NULL;
      > +    SmallVector ChainSuccs;
      > +    SmallVector LoadPreds;
      > +    SmallVector NodePreds;
      > +    SmallVector NodeSuccs;
      > +    for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU- 
      > >Preds.end();
      > +         I != E; ++I) {
      > +      if (I->isCtrl)
      > +        ChainPred = I->Dep;
      > +      else if (I->Dep->Node && I->Dep->Node->isOperandOf(LoadNode))
      > +        LoadPreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false,  
      > false));
      > +      else
      > +        NodePreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false,  
      > false));
      > +    }
      > +    for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU- 
      > >Succs.end();
      > +         I != E; ++I) {
      > +      if (I->isCtrl)
      > +        ChainSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
      > +                                  I->isCtrl, I->isSpecial));
      > +      else
      > +        NodeSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
      > +                                 I->isCtrl, I->isSpecial));
      > +    }
      > +
      > +    if (ChainPred) {
      > +      RemovePred(SU, ChainPred, true, false);
      > +      if (isNewLoad)
      > +        AddPred(LoadSU, ChainPred, true, false);
      > +    }
      > +    for (unsigned i = 0, e = LoadPreds.size(); i != e; ++i) {
      > +      SDep *Pred = &LoadPreds[i];
      > +      RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isSpecial);
      > +      if (isNewLoad) {
      > +        AddPred(LoadSU, Pred->Dep, Pred->isCtrl, Pred->isSpecial,
      > +                Pred->Reg, Pred->Cost);
      > +      }
      > +    }
      > +    for (unsigned i = 0, e = NodePreds.size(); i != e; ++i) {
      > +      SDep *Pred = &NodePreds[i];
      > +      RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isSpecial);
      > +      AddPred(NewSU, Pred->Dep, Pred->isCtrl, Pred->isSpecial,
      > +              Pred->Reg, Pred->Cost);
      > +    }
      > +    for (unsigned i = 0, e = NodeSuccs.size(); i != e; ++i) {
      > +      SDep *Succ = &NodeSuccs[i];
      > +      RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isSpecial);
      > +      AddPred(Succ->Dep, NewSU, Succ->isCtrl, Succ->isSpecial,
      > +              Succ->Reg, Succ->Cost);
      > +    }
      > +    for (unsigned i = 0, e = ChainSuccs.size(); i != e; ++i) {
      > +      SDep *Succ = &ChainSuccs[i];
      > +      RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isSpecial);
      > +      if (isNewLoad) {
      > +        AddPred(Succ->Dep, LoadSU, Succ->isCtrl, Succ->isSpecial,
      > +                Succ->Reg, Succ->Cost);
      > +      }
      > +    }
      > +    if (isNewLoad) {
      > +      AddPred(NewSU, LoadSU, false, false);
      > +    }
      > +
      > +    ++NumUnfolds;
      > +
      > +    if (NewSU->NumSuccsLeft == 0) {
      > +      NewSU->isAvailable = true;
      > +      return NewSU;
      > +    }
      > +    SU = NewSU;
      > +  }
      > +
      > +  DOUT << "Duplicating SU # " << SU->NodeNum << "\n";
      > +  NewSU = CreateClone(SU);
      > +
      > +  // New SUnit has the exact same predecessors.
      > +  for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU- 
      > >Preds.end();
      > +       I != E; ++I)
      > +    if (!I->isSpecial) {
      > +      AddPred(NewSU, I->Dep, I->isCtrl, false, I->Reg, I->Cost);
      > +      NewSU->Depth = std::max(NewSU->Depth, I->Dep->Depth+1);
      > +    }
      > +
      > +  // Only copy scheduled successors. Cut them from old node's  
      > successor
      > +  // list and move them over.
      > +  SmallVector, 4> DelDeps;
      > +  for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU- 
      > >Succs.end();
      > +       I != E; ++I) {
      > +    if (I->isSpecial)
      > +      continue;
      > +    if (I->Dep->isScheduled) {
      > +      NewSU->Height = std::max(NewSU->Height, I->Dep->Height+1);
      > +      AddPred(I->Dep, NewSU, I->isCtrl, false, I->Reg, I->Cost);
      > +      DelDeps.push_back(std::make_pair(I->Dep, I->isCtrl));
      > +    }
      > +  }
      > +  for (unsigned i = 0, e = DelDeps.size(); i != e; ++i) {
      > +    SUnit *Succ = DelDeps[i].first;
      > +    bool isCtrl = DelDeps[i].second;
      > +    RemovePred(Succ, SU, isCtrl, false);
      > +  }
      > +
      > +  ++NumDups;
      > +  return NewSU;
      > +}
      > +
      > +/// InsertCCCopiesAndMoveSuccs - Insert expensive cross register  
      > class copies
      > +/// and move all scheduled successors of the given SUnit to the  
      > last copy.
      > +void ScheduleDAGFast::InsertCCCopiesAndMoveSuccs(SUnit *SU,  
      > unsigned Reg,
      > +                                              const  
      > TargetRegisterClass *DestRC,
      > +                                              const  
      > TargetRegisterClass *SrcRC,
      > +                                               SmallVector 2> &Copies) {
      > +  SUnit *CopyFromSU = CreateNewSUnit(NULL);
      > +  CopyFromSU->CopySrcRC = SrcRC;
      > +  CopyFromSU->CopyDstRC = DestRC;
      > +
      > +  SUnit *CopyToSU = CreateNewSUnit(NULL);
      > +  CopyToSU->CopySrcRC = DestRC;
      > +  CopyToSU->CopyDstRC = SrcRC;
      > +
      > +  // Only copy scheduled successors. Cut them from old node's  
      > successor
      > +  // list and move them over.
      > +  SmallVector, 4> DelDeps;
      > +  for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU- 
      > >Succs.end();
      > +       I != E; ++I) {
      > +    if (I->isSpecial)
      > +      continue;
      > +    if (I->Dep->isScheduled) {
      > +      AddPred(I->Dep, CopyToSU, I->isCtrl, false, I->Reg, I->Cost);
      > +      DelDeps.push_back(std::make_pair(I->Dep, I->isCtrl));
      > +    }
      > +  }
      > +  for (unsigned i = 0, e = DelDeps.size(); i != e; ++i) {
      > +    SUnit *Succ = DelDeps[i].first;
      > +    bool isCtrl = DelDeps[i].second;
      > +    RemovePred(Succ, SU, isCtrl, false);
      > +  }
      > +
      > +  AddPred(CopyFromSU, SU, false, false, Reg, -1);
      > +  AddPred(CopyToSU, CopyFromSU, false, false, Reg, 1);
      > +
      > +  Copies.push_back(CopyFromSU);
      > +  Copies.push_back(CopyToSU);
      > +
      > +  ++NumCCCopies;
      > +}
      > +
      > +/// getPhysicalRegisterVT - Returns the ValueType of the physical  
      > register
      > +/// definition of the specified node.
      > +/// FIXME: Move to SelectionDAG?
      > +static MVT getPhysicalRegisterVT(SDNode *N, unsigned Reg,
      > +                                 const TargetInstrInfo *TII) {
      > +  const TargetInstrDesc &TID = TII->get(N->getMachineOpcode());
      > +  assert(TID.ImplicitDefs && "Physical reg def must be in implicit  
      > def list!");
      > +  unsigned NumRes = TID.getNumDefs();
      > +  for (const unsigned *ImpDef = TID.getImplicitDefs(); *ImpDef; + 
      > +ImpDef) {
      > +    if (Reg == *ImpDef)
      > +      break;
      > +    ++NumRes;
      > +  }
      > +  return N->getValueType(NumRes);
      > +}
      > +
      > +/// DelayForLiveRegsBottomUp - Returns true if it is necessary to  
      > delay
      > +/// scheduling of the given node to satisfy live physical register  
      > dependencies.
      > +/// If the specific node is the last one that's available to  
      > schedule, do
      > +/// whatever is necessary (i.e. backtracking or cloning) to make it  
      > possible.
      > +bool ScheduleDAGFast::DelayForLiveRegsBottomUp(SUnit *SU,
      > +                                                
      > SmallVector &LRegs){
      > +  if (LiveRegs.empty())
      > +    return false;
      > +
      > +  SmallSet RegAdded;
      > +  // If this node would clobber any "live" register, then it's not  
      > ready.
      > +  for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU- 
      > >Preds.end();
      > +       I != E; ++I) {
      > +    if (I->Cost < 0)  {
      > +      unsigned Reg = I->Reg;
      > +      if (LiveRegs.count(Reg) && LiveRegDefs[Reg] != I->Dep) {
      > +        if (RegAdded.insert(Reg))
      > +          LRegs.push_back(Reg);
      > +      }
      > +      for (const unsigned *Alias = TRI->getAliasSet(Reg);
      > +           *Alias; ++Alias)
      > +        if (LiveRegs.count(*Alias) && LiveRegDefs[*Alias] != I- 
      > >Dep) {
      > +          if (RegAdded.insert(*Alias))
      > +            LRegs.push_back(*Alias);
      > +        }
      > +    }
      > +  }
      > +
      > +  for (unsigned i = 0, e = SU->FlaggedNodes.size()+1; i != e; ++i) {
      > +    SDNode *Node = (i == 0) ? SU->Node : SU->FlaggedNodes[i-1];
      > +    if (!Node || !Node->isMachineOpcode())
      > +      continue;
      > +    const TargetInstrDesc &TID = TII->get(Node->getMachineOpcode());
      > +    if (!TID.ImplicitDefs)
      > +      continue;
      > +    for (const unsigned *Reg = TID.ImplicitDefs; *Reg; ++Reg) {
      > +      if (LiveRegs.count(*Reg) && LiveRegDefs[*Reg] != SU) {
      > +        if (RegAdded.insert(*Reg))
      > +          LRegs.push_back(*Reg);
      > +      }
      > +      for (const unsigned *Alias = TRI->getAliasSet(*Reg);
      > +           *Alias; ++Alias)
      > +        if (LiveRegs.count(*Alias) && LiveRegDefs[*Alias] != SU) {
      > +          if (RegAdded.insert(*Alias))
      > +            LRegs.push_back(*Alias);
      > +        }
      > +    }
      > +  }
      > +  return !LRegs.empty();
      > +}
      > +
      > +
      > +/// ListScheduleBottomUp - The main loop of list scheduling for  
      > bottom-up
      > +/// schedulers.
      > +void ScheduleDAGFast::ListScheduleBottomUp() {
      > +  unsigned CurCycle = 0;
      > +  // Add root to Available queue.
      > +  if (!SUnits.empty()) {
      > +    SUnit *RootSU = &SUnits[DAG.getRoot().getNode()->getNodeId()];
      > +    assert(RootSU->Succs.empty() && "Graph root shouldn't have  
      > successors!");
      > +    RootSU->isAvailable = true;
      > +    AvailableQueue.push(RootSU);
      > +  }
      > +
      > +  // While Available queue is not empty, grab the node with the  
      > highest
      > +  // priority. If it is not ready put it back.  Schedule the node.
      > +  SmallVector NotReady;
      > +  DenseMap > LRegsMap;
      > +  Sequence.reserve(SUnits.size());
      > +  while (!AvailableQueue.empty()) {
      > +    bool Delayed = false;
      > +    LRegsMap.clear();
      > +    SUnit *CurSU = AvailableQueue.pop();
      > +    while (CurSU) {
      > +      if (CurSU->CycleBound <= CurCycle) {
      > +        SmallVector LRegs;
      > +        if (!DelayForLiveRegsBottomUp(CurSU, LRegs))
      > +          break;
      > +        Delayed = true;
      > +        LRegsMap.insert(std::make_pair(CurSU, LRegs));
      > +      }
      > +
      > +      CurSU->isPending = true;  // This SU is not in AvailableQueue  
      > right now.
      > +      NotReady.push_back(CurSU);
      > +      CurSU = AvailableQueue.pop();
      > +    }
      > +
      > +    // All candidates are delayed due to live physical reg  
      > dependencies.
      > +    // Try code duplication or inserting cross class copies
      > +    // to resolve it.
      > +    if (Delayed && !CurSU) {
      > +      if (!CurSU) {
      > +        // Try duplicating the nodes that produces these
      > +        // "expensive to copy" values to break the dependency. In  
      > case even
      > +        // that doesn't work, insert cross class copies.
      > +        SUnit *TrySU = NotReady[0];
      > +        SmallVector &LRegs = LRegsMap[TrySU];
      > +        assert(LRegs.size() == 1 && "Can't handle this yet!");
      > +        unsigned Reg = LRegs[0];
      > +        SUnit *LRDef = LiveRegDefs[Reg];
      > +        SUnit *NewDef = CopyAndMoveSuccessors(LRDef);
      > +        if (!NewDef) {
      > +          // Issue expensive cross register class copies.
      > +          MVT VT = getPhysicalRegisterVT(LRDef->Node, Reg, TII);
      > +          const TargetRegisterClass *RC =
      > +            TRI->getPhysicalRegisterRegClass(Reg, VT);
      > +          const TargetRegisterClass *DestRC = TRI- 
      > >getCrossCopyRegClass(RC);
      > +          if (!DestRC) {
      > +            assert(false && "Don't know how to copy this physical  
      > register!");
      > +            abort();
      > +          }
      > +          SmallVector Copies;
      > +          InsertCCCopiesAndMoveSuccs(LRDef, Reg, DestRC, RC, Copies);
      > +          DOUT << "Adding an edge from SU # " << TrySU->NodeNum
      > +               << " to SU #" << Copies.front()->NodeNum << "\n";
      > +          AddPred(TrySU, Copies.front(), true, true);
      > +          NewDef = Copies.back();
      > +        }
      > +
      > +        DOUT << "Adding an edge from SU # " << NewDef->NodeNum
      > +             << " to SU #" << TrySU->NodeNum << "\n";
      > +        LiveRegDefs[Reg] = NewDef;
      > +        AddPred(NewDef, TrySU, true, true);
      > +        TrySU->isAvailable = false;
      > +        CurSU = NewDef;
      > +      }
      > +
      > +      if (!CurSU) {
      > +        assert(false && "Unable to resolve live physical register  
      > dependencies!");
      > +        abort();
      > +      }
      > +    }
      > +
      > +    // Add the nodes that aren't ready back onto the available list.
      > +    for (unsigned i = 0, e = NotReady.size(); i != e; ++i) {
      > +      NotReady[i]->isPending = false;
      > +      // May no longer be available due to backtracking.
      > +      if (NotReady[i]->isAvailable)
      > +        AvailableQueue.push(NotReady[i]);
      > +    }
      > +    NotReady.clear();
      > +
      > +    if (!CurSU)
      > +      Sequence.push_back(0);
      > +    else {
      > +      ScheduleNodeBottomUp(CurSU, CurCycle);
      > +      Sequence.push_back(CurSU);
      > +    }
      > +    ++CurCycle;
      > +  }
      > +
      > +  // Reverse the order if it is bottom up.
      > +  std::reverse(Sequence.begin(), Sequence.end());
      > +
      > +
      > +#ifndef NDEBUG
      > +  // Verify that all SUnits were scheduled.
      > +  bool AnyNotSched = false;
      > +  unsigned DeadNodes = 0;
      > +  unsigned Noops = 0;
      > +  for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
      > +    if (!SUnits[i].isScheduled) {
      > +      if (SUnits[i].NumPreds == 0 && SUnits[i].NumSuccs == 0) {
      > +        ++DeadNodes;
      > +        continue;
      > +      }
      > +      if (!AnyNotSched)
      > +        cerr << "*** List scheduling failed! ***\n";
      > +      SUnits[i].dump(&DAG);
      > +      cerr << "has not been scheduled!\n";
      > +      AnyNotSched = true;
      > +    }
      > +    if (SUnits[i].NumSuccsLeft != 0) {
      > +      if (!AnyNotSched)
      > +        cerr << "*** List scheduling failed! ***\n";
      > +      SUnits[i].dump(&DAG);
      > +      cerr << "has successors left!\n";
      > +      AnyNotSched = true;
      > +    }
      > +  }
      > +  for (unsigned i = 0, e = Sequence.size(); i != e; ++i)
      > +    if (!Sequence[i])
      > +      ++Noops;
      > +  assert(!AnyNotSched);
      > +  assert(Sequence.size() + DeadNodes - Noops == SUnits.size() &&
      > +         "The number of nodes scheduled doesn't match the expected  
      > number!");
      > +#endif
      > +}
      > +
      > +// 
      > = 
      > = 
      > = 
      > ----------------------------------------------------------------------= 
      > ==//
      > +//                         Public Constructor Functions
      > +// 
      > = 
      > = 
      > = 
      > ----------------------------------------------------------------------= 
      > ==//
      > +
      > +llvm::ScheduleDAG* llvm::createFastDAGScheduler(SelectionDAGISel *IS,
      > +                                                SelectionDAG *DAG,
      > +                                                MachineBasicBlock  
      > *BB, bool) {
      > +  return new ScheduleDAGFast(*DAG, BB, DAG->getTarget());
      > +}
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From evan.cheng at apple.com  Thu Sep 18 11:57:02 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Thu, 18 Sep 2008 09:57:02 -0700
      Subject: [llvm-commits] [llvm] r56286 - in /llvm/trunk:
      	lib/Transforms/Utils/SimplifyCFG.cpp
      	test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll
      In-Reply-To: <200809171821.m8HILowg007540@zion.cs.uiuc.edu>
      References: <200809171821.m8HILowg007540@zion.cs.uiuc.edu>
      Message-ID: <90803500-8C38-4D8E-919F-04B5668D00B5@apple.com>
      
      
      On Sep 17, 2008, at 11:21 AM, Devang Patel wrote:
      
      > Author: dpatel
      > Date: Wed Sep 17 13:21:49 2008
      > New Revision: 56286
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=56286&view=rev
      > Log:
      > Do not hoist instruction above branch condition. The instruction may  
      > use branch condition.
      
      Ok.
      
      >
      >
      > Added:
      >    llvm/trunk/test/Transforms/SimplifyCFG/2008-09-17- 
      > SpeculativeHoist.ll
      > Modified:
      >    llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
      >
      > Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=56286&r1=56285&r2=56286&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
      > +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Wed Sep 17  
      > 13:21:49 2008
      > @@ -1046,15 +1046,8 @@
      >       return false;
      >   }
      >
      > -  // If we get here, we can hoist the instruction. Try to place it  
      > before the
      > -  // icmp instruction preceeding the conditional branch.
      > -  BasicBlock::iterator InsertPos = BI;
      > -  if (InsertPos != BIParent->begin())
      > -    --InsertPos;
      > -  if (InsertPos == BrCond && !isa(BrCond))
      > -    BIParent->getInstList().splice(InsertPos, BB1->getInstList(), I);
      > -  else
      > -    BIParent->getInstList().splice(BI, BB1->getInstList(), I);
      > +  // If we get here, we can hoist the instruction.
      > +  BIParent->getInstList().splice(BI, BB1->getInstList(), I);
      
      Rather than removing the logic, why not check if the instruction uses  
      the branch condition?
      
      Evan
      
      >
      >
      >   // Create a select whose true value is the speculatively executed  
      > value and
      >   // false value is the previously determined FalseV.
      >
      > Added: llvm/trunk/test/Transforms/SimplifyCFG/2008-09-17- 
      > SpeculativeHoist.ll
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll?rev=56286&view=auto
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Transforms/SimplifyCFG/2008-09-17- 
      > SpeculativeHoist.ll (added)
      > +++ llvm/trunk/test/Transforms/SimplifyCFG/2008-09-17- 
      > SpeculativeHoist.ll Wed Sep 17 13:21:49 2008
      > @@ -0,0 +1,18 @@
      > +; RUN: llvm-as < %s | opt -simplifycfg -disable-output
      > +; PR 2800
      > +
      > +define void @foo() {
      > +start:
      > +	%tmp = call i1 @bar( )		;  [#uses=4]
      > +	br i1 %tmp, label %brtrue, label %brfalse
      > +
      > +brtrue:		; preds = %start
      > +	%tmpnew = and i1 %tmp, %tmp		;  [#uses=1]
      > +	br label %brfalse
      > +
      > +brfalse:		; preds = %brtrue, %start
      > +	%andandtmp.0 = phi i1 [ %tmp, %start ], [ %tmpnew, %brtrue ]		;  
      >  [#uses=0]
      > +	ret void
      > +}
      > +
      > +declare i1 @bar()
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From dpatel at apple.com  Thu Sep 18 12:12:32 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Thu, 18 Sep 2008 10:12:32 -0700
      Subject: [llvm-commits] [llvm] r56286 - in /llvm/trunk:
      	lib/Transforms/Utils/SimplifyCFG.cpp
      	test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll
      In-Reply-To: <90803500-8C38-4D8E-919F-04B5668D00B5@apple.com>
      References: <200809171821.m8HILowg007540@zion.cs.uiuc.edu>
      	<90803500-8C38-4D8E-919F-04B5668D00B5@apple.com>
      Message-ID: <04F22395-E8C2-44B3-9C0C-578F61CBBAA2@apple.com>
      
      
      On Sep 18, 2008, at 9:57 AM, Evan Cheng wrote:
      
      >> -  // If we get here, we can hoist the instruction. Try to place it
      >> before the
      >> -  // icmp instruction preceeding the conditional branch.
      >> -  BasicBlock::iterator InsertPos = BI;
      >> -  if (InsertPos != BIParent->begin())
      >> -    --InsertPos;
      >> -  if (InsertPos == BrCond && !isa(BrCond))
      >> -    BIParent->getInstList().splice(InsertPos, BB1->getInstList(),  
      >> I);
      >> -  else
      >> -    BIParent->getInstList().splice(BI, BB1->getInstList(), I);
      >> +  // If we get here, we can hoist the instruction.
      >> +  BIParent->getInstList().splice(BI, BB1->getInstList(), I);
      >
      > Rather than removing the logic, why not check if the instruction uses
      > the branch condition?
      
      What's the advantage of hoisting this instruction by one  additional  
      instruction in some cases ?
      -
      Devang
      
      
      From evan.cheng at apple.com  Thu Sep 18 12:17:04 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Thu, 18 Sep 2008 10:17:04 -0700
      Subject: [llvm-commits] [llvm] r56290 - in /llvm/trunk:
      	include/llvm/CodeGen/LiveIntervalAnalysis.h
      	include/llvm/CodeGen/MachineOperand.h
      	include/llvm/CodeGen/ScheduleDAG.h
      	lib/CodeGen/AsmPrinter/AsmPrinter.cpp
      	lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/MachineInstr.cpp
      	lib/CodeGen/RegAllocLinearScan.cpp
      	lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      	lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
      	lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
      	test/CodeGen/X86/2008-09-17-inline-asm-1.ll
      In-Reply-To: <200809172113.m8HLDDWK014018@zion.cs.uiuc.edu>
      References: <200809172113.m8HLDDWK014018@zion.cs.uiuc.edu>
      Message-ID: <9D57B985-FDD1-428F-BA5C-E90C31304F19@apple.com>
      
      Hi Dale,
      
      Thanks for doing this. Comments inline.
      
      On Sep 17, 2008, at 2:13 PM, Dale Johannesen wrote:
      
      LiveIntervals::releaseMemory() should release  
      AsmsWithEarlyClobberConflict and AsmsThatEarlyClobber, no?
      
      
      >
      > +/// noEarlyclobberConflict - see whether virtual reg VReg has a  
      > conflict with
      > +/// hard reg HReg because of earlyclobbers.
      > +///
      > +/// Earlyclobber operands may not be assigned the same register as
      > +/// each other, or as earlyclobber-conflict operands (i.e. those that
      > +/// are non-earlyclobbered inputs to an asm that also has  
      > earlyclobbers).
      > +///
      > +/// Thus there are two cases to check for:
      > +/// 1.  VReg is an earlyclobber-conflict register and HReg is an  
      > earlyclobber
      > +/// register in some asm that also has VReg as an input.
      > +/// 2.  VReg is an earlyclobber register and HReg is an  
      > earlyclobber-conflict
      > +/// input elsewhere in some asm.
      > +/// In both cases HReg can be assigned by the user, or assigned  
      > early in
      > +/// register allocation.
      > +///
      > +/// Dropping the distinction between earlyclobber and earlyclobber- 
      > conflict,
      > +/// keeping only one multimap, looks promising, but two  
      > earlyclobber-conflict
      > +/// operands may be assigned the same register if they happen to  
      > contain the
      > +/// same value, and that implementation would prevent this.
      > +///
      > +bool LiveIntervals::noEarlyclobberConflict(unsigned VReg,  
      > VirtRegMap &vrm,
      > +                                           unsigned HReg) {
      > +  typedef std::multimap::iterator It;
      > +
      > +  // Short circuit the most common case.
      > +  if (AsmsWithEarlyClobberConflict.size()!=0) {
      
      If AsmsWithEarlyClobberConflict is empty, there is no need to check  
      for AsmsThatEarlyClobber, right? And vice versa.
      
      Also, I don't think this is a safe approach, machine instructions can  
      be deleted and leave the maps in the invalid state.
      
      >
      > +    std::pair x =  
      > AsmsWithEarlyClobberConflict.equal_range(VReg);
      > +    for (It I = x.first; I!=x.second; I++) {
      > +      MachineInstr* MI = I->second;
      > +      for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
      > +        MachineOperand &MO = MI->getOperand(i);
      > +        if (MO.isRegister() && MO.isEarlyClobber()) {
      > +          unsigned PhysReg = MO.getReg();
      > +          if (PhysReg &&  
      > TargetRegisterInfo::isVirtualRegister(PhysReg)) {
      > +            if (!vrm.hasPhys(PhysReg))
      > +              continue;
      > +            PhysReg = vrm.getPhys(PhysReg);
      > +          }
      > +          if (PhysReg==HReg)
      > +            return false;
      > +        }
      > +      }
      > +    }
      > +  }
      > +  // Short circuit the most common case.
      > +  if (AsmsThatEarlyClobber.size()!=0) {
      > +    std::pair x = AsmsThatEarlyClobber.equal_range(VReg);
      > +    for (It I = x.first; I!=x.second; I++) {
      > +      MachineInstr* MI = I->second;
      > +      for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
      > +        MachineOperand &MO = MI->getOperand(i);
      > +        if (MO.isRegister() && MO.overlapsEarlyClobber()) {
      > +          unsigned PhysReg = MO.getReg();
      > +          if (PhysReg &&  
      > TargetRegisterInfo::isVirtualRegister(PhysReg)) {
      > +            if (!vrm.hasPhys(PhysReg))
      > +              continue;
      > +            PhysReg = vrm.getPhys(PhysReg);
      > +          }
      > +          if (PhysReg==HReg)
      > +            return false;
      > +        }
      > +      }
      > +    }
      > +  }
      > +  return true;
      > +}
      >
      > LiveInterval* LiveIntervals::createInterval(unsigned reg) {
      >   float Weight = TargetRegisterInfo::isPhysicalRegister(reg) ?
      >
      >
      > Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56290&r1=56289&r2=56290&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
      > +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Wed Sep 17  
      > 16:13:11 2008
      > @@ -1050,7 +1050,8 @@
      >   TargetRegisterClass::iterator E = RC->allocation_order_end(*mf_);
      >   assert(I != E && "No allocatable register in this register class!");
      >   for (; I != E; ++I)
      > -    if (prt_->isRegAvail(*I)) {
      > +    if (prt_->isRegAvail(*I) &&
      > +        li_->noEarlyclobberConflict(cur->reg, *vrm_, *I)) {
      
      Ok, I have two concerns. 1. We need to do this check for every  
      interval. 2. After AsmsThatEarlyClobber and  
      AsmsWithEarlyClobberConflict are populated virtual registers can  
      change due to coalescing (and potentially other passes). Then the maps  
      won't be accurate.
      
      Perhaps we should add a bit to LiveInterval to indicate a vr can be  
      earlyclobber or earlyclobberconflict. Coalescer should not touch any  
      register whose interval has the bit. Then we only do the check for  
      those intervals here. The check can use MachineRegisterInfo def / use  
      chain to look for any conflicts.
      
      Evan
      
      >
      >       FreeReg = *I;
      >       if (FreeReg < inactiveCounts.size())
      >         FreeRegInactiveCount = inactiveCounts[FreeReg];
      > @@ -1070,7 +1071,8 @@
      >   for (; I != E; ++I) {
      >     unsigned Reg = *I;
      >     if (prt_->isRegAvail(Reg) && Reg < inactiveCounts.size() &&
      > -        FreeRegInactiveCount < inactiveCounts[Reg]) {
      > +        FreeRegInactiveCount < inactiveCounts[Reg] &&
      > +        li_->noEarlyclobberConflict(cur->reg, *vrm_, Reg)) {
      >       FreeReg = Reg;
      >       FreeRegInactiveCount = inactiveCounts[Reg];
      >       if (FreeRegInactiveCount == MaxInactiveCount)
      >
      > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp?rev=56290&r1=56289&r2=56290&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp (original)
      > +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp Wed Sep  
      > 17 16:13:11 2008
      > @@ -231,7 +231,8 @@
      > void ScheduleDAG::AddOperand(MachineInstr *MI, SDValue Op,
      >                              unsigned IIOpNum,
      >                              const TargetInstrDesc *II,
      > -                             DenseMap  
      > &VRBaseMap) {
      > +                             DenseMap &VRBaseMap,
      > +                             bool overlapsEarlyClobber) {
      >   if (Op.isMachineOpcode()) {
      >     // Note that this case is redundant with the final else block,  
      > but we
      >     // include it because it is the most common and it makes the logic
      > @@ -244,7 +245,9 @@
      >     const TargetInstrDesc &TID = MI->getDesc();
      >     bool isOptDef = IIOpNum < TID.getNumOperands() &&
      >       TID.OpInfo[IIOpNum].isOptionalDef();
      > -    MI->addOperand(MachineOperand::CreateReg(VReg, isOptDef));
      > +    MI->addOperand(MachineOperand::CreateReg(VReg, isOptDef, false,  
      > false,
      > +                                             false, 0, false,
      > +                                             overlapsEarlyClobber));
      >
      >     // Verify that it is right.
      >     assert(TargetRegisterInfo::isVirtualRegister(VReg) && "Not a  
      > vreg?");
      > @@ -278,7 +281,9 @@
      >     const ConstantFP *CFP = F->getConstantFPValue();
      >     MI->addOperand(MachineOperand::CreateFPImm(CFP));
      >   } else if (RegisterSDNode *R = dyn_cast(Op)) {
      > -    MI->addOperand(MachineOperand::CreateReg(R->getReg(), false));
      > +    MI->addOperand(MachineOperand::CreateReg(R->getReg(), false,  
      > false,
      > +                                             false, false, 0, false,
      > +                                             overlapsEarlyClobber));
      >   } else if (GlobalAddressSDNode *TGA =  
      > dyn_cast(Op)) {
      >     MI->addOperand(MachineOperand::CreateGA(TGA->getGlobal(),TGA- 
      > >getOffset()));
      >   } else if (BasicBlockSDNode *BB = dyn_cast(Op)) {
      > @@ -314,7 +319,9 @@
      >            Op.getValueType() != MVT::Flag &&
      >            "Chain and flag operands should occur at end of operand  
      > list!");
      >     unsigned VReg = getVR(Op, VRBaseMap);
      > -    MI->addOperand(MachineOperand::CreateReg(VReg, false));
      > +    MI->addOperand(MachineOperand::CreateReg(VReg, false, false,
      > +                                             false, false, 0, false,
      > +                                             overlapsEarlyClobber));
      >
      >     // Verify that it is right.  Note that the reg class of the  
      > physreg and the
      >     // vreg don't necessarily need to match, but the target copy  
      > insertion has
      > @@ -596,6 +603,7 @@
      >
      >     // Add all of the operand registers to the instruction.
      >     for (unsigned i = 2; i != NumOps;) {
      > +      bool overlapsEarlyClobber = false;
      >       unsigned Flags =
      >         cast(Node->getOperand(i))->getZExtValue();
      >       unsigned NumVals = Flags >> 3;
      > @@ -618,13 +626,18 @@
      >                                                    false, 0, true));
      >         }
      >         break;
      > +      case 7:  // Addressing mode overlapping earlyclobber.
      > +      case 5:  // Use of register overlapping earlyclobber.
      > +        overlapsEarlyClobber = true;
      > +        // fall through
      >       case 1:  // Use of register.
      >       case 3:  // Immediate.
      >       case 4:  // Addressing mode.
      >         // The addressing mode has been selected, just add all of the
      >         // operands to the machine instruction.
      >         for (; NumVals; --NumVals, ++i)
      > -          AddOperand(MI, Node->getOperand(i), 0, 0, VRBaseMap);
      > +          AddOperand(MI, Node->getOperand(i), 0, 0, VRBaseMap,
      > +                     overlapsEarlyClobber);
      >         break;
      >       }
      >     }
      >
      > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=56290&r1=56289&r2=56290&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp  
      > (original)
      > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed  
      > Sep 17 16:13:11 2008
      > @@ -4909,8 +4909,10 @@
      >         assert(OpInfo.isIndirect && "Memory output must be indirect  
      > operand");
      >
      >         // Add information to the INLINEASM node to know about this  
      > output.
      > -        unsigned ResOpType = 4/*MEM*/ | (1 << 3);
      > -        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType,
      > +        unsigned ResOpType = SawEarlyClobber ?
      > +                                  7 /* MEM OVERLAPS EARLYCLOBBER */ :
      > +                                  4/*MEM*/;
      > +        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType |  
      > (1<<3),
      >                                                          
      > TLI.getPointerTy()));
      >         AsmNodeOperands.push_back(OpInfo.CallOperand);
      >         break;
      > @@ -4963,7 +4965,8 @@
      >             cast(AsmNodeOperands[CurOp])- 
      > >getZExtValue();
      >           assert(((NumOps & 7) == 2 /*REGDEF*/ ||
      >                   (NumOps & 7) == 6 /*EARLYCLOBBER REGDEF*/ ||
      > -                  (NumOps & 7) == 4 /*MEM*/) &&
      > +                  (NumOps & 7) == 4 /*MEM*/ ||
      > +                  (NumOps & 7) == 7 /*MEM OVERLAPS EARLYCLOBBER*/) &&
      >                  "Skipped past definitions?");
      >           CurOp += (NumOps>>3)+1;
      >         }
      > @@ -4985,14 +4988,17 @@
      >
      >           // Use the produced MatchedRegs object to
      >           MatchedRegs.getCopyToRegs(InOperandVal, DAG, Chain, &Flag);
      > -          MatchedRegs.AddInlineAsmOperands(1 /*REGUSE*/, DAG,  
      > AsmNodeOperands);
      > +          MatchedRegs.AddInlineAsmOperands(SawEarlyClobber ?
      > +                                           1 /*REGUSE*/ :
      > +                                           5 /*REGUSE OVERLAPS  
      > EARLYCLOBBER*/,
      > +                                           DAG, AsmNodeOperands);
      >           break;
      >         } else {
      > -          assert((NumOps & 7) == 4/*MEM*/ && "Unknown matching  
      > constraint!");
      > +          assert(((NumOps & 7) == 7/*MEM OVERLAPS EARLYCLOBBER */ ||
      > +                  (NumOps & 7) == 4) && "Unknown matching  
      > constraint!");
      >           assert((NumOps >> 3) == 1 && "Unexpected number of  
      > operands");
      >           // Add information to the INLINEASM node to know about  
      > this input.
      > -          unsigned ResOpType = 4/*MEM*/ | (1 << 3);
      > -          AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType,
      > +          AsmNodeOperands.push_back(DAG.getTargetConstant(NumOps,
      >                                                            
      > TLI.getPointerTy()));
      >           AsmNodeOperands.push_back(AsmNodeOperands[CurOp+1]);
      >           break;
      > @@ -5024,8 +5030,10 @@
      >                "Memory operands expect pointer values");
      >
      >         // Add information to the INLINEASM node to know about this  
      > input.
      > -        unsigned ResOpType = 4/*MEM*/ | (1 << 3);
      > -        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType,
      > +        unsigned ResOpType = SawEarlyClobber ?
      > +                                7 /* MEM OVERLAPS EARLYCLOBBER */ :
      > +                                4/*MEM*/;
      > +        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType |  
      > (1<<3),
      >                                                          
      > TLI.getPointerTy()));
      >         AsmNodeOperands.push_back(InOperandVal);
      >         break;
      > @@ -5043,16 +5051,18 @@
      >
      >       OpInfo.AssignedRegs.getCopyToRegs(InOperandVal, DAG, Chain,  
      > &Flag);
      >
      > -      OpInfo.AssignedRegs.AddInlineAsmOperands(1/*REGUSE*/, DAG,
      > -                                               AsmNodeOperands);
      > +      OpInfo.AssignedRegs.AddInlineAsmOperands(SawEarlyClobber ?
      > +                                           5 /*REGUSE OVERLAPS  
      > EARLYCLOBBER*/:
      > +                                           1/*REGUSE*/,
      > +                                           DAG, AsmNodeOperands);
      >       break;
      >     }
      >     case InlineAsm::isClobber: {
      >       // Add the clobbered value to the operand list, so that the  
      > register
      >       // allocator is aware that the physreg got clobbered.
      >       if (!OpInfo.AssignedRegs.Regs.empty())
      > -        OpInfo.AssignedRegs.AddInlineAsmOperands(2/*REGDEF*/, DAG,
      > -                                                 AsmNodeOperands);
      > +        OpInfo.AssignedRegs.AddInlineAsmOperands(6 /* EARLYCLOBBER  
      > REGDEF */,
      > +                                                 DAG,  
      > AsmNodeOperands);
      >       break;
      >     }
      >     }
      >
      > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=56290&r1=56289&r2=56290&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  
      > (original)
      > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Sep  
      > 17 16:13:11 2008
      > @@ -1113,7 +1113,8 @@
      >
      >   while (i != e) {
      >     unsigned Flags = cast(InOps[i])->getZExtValue();
      > -    if ((Flags & 7) != 4 /*MEM*/) {
      > +    if ((Flags & 7) != 4 /*MEM*/ &&
      > +        (Flags & 7) != 7 /*MEM OVERLAPS EARLYCLOBBER*/) {
      >       // Just skip over this operand, copying the operands verbatim.
      >       Ops.insert(Ops.end(), InOps.begin()+i, InOps.begin()+i+(Flags  
      > >> 3) + 1);
      >       i += (Flags >> 3) + 1;
      > @@ -1128,7 +1129,7 @@
      >
      >       // Add this to the output node.
      >       MVT IntPtrTy = CurDAG->getTargetLoweringInfo().getPointerTy();
      > -      Ops.push_back(CurDAG->getTargetConstant(4/*MEM*/ |  
      > (SelOps.size() << 3),
      > +      Ops.push_back(CurDAG->getTargetConstant((Flags & 7) |  
      > (SelOps.size()<< 3),
      >                                               IntPtrTy));
      >       Ops.insert(Ops.end(), SelOps.begin(), SelOps.end());
      >       i += 2;
      >
      > Added: llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll?rev=56290&view=auto
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll (added)
      > +++ llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll Wed Sep  
      > 17 16:13:11 2008
      > @@ -0,0 +1,24 @@
      > +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl %eax,  
      > %eax"
      > +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl %edx,  
      > %edx"
      > +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl (%eax),  
      > %eax"
      > +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl (%edx),  
      > %edx"
      > +
      > +; %0 must not be put in EAX or EDX.
      > +; In the first asm, $0 and $2 must not be put in EAX.
      > +; In the second asm, $0 and $2 must not be put in EDX.
      > +; This is kind of hard to test thoroughly, but the things above  
      > should continue
      > +; to pass, I think.
      > +; ModuleID = ''
      > +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32- 
      > i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64- 
      > f80:128:128"
      > +target triple = "i386-apple-darwin8"
      > + at x = common global i32 0		;  [#uses=1]
      > +
      > +define i32 @aci(i32* %pw) nounwind {
      > +entry:
      > +	%0 = load i32* @x, align 4		;  [#uses=1]
      > +	%asmtmp = tail call { i32, i32 } asm "movl $0, %eax\0A\090:\0A 
      > \09test %eax, %eax\0A\09je 1f\0A\09movl %eax, $2\0A\09incl $2\0A 
      > \09lock\0A\09cmpxchgl $2, $0\0A\09jne 0b\0A\091:",  
      > "=*m,=&{ax},=&r,*m,~{dirflag},~{fpsr},~{flags},~{memory},~{cc}"(i32*  
      > %pw, i32* %pw) nounwind		; <{ i32, i32 }> [#uses=0]
      > +	%asmtmp2 = tail call { i32, i32 } asm "movl $0, %edx\0A\090:\0A 
      > \09test %edx, %edx\0A\09je 1f\0A\09movl %edx, $2\0A\09incl $2\0A 
      > \09lock\0A\09cmpxchgl $2, $0\0A\09jne 0b\0A\091:",  
      > "=*m,=&{dx},=&r,*m,~{dirflag},~{fpsr},~{flags},~{memory},~{cc}"(i32*  
      > %pw, i32* %pw) nounwind		; <{ i32, i32 }> [#uses=1]
      > +	%asmresult3 = extractvalue { i32, i32 } %asmtmp2, 0		;   
      > [#uses=1]
      > +	%1 = add i32 %asmresult3, %0		;  [#uses=1]
      > +	ret i32 %1
      > +}
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From evan.cheng at apple.com  Thu Sep 18 12:21:06 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Thu, 18 Sep 2008 10:21:06 -0700
      Subject: [llvm-commits] [llvm] r56286 - in /llvm/trunk:
      	lib/Transforms/Utils/SimplifyCFG.cpp
      	test/Transforms/SimplifyCFG/2008-09-17-SpeculativeHoist.ll
      In-Reply-To: <04F22395-E8C2-44B3-9C0C-578F61CBBAA2@apple.com>
      References: <200809171821.m8HILowg007540@zion.cs.uiuc.edu>
      	<90803500-8C38-4D8E-919F-04B5668D00B5@apple.com>
      	<04F22395-E8C2-44B3-9C0C-578F61CBBAA2@apple.com>
      Message-ID: <4D950794-2F6C-4B08-BB29-138FCB443458@apple.com>
      
      
      On Sep 18, 2008, at 10:12 AM, Devang Patel wrote:
      
      >
      > On Sep 18, 2008, at 9:57 AM, Evan Cheng wrote:
      >
      >>> -  // If we get here, we can hoist the instruction. Try to place it
      >>> before the
      >>> -  // icmp instruction preceeding the conditional branch.
      >>> -  BasicBlock::iterator InsertPos = BI;
      >>> -  if (InsertPos != BIParent->begin())
      >>> -    --InsertPos;
      >>> -  if (InsertPos == BrCond && !isa(BrCond))
      >>> -    BIParent->getInstList().splice(InsertPos, BB1->getInstList(),
      >>> I);
      >>> -  else
      >>> -    BIParent->getInstList().splice(BI, BB1->getInstList(), I);
      >>> +  // If we get here, we can hoist the instruction.
      >>> +  BIParent->getInstList().splice(BI, BB1->getInstList(), I);
      >>
      >> Rather than removing the logic, why not check if the instruction uses
      >> the branch condition?
      >
      > What's the advantage of hoisting this instruction by one  additional
      > instruction in some cases ?
      
      As the comment said, it's trying to place it before the icmp  
      instruction which produces the predicate. This is a micro-optimization  
      for performance reason. Some optimization passes do not look very far,  
      it may prefer the icmp and branch to be next to each other. Also fast- 
      isel codegen will also prefer them to be together.
      
      Evan
      
      >
      > -
      > Devang
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From gohman at apple.com  Thu Sep 18 12:23:28 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Thu, 18 Sep 2008 10:23:28 -0700
      Subject: [llvm-commits] [llvm] r56307 - in /llvm/trunk:
      	include/llvm/CodeGen/LinkAllCodegenComponents.h
      	include/llvm/CodeGen/ScheduleDAG.h	lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
      In-Reply-To: <48A9BBBB-728D-4BFB-B915-E0B827F3F44F@apple.com>
      References: <200809181626.m8IGQTKo030214@zion.cs.uiuc.edu>
      	<48A9BBBB-728D-4BFB-B915-E0B827F3F44F@apple.com>
      Message-ID: <33BD3FE3-B55D-492B-ADF2-E0FA42A19AE1@apple.com>
      
      The same way as list-burr, except without the backtracking.
      It still knows how to do cloning and cross-RC copies.
      
      Dan
      
      On Sep 18, 2008, at 9:47 AM, Evan Cheng wrote:
      
      > How does this deal with physical register dependencies?
      >
      > Evan
      >
      > On Sep 18, 2008, at 9:26 AM, Dan Gohman wrote:
      >
      >> Author: djg
      >> Date: Thu Sep 18 11:26:26 2008
      >> New Revision: 56307
      >>
      >> URL: http://llvm.org/viewvc/llvm-project?rev=56307&view=rev
      >> Log:
      >> Add a new "fast" scheduler. This is currently basically just a
      >> copy of the BURRList scheduler, but with several parts ripped
      >> out, such as backtracking, online topological sort maintenance
      >> (needed by backtracking), the priority queue, and Sethi-Ullman
      >> number computation and maintenance (needed by the priority
      >> queue). As a result of all this, it generates somewhat lower
      >> quality code, but that's its tradeoff for running about 30%
      >> faster than list-burr in -fast mode in many cases.
      >>
      >> This is somewhat experimental. Moving forward, major pieces of
      >> this can be refactored with pieces in common with
      >> ScheduleDAGRRList.cpp.
      >>
      >> Added:
      >>   llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
      >> Modified:
      >>   llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h
      >>   llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
      >>
      >> Modified: llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h
      >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h?rev=56307&r1=56306&r2=56307&view=diff
      >>
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =====================================================================
      >> --- llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h
      >> (original)
      >> +++ llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h Thu
      >> Sep 18 11:26:26 2008
      >> @@ -44,6 +44,7 @@
      >>      (void) llvm::createBURRListDAGScheduler(NULL, NULL, NULL,
      >> false);
      >>      (void) llvm::createTDRRListDAGScheduler(NULL, NULL, NULL,
      >> false);
      >>      (void) llvm::createTDListDAGScheduler(NULL, NULL, NULL, false);
      >> +      (void) llvm::createFastDAGScheduler(NULL, NULL, NULL, false);
      >>      (void) llvm::createDefaultScheduler(NULL, NULL, NULL, false);
      >>
      >>    }
      >>
      >> Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
      >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=56307&r1=56306&r2=56307&view=diff
      >>
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =====================================================================
      >> --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original)
      >> +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Thu Sep 18
      >> 11:26:26 2008
      >> @@ -414,6 +414,13 @@
      >>                                        MachineBasicBlock *BB,
      >>                                        bool Fast);
      >>
      >> +  /// createFastDAGScheduler - This creates a "fast" scheduler.
      >> +  ///
      >> +  ScheduleDAG *createFastDAGScheduler(SelectionDAGISel *IS,
      >> +                                      SelectionDAG *DAG,
      >> +                                      MachineBasicBlock *BB,
      >> +                                      bool Fast);
      >> +
      >>  /// createDefaultScheduler - This creates an instruction scheduler
      >> appropriate
      >>  /// for the target.
      >>  ScheduleDAG* createDefaultScheduler(SelectionDAGISel *IS,
      >>
      >> Added: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
      >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp?rev=56307&view=auto
      >>
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =====================================================================
      >> --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp (added)
      >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp Thu Sep
      >> 18 11:26:26 2008
      >> @@ -0,0 +1,654 @@
      >> +//===----- ScheduleDAGFast.cpp - Fast poor list scheduler
      >> -----------------===//
      >> +//
      >> +//                     The LLVM Compiler Infrastructure
      >> +//
      >> +// This file is distributed under the University of Illinois Open
      >> Source
      >> +// License. See LICENSE.TXT for details.
      >> +//
      >> +//
      >> =
      >> =
      >> =
      >> ----------------------------------------------------------------------=
      >> ==//
      >> +//
      >> +// This implements a fast scheduler.
      >> +//
      >> +//
      >> =
      >> =
      >> =
      >> ----------------------------------------------------------------------=
      >> ==//
      >> +
      >> +#define DEBUG_TYPE "pre-RA-sched"
      >> +#include "llvm/CodeGen/ScheduleDAG.h"
      >> +#include "llvm/CodeGen/SchedulerRegistry.h"
      >> +#include "llvm/Target/TargetRegisterInfo.h"
      >> +#include "llvm/Target/TargetData.h"
      >> +#include "llvm/Target/TargetMachine.h"
      >> +#include "llvm/Target/TargetInstrInfo.h"
      >> +#include "llvm/Support/Debug.h"
      >> +#include "llvm/Support/Compiler.h"
      >> +#include "llvm/ADT/SmallSet.h"
      >> +#include "llvm/ADT/Statistic.h"
      >> +#include "llvm/ADT/STLExtras.h"
      >> +#include "llvm/Support/CommandLine.h"
      >> +using namespace llvm;
      >> +
      >> +STATISTIC(NumUnfolds,    "Number of nodes unfolded");
      >> +STATISTIC(NumDups,       "Number of duplicated nodes");
      >> +STATISTIC(NumCCCopies,   "Number of cross class copies");
      >> +
      >> +static RegisterScheduler
      >> +  fastDAGScheduler("fast", "  Fast suboptimal list scheduling",
      >> +                   createFastDAGScheduler);
      >> +
      >> +namespace {
      >> +  /// FastPriorityQueue - A degenerate priority queue that considers
      >> +  /// all nodes to have the same priority.
      >> +  ///
      >> +  struct VISIBILITY_HIDDEN FastPriorityQueue {
      >> +    std::vector Queue;
      >> +
      >> +    bool empty() const { return Queue.empty(); }
      >> +
      >> +    void push(SUnit *U) {
      >> +      Queue.push_back(U);
      >> +    }
      >> +
      >> +    SUnit *pop() {
      >> +      if (empty()) return NULL;
      >> +      SUnit *V = Queue.back();
      >> +      Queue.pop_back();
      >> +      return V;
      >> +    }
      >> +  };
      >> +
      >> +//
      >> =
      >> =
      >> =
      >> ----------------------------------------------------------------------=
      >> ==//
      >> +/// ScheduleDAGFast - The actual "fast" list scheduler
      >> implementation.
      >> +///
      >> +class VISIBILITY_HIDDEN ScheduleDAGFast : public ScheduleDAG {
      >> +private:
      >> +  /// AvailableQueue - The priority queue to use for the available
      >> SUnits.
      >> +  FastPriorityQueue AvailableQueue;
      >> +
      >> +  /// LiveRegs / LiveRegDefs - A set of physical registers and
      >> their definition
      >> +  /// that are "live". These nodes must be scheduled before any
      >> other nodes that
      >> +  /// modifies the registers can be scheduled.
      >> +  SmallSet LiveRegs;
      >> +  std::vector LiveRegDefs;
      >> +  std::vector LiveRegCycles;
      >> +
      >> +public:
      >> +  ScheduleDAGFast(SelectionDAG &dag, MachineBasicBlock *bb,
      >> +                  const TargetMachine &tm)
      >> +    : ScheduleDAG(dag, bb, tm) {}
      >> +
      >> +  void Schedule();
      >> +
      >> +  /// AddPred - This adds the specified node X as a predecessor of
      >> +  /// the current node Y if not already.
      >> +  /// This returns true if this is a new predecessor.
      >> +  bool AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool isSpecial,
      >> +               unsigned PhyReg = 0, int Cost = 1);
      >> +
      >> +  /// RemovePred - This removes the specified node N from the
      >> predecessors of
      >> +  /// the current node M.
      >> +  bool RemovePred(SUnit *M, SUnit *N, bool isCtrl, bool isSpecial);
      >> +
      >> +private:
      >> +  void ReleasePred(SUnit*, bool, unsigned);
      >> +  void ScheduleNodeBottomUp(SUnit*, unsigned);
      >> +  SUnit *CopyAndMoveSuccessors(SUnit*);
      >> +  void InsertCCCopiesAndMoveSuccs(SUnit*, unsigned,
      >> +                                  const TargetRegisterClass*,
      >> +                                  const TargetRegisterClass*,
      >> +                                  SmallVector&);
      >> +  bool DelayForLiveRegsBottomUp(SUnit*, SmallVector&);
      >> +  void ListScheduleBottomUp();
      >> +
      >> +  /// CreateNewSUnit - Creates a new SUnit and returns a pointer to
      >> it.
      >> +  SUnit *CreateNewSUnit(SDNode *N) {
      >> +    SUnit *NewNode = NewSUnit(N);
      >> +    return NewNode;
      >> +  }
      >> +
      >> +  /// CreateClone - Creates a new SUnit from an existing one.
      >> +  SUnit *CreateClone(SUnit *N) {
      >> +    SUnit *NewNode = Clone(N);
      >> +    return NewNode;
      >> +  }
      >> +};
      >> +}  // end anonymous namespace
      >> +
      >> +
      >> +/// Schedule - Schedule the DAG using list scheduling.
      >> +void ScheduleDAGFast::Schedule() {
      >> +  DOUT << "********** List Scheduling **********\n";
      >> +
      >> +  LiveRegDefs.resize(TRI->getNumRegs(), NULL);
      >> +  LiveRegCycles.resize(TRI->getNumRegs(), 0);
      >> +
      >> +  // Build scheduling units.
      >> +  BuildSchedUnits();
      >> +
      >> +  DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su)
      >> +          SUnits[su].dumpAll(&DAG));
      >> +
      >> +  // Execute the actual scheduling loop.
      >> +  ListScheduleBottomUp();
      >> +}
      >> +
      >> +//
      >> =
      >> =
      >> =
      >> ----------------------------------------------------------------------=
      >> ==//
      >> +//  Bottom-Up Scheduling
      >> +//
      >> =
      >> =
      >> =
      >> ----------------------------------------------------------------------=
      >> ==//
      >> +
      >> +/// ReleasePred - Decrement the NumSuccsLeft count of a
      >> predecessor. Add it to
      >> +/// the AvailableQueue if the count reaches zero. Also update its
      >> cycle bound.
      >> +void ScheduleDAGFast::ReleasePred(SUnit *PredSU, bool isChain,
      >> +                                  unsigned CurCycle) {
      >> +  // FIXME: the distance between two nodes is not always == the
      >> predecessor's
      >> +  // latency. For example, the reader can very well read the
      >> register written
      >> +  // by the predecessor later than the issue cycle. It also depends
      >> on the
      >> +  // interrupt model (drain vs. freeze).
      >> +  PredSU->CycleBound = std::max(PredSU->CycleBound, CurCycle +
      >> PredSU->Latency);
      >> +
      >> +  --PredSU->NumSuccsLeft;
      >> +
      >> +#ifndef NDEBUG
      >> +  if (PredSU->NumSuccsLeft < 0) {
      >> +    cerr << "*** List scheduling failed! ***\n";
      >> +    PredSU->dump(&DAG);
      >> +    cerr << " has been released too many times!\n";
      >> +    assert(0);
      >> +  }
      >> +#endif
      >> +
      >> +  if (PredSU->NumSuccsLeft == 0) {
      >> +    PredSU->isAvailable = true;
      >> +    AvailableQueue.push(PredSU);
      >> +  }
      >> +}
      >> +
      >> +/// ScheduleNodeBottomUp - Add the node to the schedule. Decrement
      >> the pending
      >> +/// count of its predecessors. If a predecessor pending count is
      >> zero, add it to
      >> +/// the Available queue.
      >> +void ScheduleDAGFast::ScheduleNodeBottomUp(SUnit *SU, unsigned
      >> CurCycle) {
      >> +  DOUT << "*** Scheduling [" << CurCycle << "]: ";
      >> +  DEBUG(SU->dump(&DAG));
      >> +  SU->Cycle = CurCycle;
      >> +
      >> +  // Bottom up: release predecessors
      >> +  for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU-
      >>> Preds.end();
      >> +       I != E; ++I) {
      >> +    ReleasePred(I->Dep, I->isCtrl, CurCycle);
      >> +    if (I->Cost < 0)  {
      >> +      // This is a physical register dependency and it's impossible
      >> or
      >> +      // expensive to copy the register. Make sure nothing that can
      >> +      // clobber the register is scheduled between the predecessor
      >> and
      >> +      // this node.
      >> +      if (LiveRegs.insert(I->Reg)) {
      >> +        LiveRegDefs[I->Reg] = I->Dep;
      >> +        LiveRegCycles[I->Reg] = CurCycle;
      >> +      }
      >> +    }
      >> +  }
      >> +
      >> +  // Release all the implicit physical register defs that are live.
      >> +  for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU-
      >>> Succs.end();
      >> +       I != E; ++I) {
      >> +    if (I->Cost < 0)  {
      >> +      if (LiveRegCycles[I->Reg] == I->Dep->Cycle) {
      >> +        LiveRegs.erase(I->Reg);
      >> +        assert(LiveRegDefs[I->Reg] == SU &&
      >> +               "Physical register dependency violated?");
      >> +        LiveRegDefs[I->Reg] = NULL;
      >> +        LiveRegCycles[I->Reg] = 0;
      >> +      }
      >> +    }
      >> +  }
      >> +
      >> +  SU->isScheduled = true;
      >> +}
      >> +
      >> +/// AddPred - adds an edge from SUnit X to SUnit Y.
      >> +bool ScheduleDAGFast::AddPred(SUnit *Y, SUnit *X, bool isCtrl, bool
      >> isSpecial,
      >> +                              unsigned PhyReg, int Cost) {
      >> +  return Y->addPred(X, isCtrl, isSpecial, PhyReg, Cost);
      >> +}
      >> +
      >> +/// RemovePred - This removes the specified node N from the
      >> predecessors of
      >> +/// the current node M.
      >> +bool ScheduleDAGFast::RemovePred(SUnit *M, SUnit *N,
      >> +                                 bool isCtrl, bool isSpecial) {
      >> +  return M->removePred(N, isCtrl, isSpecial);
      >> +}
      >> +
      >> +/// CopyAndMoveSuccessors - Clone the specified node and move its
      >> scheduled
      >> +/// successors to the newly created node.
      >> +SUnit *ScheduleDAGFast::CopyAndMoveSuccessors(SUnit *SU) {
      >> +  if (SU->FlaggedNodes.size())
      >> +    return NULL;
      >> +
      >> +  SDNode *N = SU->Node;
      >> +  if (!N)
      >> +    return NULL;
      >> +
      >> +  SUnit *NewSU;
      >> +  bool TryUnfold = false;
      >> +  for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) {
      >> +    MVT VT = N->getValueType(i);
      >> +    if (VT == MVT::Flag)
      >> +      return NULL;
      >> +    else if (VT == MVT::Other)
      >> +      TryUnfold = true;
      >> +  }
      >> +  for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
      >> +    const SDValue &Op = N->getOperand(i);
      >> +    MVT VT = Op.getNode()->getValueType(Op.getResNo());
      >> +    if (VT == MVT::Flag)
      >> +      return NULL;
      >> +  }
      >> +
      >> +  if (TryUnfold) {
      >> +    SmallVector NewNodes;
      >> +    if (!TII->unfoldMemoryOperand(DAG, N, NewNodes))
      >> +      return NULL;
      >> +
      >> +    DOUT << "Unfolding SU # " << SU->NodeNum << "\n";
      >> +    assert(NewNodes.size() == 2 && "Expected a load folding node!");
      >> +
      >> +    N = NewNodes[1];
      >> +    SDNode *LoadNode = NewNodes[0];
      >> +    unsigned NumVals = N->getNumValues();
      >> +    unsigned OldNumVals = SU->Node->getNumValues();
      >> +    for (unsigned i = 0; i != NumVals; ++i)
      >> +      DAG.ReplaceAllUsesOfValueWith(SDValue(SU->Node, i),
      >> SDValue(N, i));
      >> +    DAG.ReplaceAllUsesOfValueWith(SDValue(SU->Node, OldNumVals-1),
      >> +                                  SDValue(LoadNode, 1));
      >> +
      >> +    SUnit *NewSU = CreateNewSUnit(N);
      >> +    assert(N->getNodeId() == -1 && "Node already inserted!");
      >> +    N->setNodeId(NewSU->NodeNum);
      >> +
      >> +    const TargetInstrDesc &TID = TII->get(N->getMachineOpcode());
      >> +    for (unsigned i = 0; i != TID.getNumOperands(); ++i) {
      >> +      if (TID.getOperandConstraint(i, TOI::TIED_TO) != -1) {
      >> +        NewSU->isTwoAddress = true;
      >> +        break;
      >> +      }
      >> +    }
      >> +    if (TID.isCommutable())
      >> +      NewSU->isCommutable = true;
      >> +    // FIXME: Calculate height / depth and propagate the changes?
      >> +    NewSU->Depth = SU->Depth;
      >> +    NewSU->Height = SU->Height;
      >> +    ComputeLatency(NewSU);
      >> +
      >> +    // LoadNode may already exist. This can happen when there is
      >> another
      >> +    // load from the same location and producing the same type of
      >> value
      >> +    // but it has different alignment or volatileness.
      >> +    bool isNewLoad = true;
      >> +    SUnit *LoadSU;
      >> +    if (LoadNode->getNodeId() != -1) {
      >> +      LoadSU = &SUnits[LoadNode->getNodeId()];
      >> +      isNewLoad = false;
      >> +    } else {
      >> +      LoadSU = CreateNewSUnit(LoadNode);
      >> +      LoadNode->setNodeId(LoadSU->NodeNum);
      >> +
      >> +      LoadSU->Depth = SU->Depth;
      >> +      LoadSU->Height = SU->Height;
      >> +      ComputeLatency(LoadSU);
      >> +    }
      >> +
      >> +    SUnit *ChainPred = NULL;
      >> +    SmallVector ChainSuccs;
      >> +    SmallVector LoadPreds;
      >> +    SmallVector NodePreds;
      >> +    SmallVector NodeSuccs;
      >> +    for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU-
      >>> Preds.end();
      >> +         I != E; ++I) {
      >> +      if (I->isCtrl)
      >> +        ChainPred = I->Dep;
      >> +      else if (I->Dep->Node && I->Dep->Node->isOperandOf(LoadNode))
      >> +        LoadPreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false,
      >> false));
      >> +      else
      >> +        NodePreds.push_back(SDep(I->Dep, I->Reg, I->Cost, false,
      >> false));
      >> +    }
      >> +    for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU-
      >>> Succs.end();
      >> +         I != E; ++I) {
      >> +      if (I->isCtrl)
      >> +        ChainSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
      >> +                                  I->isCtrl, I->isSpecial));
      >> +      else
      >> +        NodeSuccs.push_back(SDep(I->Dep, I->Reg, I->Cost,
      >> +                                 I->isCtrl, I->isSpecial));
      >> +    }
      >> +
      >> +    if (ChainPred) {
      >> +      RemovePred(SU, ChainPred, true, false);
      >> +      if (isNewLoad)
      >> +        AddPred(LoadSU, ChainPred, true, false);
      >> +    }
      >> +    for (unsigned i = 0, e = LoadPreds.size(); i != e; ++i) {
      >> +      SDep *Pred = &LoadPreds[i];
      >> +      RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isSpecial);
      >> +      if (isNewLoad) {
      >> +        AddPred(LoadSU, Pred->Dep, Pred->isCtrl, Pred->isSpecial,
      >> +                Pred->Reg, Pred->Cost);
      >> +      }
      >> +    }
      >> +    for (unsigned i = 0, e = NodePreds.size(); i != e; ++i) {
      >> +      SDep *Pred = &NodePreds[i];
      >> +      RemovePred(SU, Pred->Dep, Pred->isCtrl, Pred->isSpecial);
      >> +      AddPred(NewSU, Pred->Dep, Pred->isCtrl, Pred->isSpecial,
      >> +              Pred->Reg, Pred->Cost);
      >> +    }
      >> +    for (unsigned i = 0, e = NodeSuccs.size(); i != e; ++i) {
      >> +      SDep *Succ = &NodeSuccs[i];
      >> +      RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isSpecial);
      >> +      AddPred(Succ->Dep, NewSU, Succ->isCtrl, Succ->isSpecial,
      >> +              Succ->Reg, Succ->Cost);
      >> +    }
      >> +    for (unsigned i = 0, e = ChainSuccs.size(); i != e; ++i) {
      >> +      SDep *Succ = &ChainSuccs[i];
      >> +      RemovePred(Succ->Dep, SU, Succ->isCtrl, Succ->isSpecial);
      >> +      if (isNewLoad) {
      >> +        AddPred(Succ->Dep, LoadSU, Succ->isCtrl, Succ->isSpecial,
      >> +                Succ->Reg, Succ->Cost);
      >> +      }
      >> +    }
      >> +    if (isNewLoad) {
      >> +      AddPred(NewSU, LoadSU, false, false);
      >> +    }
      >> +
      >> +    ++NumUnfolds;
      >> +
      >> +    if (NewSU->NumSuccsLeft == 0) {
      >> +      NewSU->isAvailable = true;
      >> +      return NewSU;
      >> +    }
      >> +    SU = NewSU;
      >> +  }
      >> +
      >> +  DOUT << "Duplicating SU # " << SU->NodeNum << "\n";
      >> +  NewSU = CreateClone(SU);
      >> +
      >> +  // New SUnit has the exact same predecessors.
      >> +  for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU-
      >>> Preds.end();
      >> +       I != E; ++I)
      >> +    if (!I->isSpecial) {
      >> +      AddPred(NewSU, I->Dep, I->isCtrl, false, I->Reg, I->Cost);
      >> +      NewSU->Depth = std::max(NewSU->Depth, I->Dep->Depth+1);
      >> +    }
      >> +
      >> +  // Only copy scheduled successors. Cut them from old node's
      >> successor
      >> +  // list and move them over.
      >> +  SmallVector, 4> DelDeps;
      >> +  for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU-
      >>> Succs.end();
      >> +       I != E; ++I) {
      >> +    if (I->isSpecial)
      >> +      continue;
      >> +    if (I->Dep->isScheduled) {
      >> +      NewSU->Height = std::max(NewSU->Height, I->Dep->Height+1);
      >> +      AddPred(I->Dep, NewSU, I->isCtrl, false, I->Reg, I->Cost);
      >> +      DelDeps.push_back(std::make_pair(I->Dep, I->isCtrl));
      >> +    }
      >> +  }
      >> +  for (unsigned i = 0, e = DelDeps.size(); i != e; ++i) {
      >> +    SUnit *Succ = DelDeps[i].first;
      >> +    bool isCtrl = DelDeps[i].second;
      >> +    RemovePred(Succ, SU, isCtrl, false);
      >> +  }
      >> +
      >> +  ++NumDups;
      >> +  return NewSU;
      >> +}
      >> +
      >> +/// InsertCCCopiesAndMoveSuccs - Insert expensive cross register
      >> class copies
      >> +/// and move all scheduled successors of the given SUnit to the
      >> last copy.
      >> +void ScheduleDAGFast::InsertCCCopiesAndMoveSuccs(SUnit *SU,
      >> unsigned Reg,
      >> +                                              const
      >> TargetRegisterClass *DestRC,
      >> +                                              const
      >> TargetRegisterClass *SrcRC,
      >> +                                               SmallVector> 2> &Copies) {
      >> +  SUnit *CopyFromSU = CreateNewSUnit(NULL);
      >> +  CopyFromSU->CopySrcRC = SrcRC;
      >> +  CopyFromSU->CopyDstRC = DestRC;
      >> +
      >> +  SUnit *CopyToSU = CreateNewSUnit(NULL);
      >> +  CopyToSU->CopySrcRC = DestRC;
      >> +  CopyToSU->CopyDstRC = SrcRC;
      >> +
      >> +  // Only copy scheduled successors. Cut them from old node's
      >> successor
      >> +  // list and move them over.
      >> +  SmallVector, 4> DelDeps;
      >> +  for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU-
      >>> Succs.end();
      >> +       I != E; ++I) {
      >> +    if (I->isSpecial)
      >> +      continue;
      >> +    if (I->Dep->isScheduled) {
      >> +      AddPred(I->Dep, CopyToSU, I->isCtrl, false, I->Reg, I->Cost);
      >> +      DelDeps.push_back(std::make_pair(I->Dep, I->isCtrl));
      >> +    }
      >> +  }
      >> +  for (unsigned i = 0, e = DelDeps.size(); i != e; ++i) {
      >> +    SUnit *Succ = DelDeps[i].first;
      >> +    bool isCtrl = DelDeps[i].second;
      >> +    RemovePred(Succ, SU, isCtrl, false);
      >> +  }
      >> +
      >> +  AddPred(CopyFromSU, SU, false, false, Reg, -1);
      >> +  AddPred(CopyToSU, CopyFromSU, false, false, Reg, 1);
      >> +
      >> +  Copies.push_back(CopyFromSU);
      >> +  Copies.push_back(CopyToSU);
      >> +
      >> +  ++NumCCCopies;
      >> +}
      >> +
      >> +/// getPhysicalRegisterVT - Returns the ValueType of the physical
      >> register
      >> +/// definition of the specified node.
      >> +/// FIXME: Move to SelectionDAG?
      >> +static MVT getPhysicalRegisterVT(SDNode *N, unsigned Reg,
      >> +                                 const TargetInstrInfo *TII) {
      >> +  const TargetInstrDesc &TID = TII->get(N->getMachineOpcode());
      >> +  assert(TID.ImplicitDefs && "Physical reg def must be in implicit
      >> def list!");
      >> +  unsigned NumRes = TID.getNumDefs();
      >> +  for (const unsigned *ImpDef = TID.getImplicitDefs(); *ImpDef; +
      >> +ImpDef) {
      >> +    if (Reg == *ImpDef)
      >> +      break;
      >> +    ++NumRes;
      >> +  }
      >> +  return N->getValueType(NumRes);
      >> +}
      >> +
      >> +/// DelayForLiveRegsBottomUp - Returns true if it is necessary to
      >> delay
      >> +/// scheduling of the given node to satisfy live physical register
      >> dependencies.
      >> +/// If the specific node is the last one that's available to
      >> schedule, do
      >> +/// whatever is necessary (i.e. backtracking or cloning) to make it
      >> possible.
      >> +bool ScheduleDAGFast::DelayForLiveRegsBottomUp(SUnit *SU,
      >> +
      >> SmallVector &LRegs){
      >> +  if (LiveRegs.empty())
      >> +    return false;
      >> +
      >> +  SmallSet RegAdded;
      >> +  // If this node would clobber any "live" register, then it's not
      >> ready.
      >> +  for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU-
      >>> Preds.end();
      >> +       I != E; ++I) {
      >> +    if (I->Cost < 0)  {
      >> +      unsigned Reg = I->Reg;
      >> +      if (LiveRegs.count(Reg) && LiveRegDefs[Reg] != I->Dep) {
      >> +        if (RegAdded.insert(Reg))
      >> +          LRegs.push_back(Reg);
      >> +      }
      >> +      for (const unsigned *Alias = TRI->getAliasSet(Reg);
      >> +           *Alias; ++Alias)
      >> +        if (LiveRegs.count(*Alias) && LiveRegDefs[*Alias] != I-
      >>> Dep) {
      >> +          if (RegAdded.insert(*Alias))
      >> +            LRegs.push_back(*Alias);
      >> +        }
      >> +    }
      >> +  }
      >> +
      >> +  for (unsigned i = 0, e = SU->FlaggedNodes.size()+1; i != e; ++i) {
      >> +    SDNode *Node = (i == 0) ? SU->Node : SU->FlaggedNodes[i-1];
      >> +    if (!Node || !Node->isMachineOpcode())
      >> +      continue;
      >> +    const TargetInstrDesc &TID = TII->get(Node->getMachineOpcode());
      >> +    if (!TID.ImplicitDefs)
      >> +      continue;
      >> +    for (const unsigned *Reg = TID.ImplicitDefs; *Reg; ++Reg) {
      >> +      if (LiveRegs.count(*Reg) && LiveRegDefs[*Reg] != SU) {
      >> +        if (RegAdded.insert(*Reg))
      >> +          LRegs.push_back(*Reg);
      >> +      }
      >> +      for (const unsigned *Alias = TRI->getAliasSet(*Reg);
      >> +           *Alias; ++Alias)
      >> +        if (LiveRegs.count(*Alias) && LiveRegDefs[*Alias] != SU) {
      >> +          if (RegAdded.insert(*Alias))
      >> +            LRegs.push_back(*Alias);
      >> +        }
      >> +    }
      >> +  }
      >> +  return !LRegs.empty();
      >> +}
      >> +
      >> +
      >> +/// ListScheduleBottomUp - The main loop of list scheduling for
      >> bottom-up
      >> +/// schedulers.
      >> +void ScheduleDAGFast::ListScheduleBottomUp() {
      >> +  unsigned CurCycle = 0;
      >> +  // Add root to Available queue.
      >> +  if (!SUnits.empty()) {
      >> +    SUnit *RootSU = &SUnits[DAG.getRoot().getNode()->getNodeId()];
      >> +    assert(RootSU->Succs.empty() && "Graph root shouldn't have
      >> successors!");
      >> +    RootSU->isAvailable = true;
      >> +    AvailableQueue.push(RootSU);
      >> +  }
      >> +
      >> +  // While Available queue is not empty, grab the node with the
      >> highest
      >> +  // priority. If it is not ready put it back.  Schedule the node.
      >> +  SmallVector NotReady;
      >> +  DenseMap > LRegsMap;
      >> +  Sequence.reserve(SUnits.size());
      >> +  while (!AvailableQueue.empty()) {
      >> +    bool Delayed = false;
      >> +    LRegsMap.clear();
      >> +    SUnit *CurSU = AvailableQueue.pop();
      >> +    while (CurSU) {
      >> +      if (CurSU->CycleBound <= CurCycle) {
      >> +        SmallVector LRegs;
      >> +        if (!DelayForLiveRegsBottomUp(CurSU, LRegs))
      >> +          break;
      >> +        Delayed = true;
      >> +        LRegsMap.insert(std::make_pair(CurSU, LRegs));
      >> +      }
      >> +
      >> +      CurSU->isPending = true;  // This SU is not in AvailableQueue
      >> right now.
      >> +      NotReady.push_back(CurSU);
      >> +      CurSU = AvailableQueue.pop();
      >> +    }
      >> +
      >> +    // All candidates are delayed due to live physical reg
      >> dependencies.
      >> +    // Try code duplication or inserting cross class copies
      >> +    // to resolve it.
      >> +    if (Delayed && !CurSU) {
      >> +      if (!CurSU) {
      >> +        // Try duplicating the nodes that produces these
      >> +        // "expensive to copy" values to break the dependency. In
      >> case even
      >> +        // that doesn't work, insert cross class copies.
      >> +        SUnit *TrySU = NotReady[0];
      >> +        SmallVector &LRegs = LRegsMap[TrySU];
      >> +        assert(LRegs.size() == 1 && "Can't handle this yet!");
      >> +        unsigned Reg = LRegs[0];
      >> +        SUnit *LRDef = LiveRegDefs[Reg];
      >> +        SUnit *NewDef = CopyAndMoveSuccessors(LRDef);
      >> +        if (!NewDef) {
      >> +          // Issue expensive cross register class copies.
      >> +          MVT VT = getPhysicalRegisterVT(LRDef->Node, Reg, TII);
      >> +          const TargetRegisterClass *RC =
      >> +            TRI->getPhysicalRegisterRegClass(Reg, VT);
      >> +          const TargetRegisterClass *DestRC = TRI-
      >>> getCrossCopyRegClass(RC);
      >> +          if (!DestRC) {
      >> +            assert(false && "Don't know how to copy this physical
      >> register!");
      >> +            abort();
      >> +          }
      >> +          SmallVector Copies;
      >> +          InsertCCCopiesAndMoveSuccs(LRDef, Reg, DestRC, RC,  
      >> Copies);
      >> +          DOUT << "Adding an edge from SU # " << TrySU->NodeNum
      >> +               << " to SU #" << Copies.front()->NodeNum << "\n";
      >> +          AddPred(TrySU, Copies.front(), true, true);
      >> +          NewDef = Copies.back();
      >> +        }
      >> +
      >> +        DOUT << "Adding an edge from SU # " << NewDef->NodeNum
      >> +             << " to SU #" << TrySU->NodeNum << "\n";
      >> +        LiveRegDefs[Reg] = NewDef;
      >> +        AddPred(NewDef, TrySU, true, true);
      >> +        TrySU->isAvailable = false;
      >> +        CurSU = NewDef;
      >> +      }
      >> +
      >> +      if (!CurSU) {
      >> +        assert(false && "Unable to resolve live physical register
      >> dependencies!");
      >> +        abort();
      >> +      }
      >> +    }
      >> +
      >> +    // Add the nodes that aren't ready back onto the available list.
      >> +    for (unsigned i = 0, e = NotReady.size(); i != e; ++i) {
      >> +      NotReady[i]->isPending = false;
      >> +      // May no longer be available due to backtracking.
      >> +      if (NotReady[i]->isAvailable)
      >> +        AvailableQueue.push(NotReady[i]);
      >> +    }
      >> +    NotReady.clear();
      >> +
      >> +    if (!CurSU)
      >> +      Sequence.push_back(0);
      >> +    else {
      >> +      ScheduleNodeBottomUp(CurSU, CurCycle);
      >> +      Sequence.push_back(CurSU);
      >> +    }
      >> +    ++CurCycle;
      >> +  }
      >> +
      >> +  // Reverse the order if it is bottom up.
      >> +  std::reverse(Sequence.begin(), Sequence.end());
      >> +
      >> +
      >> +#ifndef NDEBUG
      >> +  // Verify that all SUnits were scheduled.
      >> +  bool AnyNotSched = false;
      >> +  unsigned DeadNodes = 0;
      >> +  unsigned Noops = 0;
      >> +  for (unsigned i = 0, e = SUnits.size(); i != e; ++i) {
      >> +    if (!SUnits[i].isScheduled) {
      >> +      if (SUnits[i].NumPreds == 0 && SUnits[i].NumSuccs == 0) {
      >> +        ++DeadNodes;
      >> +        continue;
      >> +      }
      >> +      if (!AnyNotSched)
      >> +        cerr << "*** List scheduling failed! ***\n";
      >> +      SUnits[i].dump(&DAG);
      >> +      cerr << "has not been scheduled!\n";
      >> +      AnyNotSched = true;
      >> +    }
      >> +    if (SUnits[i].NumSuccsLeft != 0) {
      >> +      if (!AnyNotSched)
      >> +        cerr << "*** List scheduling failed! ***\n";
      >> +      SUnits[i].dump(&DAG);
      >> +      cerr << "has successors left!\n";
      >> +      AnyNotSched = true;
      >> +    }
      >> +  }
      >> +  for (unsigned i = 0, e = Sequence.size(); i != e; ++i)
      >> +    if (!Sequence[i])
      >> +      ++Noops;
      >> +  assert(!AnyNotSched);
      >> +  assert(Sequence.size() + DeadNodes - Noops == SUnits.size() &&
      >> +         "The number of nodes scheduled doesn't match the expected
      >> number!");
      >> +#endif
      >> +}
      >> +
      >> +//
      >> =
      >> =
      >> =
      >> ----------------------------------------------------------------------=
      >> ==//
      >> +//                         Public Constructor Functions
      >> +//
      >> =
      >> =
      >> =
      >> ----------------------------------------------------------------------=
      >> ==//
      >> +
      >> +llvm::ScheduleDAG* llvm::createFastDAGScheduler(SelectionDAGISel  
      >> *IS,
      >> +                                                SelectionDAG *DAG,
      >> +                                                MachineBasicBlock
      >> *BB, bool) {
      >> +  return new ScheduleDAGFast(*DAG, BB, DAG->getTarget());
      >> +}
      >>
      >>
      >> _______________________________________________
      >> llvm-commits mailing list
      >> llvm-commits at cs.uiuc.edu
      >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From dalej at apple.com  Thu Sep 18 12:56:50 2008
      From: dalej at apple.com (Dale Johannesen)
      Date: Thu, 18 Sep 2008 10:56:50 -0700
      Subject: [llvm-commits] [llvm] r56290 - in /llvm/trunk:
      	include/llvm/CodeGen/LiveIntervalAnalysis.h
      	include/llvm/CodeGen/MachineOperand.h	include/llvm/CodeGen/ScheduleDAG.h
      	lib/CodeGen/AsmPrinter/AsmPrinter.cpp	lib/CodeGen/LiveIntervalAnalysis.cpp
      	lib/CodeGen/MachineInstr.cpp	lib/CodeGen/RegAllocLinearScan.cpp
      	lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      	lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
      	lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
      	test/CodeGen/X86/2008-09-17-inline-asm-1.ll
      In-Reply-To: <9D57B985-FDD1-428F-BA5C-E90C31304F19@apple.com>
      References: <200809172113.m8HLDDWK014018@zion.cs.uiuc.edu>
      	<9D57B985-FDD1-428F-BA5C-E90C31304F19@apple.com>
      Message-ID: <658D3F3E-D970-4AC9-BB0C-33EA93D21FF3@apple.com>
      
      
      On Sep 18, 2008, at 10:17 AMPDT, Evan Cheng wrote:
      
      > Hi Dale,
      >
      > Thanks for doing this. Comments inline.
      >
      > On Sep 17, 2008, at 2:13 PM, Dale Johannesen wrote:
      >
      > LiveIntervals::releaseMemory() should release
      > AsmsWithEarlyClobberConflict and AsmsThatEarlyClobber, no?
      
      Right.
      
      >
      >>
      >> +/// noEarlyclobberConflict - see whether virtual reg VReg has a
      >> conflict with
      >> +/// hard reg HReg because of earlyclobbers.
      >> +///
      >> +/// Earlyclobber operands may not be assigned the same register as
      >> +/// each other, or as earlyclobber-conflict operands (i.e. those  
      >> that
      >> +/// are non-earlyclobbered inputs to an asm that also has
      >> earlyclobbers).
      >> +///
      >> +/// Thus there are two cases to check for:
      >> +/// 1.  VReg is an earlyclobber-conflict register and HReg is an
      >> earlyclobber
      >> +/// register in some asm that also has VReg as an input.
      >> +/// 2.  VReg is an earlyclobber register and HReg is an
      >> earlyclobber-conflict
      >> +/// input elsewhere in some asm.
      >> +/// In both cases HReg can be assigned by the user, or assigned
      >> early in
      >> +/// register allocation.
      >> +///
      >> +/// Dropping the distinction between earlyclobber and earlyclobber-
      >> conflict,
      >> +/// keeping only one multimap, looks promising, but two
      >> earlyclobber-conflict
      >> +/// operands may be assigned the same register if they happen to
      >> contain the
      >> +/// same value, and that implementation would prevent this.
      >> +///
      >> +bool LiveIntervals::noEarlyclobberConflict(unsigned VReg,
      >> VirtRegMap &vrm,
      >> +                                           unsigned HReg) {
      >> +  typedef std::multimap::iterator It;
      >> +
      >> +  // Short circuit the most common case.
      >> +  if (AsmsWithEarlyClobberConflict.size()!=0) {
      >
      > If AsmsWithEarlyClobberConflict is empty, there is no need to check
      > for AsmsThatEarlyClobber, right? And vice versa.
      
      Right, although very minor.
      
      > Also, I don't think this is a safe approach, machine instructions can
      > be deleted and leave the maps in the invalid state.
      
      It's safe if deletions update the maps, but I haven't touched the  
      coalescer yet.
      Agreed, this is bad, guess I shouldn't have checked it in yet.
      
      >> +    std::pair x =
      >> AsmsWithEarlyClobberConflict.equal_range(VReg);
      >> +    for (It I = x.first; I!=x.second; I++) {
      >> +      MachineInstr* MI = I->second;
      >> +      for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
      >> +        MachineOperand &MO = MI->getOperand(i);
      >> +        if (MO.isRegister() && MO.isEarlyClobber()) {
      >> +          unsigned PhysReg = MO.getReg();
      >> +          if (PhysReg &&
      >> TargetRegisterInfo::isVirtualRegister(PhysReg)) {
      >> +            if (!vrm.hasPhys(PhysReg))
      >> +              continue;
      >> +            PhysReg = vrm.getPhys(PhysReg);
      >> +          }
      >> +          if (PhysReg==HReg)
      >> +            return false;
      >> +        }
      >> +      }
      >> +    }
      >> +  }
      >> +  // Short circuit the most common case.
      >> +  if (AsmsThatEarlyClobber.size()!=0) {
      >> +    std::pair x = AsmsThatEarlyClobber.equal_range(VReg);
      >> +    for (It I = x.first; I!=x.second; I++) {
      >> +      MachineInstr* MI = I->second;
      >> +      for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
      >> +        MachineOperand &MO = MI->getOperand(i);
      >> +        if (MO.isRegister() && MO.overlapsEarlyClobber()) {
      >> +          unsigned PhysReg = MO.getReg();
      >> +          if (PhysReg &&
      >> TargetRegisterInfo::isVirtualRegister(PhysReg)) {
      >> +            if (!vrm.hasPhys(PhysReg))
      >> +              continue;
      >> +            PhysReg = vrm.getPhys(PhysReg);
      >> +          }
      >> +          if (PhysReg==HReg)
      >> +            return false;
      >> +        }
      >> +      }
      >> +    }
      >> +  }
      >> +  return true;
      >> +}
      >>
      >> LiveInterval* LiveIntervals::createInterval(unsigned reg) {
      >>  float Weight = TargetRegisterInfo::isPhysicalRegister(reg) ?
      >>
      >>
      >> Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56290&r1=56289&r2=56290&view=diff
      >>
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> = 
      >> =====================================================================
      >> --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
      >> +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Wed Sep 17
      >> 16:13:11 2008
      >> @@ -1050,7 +1050,8 @@
      >>  TargetRegisterClass::iterator E = RC->allocation_order_end(*mf_);
      >>  assert(I != E && "No allocatable register in this register class!");
      >>  for (; I != E; ++I)
      >> -    if (prt_->isRegAvail(*I)) {
      >> +    if (prt_->isRegAvail(*I) &&
      >> +        li_->noEarlyclobberConflict(cur->reg, *vrm_, *I)) {
      >
      > Ok, I have two concerns. 1. We need to do this check for every
      > interval.
      
      Yes, but in the typical case where there's no asm's it returns  
      immediately.
      I could add a bit to the LiveInterval easily enough (had this at one  
      point,
      but eventually decided I didn't need it).  Of course you still have to  
      check
      the bit for each interval, but there's no escape from that I don't  
      think.
      
      > 2. After AsmsThatEarlyClobber and
      > AsmsWithEarlyClobberConflict are populated virtual registers can
      > change due to coalescing (and potentially other passes). Then the maps
      > won't be accurate.
      >
      > Perhaps we should add a bit to LiveInterval to indicate a vr can be
      > earlyclobber or earlyclobberconflict. Coalescer should not touch any
      > register whose interval has the bit. Then we only do the check for
      > those intervals here. The check can use MachineRegisterInfo def / use
      > chain to look for any conflicts.
      
      I preferred a lookup table because walking a chain can get slow, but  
      OK, I can
      do it this way.  It may be that maintaining the table correctly is too  
      hard.
      
      > Evan
      >
      >>
      >>      FreeReg = *I;
      >>      if (FreeReg < inactiveCounts.size())
      >>        FreeRegInactiveCount = inactiveCounts[FreeReg];
      >> @@ -1070,7 +1071,8 @@
      >>  for (; I != E; ++I) {
      >>    unsigned Reg = *I;
      >>    if (prt_->isRegAvail(Reg) && Reg < inactiveCounts.size() &&
      >> -        FreeRegInactiveCount < inactiveCounts[Reg]) {
      >> +        FreeRegInactiveCount < inactiveCounts[Reg] &&
      >> +        li_->noEarlyclobberConflict(cur->reg, *vrm_, Reg)) {
      >>      FreeReg = Reg;
      >>      FreeRegInactiveCount = inactiveCounts[Reg];
      >>      if (FreeRegInactiveCount == MaxInactiveCount)
      >>
      >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp?rev=56290&r1=56289&r2=56290&view=diff
      >>
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> = 
      >> =====================================================================
      >> --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp  
      >> (original)
      >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp Wed Sep
      >> 17 16:13:11 2008
      >> @@ -231,7 +231,8 @@
      >> void ScheduleDAG::AddOperand(MachineInstr *MI, SDValue Op,
      >>                             unsigned IIOpNum,
      >>                             const TargetInstrDesc *II,
      >> -                             DenseMap
      >> &VRBaseMap) {
      >> +                             DenseMap &VRBaseMap,
      >> +                             bool overlapsEarlyClobber) {
      >>  if (Op.isMachineOpcode()) {
      >>    // Note that this case is redundant with the final else block,
      >> but we
      >>    // include it because it is the most common and it makes the logic
      >> @@ -244,7 +245,9 @@
      >>    const TargetInstrDesc &TID = MI->getDesc();
      >>    bool isOptDef = IIOpNum < TID.getNumOperands() &&
      >>      TID.OpInfo[IIOpNum].isOptionalDef();
      >> -    MI->addOperand(MachineOperand::CreateReg(VReg, isOptDef));
      >> +    MI->addOperand(MachineOperand::CreateReg(VReg, isOptDef, false,
      >> false,
      >> +                                             false, 0, false,
      >> +                                             overlapsEarlyClobber));
      >>
      >>    // Verify that it is right.
      >>    assert(TargetRegisterInfo::isVirtualRegister(VReg) && "Not a
      >> vreg?");
      >> @@ -278,7 +281,9 @@
      >>    const ConstantFP *CFP = F->getConstantFPValue();
      >>    MI->addOperand(MachineOperand::CreateFPImm(CFP));
      >>  } else if (RegisterSDNode *R = dyn_cast(Op)) {
      >> -    MI->addOperand(MachineOperand::CreateReg(R->getReg(), false));
      >> +    MI->addOperand(MachineOperand::CreateReg(R->getReg(), false,
      >> false,
      >> +                                             false, false, 0, false,
      >> +                                             overlapsEarlyClobber));
      >>  } else if (GlobalAddressSDNode *TGA =
      >> dyn_cast(Op)) {
      >>    MI->addOperand(MachineOperand::CreateGA(TGA->getGlobal(),TGA-
      >>> getOffset()));
      >>  } else if (BasicBlockSDNode *BB = dyn_cast(Op)) {
      >> @@ -314,7 +319,9 @@
      >>           Op.getValueType() != MVT::Flag &&
      >>           "Chain and flag operands should occur at end of operand
      >> list!");
      >>    unsigned VReg = getVR(Op, VRBaseMap);
      >> -    MI->addOperand(MachineOperand::CreateReg(VReg, false));
      >> +    MI->addOperand(MachineOperand::CreateReg(VReg, false, false,
      >> +                                             false, false, 0, false,
      >> +                                             overlapsEarlyClobber));
      >>
      >>    // Verify that it is right.  Note that the reg class of the
      >> physreg and the
      >>    // vreg don't necessarily need to match, but the target copy
      >> insertion has
      >> @@ -596,6 +603,7 @@
      >>
      >>    // Add all of the operand registers to the instruction.
      >>    for (unsigned i = 2; i != NumOps;) {
      >> +      bool overlapsEarlyClobber = false;
      >>      unsigned Flags =
      >>        cast(Node->getOperand(i))->getZExtValue();
      >>      unsigned NumVals = Flags >> 3;
      >> @@ -618,13 +626,18 @@
      >>                                                   false, 0, true));
      >>        }
      >>        break;
      >> +      case 7:  // Addressing mode overlapping earlyclobber.
      >> +      case 5:  // Use of register overlapping earlyclobber.
      >> +        overlapsEarlyClobber = true;
      >> +        // fall through
      >>      case 1:  // Use of register.
      >>      case 3:  // Immediate.
      >>      case 4:  // Addressing mode.
      >>        // The addressing mode has been selected, just add all of the
      >>        // operands to the machine instruction.
      >>        for (; NumVals; --NumVals, ++i)
      >> -          AddOperand(MI, Node->getOperand(i), 0, 0, VRBaseMap);
      >> +          AddOperand(MI, Node->getOperand(i), 0, 0, VRBaseMap,
      >> +                     overlapsEarlyClobber);
      >>        break;
      >>      }
      >>    }
      >>
      >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
      >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=56290&r1=56289&r2=56290&view=diff
      >>
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> = 
      >> =====================================================================
      >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
      >> (original)
      >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed
      >> Sep 17 16:13:11 2008
      >> @@ -4909,8 +4909,10 @@
      >>        assert(OpInfo.isIndirect && "Memory output must be indirect
      >> operand");
      >>
      >>        // Add information to the INLINEASM node to know about this
      >> output.
      >> -        unsigned ResOpType = 4/*MEM*/ | (1 << 3);
      >> -        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType,
      >> +        unsigned ResOpType = SawEarlyClobber ?
      >> +                                  7 /* MEM OVERLAPS EARLYCLOBBER  
      >> */ :
      >> +                                  4/*MEM*/;
      >> +        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType |
      >> (1<<3),
      >>
      >> TLI.getPointerTy()));
      >>        AsmNodeOperands.push_back(OpInfo.CallOperand);
      >>        break;
      >> @@ -4963,7 +4965,8 @@
      >>            cast(AsmNodeOperands[CurOp])-
      >>> getZExtValue();
      >>          assert(((NumOps & 7) == 2 /*REGDEF*/ ||
      >>                  (NumOps & 7) == 6 /*EARLYCLOBBER REGDEF*/ ||
      >> -                  (NumOps & 7) == 4 /*MEM*/) &&
      >> +                  (NumOps & 7) == 4 /*MEM*/ ||
      >> +                  (NumOps & 7) == 7 /*MEM OVERLAPS EARLYCLOBBER*/)  
      >> &&
      >>                 "Skipped past definitions?");
      >>          CurOp += (NumOps>>3)+1;
      >>        }
      >> @@ -4985,14 +4988,17 @@
      >>
      >>          // Use the produced MatchedRegs object to
      >>          MatchedRegs.getCopyToRegs(InOperandVal, DAG, Chain, &Flag);
      >> -          MatchedRegs.AddInlineAsmOperands(1 /*REGUSE*/, DAG,
      >> AsmNodeOperands);
      >> +          MatchedRegs.AddInlineAsmOperands(SawEarlyClobber ?
      >> +                                           1 /*REGUSE*/ :
      >> +                                           5 /*REGUSE OVERLAPS
      >> EARLYCLOBBER*/,
      >> +                                           DAG, AsmNodeOperands);
      >>          break;
      >>        } else {
      >> -          assert((NumOps & 7) == 4/*MEM*/ && "Unknown matching
      >> constraint!");
      >> +          assert(((NumOps & 7) == 7/*MEM OVERLAPS EARLYCLOBBER */ ||
      >> +                  (NumOps & 7) == 4) && "Unknown matching
      >> constraint!");
      >>          assert((NumOps >> 3) == 1 && "Unexpected number of
      >> operands");
      >>          // Add information to the INLINEASM node to know about
      >> this input.
      >> -          unsigned ResOpType = 4/*MEM*/ | (1 << 3);
      >> -          AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType,
      >> +          AsmNodeOperands.push_back(DAG.getTargetConstant(NumOps,
      >>
      >> TLI.getPointerTy()));
      >>          AsmNodeOperands.push_back(AsmNodeOperands[CurOp+1]);
      >>          break;
      >> @@ -5024,8 +5030,10 @@
      >>               "Memory operands expect pointer values");
      >>
      >>        // Add information to the INLINEASM node to know about this
      >> input.
      >> -        unsigned ResOpType = 4/*MEM*/ | (1 << 3);
      >> -        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType,
      >> +        unsigned ResOpType = SawEarlyClobber ?
      >> +                                7 /* MEM OVERLAPS EARLYCLOBBER */ :
      >> +                                4/*MEM*/;
      >> +        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType |
      >> (1<<3),
      >>
      >> TLI.getPointerTy()));
      >>        AsmNodeOperands.push_back(InOperandVal);
      >>        break;
      >> @@ -5043,16 +5051,18 @@
      >>
      >>      OpInfo.AssignedRegs.getCopyToRegs(InOperandVal, DAG, Chain,
      >> &Flag);
      >>
      >> -      OpInfo.AssignedRegs.AddInlineAsmOperands(1/*REGUSE*/, DAG,
      >> -                                               AsmNodeOperands);
      >> +      OpInfo.AssignedRegs.AddInlineAsmOperands(SawEarlyClobber ?
      >> +                                           5 /*REGUSE OVERLAPS
      >> EARLYCLOBBER*/:
      >> +                                           1/*REGUSE*/,
      >> +                                           DAG, AsmNodeOperands);
      >>      break;
      >>    }
      >>    case InlineAsm::isClobber: {
      >>      // Add the clobbered value to the operand list, so that the
      >> register
      >>      // allocator is aware that the physreg got clobbered.
      >>      if (!OpInfo.AssignedRegs.Regs.empty())
      >> -        OpInfo.AssignedRegs.AddInlineAsmOperands(2/*REGDEF*/, DAG,
      >> -                                                 AsmNodeOperands);
      >> +        OpInfo.AssignedRegs.AddInlineAsmOperands(6 /* EARLYCLOBBER
      >> REGDEF */,
      >> +                                                 DAG,
      >> AsmNodeOperands);
      >>      break;
      >>    }
      >>    }
      >>
      >> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
      >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=56290&r1=56289&r2=56290&view=diff
      >>
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> = 
      >> =====================================================================
      >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
      >> (original)
      >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Sep
      >> 17 16:13:11 2008
      >> @@ -1113,7 +1113,8 @@
      >>
      >>  while (i != e) {
      >>    unsigned Flags = cast(InOps[i])->getZExtValue();
      >> -    if ((Flags & 7) != 4 /*MEM*/) {
      >> +    if ((Flags & 7) != 4 /*MEM*/ &&
      >> +        (Flags & 7) != 7 /*MEM OVERLAPS EARLYCLOBBER*/) {
      >>      // Just skip over this operand, copying the operands verbatim.
      >>      Ops.insert(Ops.end(), InOps.begin()+i, InOps.begin()+i+(Flags
      >>>> 3) + 1);
      >>      i += (Flags >> 3) + 1;
      >> @@ -1128,7 +1129,7 @@
      >>
      >>      // Add this to the output node.
      >>      MVT IntPtrTy = CurDAG->getTargetLoweringInfo().getPointerTy();
      >> -      Ops.push_back(CurDAG->getTargetConstant(4/*MEM*/ |
      >> (SelOps.size() << 3),
      >> +      Ops.push_back(CurDAG->getTargetConstant((Flags & 7) |
      >> (SelOps.size()<< 3),
      >>                                              IntPtrTy));
      >>      Ops.insert(Ops.end(), SelOps.begin(), SelOps.end());
      >>      i += 2;
      >>
      >> Added: llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll
      >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll?rev=56290&view=auto
      >>
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> =
      >> = 
      >> =====================================================================
      >> --- llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll (added)
      >> +++ llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll Wed Sep
      >> 17 16:13:11 2008
      >> @@ -0,0 +1,24 @@
      >> +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl %eax,
      >> %eax"
      >> +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl %edx,
      >> %edx"
      >> +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl (%eax),
      >> %eax"
      >> +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl (%edx),
      >> %edx"
      >> +
      >> +; %0 must not be put in EAX or EDX.
      >> +; In the first asm, $0 and $2 must not be put in EAX.
      >> +; In the second asm, $0 and $2 must not be put in EDX.
      >> +; This is kind of hard to test thoroughly, but the things above
      >> should continue
      >> +; to pass, I think.
      >> +; ModuleID = ''
      >> +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-
      >> i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-
      >> f80:128:128"
      >> +target triple = "i386-apple-darwin8"
      >> + at x = common global i32 0		;  [#uses=1]
      >> +
      >> +define i32 @aci(i32* %pw) nounwind {
      >> +entry:
      >> +	%0 = load i32* @x, align 4		;  [#uses=1]
      >> +	%asmtmp = tail call { i32, i32 } asm "movl $0, %eax\0A\090:\0A
      >> \09test %eax, %eax\0A\09je 1f\0A\09movl %eax, $2\0A\09incl $2\0A
      >> \09lock\0A\09cmpxchgl $2, $0\0A\09jne 0b\0A\091:",
      >> "=*m,=&{ax},=&r,*m,~{dirflag},~{fpsr},~{flags},~{memory},~{cc}"(i32*
      >> %pw, i32* %pw) nounwind		; <{ i32, i32 }> [#uses=0]
      >> +	%asmtmp2 = tail call { i32, i32 } asm "movl $0, %edx\0A\090:\0A
      >> \09test %edx, %edx\0A\09je 1f\0A\09movl %edx, $2\0A\09incl $2\0A
      >> \09lock\0A\09cmpxchgl $2, $0\0A\09jne 0b\0A\091:",
      >> "=*m,=&{dx},=&r,*m,~{dirflag},~{fpsr},~{flags},~{memory},~{cc}"(i32*
      >> %pw, i32* %pw) nounwind		; <{ i32, i32 }> [#uses=1]
      >> +	%asmresult3 = extractvalue { i32, i32 } %asmtmp2, 0		; 
      >> [#uses=1]
      >> +	%1 = add i32 %asmresult3, %0		;  [#uses=1]
      >> +	ret i32 %1
      >> +}
      >>
      >>
      >> _______________________________________________
      >> llvm-commits mailing list
      >> llvm-commits at cs.uiuc.edu
      >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From gohman at apple.com  Thu Sep 18 13:06:48 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Thu, 18 Sep 2008 11:06:48 -0700
      Subject: [llvm-commits] [llvm] r56189 - in /llvm/trunk:
      	include/llvm/CodeGen/ lib/CodeGen/
      	lib/Target/ARM/	lib/Target/PowerPC/ lib/Target/Sparc/
      	lib/Target/X86/
      In-Reply-To: 
      References: <200809131758.m8DHwOc8023051@zion.cs.uiuc.edu>
      	
      Message-ID: <15FE807C-407B-4123-8ED6-8DC30FB3A706@apple.com>
      
      
      On Sep 15, 2008, at 11:54 AM, Chris Lattner wrote:
      
      >
      > On Sep 13, 2008, at 10:58 AM, Dan Gohman wrote:
      >
      >> Author: djg
      >> Date: Sat Sep 13 12:58:21 2008
      >> New Revision: 56189
      >>
      >> URL: http://llvm.org/viewvc/llvm-project?rev=56189&view=rev
      >> Log:
      >> Remove isImm(), isReg(), and friends, in favor of
      >> isImmediate(), isRegister(), and friends, to avoid confusion
      >> about having two different names with the same meaning. I'm
      >> not attached to the longer names, and would be ok with
      >> changing to the shorter names if others prefer it.
      >
      > Thanks for doing this Dan, but could you go the other way?  The short
      > names are just as legible and are more concise.  I started converting
      > all the old ones over to the short ones before but apparently got
      > distracted and never finished, :(
      
      Ok, I'll change the code to the shorter names.
      
      Dan
      
      
      
      From evan.cheng at apple.com  Thu Sep 18 13:07:00 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Thu, 18 Sep 2008 11:07:00 -0700
      Subject: [llvm-commits] [llvm] r56290 - in /llvm/trunk:
      	include/llvm/CodeGen/LiveIntervalAnalysis.h
      	include/llvm/CodeGen/MachineOperand.h	include/llvm/CodeGen/ScheduleDAG.h
      	lib/CodeGen/AsmPrinter/AsmPrinter.cpp	lib/CodeGen/LiveIntervalAnalysis.cpp
      	lib/CodeGen/MachineInstr.cpp	lib/CodeGen/RegAllocLinearScan.cpp
      	lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      	lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
      	lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
      	test/CodeGen/X86/2008-09-17-inline-asm-1.ll
      In-Reply-To: <658D3F3E-D970-4AC9-BB0C-33EA93D21FF3@apple.com>
      References: <200809172113.m8HLDDWK014018@zion.cs.uiuc.edu>
      	<9D57B985-FDD1-428F-BA5C-E90C31304F19@apple.com>
      	<658D3F3E-D970-4AC9-BB0C-33EA93D21FF3@apple.com>
      Message-ID: <022ED0A5-8BA2-4A8D-98B8-F4AA780FCEA6@apple.com>
      
      
      On Sep 18, 2008, at 10:56 AM, Dale Johannesen wrote:
      
      >
      >> 2. After AsmsThatEarlyClobber and
      >> AsmsWithEarlyClobberConflict are populated virtual registers can
      >> change due to coalescing (and potentially other passes). Then the  
      >> maps
      >> won't be accurate.
      >>
      >> Perhaps we should add a bit to LiveInterval to indicate a vr can be
      >> earlyclobber or earlyclobberconflict. Coalescer should not touch any
      >> register whose interval has the bit. Then we only do the check for
      >> those intervals here. The check can use MachineRegisterInfo def / use
      >> chain to look for any conflicts.
      >
      > I preferred a lookup table because walking a chain can get slow, but
      > OK, I can
      > do it this way.  It may be that maintaining the table correctly is too
      > hard.
      
      I think we want to avoid maintaining the maps in LiveIntervalAnalysis.  
      I know the register allocator currently rely on it, but that may  
      change in the future.
      
      Obviously traversing the def / use info will be slower. But if we only  
      do so for earlyclobber operands it should be ok. People who use this  
      inline asm "feature" should suffer. :-)
      
      Evan
      
      >
      >
      >> Evan
      >>
      >>>
      >>>     FreeReg = *I;
      >>>     if (FreeReg < inactiveCounts.size())
      >>>       FreeRegInactiveCount = inactiveCounts[FreeReg];
      >>> @@ -1070,7 +1071,8 @@
      >>> for (; I != E; ++I) {
      >>>   unsigned Reg = *I;
      >>>   if (prt_->isRegAvail(Reg) && Reg < inactiveCounts.size() &&
      >>> -        FreeRegInactiveCount < inactiveCounts[Reg]) {
      >>> +        FreeRegInactiveCount < inactiveCounts[Reg] &&
      >>> +        li_->noEarlyclobberConflict(cur->reg, *vrm_, Reg)) {
      >>>     FreeReg = Reg;
      >>>     FreeRegInactiveCount = inactiveCounts[Reg];
      >>>     if (FreeRegInactiveCount == MaxInactiveCount)
      >>>
      >>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp?rev=56290&r1=56289&r2=56290&view=diff
      >>>
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> = 
      >>> ====================================================================
      >>> --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp
      >>> (original)
      >>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp Wed Sep
      >>> 17 16:13:11 2008
      >>> @@ -231,7 +231,8 @@
      >>> void ScheduleDAG::AddOperand(MachineInstr *MI, SDValue Op,
      >>>                            unsigned IIOpNum,
      >>>                            const TargetInstrDesc *II,
      >>> -                             DenseMap
      >>> &VRBaseMap) {
      >>> +                             DenseMap  
      >>> &VRBaseMap,
      >>> +                             bool overlapsEarlyClobber) {
      >>> if (Op.isMachineOpcode()) {
      >>>   // Note that this case is redundant with the final else block,
      >>> but we
      >>>   // include it because it is the most common and it makes the logic
      >>> @@ -244,7 +245,9 @@
      >>>   const TargetInstrDesc &TID = MI->getDesc();
      >>>   bool isOptDef = IIOpNum < TID.getNumOperands() &&
      >>>     TID.OpInfo[IIOpNum].isOptionalDef();
      >>> -    MI->addOperand(MachineOperand::CreateReg(VReg, isOptDef));
      >>> +    MI->addOperand(MachineOperand::CreateReg(VReg, isOptDef, false,
      >>> false,
      >>> +                                             false, 0, false,
      >>> +                                              
      >>> overlapsEarlyClobber));
      >>>
      >>>   // Verify that it is right.
      >>>   assert(TargetRegisterInfo::isVirtualRegister(VReg) && "Not a
      >>> vreg?");
      >>> @@ -278,7 +281,9 @@
      >>>   const ConstantFP *CFP = F->getConstantFPValue();
      >>>   MI->addOperand(MachineOperand::CreateFPImm(CFP));
      >>> } else if (RegisterSDNode *R = dyn_cast(Op)) {
      >>> -    MI->addOperand(MachineOperand::CreateReg(R->getReg(), false));
      >>> +    MI->addOperand(MachineOperand::CreateReg(R->getReg(), false,
      >>> false,
      >>> +                                             false, false, 0,  
      >>> false,
      >>> +                                              
      >>> overlapsEarlyClobber));
      >>> } else if (GlobalAddressSDNode *TGA =
      >>> dyn_cast(Op)) {
      >>>   MI->addOperand(MachineOperand::CreateGA(TGA->getGlobal(),TGA-
      >>>> getOffset()));
      >>> } else if (BasicBlockSDNode *BB = dyn_cast(Op)) {
      >>> @@ -314,7 +319,9 @@
      >>>          Op.getValueType() != MVT::Flag &&
      >>>          "Chain and flag operands should occur at end of operand
      >>> list!");
      >>>   unsigned VReg = getVR(Op, VRBaseMap);
      >>> -    MI->addOperand(MachineOperand::CreateReg(VReg, false));
      >>> +    MI->addOperand(MachineOperand::CreateReg(VReg, false, false,
      >>> +                                             false, false, 0,  
      >>> false,
      >>> +                                              
      >>> overlapsEarlyClobber));
      >>>
      >>>   // Verify that it is right.  Note that the reg class of the
      >>> physreg and the
      >>>   // vreg don't necessarily need to match, but the target copy
      >>> insertion has
      >>> @@ -596,6 +603,7 @@
      >>>
      >>>   // Add all of the operand registers to the instruction.
      >>>   for (unsigned i = 2; i != NumOps;) {
      >>> +      bool overlapsEarlyClobber = false;
      >>>     unsigned Flags =
      >>>       cast(Node->getOperand(i))->getZExtValue();
      >>>     unsigned NumVals = Flags >> 3;
      >>> @@ -618,13 +626,18 @@
      >>>                                                  false, 0, true));
      >>>       }
      >>>       break;
      >>> +      case 7:  // Addressing mode overlapping earlyclobber.
      >>> +      case 5:  // Use of register overlapping earlyclobber.
      >>> +        overlapsEarlyClobber = true;
      >>> +        // fall through
      >>>     case 1:  // Use of register.
      >>>     case 3:  // Immediate.
      >>>     case 4:  // Addressing mode.
      >>>       // The addressing mode has been selected, just add all of the
      >>>       // operands to the machine instruction.
      >>>       for (; NumVals; --NumVals, ++i)
      >>> -          AddOperand(MI, Node->getOperand(i), 0, 0, VRBaseMap);
      >>> +          AddOperand(MI, Node->getOperand(i), 0, 0, VRBaseMap,
      >>> +                     overlapsEarlyClobber);
      >>>       break;
      >>>     }
      >>>   }
      >>>
      >>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
      >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=56290&r1=56289&r2=56290&view=diff
      >>>
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> = 
      >>> ====================================================================
      >>> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
      >>> (original)
      >>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed
      >>> Sep 17 16:13:11 2008
      >>> @@ -4909,8 +4909,10 @@
      >>>       assert(OpInfo.isIndirect && "Memory output must be indirect
      >>> operand");
      >>>
      >>>       // Add information to the INLINEASM node to know about this
      >>> output.
      >>> -        unsigned ResOpType = 4/*MEM*/ | (1 << 3);
      >>> -        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType,
      >>> +        unsigned ResOpType = SawEarlyClobber ?
      >>> +                                  7 /* MEM OVERLAPS EARLYCLOBBER
      >>> */ :
      >>> +                                  4/*MEM*/;
      >>> +        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType |
      >>> (1<<3),
      >>>
      >>> TLI.getPointerTy()));
      >>>       AsmNodeOperands.push_back(OpInfo.CallOperand);
      >>>       break;
      >>> @@ -4963,7 +4965,8 @@
      >>>           cast(AsmNodeOperands[CurOp])-
      >>>> getZExtValue();
      >>>         assert(((NumOps & 7) == 2 /*REGDEF*/ ||
      >>>                 (NumOps & 7) == 6 /*EARLYCLOBBER REGDEF*/ ||
      >>> -                  (NumOps & 7) == 4 /*MEM*/) &&
      >>> +                  (NumOps & 7) == 4 /*MEM*/ ||
      >>> +                  (NumOps & 7) == 7 /*MEM OVERLAPS EARLYCLOBBER*/)
      >>> &&
      >>>                "Skipped past definitions?");
      >>>         CurOp += (NumOps>>3)+1;
      >>>       }
      >>> @@ -4985,14 +4988,17 @@
      >>>
      >>>         // Use the produced MatchedRegs object to
      >>>         MatchedRegs.getCopyToRegs(InOperandVal, DAG, Chain, &Flag);
      >>> -          MatchedRegs.AddInlineAsmOperands(1 /*REGUSE*/, DAG,
      >>> AsmNodeOperands);
      >>> +          MatchedRegs.AddInlineAsmOperands(SawEarlyClobber ?
      >>> +                                           1 /*REGUSE*/ :
      >>> +                                           5 /*REGUSE OVERLAPS
      >>> EARLYCLOBBER*/,
      >>> +                                           DAG, AsmNodeOperands);
      >>>         break;
      >>>       } else {
      >>> -          assert((NumOps & 7) == 4/*MEM*/ && "Unknown matching
      >>> constraint!");
      >>> +          assert(((NumOps & 7) == 7/*MEM OVERLAPS EARLYCLOBBER */  
      >>> ||
      >>> +                  (NumOps & 7) == 4) && "Unknown matching
      >>> constraint!");
      >>>         assert((NumOps >> 3) == 1 && "Unexpected number of
      >>> operands");
      >>>         // Add information to the INLINEASM node to know about
      >>> this input.
      >>> -          unsigned ResOpType = 4/*MEM*/ | (1 << 3);
      >>> -           
      >>> AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType,
      >>> +          AsmNodeOperands.push_back(DAG.getTargetConstant(NumOps,
      >>>
      >>> TLI.getPointerTy()));
      >>>         AsmNodeOperands.push_back(AsmNodeOperands[CurOp+1]);
      >>>         break;
      >>> @@ -5024,8 +5030,10 @@
      >>>              "Memory operands expect pointer values");
      >>>
      >>>       // Add information to the INLINEASM node to know about this
      >>> input.
      >>> -        unsigned ResOpType = 4/*MEM*/ | (1 << 3);
      >>> -        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType,
      >>> +        unsigned ResOpType = SawEarlyClobber ?
      >>> +                                7 /* MEM OVERLAPS EARLYCLOBBER */ :
      >>> +                                4/*MEM*/;
      >>> +        AsmNodeOperands.push_back(DAG.getTargetConstant(ResOpType |
      >>> (1<<3),
      >>>
      >>> TLI.getPointerTy()));
      >>>       AsmNodeOperands.push_back(InOperandVal);
      >>>       break;
      >>> @@ -5043,16 +5051,18 @@
      >>>
      >>>     OpInfo.AssignedRegs.getCopyToRegs(InOperandVal, DAG, Chain,
      >>> &Flag);
      >>>
      >>> -      OpInfo.AssignedRegs.AddInlineAsmOperands(1/*REGUSE*/, DAG,
      >>> -                                               AsmNodeOperands);
      >>> +      OpInfo.AssignedRegs.AddInlineAsmOperands(SawEarlyClobber ?
      >>> +                                           5 /*REGUSE OVERLAPS
      >>> EARLYCLOBBER*/:
      >>> +                                           1/*REGUSE*/,
      >>> +                                           DAG, AsmNodeOperands);
      >>>     break;
      >>>   }
      >>>   case InlineAsm::isClobber: {
      >>>     // Add the clobbered value to the operand list, so that the
      >>> register
      >>>     // allocator is aware that the physreg got clobbered.
      >>>     if (!OpInfo.AssignedRegs.Regs.empty())
      >>> -        OpInfo.AssignedRegs.AddInlineAsmOperands(2/*REGDEF*/, DAG,
      >>> -                                                 AsmNodeOperands);
      >>> +        OpInfo.AssignedRegs.AddInlineAsmOperands(6 /* EARLYCLOBBER
      >>> REGDEF */,
      >>> +                                                 DAG,
      >>> AsmNodeOperands);
      >>>     break;
      >>>   }
      >>>   }
      >>>
      >>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
      >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=56290&r1=56289&r2=56290&view=diff
      >>>
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> = 
      >>> ====================================================================
      >>> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
      >>> (original)
      >>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Sep
      >>> 17 16:13:11 2008
      >>> @@ -1113,7 +1113,8 @@
      >>>
      >>> while (i != e) {
      >>>   unsigned Flags = cast(InOps[i])->getZExtValue();
      >>> -    if ((Flags & 7) != 4 /*MEM*/) {
      >>> +    if ((Flags & 7) != 4 /*MEM*/ &&
      >>> +        (Flags & 7) != 7 /*MEM OVERLAPS EARLYCLOBBER*/) {
      >>>     // Just skip over this operand, copying the operands verbatim.
      >>>     Ops.insert(Ops.end(), InOps.begin()+i, InOps.begin()+i+(Flags
      >>>>> 3) + 1);
      >>>     i += (Flags >> 3) + 1;
      >>> @@ -1128,7 +1129,7 @@
      >>>
      >>>     // Add this to the output node.
      >>>     MVT IntPtrTy = CurDAG->getTargetLoweringInfo().getPointerTy();
      >>> -      Ops.push_back(CurDAG->getTargetConstant(4/*MEM*/ |
      >>> (SelOps.size() << 3),
      >>> +      Ops.push_back(CurDAG->getTargetConstant((Flags & 7) |
      >>> (SelOps.size()<< 3),
      >>>                                             IntPtrTy));
      >>>     Ops.insert(Ops.end(), SelOps.begin(), SelOps.end());
      >>>     i += 2;
      >>>
      >>> Added: llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll
      >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll?rev=56290&view=auto
      >>>
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> =
      >>> = 
      >>> ====================================================================
      >>> --- llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll (added)
      >>> +++ llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll Wed Sep
      >>> 17 16:13:11 2008
      >>> @@ -0,0 +1,24 @@
      >>> +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl %eax,
      >>> %eax"
      >>> +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl %edx,
      >>> %edx"
      >>> +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl (%eax),
      >>> %eax"
      >>> +; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl (%edx),
      >>> %edx"
      >>> +
      >>> +; %0 must not be put in EAX or EDX.
      >>> +; In the first asm, $0 and $2 must not be put in EAX.
      >>> +; In the second asm, $0 and $2 must not be put in EDX.
      >>> +; This is kind of hard to test thoroughly, but the things above
      >>> should continue
      >>> +; to pass, I think.
      >>> +; ModuleID = ''
      >>> +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16- 
      >>> i32:32:32-
      >>> i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-
      >>> f80:128:128"
      >>> +target triple = "i386-apple-darwin8"
      >>> + at x = common global i32 0		;  [#uses=1]
      >>> +
      >>> +define i32 @aci(i32* %pw) nounwind {
      >>> +entry:
      >>> +	%0 = load i32* @x, align 4		;  [#uses=1]
      >>> +	%asmtmp = tail call { i32, i32 } asm "movl $0, %eax\0A\090:\0A
      >>> \09test %eax, %eax\0A\09je 1f\0A\09movl %eax, $2\0A\09incl $2\0A
      >>> \09lock\0A\09cmpxchgl $2, $0\0A\09jne 0b\0A\091:",
      >>> "=*m,=&{ax},=&r,*m,~{dirflag},~{fpsr},~{flags},~{memory},~{cc}"(i32*
      >>> %pw, i32* %pw) nounwind		; <{ i32, i32 }> [#uses=0]
      >>> +	%asmtmp2 = tail call { i32, i32 } asm "movl $0, %edx\0A\090:\0A
      >>> \09test %edx, %edx\0A\09je 1f\0A\09movl %edx, $2\0A\09incl $2\0A
      >>> \09lock\0A\09cmpxchgl $2, $0\0A\09jne 0b\0A\091:",
      >>> "=*m,=&{dx},=&r,*m,~{dirflag},~{fpsr},~{flags},~{memory},~{cc}"(i32*
      >>> %pw, i32* %pw) nounwind		; <{ i32, i32 }> [#uses=1]
      >>> +	%asmresult3 = extractvalue { i32, i32 } %asmtmp2, 0		; 
      >>> [#uses=1]
      >>> +	%1 = add i32 %asmresult3, %0		;  [#uses=1]
      >>> +	ret i32 %1
      >>> +}
      >>>
      >>>
      >>> _______________________________________________
      >>> llvm-commits mailing list
      >>> llvm-commits at cs.uiuc.edu
      >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      >>
      >> _______________________________________________
      >> llvm-commits mailing list
      >> llvm-commits at cs.uiuc.edu
      >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From gohman at apple.com  Thu Sep 18 13:10:59 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Thu, 18 Sep 2008 11:10:59 -0700
      Subject: [llvm-commits] [PATCH] align constant pool loads
      	using	preferred alignment
      In-Reply-To: <48D11945.2080105@rapidmind.com>
      References: <48CFF5CD.5050102@rapidmind.com>
      	<28743604-0ED1-4A68-B934-9BFFE496C1FB@apple.com>
      	<48D11945.2080105@rapidmind.com>
      Message-ID: 
      
      
      On Sep 17, 2008, at 7:50 AM, Paul Redmond wrote:
      
      > Dan Gohman wrote:
      >> I was surprised to see that ConstantPoolSDNode's alignment
      >> argument is a log2 value, but that apparently what that
      >> code is expecting.
      >>
      > I made that mistake at first. Perhaps getAlignment can be renamed
      > getAlignmentShift?
      
      That seems reasonable. I'm thinking I might see if it's not
      too much work to change the code to use a regular alignment
      value instead though :-).
      
      >
      >> It looks like the code in ScheduleDAGEmit.cpp that handles
      >> the alignment==0 case for ConstantPoolSDNode is no longer
      >> needed. Does that seem right to you?
      >>
      > Yes, I believe that can be removed.
      
      Cool, thanks.
      
      Dan
      
      
      
      From gohman at apple.com  Thu Sep 18 13:22:32 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Thu, 18 Sep 2008 18:22:32 -0000
      Subject: [llvm-commits] [llvm] r56310 -
      	/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp
      Message-ID: <200809181822.m8IIMW2k002887@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Thu Sep 18 13:22:32 2008
      New Revision: 56310
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56310&view=rev
      Log:
      Don't consider instructions with implicit physical register
      defs to be necessarily live.
      
      Modified:
          llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp
      
      Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp?rev=56310&r1=56309&r2=56310&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp (original)
      +++ llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Thu Sep 18 13:22:32 2008
      @@ -64,7 +64,8 @@
                 const MachineOperand &MO = MI->getOperand(i);
                 if (MO.isRegister() && MO.isDef()) {
                   unsigned Reg = MO.getReg();
      -            if (TargetRegisterInfo::isPhysicalRegister(Reg) ||
      +            if ((!MO.isImplicit() &&
      +                 TargetRegisterInfo::isPhysicalRegister(Reg)) ||
                       !MRI.use_empty(Reg)) {
                     // This def has a use. Don't delete the instruction!
                     AllDefsDead = false;
      
      
      
      
      From gohman at apple.com  Thu Sep 18 13:26:43 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Thu, 18 Sep 2008 18:26:43 -0000
      Subject: [llvm-commits] [llvm] r56311 -
      	/llvm/trunk/lib/Target/X86/X86FastISel.cpp
      Message-ID: <200809181826.m8IIQhup003044@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Thu Sep 18 13:26:43 2008
      New Revision: 56311
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56311&view=rev
      Log:
      Simplify this code. The FastISel class has its own TD member.
      
      Modified:
          llvm/trunk/lib/Target/X86/X86FastISel.cpp
      
      Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=56311&r1=56310&r2=56311&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Thu Sep 18 13:26:43 2008
      @@ -629,7 +629,7 @@
       bool X86FastISel::X86SelectSelect(Instruction *I) {
         const Type *Ty = I->getType();
         if (isa(Ty))
      -    Ty = TLI.getTargetData()->getIntPtrType();
      +    Ty = TD.getIntPtrType();
       
         unsigned Opc = 0;
         const TargetRegisterClass *RC = NULL;
      @@ -1063,11 +1063,10 @@
         }
         
         // MachineConstantPool wants an explicit alignment.
      -  unsigned Align =
      -               TM.getTargetData()->getPreferredTypeAlignmentShift(C->getType());
      +  unsigned Align = TD.getPreferredTypeAlignmentShift(C->getType());
         if (Align == 0) {
           // Alignment of vector types.  FIXME!
      -    Align = TM.getTargetData()->getABITypeSize(C->getType());
      +    Align = TD.getABITypeSize(C->getType());
           Align = Log2_64(Align);
         }
         
      
      
      
      
      From evan.cheng at apple.com  Thu Sep 18 17:38:48 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Thu, 18 Sep 2008 22:38:48 -0000
      Subject: [llvm-commits] [llvm] r56314 -
      	/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      Message-ID: <200809182238.m8IMcmAx013966@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Thu Sep 18 17:38:47 2008
      New Revision: 56314
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56314&view=rev
      Log:
      Somehow RegAllocLinearScan is keeping two pointers to MachineRegisterInfo.
      
      Modified:
          llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      
      Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56314&r1=56313&r2=56314&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
      +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Thu Sep 18 17:38:47 2008
      @@ -71,7 +71,6 @@
           const TargetMachine* tm_;
           const TargetRegisterInfo* tri_;
           const TargetInstrInfo* tii_;
      -    MachineRegisterInfo *reginfo_;
           BitVector allocatableRegs_;
           LiveIntervals* li_;
           LiveStacks* ls_;
      @@ -255,7 +254,7 @@
         if (Reg == SrcReg)
           return Reg;
       
      -  const TargetRegisterClass *RC = reginfo_->getRegClass(cur.reg);
      +  const TargetRegisterClass *RC = mri_->getRegClass(cur.reg);
         if (!RC->contains(SrcReg))
           return Reg;
       
      @@ -278,7 +277,6 @@
         tm_ = &fn.getTarget();
         tri_ = tm_->getRegisterInfo();
         tii_ = tm_->getInstrInfo();
      -  reginfo_ = &mf_->getRegInfo();
         allocatableRegs_ = tri_->getAllocatableSet(fn);
         li_ = &getAnalysis();
         ls_ = &getAnalysis();
      @@ -326,7 +324,7 @@
       
         for (LiveIntervals::iterator i = li_->begin(), e = li_->end(); i != e; ++i) {
           if (TargetRegisterInfo::isPhysicalRegister(i->second->reg)) {
      -      reginfo_->setPhysRegUsed(i->second->reg);
      +      mri_->setPhysRegUsed(i->second->reg);
             fixed_.push_back(std::make_pair(i->second, i->second->begin()));
           } else
             unhandled_.push(i->second);
      @@ -660,7 +658,7 @@
         DOUT << "\tallocating current interval: ";
       
         // This is an implicitly defined live interval, just assign any register.
      -  const TargetRegisterClass *RC = reginfo_->getRegClass(cur->reg);
      +  const TargetRegisterClass *RC = mri_->getRegClass(cur->reg);
         if (cur->empty()) {
           unsigned physReg = cur->preference;
           if (!physReg)
      @@ -706,7 +704,7 @@
           unsigned Reg = i->first->reg;
           assert(TargetRegisterInfo::isVirtualRegister(Reg) &&
                  "Can only allocate virtual registers!");
      -    const TargetRegisterClass *RegRC = reginfo_->getRegClass(Reg);
      +    const TargetRegisterClass *RegRC = mri_->getRegClass(Reg);
           // If this is not in a related reg class to the register we're allocating, 
           // don't check it.
           if (RelatedRegClasses.getLeaderValue(RegRC) == RCLeader &&
      @@ -1009,7 +1007,7 @@
         SmallVector inactiveCounts;
         unsigned MaxInactiveCount = 0;
         
      -  const TargetRegisterClass *RC = reginfo_->getRegClass(cur->reg);
      +  const TargetRegisterClass *RC = mri_->getRegClass(cur->reg);
         const TargetRegisterClass *RCLeader = RelatedRegClasses.getLeaderValue(RC);
        
         for (IntervalPtrs::iterator i = inactive_.begin(), e = inactive_.end();
      @@ -1020,7 +1018,7 @@
       
           // If this is not in a related reg class to the register we're allocating, 
           // don't check it.
      -    const TargetRegisterClass *RegRC = reginfo_->getRegClass(reg);
      +    const TargetRegisterClass *RegRC = mri_->getRegClass(reg);
           if (RelatedRegClasses.getLeaderValue(RegRC) == RCLeader) {
             reg = vrm_->getPhys(reg);
             if (inactiveCounts.size() <= reg)
      
      
      
      
      From dpatel at apple.com  Thu Sep 18 17:50:42 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Thu, 18 Sep 2008 22:50:42 -0000
      Subject: [llvm-commits] [llvm] r56315 -
      	/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
      Message-ID: <200809182250.m8IMogft014356@zion.cs.uiuc.edu>
      
      Author: dpatel
      Date: Thu Sep 18 17:50:42 2008
      New Revision: 56315
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56315&view=rev
      Log:
      Try to place hoisted instructions befoe icmp instruction.
      
      Modified:
          llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
      
      Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=56315&r1=56314&r2=56315&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
      +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Thu Sep 18 17:50:42 2008
      @@ -1046,8 +1046,29 @@
             return false;
         }
       
      -  // If we get here, we can hoist the instruction. 
      -  BIParent->getInstList().splice(BI, BB1->getInstList(), I);
      +  // If we get here, we can hoist the instruction. Try to place it
      +  // before the icmp instruction preceeding the conditional branch.
      +  BasicBlock::iterator InsertPos = BI;
      +  if (InsertPos != BIParent->begin()) 
      +    --InsertPos;
      +  if (InsertPos == BrCond) {
      +    SmallPtrSet BB1Insns;
      +    for(BasicBlock::iterator BB1I = BB1->begin(), BB1E = BB1->end(); 
      +        BB1I != BB1E; ++BB1I) 
      +      BB1Insns.insert(BB1I);
      +    for(Value::use_iterator UI = BrCond->use_begin(), UE = BrCond->use_end();
      +        UI != UE; ++UI) {
      +      Instruction *Use = cast(*UI);
      +      if (BB1Insns.count(Use)) {
      +        // If BrCond uses the instruction that place it just before
      +        // branch instruction.
      +        InsertPos = BI;
      +        break;
      +      }
      +    }
      +  } else
      +    InsertPos = BI;
      +  BIParent->getInstList().splice(InsertPos, BB1->getInstList(), I);
       
         // Create a select whose true value is the speculatively executed value and
         // false value is the previously determined FalseV.
      
      
      
      
      From isanbard at gmail.com  Thu Sep 18 18:04:19 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Thu, 18 Sep 2008 23:04:19 -0000
      Subject: [llvm-commits] [llvm] r56316 -
      	/llvm/trunk/lib/Transforms/Scalar/DCE.cpp
      Message-ID: <200809182304.m8IN4JI7015042@zion.cs.uiuc.edu>
      
      Author: void
      Date: Thu Sep 18 18:04:18 2008
      New Revision: 56316
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56316&view=rev
      Log:
      Decrementing the iterator here could be wrong if the worklist is empty after the "erase".
      Thanks to Ji Young Park for the patch!
      
      Modified:
          llvm/trunk/lib/Transforms/Scalar/DCE.cpp
      
      Modified: llvm/trunk/lib/Transforms/Scalar/DCE.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/DCE.cpp?rev=56316&r1=56315&r2=56316&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/Scalar/DCE.cpp (original)
      +++ llvm/trunk/lib/Transforms/Scalar/DCE.cpp Thu Sep 18 18:04:18 2008
      @@ -111,11 +111,12 @@
       
             // Remove the instruction from the worklist if it still exists in it.
             for (std::vector::iterator WI = WorkList.begin();
      -           WI != WorkList.end(); ++WI)
      -        if (*WI == I) {
      +           WI != WorkList.end(); ) {
      +        if (*WI == I)
                 WI = WorkList.erase(WI);
      -          --WI;
      -        }
      +        else
      +          ++WI;
      +      }
       
             MadeChange = true;
             ++DCEEliminated;
      
      
      
      
      From gohman at apple.com  Thu Sep 18 18:23:44 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Thu, 18 Sep 2008 23:23:44 -0000
      Subject: [llvm-commits] [llvm] r56320 -
      	/llvm/trunk/lib/Target/X86/X86FastISel.cpp
      Message-ID: <200809182323.m8INNiKF015755@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Thu Sep 18 18:23:44 2008
      New Revision: 56320
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56320&view=rev
      Log:
      Address-mode folding for X86FastISel. It's pretty basic, but it
      catches a fair number of common cases. Note that this currently
      causes Fast-ISel to leave behind lots of dead instructions.
      Those will be dealt with in subsequent commits.
      
      Modified:
          llvm/trunk/lib/Target/X86/X86FastISel.cpp
      
      Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=56320&r1=56319&r2=56320&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Thu Sep 18 18:23:44 2008
      @@ -27,6 +27,7 @@
       #include "llvm/CodeGen/MachineFrameInfo.h"
       #include "llvm/CodeGen/MachineRegisterInfo.h"
       #include "llvm/Support/CallSite.h"
      +#include "llvm/Support/GetElementPtrTypeIterator.h"
       
       using namespace llvm;
       
      @@ -330,31 +331,107 @@
       /// X86SelectAddress - Attempt to fill in an address from the given value.
       ///
       bool X86FastISel::X86SelectAddress(Value *V, X86AddressMode &AM) {
      -  // Look past bitcasts.
      -  if (const BitCastInst *BC = dyn_cast(V))
      -    return X86SelectAddress(BC->getOperand(0), AM);
      +  User *U;
      +  unsigned Opcode = Instruction::UserOp1;
      +  if (Instruction *I = dyn_cast(V)) {
      +    Opcode = I->getOpcode();
      +    U = I;
      +  } else if (ConstantExpr *C = dyn_cast(V)) {
      +    Opcode = C->getOpcode();
      +    U = C;
      +  }
       
      -  if (const AllocaInst *A = dyn_cast(V)) {
      +  switch (Opcode) {
      +  default: break;
      +  case Instruction::BitCast:
      +    // Look past bitcasts.
      +    return X86SelectAddress(U->getOperand(0), AM);
      +
      +  case Instruction::IntToPtr:
      +    // Look past no-op inttoptrs.
      +    if (TLI.getValueType(U->getOperand(0)->getType()) == TLI.getPointerTy())
      +      return X86SelectAddress(U->getOperand(0), AM);
      +
      +  case Instruction::PtrToInt:
      +    // Look past no-op ptrtoints.
      +    if (TLI.getValueType(U->getType()) == TLI.getPointerTy())
      +      return X86SelectAddress(U->getOperand(0), AM);
      +
      +  case Instruction::Alloca: {
      +    // Do static allocas.
      +    const AllocaInst *A = cast(V);
           DenseMap::iterator SI = StaticAllocaMap.find(A);
           if (SI == StaticAllocaMap.end())
             return false;
           AM.BaseType = X86AddressMode::FrameIndexBase;
           AM.Base.FrameIndex = SI->second;
      -  } else if (unsigned Ptr = lookUpRegForValue(V)) {
      -    AM.Base.Reg = Ptr;
      -  } else {
      -    // Handle constant address.
      -    // FIXME: If load type is something we can't handle, this can result in
      -    // a dead stub load instruction.
      -    if (isa(V) && X86SelectConstAddr(V, AM.Base.Reg)) {
      -      if (AM.Base.Reg == 0)
      -        AM.GV = cast(V);
      -    } else {
      -      AM.Base.Reg = getRegForValue(V);
      -      if (AM.Base.Reg == 0)
      -        // Unhandled operand. Halt "fast" selection and bail.
      -        return false;
      +    return true;
      +  }
      +
      +  case Instruction::Add: {
      +    // Adds of constants are common and easy enough.
      +    if (ConstantInt *CI = dyn_cast(U->getOperand(1))) {
      +      AM.Disp += CI->getZExtValue();
      +      return X86SelectAddress(U->getOperand(0), AM);
           }
      +    break;
      +  }
      +
      +  case Instruction::GetElementPtr: {
      +    // Pattern-match simple GEPs.
      +    uint64_t Disp = AM.Disp;
      +    unsigned IndexReg = AM.IndexReg;
      +    unsigned Scale = AM.Scale;
      +    gep_type_iterator GTI = gep_type_begin(U);
      +    // Look at all but the last index. Constants can be folded,
      +    // and one dynamic index can be handled, if the scale is supported.
      +    for (User::op_iterator i = U->op_begin() + 1, e = U->op_end();
      +         i != e; ++i, ++GTI) {
      +      Value *Op = *i;
      +      if (const StructType *STy = dyn_cast(*GTI)) {
      +        const StructLayout *SL = TD.getStructLayout(STy);
      +        unsigned Idx = cast(Op)->getZExtValue();
      +        Disp += SL->getElementOffset(Idx);
      +      } else {
      +        uint64_t S = TD.getABITypeSize(GTI.getIndexedType());
      +        if (ConstantInt *CI = dyn_cast(Op)) {
      +          // Constant-offset addressing.
      +          Disp += CI->getZExtValue() * S;
      +        } else if (IndexReg == 0 &&
      +                   (S == 1 || S == 2 || S == 4 || S == 8)) {
      +          // Scaled-index addressing.
      +          Scale = S;
      +          IndexReg = getRegForValue(Op);
      +          if (IndexReg == 0)
      +            return false;
      +        } else
      +          // Unsupported.
      +          goto unsupported_gep;
      +      }
      +    }
      +    // Ok, the GEP indices were covered by constant-offset and scaled-index
      +    // addressing. Update the address state and move on to examining the base.
      +    AM.IndexReg = IndexReg;
      +    AM.Scale = Scale;
      +    AM.Disp = Disp;
      +    return X86SelectAddress(U->getOperand(0), AM);
      +  unsupported_gep:
      +    // Ok, the GEP indices weren't all covered.
      +    break;
      +  }
      +  }
      +
      +  // Handle constant address.
      +  // FIXME: If load type is something we can't handle, this can result in
      +  // a dead stub load instruction.
      +  if (isa(V) && X86SelectConstAddr(V, AM.Base.Reg)) {
      +    if (AM.Base.Reg == 0)
      +      AM.GV = cast(V);
      +  } else {
      +    AM.Base.Reg = getRegForValue(V);
      +    if (AM.Base.Reg == 0)
      +      // Unhandled operand. Halt "fast" selection and bail.
      +      return false;
         }
       
         return true;
      
      
      
      
      From dpatel at apple.com  Thu Sep 18 18:45:14 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Thu, 18 Sep 2008 23:45:14 -0000
      Subject: [llvm-commits] [llvm] r56321 - in /llvm/trunk:
       lib/Transforms/Scalar/LoopIndexSplit.cpp
       test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll
      Message-ID: <200809182345.m8INjENA016704@zion.cs.uiuc.edu>
      
      Author: dpatel
      Date: Thu Sep 18 18:45:14 2008
      New Revision: 56321
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56321&view=rev
      Log:
      splitLoop does not handle split condition EQ.
      Fixes PR 2805
      
      Added:
          llvm/trunk/test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll
      Modified:
          llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
      
      Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=56321&r1=56320&r2=56321&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
      +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Thu Sep 18 18:45:14 2008
      @@ -1430,6 +1430,12 @@
         if (!safeSplitCondition(SD))
           return false;
       
      +  // If split condition EQ is not handled.
      +  if (ICmpInst *ICMP = dyn_cast(SD.SplitCondition)) {
      +    if (ICMP->getPredicate() == ICmpInst::ICMP_EQ)
      +      return false;
      +  }
      +  
         BasicBlock *SplitCondBlock = SD.SplitCondition->getParent();
         
         // Unable to handle triangle loops at the moment.
      
      Added: llvm/trunk/test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll?rev=56321&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll (added)
      +++ llvm/trunk/test/Transforms/LoopIndexSplit/2008-09-20-Crash.ll Thu Sep 18 18:45:14 2008
      @@ -0,0 +1,38 @@
      +; RUN: llvm-as < %s | opt -loop-index-split -disable-output
      +; PR 2805
      + at g_330 = common global i32 0		;  [#uses=1]
      +
      +define i32 @func_45(i32 %p_47) nounwind {
      +entry:
      +	br label %bb
      +
      +bb:		; preds = %bb3, %entry
      +	%p_47_addr.0.reg2mem.0 = phi i32 [ 0, %entry ], [ %2, %bb3 ]		;  [#uses=2]
      +	%0 = icmp eq i32 %p_47_addr.0.reg2mem.0, 0		;  [#uses=1]
      +	br i1 %0, label %bb2, label %bb1
      +
      +bb1:		; preds = %bb
      +	%1 = tail call i32 (...)* @func_70( i32 1 ) nounwind		;  [#uses=0]
      +	br label %bb3
      +
      +bb2:		; preds = %bb
      +	store i32 1, i32* @g_330, align 4
      +	br label %bb3
      +
      +bb3:		; preds = %bb2, %bb1
      +	%2 = add i32 %p_47_addr.0.reg2mem.0, 1		;  [#uses=3]
      +	%3 = icmp ult i32 %2, 22		;  [#uses=1]
      +	br i1 %3, label %bb, label %bb6
      +
      +bb6:		; preds = %bb3
      +	%.lcssa = phi i32 [ %2, %bb3 ]		;  [#uses=1]
      +	%4 = tail call i32 (...)* @func_95( i32 %.lcssa ) nounwind		;  [#uses=1]
      +	%5 = tail call i32 (...)* @func_56( i32 %4 ) nounwind		;  [#uses=0]
      +	ret i32 undef
      +}
      +
      +declare i32 @func_70(...)
      +
      +declare i32 @func_95(...)
      +
      +declare i32 @func_56(...)
      
      
      
      
      From isanbard at gmail.com  Thu Sep 18 19:07:06 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 00:07:06 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56322 - in /llvm-gcc-4.2/trunk: ./
       gcc/ gcc/config/ gcc/config/arm/ gcc/config/i386/ gcc/cp/ gcc/objc/
      Message-ID: <200809190007.m8J078Gr017386@zion.cs.uiuc.edu>
      
      Author: void
      Date: Thu Sep 18 19:07:05 2008
      New Revision: 56322
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56322&view=rev
      Log:
      Sync to Apple's GCC r150950. This brings in:
      
      - Many more blocks fixes.
      - Generate objc2 metadata with 'l' label.
      - Fix objc warnings.
      
      Modified:
          llvm-gcc-4.2/trunk/ChangeLog.apple
          llvm-gcc-4.2/trunk/build_gcc
          llvm-gcc-4.2/trunk/gcc/ChangeLog.apple
          llvm-gcc-4.2/trunk/gcc/c-common.c
          llvm-gcc-4.2/trunk/gcc/c-common.h
          llvm-gcc-4.2/trunk/gcc/c-decl.c
          llvm-gcc-4.2/trunk/gcc/c-gimplify.c
          llvm-gcc-4.2/trunk/gcc/c-parser.c
          llvm-gcc-4.2/trunk/gcc/c-pragma.c
          llvm-gcc-4.2/trunk/gcc/c-typeck.c
          llvm-gcc-4.2/trunk/gcc/calls.c
          llvm-gcc-4.2/trunk/gcc/config/arm/arm.c
          llvm-gcc-4.2/trunk/gcc/config/darwin-c.c
          llvm-gcc-4.2/trunk/gcc/config/darwin-sections.def
          llvm-gcc-4.2/trunk/gcc/config/darwin.c
          llvm-gcc-4.2/trunk/gcc/config/darwin.h
          llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
          llvm-gcc-4.2/trunk/gcc/config/i386/xmmintrin.h
          llvm-gcc-4.2/trunk/gcc/cp/ChangeLog
          llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple
          llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h
          llvm-gcc-4.2/trunk/gcc/cp/decl.c
          llvm-gcc-4.2/trunk/gcc/cp/decl2.c
          llvm-gcc-4.2/trunk/gcc/cp/lex.c
          llvm-gcc-4.2/trunk/gcc/cp/parser.c
          llvm-gcc-4.2/trunk/gcc/cp/pt.c
          llvm-gcc-4.2/trunk/gcc/cp/rtti.c
          llvm-gcc-4.2/trunk/gcc/cp/search.c
          llvm-gcc-4.2/trunk/gcc/cp/semantics.c
          llvm-gcc-4.2/trunk/gcc/cp/typeck.c
          llvm-gcc-4.2/trunk/gcc/dwarf2out.c
          llvm-gcc-4.2/trunk/gcc/dwarf2out.h
          llvm-gcc-4.2/trunk/gcc/final.c
          llvm-gcc-4.2/trunk/gcc/function.c
          llvm-gcc-4.2/trunk/gcc/global.c
          llvm-gcc-4.2/trunk/gcc/libgcc2.c
          llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple
          llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
          llvm-gcc-4.2/trunk/gcc/reload1.c
          llvm-gcc-4.2/trunk/gcc/rtl.h
          llvm-gcc-4.2/trunk/gcc/sched-deps.c
          llvm-gcc-4.2/trunk/gcc/tree-ssa-alias.c
          llvm-gcc-4.2/trunk/gcc/tree.h
          llvm-gcc-4.2/trunk/gcc/version.c
      
      Modified: llvm-gcc-4.2/trunk/ChangeLog.apple
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/ChangeLog.apple?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/ChangeLog.apple (original)
      +++ llvm-gcc-4.2/trunk/ChangeLog.apple Thu Sep 18 19:07:05 2008
      @@ -1,3 +1,15 @@
      +2008-09-05  Josh Conner  
      +
      +	Radar 6177003
      +	* build_gcc: Add support for LANGUAGES.
      +
      +2008-09-03  Josh Conner  
      +
      +	Radar 6156214
      +	* build_gcc (ARM_CONFIGFLAGS): On ARM, Configure
      +	--with-build-sysroot instead of --with-sysroot.
      +	* build_libgcc (ARM_CONFIGFLAGS): Likewise.
      +
       2008-08-25  Josh Conner  
       
       	Radar 6162685
      
      Modified: llvm-gcc-4.2/trunk/build_gcc
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/build_gcc (original)
      +++ llvm-gcc-4.2/trunk/build_gcc Thu Sep 18 19:07:05 2008
      @@ -29,6 +29,10 @@
           bootstrap=--disable-bootstrap
       fi
       
      +# Language front-ends to build. This also affects
      +# whether the C++ driver and driver-driver are installed
      +LANGUAGES=${LANGUAGES-c,objc,c++,obj-c++}
      +
       # The B&I build srcript (~rc/bin/buildit) accepts an '-othercflags'
       # command-line flag, and captures the argument to that flag in
       # $RC_NONARCH_CFLAGS (and mysteriously prepends '-pipe' thereto).
      @@ -108,7 +112,7 @@
       # For ARM, grab all system files from an SDK.
       ARM_SYSROOT="/Developer/SDKs/Extra"
       ARM_LIBSTDCXX_VERSION=4.2.1
      -ARM_CONFIGFLAGS="--with-sysroot=\"$ARM_SYSROOT\" \
      +ARM_CONFIGFLAGS="--with-build-sysroot=\"$ARM_SYSROOT\" \
                        --with-gxx-include-dir=\${prefix}/include/c++/$ARM_LIBSTDCXX_VERSION"
       # APPLE LOCAL end ARM ARM_CONFIGFLAGS
       
      @@ -157,7 +161,7 @@
       CONFIGFLAGS="$CHECKING_FLAGS \
         --prefix=$DEST_ROOT \
         --mandir=\${prefix}/share/man \
      -  --enable-languages=c,objc,c++,obj-c++ \
      +  --enable-languages=$LANGUAGES \
         --program-prefix=llvm- \
         --program-transform-name=/^[cg][^.-]*$/s/$/-$MAJ_VERS/ \
         --with-gxx-include-dir=/usr/include/c++/$LIBSTDCXX_VERSION \
      @@ -187,6 +191,17 @@
       # The $LOCAL_MAKEFLAGS variable can be used to override $MAKEFLAGS.
       MAKEFLAGS=${LOCAL_MAKEFLAGS-"-j $SYSCTL"}
       
      +BUILD_CXX=0
      +for lang in `echo $LANGUAGES | sed 's/,/ /g'`; do
      +  if [ $lang = "c++" -o $lang = "obj-c++" ]; then
      +    BUILD_CXX=1
      +    break
      +  fi
      +done
      +
      +# Unset this, because GCC uses this variable in its makefiles
      +unset LANGUAGES
      +
       # LLVM LOCAL begin
       if [ "$ENABLE_LLVM" == true ]; then
         # Build llvm-gcc in 'dylib mode'.
      @@ -438,6 +453,7 @@
       done
       # APPLE LOCAL end native compiler support
       
      +if [ $BUILD_CXX -eq 1 ]; then
       for t in $TARGETS ; do
           if [ "$t" == 'arm' ] ; then
               cp -p $ARM_SYSROOT/usr/lib/libstdc++.6.dylib \
      @@ -451,6 +467,7 @@
       # LLVM LOCAL
       #  strip -x -c .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/libstdc++.dylib || exit 1
       done
      +fi
       
       # include
       HEADERPATH=$DEST_ROOT/include/gcc/darwin/$MAJ_VERS
      @@ -478,18 +495,25 @@
       
       # Add extra man page symlinks for 'c++' and for arch-specific names.
       MDIR=$DEST_DIR$DEST_ROOT/share/man/man1
      -# LLVM LOCAL
      -ln -f $MDIR/llvm-g++.1 $MDIR/llvm-c++.1 || exit 1
      +if [ $BUILD_CXX -eq 1 ]; then
      +  # LLVM LOCAL
      +  ln -f $MDIR/llvm-g++.1 $MDIR/llvm-c++.1 || exit 1
      +fi
       for t in $TARGETS ; do
         # LLVM LOCAL begin
         ln -f $MDIR/llvm-gcc.1 $MDIR/$t-apple-darwin$DARWIN_VERS-llvm-gcc.1 \
             || exit 1
      -  ln -f $MDIR/llvm-g++.1 $MDIR/$t-apple-darwin$DARWIN_VERS-llvm-g++.1 \
      -      || exit 1
      +  if [ $BUILD_CXX -eq 1 ]; then
      +    ln -f $MDIR/llvm-g++.1 $MDIR/$t-apple-darwin$DARWIN_VERS-llvm-g++.1 \
      +        || exit 1
      +  fi
         # LLVM LOCAL end
       done
      +
      +# LLVM LOCAL begin
       # Compress manpages
       gzip -f $MDIR/*
      +# LLVM LOCAL end
       
       # Build driver-driver using fully-named drivers
       for h in $HOSTS ; do
      @@ -504,29 +528,31 @@
               -L$DIR/obj-$h-$BUILD/libiberty/                                        \
       	-o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-llvm-gcc-$MAJ_VERS || exit 1
       
      -    $h-apple-darwin$DARWIN_VERS-gcc \
      -	$ORIG_SRC_DIR/driverdriver.c                               \
      -	-DPDN="\"-apple-darwin$DARWIN_VERS-llvm-g++-$MAJ_VERS\""                                    \
      -	-DIL="\"$DEST_ROOT/bin/\"" -I  $ORIG_SRC_DIR/include                   \
      -	-I  $ORIG_SRC_DIR/gcc -I  $ORIG_SRC_DIR/gcc/config                     \
      -	-liberty -L$DIR/dst-$BUILD-$h$DEST_ROOT/lib/                           \
      -	-L$DIR/dst-$BUILD-$h$DEST_ROOT/$h-apple-darwin$DARWIN_VERS/lib/                    \
      -        -L$DIR/obj-$h-$BUILD/libiberty/                                        \
      -	-o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-llvm-g++-$MAJ_VERS || exit 1
      +    if [ $BUILD_CXX -eq 1 ]; then
      +        $h-apple-darwin$DARWIN_VERS-gcc \
      +	    $ORIG_SRC_DIR/driverdriver.c                               \
      +	    -DPDN="\"-apple-darwin$DARWIN_VERS-llvm-g++-$MAJ_VERS\""                                    \
      +	    -DIL="\"$DEST_ROOT/bin/\"" -I  $ORIG_SRC_DIR/include                   \
      +	    -I  $ORIG_SRC_DIR/gcc -I  $ORIG_SRC_DIR/gcc/config                     \
      +	    -liberty -L$DIR/dst-$BUILD-$h$DEST_ROOT/lib/                           \
      +	    -L$DIR/dst-$BUILD-$h$DEST_ROOT/$h-apple-darwin$DARWIN_VERS/lib/                    \
      +            -L$DIR/obj-$h-$BUILD/libiberty/                                        \
      +	    -o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-llvm-g++-$MAJ_VERS || exit 1
      +    fi
           # LLVM LOCAL end
       done
       
       # LLVM LOCAL begin
       lipo -output $DEST_DIR/$DEST_ROOT/bin/llvm-gcc-$MAJ_VERS -create \
         $DEST_DIR/$DEST_ROOT/bin/tmp-*-llvm-gcc-$MAJ_VERS || exit 1
      -
      -lipo -output $DEST_DIR/$DEST_ROOT/bin/llvm-g++-$MAJ_VERS -create \
      -  $DEST_DIR/$DEST_ROOT/bin/tmp-*-llvm-g++-$MAJ_VERS || exit 1
      -
      -ln -f $DEST_DIR/$DEST_ROOT/bin/llvm-g++-$MAJ_VERS $DEST_DIR/$DEST_ROOT/bin/llvm-c++-$MAJ_VERS || exit 1
      -
       rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-llvm-gcc-$MAJ_VERS || exit 1
      -rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-llvm-g++-$MAJ_VERS || exit 1
      +
      +if [ $BUILD_CXX -eq 1 ]; then
      +    lipo -output $DEST_DIR/$DEST_ROOT/bin/llvm-g++-$MAJ_VERS -create \
      +        $DEST_DIR/$DEST_ROOT/bin/tmp-*-llvm-g++-$MAJ_VERS || exit 1
      +    ln -f $DEST_DIR/$DEST_ROOT/bin/llvm-g++-$MAJ_VERS $DEST_DIR/$DEST_ROOT/bin/llvm-c++-$MAJ_VERS || exit 1
      +    rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-llvm-g++-$MAJ_VERS || exit 1
      +fi
       # LLVM LOCAL end
       
       ########################################
      
      Modified: llvm-gcc-4.2/trunk/gcc/ChangeLog.apple
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ChangeLog.apple?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/ChangeLog.apple (original)
      +++ llvm-gcc-4.2/trunk/gcc/ChangeLog.apple Thu Sep 18 19:07:05 2008
      @@ -1,7 +1,95 @@
      -2008-09-05  Josh Conner 
      -	* llvm-convert.cpp (EmitBuiltinDwarfCFA): ARG_POINTER_CFA_OFFSET
      -	should take a function decl.
      -	* config/arm/arm.c: Remove unnecessary declaration of is_jump_table.
      +2008-09-17  Josh Conner  
      +
      +	Radar 6204451
      +	* global.c (global_alloc): Remove code that ignores conflicts
      +	on single-set tied pseudos.
      +
      +2008-09-16  Fariborz Jahanian 
      +
      +        Radar 6214617
      +	* c-common: New flag BLOCK_HAS_CXX_OBJ replaces BLOCK_NO_COPY.
      +	(BlockImportsCxxObjects): New field replaces BlockHasByrefVar.
      +	* c-parser.c (build_block_struct_type): Remove setting of
      +	BLOCK_NO_COPY flag.
      +
      +2008-09-16  Fariborz Jahanian 
      +
      +	Radar 6217257
      +	* c-common.c (handle_blocks_attribute): Diagnose 
      +	vla __block declarations.
      +
      +2008-09-13  Josh Conner  
      +
      +	Radar 6214296
      +	* config/darwin.h (STARTFILE_SPEC): Don't add crt3.o to the link line
      +	if -miphoneos-version-min was specified.
      +
      +2008-09-12  Fariborz Jahanian 
      +
      +        Radar 6212507
      +	* config/darwin-c.c (objc_check_format_cfstring): Check for
      +	argument number value.
      +
      +2008-09-12  Fariborz Jahanian 
      +
      +        Radar 6212722 (tweak)
      +	* c-decl.c (build_block_ref_decl): Use array_to_pointer_conversion
      +	and function_to_pointer_conversion.
      +	* c-typeck.c (array_to_pointer_conversion, function_to_pointer_conversion):
      +	Made them global.
      +	* c-common.h (array_to_pointer_conversion, function_to_pointer_conversion):
      +	Declare.
      +	
      +2008-09-11  Fariborz Jahanian 
      +
      +        Radar 6212722
      +	* c-decl.c (build_block_ref_decl): Add support for array referenced
      +	as copied in objects in blocks.
      +
      +2008-09-11  Caroline Tice  
      +
      +        Radar 6066486
      +        * dwarf2out.c  (add_sibling_attribute):  Move leaf-test return
      +	statement to below the code that potentially removes the
      +	DW_AT_MIPS_linkage_name attribute.
      +
      +2008-09-10  Caroline Tice  
      +
      +        Radar 6193416
      +        * dwarf2out.c  (gen_subprogram_die):  Force Blocks helper
      +	functions to be children of the comp_unit die.
      +
      +2008-09-09  Fariborz Jahanian 
      +
      +        Radar 6169580
      +	* c-commmon.c (build_block_helper_name): Fix bug in
      +	block helper function name mangling.
      +
      +2008-09-08 Fariborz Jahanian 
      +
      +        Radar 6064186
      +	* config/darwin.c (machopic_select_section): Message refs
      +	symbol prefixes changed now. Accomodate it.
      +	* config/darwin-sections.def: __objc_msgrefs is now typed
      +	as "coalesced".
      +
      +2008-09-08  Stuart Hastings  
      +
      +	Radar 6070085
      +	* gcc/tree-ssa-alias.c (group_aliases): Continue merging alias
      +          sets until the changes converge.
      +
      +2008-09-03  Fariborz Jahanian 
      +
      +        Radar 6185344
      +	* c-typeck.c (c_finish_return): Don't do block specific
      +	stuff when block has a return type.
      +	* c-common.h (block_sema_info): block_has_return_type is
      +	a new field.
      +	* c-parser.c (c_parser_direct_declarator): Terminate type
      +	parsing for block return types.
      +	(c_parser_block_literal_expr): Added support to parse and
      +	handle explicit return type for blocks.
       
       2008-08-28  Stuart Hastings  
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/c-common.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/c-common.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/c-common.c Thu Sep 18 19:07:05 2008
      @@ -6118,6 +6118,8 @@
                                  int ARG_UNUSED (flags), bool *no_add_attrs)
       {
         tree arg_ident;
      +  /* APPLE LOCAL radar 6217257 */
      +  tree type;
         *no_add_attrs = true;
         if (!(*node) || TREE_CODE (*node) != VAR_DECL)
           {
      @@ -6134,7 +6136,19 @@
                      name);
             return NULL_TREE;
           }
      -
      +  /* APPLE LOCAL begin radar 6217257 */
      +  type = TREE_TYPE (*node);
      +  if (TREE_CODE (type) == ERROR_MARK)
      +    return NULL_TREE;
      +  if (TREE_CODE (type) == ARRAY_TYPE)
      +  {
      +    if (!TYPE_SIZE (type) || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
      +    {
      +      error ("__block not allowed on a variable length array declaration");
      +      return NULL_TREE;
      +    }
      +  }
      +  /* APPLE LOCAL end radar 6217257 */
         COPYABLE_BYREF_LOCAL_VAR (*node) = 1;
         COPYABLE_BYREF_LOCAL_NONPOD (*node) = block_requires_copying (*node);
         return NULL_TREE;
      @@ -6288,7 +6302,10 @@
         else
           {
             tree outer_decl = current_function_decl;
      -      while (outer_decl && DECL_CONTEXT (outer_decl))
      +      /* APPLE LOCAL begin radar 6169580 */
      +      while (outer_decl &&
      +             DECL_CONTEXT (outer_decl) && TREE_CODE (DECL_CONTEXT (outer_decl)) == FUNCTION_DECL)
      +      /* APPLE LOCAL end radar 6169580 */
               outer_decl = DECL_CONTEXT (outer_decl);
             buf = (char *)alloca (IDENTIFIER_LENGTH (DECL_NAME (outer_decl)) + 32); 
             sprintf (buf, "__%s_block_invoke_%d", 
      
      Modified: llvm-gcc-4.2/trunk/gcc/c-common.h
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.h?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/c-common.h (original)
      +++ llvm-gcc-4.2/trunk/gcc/c-common.h Thu Sep 18 19:07:05 2008
      @@ -1123,7 +1123,8 @@
       enum {
            BLOCK_NEEDS_FREE =        (1 << 24),
            BLOCK_HAS_COPY_DISPOSE =  (1 << 25),
      -     BLOCK_NO_COPY =           (1 << 26), /* interim byref: no copies allowed */
      +     /* APPLE LOCAL radar 6214617 */
      +     BLOCK_HAS_CXX_OBJ =       (1 << 26), 
            BLOCK_IS_GC =             (1 << 27),
            /* APPLE LOCAL radar 5822844 */
            BLOCK_IS_GLOBAL = 	       (1 << 28)
      @@ -1146,9 +1147,10 @@
         bool hasPrototype;
         bool isVariadic;
         bool BlockHasCopyDispose;
      -  bool BlockHasByrefVar;
      -  /* APPLE LOCAL radar 5822844 */
      -  bool block_is_complete; /* When true, we are done analyzing block. */
      +  /* APPLE LOCAL radar 6214617 */
      +  bool BlockImportsCxxObjects;
      +  /* APPLE LOCAL radar 6185344 */
      +  bool block_has_return_type; /* When true, block has a declared return type. */
       
         /* the_scope - This is the scope for the block itself, which
            contains arguments etc.  Use only for C.  */
      @@ -1180,7 +1182,7 @@
       extern void build_block_internal_types (void);
       extern void push_to_top_level (void);
       extern void pop_from_top_level (void);
      -extern void start_block_helper_function (tree func_decl, bool add_result_decl);
      +extern void start_block_helper_function (tree func_decl);
       extern void block_build_prologue (struct block_sema_info *block_impl);
       extern tree c_finish_return (tree);
       extern tree copy_in_object (tree);
      @@ -1212,6 +1214,10 @@
       
       /* APPLE LOCAL radar 6040305 - blocks */
       extern tree build_indirect_object_id_exp (tree);
      +/* APPLE LOCAL begin radar 6212722 */
      +extern tree array_to_pointer_conversion (tree);
      +extern tree function_to_pointer_conversion (tree);
      +/* APPLE LOCAL end radar 6212722 */
       
       /* APPLE LOCAL radar 6160536 */
       extern tree build_block_helper_name (int);
      
      Modified: llvm-gcc-4.2/trunk/gcc/c-decl.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-decl.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/c-decl.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/c-decl.c Thu Sep 18 19:07:05 2008
      @@ -3740,7 +3740,7 @@
                                                 NULL_TREE));
         /* function header synthesis. */
         push_function_context ();
      -  start_block_helper_function (block_byref_id_object_copy, true);
      +  start_block_helper_function (block_byref_id_object_copy);
         store_parm_decls_from (arg_info);
       
         /* Body of the function. */
      @@ -3805,7 +3805,7 @@
                                      NULL_TREE);
         /* function header synthesis. */
         push_function_context ();
      -  start_block_helper_function (block_byref_id_object_dispose, true);
      +  start_block_helper_function (block_byref_id_object_dispose);
         store_parm_decls_from (arg_info);
       
         /* Body of the function. */
      @@ -8003,6 +8003,8 @@
       {
         struct c_scope *scope = current_scope;
         tree ref_decl;
      +  /* APPLE LOCAL radar 6212722 */
      +  tree type, exp;
         /* APPLE LOCAL begin radar 5932809 - copyable byref blocks (C++ ch) */
         /* 'decl' was previously declared as __byref. Simply, copy the value
            embedded in the above variable. */
      @@ -8049,10 +8051,20 @@
           /* APPLE LOCAL end radar 5988451 (C++ ch) */
         }
         /* APPLE LOCAL end radar 5932809 - copyable byref blocks (C++ ch) */
      -
      +  /* APPLE LOCAL begin radar 6212722 */
      +  exp = decl;
      +  type = TREE_TYPE (exp);
      +  if (TREE_CODE (type) == ARRAY_TYPE) {
      +    exp = array_to_pointer_conversion (decl);
      +    type = TREE_TYPE (exp);
      +  }
      +  else if (TREE_CODE (type) == FUNCTION_TYPE) {
      +    exp = function_to_pointer_conversion (exp);
      +    type = TREE_TYPE (exp);
      +  }
         ref_decl = build_decl (VAR_DECL, name,
      -                         build_qualified_type (TREE_TYPE (decl),
      -                                               TYPE_QUAL_CONST));
      +                         build_qualified_type (type, TYPE_QUAL_CONST));
      +  /* APPLE LOCAL end radar 6212722 */
         /* APPLE LOCAL begin radars 6144664 & 6145471  */
         DECL_SOURCE_LOCATION (ref_decl) = DECL_SOURCE_LOCATION 
                                                      (cur_block->helper_func_decl);
      @@ -8075,7 +8087,8 @@
         cur_block->block_ref_decl_list =
           tree_cons (NULL_TREE, ref_decl, cur_block->block_ref_decl_list);
         cur_block->block_original_ref_decl_list =
      -    tree_cons (NULL_TREE, decl, cur_block->block_original_ref_decl_list);
      +    /* APPLE LOCAL radar 6212722 */
      +    tree_cons (NULL_TREE, exp, cur_block->block_original_ref_decl_list);
         return ref_decl;
       }
       
      @@ -8277,10 +8290,11 @@
        It has removed all the fuss in the start_function().
        */
       void
      -start_block_helper_function (tree decl1, bool add_result_decl)
      +start_block_helper_function (tree decl1)
       {
         struct c_label_context_se *nstack_se;
         struct c_label_context_vm *nstack_vm;
      +  tree restype, resdecl;
       
         current_function_returns_value = 0;  /* Assume, until we see it does.  */
         current_function_returns_null = 0;
      @@ -8337,14 +8351,12 @@
         push_scope ();
         declare_parm_level ();
       
      -  if (add_result_decl)
      -  {
      -    tree restype = TREE_TYPE (TREE_TYPE (current_function_decl));
      -    tree resdecl = build_decl (RESULT_DECL, NULL_TREE, restype);
      -    DECL_ARTIFICIAL (resdecl) = 1;
      -    DECL_IGNORED_P (resdecl) = 1;
      -    DECL_RESULT (current_function_decl) = resdecl;
      -  }
      +  restype = TREE_TYPE (TREE_TYPE (current_function_decl));
      +  resdecl = build_decl (RESULT_DECL, NULL_TREE, restype);
      +  DECL_ARTIFICIAL (resdecl) = 1;
      +  DECL_IGNORED_P (resdecl) = 1;
      +  DECL_RESULT (current_function_decl) = resdecl;
      +
         start_fname_decls ();
       }
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/c-gimplify.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-gimplify.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/c-gimplify.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/c-gimplify.c Thu Sep 18 19:07:05 2008
      @@ -204,15 +204,6 @@
       
         switch (code)
           {
      -    /* APPLE LOCAL begin radar 5732232 - blocks */
      -    case RETURN_EXPR:
      -        if (current_function_decl && 
      -            BLOCK_HELPER_FUNC (current_function_decl)) {
      -          tree ret_expr = TREE_OPERAND (*expr_p, 0);
      -          TREE_OPERAND (*expr_p, 0) = c_finish_return (ret_expr);
      -        }
      -        return GS_UNHANDLED;
      -    /* APPLE LOCAL end radar 5732232 - blocks */
           case DECL_EXPR:
             /* This is handled mostly by gimplify.c, but we have to deal with
       	 not warning about int x = x; as it is a GCC extension to turn off
      
      Modified: llvm-gcc-4.2/trunk/gcc/c-parser.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-parser.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/c-parser.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/c-parser.c Thu Sep 18 19:07:05 2008
      @@ -95,6 +95,9 @@
       #define IDENTIFIER 2
       /* APPLE LOCAL end CW asm blocks (in 4.2 g) */
       
      +/* APPLE LOCAL radar 6185344 */
      +static int parsing_block_return_type;
      +
       /* The reserved keyword table.  */
       struct resword
       {
      @@ -2611,7 +2614,8 @@
         /* Either we are at the end of an abstract declarator, or we have
            parentheses.  */
       
      -  if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
      +  /* APPLE LOCAL radar 6185344 */
      +  if (!parsing_block_return_type && c_parser_next_token_is (parser, CPP_OPEN_PAREN))
           {
             tree attrs;
             struct c_declarator *inner;
      @@ -9465,7 +9469,6 @@
           if (COPYABLE_BYREF_LOCAL_VAR (TREE_VALUE (chain)))
             {
       	block_impl->BlockHasCopyDispose = TRUE;
      -	block_impl->BlockHasByrefVar = TRUE;
       	break;
             }
       
      @@ -9521,7 +9524,7 @@
       /**
        build_block_struct_initlist - builds the initializer list:
        { &_NSConcreteStackBlock or &_NSConcreteGlobalBlock // isa,
      - BLOCK_NO_COPY | BLOCK_HAS_COPY_DISPOSE | BLOCK_IS_GLOBAL // flags,
      +   BLOCK_HAS_COPY_DISPOSE | BLOCK_IS_GLOBAL // flags,
        sizeof(struct block_1),
        helper_1 },
        copy_helper_block_1, // only if block BLOCK_HAS_COPY_DISPOSE
      @@ -9546,10 +9549,6 @@
              we have destroy_helper_block/copy_helper_block helper
              routines. */
           flags |= BLOCK_HAS_COPY_DISPOSE;
      -  /* Set BLOCK_NO_COPY flag only if we are using the old byref,
      -     indirect reference byref variables. */
      -  if (block_impl->block_byref_decl_list && !block_impl->BlockHasByrefVar)
      -    flags |= BLOCK_NO_COPY;
       
         fields = TYPE_FIELDS (TREE_TYPE (invoke_impl_ptr_type));
       
      @@ -9663,7 +9662,7 @@
        3) build the temporary initialization:
        struct block_1 I = {
        { &_NSConcreteStackBlock or &_NSConcreteGlobalBlock // isa,
      -   BLOCK_NO_COPY | BLOCK_HAS_COPY_DISPOSE | BLOCK_IS_GLOBAL // flags,
      +   BLOCK_HAS_COPY_DISPOSE | BLOCK_IS_GLOBAL // flags,
          sizeof(struct block_1),
          helper_1 },
        copy_helper_block_1, // only if block BLOCK_HAS_COPY_DISPOSE
      @@ -9752,7 +9751,7 @@
                                                 NULL_TREE));
         /* function header synthesis. */
         push_function_context ();
      -  start_block_helper_function (cur_block->copy_helper_func_decl, true);
      +  start_block_helper_function (cur_block->copy_helper_func_decl);
         store_parm_decls_from (arg_info);
       
         /* Body of the function. */
      @@ -9852,7 +9851,7 @@
       
         /* function header synthesis. */
         push_function_context ();
      -  start_block_helper_function (cur_block->destroy_helper_func_decl, true);
      +  start_block_helper_function (cur_block->destroy_helper_func_decl);
         store_parm_decls_from (arg_info);
       
         /* Body of the function. */
      @@ -9943,13 +9942,30 @@
         struct block_sema_info *block_impl;
         tree tmp;
         bool open_paren_seen = false;
      -  tree restype, resdecl;
      +  tree restype;
         tree fnbody, typelist;
         tree helper_function_type;
         tree block;
      +  /* APPLE LOCAL radar 6185344 */
      +  tree declared_block_return_type = NULL_TREE;
       
         c_parser_consume_token (parser); /* eat '^' */
       
      +  /* APPLE LOCAL begin radar 6185344 */
      +  /* Parse user declared return type. */
      +  if (!c_parser_next_token_is (parser, CPP_OPEN_PAREN) &&
      +      !c_parser_next_token_is (parser, CPP_OPEN_BRACE))
      +  {
      +    struct c_type_name *type;
      +    parsing_block_return_type = 1;
      +    type = c_parser_type_name (parser);
      +    parsing_block_return_type = 0;
      +    if (type) {
      +      declared_block_return_type = groktypename (type);
      +    }
      +  }
      +  /* APPLE LOCAL end radar 6185344 */
      +
         /* Parse the optional argument list */
         if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
           {
      @@ -9976,7 +9992,13 @@
         block = begin_block ();
       
         cur_block->arg_info = NULL;
      -  cur_block->return_type = NULL_TREE;
      +  if (declared_block_return_type)
      +    {
      +      cur_block->return_type = TYPE_MAIN_VARIANT (declared_block_return_type);
      +      cur_block->block_has_return_type = true;
      +  }
      +  else
      +    cur_block->return_type = NULL_TREE;
       
         if (args)
           {
      @@ -10013,20 +10035,24 @@
         cur_block->arg_info->types = tree_cons (NULL_TREE, ptr_type_node, arg_type);
         cur_block->arg_info->parms = self_arg;
       
      -  /* Build the declaration of the helper function (we do not know its result
      -     type yet, so assume it is 'void'). Treat this as a nested function and use
      -     nested function infrastructure for its generation. */
      -
      -  ftype = build_function_type (void_type_node, cur_block->arg_info->types);
      +  /* APPLE LOCAL begin radar 6185344 */
      +  /* Build the declaration of the helper function (if we do not know its result
      +     type yet, assume it is 'void'. If user provided it, use it).
      +     Treat this as a nested function and use nested function infrastructure for
      +     its generation. */
      +
      +  ftype = build_function_type ((!cur_block->block_has_return_type
      +                                ? void_type_node : cur_block->return_type),
      +                               cur_block->arg_info->types);
      +  /* APPLE LOCAL end radar 6185344 */
         /* APPLE LOCAL radar 6160536 */
         block_helper_function_decl = build_helper_func_decl (build_block_helper_name (unique_count),
                                                                ftype);
         DECL_CONTEXT (block_helper_function_decl) = current_function_decl;
      -  BLOCK_HELPER_FUNC (block_helper_function_decl) = 1;
         cur_block->helper_func_decl = block_helper_function_decl;
       
         push_function_context ();
      -  start_block_helper_function (cur_block->helper_func_decl, false);
      +  start_block_helper_function (cur_block->helper_func_decl);
         /* Set block's scope to the scope of the helper function's main body.
            This is primarily used when nested blocks are declared. */
         /* FIXME: Name of objc_get_current_scope needs to get changed. */
      @@ -10049,34 +10075,45 @@
           c_cont_label = save_c_cont_label;
           c_break_label = save_c_break_label;
         }
      -  else {
      -    struct c_expr expr;
      -    stmt = c_begin_compound_stmt (true);
      -    error ("blocks require { }");
      -    expr = c_parser_cast_expression (parser, NULL);
      -    body = expr.value;
      -    if (body == error_mark_node)
      -      return clean_and_exit (block);
      -
      -    if (cur_block->return_type) {
      -      error ("return not allowed in block expression literal");
      -      return clean_and_exit (block);
      -    }
      -    else if (!open_paren_seen) {
      -      error ("argument list is required for block expression literals");
      -      return clean_and_exit (block);
      -    }
      -    else {
      -      add_stmt (body);
      -      cur_block->return_type = TREE_TYPE (body);
      +  else
      +    {
      +      struct c_expr expr;
      +      stmt = c_begin_compound_stmt (true);
      +      error ("blocks require { }");
      +      expr = c_parser_cast_expression (parser, NULL);
      +      body = expr.value;
      +      if (body == error_mark_node)
      +	return clean_and_exit (block);
      +
      +      if (cur_block->return_type)
      +	{
      +	  error ("return not allowed in block expression literal");
      +	  return clean_and_exit (block);
      +	}
      +      else if (!open_paren_seen)
      +	{
      +	  error ("argument list is required for block expression literals");
      +	  return clean_and_exit (block);
      +	}
      +      else
      +	{
      +	  tree restype = TYPE_MAIN_VARIANT (TREE_TYPE (body));
      +
      +	  add_stmt (body);
      +	  TREE_TYPE (current_function_decl)
      +	    = build_function_type (restype,
      +				   TYPE_ARG_TYPES (TREE_TYPE (current_function_decl)));
      +	  TREE_TYPE (DECL_RESULT (current_function_decl)) = restype;
      +	  relayout_decl (DECL_RESULT (current_function_decl));
      +	  cur_block->return_type = restype;
      +	}
           }
      -  }
       
         cur_block->block_arg_ptr_type =
           build_pointer_type (build_block_struct_type (cur_block));
       
         restype = !cur_block->return_type ? void_type_node
      -                                      : cur_block->return_type;
      +				    : cur_block->return_type;
         if (restype == error_mark_node)
           return clean_and_exit (block);
       
      @@ -10084,11 +10121,9 @@
         TREE_TYPE (self_arg) = cur_block->block_arg_ptr_type;
         DECL_ARG_TYPE (self_arg) = cur_block->block_arg_ptr_type;
       
      -  /* Now that we know helper's result type, fix its result variable decl. */
      -  resdecl = build_decl (RESULT_DECL, NULL_TREE, restype);
      -  DECL_ARTIFICIAL (resdecl) = 1;
      -  DECL_IGNORED_P (resdecl) = 1;
      -  DECL_RESULT (current_function_decl) = resdecl;
      +  /* The DECL_RESULT should already have the correct type by now.  */
      +  gcc_assert (TREE_TYPE (DECL_RESULT (current_function_decl))
      +	      == restype);
       
         cur_block->block_body = stmt;
         block_build_prologue (cur_block);
      @@ -10111,11 +10146,6 @@
                               typelist);
         helper_function_type = build_function_type (TREE_TYPE (ftype), typelist);
         TREE_TYPE (cur_block->helper_func_decl) = helper_function_type;
      -  /* Let tree builder know that we are done analyzing block's return type so it
      -     does not do it twice (and produce bad return expression tree). This case is 
      -     for global blocks as finish_function () for them builds AST for the entire
      -     body of the function. */
      -  cur_block->block_is_complete = true;
         finish_function ();
         pop_function_context ();
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/c-pragma.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-pragma.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/c-pragma.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/c-pragma.c Thu Sep 18 19:07:05 2008
      @@ -249,7 +249,6 @@
           }
       }
       #endif  /* HANDLE_PRAGMA_PACK */
      -
       /* LLVM LOCAL begin */
       #endif /* ENABLE_LLVM && !TARGET_OVERRIDE_PRAGMA_PACK_HANDLER */
       /* LLVM LOCAL end */
      
      Modified: llvm-gcc-4.2/trunk/gcc/c-typeck.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-typeck.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/c-typeck.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/c-typeck.c Thu Sep 18 19:07:05 2008
      @@ -1518,7 +1518,8 @@
       }
       
       /* Convert the array expression EXP to a pointer.  */
      -static tree
      +/* APPLE LOCAL radar 6212722 */
      +tree
       array_to_pointer_conversion (tree exp)
       {
         tree orig_exp = exp;
      @@ -1559,7 +1560,8 @@
       }
       
       /* Convert the function expression EXP to a pointer.  */
      -static tree
      +/* APPLE LOCAL radar 6212722 */
      +tree
       function_to_pointer_conversion (tree exp)
       {
         tree orig_exp = exp;
      @@ -7715,16 +7717,25 @@
            the block from it. */
         if (cur_block->return_type == NULL_TREE)
           {
      +      tree restype;
             if (retval)
      -	cur_block->return_type = TYPE_MAIN_VARIANT (TREE_TYPE (retval));
      +	{
      +	  restype = TYPE_MAIN_VARIANT (TREE_TYPE (retval));
      +          TREE_TYPE (current_function_decl)
      +	    = build_function_type (restype,
      +                                   TYPE_ARG_TYPES (TREE_TYPE (current_function_decl)));
      +          TREE_TYPE (DECL_RESULT (current_function_decl)) = restype;
      +          relayout_decl (DECL_RESULT (current_function_decl));
      +	}
             else
      -	cur_block->return_type = void_type_node;
      -      return retval;
      +	restype = void_type_node;
      +      
      +      cur_block->return_type = restype;
           }
       
      -  /* Otherwise, verify that this result type matches the previous one.  We are
      -     pickier with blocks than for normal functions because this is a new
      -     feature and we set the rules. */
      +  /* Verify that this result type matches the previous one.  We are
      +     pickier with blocks than for normal functions because this is a
      +     new feature and we set the rules. */
         if (TREE_CODE (cur_block->return_type) == VOID_TYPE)
           {
             if (retval)
      @@ -7738,7 +7749,7 @@
         if (!retval)
           {
             error ("non-void block should return a value");
      -      return retval;
      +      return error_mark_node;
           }
       
         /* We have a non-void block with an expression, continue checking.  */
      @@ -7763,14 +7774,13 @@
         tree valtype, ret_stmt;
         bool no_warning = false;
         
      -  /* APPLE LOCAL radar 5822844 */
      -  if (cur_block && !cur_block->block_is_complete) {
      -    /* APPLE LOCAL radar 6083129 - byref escapes (C++ cp) */
      -    release_all_local_byrefs_at_return ();
      -    retval = c_finish_block_return_stmt (retval);
      -    ret_stmt = build_stmt (RETURN_EXPR, retval);
      -    return add_stmt (ret_stmt);
      -  }
      +  /* APPLE LOCAL radar 5822844 - radar 6185344 */
      +  if (cur_block && !cur_block->block_has_return_type)
      +    {
      +      retval = c_finish_block_return_stmt (retval);
      +      if (retval == error_mark_node)
      +	return NULL_TREE;
      +    }
         
         valtype = TREE_TYPE (TREE_TYPE (current_function_decl));
         /* APPLE LOCAL end radar 5732232 - blocks */
      @@ -7842,17 +7852,18 @@
       	    case ADDR_EXPR:
       	      inner = TREE_OPERAND (inner, 0);
       
      -               /* LLVM LOCAL begin */
      +              /* LLVM LOCAL begin */
         	      while (REFERENCE_CLASS_P (inner)
      - 	             && TREE_CODE (inner) != INDIRECT_REF) {
      + 	             && TREE_CODE (inner) != INDIRECT_REF)
      +                {
       #ifdef ENABLE_LLVM
      -                 if (TREE_CODE (inner) == ARRAY_REF
      -                     && (TREE_CODE (TREE_TYPE (TREE_OPERAND (inner, 0)))
      -                         != ARRAY_TYPE))
      -                   break;    /* Ignore pointer base of array ref extension. */
      +                  if (TREE_CODE (inner) == ARRAY_REF
      +                      && (TREE_CODE (TREE_TYPE (TREE_OPERAND (inner, 0)))
      +                          != ARRAY_TYPE))
      +                    break;    /* Ignore pointer base of array ref extension. */
       #endif
      -                 inner = TREE_OPERAND (inner, 0);
      -               }
      +                  inner = TREE_OPERAND (inner, 0);
      +                }
                     /* LLVM LOCAL end */
        
       	      if (DECL_P (inner)
      @@ -7879,12 +7890,6 @@
       
             retval = build2 (MODIFY_EXPR, TREE_TYPE (res), res, t);
           }
      -  /* APPLE LOCAL begin radar 5732232 - blocks */
      -  /* When this routine is called for the helper function, during gimplification,
      -     we are only interested in the actual return expression. */
      -  if (current_function_decl && BLOCK_HELPER_FUNC (current_function_decl))
      -    return retval;
      -  /* APPLE LOCAL end radar 5732232 - blocks */
         /* APPLE LOCAL radar 6083129 - byref escapes (C++ cp) */
         release_all_local_byrefs_at_return ();
         ret_stmt = build_stmt (RETURN_EXPR, retval);
      
      Modified: llvm-gcc-4.2/trunk/gcc/calls.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/calls.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/calls.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/calls.c Thu Sep 18 19:07:05 2008
      @@ -249,6 +249,8 @@
         rtx rounded_stack_size_rtx = GEN_INT (rounded_stack_size);
         rtx call_insn;
         int already_popped = 0;
      +  /* APPLE LOCAL async unwind info 5976588 */
      +  rtx dwarf = NULL_RTX;
         HOST_WIDE_INT n_popped = RETURN_POPS_ARGS (fndecl, funtype, stack_size);
       #if defined (HAVE_call) && defined (HAVE_call_value)
         rtx struct_value_size_rtx;
      @@ -368,6 +370,18 @@
         /* Find the call we just emitted.  */
         call_insn = last_call_insn ();
       
      +  /* APPLE LOCAL begin async unwind info 5976588 */
      +  if (already_popped && n_popped
      +      && flag_asynchronous_unwind_tables && ACCUMULATE_OUTGOING_ARGS)
      +    {
      +      dwarf = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
      +			   plus_constant (stack_pointer_rtx, n_popped));
      +      REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
      +						 REG_NOTES (call_insn));
      +      RTX_FRAME_RELATED_P (call_insn) = 1;
      +    }
      +  /* APPLE LOCAL end async unwind info 5976588 */
      +
         /* Mark memory as used for "pure" function call.  */
         if (ecf_flags & ECF_PURE)
           call_fusage
      @@ -480,7 +494,20 @@
            ??? It will be worthwhile to enable combine_stack_adjustments even for
            such machines.  */
         else if (n_popped)
      -    anti_adjust_stack (GEN_INT (n_popped));
      +    /* APPLE LOCAL begin async unwind info 5976588 */
      +    {
      +      anti_adjust_stack (GEN_INT (n_popped));
      +      if (dwarf)
      +	{
      +	  rtx last_insn = get_last_nonnote_insn ();
      +	  dwarf = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
      +			       plus_constant (stack_pointer_rtx, -n_popped));
      +	  REG_NOTES (last_insn) = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, dwarf,
      +						     REG_NOTES (last_insn));
      +	  RTX_FRAME_RELATED_P (last_insn) = 1;
      +	}
      +    }
      +    /* APPLE LOCAL end async unwind info 5976588 */
       }
       
       /* Determine if the function identified by NAME and FNDECL is one with
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Thu Sep 18 19:07:05 2008
      @@ -84,6 +84,7 @@
       static const char *fp_const_from_val (REAL_VALUE_TYPE *);
       static arm_cc get_arm_condition_code (rtx);
       static HOST_WIDE_INT int_log2 (HOST_WIDE_INT);
      +static rtx is_jump_table (rtx);
       static const char *output_multi_immediate (rtx *, const char *, const char *,
       					   int, HOST_WIDE_INT);
       static const char *shift_op (rtx, HOST_WIDE_INT *);
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/darwin-c.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin-c.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/darwin-c.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/darwin-c.c Thu Sep 18 19:07:05 2008
      @@ -1150,6 +1150,13 @@
                                   bool *no_add_attrs)
       {
         unsigned HOST_WIDE_INT i;
      +  /* APPLE LOCAL begin 6212507 */
      +  if (format_num < 1)
      +    {
      +      error ("argument number of CFString format cannot be less than one");
      +      return false;
      +    }
      +  /* APPLE LOCAL end 6212507 */
         for (i = 1; i != format_num; i++)
           {
             if (argument == 0)
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/darwin-sections.def
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin-sections.def?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/darwin-sections.def (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/darwin-sections.def Thu Sep 18 19:07:05 2008
      @@ -94,8 +94,10 @@
       	     ".section " EH_FRAME_SECTION_NAME ",__eh_frame"
       	     EH_FRAME_SECTION_ATTR, 0)
       /* APPLE LOCAL begin ObjC new abi - radar 4792158 */
      +/* APPLE LOCAL begin radar 5575115 */
       DEF_SECTION (objc_v2_message_refs_section, 0,
      -	     ".section __DATA, __objc_msgrefs, regular, no_dead_strip", 1)
      +	     ".section __DATA, __objc_msgrefs, coalesced", 0)
      +/* APPLE LOCAL end radar 5575115 */
       DEF_SECTION (objc_v2_classrefs_section, 0, 
                    ".section __DATA, __objc_classrefs, regular, no_dead_strip", 1)
       DEF_SECTION (objc_v2_classlist_section, 0,
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Thu Sep 18 19:07:05 2008
      @@ -1427,7 +1427,10 @@
       	   DECL_NAME (exp) &&
       	   TREE_CODE (DECL_NAME (exp)) == IDENTIFIER_NODE &&
       	   IDENTIFIER_POINTER (DECL_NAME (exp)) &&
      -	   !strncmp (IDENTIFIER_POINTER (DECL_NAME (exp)), "_OBJC_", 6))
      +           /* APPLE LOCAL begin radar 5575115 */
      +	   (!strncmp (IDENTIFIER_POINTER (DECL_NAME (exp)), "_OBJC_", 6)
      +            || !strncmp (IDENTIFIER_POINTER (DECL_NAME (exp)), "l_objc_", 7)))
      +           /* APPLE LOCAL end radar 5575115 */
           {
             const char *name = IDENTIFIER_POINTER (DECL_NAME (exp));
             /* APPLE LOCAL begin radar 4792158 */
      @@ -1502,7 +1505,8 @@
                   return darwin_sections[objc_v2_classrefs_section];
                 else if (!strncmp (name, "_OBJC_CLASSLIST_SUP_REFS_", 25))
                   return darwin_sections[objc_v2_super_classrefs_section];
      -          else if (!strncmp (name, "_OBJC_MESSAGE_REF", 17))
      +          /* APPLE LOCAL radar 5575115 */
      +          else if (!strncmp (name, "l_objc_msgSend_", 15))
                   return darwin_sections[objc_v2_message_refs_section];
                 else if (!strncmp (name, "_OBJC_LABEL_CLASS_", 18))
                   return darwin_sections[objc_v2_classlist_section];
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Thu Sep 18 19:07:05 2008
      @@ -310,6 +310,8 @@
       	if (flag_mkernel)						\
       	  flag_no_builtin = 1;						\
       	/* APPLE LOCAL end 5731065 */					\
      +	/* APPLE LOCAL xmmintrin.h for kernel 4123064 */					\
      +	flag_hosted = 0;						\
             }									\
         } while (0)
       
      @@ -535,7 +537,9 @@
                                       %{!object:%{preload:-lcrt0.o}		    \
                                         %{!preload: %(darwin_crt1)		    \
       					      %(darwin_crt2)}}}}}}	    \
      -  %{shared-libgcc:%:version-compare(< 10.5 mmacosx-version-min= crt3.o%s)}"
      +  %{shared-libgcc:							    \
      +    %{!miphoneos-version-min=*:						    \
      +      %:version-compare(< 10.5 mmacosx-version-min= crt3.o%s)}}"
       /* APPLE LOCAL end mainline  */
       
       /* The native Darwin linker doesn't necessarily place files in the order
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/i386/i386.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.c Thu Sep 18 19:07:05 2008
      @@ -6285,13 +6285,7 @@
             /* If not an i386, mov & pop is faster than "leave".  */
             else if (TARGET_USE_LEAVE || optimize_size
       	       || !cfun->machine->use_fast_prologue_epilogue)
      -	/* APPLE LOCAL begin async unwind info 5949350 */
      -	{
      -	  rtx insn = emit_insn (TARGET_64BIT ? gen_leave_rex64 () : gen_leave ());
      -	  if (flag_asynchronous_unwind_tables)
      -	    RTX_FRAME_RELATED_P (insn) = 1;
      -	}
      -	/* APPLE LOCAL end async unwind info 5949350 */
      +	emit_insn (TARGET_64BIT ? gen_leave_rex64 () : gen_leave ());
             else
       	{
       	  pro_epilogue_adjust_stack (stack_pointer_rtx,
      @@ -6331,13 +6325,7 @@
       	  /* Leave results in shorter dependency chains on CPUs that are
       	     able to grok it fast.  */
       	  if (TARGET_USE_LEAVE)
      -	    /* APPLE LOCAL begin async unwind info 5949350 */
      -	    {
      -	      rtx insn = emit_insn (TARGET_64BIT ? gen_leave_rex64 () : gen_leave ());
      -	      if (flag_asynchronous_unwind_tables)
      -		RTX_FRAME_RELATED_P (insn) = 1;
      -	    }
      -	  /* APPLE LOCAL end async unwind info 5949350 */
      +	    emit_insn (TARGET_64BIT ? gen_leave_rex64 () : gen_leave ());
       	  else if (TARGET_64BIT)
       	    emit_insn (gen_popdi1 (hard_frame_pointer_rtx));
       	  else
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/i386/xmmintrin.h
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/xmmintrin.h?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/i386/xmmintrin.h (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/i386/xmmintrin.h Thu Sep 18 19:07:05 2008
      @@ -40,7 +40,11 @@
       #include 
       
       /* Get _mm_malloc () and _mm_free ().  */
      +/* APPLE LOCAL begin xmmintrin.h for kernel 4123064 */
      +#if __STDC_HOSTED__
       #include 
      +#endif
      +/* APPLE LOCAL end xmmintrin.h for kernel 4123064 */
       
       /* The Intel API is flexible enough that we must allow aliasing with other
          vector types, and their scalar components.  */
      
      Modified: llvm-gcc-4.2/trunk/gcc/cp/ChangeLog
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/ChangeLog?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/cp/ChangeLog (original)
      +++ llvm-gcc-4.2/trunk/gcc/cp/ChangeLog Thu Sep 18 19:07:05 2008
      @@ -1,3 +1,14 @@
      + # APPLE LOCAL begin mainline radar 6194879
      +2007-08-22  Jason Merrill  
      +
      +	PR c++/29365
      +	* pt.c (outermost_tinst_level): New function.
      +	* lex.c (in_main_input_context): New function.
      +	* cp-tree.h: Declare it.
      +	* decl2.c (constrain_class_visibility): Use it to avoid warning
      +	about uses of the anonymous namespace in the main input file.
      +	
      + # APPLE LOCAL end mainline radar 6194879
        # APPLE LOCAL begin for-fsf-4_4 3274130 5295549
       2007-08-03  Geoffrey Keating  
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple (original)
      +++ llvm-gcc-4.2/trunk/gcc/cp/ChangeLog.apple Thu Sep 18 19:07:05 2008
      @@ -1,3 +1,63 @@
      +2008-09-16  Fariborz Jahanian 
      +
      +        Radar 6214617
      +	* parser.c (cp_block_requires_copying): New
      +	(build_block_struct_type): Set BlockImportsCxxObjects flag.
      +	(build_block_struct_initlist): Set BLOCK_HAS_CXX_OBJ if need be.
      +	(synth_copy_helper_block_func): Call copy ctor if copied in object has one.
      +	(synth_destroy_helper_block_func): Call dtor on cxx object.
      +	
      +2008-09-12  Fariborz Jahanian 
      +
      +        Radar 6212722 (tweak)
      +	* parser.c (build_block_ref_decl): Use decay_conversion.
      +
      +2008-09-11  Fariborz Jahanian 
      +
      +        Radar 6212722
      +        * parser.c (build_block_ref_decl): Add support for arrays referenced
      +        as copied in objects in blocks.
      +	
      +2008-09-09  Fariborz Jahanian 
      +
      +        Radar 6169580
      +	* decl.c (synth_block_byref_id_object_copy_func): Pass new flag 
      +	to finish_function.
      +	(synth_block_byref_id_object_): Ditto.
      +	(finish_function): Don't pop the nested class when synthesizing
      +	block helpers.
      +	* semantics.c (finish_id_expression): Added logic to attach
      +	copied-in "this" to stand-alone field reference in a block.
      +	* parser.c (synth_copy_helper_block_func, synth_destroy_helper_block_func):
      +	Pass new flag to finish_function.
      +	(cp_parser_block_literal_expr): When block is in non-static member
      +	function, need to import "this" as a read-only copied in variable.
      +	
      +	
      +2008-09-05  Fariborz Jahanian 
      +
      +        Radar 6169527
      +	* parser.c (build_block_struct_type): Set CLASSTYPE_AS_BASE.
      +	(build_block_internal_types): Ditto.
      +	(build_block_struct_initlist): Rewritten.
      +	(build_block_literal_tmp): Rewritten.
      +	(build_block_ref_decl): Just add copied-in variable to
      +	the scope.
      +	(declare_block_prologue_local_vars): Rewritten.
      +	(declare_block_prologue_local_byref_vars): New
      +	(block_build_prologue): Call declare_block_prologue_local_byref_vars
      +	for byref variables.
      +
      +2008-09-03  Fariborz Jahanian 
      +
      +        Radar 6185344
      +	* typeck.c (check_return_expr): Added extra check
      +	for return type checking.
      +	* parser.c (cp_parser_direct_declarator): Added
      +	extra check for type used as block return type.
      +	(cp_parser_block_literal_expr): Parse and handle
      +	user provided block return type syntax.
      +
       2008-08-28  Fariborz Jahanian 
       
       	Radar 6160536
      
      Modified: llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h (original)
      +++ llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h Thu Sep 18 19:07:05 2008
      @@ -4155,9 +4155,8 @@
       extern void yyhook				(int);
       extern bool cxx_init				(void);
       extern void cxx_finish				(void);
      -/* LLVM LOCAL begin - Fix for GCC PR c++/29365 */
      +/* APPLE LOCAL mainline radar 6194879 */
       extern bool in_main_input_context		(void);
      -/* LLVM LOCAL end */
       
       /* in method.c */
       extern void init_method				(void);
      @@ -4240,9 +4239,8 @@
       extern bool reregister_specialization		(tree, tree, tree);
       extern tree fold_non_dependent_expr		(tree);
       extern bool explicit_class_specialization_p     (tree);
      -/* LLVM LOCAL begin - Fix for GCC PR c++/29365 */
      +/* APPLE LOCAL mainline radar 6194879 */
       extern tree outermost_tinst_level		(void);
      -/* LLVM LOCAL end */
       
       /* in repo.c */
       extern void init_repo				(void);
      @@ -4689,9 +4687,9 @@
       /* APPLE LOCAL radar 5741070  */
       extern tree c_return_interface_record_type (tree);
       
      -/* APPLE LOCAL begin block 6040305 (cg) */
      +/* APPLE LOCAL begin blocks 6040305 (cg) */
       extern cp_declarator* make_block_pointer_declarator (tree, cp_cv_quals,
       						     cp_declarator *);
      -/* APPLE LOCAL end block 6040305 (cg) */
      +/* APPLE LOCAL end blocks 6040305 (cg) */
       
       #endif /* ! GCC_CP_TREE_H */
      
      Modified: llvm-gcc-4.2/trunk/gcc/cp/decl.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/decl.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/cp/decl.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/cp/decl.c Thu Sep 18 19:07:05 2008
      @@ -5394,7 +5394,8 @@
         /* APPLE LOCAL end radar 6180456 */
       
         finish_compound_stmt (stmt);
      -  finish_function (0);
      +  /* APPLE LOCAL radar 6169580 */
      +  finish_function (4);
         pop_function_context ();
       }
       
      @@ -5447,7 +5448,8 @@
         add_stmt (rel_exp);
       
         finish_compound_stmt (stmt);
      -  finish_function (0);
      +  /* APPLE LOCAL radar 6169580 */
      +  finish_function (4);
         pop_function_context ();
       }
       
      @@ -11881,6 +11883,8 @@
         tree fndecl = current_function_decl;
         tree fntype, ctype = NULL_TREE;
         int inclass_inline = (flags & 2) != 0;
      +  /* APPLE LOCAL radar 6169580 */
      +  int in_blocks_helper_function = (flags & 4) != 0;
         int nested;
       
         /* When we get some parse errors, we can end up without a
      @@ -12076,7 +12080,8 @@
           maybe_end_member_template_processing ();
       
         /* Leave the scope of the class.  */
      -  if (ctype)
      +  /* APPLE LOCAL radar 6169580 */
      +  if (ctype && !in_blocks_helper_function)
           pop_nested_class ();
       
         --function_depth;
      
      Modified: llvm-gcc-4.2/trunk/gcc/cp/decl2.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/decl2.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/cp/decl2.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/cp/decl2.c Thu Sep 18 19:07:05 2008
      @@ -1893,16 +1893,14 @@
       	int subvis = type_visibility (ftype);
       
       	if (subvis == VISIBILITY_ANON)
      -          /* LLVM LOCAL begin - Fix for GCC PR c++/29365 */
      +          /* APPLE LOCAL begin mainline radar 6194879 */
       	  {
      -#ifdef ENABLE_LLVM
       	    if (!in_main_input_context ())
      -#endif
       	      warning (0, "\
       %qT has a field %qD whose type uses the anonymous namespace",
       		   type, t);
       	  }
      -	  /* LLVM LOCAL end */
      +          /* APPLE LOCAL end mainline radar 6194879 */
       	else if (IS_AGGR_TYPE (ftype)
       		 && vis < VISIBILITY_HIDDEN
       		 && subvis >= VISIBILITY_HIDDEN)
      @@ -1917,16 +1915,14 @@
             int subvis = type_visibility (TREE_TYPE (t));
       
             if (subvis == VISIBILITY_ANON)
      -        /* LLVM LOCAL begin - Fix for GCC PR c++/29365 */
      +        /* APPLE LOCAL begin mainline radar 6194879 */
               {
      -#ifdef ENABLE_LLVM
       	  if (!in_main_input_context())
      -#endif
       	    warning (0, "\
       %qT has a base %qT whose type uses the anonymous namespace",
       		 type, TREE_TYPE (t));
       	}
      -      /* LLVM LOCAL end */
      +        /* APPLE LOCAL end mainline radar 6194879 */
             else if (vis < VISIBILITY_HIDDEN
       	       && subvis >= VISIBILITY_HIDDEN)
       	warning (OPT_Wattributes, "\
      
      Modified: llvm-gcc-4.2/trunk/gcc/cp/lex.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/lex.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/cp/lex.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/cp/lex.c Thu Sep 18 19:07:05 2008
      @@ -877,8 +877,8 @@
       
         return t;
       }
      +/* APPLE LOCAL begin mainline radar 6194879 */
       
      -/* LLVM LOCAL begin - Fix for GCC PR c++/29365 */
       /* Returns true if we are currently in the main source file, or in a
          template instantiation started from the main source file.  */
       
      @@ -893,4 +893,4 @@
         else
           return strcmp (main_input_filename, input_filename) == 0;
       }
      -/* LLVM LOCAL end */
      +/* APPLE LOCAL end mainline radar 6194879 */
      
      Modified: llvm-gcc-4.2/trunk/gcc/cp/parser.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/parser.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/cp/parser.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/cp/parser.c Thu Sep 18 19:07:05 2008
      @@ -12530,6 +12530,10 @@
         return declarator;
       }
       
      +/* APPLE LOCAL begin blocks 6185344 */
      +static int parsing_block_return_type;
      +/* APPLE LOCAL end blocks 6185344 */
      +
       /* Parse a direct-declarator or direct-abstract-declarator.
       
          direct-declarator:
      @@ -12575,7 +12579,8 @@
           {
             /* Peek at the next token.  */
             token = cp_lexer_peek_token (parser->lexer);
      -      if (token->type == CPP_OPEN_PAREN)
      +      /* APPLE LOCAL radar 6185344 */
      +      if (!parsing_block_return_type && token->type == CPP_OPEN_PAREN)
       	{
       	  /* This is either a parameter-declaration-clause, or a
       	     parenthesized declarator. When we know we are parsing a
      @@ -20498,10 +20503,22 @@
       {
         if (!DECL_P (member))
           member = lookup_member (TREE_TYPE (e), member, 0, 0);
      +  if (processing_template_decl)
      +    return build3 (COMPONENT_REF, TREE_TYPE (member), e, DECL_NAME (member), NULL_TREE);
         return build_class_member_access_expr (e, member,
       					 NULL_TREE, false);
       }
       
      +/* APPLE LOCAL begin radar 6214617 */
      +static bool
      +cp_block_requires_copying (tree exp)
      +{
      +  return (block_requires_copying (exp) 
      +          || TYPE_HAS_CONSTRUCTOR (TREE_TYPE (exp)) 
      +          || TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp)));
      +}
      +/* APPLE LOCAL end radar 6214617 */
      +
       static tree block_copy_assign_decl;
       static tree block_destroy_decl;
       
      @@ -20529,10 +20546,17 @@
            helper function. If yes, set BlockHasCopyDispose to TRUE. */
         for (chain = block_impl->block_ref_decl_list; chain;
              chain = TREE_CHAIN (chain))
      -    if (block_requires_copying (TREE_VALUE (chain)))
      +    /* APPLE LOCAL begin radar 6214617 */
      +    if (cp_block_requires_copying (TREE_VALUE (chain)))
           {
      +      tree type = TREE_TYPE (TREE_VALUE (chain));
             block_impl->BlockHasCopyDispose = TRUE;
      -      break;
      +      if (TYPE_HAS_CONSTRUCTOR (type) || TYPE_NEEDS_CONSTRUCTING (type))
      +        {
      +          block_impl->BlockImportsCxxObjects = TRUE;
      +          break;
      +	}
      +    /* APPLE LOCAL end radar 6214617 */
           }
       
         /* Further check to see that we have __byref variables which require
      @@ -20542,7 +20566,6 @@
           if (COPYABLE_BYREF_LOCAL_VAR (TREE_VALUE (chain)))
             {
       	block_impl->BlockHasCopyDispose = TRUE;
      -	block_impl->BlockHasByrefVar = TRUE;
       	break;
             }
       
      @@ -20603,7 +20626,11 @@
         /* finish_struct (block_struct_type, field_decl_chain, NULL_TREE); */
         finish_builtin_struct (block_struct_type, buffer,
       			 fields, NULL_TREE);
      -
      +  /* APPLE LOCAL begin radar 6169527 */
      +  /* This type is now a full-blown c++ struct and as such, this field must
      +     be set. */
      +  CLASSTYPE_AS_BASE (block_struct_type) = block_struct_type;
      +  /* APPLE LOCAL end radar 6169527 */
         /* Zap out the name so that the back-end will give us the debugging
            information for this anonymous RECORD_TYPE.  */
         TYPE_NAME (block_struct_type) = NULL_TREE;
      @@ -20614,37 +20641,42 @@
       /**
        build_block_struct_initlist - builds the initializer list:
        { &_NSConcreteStackBlock or &_NSConcreteGlobalBlock // isa,
      - BLOCK_NO_COPY | BLOCK_HAS_COPY_DISPOSE | BLOCK_IS_GLOBAL // flags,
      - sizeof(struct block_1),
      - helper_1 },
      +   BLOCK_HAS_CXX_OBJ | BLOCK_HAS_COPY_DISPOSE | BLOCK_IS_GLOBAL // flags,
      +   sizeof(struct block_1),
      +   helper_1 
      + },
        copy_helper_block_1, // only if block BLOCK_HAS_COPY_DISPOSE
        destroy_helper_block_1, // only if block BLOCK_HAS_COPY_DISPOSE
        x,
        &y
        }
       */
      -static tree
      +/* APPLE LOCAL begin radar 6169527 */
      +/* This routine is entirely rewritten as we now have to deal with full-blown
      +   c++ classes with fields which may require construction. */
      +static VEC(constructor_elt,gc) *
       build_block_struct_initlist (tree block_struct_type,
       			     struct block_sema_info *block_impl)
       {
      -  tree initlist;
         int size;
      -  tree helper_addr, chain, fields;
      +  tree helper_addr, chain;
         unsigned flags = 0;
         static tree NSConcreteStackBlock_decl = NULL_TREE;
         static tree NSConcreteGlobalBlock_decl = NULL_TREE;
      +  tree impl_constructor;
      +  VEC(constructor_elt,gc) *impl_v = NULL;
      +  VEC(constructor_elt,gc) *v = NULL;
       
         if (block_impl->BlockHasCopyDispose)
           /* Note! setting of this flag merely indicates to the runtime that
              we have destroy_helper_block/copy_helper_block helper
              routines. */
           flags |= BLOCK_HAS_COPY_DISPOSE;
      -  /* Set BLOCK_NO_COPY flag only if we are using the old byref,
      -     indirect reference byref variables. */
      -  if (block_impl->block_byref_decl_list && !block_impl->BlockHasByrefVar)
      -    flags |= BLOCK_NO_COPY;
      -
      -  fields = TYPE_FIELDS (TREE_TYPE (invoke_impl_ptr_type));
      +  /* APPLE LOCAL begin radar 6214617 */
      +  /* Set BLOCK_HAS_CXX_OBJ if block is importing a cxx object. */
      +  if (block_impl->BlockImportsCxxObjects)
      +    flags |= BLOCK_HAS_CXX_OBJ;
      +  /* APPLE LOCAL end radar 6214617 */
       
         if (!current_function_decl)
           {
      @@ -20664,8 +20696,7 @@
       	      rest_of_decl_compilation (NSConcreteGlobalBlock_decl, 0, 0);
       	    }
       	}
      -      initlist = build_tree_list (fields,
      -				  build_fold_addr_expr (NSConcreteGlobalBlock_decl));
      +      CONSTRUCTOR_APPEND_ELT(impl_v, NULL_TREE, build_fold_addr_expr (NSConcreteGlobalBlock_decl));
             flags |= BLOCK_IS_GLOBAL;
           }
         else
      @@ -20685,60 +20716,50 @@
       	      rest_of_decl_compilation (NSConcreteStackBlock_decl, 0, 0);
       	    }
       	}
      -      initlist = build_tree_list (fields,
      -				  build_fold_addr_expr (NSConcreteStackBlock_decl));
      +      CONSTRUCTOR_APPEND_ELT(impl_v, NULL_TREE, build_fold_addr_expr (NSConcreteStackBlock_decl));
           }
      -  fields = TREE_CHAIN (fields);
       
      -  initlist = tree_cons (fields,
      -                        build_int_cst (unsigned_type_node, flags),
      -                        initlist);
      -  fields = TREE_CHAIN (fields);
      +  CONSTRUCTOR_APPEND_ELT(impl_v, NULL_TREE, build_int_cst (unsigned_type_node, flags));
      +  
         size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (block_struct_type));
      -  initlist = tree_cons (fields,
      -                        build_int_cst (unsigned_type_node, size),
      -                        initlist);
      -  fields = TREE_CHAIN (fields);
      +  CONSTRUCTOR_APPEND_ELT(impl_v, NULL_TREE, build_int_cst (unsigned_type_node, size));
      +
         helper_addr = build_fold_addr_expr (block_impl->helper_func_decl);
         /* mark_used (block_impl->helper_func_decl); */
         helper_addr = convert (ptr_type_node, helper_addr);
      -  initlist = tree_cons (fields, helper_addr, initlist);
      -  gcc_assert (invoke_impl_ptr_type);
      -  initlist = build_constructor_from_list (TREE_TYPE (invoke_impl_ptr_type),
      -                                          nreverse (initlist));
      -  fields = TYPE_FIELDS (block_struct_type);
      -  initlist = build_tree_list (fields, initlist);
      +  CONSTRUCTOR_APPEND_ELT(impl_v, NULL_TREE, helper_addr);
       
      +  impl_constructor = make_node (CONSTRUCTOR);
      +  CONSTRUCTOR_ELTS (impl_constructor) = impl_v;
      +  CONSTRUCTOR_APPEND_ELT(v, NULL_TREE, impl_constructor);
      +  
         if (block_impl->BlockHasCopyDispose)
           {
      -      fields = TREE_CHAIN (fields);
             helper_addr = build_fold_addr_expr (block_impl->copy_helper_func_decl);
             helper_addr = convert (ptr_type_node, helper_addr);
      -      initlist = tree_cons (fields, helper_addr, initlist);
      -      fields = TREE_CHAIN (fields);
      +      CONSTRUCTOR_APPEND_ELT(v, NULL_TREE, helper_addr);
             helper_addr = build_fold_addr_expr (block_impl->destroy_helper_func_decl);
             helper_addr = convert (ptr_type_node, helper_addr);
      -      initlist = tree_cons (fields, helper_addr, initlist);
      +      CONSTRUCTOR_APPEND_ELT(v, NULL_TREE, helper_addr);
           }
         for (chain = block_impl->block_original_ref_decl_list; chain;
              chain = TREE_CHAIN (chain))
           {
             tree y = TREE_VALUE (chain);
             TREE_USED (y) = 1;
      -      fields = TREE_CHAIN (fields);
      -      initlist = tree_cons (fields, copy_in_object (y), initlist);
      +      CONSTRUCTOR_APPEND_ELT(v, NULL_TREE, copy_in_object (y));
           }
         for (chain = block_impl->block_original_byref_decl_list; chain;
              chain = TREE_CHAIN (chain))
           {
             tree y = TREE_VALUE (chain);
             TREE_USED (y) = 1;
      -      fields = TREE_CHAIN (fields);
             y = build_fold_addr_expr (y);
      -      initlist = tree_cons (fields, y, initlist);
      +      CONSTRUCTOR_APPEND_ELT(v, NULL_TREE, y);
           }
      -  return initlist;
      +  return v;
       }
      +/* APPLE LOCAL end radar 6169527 */
       
       /**
        build_block_literal_tmp - This routine:
      @@ -20758,7 +20779,7 @@
        3) build the temporary initialization:
        struct block_1 I = {
        { &_NSConcreteStackBlock or &_NSConcreteGlobalBlock // isa,
      -   BLOCK_NO_COPY | BLOCK_HAS_COPY_DISPOSE | BLOCK_IS_GLOBAL // flags,
      +   BLOCK_HAS_CXX_OBJ | BLOCK_HAS_COPY_DISPOSE | BLOCK_IS_GLOBAL // flags,
          sizeof(struct block_1),
          helper_1 },
        copy_helper_block_1, // only if block BLOCK_HAS_COPY_DISPOSE
      @@ -20769,45 +20790,38 @@
       
       It return the temporary.
       */
      -
      +/* APPLE LOCAL begin radar 6169527 */
       static tree
       build_block_literal_tmp (const char *name,
       			 struct block_sema_info * block_impl)
       {
         extern tree create_tmp_var_raw (tree, const char *);
         tree block_holder_tmp_decl;
      -  tree constructor, initlist;
      -  tree exp, bind;
      +  tree constructor;
         tree block_struct_type = TREE_TYPE (block_impl->block_arg_ptr_type);
       
       
         block_holder_tmp_decl = create_tmp_var_raw (block_struct_type, name);
         /* Context will not be known until when the literal is synthesized.
            This is more so in the case of nested block literal blocks.  */
      +  maybe_push_decl (block_holder_tmp_decl);
         DECL_CONTEXT (block_holder_tmp_decl) = current_function_decl;
         DECL_ARTIFICIAL (block_holder_tmp_decl) = 1;
       
      -  initlist = build_block_struct_initlist (block_struct_type,
      -					  block_impl);
      -  initlist = nreverse (initlist);
      -  constructor = build_constructor_from_list (block_struct_type,
      -                                             initlist);
      -  TREE_CONSTANT (constructor) = 1;
      -  TREE_STATIC (constructor) = 1;
      -  TREE_READONLY (constructor) = 1;
      -  DECL_INITIAL (block_holder_tmp_decl) = constructor;
      -  exp = build_stmt (DECL_EXPR, block_holder_tmp_decl);
      -  bind = build3 (BIND_EXPR, void_type_node, block_holder_tmp_decl, exp, NULL);
      -  TREE_SIDE_EFFECTS (bind) = 1;
      -  add_stmt (bind);
      +  /* Create a CONSTRUCTOR to represent the braced-initializer.  */
      +  constructor = make_node (CONSTRUCTOR);
      +
      +  CONSTRUCTOR_ELTS (constructor) = build_block_struct_initlist (block_struct_type,
      +                                                                block_impl);
         /* Temporary representing a global block is made global static.  */
         if (global_bindings_p ()) {
           TREE_PUBLIC (block_holder_tmp_decl) = 0;
           TREE_STATIC (block_holder_tmp_decl) = 1;
      -    finish_decl (block_holder_tmp_decl, constructor, NULL_TREE);
         }
      +  cp_finish_decl (block_holder_tmp_decl, constructor, 0, 0, LOOKUP_ONLYCONVERTING);
         return block_holder_tmp_decl;
       }
      +/* APPLE LOCAL end radar 6169527 */
       
       static tree
       clean_and_exit (tree block)
      @@ -20862,7 +20876,8 @@
         stmt = begin_compound_stmt (BCS_FN_BODY);
         for (chain = block_impl->block_ref_decl_list; chain;
              chain = TREE_CHAIN (chain))
      -    if (block_requires_copying (TREE_VALUE (chain)))
      +    /* APPLE LOCAL radar 6214617 */
      +    if (cp_block_requires_copying (TREE_VALUE (chain)))
           {
             tree p = TREE_VALUE (chain);
             tree dst_block_component, src_block_component;
      @@ -20895,6 +20910,15 @@
               call_exp = build_function_call (block_copy_assign_decl, func_params);
               add_stmt (call_exp);
             }
      +      /* APPLE LOCAL begin radar 6214617 */
      +      else if (TYPE_HAS_CONSTRUCTOR (TREE_TYPE (p)) 
      +               || TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (p)))
      +      {
      +        tree call_exp = build_aggr_init (dst_block_component, src_block_component, 
      +                                         LOOKUP_ONLYCONVERTING);
      +        add_stmt (call_exp);
      +      }
      +      /* APPLE LOCAL end radar 6214617 */
             else
             {
               /* _dest-> imported_object_x = [_src->imported_object_x retain] */
      @@ -20931,7 +20955,8 @@
             }
       
         finish_compound_stmt (stmt);
      -  finish_function (0);
      +  /* APPLE LOCAL radar 6169580 */
      +  finish_function (4);
         /* Hum, would be nice if someone else did this for us.  */
         if (global_bindings_p ())
           cgraph_finalize_function (block_impl->copy_helper_func_decl, false);
      @@ -20971,7 +20996,11 @@
         stmt = begin_compound_stmt (BCS_FN_BODY);
         for (chain = block_impl->block_ref_decl_list; chain;
              chain = TREE_CHAIN (chain))
      -    if (block_requires_copying (TREE_VALUE (chain)))
      +    /* APPLE LOCAL begin radar 6214617 */
      +    if (block_requires_copying (TREE_VALUE (chain))
      +	|| (TREE_CODE (TREE_TYPE (TREE_VALUE (chain))) == RECORD_TYPE 
      +            && CLASSTYPE_DESTRUCTORS (TREE_TYPE (TREE_VALUE (chain)))))
      +    /* APPLE LOCAL end radar 6214617 */
           {
             tree p = TREE_VALUE (chain);
             tree src_block_component;
      @@ -20999,6 +21028,15 @@
               call_exp = build_function_call (block_destroy_decl, func_params);
               add_stmt (call_exp);
             }
      +      /* APPLE LOCAL begin radar 6214617 */
      +      else if (TREE_CODE (TREE_TYPE (p)) == RECORD_TYPE
      +               && CLASSTYPE_DESTRUCTORS (TREE_TYPE (p)))
      +      {
      +        tree call_exp = cxx_maybe_build_cleanup (src_block_component);
      +        gcc_assert (call_exp);
      +        add_stmt (call_exp);
      +      }
      +      /* APPLE LOCAL end radar 6214617 */
             else
             {
               tree rel_exp;
      @@ -21030,7 +21068,8 @@
           }
       
         finish_compound_stmt (stmt);
      -  finish_function (0);
      +  /* APPLE LOCAL radar 6169580 */
      +  finish_function (4);
         /* Hum, would be nice if someone else did this for us.  */
         if (global_bindings_p ())
           cgraph_finalize_function (block_impl->destroy_helper_func_decl, false);
      @@ -21056,13 +21095,31 @@
         tree arg_type = void_list_node;
         struct block_sema_info *block_impl;
         tree tmp;
      -  tree restype, resdecl;
      +  tree restype;
         tree typelist;
         tree helper_function_type;
         tree block;
      +  /* APPLE LOCAL radar 6185344 */
      +  tree declared_block_return_type = NULL_TREE;
      +  /* APPLE LOCAL radar 6169580 */
      +  int context_is_nonstatic_method;
       
         cp_lexer_consume_token (parser->lexer); /* eat '^' */
       
      +  /* APPLE LOCAL begin radar 6185344 */
      +  /* Parse user declared return type. */
      +  if (!cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN) &&
      +      !cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
      +  {
      +    tree type;
      +    parsing_block_return_type = 1;
      +    type = cp_parser_type_id (parser);
      +    parsing_block_return_type = 0;
      +    if (type != error_mark_node) 
      +      declared_block_return_type = type;
      +  }
      +  /* APPLE LOCAL end radar 6185344 */
      +
         /* Parse the optional argument list */
         if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
           {
      @@ -21088,9 +21145,21 @@
       #endif
       
         block = begin_block ();
      +  /* APPLE LOCAL begin radar 6169580 */
      +  context_is_nonstatic_method = (current_function_decl 
      +                                 && DECL_NONSTATIC_MEMBER_FUNCTION_P (current_function_decl));
      +  /* APPLE LOCAL end radar 6169580 */
       
         /* cur_block->arg_info = NULL; */
      -  cur_block->return_type = NULL_TREE;
      +  /* APPLE LOCAL begin radar 6185344 */
      +  if (declared_block_return_type)
      +    {
      +      cur_block->return_type  = TYPE_MAIN_VARIANT (declared_block_return_type);
      +      cur_block->block_has_return_type = true;
      +    }
      +  else
      +    cur_block->return_type = NULL_TREE;
      +  /* APPLE LOCAL end radar 6185344 */
       
         if (args)
           {
      @@ -21124,19 +21193,24 @@
         arg_type = tree_cons (NULL_TREE, ptr_type_node, arg_type);
         arglist = self_arg;
       
      -  /* Build the declaration of the helper function (we do not know its result
      -     type yet, so assume it is 'void'). Treat this as a nested function and use
      -     nested function infrastructure for its generation. */
      +  /* APPLE LOCAL begin radar 6185344 */
      +  /* Build the declaration of the helper function (if we do not know its result
      +     type yet, assume it is 'void'. If user provided it, use it).
      +     Treat this as a nested function and use nested function infrastructure for
      +     its generation. */
       
         push_lang_context (lang_name_c);
      -  ftype = build_function_type (void_type_node, arg_type);
      +
      +  ftype = build_function_type ((!cur_block->block_has_return_type
      +                                ? void_type_node : cur_block->return_type),
      +                               arg_type);
      +  /* APPLE LOCAL end radar 6185344 */
         /* APPLE LOCAL radar 6160536 */
         block_helper_function_decl = build_helper_func_decl (build_block_helper_name (unique_count),
       						       ftype);
         if (current_function_decl)
           DECL_NO_STATIC_CHAIN (current_function_decl) = 0;
         DECL_CONTEXT (block_helper_function_decl) = current_function_decl;
      -  BLOCK_HELPER_FUNC (block_helper_function_decl) = 1;
         cur_block->helper_func_decl = block_helper_function_decl;
       
         DECL_ARGUMENTS (block_helper_function_decl) = arglist;
      @@ -21159,6 +21233,14 @@
           /* Set block's scope to the scope of the helper function's main body.
              This is primarily used when nested blocks are declared. */
           cur_block->cp_the_scope = current_binding_level;
      +    /* APPLE LOCAL begin radar 6169580 */
      +    if (context_is_nonstatic_method)
      +      {
      +        tree this_decl = lookup_name (this_identifier);
      +        gcc_assert (this_decl);
      +        build_block_ref_decl (this_identifier, this_decl);
      +      }
      +    /* APPLE LOCAL end radar 6169580 */
           cp_parser_compound_statement (parser, NULL, false, false);
           parser->in_statement = save;
         }
      @@ -21175,11 +21257,9 @@
         TREE_TYPE (self_arg) = cur_block->block_arg_ptr_type;
         DECL_ARG_TYPE (self_arg) = cur_block->block_arg_ptr_type;
       
      -  /* Now that we know helper's result type, fix its result variable decl. */
      -  resdecl = build_decl (RESULT_DECL, NULL_TREE, restype);
      -  DECL_ARTIFICIAL (resdecl) = 1;
      -  DECL_IGNORED_P (resdecl) = 1;
      -  DECL_RESULT (current_function_decl) = resdecl;
      +  /* The DECL_RESULT should already have the correct type by now.  */
      +  gcc_assert (TREE_TYPE (DECL_RESULT (current_function_decl))
      +	      == restype);
       
         cur_block->block_body = stmt;
         block_build_prologue (cur_block);
      @@ -21202,12 +21282,7 @@
                               typelist);
         helper_function_type = build_function_type (TREE_TYPE (ftype), typelist);
         TREE_TYPE (cur_block->helper_func_decl) = helper_function_type;
      -  /* Let tree builder know that we are done analyzing block's return type so it
      -     does not do it twice (and produce bad return expression tree). This case is 
      -     for global blocks as finish_function () for them builds AST for the entire
      -     body of the function. */
      -  cur_block->block_is_complete = true;
      -  finish_function (0);
      +  finish_function (4);
         pop_function_context ();
         /* Hum, would be nice if someone else did this for us.  */
         if (global_bindings_p ())
      @@ -21330,6 +21405,8 @@
         /* FIXME - Broken, should be found via objc runtime testcases.  */
         /* FIXME - Don't use DECL_CONTEXT on any helpers */
         tree ref_decl;
      +  /* APPLE LOCAL radar 6212722 */
      +  tree type, exp;
         /* 'decl' was previously declared as __block.  Simply, copy the value
            embedded in the above variable. */
         if (TREE_CODE (decl) == VAR_DECL && COPYABLE_BYREF_LOCAL_VAR (decl))
      @@ -21391,10 +21468,16 @@
             }
           }
         }
      -
      +  /* APPLE LOCAL begin radar 6212722 */
      +  exp = decl;
      +  type = TREE_TYPE (exp);
      +  if (TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == FUNCTION_TYPE) {
      +    exp = decay_conversion (exp);
      +    type = TREE_TYPE (exp);
      +  }
         ref_decl = build_decl (VAR_DECL, name,
      -                         build_qualified_type (TREE_TYPE (decl),
      -                                               TYPE_QUAL_CONST));
      +                         build_qualified_type (type, TYPE_QUAL_CONST));
      +  /* APPLE LOCAL end radar 6212722 */
         /* APPLE LOCAL begin radar 6144664  */
         DECL_SOURCE_LOCATION (ref_decl) = DECL_SOURCE_LOCATION 
                                                        (cur_block->helper_func_decl);
      @@ -21412,13 +21495,14 @@
           while (b->level_chain->kind != sk_function_parms)
             b = b->level_chain;
           pushdecl_with_scope (ref_decl, b, /*is_friend=*/false);
      -    cp_finish_decl (ref_decl, NULL_TREE, /*init_const_expr_p=*/false, NULL_TREE,
      -		    LOOKUP_ONLYCONVERTING);
      +    /* APPLE LOCAL radar 6169527 */
      +    add_decl_expr (ref_decl);
         }
         cur_block->block_ref_decl_list =
           tree_cons (NULL_TREE, ref_decl, cur_block->block_ref_decl_list);
         cur_block->block_original_ref_decl_list =
      -    tree_cons (NULL_TREE, decl, cur_block->block_original_ref_decl_list);
      +    /* APPLE LOCAL radar 6212722 */
      +    tree_cons (NULL_TREE, exp, cur_block->block_original_ref_decl_list);
         return ref_decl;
       }
       
      @@ -21475,6 +21559,8 @@
         TYPE_BLOCK_IMPL_STRUCT (invoke_impl_type) = 1;
         /* finish_struct (invoke_impl_type, field_decl_chain, NULL_TREE); */
         finish_builtin_struct (invoke_impl_type, "__invoke_impl", fields, NULL_TREE);
      +  /* APPLE LOCAL radar 6169527 */
      +  CLASSTYPE_AS_BASE (invoke_impl_type) = invoke_impl_type;
         pop_from_top_level ();
         invoke_impl_ptr_type = build_pointer_type (invoke_impl_type);
       }
      @@ -21497,11 +21583,6 @@
         return ret;
       }
       
      -bool in_imm_block (void)
      -{
      -  return (cur_block && cur_block->cp_the_scope == current_binding_level);
      -}
      -
       /* This routine returns 'true' if 'name' has a declaration inside the
          current block, 'false' otherwise.  If 'name' has no declaration in
          the current block, it returns in DECL the user declaration for
      @@ -21556,13 +21637,16 @@
        declare_block_prologue_local_vars - utility routine to do the actual
        declaration and initialization for each referecned block variable.
       */
      +/* APPLE LOCAL begin radar 6169527 */
      +/* This routine is mostly rewritten for c++ because initialization of variables
      +   may involve copy construction. */
       static void
       declare_block_prologue_local_vars (tree self_parm, tree component,
       				   tree stmt)
       {
         tree decl, block_component;
         tree_stmt_iterator i;
      -  tree decl_stmt;
      +  tree initialization_stmt;
       
         decl = component;
         block_component = build_component_ref (build_indirect_ref (self_parm, "->"),
      @@ -21573,6 +21657,35 @@
         TREE_USED (decl) = 1;
         DECL_CONTEXT (decl) = current_function_decl;
         DECL_ARTIFICIAL (decl) = 1;
      +  initialization_stmt = push_stmt_list();
      +  cp_finish_decl (decl, block_component, 0, 0, LOOKUP_ONLYCONVERTING);
      +  initialization_stmt = pop_stmt_list (initialization_stmt);
      +  /* Prepend a initialization_stmt statement to the statement list. */
      +  i = tsi_start (stmt);
      +  tsi_link_before (&i, initialization_stmt, TSI_SAME_STMT);
      +}
      +
      +/**
      + declare_block_prologue_local_byref_vars - utility routine to do the actual
      + declaration and initialization for each __block referenced block variable.
      + */
      +static void
      +declare_block_prologue_local_byref_vars (tree self_parm, tree component,
      +				   tree stmt)
      +{
      +  tree decl, block_component;
      +  tree_stmt_iterator i;
      +  tree decl_stmt;
      +  
      +  decl = component;
      +  block_component = build_component_ref (build_indirect_ref (self_parm, "->"),
      +                                         DECL_NAME (component));
      +  gcc_assert (block_component);
      +  DECL_EXTERNAL (decl) = 0;
      +  TREE_STATIC (decl) = 0;
      +  TREE_USED (decl) = 1;
      +  DECL_CONTEXT (decl) = current_function_decl;
      +  DECL_ARTIFICIAL (decl) = 1;
         DECL_INITIAL (decl) = block_component;
         /* Prepend a DECL_EXPR statement to the statement list. */
         i = tsi_start (stmt);
      @@ -21580,9 +21693,10 @@
         SET_EXPR_LOCATION (decl_stmt, DECL_SOURCE_LOCATION (decl));
         decl_stmt = build3 (BIND_EXPR, void_type_node, decl, decl_stmt, NULL);
         TREE_SIDE_EFFECTS (decl_stmt) = 1;
      -
      -  tsi_link_before (&i, decl_stmt, TSI_SAME_STMT);
      +  
      +  tsi_link_before (&i, decl_stmt, TSI_SAME_STMT);  
       }
      +/* APPLE LOCAL end radar 6169527 */
       
       /**
        block_build_prologue
      @@ -21606,11 +21720,12 @@
              chain = TREE_CHAIN (chain))
           declare_block_prologue_local_vars (self_parm, TREE_VALUE (chain),
       				       block_impl->block_body);
      -
      +  /* APPLE LOCAL begin radar 6169527 */
         for (chain = block_impl->block_byref_decl_list; chain;
              chain = TREE_CHAIN (chain))
      -    declare_block_prologue_local_vars (self_parm, TREE_VALUE (chain),
      -				       block_impl->block_body);
      +    declare_block_prologue_local_byref_vars (self_parm, TREE_VALUE (chain),
      +                                             block_impl->block_body);
      +  /* APPLE LOCAL end radar 6169527 */
       }
       /* APPLE LOCAL end blocks 6040305 (ch) */
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/cp/pt.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/pt.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/cp/pt.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/cp/pt.c Thu Sep 18 19:07:05 2008
      @@ -5288,7 +5288,7 @@
         pop_tinst_level ();
       }
       
      -/* LLVM LOCAL begin - Fix for GCC PR c++/29365 */
      +/* APPLE LOCAL begin mainline radar 6194879 */
       /* Returns the TINST_LEVEL which gives the original instantiation
          context.  */
       
      @@ -5297,8 +5297,8 @@
       {
         return tree_last (current_tinst_level);
       }
      -/* LLVM LOCAL end */
       
      +/* APPLE LOCAL end mainline radar 6194879 */
       /* DECL is a friend FUNCTION_DECL or TEMPLATE_DECL.  ARGS is the
          vector of template arguments, as for tsubst.
       
      @@ -7869,6 +7869,11 @@
       					     complain);
             }
       
      +      /* APPLE LOCAL begin blocks 6204446 */
      +    case BLOCK_POINTER_TYPE:
      +      return t;
      +      /* APPLE LOCAL end blocks 6204446 */
      +
           default:
             sorry ("use of %qs in template",
       	     tree_code_name [(int) TREE_CODE (t)]);
      
      Modified: llvm-gcc-4.2/trunk/gcc/cp/rtti.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/rtti.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/cp/rtti.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/cp/rtti.c Thu Sep 18 19:07:05 2008
      @@ -828,6 +828,10 @@
           DECL_EXTERNAL (name_decl) = 0;
           DECL_TINFO_P (name_decl) = 1;
           set_linkage_according_to_type (target, name_decl);
      +    /* APPLE LOCAL begin export basic tinfo names 5008927 */
      +    if (doing_runtime && ! targetm.cxx.library_rtti_comdat ())
      +      DECL_INTERFACE_KNOWN (name_decl) = 1;
      +    /* APPLE LOCAL end export basic tinfo names 5008927 */
           import_export_decl (name_decl);
           DECL_INITIAL (name_decl) = name_string;
           mark_used (name_decl);
      
      Modified: llvm-gcc-4.2/trunk/gcc/cp/search.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/search.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/cp/search.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/cp/search.c Thu Sep 18 19:07:05 2008
      @@ -1920,6 +1920,13 @@
         int ix;
         int found = 0;
       
      +  /* APPLE LOCAL begin ctor name 6202462 */
      +  /* A constructor doesn't have a name, so the concept of name lookup
      +     of its name doesn't make sense.  */
      +  if (DECL_CONSTRUCTOR_P (fndecl))
      +    return false;
      +  /* APPLE LOCAL end ctor name 6202462 */
      +
         for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++)
           {
             tree basetype = BINFO_TYPE (base_binfo);
      
      Modified: llvm-gcc-4.2/trunk/gcc/cp/semantics.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/semantics.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/cp/semantics.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/cp/semantics.c Thu Sep 18 19:07:05 2008
      @@ -774,12 +774,6 @@
       
         expr = check_return_expr (expr, &no_warning);
       
      -  /* APPLE LOCAL begin blocks 6040305 */
      -  if (current_function_decl && BLOCK_HELPER_FUNC (current_function_decl)
      -      && !cur_block)
      -    return expr;
      -  /* APPLE LOCAL end blocks 6040305 */
      -
         if (flag_openmp && !check_omp_return ())
           return error_mark_node;
         if (!processing_template_decl)
      @@ -2882,8 +2876,21 @@
       	     Access checking has been performed during name lookup
       	     already.  Turn off checking to avoid duplicate errors.  */
       	  push_deferring_access_checks (dk_no_check);
      -	  decl = finish_non_static_data_member (decl, current_class_ref,
      -						/*qualifying_scope=*/NULL_TREE);
      +          /* APPLE LOCAL begin radar 6169580 */
      +          if (cur_block)
      +          {
      +            tree exp;
      +            tree this_copiedin_var = lookup_name (this_identifier);
      +            gcc_assert (!current_class_ref);
      +            gcc_assert (this_copiedin_var);
      +            exp = build_x_arrow (this_copiedin_var);
      +            decl = build_class_member_access_expr (exp, decl, TREE_TYPE (exp), 
      +                                                   /*preserve_reference=*/false);
      +          }
      +          else
      +	    decl = finish_non_static_data_member (decl, current_class_ref,
      +                                                  /*qualifying_scope=*/NULL_TREE);
      +          /* APPLE LOCAL end radar 6169580 */
       	  pop_deferring_access_checks ();
       	}
             else if (is_overloaded_fn (decl))
      
      Modified: llvm-gcc-4.2/trunk/gcc/cp/typeck.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/typeck.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/cp/typeck.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/cp/typeck.c Thu Sep 18 19:07:05 2008
      @@ -2775,6 +2775,7 @@
         tree block_ptr_exp;
         tree function_ptr_exp;
         tree typelist;
      +  tree result;
         
         /* (struct invok_impl *)BLOCK_PTR_VAR */
         /* First convert it to 'void *'. */
      @@ -2792,8 +2793,11 @@
         typelist = tree_cons (NULL_TREE, invoke_impl_ptr_type, typelist);
         fntype = build_function_type (TREE_TYPE (fntype), typelist);
         function_ptr_exp = convert (build_pointer_type (fntype), function_ptr_exp);
      -  return  build3 (CALL_EXPR, TREE_TYPE (fntype),
      -                  function_ptr_exp, params, NULL_TREE);
      +  result = build3 (CALL_EXPR, TREE_TYPE (fntype),
      +		   function_ptr_exp, params, NULL_TREE);
      +  /* FIXME: should do more from build_cxx_call */
      +  result = convert_from_reference (result);
      +  return result;
       }
       /* APPLE LOCAL end blocks 6040305 (cm) */
       
      @@ -6982,59 +6986,70 @@
             return NULL_TREE;
           }
       
      -  if (processing_template_decl)
      -    {
      -      current_function_returns_value = 1;
      -      return retval;
      -    }
      -
         /* APPLE LOCAL begin blocks 6040305 (cm) */
      -  if (cur_block)
      +  /* APPLE LOCAL radar 6185344 */
      +  if (cur_block && !cur_block->block_has_return_type)
           {
      +      /* If this is the first return we've seen in the block, infer the type of
      +	 the block from it. */
             if (cur_block->return_type == NULL_TREE)
       	{
       	  if (retval)
      -	    cur_block->return_type = TYPE_MAIN_VARIANT (TREE_TYPE (retval));
      +	    {
      +	      tree restype;
      +	      retval = decay_conversion (retval);
      +	      restype = TYPE_MAIN_VARIANT (TREE_TYPE (retval));
      +	      TREE_TYPE (current_function_decl)
      +		= build_function_type (restype,
      +				       TYPE_ARG_TYPES (TREE_TYPE (current_function_decl)));
      +	      TREE_TYPE (DECL_RESULT (current_function_decl)) = restype;
      +	      relayout_decl (DECL_RESULT (current_function_decl));
      +	      cur_block->return_type = restype;
      +	    }
       	  else
       	    cur_block->return_type = void_type_node;
      -	  /* FIXME - is this copy ctor safe? */
      -	  return retval;
       	}
       
      -      /* Otherwise, verify that this result type matches the previous one.  We are
      -	 pickier with blocks than for normal functions because this is a new
      -	 feature and we set the rules. */
      +      /* Verify that this result type matches the previous one.  We
      +	 are pickier with blocks than for normal functions because
      +	 this is a new feature and we set the rules. */
             if (TREE_CODE (cur_block->return_type) == VOID_TYPE)
       	{
       	  if (retval)
       	    {
       	      error ("void block should not return a value");
      -	      retval = error_mark_node;
      +	      return error_mark_node;
       	    }
      -	  return retval;
       	}
      -
      -      if (!retval)
      +      else if (!retval)
       	{
       	  error ("non-void block should return a value");
       	  return error_mark_node;
       	}
         
      -      /* We have a non-void block with an expression, continue checking.  */
      -      valtype = TREE_TYPE (retval);
      +      if (retval)
      +	{
      +	  /* We have a non-void block with an expression, continue checking.  */
      +	  valtype = TREE_TYPE (retval);
       
      -      /* For now, restrict multiple return statements in a block to have 
      -	 strict compatible types only. */
      -      if (!types_are_block_compatible (cur_block->return_type, valtype))
      -	{
      -	  error ("incompatible type returning %qT, expected %qT",
      -		 valtype, cur_block->return_type);
      -	  retval = error_mark_node;
      +	  /* For now, restrict multiple return statements in a block to have 
      +	     strict compatible types only. */
      +	  if (!types_are_block_compatible (cur_block->return_type, valtype))
      +	    {
      +	      error ("incompatible type returning %qT, expected %qT",
      +		     valtype, cur_block->return_type);
      +	      return error_mark_node;
      +	    }
       	}
      -      return retval;
           }
         /* APPLE LOCAL end blocks 6040305 (cm) */
       
      +  if (processing_template_decl)
      +    {
      +      current_function_returns_value = 1;
      +      return retval;
      +    }
      +
         /* When no explicit return-value is given in a function with a named
            return value, the named return value is used.  */
         result = DECL_RESULT (current_function_decl);
      @@ -7568,17 +7583,3 @@
       
         return win;
       }
      -
      -/* APPLE LOCAL begin blocks 6040305 */
      -tree c_finish_return (tree exp)
      -{
      -  /* Unlike c front-end, genericize gets called in the middle of
      -     block parsing. Must not convert the expression tree at that
      -     time. */
      -  if (cur_block)
      -    return exp;
      -  gcc_assert (current_function_decl
      -              && BLOCK_HELPER_FUNC (current_function_decl));
      -  return finish_return_stmt (exp);
      -}
      -/* APPLE LOCAL end blocks 6040305 */
      
      Modified: llvm-gcc-4.2/trunk/gcc/dwarf2out.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/dwarf2out.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/dwarf2out.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/dwarf2out.c Thu Sep 18 19:07:05 2008
      @@ -214,8 +214,6 @@
       typedef struct cfa_loc GTY(())
       {
         HOST_WIDE_INT offset;
      -  /* APPLE LOCAL async unwind info 5949350 */
      -  HOST_WIDE_INT fp_offset;
         HOST_WIDE_INT base_offset;
         unsigned int reg;
         int indirect;            /* 1 if CFA is accessed via a dereference.  */
      @@ -733,21 +731,6 @@
       /* The last args_size we actually output.  */
       static HOST_WIDE_INT old_args_size;
       
      -/* APPLE LOCAL begin async unwind info 5949350 */
      -/* This routine should be called anytime the cfa.reg can be switched
      -   away from the fp.  We record the offset used with the fp, so that
      -   if we go from using the fp to the sp and then update the sp from
      -   the fp, we know what offset to use instead of the current offset in
      -   use for the sp.  */
      -
      -static inline void
      -notice_cfa_fp_offset (void)
      -{
      -  if (cfa.reg == (unsigned) HARD_FRAME_POINTER_REGNUM)
      -    cfa.fp_offset = cfa.offset;
      -}
      -/* APPLE LOCAL end async unwind info 5949350 */
      -
       /* Entry point to update the canonical frame address (CFA).
          LABEL is passed to add_fde_cfi.  The value of CFA is now to be
          calculated from REG+OFFSET.  */
      @@ -758,8 +741,6 @@
         dw_cfa_location loc;
         loc.indirect = 0;
         loc.base_offset = 0;
      -  /* APPLE LOCAL async unwind info 5949350 */
      -  notice_cfa_fp_offset ();
         loc.reg = reg;
         loc.offset = offset;
         def_cfa_1 (label, &loc);
      @@ -792,8 +773,6 @@
         if (cfa_store.reg == loc.reg && loc.indirect == 0)
           cfa_store.offset = loc.offset;
       
      -  /* APPLE LOCAL async unwind info 5949350 */
      -  notice_cfa_fp_offset ();
         loc.reg = DWARF_FRAME_REGNUM (loc.reg);
         lookup_cfa (&old_cfa);
       
      @@ -1129,20 +1108,7 @@
            insns to be marked, and to be able to handle saving state around
            epilogues textually in the middle of the function.  */
         if (prologue_epilogue_contains (insn) || sibcall_epilogue_contains (insn))
      -    /* APPLE LOCAL begin async unwind info 5949350 */
      -    {
      -      if (!flag_asynchronous_unwind_tables)
      -	return;
      -
      -      /* We now handle epilogues for flag_asynchronous_unwind_tables.
      -	 We do this by saving the cfa information around the epilogue
      -	 instructions and restoring that information after the
      -	 epilogue instructions.  See dwarf2out_frame_debug_noncall for
      -	 the information that is saved and restored.  */
      -      if (!epilogue_contains (insn))
      -	return;
      -    }
      -    /* APPLE LOCAL end async unwind info 5949350 */
      +    return;
       
         /* If only calls can throw, and we have a frame pointer,
            save up adjustments until we see the CALL_INSN.  */
      @@ -1597,8 +1563,6 @@
       	case REG:
       	  if (cfa.reg == (unsigned) REGNO (src))
       	    {
      -	      /* APPLE LOCAL async unwind info 5949350 */
      -	      notice_cfa_fp_offset ();
       	      /* Rule 1 */
       	      /* Update the CFA rule wrt SP or FP.  Make sure src is
       		 relative to the current CFA register.
      @@ -1645,24 +1609,8 @@
       
       	      if (XEXP (src, 0) == hard_frame_pointer_rtx)
       		{
      -		  /* APPLE LOCAL begin async unwind info 5949350 */
      -		  /* In the epilogue, sometimes we switch from fp to
      -		     sp and then play with sp, then do another switch
      -		     from fp to sp.  In order for this to work, we
      -		     have to save a copy of the offset against fp, and
      -		     restore that here, back into cfa.offset when we
      -		     notice that we were using sp and not fp.  */
      -		  if (cfa.reg == (unsigned) STACK_POINTER_REGNUM)
      -		    {
      -		      cfa.reg = HARD_FRAME_POINTER_REGNUM;
      -		      cfa.offset = cfa.fp_offset;
      -		    }
      -		  /* APPLE LOCAL end async unwind info 5949350 */
      -
       		  /* Restoring SP from FP in the epilogue.  */
       		  gcc_assert (cfa.reg == (unsigned) HARD_FRAME_POINTER_REGNUM);
      -		  /* APPLE LOCAL async unwind info 5949350 */
      -		  notice_cfa_fp_offset ();
       		  cfa.reg = STACK_POINTER_REGNUM;
       		}
       	      else if (GET_CODE (src) == LO_SUM)
      @@ -1703,8 +1651,6 @@
       		  && REGNO (XEXP (src, 0)) == cfa.reg
       		  && GET_CODE (XEXP (src, 1)) == CONST_INT)
       		{
      -		  /* APPLE LOCAL async unwind info 5949350 */
      -		  notice_cfa_fp_offset ();
       		  /* Setting a temporary CFA register that will be copied
       		     into the FP later on.  */
       		  offset = - INTVAL (XEXP (src, 1));
      @@ -1897,8 +1843,6 @@
       		x = XEXP (x, 0);
       	      gcc_assert (REG_P (x));
       
      -	      /* APPLE LOCAL async unwind info 5949350 */
      -	      notice_cfa_fp_offset ();
       	      cfa.reg = REGNO (x);
       	      cfa.base_offset = offset;
       	      cfa.indirect = 1;
      @@ -1916,53 +1860,6 @@
           }
       }
       
      -/* APPLE LOCAL begin async unwind info 5949350 */
      -/* Mirror routine to dwarf2out_frame_debug_noncall, except this
      -   routine is only called for all non-CALL_P instructions and only
      -   before the instruction.  We use this to save and restore the cfa
      -   state around epilogue instructions so that we can track frame
      -   related instructions from the epilogue when
      -   flag_asynchronous_unwind_tables is on.  */
      -void
      -dwarf2out_frame_debug_noncall (bool inside_epilogue)
      -{
      -  static dw_cfa_location saved_cfa;
      -  static dw_cfa_location saved_cfa_store;
      -  static dw_cfa_location saved_cfa_temp;
      -  static HOST_WIDE_INT saved_args_size;
      -
      -  const char *label;
      -
      -  if (inside_epilogue)
      -    {
      -      if (saved_cfa.reg == 0)
      -	{
      -	  /* When we enter an epilogue, we save the current cfa so
      -	     that we can restore it when we leave the epilogue.  */
      -	  saved_cfa = cfa;
      -	  saved_cfa_store = cfa_store;
      -	  saved_cfa_temp = cfa_temp;
      -	  saved_args_size = args_size;
      -	}
      -    }
      -  else if (saved_cfa.reg != 0)
      -    {
      -      /* We have now left the epilogue, so restore the saved cfa.  */
      -      cfa = saved_cfa;
      -      cfa_store = saved_cfa_store;
      -      cfa_temp = saved_cfa_temp;
      -      args_size = saved_args_size;
      -
      -      label = dwarf2out_cfi_label ();
      -      def_cfa_1 (label, &cfa);
      -
      -      /* Once restored, we might need to save it again.  */
      -      saved_cfa.reg = 0;
      -      return;
      -    }
      -}
      -/* APPLE LOCAL end async unwind info 5949350 */
      -
       /* Record call frame debugging information for INSN, which either
          sets SP or FP (adjusting how we calculate the frame address) or saves a
          register to the stack.  If INSN is NULL_RTX, initialize our state.
      @@ -2012,14 +1909,19 @@
             return;
           }
       
      -  label = dwarf2out_cfi_label ();
      -  src = find_reg_note (insn, REG_FRAME_RELATED_EXPR, NULL_RTX);
      -  if (src)
      -    insn = XEXP (src, 0);
      -  else
      -    insn = PATTERN (insn);
      +  /* APPLE LOCAL begin async unwind info 5976588 */
      +  if (after_p)
      +    {
      +      label = dwarf2out_cfi_label ();
      +      src = find_reg_note (insn, REG_FRAME_RELATED_EXPR, NULL_RTX);
      +      if (src)
      +	insn = XEXP (src, 0);
      +      else
      +	insn = PATTERN (insn);
       
      -  dwarf2out_frame_debug_expr (insn, label);
      +      dwarf2out_frame_debug_expr (insn, label);
      +    }
      +    /* APPLE LOCAL end async unwind info 5976588 */
       }
       
       #endif
      @@ -6714,9 +6616,7 @@
       {
         dw_die_ref c;
       
      -  if (! die->die_child)
      -    return;
      -
      +  /* APPLE LOCAL radar 6066486 - move code further down.  */
         /* APPLE LOCAL begin radar 5636185  */
         /* As we are traversing the entire structure of dies, to add the
            sibling attributes, also check each die to see if it has the
      @@ -6736,6 +6636,13 @@
             && contained_in_subroutine (die))
           remove_AT (die, DW_AT_MIPS_linkage_name);
         /* APPLE LOCAL end radar 5636185  */
      +  /* APPLE LOCAL begin radar 6066486 - Code moved from above.  */
      +  /* Don't return until after removing the DW_AT_MIPS_linkage_name,
      +     if appropriate.  */
      +  if (! die->die_child)
      +    return;
      +  /* APPLE LOCAL end radar 6066486  */
      +
         if (die->die_parent && die != die->die_parent->die_child)
           add_AT_die_ref (die, DW_AT_sibling, die->die_sib);
       
      @@ -12258,7 +12165,12 @@
           }
         else
           {
      -      subr_die = new_die (DW_TAG_subprogram, context_die, decl);
      +      /* APPLE LOCAL begin radar 6193416  */
      +      if (BLOCK_SYNTHESIZED_FUNC (decl))
      +	subr_die = new_die (DW_TAG_subprogram, comp_unit_die, decl);
      +      else
      +	subr_die = new_die (DW_TAG_subprogram, context_die, decl);
      +      /* APPLE LOCAL end radar 6193416  */
       
             if (TREE_PUBLIC (decl))
       	add_AT_flag (subr_die, DW_AT_external, 1);
      
      Modified: llvm-gcc-4.2/trunk/gcc/dwarf2out.h
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/dwarf2out.h?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/dwarf2out.h (original)
      +++ llvm-gcc-4.2/trunk/gcc/dwarf2out.h Thu Sep 18 19:07:05 2008
      @@ -21,8 +21,6 @@
       
       extern void dwarf2out_decl (tree);
       extern void dwarf2out_frame_debug (rtx, bool);
      -/* APPLE LOCAL async unwind info 5949350 */
      -extern void dwarf2out_frame_debug_noncall (bool);
       
       extern void debug_dwarf (void);
       struct die_struct;
      
      Modified: llvm-gcc-4.2/trunk/gcc/final.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/final.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/final.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/final.c Thu Sep 18 19:07:05 2008
      @@ -1944,12 +1944,7 @@
           case BARRIER:
       #if defined (DWARF2_UNWIND_INFO)
             if (dwarf2out_do_frame ())
      -	/* APPLE LOCAL begin async unwind info 5949350 */
      -	{
      -	  dwarf2out_frame_debug_noncall (epilogue_contains (insn));
      -	  dwarf2out_frame_debug (insn, false);
      -	}
      -	/* APPLE LOCAL end async unwind info 5949350 */
      +	dwarf2out_frame_debug (insn, false);
       #endif
             break;
       
      @@ -2534,10 +2529,6 @@
       #if defined (DWARF2_UNWIND_INFO)
       	if (CALL_P (insn) && dwarf2out_do_frame ())
       	  dwarf2out_frame_debug (insn, false);
      -	/* APPLE LOCAL begin async unwind info 5949350 */
      -	else if (dwarf2out_do_frame ())
      -	  dwarf2out_frame_debug_noncall (epilogue_contains (insn));
      -	/* APPLE LOCAL end async unwind info 5949350 */
       #endif
       
       	/* Find the proper template for this insn.  */
      
      Modified: llvm-gcc-4.2/trunk/gcc/function.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/function.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/function.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/function.c Thu Sep 18 19:07:05 2008
      @@ -4731,16 +4731,6 @@
         return 0;
       }
       
      -/* APPLE LOCAL begin async unwind info 5949350 */
      -int
      -epilogue_contains (rtx insn)
      -{
      -  if (contains (insn, &epilogue))
      -    return 1;
      -  return 0;
      -}
      -/* APPLE LOCAL end async unwind info 5949350 */
      -
       int
       prologue_epilogue_contains (rtx insn)
       {
      
      Modified: llvm-gcc-4.2/trunk/gcc/global.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/global.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/global.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/global.c Thu Sep 18 19:07:05 2008
      @@ -690,33 +690,6 @@
       
             mirror_conflicts ();
       
      -      /* APPLE LOCAL begin 4321079 */
      -      /* If two regs are tied by pseudo_preferences, and each is assigned to
      -	 only once, they can share the same register even if their lifetimes
      -	 overlap, as one must be a copy of the other. */
      -      {
      -	int i, j;
      -	for (i = max_allocno - 1; i >= 0; i--)
      -	  {
      -	    EXECUTE_IF_SET_IN_ALLOCNO_SET (pseudo_preferences 
      -					      + i * allocno_row_words,
      -					   j,
      -	      {
      -		if (REG_N_SETS (allocno[i].reg) == 1
      -		    && REG_N_SETS (allocno[j].reg) == 1)
      -		  {
      -		    conflicts[(i) * allocno_row_words 
      -				+ (unsigned) (j) / INT_BITS]
      -		      &= ~((INT_TYPE) 1 << ((unsigned) (j) % INT_BITS));
      -		    conflicts[(j) * allocno_row_words 
      -				+ (unsigned) (i) / INT_BITS]
      -		      &= ~((INT_TYPE) 1 << ((unsigned) (i) % INT_BITS));
      -		  }
      -	      });
      -	  }
      -      }
      -      /* APPLE LOCAL end 4321079 */
      -
             /* Eliminate conflicts between pseudos and eliminable registers.  If
       	 the register is not eliminated, the pseudo won't really be able to
       	 live in the eliminable register, so the conflict doesn't matter.
      
      Modified: llvm-gcc-4.2/trunk/gcc/libgcc2.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/libgcc2.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/libgcc2.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/libgcc2.c Thu Sep 18 19:07:05 2008
      @@ -2091,6 +2091,7 @@
       #endif
       }
       
      +/* LLVM LOCAL */
       #if defined(__i386__) && ! defined(_WINBASE_H)
       extern int VirtualProtect (char *, int, int, int *) __attribute__((stdcall));
       #endif
      @@ -2126,6 +2127,7 @@
       #endif
       #endif /* L_trampoline */
       
      +/* LLVM LOCAL */
       #if !defined (__CYGWIN__) && !defined(__MINGW32__)
       #ifdef L__main
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple (original)
      +++ llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple Thu Sep 18 19:07:05 2008
      @@ -1,3 +1,33 @@
      +2008-09-11  Fariborz Jahanian 
      +
      +        Radar 5839123
      +	* objc-act.c (objc_compare_types): More detailed error
      +	reporting.
      +
      +2008-09-10  Fariborz Jahanian 
      +
      +        Radar 6209554
      +	* objc-act.c (objc_declare_property_impl): Report on 
      +	location of previous property decl.
      +	(error_previous_property_decl): New.
      +	
      +2008-09-08 Fariborz Jahanian 
      +
      +        Radar 6064186
      +	* objc_act.c (generate_v2_property_list,
      +		      forward_declare_categories,
      +		      generate_descriptor_table,
      +		      generate_v2_ivars_list,
      +		      generate_dispatch_table,
      +		      generate_v2_dispatch_tables,
      +		      generate_v2_protocol_list,
      +		      generate_v2_method_descriptors,
      +		      newabi_append_ro,
      +		      generate_v2_shared_structures): Symbols which end up in DATA
      +	section now start with "l_".
      +	(build_message_reference_decl): Each message ref symbol is now prefixed
      +	by "l_". It is also becomes 'private extern'.
      +		       
       2008-08-26  Fariborz Jahanian 
       
               Radar 5595325 (minor addition)
      
      Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Thu Sep 18 19:07:05 2008
      @@ -2157,8 +2157,11 @@
         tree decl, initlist;
         int init_val = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_property_template));
       
      -  decl = start_var_decl (type, synth_id_with_class_suffix
      -			 (name, objc_implementation_context));
      +  /* APPLE LOCAL begin radar 6064186 */
      +  const char * ref_name = synth_id_with_class_suffix (name, objc_implementation_context);
      +  decl = start_var_decl (type, ref_name);
      +  set_user_assembler_name (decl, ref_name);
      +  /* APPLE LOCAL end radar 6064186 */
       
         initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, init_val));
         initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, size), initlist);
      @@ -2932,8 +2935,10 @@
            name of property meta-data is unique for each case. */
         UOBJC_V2_PROPERTY_decl = generate_v2_property_list (
       			     property_list_template,
      -			     protocol ? "_OBJC_$_PROP_PROTO_LIST"
      -				      : "_OBJC_$_PROP_LIST",
      +			     /* APPLE LOCAL begin radar 6064186 */
      +			     protocol ? "l_OBJC_$_PROP_PROTO_LIST"
      +				      : "l_OBJC_$_PROP_LIST",
      +			     /* APPLE LOCAL end radar 6064186 */
       			     size, initlist);
       }
       
      @@ -3784,25 +3789,33 @@
       	  return false;
       
       	/* APPLE LOCAL end 4175534 */
      +        /* APPLE LOCAL begin radar 5839123 */
       	case -3:
      -	  warning (0, "comparison of distinct Objective-C types lacks a cast");
      +	  warning (0, "comparison of distinct Objective-C types %qT and %qT lacks a cast",
      +                   orig_rtyp, orig_ltyp);
       	  break;
       
       	case -2:
      -	  warning (0, "initialization from distinct Objective-C type");
      +	  warning (0, "incompatible Objective-C types initializing %qT, expected %qT",
      +                   orig_rtyp, orig_ltyp);
       	  break;
       
       	case -1:
      -	  warning (0, "assignment from distinct Objective-C type");
      +	  warning (0, "incompatible Objective-C types assigning %qT, expected %qT", 
      +		   orig_rtyp, orig_ltyp);
       	  break;
       
       	case 0:
      -	  warning (0, "distinct Objective-C type in return");
      +	  warning (0, "incompatible Objective-C types returning %qT, expected %qT",
      +                   orig_rtyp, orig_ltyp);
       	  break;
       
       	default:
      -	  warning (0, "passing argument %d of %qE from distinct "
      -		   "Objective-C type", argno, callee);
      +	  warning (0, "incompatible Objective-C types %qT, expected %qT when"
      +                       " passing argument %d of %qE from distinct "
      +		       "Objective-C type"
      +                        , orig_rtyp, orig_ltyp, argno, callee);
      +          /* APPLE LOCAL end radar 5839123 */
       	  break;
       	}
           }
      @@ -5297,10 +5310,14 @@
       	  /* APPLE LOCAL begin new ObjC abi v2 */
       	  if (flag_objc_abi == 2)
       	    {
      -	      /* extern struct category_t _OBJC_$_CATEGORY_; */
      -	      impent->class_v2_decl = build_metadata_decl ("_OBJC_$_CATEGORY",
      +	      /* APPLE LOCAL begin radar 6064186 */
      +	      /* extern struct category_t l_OBJC_$_CATEGORY_; */
      +	      impent->class_v2_decl = build_metadata_decl ("l_OBJC_$_CATEGORY",
       							   /* APPLE LOCAL radar 5202926 */
       						           objc_v2_category_template, false); 
      +	      set_user_assembler_name (impent->class_v2_decl, 
      +				       IDENTIFIER_POINTER (DECL_NAME (impent->class_v2_decl)));
      +	      /* APPLE LOCAL end radar 6064186 */
       	    }
       	  else
       	    {
      @@ -5977,22 +5994,36 @@
       
       static GTY(()) int message_reference_idx;
       
      +/* APPLE LOCAL begin radar 5575115 - radar 6064186 */
       static tree
      -build_message_reference_decl (void)
      +build_message_reference_decl (tree sel_name, tree message_func_ident)
       {
         tree decl;
      -  char buf[256];
      +  char *buf;
      +  char *temp;
      +  int fixed_prefix_size = 
      +        2 + IDENTIFIER_LENGTH (message_func_ident) + 1;
      +  buf = (char *)alloca (fixed_prefix_size + 
      +                        strlen (IDENTIFIER_POINTER (sel_name)) + 1);
      +  sprintf (buf, "l_%s_%s", IDENTIFIER_POINTER (message_func_ident),
      +		IDENTIFIER_POINTER (sel_name));
      +  for (temp = buf+fixed_prefix_size; *temp; temp++)
      +    if (*temp == ':') *temp = '_';
       
      -  sprintf (buf, "_OBJC_MESSAGE_REF_%d", message_reference_idx++);
      -  decl = start_var_decl (objc_v2_message_ref_template, buf);
      +  decl = create_hidden_decl (objc_v2_message_ref_template, buf);
      +  DECL_WEAK (decl) = 1;
      +  /* LLVM LOCAL begin */
       #ifdef ENABLE_LLVM
      -  /* These are 4-byte aligned in 32-byte, 16-byte in 64-bit, which does not
      +  /* These are 4-byte aligned in 32-bit, 16-byte in 64-bit, which does not
            follow from the alignments of the component types. */
         DECL_ALIGN(decl) = BITS_PER_WORD==32 ? 32 : 128;
         DECL_USER_ALIGN(decl) = 1;
       #endif
      +  /* LLVM LOCAL end */
      +  set_user_assembler_name (decl, buf);
         return decl;
       }
      +/* APPLE LOCAL end radar 5575115 - radar 6064186 */
       
       /* Build the list of (objc_msgSend_fixup_xxx, selector name) Used later on to
          initialize the table of 'struct message_ref_t' elements. */
      @@ -6013,7 +6044,8 @@
             chain = &TREE_CHAIN (*chain);
           }
       
      -  mess_expr = build_message_reference_decl ();
      +  /* APPLE LOCAL radar 5575115 - radar 6064186 */
      +  mess_expr = build_message_reference_decl (sel_name, DECL_NAME (message_func_decl));
         *chain = tree_cons (mess_expr, message_func_decl, NULL_TREE);
       
         chain = &TREE_CHAIN (*chain);
      @@ -9258,13 +9290,17 @@
       			   tree proto, bool newabi)
       {
         tree decl, initlist;
      -
      -  decl = start_var_decl (type, synth_id_with_class_suffix (name, proto));
      +  /* APPLE LOCAL begin radar 6064186 */
      +  const char* ref_name = synth_id_with_class_suffix (name, proto);
      +  decl = start_var_decl (type, ref_name);
      +  /* APPLE LOCAL end radar 6064186 */
       
         /* APPLE LOCAL begin ObjC new abi */
         if (newabi)
           {
             int entsize;
      +      /* APPLE LOCAL radar 6064186 */
      +      set_user_assembler_name (decl, ref_name);
             entsize = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_method_template));
             initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, entsize));
             initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, size), initlist);
      @@ -10995,9 +11031,11 @@
       			    int size, tree list)
       {
         tree decl, initlist;
      -
      -  decl = start_var_decl (type, synth_id_with_class_suffix
      -			       (name, objc_implementation_context));
      +  /* APPLE LOCAL begin radar 6064186 */
      +  const char *ref_name = synth_id_with_class_suffix (name, objc_implementation_context);
      +  decl = start_var_decl (type, ref_name);
      +  set_user_assembler_name (decl, ref_name);
      +  /* APPLE LOCAL end radar 6064186 */
       
         initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, ivar_t_size));
       
      @@ -11052,7 +11090,8 @@
       						     objc_v2_ivar_template, chain);
       
             UOBJC_V2_INSTANCE_VARIABLES_decl
      -        = generate_v2_ivars_list (ivar_list_template, "_OBJC_$_INSTANCE_VARIABLES",
      +	/* APPLE LOCAL radar 6064186 */
      +        = generate_v2_ivars_list (ivar_list_template, "l_OBJC_$_INSTANCE_VARIABLES",
       				      TREE_INT_CST_LOW (
       				   	TYPE_SIZE_UNIT (objc_v2_ivar_template)),
                                      	      size, initlist);
      @@ -11197,8 +11236,12 @@
       	         ? TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_method_template)) 
       	         : 0;
         /* APPLE LOCAL end ObjC new abi */
      -  decl = start_var_decl (type, synth_id_with_class_suffix
      -			       (name, objc_implementation_context));
      +  /* APPLE LOCAL begin radar 6064186 */
      +  const char* ref_name = synth_id_with_class_suffix (name, objc_implementation_context);
      +  decl = start_var_decl (type, ref_name);
      +  if (newabi)
      +    set_user_assembler_name (decl, ref_name);
      +  /* APPLE LOCAL end radar 6064186 */
       
         /* LLVM LOCAL - begin make initializer size match type size */
         /* APPLE LOCAL ObjC new abi */
      @@ -11328,8 +11371,10 @@
       	= generate_dispatch_table (method_list_template,
       				   ((TREE_CODE (objc_implementation_context)
       				     == CLASS_IMPLEMENTATION_TYPE)
      -				    ? "_OBJC_$_CLASS_METHODS"
      -				    : "_OBJC_$_CATEGORY_CLASS_METHODS"),
      +				    /* APPLE LOCAL begin radar 6064186 */
      +				    ? "l_OBJC_$_CLASS_METHODS"
      +				    : "l_OBJC_$_CATEGORY_CLASS_METHODS"),
      +				    /* APPLE LOCAL end radar 6064186 */
       				   size, initlist, true);
           }
         else
      @@ -11348,13 +11393,15 @@
             if (TREE_CODE (objc_implementation_context) == CLASS_IMPLEMENTATION_TYPE)
       	UOBJC_V2_INSTANCE_METHODS_decl
       	  = generate_dispatch_table (method_list_template,
      -				     "_OBJC_$_INSTANCE_METHODS",
      +				     /* APPLE LOCAL radar 6064186 */
      +				     "l_OBJC_$_INSTANCE_METHODS",
       				     size, initlist, true);
             else
       	/* We have a category.  */
       	UOBJC_V2_INSTANCE_METHODS_decl
       	  = generate_dispatch_table (method_list_template,
      -				     "_OBJC_$_CATEGORY_INSTANCE_METHODS",
      +				     /* APPLE LOCAL radar 6064186 */
      +				     "l_OBJC_$_CATEGORY_INSTANCE_METHODS",
       				     size, initlist, true);
           }
         else
      @@ -11404,12 +11451,13 @@
       
         /* static struct protocol_list_t *list[size]; */
       
      +  /* APPLE LOCAL begin radar 6064186 */
         if (TREE_CODE (i_or_p) == PROTOCOL_INTERFACE_TYPE)
      -    ref_name = synth_id_with_class_suffix ("_OBJC_$_PROTOCOL_REFS", i_or_p);
      +    ref_name = synth_id_with_class_suffix ("l_OBJC_$_PROTOCOL_REFS", i_or_p);
         else if (TREE_CODE (i_or_p) == CLASS_INTERFACE_TYPE)
      -    ref_name = synth_id_with_class_suffix ("_OBJC_CLASS_PROTOCOLS_$", i_or_p);
      +    ref_name = synth_id_with_class_suffix ("l_OBJC_CLASS_PROTOCOLS_$", i_or_p);
         else if (TREE_CODE (i_or_p) == CATEGORY_INTERFACE_TYPE)
      -    ref_name = synth_id_with_class_suffix ("_OBJC_CATEGORY_PROTOCOLS_$", i_or_p);
      +    ref_name = synth_id_with_class_suffix ("l_OBJC_CATEGORY_PROTOCOLS_$", i_or_p);
         else
           abort ();
       
      @@ -11418,6 +11466,8 @@
       	       (build_pointer_type (objc_v2_protocol_template),
       		build_index_type (build_int_cst (NULL_TREE, size))),
       	       ref_name);
      +  set_user_assembler_name (refs_decl, ref_name);
      +  /* APPLE LOCAL end radar 6064186 */
       
         finish_var_decl (refs_decl, objc_build_constructor (TREE_TYPE (refs_decl),
         						      nreverse (initlist)));
      @@ -11494,12 +11544,14 @@
             if (is_optional)
       	UOBJC_PROTOCOL_OPT_CLS_METHODS_decl
       	  = generate_descriptor_table (method_list_template,
      -				       "_OBJC_$_PROTOCOL_CLASS_METHODS_OPT",
      +				       /* APPLE LOCAL radar 6064186 */
      +				       "l_OBJC_$_PROTOCOL_CLASS_METHODS_OPT",
       				       size, initlist, protocol, true);
             else
               UOBJC_V2_CLASS_METHODS_decl
       	  = generate_descriptor_table (method_list_template,
      -			       	       "_OBJC_$_PROTOCOL_CLASS_METHODS",
      +				       /* APPLE LOCAL radar 6064186 */
      +			       	       "l_OBJC_$_PROTOCOL_CLASS_METHODS",
       				       size, initlist, protocol, true);
           }
         else
      @@ -11524,12 +11576,14 @@
             if (is_optional)
       	UOBJC_PROTOCOL_OPT_NST_METHODS_decl
       	  = generate_descriptor_table (method_list_template,
      -				       "_OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT",
      +				       /* APPLE LOCAL radar 6064186 */
      +				       "l_OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT",
       				       size, initlist, protocol, true);
             else
               UOBJC_V2_INSTANCE_METHODS_decl
       	  = generate_descriptor_table (method_list_template,
      -				       "_OBJC_$_PROTOCOL_INSTANCE_METHODS",
      +				       /* APPLE LOCAL radar 6064186 */
      +				       "l_OBJC_$_PROTOCOL_INSTANCE_METHODS",
       				       size, initlist, protocol, true);
           }
         else
      @@ -12017,6 +12071,8 @@
         dollar = strchr (name, '$');
         gcc_assert (dollar);
         p = string;
      +  /* APPLE LOCAL radar 6064186 */
      +  *p = 'l'; p++;
         *p = '_'; p++;
         strncpy (p, name, (int)(dollar - name));
         p += (int)(dollar - name);
      @@ -12390,6 +12446,8 @@
         tree field, firstIvar;
         tree class_superclass_expr, metaclass_superclass_expr;
         unsigned int flags = 0x1; /* Start with CLS_META */
      +  /* APPLE LOCAL radar 6064186 */
      +  const char* ref_name;
         /* APPLE LOCAL begin radar 4705298, 4843145 */
         class_decl = objc_create_global_decl_for_class (
       		 objc_v2_class_template, 
      @@ -12497,9 +12555,12 @@
         sc_spec = build_tree_list (NULL_TREE, ridpointers[(int) RID_STATIC]);
         decl_specs = tree_cons (NULL_TREE, objc_v2_class_ro_template, sc_spec);
       
      -  decl = start_var_decl (objc_v2_class_ro_template,
      -                         newabi_append_ro (IDENTIFIER_POINTER
      -                                    (DECL_NAME (UOBJC_V2_METACLASS_decl))));
      +  /* APPLE LOCAL begin radar 6064186 */
      +  ref_name = newabi_append_ro (
      +	       IDENTIFIER_POINTER (DECL_NAME (UOBJC_V2_METACLASS_decl))); 
      +  decl = start_var_decl (objc_v2_class_ro_template, ref_name);
      +  set_user_assembler_name (decl, ref_name);
      +  /* APPLE LOCAL end radar 6064186 */
       
         initlist = build_class_ro_t_initializer
       	       (TREE_TYPE (decl),
      @@ -12575,9 +12636,11 @@
       		  : instanceSize;
         /* APPLE LOCAL end ARM signedness mismatch */
       
      -  decl = start_var_decl (objc_v2_class_ro_template,
      -                         newabi_append_ro (IDENTIFIER_POINTER
      -                         (DECL_NAME (UOBJC_V2_CLASS_decl))));  
      +  /* APPLE LOCAL begin radar 6064186 */
      +  ref_name = newabi_append_ro (IDENTIFIER_POINTER (DECL_NAME (UOBJC_V2_CLASS_decl)));
      +  decl = start_var_decl (objc_v2_class_ro_template, ref_name);
      +  set_user_assembler_name (decl, ref_name);
      +  /* APPLE LOCAL end radar 6064186 */
       
         /* APPLE LOCAL begin radar 4695101 */
         ivarLayout = objc_build_ivar_layout (true);
      @@ -19804,6 +19867,13 @@
       
       /* APPLE LOCAL end radar 5435299 */
       
      +/* APPLE LOCAL begin radar 6209554 */
      +static void error_previous_property_decl (tree x)
      +{ tree decl = build_decl (VAR_DECL, DECL_NAME (x), TREE_TYPE (x));
      +  DECL_SOURCE_LOCATION (decl) = DECL_SOURCE_LOCATION (x);
      +  error ("previous property declaration of %q+D was here", decl);
      +}
      +/* APPLE LOCAL end radar 6209554 */
       /* This routine declares a new property implementation. Triggered by a @synthesize or
          @dynamic declaration. */
       void objc_declare_property_impl (int impl_code, tree tree_list)
      @@ -19950,24 +20020,30 @@
       			    }
       			}
       		    }
      -                  /* APPLE LOCAL begin radar 5435299 */
      +                  /* APPLE LOCAL begin radar 5435299 - radar 6209554 */
                         else if (flag_new_property_ivar_synthesis)
                                objc_lookup_property_ivar (class, property_decl);
                         if (flag_new_property_ivar_synthesis &&
       		      (x = lookup_ivar_in_property_list (objc_implementation_context,
                                                                ivar_name)))
      -                    error ("synthesized properties %qs and %qs both claim ivar %qs",
      -                           IDENTIFIER_POINTER (property_name),
      -                           IDENTIFIER_POINTER (DECL_NAME (x)),
      -                           IDENTIFIER_POINTER (ivar_name));
      -                  /* APPLE LOCAL end radar 5435299 */
      +		    {
      +                      error ("synthesized properties %qs and %qs both claim ivar %qs",
      +                             IDENTIFIER_POINTER (property_name),
      +                             IDENTIFIER_POINTER (DECL_NAME (x)),
      +                             IDENTIFIER_POINTER (ivar_name));
      +                      error_previous_property_decl (x);
      +		    }
      +                  /* APPLE LOCAL end radar 5435299 - radar 6209554 */
       		}
      -              /* APPLE LOCAL begin radar 5435299 */
      +              /* APPLE LOCAL begin radar 5435299 - radar 6209554 */
                     if (flag_new_property_ivar_synthesis &&
      -		  lookup_property_impl_in_list (objc_implementation_context, property_name))
      -                error ("property %qs is already implemented",
      -                       IDENTIFIER_POINTER (property_name));
      -              /* APPLE LOCAL end radar 5435299 */
      +		  (x = lookup_property_impl_in_list (objc_implementation_context, property_name)))
      +	        {
      +                  error ("property %qs is already implemented",
      +                         IDENTIFIER_POINTER (property_name));
      +		  error_previous_property_decl (x);
      +		}
      +              /* APPLE LOCAL end radar 5435299 - radar 6209554 */
       	     /* Add the property to the list of properties for current implementation. */
                    TREE_CHAIN (property_decl) = IMPL_PROPERTY_DECL (objc_implementation_context);
                    IMPL_PROPERTY_DECL (objc_implementation_context) = property_decl;
      
      Modified: llvm-gcc-4.2/trunk/gcc/reload1.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/reload1.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/reload1.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/reload1.c Thu Sep 18 19:07:05 2008
      @@ -2695,7 +2695,11 @@
       
           case CLOBBER:
           case ASM_OPERANDS:
      +      /* APPLE LOCAL begin async unwind info 5976588 */
      +      gcc_unreachable ();
           case SET:
      +      break;
      +      /* APPLE LOCAL end async unwind info 5976588 */
             gcc_unreachable ();
       
           default:
      
      Modified: llvm-gcc-4.2/trunk/gcc/rtl.h
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/rtl.h?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/rtl.h (original)
      +++ llvm-gcc-4.2/trunk/gcc/rtl.h Thu Sep 18 19:07:05 2008
      @@ -2143,8 +2143,6 @@
       /* In function.c */
       extern void reposition_prologue_and_epilogue_notes (rtx);
       extern void thread_prologue_and_epilogue_insns (rtx);
      -    /* APPLE LOCAL async unwind info 5949350 */
      -extern int epilogue_contains (rtx);
       extern int prologue_epilogue_contains (rtx);
       extern int sibcall_epilogue_contains (rtx);
       extern void mark_temp_addr_taken (rtx);
      
      Modified: llvm-gcc-4.2/trunk/gcc/sched-deps.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/sched-deps.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/sched-deps.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/sched-deps.c Thu Sep 18 19:07:05 2008
      @@ -2132,6 +2132,7 @@
       
         return ds;
       }
      +/* LLVM LOCAL */
       #endif
       
       #ifdef INSN_SCHEDULING
      
      Modified: llvm-gcc-4.2/trunk/gcc/tree-ssa-alias.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-ssa-alias.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/tree-ssa-alias.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/tree-ssa-alias.c Thu Sep 18 19:07:05 2008
      @@ -1502,6 +1502,8 @@
       {
         size_t i;
         tree ptr;
      +  /* APPLE LOCAL 6070085 */
      +  bool more;
       
         /* Sort the POINTERS array in descending order of contributed
            virtual operands.  */
      @@ -1523,26 +1525,38 @@
             /* See if TAG1 had any aliases in common with other symbol tags.
       	 If we find a TAG2 with common aliases with TAG1, add TAG2's
       	 aliases into TAG1.  */
      -      for (j = i + 1; j < ai->num_pointers; j++)
      -	{
      -	  bitmap tag2_aliases = ai->pointers[j]->may_aliases;
      +      /* APPLE LOCAL begin 6070085 */
      +      do {
      +	/* Repeat alias merging until changes converge.  */
      +	more = false;
      +	for (j = i + 1; j < ai->num_pointers; j++)
      +	  {
      +	    bitmap tag2_aliases;
       
      -          if (bitmap_intersect_p (tag1_aliases, tag2_aliases))
      -	    {
      -	      tree tag2 = var_ann (ai->pointers[j]->var)->symbol_mem_tag;
      +	    if (ai->pointers[j]->grouped_p)
      +	      continue;
       
      -	      bitmap_ior_into (tag1_aliases, tag2_aliases);
      +	    tag2_aliases = ai->pointers[j]->may_aliases;
       
      -	      /* TAG2 does not need its aliases anymore.  */
      -	      bitmap_clear (tag2_aliases);
      -	      var_ann (tag2)->may_aliases = NULL;
      +	    if (bitmap_intersect_p (tag1_aliases, tag2_aliases))
      +	      {
      +		tree tag2 = var_ann (ai->pointers[j]->var)->symbol_mem_tag;
       
      -	      /* TAG1 is the unique alias of TAG2.  */
      -	      add_may_alias (tag2, tag1);
      +		bitmap_ior_into (tag1_aliases, tag2_aliases);
       
      -	      ai->pointers[j]->grouped_p = true;
      -	    }
      -	}
      +		/* TAG2 does not need its aliases anymore.  */
      +		bitmap_clear (tag2_aliases);
      +		var_ann (tag2)->may_aliases = NULL;
      +
      +		/* TAG1 is the unique alias of TAG2.  */
      +		add_may_alias (tag2, tag1);
      +
      +		ai->pointers[j]->grouped_p = true;
      +		more = true;
      +	      }
      +	  }
      +      } while (more);
      +      /* APPLE LOCAL end 6070085 */
       
             /* Now group all the aliases we collected into TAG1.  */
             group_aliases_into (tag1, tag1_aliases, ai);
      
      Modified: llvm-gcc-4.2/trunk/gcc/tree.h
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.h?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/tree.h (original)
      +++ llvm-gcc-4.2/trunk/gcc/tree.h Thu Sep 18 19:07:05 2008
      @@ -3062,8 +3062,6 @@
        ENUM_BITFIELD(tls_model) tls_model : 3;
       
        /* APPLE LOCAL begin radar 5732232 - blocks */
      - /* Belongs to FUNCTION_DECL exclusively. */
      - unsigned block_helper_func : 1;
        /* Belong to VAR_DECL exclusively. */
        unsigned block_decl_byref : 1;
        unsigned block_decl_copied : 1;
      @@ -3072,7 +3070,7 @@
        unsigned copyable_byref_local_nonpod : 1;
        /* APPLE LOCAL radar 6172148 */
        unsigned block_synthesized_function : 1;
      - /* 5 unused bits. */
      + /* 6 unused bits. */
        /* APPLE LOCAL end radar 5932809 - copyable byref blocks */
        /* APPLE LOCAL end radar 5732232 - blocks */
       };
      @@ -3121,7 +3119,6 @@
       #define DECL_TLS_MODEL(NODE) (VAR_DECL_CHECK (NODE)->decl_with_vis.tls_model)
       
       /* APPLE LOCAL begin radar 5732232 - blocks */
      -#define BLOCK_HELPER_FUNC(NODE) (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.block_helper_func)
       #define BLOCK_DECL_BYREF(NODE) (VAR_DECL_CHECK (NODE)->decl_with_vis.block_decl_byref)
       #define BLOCK_DECL_COPIED(NODE) (VAR_DECL_CHECK (NODE)->decl_with_vis.block_decl_copied)
       /* APPLE LOCAL end radar 5732232 - blocks */
      
      Modified: llvm-gcc-4.2/trunk/gcc/version.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/version.c?rev=56322&r1=56321&r2=56322&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/version.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/version.c Thu Sep 18 19:07:05 2008
      @@ -11,12 +11,12 @@
       /* APPLE LOCAL begin Apple version */
       #ifdef ENABLE_LLVM
       #ifdef LLVM_VERSION_INFO
      -#define VERSUFFIX " (Based on Apple Inc. build 5620) (LLVM build " LLVM_VERSION_INFO ")"
      +#define VERSUFFIX " (Based on Apple Inc. build 5622) (LLVM build " LLVM_VERSION_INFO ")"
       #else
      -#define VERSUFFIX " (Based on Apple Inc. build 5620) (LLVM build)"
      +#define VERSUFFIX " (Based on Apple Inc. build 5622) (LLVM build)"
       #endif
       #else
      -#define VERSUFFIX " (Based on Apple Inc. build 5620)"
      +#define VERSUFFIX " (Based on Apple Inc. build 5622)"
       #endif
       /* APPLE LOCAL end Apple version */
       
      
      
      
      
      From isanbard at gmail.com  Thu Sep 18 19:15:30 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 00:15:30 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56323 - in
       /llvm-gcc-4.2/trunk/gcc/testsuite: g++.apple/ g++.dg/ext/ g++.dg/warn/
       gcc.apple/ obj-c++.dg/ objc.dg/
      Message-ID: <200809190015.m8J0FUg3017662@zion.cs.uiuc.edu>
      
      Author: void
      Date: Thu Sep 18 19:15:30 2008
      New Revision: 56323
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56323&view=rev
      Log:
      Syncing testsuite up with Apple's GCC testsuite.
      
      Added:
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-copyconstructor.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-dynamic-array.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-explicit-return-type.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-reference-in-method.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/blocks-recovercpp.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/ctor.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/mips-linkage-name.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/unwind-1.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/ext/apple-r4168392.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-1.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-1.h
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.h
          llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-byref-dynamic-array.c
          llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-dynamic-array.c
          llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-explicit-return-type.c
          llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/format-security-attribute-3.c
          llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-10.mm
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-1-64bit.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-5-64bit.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-10.m
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-copyconstructor.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/block-copyconstructor.C?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-copyconstructor.C (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-copyconstructor.C Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,83 @@
      +/* APPLE LOCAL file radar 6169527 */
      +/* Test for proper use of copy constructors in setting up various block
      +   support code. */
      +/* { dg-do run } */
      +/* { dg-options "-mmacosx-version-min=10.6 " { target *-*-darwin* } } */
      +
      +#import 
      +#include 
      +
      +int constructors = 0;
      +int destructors = 0;
      +
      +#define CONST const
      +
      +class TestObject
      +{
      +public:
      +	TestObject(CONST TestObject& inObj);
      +	TestObject();
      +	~TestObject();
      +	
      +	TestObject& operator=(CONST TestObject& inObj);
      +
      +	int version() CONST { return _version; }
      +private:
      +	mutable int _version;
      +};
      +
      +TestObject::TestObject(CONST TestObject& inObj)
      +	
      +{
      +        ++constructors;
      +        _version = inObj._version;
      +	printf("%p (%d) -- TestObject(const TestObject&) called", this, _version); 
      +}
      +
      +
      +TestObject::TestObject()
      +{
      +        _version = ++constructors;
      +	printf("%p (%d) -- TestObject() called\n", this, _version); 
      +}
      +
      +
      +TestObject::~TestObject()
      +{
      +	printf("%p -- ~TestObject() called\n", this);
      +        ++destructors;
      +}
      +
      +
      +TestObject& TestObject::operator=(CONST TestObject& inObj)
      +{
      +	printf("%p -- operator= called", this);
      +        _version = inObj._version;
      +	return *this;
      +}
      +
      +void simpletest() {
      +    TestObject one;
      +    TestObject two;
      +    printf("one (%d) two (%d)\n", one.version(), two.version());
      +    one = two;
      +    printf(" after one = two, one (%d) two (%d)\n", one.version(), two.version());
      +}
      +
      +
      +void testRoutine() {
      +    TestObject one;
      +    
      +    void (^b)(void) = ^{ printf("my const copy of one is %d\n", one.version()); };
      +}
      +    
      +int main(char *argc, char *argv[]) {
      +    //simpletest();
      +    testRoutine();
      +    if (constructors != 0) {
      +        printf("%s: success\n", argv[0]);
      +        return 0;
      +    }
      +    printf("%s: *** didn't copy construct\n", argv[0]);
      +    return 1;
      +}
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-dynamic-array.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/block-dynamic-array.C?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-dynamic-array.C (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-dynamic-array.C Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,74 @@
      +/* APPLE LOCAL file radar 6212722 */
      +/* Test for use of array (dynamic or static) as copied in object in a block. */
      +/* { dg-options "-mmacosx-version-min=10.6 -ObjC++ -framework Foundation" { target *-*-darwin* } } */
      +/* { dg-do run } */
      +
      +#import 
      +#import 
      +
      +
      +int _getArrayCount() {return 5;}
      +
      +
      +int func ()
      +{
      +	NSAutoreleasePool *pool	= [[NSAutoreleasePool alloc] init];
      +
      +	int array[5];
      +	
      +	int i;
      +	const int c = 5;
      +	for (i = 0; i < c; ++i)
      +	{
      +		array[i] = i+1;
      +	}
      +	
      +	void (^block)(void) = ^{
      +	
      +		int i;
      +		NSLog (@"c = %d", c);
      +		for (i = 0; i < c; ++i)
      +		{
      +			NSLog (@"array[%d] = %d", i, array[i]);
      +		}
      +	
      +	};
      +	
      +	block();
      +
      +	[pool drain];
      +	return 0;
      +}
      +
      +int main (int argc, const char *argv[])
      +{
      +        int res;
      +	NSAutoreleasePool *pool	= [[NSAutoreleasePool alloc] init];
      +
      +	int array[_getArrayCount()];
      +	
      +	int i;
      +	const int c = _getArrayCount();
      +	for (i = 0; i < c; ++i)
      +	{
      +		array[i] = i+1;
      +	}
      +	
      +	void (^block)(void) = ^{
      +	
      +		int i;
      +		//const int c = _getArrayCount();
      +		NSLog (@"c = %d", c);
      +		for (i = 0; i < c; ++i)
      +		{
      +			NSLog (@"array[%d] = %d", i, array[i]);
      +		}
      +	
      +	};
      +	
      +	block();
      +	res = func();
      +
      +	[pool drain];
      +	return 0 + res;
      +}
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-explicit-return-type.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/block-explicit-return-type.C?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-explicit-return-type.C (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-explicit-return-type.C Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,83 @@
      +/* APPLE LOCAL file radar 6185344 */
      +/* Test for blocks with explicit return type specified. */
      +/* { dg-options "-mmacosx-version-min=10.6 -ObjC++" { target *-*-darwin* } } */
      +/* { dg-do compile } */
      +
      +typedef float * PF;
      +float gf;
      +
      + at interface NSView
      +  - (id) some_method_that_returns_id;
      + at end
      +
      +NSView *some_object;
      +
      +void some_func (NSView * (^) (id));
      +
      +typedef struct dispatch_item_s *dispatch_item_t;
      +typedef void (^completion_block_t)(void);
      +
      +typedef double (^myblock)(int);
      +double test(myblock I);
      +
      +int main()
      +{
      +	 __block int x = 1;
      + 	__block int y = 2;
      +
      +	^void *{ return 0; };
      +
      +	^float(float y){ return y; };
      +
      +	^double (float y, double d) 
      +           {
      +	      if (y)
      +	       return d;
      +	      else
      +	       return y;
      +	   };
      +
      +	const char * (^chb) (int flag, const char *arg, char *arg1) = ^ const char * (int flag, const char *arg, char *arg1) { 
      +	  if (flag)
      +	    return 0;
      +	  if (flag == 1)
      +	    return arg;
      +          else if (flag == 2)
      +	    return "";
      +	  return arg1; 
      +	};
      +
      +	^PF { return &gf; };
      +
      +	some_func(^ NSView * (id whatever) { return [some_object some_method_that_returns_id]; });
      +
      +	double res = test(^double (int z){x = y+z; return z; });	
      +}
      +
      +void func()
      +{
      +  completion_block_t X;
      +
      +  completion_block_t (^blockx)(dispatch_item_t) = ^completion_block_t (dispatch_item_t item) {
      +    return X;
      +  };
      +
      +  completion_block_t (^blocky)(dispatch_item_t) = ^(dispatch_item_t item) {
      +    return X;
      +  };
      +
      +  blockx = blocky;
      +
      +}
      +
      +
      +// intent: block taking int returning block that takes char,int and returns int
      +int (^(^block)(double x))(char, short);
      +
      +void foo() {
      +   block = ^(double x){ return ^int(char c, short y) { return c + y; };};  /* { dg-warning "returning block that lives on the local stack" } */
      +   // or:
      +   block = ^(double x){ return ^(char c, short y) { return (int)c + y; };};  /* { dg-warning "returning block that lives on the local stack" } */
      +}
      +
      +
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-reference-in-method.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/block-reference-in-method.C?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-reference-in-method.C (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-reference-in-method.C Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,95 @@
      +/* APPLE LOCAL file radar 6169580 */
      +/* Test use of blocks in member functions. */
      +/* { dg-do run } */
      +/* { dg-options "-mmacosx-version-min=10.6 " { target *-*-darwin* } } */
      +
      +#import 
      +#include 
      +
      +int recovered = 0;
      +
      +
      +#ifdef __cplusplus
      +
      +int constructors = 0;
      +int destructors = 0;
      +
      +#define CONST const
      +
      +class TestObject
      +{
      +public:
      +	TestObject(CONST TestObject& inObj);
      +	TestObject();
      +	~TestObject();
      +	
      +	TestObject& operator=(CONST TestObject& inObj);
      +        
      +        void test(void);
      +
      +	int version() CONST { return _version; }
      +private:
      +	mutable int _version;
      +};
      +
      +TestObject::TestObject(CONST TestObject& inObj)
      +	
      +{
      +        ++constructors;
      +        _version = inObj._version;
      +	printf("%p (%d) -- TestObject(const TestObject&) called", this, _version); 
      +}
      +
      +
      +TestObject::TestObject()
      +{
      +        _version = ++constructors;
      +	printf("%p (%d) -- TestObject() called\n", this, _version); 
      +}
      +
      +
      +TestObject::~TestObject()
      +{
      +	printf("%p -- ~TestObject() called\n", this);
      +        ++destructors;
      +}
      +
      +#if 1
      +TestObject& TestObject::operator=(CONST TestObject& inObj)
      +{
      +	printf("%p -- operator= called", this);
      +        _version = inObj._version;
      +	return *this;
      +}
      +#endif
      +
      +void TestObject::test(void)  {
      +    void (^b)(void) = ^{ recovered = _version; };
      +    b();
      +}
      +
      +#endif
      +
      +
      +void testRoutine() {
      +#ifdef __cplusplus
      +    TestObject one;
      +
      +    
      +    one.test();
      +#else
      +    recovered = 1;
      +#endif
      +}
      +    
      +    
      +
      +int main(char *argc, char *argv[]) {
      +    testRoutine();
      +    if (recovered == 1) {
      +        printf("%s: success\n", argv[0]);
      +        return (0);
      +    }
      +    printf("%s: *** didn't recover byref block variable\n", argv[0]);
      +    return (1);
      +}
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/blocks-recovercpp.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/blocks-recovercpp.C?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/blocks-recovercpp.C (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/blocks-recovercpp.C Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,104 @@
      +/* APPLE LOCAL file radar 6214617 */
      +/* { dg-options "-mmacosx-version-min=10.5 -ObjC++" { target *-*-darwin* } } */
      +/* { dg-do run } */
      +
      +#include 
      +#include 
      +
      +int constructors = 0;
      +int destructors = 0;
      +
      +void * _NSConcreteStackBlock[32];
      +
      +#define CONST const
      +
      +class TestObject
      +{
      +public:
      +	TestObject(CONST TestObject& inObj);
      +	TestObject();
      +	~TestObject();
      +	
      +	TestObject& operator=(CONST TestObject& inObj);
      +
      +	int version() CONST { return _version; }
      +private:
      +	mutable int _version;
      +};
      +
      +TestObject::TestObject(CONST TestObject& inObj)
      +	
      +{
      +        ++constructors;
      +        _version = inObj._version;
      +	printf("%p (%d) -- TestObject(const TestObject&) called\n", this, _version); 
      +}
      +
      +
      +TestObject::TestObject()
      +{
      +        _version = ++constructors;
      +	printf("%p (%d) -- TestObject() called\n", this, _version); 
      +}
      +
      +
      +TestObject::~TestObject()
      +{
      +	printf("%p -- ~TestObject() called\n", this);
      +        ++destructors;
      +}
      +
      +
      +TestObject& TestObject::operator=(CONST TestObject& inObj)
      +{
      +	printf("%p -- operator= called\n", this);
      +        _version = inObj._version;
      +	return *this;
      +}
      +
      +void hack(void *block) {
      +    // check flags to see if constructor/destructor is available;
      +    struct myblock {
      +        void *isa;
      +        int flags;
      +        int refcount;
      +        void *invokeptr;
      +        void (*copyhelper)(struct myblock *dst, struct myblock *src);
      +        void (*disposehelper)(struct myblock *src);
      +        long space[32];
      +    } myversion, *mbp = (struct myblock *)block;
      +    printf("flags -> %x\n", mbp->flags);
      +    if (! ((1<<25) & mbp->flags)) {
      +        printf("no copy/dispose helper functions provided!\n");
      +        exit(1);
      +    }
      +    if (! ((1<<26) & mbp->flags)) {
      +        printf("no marking for ctor/dtors present!\n");
      +        exit(1);
      +    }
      +    printf("copyhelper -> %p\n", mbp->copyhelper);
      +    // simulate copy
      +    mbp->copyhelper(&myversion, mbp);
      +    if (constructors != 3) {
      +        printf("copy helper didn't do the constructor part\n");
      +        exit(1);
      +    }
      +    printf("disposehelper -> %p\n", mbp->disposehelper);
      +    // simulate destroy
      +    mbp->disposehelper(&myversion);
      +    if (destructors != 1) {
      +        printf("dispose helper didn't do the dispose\n");
      +        exit(1);
      +    }
      +}
      +void testRoutine() {
      +    TestObject one;
      +    
      +    void (^b)(void) = ^{ printf("my copy of one is %d\n", one.version()); };
      +    hack(b);
      +}
      +
      +int main(char *argc, char *argv[]) {
      +    testRoutine();
      +    exit(0);
      +}
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/ctor.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/ctor.C?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/ctor.C (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/ctor.C Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,8 @@
      +/* APPLE LOCAL file ctor name 6202462 */
      +class A {
      +  virtual int B() { return 0; }
      +};
      +
      +class B: A {
      +  B() { }
      +};
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/mips-linkage-name.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/mips-linkage-name.C?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/mips-linkage-name.C (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/mips-linkage-name.C Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,13 @@
      +/* Radar 6066486 */
      +/* { dg-do compile { target *-*-darwin* } } */
      +/* { dg-options "-O0 -gdwarf-2 -dA" } */
      +/* { dg-final { scan-assembler-not "DW_AT_MIPS_linkage_name" } }*/
      +
      +#include 
      +
      +int main (int argc, char **argv)
      +{
      +  static int spin = 1;
      +  while (spin) sleep (1);
      +}
      +
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/unwind-1.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/unwind-1.C?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/unwind-1.C (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/unwind-1.C Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,35 @@
      +/* APPLE LOCAL file 6205688 */
      +/* { dg-do run } */
      +#include 
      +
      +void fn2(int i) __attribute__((noinline));
      +void fn2(int i) {
      +  printf("fn2 %d\n", i);
      +}
      +
      +int fn3(int i) __attribute__((noinline));
      +int fn3(int i) {
      +  if (i) return i+1;
      +  else throw 1;
      +}
      +
      +void fn(int i) __attribute__((noinline));
      +void fn(int i) {
      +  if (i) {
      +    fn2(i);
      +  } else {
      +    int j = fn3(i);
      +    printf("j %d\n", j);
      +  }
      +}
      +
      +volatile int arg = 0;
      +
      +int main(int argc, char **argv) {
      +  try {
      +    fn(arg);
      +  } catch (int e) {
      +    printf("caught %d\n", e);
      +  }
      +  return 0;
      +}
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/ext/apple-r4168392.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.dg/ext/apple-r4168392.C?rev=56323&view=auto
      
      ==============================================================================
          (empty)
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-1.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.dg/warn/anonymous-namespace-1.C?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-1.C (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-1.C Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,19 @@
      +// APPLE LOCAL file mainline radar 6194879
      +// Test for the warning of exposing types from an anonymous namespace
      +// { dg-do compile }
      +
      +#include "anonymous-namespace-1.h"
      +
      +namespace {
      + class good { };
      +}
      +
      +class foo::bar : public good { }; 
      +class foobar1
      +{
      +  good g;
      +};
      +
      +#line 18 "foo.C"
      +class foobar : public bad { }; // { dg-warning "uses the anonymous namespace" }
      +class foobar2 { bad b; }; // { dg-warning "uses the anonymous namespace" }
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-1.h
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.dg/warn/anonymous-namespace-1.h?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-1.h (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-1.h Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,8 @@
      +// APPLE LOCAL file mainline radar 6194879
      +class foo {
      + class bar;
      +};
      +
      +namespace {
      +  class bad { };
      +}
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.dg/warn/anonymous-namespace-2.C?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.C (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.C Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,29 @@
      +// APPLE LOCAL file mainline radar 6194879
      +// Test for the warning of exposing types from an anonymous namespace
      +// { dg-do compile }
      +//
      +#include "anonymous-namespace-2.h"
      +
      +namespace {
      +    struct good { };
      +}
      +
      +struct g1 {
      +    good * A;
      +};
      +struct g2 {
      +    good * A[1];
      +};
      +struct g3 {
      +    good (*A)[1];
      +};
      +#line 21 "foo.C"
      +struct b1 { // { dg-warning "uses the anonymous namespace" }
      +    bad * B;
      +};
      +struct b2 { // { dg-warning "uses the anonymous namespace" }
      +    bad * B[1];
      +};
      +struct b3 { // { dg-warning "uses the anonymous namespace" }
      +    bad (*B)[1];
      +};
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.h
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.dg/warn/anonymous-namespace-2.h?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.h (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.h Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,4 @@
      +// APPLE LOCAL file mainline radar 6194879
      +namespace {
      +  struct bad { };
      +}
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-byref-dynamic-array.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-byref-dynamic-array.c?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-byref-dynamic-array.c (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-byref-dynamic-array.c Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,26 @@
      +/* APPLE LOCAL file radar 6217257 */
      +/* __block cannot be used on dynamic array declaration due to block's runtime
      +   limitations. This test detects and flags as error such cases. */
      +/* { dg-options "-mmacosx-version-min=10.6 -ObjC" { target *-*-darwin* } } */
      +/* { dg-do compile } */
      +
      +int size=5;
      +
      +int main() {
      +  __block int array[size];	/* { dg-error "__block not allowed on a variable length array declaration" } */
      +
      +  __block id aid1[size];	/* { dg-error "__block not allowed on a variable length array declaration" } */
      +
      + __block id aid2[2][size];	/* { dg-error "__block not allowed on a variable length array declaration" } */
      +
      + __block id aid3[][size];	/* { dg-error "__block not allowed on a variable length array declaration" } */
      +				/* { dg-error "array size missing in" "" { target *-*-* } 16 } */
      +
      +
      + __block id oid1 [1];
      + __block id oid2 [2][3];
      + __block id oid4 [][1];	/* { dg-error "__block not allowed on a variable length array declaration" } */
      +		        /* { dg-error "array size missing in" "" { target *-*-* } 22 } */
      + return 0;
      +}
      +
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-dynamic-array.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-dynamic-array.c?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-dynamic-array.c (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-dynamic-array.c Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,74 @@
      +/* APPLE LOCAL file radar 6212722 */
      +/* Test for use of array (dynamic or static) as copied in object in a block. */
      +/* { dg-options "-mmacosx-version-min=10.6 -ObjC -framework Foundation" { target *-*-darwin* } } */
      +/* { dg-do run } */
      +
      +#import 
      +#import 
      +
      +
      +int _getArrayCount() {return 5;}
      +
      +
      +int func ()
      +{
      +	NSAutoreleasePool *pool	= [[NSAutoreleasePool alloc] init];
      +
      +	int array[5];
      +	
      +	int i;
      +	const int c = 5;
      +	for (i = 0; i < c; ++i)
      +	{
      +		array[i] = i+1;
      +	}
      +	
      +	void (^block)(void) = ^{
      +	
      +		int i;
      +		NSLog (@"c = %d", c);
      +		for (i = 0; i < c; ++i)
      +		{
      +			NSLog (@"array[%d] = %d", i, array[i]);
      +		}
      +	
      +	};
      +	
      +	block();
      +
      +	[pool drain];
      +	return 0;
      +}
      +
      +int main (int argc, const char *argv[])
      +{
      +        int res;
      +	NSAutoreleasePool *pool	= [[NSAutoreleasePool alloc] init];
      +
      +	int array[_getArrayCount()];
      +	
      +	int i;
      +	const int c = _getArrayCount();
      +	for (i = 0; i < c; ++i)
      +	{
      +		array[i] = i+1;
      +	}
      +	
      +	void (^block)(void) = ^{
      +	
      +		int i;
      +		//const int c = _getArrayCount();
      +		NSLog (@"c = %d", c);
      +		for (i = 0; i < c; ++i)
      +		{
      +			NSLog (@"array[%d] = %d", i, array[i]);
      +		}
      +	
      +	};
      +	
      +	block();
      +	res = func();
      +
      +	[pool drain];
      +	return 0 + res;
      +}
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-explicit-return-type.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-explicit-return-type.c?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-explicit-return-type.c (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-explicit-return-type.c Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,83 @@
      +/* APPLE LOCAL file radar 6185344 */
      +/* Test for blocks with explicit return type specified. */
      +/* { dg-options "-mmacosx-version-min=10.6 -ObjC" { target *-*-darwin* } } */
      +/* { dg-do compile } */
      +
      +typedef float * PF;
      +float gf;
      +
      + at interface NSView
      +  - (id) some_method_that_returns_id;
      + at end
      +
      +NSView *some_object;
      +
      +void some_func (NSView * (^) (id));
      +
      +typedef struct dispatch_item_s *dispatch_item_t;
      +typedef void (^completion_block_t)(void);
      +
      +typedef double (^myblock)(int);
      +double test(myblock I);
      +
      +int main()
      +{
      +	 __block int x = 1;
      + 	__block int y = 2;
      +
      +	^void *{ return 0; };
      +
      +	^float(float y){ return y; };
      +
      +	^double (float y, double d) 
      +           {
      +	      if (y)
      +	       return d;
      +	      else
      +	       return y;
      +	   };
      +
      +	const char * (^chb) (int flag, const char *arg, char *arg1) = ^ const char * (int flag, const char *arg, char *arg1) { 
      +	  if (flag)
      +	    return 0;
      +	  if (flag == 1)
      +	    return arg;
      +          else if (flag == 2)
      +	    return "";
      +	  return arg1; 
      +	};
      +
      +	^PF { return &gf; };
      +
      +	some_func(^ NSView * (id whatever) { return [some_object some_method_that_returns_id]; });
      +
      +	double res = test(^double (int z){x = y+z; return z; });	
      +}
      +
      +void func()
      +{
      +  completion_block_t X;
      +
      +  completion_block_t (^blockx)(dispatch_item_t) = ^completion_block_t (dispatch_item_t item) {
      +    return X;
      +  };
      +
      +  completion_block_t (^blocky)(dispatch_item_t) = ^(dispatch_item_t item) {
      +    return X;
      +  };
      +
      +  blockx = blocky;
      +
      +}
      +
      +
      +// intent: block taking int returning block that takes char,int and returns int
      +int (^(^block)(double x))(char, short);
      +
      +void foo() {
      +   block = ^(double x){ return ^int(char c, short y) { return c + y; };};  /* { dg-warning "returning block that lives on the local stack" } */
      +   // or:
      +   block = ^(double x){ return ^(char c, short y) { return (int)c + y; };};  /* { dg-warning "returning block that lives on the local stack" } */
      +}
      +
      +
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/format-security-attribute-3.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/format-security-attribute-3.c?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/format-security-attribute-3.c (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/format-security-attribute-3.c Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,8 @@
      +/* APPLE LOCAL file radar 6212507 */
      +/* This for incorrect specification of format number argument. */
      +/* { dg-options "-fconstant-cfstrings -Wformat -Wformat-security" } */
      +/* { dg-do compile { target *-*-darwin* } } */
      +
      +#include 
      +void doSomething(CFStringRef format, CFStringRef bla) __attribute__((format(CFString, 0, 1))); /* { dg-error "argument number of CFString format cannot be less than one" } */
      +
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-10.mm
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/property-synthesize-ivar-10.mm?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-10.mm (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-10.mm Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,35 @@
      +/* APPLE LOCAL file radar 6209554 */
      +/* Better messages for bad property declarations. */
      +/* { dg-options "-fnew-property-ivar-synthesis -mmacosx-version-min=10.5" { target powerpc*-*-darwin* i?86*-*-darwin* } } */
      +/* { dg-options "-fnew-property-ivar-synthesis -fobjc-new-property" { target arm*-*-darwin* } } */
      +/* { dg-do compile { target *-*-darwin* } } */
      +
      + at interface I
      +{
      +	int _p;
      +	int _p3;
      +	int _p4;
      +}
      + at property int p;
      + at property int p1;
      + at property int p3;
      + at property int p4;
      + at end
      +
      + at implementation I
      +
      + at dynamic p3; /* { dg-error "previous property declaration of \\'p3\\' was here" } */
      + at dynamic p4;	/* { dg-error "previous property declaration of \\'p4\\' was here" } */
      + at synthesize p = _p; /* { dg-error "previous property declaration of \\'p\\' was here" } */
      +
      +
      + at synthesize p1 = _p;  /* { dg-error "synthesized properties \\'p1\\' and \\'p\\' both claim ivar \\'_p\\'" } */
      +
      + at dynamic p3;  /* { dg-error "property \\'p3\\' is already implemented" } */
      +
      + at synthesize p4=_p4;	/* { dg-error "property \\'p4\\' is already implemented" } */
      +
      +
      + at end
      +
      +
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-1-64bit.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-1-64bit.m?rev=56323&view=auto
      
      ==============================================================================
          (empty)
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-5-64bit.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc-gc-5-64bit.m?rev=56323&view=auto
      
      ==============================================================================
          (empty)
      
      Added: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-10.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-10.m?rev=56323&view=auto
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-10.m (added)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-10.m Thu Sep 18 19:15:30 2008
      @@ -0,0 +1,35 @@
      +/* APPLE LOCAL file radar 6209554 */
      +/* Better messages for bad property declarations. */
      +/* { dg-options "-fnew-property-ivar-synthesis -mmacosx-version-min=10.5" { target powerpc*-*-darwin* i?86*-*-darwin* } } */
      +/* { dg-options "-fnew-property-ivar-synthesis -fobjc-new-property" { target arm*-*-darwin* } } */
      +/* { dg-do compile { target *-*-darwin* } } */
      +
      + at interface I
      +{
      +	int _p;
      +	int _p3;
      +	int _p4;
      +}
      + at property int p;
      + at property int p1;
      + at property int p3;
      + at property int p4;
      + at end
      +
      + at implementation I
      +
      + at dynamic p3; /* { dg-error "previous property declaration of \\'p3\\' was here" } */
      + at dynamic p4;	/* { dg-error "previous property declaration of \\'p4\\' was here" } */
      + at synthesize p = _p; /* { dg-error "previous property declaration of \\'p\\' was here" } */
      +
      +
      + at synthesize p1 = _p;  /* { dg-error "synthesized properties \\'p1\\' and \\'p\\' both claim ivar \\'_p\\'" } */
      +
      + at dynamic p3;  /* { dg-error "property \\'p3\\' is already implemented" } */
      +
      + at synthesize p4=_p4;	/* { dg-error "property \\'p4\\' is already implemented" } */
      +
      +
      + at end
      +
      +
      
      
      
      
      From isanbard at gmail.com  Thu Sep 18 19:16:21 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 00:16:21 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56324 -
      	/llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple
      Message-ID: <200809190016.m8J0GLBK017701@zion.cs.uiuc.edu>
      
      Author: void
      Date: Thu Sep 18 19:16:21 2008
      New Revision: 56324
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56324&view=rev
      Log:
      Update
      
      Modified:
          llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple?rev=56324&r1=56323&r2=56324&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple Thu Sep 18 19:16:21 2008
      @@ -1,3 +1,96 @@
      +2008-09-16  Fariborz Jahanian 
      +
      +	Radar 6214617
      +	* g++.apple/blocks-recovercpp.C: Add
      +
      +2008-09-16  Fariborz Jahanian 
      +
      +        Radar 6217257
      +	* gcc.apple/block-byref-dynamic-array.c: Add
      +
      +2008-09-12  Fariborz Jahanian 
      +	
      +	Radar 6212507
      +	* gcc.apple/format-security-attribute-3.c: Add
      +
      +2008-09-11  Fariborz Jahanian 
      +
      +	Radar 6212722
      +	* gcc.apple/block-dynamic-array.c: Add
      +	* g++.apple/block-dynamic-array.C: Add
      +
      +2008-09-11  Fariborz Jahanian 
      +
      +	Radar 5839123
      +	* objc.dg/comp-types-1.m: Modified
      +	* objc.dg/comp-types-10.m: Modified
      +	* objc.dg/comp-types-11.m: Modified
      +	* objc.dg/method-9.m: Modified
      +	* objc.dg/class-protocol-1.m: Modified
      +	* objc.dg/comp-types-6.m: Modified
      +	* obj-c++.dg/comp-types-7.mm: Modified
      +	* obj-c++.dg/comp-types-2.mm: Modified
      +	* obj-c++.dg/comp-types-11.mm: Modified
      +	* obj-c++.dg/comp-types-12.mm: Modified
      +	* obj-c++.dg/class-protocol-1.mm: Modified
      +
      +2008-09-11  Caroline Tice  
      +
      +        Radar 6066486
      +	* g++.apple/mips-linkage-name.C:  New testcase.
      +
      +2008-09-10  Fariborz Jahanian 
      +
      +	Radar 6209554
      +	* objc.dg/property-synthesize-ivar-3.m: Modified
      +	* objc.dg/property-synthesize-ivar-10.m: New
      +	* objc.dg/property-synthesize-ivar-32-5.m: Modified
      +	* objc.dg/property-synthesize-ivar-5.m: Modified
      +	* obj-c++.dg/property-synthesize-ivar-5.mm: Modified
      +	* obj-c++.dg/property-synthesize-ivar-32-5.mm: Modified
      +	* obj-c++.dg/property-synthesize-ivar-3.mm: Modified
      +	* obj-c++.dg/property-synthesize-ivar-10.mm: New
      +
      +2008-09-09  Fariborz Jahanian 
      +
      +	Radar 6191227
      +	*  objc.dg/objc2-warn-prev-osx-1.m: Modified.
      +
      +2008-09-09  Fariborz Jahanian 
      +
      +	Radar 6169580
      +	* g++.apple/block-reference-in-method.C: Add
      +	
      +2008-09-05  Fariborz Jahanian 
      +
      +	Radar 6169527
      +	* g++.apple/block-copyconstructor.C: Add
      +	* g++.apple/block-continuation.C: Modified
      +
      +2008-09-08 Fariborz Jahanian 
      +
      +	Radar 6064186
      +	* objc.dg/property-metadata-1.m: Modified
      +	* objc.dg/message-metadata-1.m: Modified
      +	* obj-c++.dg/property-metadata-1.mm: Modified
      +	* obj-c++.dg/objc2-instanceSizeStart-1.mm: Modified
      +	* obj-c++.dg/message-metadata-1.mm: Modified
      +
      +2008-09-05  Bill Wendling  
      +
      +        Radar 6194879
      +        * g++.dg/warn/anonymous-namespace-1.C: New.
      +        * g++.dg/warn/anonymous-namespace-1.h: New.
      +        * g++.dg/warn/anonymous-namespace-2.C: New.
      +        * g++.dg/warn/anonymous-namespace-2.h: New.
      +
      +2008-09-03  Fariborz Jahanian 
      +
      +	Radar 6185344
      +	* gcc.apple/block-explicit-return-type.c: Add
      +	* gcc.apple/block-literal.c: Modified
      +	* g++.apple/block-explicit-return-type.C: Add
      +
       2008-08-28  Fariborz Jahanian 
       
       	Radar 6180456
      
      
      
      
      From isanbard at gmail.com  Thu Sep 18 19:40:03 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 00:40:03 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56325 - in
       /llvm-gcc-4.2/trunk/gcc/testsuite: g++.apple/ g++.dg/tree-ssa/ gcc.apple/
       obj-c++.dg/ objc.dg/
      Message-ID: <200809190040.m8J0e4cX018492@zion.cs.uiuc.edu>
      
      Author: void
      Date: Thu Sep 18 19:40:03 2008
      New Revision: 56325
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56325&view=rev
      Log:
      Update tests to Apple's GCC version.
      
      Modified:
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-continuation.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-return.C
          llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/tree-ssa/ivopts-1.C
          llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-literal.c
          llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-return.c
          llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/class-protocol-1.mm
          llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-11.mm
          llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-12.mm
          llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-2.mm
          llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-7.mm
          llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/message-metadata-1.mm
          llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-instanceSizeStart-1.mm
          llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-metadata-1.mm
          llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-3.mm
          llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-32-5.mm
          llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-5.mm
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/class-protocol-1.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-1.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-10.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-11.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-6.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/message-metadata-1.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/method-9.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-warn-prev-osx-1.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-3.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-32-5.m
          llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-5.m
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-continuation.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/block-continuation.C?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-continuation.C (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-continuation.C Thu Sep 18 19:40:03 2008
      @@ -1,4 +1,5 @@
       /* APPLE LOCAL file radar 5732232 - blocks */
      +/* Modified for radar 6169527 */
       /* { dg-do compile } */
       /* { dg-options "-fblocks" } */
       
      @@ -10,9 +11,9 @@
       	break;		/* { dg-error "break statement not within loop or switch" } */
       	while (1) break;/* ok */
       	goto label1;	/* { dg-error "goto not allowed in block literal" } */
      -			/* { dg-error "label" "" { target *-*-* } 12 } */
      -      });
      -  label1:
      +			/* { dg-error "label" "" { target *-*-* } 13 } */
      +      });	/* { dg-error "enters" } */
      +  label1:	/* { dg-error "jump to label" } */
           break; /* OK */
           if (1)
             continue; /* OK */
      @@ -40,5 +41,5 @@
       	  break;
           }
         };
      -  goto label1;
      +  goto label1; /* { dg-error "from here" } */
       }
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-return.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.apple/block-return.C?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-return.C (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.apple/block-return.C Thu Sep 18 19:40:03 2008
      @@ -5,43 +5,55 @@
       typedef void (^CL)(void);
       
       CL foo() {
      +  short y;
      +  short (^add1)(void) = ^{ return y+1; };  /* { dg-error "cannot convert" } */
       
      -	short y;
      -        short (^add1)(void) = ^{ return y+1; };  /* { dg-error "cannot convert" } */
      -
      -	CL X = ^{if (2)
      -                   return;
      -           	 return 1;   /* { dg-error "void block should not return a value" } */
      -			     /* { dg-error "return-statement with a value" "" { target *-*-* } 14 } */
      -	 	};
      -
      -	int (^Y) (void)  = ^{ if (3)
      -	     	        return 1;
      -	   	       else
      -	     	        return;  /* { dg-error "non-void block should return a value" } */
      -	             };
      -
      -	char *(^Z)(void) = ^{ if (3)
      -             			return "";  /* { dg-error "cannot convert" } */
      -           		      else
      -             		       return (char*)0; /* { dg-error "incompatible type returning" } */ 
      -         		    };	/* { dg-error "cannot convert" } */
      -
      -        double (^A)(void) = ^ { if (1)
      -				 return (float)1.0;
      -				else
      -				  if (2)
      -				    return (double)2.0;  /* { dg-error "incompatible type returning" } */
      -				return 1;  /* { dg-error "incompatible type returning" } */
      -			      }; /* { dg-error "cannot convert" } */
      -        char *(^B)(void) =
      -		^{ if (3)
      -             	     return ""; /* { dg-error "cannot convert" } */
      -           	   else
      -             	    return 2; /* { dg-error "incompatible type returning" } */
      -         	};	     /* { dg-error "cannot convert" } */
      -
      -        return ^{ return 1; };  /* { dg-error "cannot convert" } */
      +  CL X = ^{
      +    if (2)
      +      return;
      +    return 1;		/* { dg-error "void block should not return a value" } */
      +  };
      +
      +  int (^Y) (void)  = ^{
      +    if (3)
      +      return 1;
      +    else
      +      return;		/* { dg-error "non-void block should return a value" } */
      +  };
      +
      +  char *(^Z)(void) = ^{
      +    if (3)
      +      return "";
      +    else
      +      return (char*)0;	/* { dg-error "incompatible type returning" } */ 
      +  };			/* { dg-error "cannot convert" } */
      +
      +  double (^A)(void) = ^ {
      +    if (1)
      +      return (float)1.0;
      +    else
      +      if (2)
      +	return (double)2.0;	/* { dg-error "incompatible type returning" } */
      +    return 1;		/* { dg-error "incompatible type returning" } */
      +  };			/* { dg-error "cannot convert" } */
      +  char *(^B)(void) = ^{
      +    if (3)
      +      return "";
      +    else
      +      return 2;		/* { dg-error "incompatible type returning" } */
      +  };			/* { dg-error "cannot convert" } */
      +
      +  __block int i;
      +  int& (^o)() = ^ int& {
      +    int &ri = i;
      +    return ri;
      +  };
      +
      +  int (^o1)() = ^ {
      +    int &ri = i;
      +    return ri;
      +  };
      +  o() = 1;
       
      +  return ^{ return 1; };	/* { dg-error "cannot convert" } */
       }
      -
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/tree-ssa/ivopts-1.C
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.dg/tree-ssa/ivopts-1.C?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/tree-ssa/ivopts-1.C (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/tree-ssa/ivopts-1.C Thu Sep 18 19:40:03 2008
      @@ -15,6 +15,8 @@
       }
       
       /* { dg-final { scan-tree-dump-not "-&x" "ivopts" } } */
      -/* { dg-final { scan-tree-dump-not "offset: -4B" "ivopts" { xfail i?86-*-* x86_64-*-* hppa*-*-* } } } */
      -/* { dg-final { scan-tree-dump-not "&x\\\[5\\\]" "ivopts" { xfail i?86-*-* x86_64-*-* hppa*-*-* } } } */
      +/* APPLE LOCAL begin 5431747 */
      +/* { dg-final { scan-tree-dump-not "offset: -4B" "ivopts" { xfail hppa*-*-* } } } */
      +/* { dg-final { scan-tree-dump-not "&x\\\[5\\\]" "ivopts" { xfail hppa*-*-* } } } */
      +/* APPLE LOCAL end 5431747 */
       /* { dg-final { cleanup-tree-dump "ivopts" } } */
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-literal.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-literal.c?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-literal.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-literal.c Thu Sep 18 19:40:03 2008
      @@ -23,7 +23,8 @@
       
         I(^{ });
       
      -  noop = ^noop /* { dg-error "blocks require" } */
      +  noop = ^noop /* { dg-error "expected specifier" } */ 
      +	       /*  { dg-error "blocks require" "" { target *-*-* } 26 } */
           ;  /* { dg-error "argument list is required for block expression literals" } */
       
         return ^{printf("\nBlock\n"); };  /* { dg-error "returning block that lives on the local stack" } */
      @@ -35,7 +36,8 @@
         takeblock(^{ printf("%d\n", x); });
         takeblock(^{ x = 4; });  /* { dg-error "assignment of read-only variable" } */
       
      -  takeblock(^test2() /* { dg-error "blocks require" } */
      +  takeblock(^test2() /* { dg-error "expected specifier" } */  
      +		     /* { dg-error "blocks require" "" { target *-*-* } 39 } */
       	    );	/* { dg-error "argument list is required for block expression literals" } */
       
         takeblock(^(void)(void)printf("hello world!\n")); /* { dg-error "blocks require" } */
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-return.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-return.c?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-return.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.apple/block-return.c Thu Sep 18 19:40:03 2008
      @@ -5,43 +5,44 @@
       typedef void (^CL)(void);
       
       CL foo() {
      +  short y;
      +  short (^add1)(void) = ^{ return y+1; };  /* { dg-error "incompatible block pointer types initializing" } */
       
      -	short y;
      -        short (^add1)(void) = ^{ return y+1; };  /* { dg-error "incompatible block pointer types initializing" } */
      -
      -	CL X = ^{if (2)
      -                   return;
      -           	 return 1;   /* { dg-error "void block should not return a value" } */
      -	 	};
      -
      -	int (^Y) (void)  = ^{ if (3)
      -	     	        return 1;
      -	   	       else
      -	     	        return;  /* { dg-error "non-void block should return a value" } */
      -	             };
      -
      -	char *(^Z)(void) = ^{ if (3)
      -             			return "";
      -           		      else
      -             		       return (char*)0;
      -         		    };
      -
      -        double (^A)(void) = ^ { if (1)
      -				 return (float)1.0;
      -				else
      -				  if (2)
      -				    return (double)2.0;  /* { dg-error "incompatible type returning" } */
      -				return 1;  /* { dg-error "incompatible type returning" } */
      -			      }; /* { dg-error "incompatible block pointer types initializing" } */
      -        char *(^B)(void) =
      -		^{ if (3)
      -             	     return "";
      -           	   else
      -             	    return 2; /* { dg-error "incompatible type returning" } */
      -			      /* { dg-warning "return makes pointer from integer without a cast" "" { target *-*-* } 40 } */
      -         	};
      -
      -        return ^{ return 1; };  /* { dg-error "incompatible block pointer types initializing" } */
      +  CL X = ^{
      +    if (2)
      +      return;
      +    return 1;		/* { dg-error "void block should not return a value" } */
      +  };
      +
      +  int (^Y) (void)  = ^{
      +    if (3)
      +      return 1;
      +    else
      +      return;		/* { dg-error "non-void block should return a value" } */
      +  };
      +
      +  char *(^Z)(void) = ^{
      +    if (3)
      +      return "";
      +    else
      +      return (char*)0;
      +  };
      +
      +  double (^A)(void) = ^ {
      +    if (1)
      +      return (float)1.0;
      +    else
      +      if (2)
      +	return (double)2.0;	/* { dg-error "incompatible type returning" } */
      +    return 1;		/* { dg-error "incompatible type returning" } */
      +  };			/* { dg-error "incompatible block pointer types initializing" } */
      +  char *(^B)(void) = ^{
      +    if (3)
      +      return "";
      +    else
      +      return 2;		/* { dg-error "incompatible type returning" } */
      +			/* { dg-warning "return makes pointer from integer without a cast" "" { target *-*-* } 43 } */
      +  };
       
      +  return ^{ return 1; };	/* { dg-error "incompatible block pointer types initializing" } */
       }
      -
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/class-protocol-1.mm
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/class-protocol-1.mm?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/class-protocol-1.mm (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/class-protocol-1.mm Thu Sep 18 19:40:03 2008
      @@ -1,4 +1,4 @@
      -
      +/* APPLE LOCAL file radar 5839123 */
       /* Check Class  types */
       /* Author: David Ayers  */
       /* { dg-do compile } */
      @@ -176,7 +176,7 @@
       
       @protocol FwProto;
       /* APPLE LOCAL radar 4398221 */
      - at interface MyClass1 (Forward)   /* { dg-warning "no definition of protocol \\'FwProto\\' " } */
      + at interface MyClass1 (Forward)  /* { dg-warning "no definition of protocol \\'FwProto\\' " } */
       @end
       
       Class  clsP7 = 0;
      @@ -327,8 +327,8 @@
           objP1 == cls; /* { dg-warning "lacks a cast" } */
         }
         { /* id , non-ObjC  */
      -    num == objP1; /* { dg-warning "between pointer" } */
      -    objP1 == num; /* { dg-warning "between pointer" } */
      +    num == objP1; /* { dg-error "between pointer" } */
      +    objP1 == num; /* { dg-error "between pointer" } */
       
           ptr == objP1;
           objP1 == ptr;
      @@ -383,12 +383,12 @@
           objP1 = obj;
         }
         { /* id , Class  */
      -    cls = objP1; /* { dg-warning "distinct Objective\\-C type" } */
      -    objP1 = cls; /* { dg-warning "distinct Objective\\-C type" } */
      +    cls = objP1; /* { dg-warning "incompatible Objective-C types assigning \\'objc_object\\*\\', expected \\'objc_class\\*\\'" } */
      +    objP1 = cls; /* { dg-warning "incompatible Objective-C types assigning \\'objc_class\\*\\', expected \\'objc_object\\*\\'" } */
         }
         { /* id , non-ObjC  */
      -    num = objP1; /* { dg-error "invalid conversion" } */
      -    objP1 = num; /* { dg-error "invalid conversion" } */
      +    num = objP1; /* { dg-warning "invalid conversion" } */
      +    objP1 = num; /* { dg-warning "invalid conversion" } */
       
           ptr = objP1;
           objP1 = ptr; /* { dg-error "invalid conversion" } */
      @@ -402,11 +402,11 @@
         }
         { /* Class , SomeClass * */
           /* These combinations should always elicit a warning.  */
      -    mc1 = clsP1; /* { dg-warning "distinct Objective\\-C type" } */
      -    clsP1 = mc1; /* { dg-warning "distinct Objective\\-C type" } */
      +    mc1 = clsP1; /* { dg-warning "incompatible Objective-C types assigning \\'objc_class\\*\\', expected \\'MyClass1\\*\\'" } */
      +    clsP1 = mc1; /* { dg-warning "incompatible Objective-C types assigning \\'MyClass1\\*\\', expected \\'objc_class\\*\\'" } */
           
      -    mc1 = clsP2; /* { dg-warning "distinct Objective\\-C type" } */
      -    clsP2 = mc1; /* { dg-warning "distinct Objective\\-C type" } */
      +    mc1 = clsP2; /* { dg-warning "incompatible Objective-C types assigning \\'objc_class\\*\\', expected \\'MyClass1\\*\\'" } */
      +    clsP2 = mc1; /* { dg-warning "incompatible Objective-C types assigning \\'MyClass1\\*\\', expected \\'objc_class\\*\\'" } */
         }
         { /* Class , id */
           obj = clsP1;
      @@ -424,8 +424,8 @@
           clsP1 = ptr; /* { dg-error "invalid conversion" } */
         }
         { /* Class , id  */
      -    clsP1 = objP1; /* { dg-warning "distinct Objective\\-C type" } */
      -    objP1 = clsP1; /* { dg-warning "distinct Objective\\-C type" } */
      +    clsP1 = objP1; /* { dg-warning "incompatible Objective-C types assigning \\'objc_object\\*\\', expected \\'objc_class\\*\\'" } */
      +    objP1 = clsP1; /* { dg-warning "incompatible Objective-C types assigning \\'objc_class\\*\\', expected \\'objc_object\\*\\'" } */
         }
       }
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-11.mm
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/comp-types-11.mm?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-11.mm (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-11.mm Thu Sep 18 19:40:03 2008
      @@ -25,7 +25,7 @@
       @implementation Derived2
       + (Derived1 *)new {
         Derived2 *o = [super new];
      -  return o;  /* { dg-warning "distinct Objective\\-C type in return" } */
      +  return o;  /* { dg-warning "incompatible Objective-C types returning \\'Derived2\\*\\', expected \\'Derived1\\*\\'" } */
       }
       @end
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-12.mm
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/comp-types-12.mm?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-12.mm (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-12.mm Thu Sep 18 19:40:03 2008
      @@ -9,7 +9,7 @@
       extern Object* foo(void);
       static Derived *test(void)
       {
      -   Derived *m = foo();   /* { dg-warning "initialization from distinct Objective\\-C type" } */
      +   Derived *m = foo();   /* { dg-warning "incompatible Objective-C types initializing \\'Object\\*\\', expected \\'Derived\\*\\'" } */
       
          return m;
       }
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-2.mm
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/comp-types-2.mm?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-2.mm (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-2.mm Thu Sep 18 19:40:03 2008
      @@ -1,3 +1,4 @@
      +/* APPLE LOCAL file radar 5839123 */
       /* Test various ObjC types assignments and comparisons.  */
       /* Author: Nicola Pero .  */
       /* { dg-do compile } */
      @@ -33,9 +34,9 @@
         /* Assigning to a 'MyClass *' variable should always generate a
            warning, unless done from an 'id'.  */
         obj_c = obj;    /* Ok */
      -  obj_c = obj_p;  /* { dg-warning "distinct Objective\\-C type" } */
      -  obj_c = obj_cp; /* { dg-warning "distinct Objective\\-C type" } */
      -  obj_c = obj_C;  /* { dg-warning "distinct Objective\\-C type" } */
      +  obj_c = obj_p;  /* { dg-warning "incompatible Objective-C types assigning \\'objc_object\\*\\', expected \\'MyClass\\*\\'" } */
      +  obj_c = obj_cp; /* { dg-warning "incompatible Objective-C types assigning \\'MyOtherClass\\*\\', expected \\'MyClass\\*\\'" } */
      +  obj_c = obj_C;  /* { dg-warning "incompatible Objective-C types assigning \\'objc_class\\*\\', expected \\'MyClass\\*\\'" } */
       
         /* Assigning to an 'id' variable should generate a
            warning if done from a 'MyClass *' (which doesn't implement
      @@ -44,15 +45,15 @@
         obj_p = obj;    /* Ok */
         obj_p = obj_c;  /* { dg-warning "does not implement" } */
         obj_p = obj_cp; /* Ok  */
      -  obj_p = obj_C;  /* { dg-warning "distinct Objective\\-C type" } */
      +  obj_p = obj_C;  /* { dg-warning "incompatible Objective-C types assigning \\'objc_class\\*\\', expected \\'objc_object\\*\\'" } */
       
         /* Assigning to a 'MyOtherClass *' variable should always generate
            a warning, unless done from an 'id' or an 'id' (since
            MyOtherClass implements MyProtocol).  */
         obj_cp = obj;    /* Ok */
      -  obj_cp = obj_c;  /* { dg-warning "distinct Objective\\-C type" } */
      +  obj_cp = obj_c;  /* { dg-warning "incompatible Objective-C types assigning \\'MyClass\\*\\', expected \\'MyOtherClass\\*\\'" } */
         obj_cp = obj_p;  /* Ok */
      -  obj_cp = obj_C;  /* { dg-warning "distinct Objective\\-C type" } */
      +  obj_cp = obj_C;  /* { dg-warning "incompatible Objective-C types assigning \\'objc_class\\*\\', expected \\'MyOtherClass\\*\\'" } */
       
         /* Any comparison involving an 'id' must be without warnings.  */
         if (obj == obj_p) ;  /* Ok  */ /*Bogus warning here in 2.95.4*/
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-7.mm
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/comp-types-7.mm?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-7.mm (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/comp-types-7.mm Thu Sep 18 19:40:03 2008
      @@ -1,3 +1,4 @@
      +/* APPLE LOCAL file radar 5839123 */
       /* Test assignments and comparisons involving category protocols.  */
       /* Author: Nicola Pero .  */
       /* { dg-do compile } */
      @@ -24,8 +25,8 @@
         MyClass *obj_cp = nil;
         MyOtherClass *obj_cp2 = nil;
       
      -  obj_cp = obj_p;  /* { dg-warning "distinct Objective\\-C type" } */
      -  obj_cp2 = obj_p; /* { dg-warning "distinct Objective\\-C type" } */
      +  obj_cp = obj_p;  /* { dg-warning "incompatible Objective-C types assigning \\'objc_object\\*\\', expected \\'MyClass\\*\\'" } */
      +  obj_cp2 = obj_p; /* { dg-warning "incompatible Objective-C types assigning \\'objc_object\\*\\', expected \\'MyOtherClass\\*\\'" } */
         obj_p = obj_cp;  /* Ok */
         obj_p = obj_cp2; /* Ok */
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/message-metadata-1.mm
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/message-metadata-1.mm?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/message-metadata-1.mm (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/message-metadata-1.mm Thu Sep 18 19:40:03 2008
      @@ -1,6 +1,6 @@
      -/* APPLE LOCAL file radar 4582204 */
      +/* APPLE LOCAL file radar 4582204 - radar 5575115 */
       /* Test that message_ref_t meta-data is generated for for objc and obj-c++ */
      -/* { dg-options "-fobjc-abi-version=2 -mmacosx-version-min=10.5" } */
      +/* { dg-options "-fobjc-abi-version=2 -mmacosx-version-min=10.6" } */
       /* { dg-do compile } */
       /* APPLE LOCAL ARM hybrid ABI */
       /* { dg-skip-if "" { arm*-*-darwin* } { "*" } { "" } } */
      @@ -11,4 +11,4 @@
       int main() {
           [Foo class];
       }
      -/* { dg-final { scan-assembler "OBJC_MESSAGE_REF.*:" } } */
      +/* { dg-final { scan-assembler "l_objc_msgSend_fixup.*:" } } */
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-instanceSizeStart-1.mm
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/objc2-instanceSizeStart-1.mm?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-instanceSizeStart-1.mm (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-instanceSizeStart-1.mm Thu Sep 18 19:40:03 2008
      @@ -1,6 +1,6 @@
      -/* APPLE LOCAL file radar 5333233 */
      +/* APPLE LOCAL file radar 5333233  - radar 6064186 */
       /* { dg-do compile { target powerpc*-*-darwin* i?86*-*-darwin* } } */
      -/* { dg-options "-mmacosx-version-min=10.5 -m64" } */
      +/* { dg-options "-mmacosx-version-min=10.6 -m64" } */
       
       @interface Super { id isa; } @end
       @implementation Super @end
      @@ -11,4 +11,4 @@
       @implementation SubNoIvars @end
       
       int main() { return 0; }
      -/* { dg-final { scan-assembler "L_ZL27_OBJC_CLASS_RO_\\\$_SubNoIvars:\n\t.long\t0\n\t.long\t8\n\t.long\t8" } } */
      +/* { dg-final { scan-assembler "l_OBJC_CLASS_RO_\\\$_SubNoIvars:\n\t.long\t0\n\t.long\t8\n\t.long\t8" } } */
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-metadata-1.mm
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/property-metadata-1.mm?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-metadata-1.mm (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-metadata-1.mm Thu Sep 18 19:40:03 2008
      @@ -1,9 +1,9 @@
      -/* APPLE LOCAL file radar 4695101 */
      +/* APPLE LOCAL file radar 4695101 - radar 6064186 */
       /* Test that @implementation  syntax generates metadata for properties 
          declared in @protocol, as well as those declared in the @interface. */
      -/* { dg-do compile { target *-*-darwin* } } */
      +/* { dg-do compile { target powerpc*-*-darwin* i?86*-*-darwin* } } */
       /* APPLE LOCAL radar 4899595 */
      -/* { dg-options "-mmacosx-version-min=10.5 -m64" { target powerpc*-*-darwin* i?86*-*-darwin* } } */
      +/* { dg-options "-mmacosx-version-min=10.6 -m64" } */
       
       @protocol GCObject
       @property(readonly) unsigned long int instanceSize;
      @@ -23,6 +23,6 @@
       @end
       
       /* LLVM LOCAL begin accept llvm syntax */
      -/* { dg-final { scan-assembler "L_.*OBJC_\\\$_PROP_LIST_GCObject:" } } */
      -/* { dg-final { scan-assembler "L_.*OBJC_\\\$_PROP_PROTO_LIST_GCObject:" } } */
      +/* { dg-final { scan-assembler "l_.*OBJC_\\\$_PROP_LIST_GCObject:" } } */
      +/* { dg-final { scan-assembler "l_.*OBJC_\\\$_PROP_PROTO_LIST_GCObject:" } } */
       /* LLVM LOCAL end */
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-3.mm
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/property-synthesize-ivar-3.mm?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-3.mm (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-3.mm Thu Sep 18 19:40:03 2008
      @@ -1,6 +1,6 @@
       /* APPLE LOCAL file radar 5435299 */
       /* Multiple @synthesize of a single property is error. */
      -/* { dg-options "-fnew-property-ivar-synthesis -mmacosx-version-min=10.5" { target powerpc*-*-darwin* i?86*-*-darwin* } } */
      +/* { dg-options "-mmacosx-version-min=10.5 -fnew-property-ivar-synthesis" { target powerpc*-*-darwin* i?86*-*-darwin* } } */
       /* { dg-options "-fnew-property-ivar-synthesis -fobjc-new-property" { target arm*-*-darwin* } } */
       /* { dg-do compile { target *-*-darwin* } } */
       
      @@ -13,7 +13,7 @@
       @property int prop;
       @end
       @implementation Test3
      - at synthesize prop;
      + at synthesize prop;	/* { dg-error "previous property declaration of \\'prop\\' was here" } */
       @synthesize prop;  /* { dg-error "synthesized properties \\'prop\\' and \\'prop\\' both claim ivar \\'prop\\'" } */
       		   /* { dg-error "property \\'prop\\' is already implemented" "" { target *-*-* } 17 } */
       @end
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-32-5.mm
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/property-synthesize-ivar-32-5.mm?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-32-5.mm (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-32-5.mm Thu Sep 18 19:40:03 2008
      @@ -14,7 +14,7 @@
       @property int prop2;
       @end
       @implementation Test5_1
      - at synthesize ivar;
      + at synthesize ivar; /* { dg-error "previous property declaration of \\'ivar\\' was here" } */
       @synthesize prop2 = ivar; /* { dg-error "synthesized properties \\'prop2\\' and \\'ivar\\' both claim ivar \\'ivar\\'" } */
       @end
       
      @@ -26,7 +26,7 @@
       @property int ivar;
       @end
       @implementation Test5_2
      - at synthesize prop2 = ivar;
      + at synthesize prop2 = ivar;  /* { dg-error "previous property declaration of \\'prop2\\' was here" } */
       @synthesize ivar; /* { dg-error "synthesized properties \\'ivar\\' and \\'prop2\\' both claim ivar \\'ivar\\'" } */
       @end
       
      @@ -38,6 +38,6 @@
       @property int prop2;
       @end
       @implementation Test5_3
      - at synthesize prop1 = ivar;
      + at synthesize prop1 = ivar;  /* { dg-error "previous property declaration of \\'prop1\\' was here" } */
       @synthesize prop2 = ivar; /* { dg-error "synthesized properties \\'prop2\\' and \\'prop1\\' both claim ivar \\'ivar\\'" } */
       @end
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-5.mm
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/property-synthesize-ivar-5.mm?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-5.mm (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-synthesize-ivar-5.mm Thu Sep 18 19:40:03 2008
      @@ -16,7 +16,7 @@
       @property int prop2;
       @end
       @implementation Test5_1
      - at synthesize ivar;
      + at synthesize ivar;	/* { dg-error "previous property declaration of \\'ivar\\' was here" } */
       @synthesize prop2 = ivar; /* { dg-error "synthesized properties \\'prop2\\' and \\'ivar\\' both claim ivar \\'ivar\\'" } */
       @end
       
      @@ -28,7 +28,7 @@
       @property int ivar;
       @end
       @implementation Test5_2
      - at synthesize prop2 = ivar;
      + at synthesize prop2 = ivar;	/* { dg-error "previous property declaration of \\'prop2\\' was here" } */
       @synthesize ivar; /* { dg-error "synthesized properties \\'ivar\\' and \\'prop2\\' both claim ivar \\'ivar\\'" } */
       @end
       
      @@ -40,7 +40,7 @@
       @property int prop2;
       @end
       @implementation Test5_3
      - at synthesize prop1 = ivar;
      + at synthesize prop1 = ivar; /* { dg-error "previous property declaration of \\'prop1\\' was here" } */
       @synthesize prop2 = ivar; /* { dg-error "synthesized properties \\'prop2\\' and \\'prop1\\' both claim ivar \\'ivar\\'" } */
       @end
       
      @@ -50,7 +50,7 @@
       @property int prop2;
       @end
       @implementation Test5_4
      - at synthesize prop1;
      + at synthesize prop1; /* { dg-error "previous property declaration of \\'prop1\\' was here" } */
       @synthesize prop2 = prop1; /* { dg-error "synthesized properties \\'prop2\\' and \\'prop1\\' both claim ivar \\'prop1\\'" } */
       @end
       
      @@ -59,7 +59,7 @@
       @property int prop2;
       @end
       @implementation Test5_5
      - at synthesize prop1 = prop2;
      + at synthesize prop1 = prop2;  /* { dg-error "previous property declaration of \\'prop1\\' was here" } */
       @synthesize prop2; /* { dg-error "synthesized properties \\'prop2\\' and \\'prop1\\' both claim ivar \\'prop2\\'" } */
       @end
       
      @@ -68,7 +68,7 @@
       @property int prop2;
       @end
       @implementation Test5_6
      - at synthesize prop1 = ivar;
      + at synthesize prop1 = ivar; /* { dg-error "previous property declaration of \\'prop1\\' was here" } */
       @synthesize prop2 = ivar; /* { dg-error "synthesized properties \\'prop2\\' and \\'prop1\\' both claim ivar \\'ivar\\'" } */
       @end
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/class-protocol-1.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/class-protocol-1.m?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/class-protocol-1.m (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/class-protocol-1.m Thu Sep 18 19:40:03 2008
      @@ -1,3 +1,4 @@
      +/* APPLE LOCAL file radar 5839123 */
       /* Check Class  types */
       /* Author: David Ayers  */
       /* { dg-do compile } */
      @@ -187,9 +188,9 @@
         [cls doItInstance7];      /* { dg-warning "no .\\+doItInstance7. method found" } */
       
         [clsP7 doItClass7];       /* { dg-warning "not found in protocol" } */
      -  /* { dg-warning "no .\\+doItClass7. method found" "" { target *-*-* } 189 } */
      +  /* { dg-warning "no .\\+doItClass7. method found" "" { target *-*-* } 190 } */
         [clsP7 doItInstance7];    /* { dg-warning "not found in protocol" } */
      -  /* { dg-warning "no .\\+doItInstance7. method found" "" { target *-*-* } 191 } */
      +  /* { dg-warning "no .\\+doItInstance7. method found" "" { target *-*-* } 192 } */
       
         [MyClass1 doItClass7];    /* { dg-warning "may not respond" } */
         [MyClass1 doItInstance7]; /* { dg-warning "may not respond" } */
      @@ -382,8 +383,8 @@
           objP1 = obj;
         }
         { /* id , Class  */
      -    cls = objP1; /* { dg-warning "distinct Objective\\-C type" } */
      -    objP1 = cls; /* { dg-warning "distinct Objective\\-C type" } */
      +    cls = objP1; /* { dg-warning "incompatible Objective-C types assigning \\'id\\', expected \\'Class\\'" } */
      +    objP1 = cls; /* { dg-warning "incompatible Objective-C types assigning \\'Class\\', expected \\'id\\'" } */
         }
         { /* id , non-ObjC  */
           num = objP1; /* { dg-warning "makes integer" } */
      @@ -401,11 +402,11 @@
         }
         { /* Class , SomeClass * */
           /* These combinations should always elicit a warning.  */
      -    mc1 = clsP1; /* { dg-warning "distinct Objective\\-C type" } */
      -    clsP1 = mc1; /* { dg-warning "distinct Objective\\-C type" } */
      +    mc1 = clsP1; /* { dg-warning "incompatible Objective-C types assigning \\'Class\\', expected \\'struct MyClass1 \\*\\'" } */
      +    clsP1 = mc1; /* { dg-warning "incompatible Objective-C types assigning \\'struct MyClass1 \\*\\', expected \\'Class\\'" } */
           
      -    mc1 = clsP2; /* { dg-warning "distinct Objective\\-C type" } */
      -    clsP2 = mc1; /* { dg-warning "distinct Objective\\-C type" } */
      +    mc1 = clsP2; /* { dg-warning "incompatible Objective-C types assigning \\'Class\\', expected \\'struct MyClass1 \\*\\'" } */
      +    clsP2 = mc1; /* { dg-warning "incompatible Objective-C types assigning \\'struct MyClass1 \\*\\', expected \\'Class\\'" } */
         }
         { /* Class , id */
           obj = clsP1;
      @@ -423,8 +424,8 @@
           clsP1 = ptr;
         }
         { /* Class , id  */
      -    clsP1 = objP1; /* { dg-warning "distinct Objective\\-C type" } */
      -    objP1 = clsP1; /* { dg-warning "distinct Objective\\-C type" } */
      +    clsP1 = objP1; /* { dg-warning "incompatible Objective-C types assigning \\'id\\', expected \\'Class\\'" } */
      +    objP1 = clsP1; /* { dg-warning "incompatible Objective-C types assigning \\'Class\\', expected \\'id\\'" } */
         }
       }
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-1.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-1.m?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-1.m (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-1.m Thu Sep 18 19:40:03 2008
      @@ -1,3 +1,4 @@
      +/* APPLE LOCAL file radar 5839123 */
       /* Test various ObjC types assignments and comparisons.  */
       /* Author: Nicola Pero .  */
       /* { dg-do compile } */
      @@ -32,9 +33,9 @@
         /* Assigning to a 'MyClass *' variable should always generate a
            warning, unless done from an 'id'.  */
         obj_c = obj;    /* Ok */
      -  obj_c = obj_p;  /* { dg-warning "distinct Objective\\-C type" } */
      -  obj_c = obj_cp; /* { dg-warning "distinct Objective\\-C type" } */
      -  obj_c = obj_C;  /* { dg-warning "distinct Objective\\-C type" } */
      +  obj_c = obj_p;  /* { dg-warning "incompatible Objective-C types assigning \\'id\\', expected \\'struct MyClass \\*\\'" } */
      +  obj_c = obj_cp; /* { dg-warning "incompatible Objective-C types assigning \\'struct MyOtherClass \\*\\', expected \\'struct MyClass \\*\\'" } */
      +  obj_c = obj_C;  /* { dg-warning "incompatible Objective-C types assigning \\'Class\\', expected \\'struct MyClass \\*\\'" } */
       
         /* Assigning to an 'id' variable should generate a
            warning if done from a 'MyClass *' (which doesn't implement
      @@ -43,15 +44,15 @@
         obj_p = obj;    /* Ok */
         obj_p = obj_c;  /* { dg-warning "does not implement" } */
         obj_p = obj_cp; /* Ok  */
      -  obj_p = obj_C;  /* { dg-warning "distinct Objective\\-C type" } */
      +  obj_p = obj_C;  /* { dg-warning "incompatible Objective-C types assigning \\'Class\\', expected \\'id\\'" } */
       
         /* Assigning to a 'MyOtherClass *' variable should always generate
            a warning, unless done from an 'id' or an 'id' (since
            MyOtherClass implements MyProtocol).  */
         obj_cp = obj;    /* Ok */
      -  obj_cp = obj_c;  /* { dg-warning "distinct Objective\\-C type" } */
      +  obj_cp = obj_c;  /* { dg-warning "incompatible Objective-C types assigning \\'struct MyClass \\*\\', expected \\'struct MyOtherClass \\*\\'" } */
         obj_cp = obj_p;  /* Ok */
      -  obj_cp = obj_C;  /* { dg-warning "distinct Objective\\-C type" } */
      +  obj_cp = obj_C;  /* { dg-warning "incompatible Objective-C types assigning \\'Class\\', expected \\'struct MyOtherClass \\*\\'" } */
       
         /* Any comparison involving an 'id' must be without warnings.  */
         if (obj == obj_p) ;  /* Ok  */ /*Bogus warning here in 2.95.4*/
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-10.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-10.m?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-10.m (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-10.m Thu Sep 18 19:40:03 2008
      @@ -25,7 +25,7 @@
       @implementation Derived2
       + (Derived1 *)new {
         Derived2 *o = [super new];
      -  return o;  /* { dg-warning "distinct Objective\\-C type in return" } */
      +  return o;  /* { dg-warning "incompatible Objective-C types returning \\'struct Derived2 \\*\\', expected \\'struct Derived1 \\*\\'" } */
       }
       @end
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-11.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-11.m?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-11.m (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-11.m Thu Sep 18 19:40:03 2008
      @@ -1,3 +1,4 @@
      +/* APPLE LOCAL file radar 5839123 */
       /* { dg-do compile } */
       #include 
       
      @@ -7,7 +8,7 @@
       extern Object* foo(void);
       static Derived *test(void)
       {
      -   Derived *m = foo();   /* { dg-warning "initialization from distinct Objective\\-C type" } */
      +   Derived *m = foo();   /* { dg-warning "incompatible Objective-C types initializing \\'struct Object \\*\\', expected \\'struct Derived \\*\\'" } */
       
          return m;
       }
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-6.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-6.m?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-6.m (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/comp-types-6.m Thu Sep 18 19:40:03 2008
      @@ -1,3 +1,4 @@
      +/* APPLE LOCAL file radar 5839123 */
       /* Test assignments and comparisons involving category protocols.  */
       /* Author: Nicola Pero .  */
       /* { dg-do compile } */
      @@ -24,8 +25,8 @@
         MyClass *obj_cp = nil;
         MyOtherClass *obj_cp2 = nil;
       
      -  obj_cp = obj_p;  /* { dg-warning "distinct Objective\\-C type" } */
      -  obj_cp2 = obj_p; /* { dg-warning "distinct Objective\\-C type" } */
      +  obj_cp = obj_p;  /* { dg-warning "incompatible Objective-C types assigning \\'id\\', expected \\'struct MyClass \\*\\'" } */
      +  obj_cp2 = obj_p; /* { dg-warning "incompatible Objective-C types assigning \\'id\\', expected \\'struct MyOtherClass \\*\\'" } */
         obj_p = obj_cp;  /* Ok */
         obj_p = obj_cp2; /* Ok */
       
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/message-metadata-1.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/message-metadata-1.m?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/message-metadata-1.m (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/message-metadata-1.m Thu Sep 18 19:40:03 2008
      @@ -1,6 +1,6 @@
      -/* APPLE LOCAL file radar 4582204 */
      +/* APPLE LOCAL file radar 4582204 - radar 5575115 */
       /* Test that message_ref_t meta-data is generated for for objc and obj-c++ */
      -/* { dg-options "-fobjc-abi-version=2 -mmacosx-version-min=10.5" { target powerpc*-*-darwin* i?86*-*-darwin* } } */
      +/* { dg-options "-fobjc-abi-version=2 -mmacosx-version-min=10.6" { target powerpc*-*-darwin* i?86*-*-darwin* } } */
       /* { dg-options "-fno-objc-legacy-dispatch" { target arm*-*-darwin* } } */
       /* { dg-do compile } */
       
      @@ -10,4 +10,4 @@
       int main() {
           [Foo class];
       }
      -/* { dg-final { scan-assembler "OBJC_MESSAGE_REF.*:" } } */
      +/* { dg-final { scan-assembler "l_objc_msgSend_fixup.*:" } } */
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/method-9.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/method-9.m?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/method-9.m (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/method-9.m Thu Sep 18 19:40:03 2008
      @@ -39,7 +39,7 @@
       
            /* The following warning is a consequence of picking the "wrong" method signature.  */
            /* APPLE LOCAL mainline */
      -     /* { dg-warning "passing argument 1 of .initWithData:. from distinct Objective\\-C type" "" { target *-*-* } 34 } */
      +     /* { dg-warning "incompatible Objective-C types \\'id\\', expected \\'struct Object \\*\\' when passing argument 1 of \\'initWithData:\\' from distinct" "" { target *-*-* } 34 } */
           return result;
       }
       @end
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-warn-prev-osx-1.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-warn-prev-osx-1.m?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-warn-prev-osx-1.m (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-warn-prev-osx-1.m Thu Sep 18 19:40:03 2008
      @@ -1,6 +1,6 @@
       /* APPLE LOCAL file radar 4531086 */
       /* Test for warning on usage of objc2 features on older os's. */
      -/* { dg-options "-mmacosx-version-min=10.5 -fobjc-abi-version=2 -fobjc-new-property -mmacosx-version-min=10.4 -std=c99" } */
      +/* { dg-options "-mmacosx-version-min=10.4 -fobjc-abi-version=2 -fobjc-new-property -std=c99" } */
       /* { dg-do compile { target powerpc*-*-darwin* i?86*-*-darwin* } } */
       
       #include 
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-metadata-1.m Thu Sep 18 19:40:03 2008
      @@ -1,9 +1,9 @@
      -/* APPLE LOCAL file radar 4695101 */
      +/* APPLE LOCAL file radar 4695101 - radar 6064186 */
       /* Test that @implementation  syntax generates metadata for properties 
          declared in @protocol, as well as those declared in the @interface. */
       /* { dg-do compile { target powerpc*-*-darwin* i?86*-*-darwin* } } */
       /* APPLE LOCAL radar 4899595 */
      -/* { dg-options "-mmacosx-version-min=10.5 -m64" } */
      +/* { dg-options "-mmacosx-version-min=10.6 -m64" } */
       
       @protocol GCObject
       @property(readonly) unsigned long int instanceSize;
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-3.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-3.m?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-3.m (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-3.m Thu Sep 18 19:40:03 2008
      @@ -13,7 +13,7 @@
       @property int prop;
       @end
       @implementation Test3
      - at synthesize prop;
      + at synthesize prop;	/* { dg-error "previous property declaration of \\'prop\\' was here" } */
       @synthesize prop;  /* { dg-error "synthesized properties \\'prop\\' and \\'prop\\' both claim ivar \\'prop\\'" } */
       		   /* { dg-error "property \\'prop\\' is already implemented" "" { target *-*-* } 17 } */
       @end
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-32-5.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-32-5.m?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-32-5.m (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-32-5.m Thu Sep 18 19:40:03 2008
      @@ -14,7 +14,7 @@
       @property int prop2;
       @end
       @implementation Test5_1
      - at synthesize ivar;
      + at synthesize ivar; /* { dg-error "previous property declaration of \\'ivar\\' was here" } */
       @synthesize prop2 = ivar; /* { dg-error "synthesized properties \\'prop2\\' and \\'ivar\\' both claim ivar \\'ivar\\'" } */
       @end
       
      @@ -26,7 +26,7 @@
       @property int ivar;
       @end
       @implementation Test5_2
      - at synthesize prop2 = ivar;
      + at synthesize prop2 = ivar;  /* { dg-error "previous property declaration of \\'prop2\\' was here" } */
       @synthesize ivar; /* { dg-error "synthesized properties \\'ivar\\' and \\'prop2\\' both claim ivar \\'ivar\\'" } */
       @end
       
      @@ -38,6 +38,6 @@
       @property int prop2;
       @end
       @implementation Test5_3
      - at synthesize prop1 = ivar;
      + at synthesize prop1 = ivar;  /* { dg-error "previous property declaration of \\'prop1\\' was here" } */
       @synthesize prop2 = ivar; /* { dg-error "synthesized properties \\'prop2\\' and \\'prop1\\' both claim ivar \\'ivar\\'" } */
       @end
      
      Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-5.m
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-5.m?rev=56325&r1=56324&r2=56325&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-5.m (original)
      +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/property-synthesize-ivar-5.m Thu Sep 18 19:40:03 2008
      @@ -16,7 +16,7 @@
       @property int prop2;
       @end
       @implementation Test5_1
      - at synthesize ivar;
      + at synthesize ivar;	/* { dg-error "previous property declaration of \\'ivar\\' was here" } */
       @synthesize prop2 = ivar; /* { dg-error "synthesized properties \\'prop2\\' and \\'ivar\\' both claim ivar \\'ivar\\'" } */
       @end
       
      @@ -28,7 +28,7 @@
       @property int ivar;
       @end
       @implementation Test5_2
      - at synthesize prop2 = ivar;
      + at synthesize prop2 = ivar;	/* { dg-error "previous property declaration of \\'prop2\\' was here" } */
       @synthesize ivar; /* { dg-error "synthesized properties \\'ivar\\' and \\'prop2\\' both claim ivar \\'ivar\\'" } */
       @end
       
      @@ -40,7 +40,7 @@
       @property int prop2;
       @end
       @implementation Test5_3
      - at synthesize prop1 = ivar;
      + at synthesize prop1 = ivar; /* { dg-error "previous property declaration of \\'prop1\\' was here" } */
       @synthesize prop2 = ivar; /* { dg-error "synthesized properties \\'prop2\\' and \\'prop1\\' both claim ivar \\'ivar\\'" } */
       @end
       
      @@ -50,7 +50,7 @@
       @property int prop2;
       @end
       @implementation Test5_4
      - at synthesize prop1;
      + at synthesize prop1; /* { dg-error "previous property declaration of \\'prop1\\' was here" } */
       @synthesize prop2 = prop1; /* { dg-error "synthesized properties \\'prop2\\' and \\'prop1\\' both claim ivar \\'prop1\\'" } */
       @end
       
      @@ -59,7 +59,7 @@
       @property int prop2;
       @end
       @implementation Test5_5
      - at synthesize prop1 = prop2;
      + at synthesize prop1 = prop2;  /* { dg-error "previous property declaration of \\'prop1\\' was here" } */
       @synthesize prop2; /* { dg-error "synthesized properties \\'prop2\\' and \\'prop1\\' both claim ivar \\'prop2\\'" } */
       @end
       
      @@ -68,7 +68,7 @@
       @property int prop2;
       @end
       @implementation Test5_6
      - at synthesize prop1 = ivar;
      + at synthesize prop1 = ivar; /* { dg-error "previous property declaration of \\'prop1\\' was here" } */
       @synthesize prop2 = ivar; /* { dg-error "synthesized properties \\'prop2\\' and \\'prop1\\' both claim ivar \\'ivar\\'" } */
       @end
       
      
      
      
      
      From dalej at apple.com  Thu Sep 18 20:02:35 2008
      From: dalej at apple.com (Dale Johannesen)
      Date: Fri, 19 Sep 2008 01:02:35 -0000
      Subject: [llvm-commits] [llvm] r56326 - in /llvm/trunk:
       include/llvm/CodeGen/LiveInterval.h
       include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveInterval.cpp
       lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp
      Message-ID: <200809190102.m8J12ZW2019167@zion.cs.uiuc.edu>
      
      Author: johannes
      Date: Thu Sep 18 20:02:35 2008
      New Revision: 56326
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56326&view=rev
      Log:
      Remove AsmThatEarlyClobber etc. from LiveIntervalAnalysis
      and redo as linked list walk.  Logic moved into RA.
      Per review feedback.
      
      
      Modified:
          llvm/trunk/include/llvm/CodeGen/LiveInterval.h
          llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
          llvm/trunk/lib/CodeGen/LiveInterval.cpp
          llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
          llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      
      Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=56326&r1=56325&r2=56326&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Thu Sep 18 20:02:35 2008
      @@ -105,12 +105,17 @@
                                // if the top bits is set, it represents a stack slot.
           unsigned preference; // preferred register to allocate for this interval
           float weight;        // weight of this interval
      +    bool isEarlyClobber;
      +    bool overlapsEarlyClobber;
           Ranges ranges;       // the ranges in which this register is live
           VNInfoList valnos;   // value#'s
       
         public:
      -    LiveInterval(unsigned Reg, float Weight, bool IsSS = false)
      -      : reg(Reg), preference(0), weight(Weight) {
      +    LiveInterval(unsigned Reg, float Weight, bool IsSS = false, 
      +                 bool IsEarlyClobber = false, bool OverlapsEarlyClobber = false)
      +      : reg(Reg), preference(0), weight(Weight), 
      +        isEarlyClobber(IsEarlyClobber), 
      +        overlapsEarlyClobber(OverlapsEarlyClobber) {
             if (IsSS)
               reg = reg | (1U << (sizeof(unsigned)*8-1));
           }
      
      Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=56326&r1=56325&r2=56326&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Thu Sep 18 20:02:35 2008
      @@ -65,22 +65,6 @@
           AliasAnalysis *aa_;
           LiveVariables* lv_;
       
      -    /// AsmsWithEarlyClobber - maps a virtual register number to all the
      -    /// inline asm's that have the register marked earlyclobber.
      -    /// 
      -    std::multimap AsmsThatEarlyClobber;
      -
      -    /// AsmsWithEarlyClobberConflict - maps a virtual register number
      -    /// to all the inline asm's that have earlyclobber operands elsewhere
      -    /// and use the register as a (non-earlyclobber) input.
      -    ///
      -    /// Note: earlyclobber operands may not be assigned the same register as
      -    /// each other, or as earlyclobber-conflict operands.  However two
      -    /// earlyclobber-conflict operands may be assigned the same register if
      -    /// they happen to contain the same value.
      -    /// 
      -    std::multimap AsmsWithEarlyClobberConflict;
      -
           /// Special pool allocator for VNInfo's (LiveInterval val#).
           ///
           BumpPtrAllocator VNInfoAllocator;
      @@ -353,11 +337,6 @@
           unsigned getNumConflictsWithPhysReg(const LiveInterval &li,
                                               unsigned PhysReg) const;
       
      -    /// noEarlyclobberConflict - see whether virtual reg VReg has a conflict
      -    /// with hard reg HReg because HReg is used as an earlyclobber register in
      -    /// asm that also has VReg live into or across it.
      -    bool noEarlyclobberConflict(unsigned VReg, VirtRegMap &vrm, unsigned HReg);
      -
           /// computeNumbering - Compute the index numbering.
           void computeNumbering();
       
      
      Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=56326&r1=56325&r2=56326&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
      +++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Thu Sep 18 20:02:35 2008
      @@ -686,6 +686,10 @@
           OS << "%reg" << reg;
       
         OS << ',' << weight;
      +  if (isEarlyClobber)
      +    OS << ",earlyclobber";
      +  if (overlapsEarlyClobber)
      +    OS << ",overlapsearly";
       
         if (empty())
           OS << " EMPTY";
      
      Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=56326&r1=56325&r2=56326&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
      +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Thu Sep 18 20:02:35 2008
      @@ -674,8 +674,6 @@
       /// live interval is an interval [i, j) where 1 <= i <= j < N for
       /// which a variable is live
       void LiveIntervals::computeIntervals() { 
      -  AsmsThatEarlyClobber.clear();
      -  AsmsWithEarlyClobberConflict.clear();
       
         DOUT << "********** COMPUTING LIVE INTERVALS **********\n"
              << "********** Function: "
      @@ -716,13 +714,15 @@
               if (MO.isRegister() && MO.getReg() && MO.isDef()) {
                 handleRegisterDef(MBB, MI, MIIndex, MO, i);
                 if (MO.isEarlyClobber()) {
      -            AsmsThatEarlyClobber.insert(std::make_pair(MO.getReg(), MI));
      +            LiveInterval &interval =  getOrCreateInterval(MO.getReg());
      +            interval.isEarlyClobber = true;
                 }
               }
               if (MO.isRegister() && !MO.isDef() &&
                   MO.getReg() && TargetRegisterInfo::isVirtualRegister(MO.getReg()) &&
                   MO.overlapsEarlyClobber()) {
      -          AsmsWithEarlyClobberConflict.insert(std::make_pair(MO.getReg(), MI));
      +          LiveInterval &interval = getOrCreateInterval(MO.getReg());
      +          interval.overlapsEarlyClobber = true;
               }
             }
             
      @@ -752,73 +752,6 @@
         return ResVal;
       }
       
      -/// noEarlyclobberConflict - see whether virtual reg VReg has a conflict with
      -/// hard reg HReg because of earlyclobbers.  
      -///
      -/// Earlyclobber operands may not be assigned the same register as
      -/// each other, or as earlyclobber-conflict operands (i.e. those that
      -/// are non-earlyclobbered inputs to an asm that also has earlyclobbers).
      -///
      -/// Thus there are two cases to check for:
      -/// 1.  VReg is an earlyclobber-conflict register and HReg is an earlyclobber
      -/// register in some asm that also has VReg as an input.
      -/// 2.  VReg is an earlyclobber register and HReg is an earlyclobber-conflict
      -/// input elsewhere in some asm.
      -/// In both cases HReg can be assigned by the user, or assigned early in
      -/// register allocation.
      -/// 
      -/// Dropping the distinction between earlyclobber and earlyclobber-conflict,
      -/// keeping only one multimap, looks promising, but two earlyclobber-conflict
      -/// operands may be assigned the same register if they happen to contain the 
      -/// same value, and that implementation would prevent this.
      -///
      -bool LiveIntervals::noEarlyclobberConflict(unsigned VReg, VirtRegMap &vrm,
      -                                           unsigned HReg) {
      -  typedef std::multimap::iterator It;
      -
      -  // Short circuit the most common case.
      -  if (AsmsWithEarlyClobberConflict.size()!=0) {
      -    std::pair x = AsmsWithEarlyClobberConflict.equal_range(VReg);
      -    for (It I = x.first; I!=x.second; I++) {
      -      MachineInstr* MI = I->second;
      -      for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
      -        MachineOperand &MO = MI->getOperand(i);
      -        if (MO.isRegister() && MO.isEarlyClobber()) {
      -          unsigned PhysReg = MO.getReg();
      -          if (PhysReg && TargetRegisterInfo::isVirtualRegister(PhysReg)) {
      -            if (!vrm.hasPhys(PhysReg))
      -              continue;
      -            PhysReg = vrm.getPhys(PhysReg);
      -          }
      -          if (PhysReg==HReg)
      -            return false;
      -        }
      -      }
      -    }
      -  }
      -  // Short circuit the most common case.
      -  if (AsmsThatEarlyClobber.size()!=0) {
      -    std::pair x = AsmsThatEarlyClobber.equal_range(VReg);
      -    for (It I = x.first; I!=x.second; I++) {
      -      MachineInstr* MI = I->second;
      -      for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
      -        MachineOperand &MO = MI->getOperand(i);
      -        if (MO.isRegister() && MO.overlapsEarlyClobber()) {
      -          unsigned PhysReg = MO.getReg();
      -          if (PhysReg && TargetRegisterInfo::isVirtualRegister(PhysReg)) {
      -            if (!vrm.hasPhys(PhysReg))
      -              continue;
      -            PhysReg = vrm.getPhys(PhysReg);
      -          }
      -          if (PhysReg==HReg)
      -            return false;
      -        }
      -      }
      -    }
      -  }
      -  return true;
      -}
      -
       LiveInterval* LiveIntervals::createInterval(unsigned reg) {
         float Weight = TargetRegisterInfo::isPhysicalRegister(reg) ?
                              HUGE_VALF : 0.0F;
      
      Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56326&r1=56325&r2=56326&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
      +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Thu Sep 18 20:02:35 2008
      @@ -173,6 +173,8 @@
       
           void ComputeRelatedRegClasses();
       
      +    bool noEarlyClobberConflict(LiveInterval *cur, unsigned RegNo);
      +
           template 
           void printIntervals(const char* const str, ItTy i, ItTy e) const {
             if (str) DOUT << str << " intervals:\n";
      @@ -1001,6 +1003,73 @@
           unhandled_.push(added[i]);
       }
       
      +/// noEarlyClobberConflict - see whether LiveInternal cur has a conflict with
      +/// hard reg HReg because of earlyclobbers.  
      +///
      +/// Earlyclobber operands may not be assigned the same register as
      +/// each other, or as earlyclobber-conflict operands (i.e. those that
      +/// are non-earlyclobbered inputs to an asm that also has earlyclobbers).
      +///
      +/// Thus there are two cases to check for:
      +/// 1.  cur->reg is an earlyclobber-conflict register and HReg is an
      +/// earlyclobber register in some asm that also has cur->reg as an input.
      +/// 2.  cur->reg is an earlyclobber register and HReg is an 
      +/// earlyclobber-conflict input, or a different earlyclobber register,
      +/// elsewhere in some asm.
      +/// In both cases HReg can be assigned by the user, or assigned early in
      +/// register allocation.
      +/// 
      +/// Dropping the distinction between earlyclobber and earlyclobber-conflict,
      +/// keeping only one bit, looks promising, but two earlyclobber-conflict
      +/// operands may be assigned the same register if they happen to contain the 
      +/// same value, and that implementation would prevent this.
      +///
      +bool RALinScan::noEarlyClobberConflict(LiveInterval *cur, unsigned HReg) {
      +  if (cur->overlapsEarlyClobber) {
      +    for (MachineRegisterInfo::use_iterator I = mri_->use_begin(cur->reg),
      +          E = mri_->use_end(); I!=E; ++I) {
      +      MachineInstr *MI = I.getOperand().getParent();
      +      if (MI->getOpcode()==TargetInstrInfo::INLINEASM) {
      +        for (int i = MI->getNumOperands()-1; i>=0; --i) {
      +          MachineOperand &MO = MI->getOperand(i);
      +          if (MO.isRegister() && MO.getReg() && MO.isEarlyClobber() &&
      +              HReg==MO.getReg()) {
      +            DOUT << "  earlyclobber conflict: " << 
      +                  "%reg" << cur->reg << ", " << tri_->getName(HReg) << "\n\t";
      +            return false;
      +          }
      +        }
      +      }
      +    }
      +  }
      +  if (cur->isEarlyClobber) {
      +    for (MachineRegisterInfo::def_iterator I = mri_->def_begin(cur->reg),
      +          E = mri_->def_end(); I!=E; ++I) {
      +      MachineInstr *MI = I.getOperand().getParent();
      +      if (MI->getOpcode()==TargetInstrInfo::INLINEASM) {
      +        // make sure cur->reg is really clobbered in this instruction.
      +        bool earlyClobberFound = false, overlapFound = false;
      +        for (int i = MI->getNumOperands()-1; i>=0; --i) {
      +          MachineOperand &MO = MI->getOperand(i);
      +          if (MO.isRegister() && MO.getReg()) {
      +            if ((MO.overlapsEarlyClobber() || MO.isEarlyClobber()) && 
      +                HReg==MO.getReg())
      +              overlapFound = true;
      +            if (MO.isEarlyClobber() && cur->reg==MO.getReg())
      +              earlyClobberFound = true;
      +          }
      +        }
      +        if (earlyClobberFound && overlapFound) {
      +          DOUT << "  earlyclobber conflict: " << 
      +                  "%reg" << cur->reg << ", " << tri_->getName(HReg) << "\n\t";
      +          return false;
      +        }
      +      }
      +    }
      +  }
      +  return true;
      +}
      +
       /// getFreePhysReg - return a free physical register for this virtual register
       /// interval if we have one, otherwise return 0.
       unsigned RALinScan::getFreePhysReg(LiveInterval *cur) {
      @@ -1049,7 +1118,7 @@
         assert(I != E && "No allocatable register in this register class!");
         for (; I != E; ++I)
           if (prt_->isRegAvail(*I) && 
      -        li_->noEarlyclobberConflict(cur->reg, *vrm_, *I)) {
      +        noEarlyClobberConflict(cur, *I)) {
             FreeReg = *I;
             if (FreeReg < inactiveCounts.size())
               FreeRegInactiveCount = inactiveCounts[FreeReg];
      @@ -1070,7 +1139,7 @@
           unsigned Reg = *I;
           if (prt_->isRegAvail(Reg) && Reg < inactiveCounts.size() &&
               FreeRegInactiveCount < inactiveCounts[Reg] &&
      -        li_->noEarlyclobberConflict(cur->reg, *vrm_, Reg)) {
      +        noEarlyClobberConflict(cur, *I)) {
             FreeReg = Reg;
             FreeRegInactiveCount = inactiveCounts[Reg];
             if (FreeRegInactiveCount == MaxInactiveCount)
      
      
      
      
      From isanbard at gmail.com  Thu Sep 18 22:02:29 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 03:02:29 -0000
      Subject: [llvm-commits] [llvm] r56328 - in /llvm/branches/Apple: Gaz/
      	Xcode-3.1.1/
      Message-ID: <200809190302.m8J32TqH023234@zion.cs.uiuc.edu>
      
      Author: void
      Date: Thu Sep 18 22:02:29 2008
      New Revision: 56328
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56328&view=rev
      Log:
      Rename Gaz to Xcode-3.1.1
      
      Added:
          llvm/branches/Apple/Xcode-3.1.1/
            - copied from r56327, llvm/branches/Apple/Gaz/
      Removed:
          llvm/branches/Apple/Gaz/
      
      
      
      From isanbard at gmail.com  Thu Sep 18 22:02:52 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 03:02:52 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56329 - in
      	/llvm-gcc-4.2/branches/Apple: Gaz/ Xcode-3.1.1/
      Message-ID: <200809190302.m8J32qlT023258@zion.cs.uiuc.edu>
      
      Author: void
      Date: Thu Sep 18 22:02:51 2008
      New Revision: 56329
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56329&view=rev
      Log:
      Rename Gaz to Xcode-3.1.1
      
      Added:
          llvm-gcc-4.2/branches/Apple/Xcode-3.1.1/
            - copied from r56328, llvm-gcc-4.2/branches/Apple/Gaz/
      Removed:
          llvm-gcc-4.2/branches/Apple/Gaz/
      
      
      
      From kremenek at apple.com  Thu Sep 18 22:45:18 2008
      From: kremenek at apple.com (Ted Kremenek)
      Date: Fri, 19 Sep 2008 03:45:18 -0000
      Subject: [llvm-commits] [llvm] r56330 - /llvm/tags/checker/checker-93/
      Message-ID: <200809190345.m8J3jIoO024707@zion.cs.uiuc.edu>
      
      Author: kremenek
      Date: Thu Sep 18 22:45:17 2008
      New Revision: 56330
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56330&view=rev
      Log:
      Tagging checker-93.
      
      Added:
          llvm/tags/checker/checker-93/
            - copied from r56329, llvm/trunk/
      
      
      
      From baldrick at free.fr  Fri Sep 19 02:57:10 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Fri, 19 Sep 2008 07:57:10 -0000
      Subject: [llvm-commits] [llvm] r56337 - in /llvm/trunk:
       test/Analysis/CallGraph/2008-09-09-DirectCall.ll
       test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll
       test/Other/2002-01-31-CallGraph.ll tools/opt/AnalysisWrappers.cpp
      Message-ID: <200809190757.m8J7vA0C007167@zion.cs.uiuc.edu>
      
      Author: baldrick
      Date: Fri Sep 19 02:57:09 2008
      New Revision: 56337
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56337&view=rev
      Log:
      Teach -callgraph to always print the callgraph (as the
      description says it does), not just when -analyze is
      used as well.  This means printing to stderr, so adjust
      some tests.
      
      Modified:
          llvm/trunk/test/Analysis/CallGraph/2008-09-09-DirectCall.ll
          llvm/trunk/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll
          llvm/trunk/test/Other/2002-01-31-CallGraph.ll
          llvm/trunk/tools/opt/AnalysisWrappers.cpp
      
      Modified: llvm/trunk/test/Analysis/CallGraph/2008-09-09-DirectCall.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/CallGraph/2008-09-09-DirectCall.ll?rev=56337&r1=56336&r2=56337&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/CallGraph/2008-09-09-DirectCall.ll (original)
      +++ llvm/trunk/test/Analysis/CallGraph/2008-09-09-DirectCall.ll Fri Sep 19 02:57:09 2008
      @@ -1,4 +1,4 @@
      -; RUN: llvm-as < %s | opt -analyze -callgraph -disable-output | grep {Calls function 'callee'} | count 2
      +; RUN: llvm-as < %s | opt -callgraph -disable-output |& grep {Calls function 'callee'} | count 2
       
       define internal void @callee(...) {
       entry:
      
      Modified: llvm/trunk/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll?rev=56337&r1=56336&r2=56337&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll (original)
      +++ llvm/trunk/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll Fri Sep 19 02:57:09 2008
      @@ -1,4 +1,4 @@
      -; RUN: llvm-as < %s | opt -analyze -callgraph -disable-output | grep {Calls function}
      +; RUN: llvm-as < %s | opt -callgraph -disable-output |& grep {Calls function}
       
       @a = global void ()* @f		;  [#uses=0]
       
      
      Modified: llvm/trunk/test/Other/2002-01-31-CallGraph.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/2002-01-31-CallGraph.ll?rev=56337&r1=56336&r2=56337&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Other/2002-01-31-CallGraph.ll (original)
      +++ llvm/trunk/test/Other/2002-01-31-CallGraph.ll Fri Sep 19 02:57:09 2008
      @@ -1,6 +1,6 @@
       ;  Call graph construction crash: Not handling indirect calls right
       ;
      -; RUN: llvm-as < %s | opt -analyze -callgraph
      +; RUN: llvm-as < %s | opt -analyze -callgraph >& /dev/null
       ;
       
               %FunTy = type i32 (i32)
      
      Modified: llvm/trunk/tools/opt/AnalysisWrappers.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/AnalysisWrappers.cpp?rev=56337&r1=56336&r2=56337&view=diff
      
      ==============================================================================
      --- llvm/trunk/tools/opt/AnalysisWrappers.cpp (original)
      +++ llvm/trunk/tools/opt/AnalysisWrappers.cpp Fri Sep 19 02:57:09 2008
      @@ -66,7 +66,7 @@
         char ExternalFunctionsPassedConstants::ID = 0;
         RegisterPass
         P1("externalfnconstants", "Print external fn callsites passed constants");
      -  
      +
         struct CallGraphPrinter : public ModulePass {
           static char ID; // Pass ID, replacement for typeid
           CallGraphPrinter() : ModulePass((intptr_t)&ID) {}
      @@ -75,13 +75,12 @@
             AU.setPreservesAll();
             AU.addRequiredTransitive();
           }
      -    virtual bool runOnModule(Module &M) { return false; }
      -
      -    virtual void print(std::ostream &OS, const Module *M) const {
      -      getAnalysis().print(OS, M);
      +    virtual bool runOnModule(Module &M) {
      +      getAnalysis().print(std::cerr, &M);
      +      return false;
           }
         };
      -  
      +
         char CallGraphPrinter::ID = 0;
         RegisterPass
           P2("callgraph", "Print a call graph");
      
      
      
      
      From baldrick at free.fr  Fri Sep 19 03:01:58 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Fri, 19 Sep 2008 08:01:58 -0000
      Subject: [llvm-commits] [llvm] r56338 -
      	/llvm/trunk/test/Transforms/PruneEH/2008-09-05-CGUpdate.ll
      Message-ID: <200809190801.m8J81wva009438@zion.cs.uiuc.edu>
      
      Author: baldrick
      Date: Fri Sep 19 03:01:57 2008
      New Revision: 56338
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56338&view=rev
      Log:
      Test the callgraph directly for the missing edge.
      
      Modified:
          llvm/trunk/test/Transforms/PruneEH/2008-09-05-CGUpdate.ll
      
      Modified: llvm/trunk/test/Transforms/PruneEH/2008-09-05-CGUpdate.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/PruneEH/2008-09-05-CGUpdate.ll?rev=56338&r1=56337&r2=56338&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Transforms/PruneEH/2008-09-05-CGUpdate.ll (original)
      +++ llvm/trunk/test/Transforms/PruneEH/2008-09-05-CGUpdate.ll Fri Sep 19 03:01:57 2008
      @@ -1,4 +1,5 @@
      -; RUN: llvm-as < %s | opt -prune-eh -inline -globalsmodref-aa -markmodref | llvm-dis | not grep {define.*read}
      +; RUN: llvm-as < %s | opt -prune-eh -inline -callgraph -disable-output |& \
      +; RUN:   grep {Calls.*ce3806g__fxio__put__put_int64__4.1339} | count 2
       	%struct.FRAME.ce3806g = type { %struct.string___XUB, %struct.string___XUB, %struct.string___XUB, %struct.string___XUB }
       	%struct.FRAME.ce3806g__fxio__put__4 = type { i32, i32, i32, %struct.system__file_control_block__pstring*, i32, i32, i8 }
       	%struct.RETURN = type { i8, i32 }
      
      
      
      
      From isanbard at gmail.com  Fri Sep 19 03:02:51 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 08:02:51 -0000
      Subject: [llvm-commits] [llvm] r56339 - /llvm/tags/Apple/llvmCore-2070/
      Message-ID: <200809190802.m8J82p90009769@zion.cs.uiuc.edu>
      
      Author: void
      Date: Fri Sep 19 03:02:51 2008
      New Revision: 56339
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56339&view=rev
      Log:
      Creating llvmCore-2070 branch
      
      Added:
          llvm/tags/Apple/llvmCore-2070/
            - copied from r56338, llvm/trunk/
      
      
      
      From isanbard at gmail.com  Fri Sep 19 03:02:57 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 08:02:57 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56340 -
      	/llvm-gcc-4.2/tags/Apple/llvmgcc42-2070/
      Message-ID: <200809190802.m8J82v4m009781@zion.cs.uiuc.edu>
      
      Author: void
      Date: Fri Sep 19 03:02:57 2008
      New Revision: 56340
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56340&view=rev
      Log:
      Creating llvmgcc42-2070 branch
      
      Added:
          llvm-gcc-4.2/tags/Apple/llvmgcc42-2070/
            - copied from r56339, llvm-gcc-4.2/trunk/
      
      
      
      From baldrick at free.fr  Fri Sep 19 03:17:05 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Fri, 19 Sep 2008 08:17:05 -0000
      Subject: [llvm-commits] [llvm] r56341 - in /llvm/trunk: include/llvm/
       include/llvm/Transforms/ lib/Transforms/IPO/ test/Analysis/GlobalsModRef/
       test/Transforms/AddReadAttrs/
      Message-ID: <200809190817.m8J8H6I8010267@zion.cs.uiuc.edu>
      
      Author: baldrick
      Date: Fri Sep 19 03:17:05 2008
      New Revision: 56341
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56341&view=rev
      Log:
      Add a new pass AddReadAttrs which works out which functions
      can get the readnone/readonly attributes, and gives them it.
      The plan is to remove markmodref (which did the same thing
      by querying GlobalsModRef) and delete the analogous
      functionality from GlobalsModRef.
      
      Added:
          llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp
          llvm/trunk/test/Transforms/AddReadAttrs/
          llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll   (contents, props changed)
            - copied, changed from r56242, llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll
          llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll   (contents, props changed)
            - copied, changed from r56242, llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll
          llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll   (contents, props changed)
            - copied, changed from r56242, llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll
          llvm/trunk/test/Transforms/AddReadAttrs/2008-09-13-VolatileRead.ll   (contents, props changed)
            - copied, changed from r56242, llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13-VolatileRead.ll
      Removed:
          llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll
          llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll
          llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll
          llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13-VolatileRead.ll
      Modified:
          llvm/trunk/include/llvm/LinkAllPasses.h
          llvm/trunk/include/llvm/Transforms/IPO.h
      
      Modified: llvm/trunk/include/llvm/LinkAllPasses.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=56341&r1=56340&r2=56341&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/LinkAllPasses.h (original)
      +++ llvm/trunk/include/llvm/LinkAllPasses.h Fri Sep 19 03:17:05 2008
      @@ -119,6 +119,7 @@
             (void) llvm::createPostDomFrontier();
             (void) llvm::createInstructionNamerPass();
             (void) llvm::createPartialSpecializationPass();
      +      (void) llvm::createAddReadAttrsPass();
       
             (void)new llvm::IntervalPartition();
             (void)new llvm::FindUsedTypes();
      
      Modified: llvm/trunk/include/llvm/Transforms/IPO.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO.h?rev=56341&r1=56340&r2=56341&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Transforms/IPO.h (original)
      +++ llvm/trunk/include/llvm/Transforms/IPO.h Fri Sep 19 03:17:05 2008
      @@ -188,6 +188,12 @@
       ///
       ModulePass* createPartialSpecializationPass();
       
      +//===----------------------------------------------------------------------===//
      +/// createAddReadAttrsPass - This pass discovers functions that do not access
      +/// memory, or only read memory, and gives them the readnone/readonly attribute.
      +///
      +Pass* createAddReadAttrsPass();
      +
       } // End llvm namespace
       
       #endif
      
      Added: llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp?rev=56341&view=auto
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp (added)
      +++ llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Fri Sep 19 03:17:05 2008
      @@ -0,0 +1,135 @@
      +//===- AddReadAttrs.cpp - Pass which marks functions readnone or readonly -===//
      +//
      +//                     The LLVM Compiler Infrastructure
      +//
      +// This file is distributed under the University of Illinois Open Source
      +// License. See LICENSE.TXT for details.
      +//
      +//===----------------------------------------------------------------------===//
      +//
      +// This file implements a simple interprocedural pass which walks the
      +// call-graph, looking for functions which do not access or only read
      +// non-local memory, and marking them readnone/readonly.  It implements
      +// this as a bottom-up traversal of the call-graph.
      +//
      +//===----------------------------------------------------------------------===//
      +
      +#define DEBUG_TYPE "addreadattrs"
      +#include "llvm/Transforms/IPO.h"
      +#include "llvm/CallGraphSCCPass.h"
      +#include "llvm/Instructions.h"
      +#include "llvm/Analysis/CallGraph.h"
      +#include "llvm/ADT/Statistic.h"
      +#include "llvm/Support/Compiler.h"
      +#include "llvm/Support/InstIterator.h"
      +using namespace llvm;
      +
      +STATISTIC(NumReadNone, "Number of functions marked readnone");
      +STATISTIC(NumReadOnly, "Number of functions marked readonly");
      +
      +namespace {
      +  struct VISIBILITY_HIDDEN AddReadAttrs : public CallGraphSCCPass {
      +    static char ID; // Pass identification, replacement for typeid
      +    AddReadAttrs() : CallGraphSCCPass(&ID) {}
      +
      +    // runOnSCC - Analyze the SCC, performing the transformation if possible.
      +    bool runOnSCC(const std::vector &SCC);
      +  };
      +}
      +
      +char AddReadAttrs::ID = 0;
      +static RegisterPass
      +X("addreadattrs", "Mark functions readnone/readonly");
      +
      +Pass *llvm::createAddReadAttrsPass() { return new AddReadAttrs(); }
      +
      +
      +bool AddReadAttrs::runOnSCC(const std::vector &SCC) {
      +  CallGraph &CG = getAnalysis();
      +
      +  // Check if any of the functions in the SCC read or write memory.
      +  // If they write memory then just give up.
      +  bool ReadsMemory = false;
      +  for (unsigned i = 0, e = SCC.size(); i != e; ++i) {
      +    Function *F = SCC[i]->getFunction();
      +
      +    if (F == 0)
      +      // May write memory.
      +      return false;
      +
      +    if (F->doesNotAccessMemory())
      +      // Already perfect!
      +      continue;
      +
      +    // Definitions with weak linkage may be overridden at linktime with
      +    // something that writes memory, so treat them like declarations.
      +    if (F->isDeclaration() || F->hasWeakLinkage()) {
      +      if (!F->onlyReadsMemory())
      +        // May write memory.
      +        return false;
      +
      +      ReadsMemory = true;
      +      continue;
      +    }
      +
      +    // Scan the function body for explicit loads and stores, or calls to
      +    // functions that may read or write memory.
      +    for (inst_iterator II = inst_begin(F), E = inst_end(F); II != E; ++II) {
      +      Instruction *I = &*II;
      +      if (LoadInst *LI = dyn_cast(I)) {
      +        if (LI->isVolatile())
      +          // Volatile loads may have side-effects, so treat them as writing
      +          // memory.
      +          return false;
      +        ReadsMemory = true;
      +      } else if (isa(I) || isa(I) || isa(I)) {
      +        // Writes memory.
      +        return false;
      +      } else if (isa(I) || isa(I)) {
      +        CallSite CS(I);
      +
      +        if (std::find(SCC.begin(), SCC.end(), CG[CS.getCalledFunction()]) !=
      +            SCC.end())
      +          // The callee is inside our current SCC - ignore it.
      +          continue;
      +
      +        if (!CS.onlyReadsMemory())
      +          // May write memory.
      +          return false;
      +
      +        if (!CS.doesNotAccessMemory())
      +          ReadsMemory = true;
      +      }
      +    }
      +  }
      +
      +  // Success!  Functions in this SCC do not access memory, or only read memory.
      +  // Give them the appropriate attribute.
      +  bool MadeChange = false;
      +  for (unsigned i = 0, e = SCC.size(); i != e; ++i) {
      +    Function *F = SCC[i]->getFunction();
      +
      +    if (F->doesNotAccessMemory())
      +      // Already perfect!
      +      continue;
      +
      +    if (F->onlyReadsMemory() && ReadsMemory)
      +      // No change.
      +      continue;
      +
      +    MadeChange = true;
      +
      +    // Clear out any existing attributes.
      +    F->removeParamAttr(0, ParamAttr::ReadOnly | ParamAttr::ReadNone);
      +
      +    // Add in the new attribute.
      +    F->addParamAttr(0, ReadsMemory ? ParamAttr::ReadOnly : ParamAttr::ReadNone);
      +
      +    if (ReadsMemory)
      +      NumReadOnly++;
      +    else
      +      NumReadNone++;
      +  }
      +
      +  return MadeChange;
      +}
      
      Removed: llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll?rev=56340&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll (original)
      +++ llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll (removed)
      @@ -1,11 +0,0 @@
      -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis | grep readnone
      -
      -define i32 @a() {
      -	%tmp = call i32 @b( )		;  [#uses=1]
      -	ret i32 %tmp
      -}
      -
      -define i32 @b() {
      -	%tmp = call i32 @a( )		;  [#uses=1]
      -	ret i32 %tmp
      -}
      
      Removed: llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll?rev=56340&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll (original)
      +++ llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll (removed)
      @@ -1,9 +0,0 @@
      -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis | grep readnone | count 2
      -
      -define i32 @f() {
      -entry:
      -	%tmp = call i32 @e( )		;  [#uses=1]
      -	ret i32 %tmp
      -}
      -
      -declare i32 @e() readnone
      
      Removed: llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll?rev=56340&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll (original)
      +++ llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll (removed)
      @@ -1,9 +0,0 @@
      -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis | grep readonly | count 2
      -
      -define i32 @f() {
      -entry:
      -	%tmp = call i32 @e( )		;  [#uses=1]
      -	ret i32 %tmp
      -}
      -
      -declare i32 @e() readonly
      
      Removed: llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13-VolatileRead.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13-VolatileRead.ll?rev=56340&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13-VolatileRead.ll (original)
      +++ llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13-VolatileRead.ll (removed)
      @@ -1,9 +0,0 @@
      -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis | not grep read
      -; PR2792
      -
      - at g = global i32 0		;  [#uses=1]
      -
      -define i32 @f() {
      -	%t = volatile load i32* @g		;  [#uses=1]
      -	ret i32 %t
      -}
      
      Copied: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll (from r56242, llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll)
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll?p2=llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll&p1=llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll&r1=56242&r2=56341&rev=56341&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll (original)
      +++ llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll Fri Sep 19 03:17:05 2008
      @@ -1,4 +1,4 @@
      -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis | grep readnone
      +; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | grep readnone
       
       define i32 @a() {
       	%tmp = call i32 @b( )		;  [#uses=1]
      
      Propchange: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll
      
      ------------------------------------------------------------------------------
          svn:mergeinfo = 
      
      Copied: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll (from r56242, llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll)
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll?p2=llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll&p1=llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll&r1=56242&r2=56341&rev=56341&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll (original)
      +++ llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll Fri Sep 19 03:17:05 2008
      @@ -1,4 +1,4 @@
      -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis | grep readnone | count 2
      +; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | grep readnone | count 2
       
       define i32 @f() {
       entry:
      
      Propchange: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll
      
      ------------------------------------------------------------------------------
          svn:mergeinfo = 
      
      Copied: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll (from r56242, llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll)
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll?p2=llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll&p1=llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll&r1=56242&r2=56341&rev=56341&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll (original)
      +++ llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll Fri Sep 19 03:17:05 2008
      @@ -1,4 +1,4 @@
      -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis | grep readonly | count 2
      +; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | grep readonly | count 2
       
       define i32 @f() {
       entry:
      
      Propchange: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll
      
      ------------------------------------------------------------------------------
          svn:mergeinfo = 
      
      Copied: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-13-VolatileRead.ll (from r56242, llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13-VolatileRead.ll)
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/AddReadAttrs/2008-09-13-VolatileRead.ll?p2=llvm/trunk/test/Transforms/AddReadAttrs/2008-09-13-VolatileRead.ll&p1=llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13-VolatileRead.ll&r1=56242&r2=56341&rev=56341&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13-VolatileRead.ll (original)
      +++ llvm/trunk/test/Transforms/AddReadAttrs/2008-09-13-VolatileRead.ll Fri Sep 19 03:17:05 2008
      @@ -1,4 +1,4 @@
      -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis | not grep read
      +; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | not grep read
       ; PR2792
       
       @g = global i32 0		;  [#uses=1]
      
      Propchange: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-13-VolatileRead.ll
      
      ------------------------------------------------------------------------------
          svn:mergeinfo = 
      
      
      
      
      From baldrick at free.fr  Fri Sep 19 03:23:44 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Fri, 19 Sep 2008 08:23:44 -0000
      Subject: [llvm-commits] [llvm] r56342 - in /llvm/trunk:
       include/llvm/LinkAllPasses.h include/llvm/Transforms/Scalar.h
       lib/Transforms/Scalar/MarkModRef.cpp
       test/Analysis/GlobalsModRef/2008-09-03-WrongRecords.ll
       win32/Transforms/Transforms.vcproj
      Message-ID: <200809190823.m8J8Nic6010477@zion.cs.uiuc.edu>
      
      Author: baldrick
      Date: Fri Sep 19 03:23:44 2008
      New Revision: 56342
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56342&view=rev
      Log:
      Remove the MarkModRef pass (use AddReadAttrs instead).
      Unfortunately this means removing one regression test
      of GlobalsModRef because I couldn't work out how to
      perform it without MarkModRef.
      
      Removed:
          llvm/trunk/lib/Transforms/Scalar/MarkModRef.cpp
          llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-WrongRecords.ll
      Modified:
          llvm/trunk/include/llvm/LinkAllPasses.h
          llvm/trunk/include/llvm/Transforms/Scalar.h
          llvm/trunk/win32/Transforms/Transforms.vcproj
      
      Modified: llvm/trunk/include/llvm/LinkAllPasses.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=56342&r1=56341&r2=56342&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/LinkAllPasses.h (original)
      +++ llvm/trunk/include/llvm/LinkAllPasses.h Fri Sep 19 03:23:44 2008
      @@ -86,7 +86,6 @@
             (void) llvm::createLowerInvokePass();
             (void) llvm::createLowerSetJmpPass();
             (void) llvm::createLowerSwitchPass();
      -      (void) llvm::createMarkModRefPass();
             (void) llvm::createNoAAPass();
             (void) llvm::createNoProfileInfoPass();
             (void) llvm::createProfileLoaderPass();
      
      Modified: llvm/trunk/include/llvm/Transforms/Scalar.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar.h?rev=56342&r1=56341&r2=56342&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Transforms/Scalar.h (original)
      +++ llvm/trunk/include/llvm/Transforms/Scalar.h Fri Sep 19 03:23:44 2008
      @@ -139,12 +139,6 @@
       
       //===----------------------------------------------------------------------===//
       //
      -// MarkModRef - This pass marks functions readnone/readonly.
      -//
      -FunctionPass *createMarkModRefPass();
      -
      -//===----------------------------------------------------------------------===//
      -//
       // PromoteMemoryToRegister - This pass is used to promote memory references to
       // be register references. A simple example of the transformation performed by
       // this pass is:
      
      Removed: llvm/trunk/lib/Transforms/Scalar/MarkModRef.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MarkModRef.cpp?rev=56341&view=auto
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/Scalar/MarkModRef.cpp (original)
      +++ llvm/trunk/lib/Transforms/Scalar/MarkModRef.cpp (removed)
      @@ -1,69 +0,0 @@
      -//===--------- MarkModRef.cpp - Mark functions readnone/readonly ----------===//
      -//
      -//                     The LLVM Compiler Infrastructure
      -//
      -// This file is distributed under the University of Illinois Open Source
      -// License. See LICENSE.TXT for details.
      -//
      -//===----------------------------------------------------------------------===//
      -//
      -// This pass marks functions readnone/readonly based on the results of alias
      -// analysis.  This requires a sufficiently powerful alias analysis, such as
      -// GlobalsModRef (invoke as "opt ... -globalsmodref-aa -markmodref ...").
      -//
      -//===----------------------------------------------------------------------===//
      -
      -#define DEBUG_TYPE "markmodref"
      -#include "llvm/ADT/Statistic.h"
      -#include "llvm/Analysis/AliasAnalysis.h"
      -#include "llvm/Support/Compiler.h"
      -#include "llvm/Transforms/Scalar.h"
      -#include "llvm/Function.h"
      -#include "llvm/Pass.h"
      -using namespace llvm;
      -
      -STATISTIC(NumReadNone, "Number of functions marked readnone");
      -STATISTIC(NumReadOnly, "Number of functions marked readonly");
      -
      -namespace {
      -  struct VISIBILITY_HIDDEN MarkModRef : public FunctionPass {
      -    static char ID; // Pass identification, replacement for typeid
      -    MarkModRef() : FunctionPass(&ID) {}
      -
      -    bool runOnFunction(Function &F);
      -
      -    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
      -      AU.setPreservesCFG();
      -      AU.addRequired();
      -      AU.addPreserved();
      -    }
      -  };
      -}
      -
      -char MarkModRef::ID = 0;
      -static RegisterPass
      -X("markmodref", "Mark functions readnone/readonly");
      -
      -bool MarkModRef::runOnFunction(Function &F) {
      -  // FIXME: Wrong for functions with weak linkage.
      -  if (F.doesNotAccessMemory())
      -    // Cannot do better.
      -    return false;
      -
      -  AliasAnalysis &AA = getAnalysis();
      -  AliasAnalysis::ModRefBehavior ModRef = AA.getModRefBehavior(&F);
      -  if (ModRef == AliasAnalysis::DoesNotAccessMemory) {
      -    F.setDoesNotAccessMemory();
      -    NumReadNone++;
      -    return true;
      -  } else if (ModRef == AliasAnalysis::OnlyReadsMemory && !F.onlyReadsMemory()) {
      -    F.setOnlyReadsMemory();
      -    NumReadOnly++;
      -    return true;
      -  }
      -  return false;
      -}
      -
      -FunctionPass *llvm::createMarkModRefPass() {
      -  return new MarkModRef();
      -}
      
      Removed: llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-WrongRecords.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-WrongRecords.ll?rev=56341&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-WrongRecords.ll (original)
      +++ llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-WrongRecords.ll (removed)
      @@ -1,1104 +0,0 @@
      -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis | not grep {define.*read}
      -
      -	%struct.FRAME.ce3806g = type { %struct.string___XUB, %struct.string___XUB, %struct.string___XUB, %struct.string___XUB }
      -	%struct.FRAME.ce3806g__fxio__put__4 = type { i32, i32, i32, %struct.system__file_control_block__pstring*, i32, i32, i8 }
      -	%struct.ada__streams__root_stream_type = type { %struct.ada__tags__dispatch_table* }
      -	%struct.ada__tags__dispatch_table = type { [1 x i32] }
      -	%struct.ada__text_io__text_afcb = type { %struct.system__file_control_block__afcb, i32, i32, i32, i32, i32, %struct.ada__text_io__text_afcb*, i8, i8 }
      -	%struct.exception = type { i8, i8, i32, i8*, i8*, i32, i8* }
      -	%struct.string___XUB = type { i32, i32 }
      -	%struct.system__file_control_block__afcb = type { %struct.ada__streams__root_stream_type, i32, %struct.system__file_control_block__pstring, %struct.system__file_control_block__pstring, i8, i8, i8, i8, i8, i8, i8, %struct.system__file_control_block__afcb*, %struct.system__file_control_block__afcb* }
      -	%struct.system__file_control_block__pstring = type { i8*, %struct.string___XUB* }
      -	%struct.system__standard_library__exception_data = type { i8, i8, i32, i32, %struct.system__standard_library__exception_data*, i32, void ()* }
      - at .str = internal constant [12 x i8] c"system.ads\00\00"		; <[12 x i8]*> [#uses=1]
      - at .str1 = internal constant [14 x i8] c"a-tifiio.adb\00\00"		; <[14 x i8]*> [#uses=1]
      - at system__soft_links__abort_undefer = external global void ()*		;  [#uses=6]
      - at .str2 = internal constant [47 x i8] c"a-tifiio.adb:327 instantiated at ce3806g.adb:52"		; <[47 x i8]*> [#uses=1]
      - at C.354.2200 = internal constant %struct.string___XUB { i32 1, i32 47 }		; <%struct.string___XUB*> [#uses=2]
      - at ada__io_exceptions__data_error = external global %struct.exception		; <%struct.exception*> [#uses=1]
      - at constraint_error = external global %struct.exception		; <%struct.exception*> [#uses=2]
      - at __gnat_all_others_value = external constant i32		;  [#uses=21]
      - at .str3 = internal constant [10 x i8] c"0123456789"		; <[10 x i8]*> [#uses=2]
      - at ada__text_io__current_out = external global %struct.ada__text_io__text_afcb*		; <%struct.ada__text_io__text_afcb**> [#uses=1]
      - at .str4 = internal constant [126 x i8] c"CHECK THAT FIXED_IO PUT OPERATES ON FILES OF MODE OUT_FILE AND IF NO FILE IS SPECIFIED THE CURRENT DEFAULT OUTPUT FILE IS USED"		; <[126 x i8]*> [#uses=1]
      - at C.131.1559 = internal constant %struct.string___XUB { i32 1, i32 126 }		; <%struct.string___XUB*> [#uses=1]
      - at .str5 = internal constant [7 x i8] c"CE3806G"		; <[7 x i8]*> [#uses=1]
      - at C.132.1562 = internal constant %struct.string___XUB { i32 1, i32 7 }		; <%struct.string___XUB*> [#uses=1]
      - at incompleteF.1176.b = internal global i1 false		;  [#uses=2]
      - at incomplete.1177 = internal global %struct.exception { i8 0, i8 65, i32 23, i8* getelementptr ([23 x i8]* @incompleteE.1174, i32 0, i32 0), i8* null, i32 0, i8* null }		; <%struct.exception*> [#uses=15]
      - at incompleteE.1174 = internal global [23 x i8] c"CE3806G.B_1.INCOMPLETE\00"		; <[23 x i8]*> [#uses=1]
      - at .str6 = internal constant [0 x i8] zeroinitializer		; <[0 x i8]*> [#uses=1]
      - at C.136.1568 = internal constant %struct.string___XUB { i32 1, i32 0 }		; <%struct.string___XUB*> [#uses=8]
      - at .str7 = internal constant [50 x i8] c"USE_ERROR RAISED ON TEXT CREATE WITH OUT_FILE MODE"		; <[50 x i8]*> [#uses=1]
      - at C.139.1577 = internal constant %struct.string___XUB { i32 1, i32 50 }		; <%struct.string___XUB*> [#uses=1]
      - at .str8 = internal constant [14 x i8] c"ce3806g.adb:65"		; <[14 x i8]*> [#uses=1]
      - at C.140.1580 = internal constant %struct.string___XUB { i32 1, i32 14 }		; <%struct.string___XUB*> [#uses=3]
      - at .str9 = internal constant [51 x i8] c"NAME_ERROR RAISED ON TEXT CREATE WITH OUT_FILE MODE"		; <[51 x i8]*> [#uses=1]
      - at C.143.1585 = internal constant %struct.string___XUB { i32 1, i32 51 }		; <%struct.string___XUB*> [#uses=1]
      - at .str10 = internal constant [14 x i8] c"ce3806g.adb:69"		; <[14 x i8]*> [#uses=1]
      - at .str12 = internal constant [47 x i8] c"USE_ERROR RAISED ON TEXT OPEN WITH IN_FILE MODE"		; <[47 x i8]*> [#uses=1]
      - at .str13 = internal constant [14 x i8] c"ce3806g.adb:88"		; <[14 x i8]*> [#uses=1]
      - at .str14 = internal constant [33 x i8] c"VALUE INCORRECT - FIXED FROM FILE"		; <[33 x i8]*> [#uses=1]
      - at C.162.1637 = internal constant %struct.string___XUB { i32 1, i32 33 }		; <%struct.string___XUB*> [#uses=1]
      - at .str15 = internal constant [36 x i8] c"VALUE INCORRECT - FIXED FROM DEFAULT"		; <[36 x i8]*> [#uses=1]
      - at C.164.1642 = internal constant %struct.string___XUB { i32 1, i32 36 }		; <%struct.string___XUB*> [#uses=1]
      - at ada__io_exceptions__use_error = external global %struct.exception		; <%struct.exception*> [#uses=4]
      - at ada__io_exceptions__name_error = external global %struct.exception		; <%struct.exception*> [#uses=2]
      -
      -define void @_ada_ce3806g() {
      -entry:
      -	%A.266.i = alloca %struct.string___XUB		; <%struct.string___XUB*> [#uses=3]
      -	%A.257.i = alloca %struct.string___XUB		; <%struct.string___XUB*> [#uses=3]
      -	%0 = alloca [12 x i8]		; <[12 x i8]*> [#uses=1]
      -	%A.301.i = alloca %struct.string___XUB		; <%struct.string___XUB*> [#uses=3]
      -	%A.292.i = alloca %struct.string___XUB		; <%struct.string___XUB*> [#uses=3]
      -	%1 = alloca [12 x i8]		; <[12 x i8]*> [#uses=1]
      -	%2 = alloca %struct.system__file_control_block__pstring, align 8		; <%struct.system__file_control_block__pstring*> [#uses=3]
      -	%3 = alloca %struct.system__file_control_block__pstring, align 8		; <%struct.system__file_control_block__pstring*> [#uses=3]
      -	%4 = alloca %struct.system__file_control_block__pstring, align 8		; <%struct.system__file_control_block__pstring*> [#uses=3]
      -	%5 = alloca %struct.system__file_control_block__pstring, align 8		; <%struct.system__file_control_block__pstring*> [#uses=3]
      -	%FRAME.356 = alloca %struct.FRAME.ce3806g		; <%struct.FRAME.ce3806g*> [#uses=20]
      -	call void @report__test( i8* getelementptr ([7 x i8]* @.str5, i32 0, i32 0), %struct.string___XUB* @C.132.1562, i8* getelementptr ([126 x i8]* @.str4, i32 0, i32 0), %struct.string___XUB* @C.131.1559 )
      -	%6 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3		; <%struct.string___XUB*> [#uses=1]
      -	call void @system__secondary_stack__ss_mark( %struct.string___XUB* noalias sret %6 )
      -	%.b = load i1* @incompleteF.1176.b		;  [#uses=1]
      -	br i1 %.b, label %bb11, label %bb
      -
      -bb:		; preds = %entry
      -	invoke void @system__exception_table__register_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @incomplete.1177 to %struct.system__standard_library__exception_data*) )
      -			to label %invcont unwind label %lpad
      -
      -invcont:		; preds = %bb
      -	store i1 true, i1* @incompleteF.1176.b
      -	br label %bb11
      -
      -bb11:		; preds = %entry, %invcont
      -	%7 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2		; <%struct.string___XUB*> [#uses=1]
      -	invoke void @system__secondary_stack__ss_mark( %struct.string___XUB* noalias sret %7 )
      -			to label %invcont12 unwind label %lpad228
      -
      -invcont12:		; preds = %bb11
      -	invoke void @report__legal_file_name( %struct.system__file_control_block__pstring* noalias sret %5, i32 1, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.136.1568 )
      -			to label %invcont17 unwind label %lpad232
      -
      -invcont17:		; preds = %invcont12
      -	%elt18 = getelementptr %struct.system__file_control_block__pstring* %5, i32 0, i32 0		;  [#uses=1]
      -	%val19 = load i8** %elt18, align 8		;  [#uses=1]
      -	%elt20 = getelementptr %struct.system__file_control_block__pstring* %5, i32 0, i32 1		; <%struct.string___XUB**> [#uses=1]
      -	%val21 = load %struct.string___XUB** %elt20		; <%struct.string___XUB*> [#uses=1]
      -	%8 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__create( %struct.ada__text_io__text_afcb* null, i8 2, i8* %val19, %struct.string___XUB* %val21, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.136.1568 )
      -			to label %invcont26 unwind label %lpad232		; <%struct.ada__text_io__text_afcb*> [#uses=2]
      -
      -invcont26:		; preds = %invcont17
      -	%9 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2, i32 0		;  [#uses=1]
      -	%10 = load i32* %9, align 8		;  [#uses=1]
      -	%11 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2, i32 1		;  [#uses=1]
      -	%12 = load i32* %11, align 4		;  [#uses=1]
      -	invoke void @system__secondary_stack__ss_release( i32 %10, i32 %12 )
      -			to label %bb73 unwind label %lpad228
      -
      -bb32:		; preds = %lpad232
      -	call void @__gnat_begin_handler( i8* %eh_ptr233 ) nounwind
      -	%13 = load void ()** @system__soft_links__abort_undefer, align 4		;  [#uses=1]
      -	invoke void %13( )
      -			to label %invcont33 unwind label %lpad240
      -
      -invcont33:		; preds = %bb32
      -	invoke void @report__not_applicable( i8* getelementptr ([50 x i8]* @.str7, i32 0, i32 0), %struct.string___XUB* @C.139.1577 )
      -			to label %invcont38 unwind label %lpad240
      -
      -invcont38:		; preds = %invcont33
      -	invoke void @__gnat_raise_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @incomplete.1177 to %struct.system__standard_library__exception_data*), i8* getelementptr ([14 x i8]* @.str8, i32 0, i32 0), %struct.string___XUB* @C.140.1580 ) noreturn
      -			to label %invcont43 unwind label %lpad240
      -
      -invcont43:		; preds = %invcont38
      -	unreachable
      -
      -bb47:		; preds = %ppad291
      -	call void @__gnat_begin_handler( i8* %eh_ptr233 ) nounwind
      -	%14 = load void ()** @system__soft_links__abort_undefer, align 4		;  [#uses=1]
      -	invoke void %14( )
      -			to label %invcont49 unwind label %lpad248
      -
      -invcont49:		; preds = %bb47
      -	invoke void @report__not_applicable( i8* getelementptr ([51 x i8]* @.str9, i32 0, i32 0), %struct.string___XUB* @C.143.1585 )
      -			to label %invcont54 unwind label %lpad248
      -
      -invcont54:		; preds = %invcont49
      -	invoke void @__gnat_raise_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @incomplete.1177 to %struct.system__standard_library__exception_data*), i8* getelementptr ([14 x i8]* @.str10, i32 0, i32 0), %struct.string___XUB* @C.140.1580 ) noreturn
      -			to label %invcont59 unwind label %lpad248
      -
      -invcont59:		; preds = %invcont54
      -	unreachable
      -
      -bb73:		; preds = %invcont26
      -	invoke void @report__legal_file_name( %struct.system__file_control_block__pstring* noalias sret %4, i32 2, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.136.1568 )
      -			to label %invcont78 unwind label %lpad228
      -
      -invcont78:		; preds = %bb73
      -	%elt79 = getelementptr %struct.system__file_control_block__pstring* %4, i32 0, i32 0		;  [#uses=1]
      -	%val80 = load i8** %elt79, align 8		;  [#uses=1]
      -	%elt81 = getelementptr %struct.system__file_control_block__pstring* %4, i32 0, i32 1		; <%struct.string___XUB**> [#uses=1]
      -	%val82 = load %struct.string___XUB** %elt81		; <%struct.string___XUB*> [#uses=1]
      -	%15 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__create( %struct.ada__text_io__text_afcb* null, i8 2, i8* %val80, %struct.string___XUB* %val82, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.136.1568 )
      -			to label %invcont87 unwind label %lpad228		; <%struct.ada__text_io__text_afcb*> [#uses=2]
      -
      -invcont87:		; preds = %invcont78
      -	invoke void @ada__text_io__set_output( %struct.ada__text_io__text_afcb* %15 )
      -			to label %invcont88 unwind label %lpad228
      -
      -invcont88:		; preds = %invcont87
      -	%16 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1		; <%struct.string___XUB*> [#uses=1]
      -	invoke void @system__secondary_stack__ss_mark( %struct.string___XUB* noalias sret %16 )
      -			to label %invcont89 unwind label %lpad228
      -
      -invcont89:		; preds = %invcont88
      -	%17 = call i8* @llvm.stacksave( )		;  [#uses=1]
      -	%.sub.i = getelementptr [12 x i8]* %1, i32 0, i32 0		;  [#uses=2]
      -	%18 = getelementptr %struct.string___XUB* %A.292.i, i32 0, i32 0		;  [#uses=1]
      -	store i32 1, i32* %18, align 8
      -	%19 = getelementptr %struct.string___XUB* %A.292.i, i32 0, i32 1		;  [#uses=1]
      -	store i32 12, i32* %19, align 4
      -	%20 = invoke fastcc i32 @ce3806g__fxio__put__4.1215( i8* %.sub.i, %struct.string___XUB* %A.292.i, i8 signext -3 )
      -			to label %invcont.i unwind label %lpad.i		;  [#uses=1]
      -
      -invcont.i:		; preds = %invcont89
      -	%21 = getelementptr %struct.string___XUB* %A.301.i, i32 0, i32 0		;  [#uses=1]
      -	store i32 1, i32* %21, align 8
      -	%22 = getelementptr %struct.string___XUB* %A.301.i, i32 0, i32 1		;  [#uses=1]
      -	store i32 %20, i32* %22, align 4
      -	invoke void @ada__text_io__generic_aux__put_item( %struct.ada__text_io__text_afcb* %8, i8* %.sub.i, %struct.string___XUB* %A.301.i )
      -			to label %bb94 unwind label %lpad.i
      -
      -lpad.i:		; preds = %invcont.i, %invcont89
      -	%eh_ptr.i = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select62.i = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr.i, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value )		;  [#uses=0]
      -	call void @llvm.stackrestore( i8* %17 )
      -	%23 = invoke i32 (...)* @_Unwind_Resume( i8* %eh_ptr.i )
      -			to label %.noexc unwind label %lpad252		;  [#uses=0]
      -
      -.noexc:		; preds = %lpad.i
      -	unreachable
      -
      -bb94:		; preds = %invcont.i
      -	%24 = call i8* @llvm.stacksave( )		;  [#uses=1]
      -	%.sub.i360 = getelementptr [12 x i8]* %0, i32 0, i32 0		;  [#uses=2]
      -	%25 = getelementptr %struct.string___XUB* %A.257.i, i32 0, i32 0		;  [#uses=1]
      -	store i32 1, i32* %25, align 8
      -	%26 = getelementptr %struct.string___XUB* %A.257.i, i32 0, i32 1		;  [#uses=1]
      -	store i32 12, i32* %26, align 4
      -	%27 = invoke fastcc i32 @ce3806g__fxio__put__4.1215( i8* %.sub.i360, %struct.string___XUB* %A.257.i, i8 signext -1 )
      -			to label %invcont.i361 unwind label %lpad.i364		;  [#uses=1]
      -
      -invcont.i361:		; preds = %bb94
      -	%28 = getelementptr %struct.string___XUB* %A.266.i, i32 0, i32 0		;  [#uses=1]
      -	store i32 1, i32* %28, align 8
      -	%29 = getelementptr %struct.string___XUB* %A.266.i, i32 0, i32 1		;  [#uses=1]
      -	store i32 %27, i32* %29, align 4
      -	%30 = load %struct.ada__text_io__text_afcb** @ada__text_io__current_out, align 4		; <%struct.ada__text_io__text_afcb*> [#uses=1]
      -	invoke void @ada__text_io__generic_aux__put_item( %struct.ada__text_io__text_afcb* %30, i8* %.sub.i360, %struct.string___XUB* %A.266.i )
      -			to label %invcont95 unwind label %lpad.i364
      -
      -lpad.i364:		; preds = %invcont.i361, %bb94
      -	%eh_ptr.i362 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select62.i363 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr.i362, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value )		;  [#uses=0]
      -	call void @llvm.stackrestore( i8* %24 )
      -	%31 = invoke i32 (...)* @_Unwind_Resume( i8* %eh_ptr.i362 )
      -			to label %.noexc365 unwind label %lpad252		;  [#uses=0]
      -
      -.noexc365:		; preds = %lpad.i364
      -	unreachable
      -
      -invcont95:		; preds = %invcont.i361
      -	%32 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__close( %struct.ada__text_io__text_afcb* %8 )
      -			to label %invcont96 unwind label %lpad252		; <%struct.ada__text_io__text_afcb*> [#uses=1]
      -
      -invcont96:		; preds = %invcont95
      -	%33 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0		; <%struct.string___XUB*> [#uses=1]
      -	invoke void @system__secondary_stack__ss_mark( %struct.string___XUB* noalias sret %33 )
      -			to label %invcont97 unwind label %lpad252
      -
      -invcont97:		; preds = %invcont96
      -	invoke void @report__legal_file_name( %struct.system__file_control_block__pstring* noalias sret %3, i32 1, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.136.1568 )
      -			to label %invcont102 unwind label %lpad256
      -
      -invcont102:		; preds = %invcont97
      -	%elt103 = getelementptr %struct.system__file_control_block__pstring* %3, i32 0, i32 0		;  [#uses=1]
      -	%val104 = load i8** %elt103, align 8		;  [#uses=1]
      -	%elt105 = getelementptr %struct.system__file_control_block__pstring* %3, i32 0, i32 1		; <%struct.string___XUB**> [#uses=1]
      -	%val106 = load %struct.string___XUB** %elt105		; <%struct.string___XUB*> [#uses=1]
      -	%34 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__open( %struct.ada__text_io__text_afcb* %32, i8 0, i8* %val104, %struct.string___XUB* %val106, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.136.1568 )
      -			to label %invcont111 unwind label %lpad256		; <%struct.ada__text_io__text_afcb*> [#uses=2]
      -
      -invcont111:		; preds = %invcont102
      -	%35 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0, i32 0		;  [#uses=1]
      -	%36 = load i32* %35, align 8		;  [#uses=1]
      -	%37 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0, i32 1		;  [#uses=1]
      -	%38 = load i32* %37, align 4		;  [#uses=1]
      -	invoke void @system__secondary_stack__ss_release( i32 %36, i32 %38 )
      -			to label %bb143 unwind label %lpad252
      -
      -bb117:		; preds = %lpad256
      -	call void @__gnat_begin_handler( i8* %eh_ptr257 ) nounwind
      -	%39 = load void ()** @system__soft_links__abort_undefer, align 4		;  [#uses=1]
      -	invoke void %39( )
      -			to label %invcont119 unwind label %lpad264
      -
      -invcont119:		; preds = %bb117
      -	invoke void @report__not_applicable( i8* getelementptr ([47 x i8]* @.str12, i32 0, i32 0), %struct.string___XUB* @C.354.2200 )
      -			to label %invcont124 unwind label %lpad264
      -
      -invcont124:		; preds = %invcont119
      -	invoke void @__gnat_raise_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @incomplete.1177 to %struct.system__standard_library__exception_data*), i8* getelementptr ([14 x i8]* @.str13, i32 0, i32 0), %struct.string___XUB* @C.140.1580 ) noreturn
      -			to label %invcont129 unwind label %lpad264
      -
      -invcont129:		; preds = %invcont124
      -	unreachable
      -
      -bb143:		; preds = %invcont111
      -	%40 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__standard_output( )
      -			to label %invcont144 unwind label %lpad252		; <%struct.ada__text_io__text_afcb*> [#uses=1]
      -
      -invcont144:		; preds = %bb143
      -	invoke void @ada__text_io__set_output( %struct.ada__text_io__text_afcb* %40 )
      -			to label %invcont145 unwind label %lpad252
      -
      -invcont145:		; preds = %invcont144
      -	%41 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__close( %struct.ada__text_io__text_afcb* %15 )
      -			to label %invcont146 unwind label %lpad252		; <%struct.ada__text_io__text_afcb*> [#uses=1]
      -
      -invcont146:		; preds = %invcont145
      -	invoke void @report__legal_file_name( %struct.system__file_control_block__pstring* noalias sret %2, i32 2, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.136.1568 )
      -			to label %invcont151 unwind label %lpad252
      -
      -invcont151:		; preds = %invcont146
      -	%elt152 = getelementptr %struct.system__file_control_block__pstring* %2, i32 0, i32 0		;  [#uses=1]
      -	%val153 = load i8** %elt152, align 8		;  [#uses=1]
      -	%elt154 = getelementptr %struct.system__file_control_block__pstring* %2, i32 0, i32 1		; <%struct.string___XUB**> [#uses=1]
      -	%val155 = load %struct.string___XUB** %elt154		; <%struct.string___XUB*> [#uses=1]
      -	%42 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__open( %struct.ada__text_io__text_afcb* %41, i8 0, i8* %val153, %struct.string___XUB* %val155, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.136.1568 )
      -			to label %invcont160 unwind label %lpad252		; <%struct.ada__text_io__text_afcb*> [#uses=2]
      -
      -invcont160:		; preds = %invcont151
      -	%43 = invoke fastcc i8 @ce3806g__fxio__get.1137( %struct.ada__text_io__text_afcb* %34 ) signext
      -			to label %invcont161 unwind label %lpad252		;  [#uses=1]
      -
      -invcont161:		; preds = %invcont160
      -	%44 = icmp eq i8 %43, -3		;  [#uses=1]
      -	br i1 %44, label %bb169, label %bb163
      -
      -bb163:		; preds = %invcont161
      -	invoke void @report__failed( i8* getelementptr ([33 x i8]* @.str14, i32 0, i32 0), %struct.string___XUB* @C.162.1637 )
      -			to label %bb169 unwind label %lpad252
      -
      -bb169:		; preds = %bb163, %invcont161
      -	%45 = invoke fastcc i8 @ce3806g__fxio__get.1137( %struct.ada__text_io__text_afcb* %42 ) signext
      -			to label %invcont170 unwind label %lpad252		;  [#uses=1]
      -
      -invcont170:		; preds = %bb169
      -	%46 = icmp eq i8 %45, -1		;  [#uses=1]
      -	br i1 %46, label %bb187, label %bb172
      -
      -bb172:		; preds = %invcont170
      -	invoke void @report__failed( i8* getelementptr ([36 x i8]* @.str15, i32 0, i32 0), %struct.string___XUB* @C.164.1642 )
      -			to label %bb187 unwind label %lpad252
      -
      -bb187:		; preds = %bb172, %invcont170
      -	%47 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1, i32 0		;  [#uses=1]
      -	%48 = load i32* %47, align 8		;  [#uses=1]
      -	%49 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1, i32 1		;  [#uses=1]
      -	%50 = load i32* %49, align 4		;  [#uses=1]
      -	invoke void @system__secondary_stack__ss_release( i32 %48, i32 %50 )
      -			to label %bb193 unwind label %lpad228
      -
      -bb193:		; preds = %bb187
      -	%51 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__delete( %struct.ada__text_io__text_afcb* %34 )
      -			to label %invcont194 unwind label %lpad268		; <%struct.ada__text_io__text_afcb*> [#uses=0]
      -
      -invcont194:		; preds = %bb193
      -	%52 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__delete( %struct.ada__text_io__text_afcb* %42 )
      -			to label %bb221 unwind label %lpad268		; <%struct.ada__text_io__text_afcb*> [#uses=0]
      -
      -bb196:		; preds = %lpad268
      -	call void @__gnat_begin_handler( i8* %eh_ptr269 ) nounwind
      -	%53 = load void ()** @system__soft_links__abort_undefer, align 4		;  [#uses=1]
      -	invoke void %53( )
      -			to label %bb203 unwind label %lpad276
      -
      -bb203:		; preds = %bb196
      -	invoke void @__gnat_end_handler( i8* %eh_ptr269 )
      -			to label %bb221 unwind label %lpad272
      -
      -bb205:		; preds = %ppad304
      -	call void @__gnat_begin_handler( i8* %eh_exception.1 ) nounwind
      -	%54 = load void ()** @system__soft_links__abort_undefer, align 4		;  [#uses=1]
      -	invoke void %54( )
      -			to label %bb212 unwind label %lpad284
      -
      -bb212:		; preds = %bb205
      -	invoke void @__gnat_end_handler( i8* %eh_exception.1 )
      -			to label %bb221 unwind label %lpad280
      -
      -bb221:		; preds = %bb212, %bb203, %invcont194
      -	%55 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3, i32 0		;  [#uses=1]
      -	%56 = load i32* %55, align 8		;  [#uses=1]
      -	%57 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3, i32 1		;  [#uses=1]
      -	%58 = load i32* %57, align 4		;  [#uses=1]
      -	call void @system__secondary_stack__ss_release( i32 %56, i32 %58 )
      -	call void @report__result( )
      -	ret void
      -
      -lpad:		; preds = %bb
      -	%eh_ptr = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select227 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value )		;  [#uses=0]
      -	br label %ppad
      -
      -lpad228:		; preds = %ppad294, %ppad288, %bb187, %invcont88, %invcont87, %invcont78, %bb73, %invcont26, %bb11
      -	%eh_ptr229 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select231 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr229, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=1]
      -	br label %ppad304
      -
      -lpad232:		; preds = %invcont17, %invcont12
      -	%eh_ptr233 = call i8* @llvm.eh.exception( )		;  [#uses=6]
      -	%eh_select235 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr233, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @ada__io_exceptions__use_error, %struct.exception* @ada__io_exceptions__name_error, %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=3]
      -	%eh_typeid = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @ada__io_exceptions__use_error, i32 0, i32 0) )		;  [#uses=1]
      -	%59 = icmp eq i32 %eh_select235, %eh_typeid		;  [#uses=1]
      -	br i1 %59, label %bb32, label %ppad291
      -
      -lpad236:		; preds = %lpad240
      -	%eh_ptr237 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select239 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr237, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=1]
      -	br label %ppad288
      -
      -lpad240:		; preds = %invcont38, %invcont33, %bb32
      -	%eh_ptr241 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select243 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr241, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=1]
      -	invoke void @__gnat_end_handler( i8* %eh_ptr233 )
      -			to label %ppad288 unwind label %lpad236
      -
      -lpad244:		; preds = %lpad248
      -	%eh_ptr245 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select247 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr245, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=1]
      -	br label %ppad288
      -
      -lpad248:		; preds = %invcont54, %invcont49, %bb47
      -	%eh_ptr249 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select251 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr249, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=1]
      -	invoke void @__gnat_end_handler( i8* %eh_ptr233 )
      -			to label %ppad288 unwind label %lpad244
      -
      -lpad252:		; preds = %ppad295, %bb172, %bb169, %bb163, %invcont160, %invcont151, %invcont146, %invcont145, %invcont144, %bb143, %invcont111, %invcont96, %invcont95, %lpad.i364, %lpad.i
      -	%eh_ptr253 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select255 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr253, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=1]
      -	br label %ppad294
      -
      -lpad256:		; preds = %invcont102, %invcont97
      -	%eh_ptr257 = call i8* @llvm.eh.exception( )		;  [#uses=4]
      -	%eh_select259 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr257, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @ada__io_exceptions__use_error, %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=2]
      -	%eh_typeid297 = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @ada__io_exceptions__use_error, i32 0, i32 0) )		;  [#uses=1]
      -	%60 = icmp eq i32 %eh_select259, %eh_typeid297		;  [#uses=1]
      -	br i1 %60, label %bb117, label %ppad295
      -
      -lpad260:		; preds = %lpad264
      -	%eh_ptr261 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select263 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr261, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=1]
      -	br label %ppad295
      -
      -lpad264:		; preds = %invcont124, %invcont119, %bb117
      -	%eh_ptr265 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select267 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr265, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=1]
      -	invoke void @__gnat_end_handler( i8* %eh_ptr257 )
      -			to label %ppad295 unwind label %lpad260
      -
      -lpad268:		; preds = %invcont194, %bb193
      -	%eh_ptr269 = call i8* @llvm.eh.exception( )		;  [#uses=5]
      -	%eh_select271 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr269, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @ada__io_exceptions__use_error, %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=2]
      -	%eh_typeid301 = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @ada__io_exceptions__use_error, i32 0, i32 0) )		;  [#uses=1]
      -	%61 = icmp eq i32 %eh_select271, %eh_typeid301		;  [#uses=1]
      -	br i1 %61, label %bb196, label %ppad304
      -
      -lpad272:		; preds = %lpad276, %bb203
      -	%eh_ptr273 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select275 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr273, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=1]
      -	br label %ppad304
      -
      -lpad276:		; preds = %bb196
      -	%eh_ptr277 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select279 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr277, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value )		;  [#uses=1]
      -	invoke void @__gnat_end_handler( i8* %eh_ptr269 )
      -			to label %ppad304 unwind label %lpad272
      -
      -lpad280:		; preds = %lpad284, %bb212
      -	%eh_ptr281 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select283 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr281, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value )		;  [#uses=0]
      -	br label %ppad
      -
      -lpad284:		; preds = %bb205
      -	%eh_ptr285 = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select287 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr285, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value )		;  [#uses=0]
      -	invoke void @__gnat_end_handler( i8* %eh_exception.1 )
      -			to label %ppad unwind label %lpad280
      -
      -ppad:		; preds = %ppad304, %lpad284, %lpad280, %lpad
      -	%eh_exception.2 = phi i8* [ %eh_ptr281, %lpad280 ], [ %eh_ptr, %lpad ], [ %eh_ptr285, %lpad284 ], [ %eh_exception.1, %ppad304 ]		;  [#uses=1]
      -	%62 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3, i32 0		;  [#uses=1]
      -	%63 = load i32* %62, align 8		;  [#uses=1]
      -	%64 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3, i32 1		;  [#uses=1]
      -	%65 = load i32* %64, align 4		;  [#uses=1]
      -	call void @system__secondary_stack__ss_release( i32 %63, i32 %65 )
      -	%66 = call i32 (...)* @_Unwind_Resume( i8* %eh_exception.2 )		;  [#uses=0]
      -	unreachable
      -
      -ppad288:		; preds = %ppad291, %lpad248, %lpad240, %lpad244, %lpad236
      -	%eh_exception.0 = phi i8* [ %eh_ptr245, %lpad244 ], [ %eh_ptr237, %lpad236 ], [ %eh_ptr241, %lpad240 ], [ %eh_ptr249, %lpad248 ], [ %eh_ptr233, %ppad291 ]		;  [#uses=1]
      -	%eh_selector.0 = phi i32 [ %eh_select247, %lpad244 ], [ %eh_select239, %lpad236 ], [ %eh_select243, %lpad240 ], [ %eh_select251, %lpad248 ], [ %eh_select235, %ppad291 ]		;  [#uses=1]
      -	%67 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2, i32 0		;  [#uses=1]
      -	%68 = load i32* %67, align 8		;  [#uses=1]
      -	%69 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2, i32 1		;  [#uses=1]
      -	%70 = load i32* %69, align 4		;  [#uses=1]
      -	invoke void @system__secondary_stack__ss_release( i32 %68, i32 %70 )
      -			to label %ppad304 unwind label %lpad228
      -
      -ppad291:		; preds = %lpad232
      -	%eh_typeid292 = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @ada__io_exceptions__name_error, i32 0, i32 0) )		;  [#uses=1]
      -	%71 = icmp eq i32 %eh_select235, %eh_typeid292		;  [#uses=1]
      -	br i1 %71, label %bb47, label %ppad288
      -
      -ppad294:		; preds = %ppad295, %lpad252
      -	%eh_exception.4 = phi i8* [ %eh_ptr253, %lpad252 ], [ %eh_exception.3, %ppad295 ]		;  [#uses=1]
      -	%eh_selector.4 = phi i32 [ %eh_select255, %lpad252 ], [ %eh_selector.3, %ppad295 ]		;  [#uses=1]
      -	%72 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1, i32 0		;  [#uses=1]
      -	%73 = load i32* %72, align 8		;  [#uses=1]
      -	%74 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1, i32 1		;  [#uses=1]
      -	%75 = load i32* %74, align 4		;  [#uses=1]
      -	invoke void @system__secondary_stack__ss_release( i32 %73, i32 %75 )
      -			to label %ppad304 unwind label %lpad228
      -
      -ppad295:		; preds = %lpad264, %lpad256, %lpad260
      -	%eh_exception.3 = phi i8* [ %eh_ptr261, %lpad260 ], [ %eh_ptr257, %lpad256 ], [ %eh_ptr265, %lpad264 ]		;  [#uses=1]
      -	%eh_selector.3 = phi i32 [ %eh_select263, %lpad260 ], [ %eh_select259, %lpad256 ], [ %eh_select267, %lpad264 ]		;  [#uses=1]
      -	%76 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0, i32 0		;  [#uses=1]
      -	%77 = load i32* %76, align 8		;  [#uses=1]
      -	%78 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0, i32 1		;  [#uses=1]
      -	%79 = load i32* %78, align 4		;  [#uses=1]
      -	invoke void @system__secondary_stack__ss_release( i32 %77, i32 %79 )
      -			to label %ppad294 unwind label %lpad252
      -
      -ppad304:		; preds = %ppad294, %ppad288, %lpad276, %lpad268, %lpad272, %lpad228
      -	%eh_exception.1 = phi i8* [ %eh_ptr229, %lpad228 ], [ %eh_ptr273, %lpad272 ], [ %eh_ptr269, %lpad268 ], [ %eh_ptr277, %lpad276 ], [ %eh_exception.0, %ppad288 ], [ %eh_exception.4, %ppad294 ]		;  [#uses=4]
      -	%eh_selector.1 = phi i32 [ %eh_select231, %lpad228 ], [ %eh_select275, %lpad272 ], [ %eh_select271, %lpad268 ], [ %eh_select279, %lpad276 ], [ %eh_selector.0, %ppad288 ], [ %eh_selector.4, %ppad294 ]		;  [#uses=1]
      -	%eh_typeid305 = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @incomplete.1177, i32 0, i32 0) )		;  [#uses=1]
      -	%80 = icmp eq i32 %eh_selector.1, %eh_typeid305		;  [#uses=1]
      -	br i1 %80, label %bb205, label %ppad
      -}
      -
      -define internal fastcc i8 @ce3806g__fxio__get.1137(%struct.ada__text_io__text_afcb* %file) signext {
      -entry:
      -	%0 = invoke x86_fp80 @ada__text_io__float_aux__get( %struct.ada__text_io__text_afcb* %file, i32 0 )
      -			to label %invcont unwind label %lpad		;  [#uses=3]
      -
      -invcont:		; preds = %entry
      -	%1 = fcmp ult x86_fp80 %0, 0xKFFFEFFFFFFFFFFFFFFFF		;  [#uses=1]
      -	%2 = fcmp ugt x86_fp80 %0, 0xK7FFEFFFFFFFFFFFFFFFF		;  [#uses=1]
      -	%or.cond = or i1 %1, %2		;  [#uses=1]
      -	br i1 %or.cond, label %bb2, label %bb4
      -
      -bb2:		; preds = %invcont
      -	invoke void @__gnat_rcheck_12( i8* getelementptr ([12 x i8]* @.str, i32 0, i32 0), i32 1 ) noreturn
      -			to label %invcont3 unwind label %lpad
      -
      -invcont3:		; preds = %bb2
      -	unreachable
      -
      -bb4:		; preds = %invcont
      -	%3 = mul x86_fp80 %0, 0xK40008000000000000000		;  [#uses=5]
      -	%4 = fcmp ult x86_fp80 %3, 0xKC0068000000000000000		;  [#uses=1]
      -	%5 = fcmp ugt x86_fp80 %3, 0xK4005FE00000000000000		;  [#uses=1]
      -	%or.cond1 = or i1 %4, %5		;  [#uses=1]
      -	br i1 %or.cond1, label %bb8, label %bb10
      -
      -bb8:		; preds = %bb4
      -	invoke void @__gnat_rcheck_10( i8* getelementptr ([14 x i8]* @.str1, i32 0, i32 0), i32 324 ) noreturn
      -			to label %invcont9 unwind label %lpad
      -
      -invcont9:		; preds = %bb8
      -	unreachable
      -
      -bb10:		; preds = %bb4
      -	%6 = fcmp ult x86_fp80 %3, 0xK00000000000000000000		;  [#uses=1]
      -	br i1 %6, label %bb13, label %bb12
      -
      -bb12:		; preds = %bb10
      -	%7 = add x86_fp80 %3, 0xK3FFDFFFFFFFFFFFFFFFF		;  [#uses=1]
      -	br label %bb14
      -
      -bb13:		; preds = %bb10
      -	%8 = sub x86_fp80 %3, 0xK3FFDFFFFFFFFFFFFFFFF		;  [#uses=1]
      -	br label %bb14
      -
      -bb14:		; preds = %bb13, %bb12
      -	%iftmp.339.0.in = phi x86_fp80 [ %8, %bb13 ], [ %7, %bb12 ]		;  [#uses=1]
      -	%iftmp.339.0 = fptosi x86_fp80 %iftmp.339.0.in to i8		;  [#uses=2]
      -	%9 = add i8 %iftmp.339.0, 20		;  [#uses=1]
      -	%10 = icmp ugt i8 %9, 40		;  [#uses=1]
      -	br i1 %10, label %bb16, label %bb22
      -
      -bb16:		; preds = %bb14
      -	invoke void @__gnat_rcheck_12( i8* getelementptr ([14 x i8]* @.str1, i32 0, i32 0), i32 324 ) noreturn
      -			to label %invcont17 unwind label %lpad
      -
      -invcont17:		; preds = %bb16
      -	unreachable
      -
      -bb22:		; preds = %bb14
      -	ret i8 %iftmp.339.0
      -
      -bb23:		; preds = %lpad
      -	tail call void @__gnat_begin_handler( i8* %eh_ptr ) nounwind
      -	%11 = load void ()** @system__soft_links__abort_undefer, align 4		;  [#uses=1]
      -	invoke void %11( )
      -			to label %invcont24 unwind label %lpad33
      -
      -invcont24:		; preds = %bb23
      -	invoke void @__gnat_raise_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @ada__io_exceptions__data_error to %struct.system__standard_library__exception_data*), i8* getelementptr ([47 x i8]* @.str2, i32 0, i32 0), %struct.string___XUB* @C.354.2200 ) noreturn
      -			to label %invcont27 unwind label %lpad33
      -
      -invcont27:		; preds = %invcont24
      -	unreachable
      -
      -lpad:		; preds = %bb16, %bb8, %bb2, %entry
      -	%eh_ptr = tail call i8* @llvm.eh.exception( )		;  [#uses=4]
      -	%eh_select32 = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @constraint_error, i32* @__gnat_all_others_value )		;  [#uses=1]
      -	%eh_typeid = tail call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @constraint_error, i32 0, i32 0) )		;  [#uses=1]
      -	%12 = icmp eq i32 %eh_select32, %eh_typeid		;  [#uses=1]
      -	br i1 %12, label %bb23, label %Unwind
      -
      -lpad33:		; preds = %invcont24, %bb23
      -	%eh_ptr34 = tail call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select36 = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr34, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value )		;  [#uses=0]
      -	tail call void @__gnat_end_handler( i8* %eh_ptr )
      -	br label %Unwind
      -
      -Unwind:		; preds = %lpad, %lpad33
      -	%eh_exception.0 = phi i8* [ %eh_ptr34, %lpad33 ], [ %eh_ptr, %lpad ]		;  [#uses=1]
      -	%13 = tail call i32 (...)* @_Unwind_Resume( i8* %eh_exception.0 )		;  [#uses=0]
      -	unreachable
      -}
      -
      -define internal fastcc i32 @ce3806g__fxio__put__4.1215(i8* %to.0, %struct.string___XUB* %to.1, i8 signext %item) {
      -entry:
      -	%0 = alloca { i64, i64 }		; <{ i64, i64 }*> [#uses=3]
      -	%1 = alloca i64		;  [#uses=3]
      -	%to_addr = alloca %struct.system__file_control_block__pstring		; <%struct.system__file_control_block__pstring*> [#uses=3]
      -	%FRAME.358 = alloca %struct.FRAME.ce3806g__fxio__put__4		; <%struct.FRAME.ce3806g__fxio__put__4*> [#uses=9]
      -	%2 = getelementptr %struct.system__file_control_block__pstring* %to_addr, i32 0, i32 0		;  [#uses=1]
      -	store i8* %to.0, i8** %2, align 8
      -	%3 = getelementptr %struct.system__file_control_block__pstring* %to_addr, i32 0, i32 1		; <%struct.string___XUB**> [#uses=1]
      -	store %struct.string___XUB* %to.1, %struct.string___XUB** %3
      -	%4 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3		; <%struct.system__file_control_block__pstring**> [#uses=9]
      -	store %struct.system__file_control_block__pstring* %to_addr, %struct.system__file_control_block__pstring** %4, align 4
      -	%5 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 0		;  [#uses=3]
      -	store i32 3, i32* %5, align 8
      -	%6 = getelementptr %struct.string___XUB* %to.1, i32 0, i32 0		;  [#uses=1]
      -	%7 = load i32* %6, align 4		;  [#uses=3]
      -	%8 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 2		;  [#uses=3]
      -	store i32 %7, i32* %8, align 8
      -	%9 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4		;  [#uses=9]
      -	store i32 %7, i32* %9, align 8
      -	%item.lobit = lshr i8 %item, 7		;  [#uses=1]
      -	%10 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 6		;  [#uses=3]
      -	store i8 %item.lobit, i8* %10, align 8
      -	%11 = add i32 %7, -1		;  [#uses=1]
      -	%12 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5		;  [#uses=18]
      -	store i32 %11, i32* %12, align 4
      -	%13 = sext i8 %item to i64		;  [#uses=2]
      -	%14 = call i64 @system__exn_lli__exn_long_long_integer( i64 10, i32 1 ) readnone		;  [#uses=1]
      -	%15 = call i64 @system__exn_lli__exn_long_long_integer( i64 10, i32 0 ) readnone		;  [#uses=1]
      -	%16 = mul i64 %15, -2		;  [#uses=1]
      -	%savedstack = call i8* @llvm.stacksave( )		;  [#uses=1]
      -	%17 = call i8* @llvm.stacksave( )		;  [#uses=1]
      -	store i64 0, i64* %1, align 8
      -	%18 = getelementptr { i64, i64 }* %0, i32 0, i32 0		;  [#uses=1]
      -	%19 = getelementptr { i64, i64 }* %0, i32 0, i32 1		;  [#uses=1]
      -	%20 = icmp eq i64 %13, 0		;  [#uses=1]
      -	br i1 %20, label %ce3806g__fxio__put__put_scaled__4.1346.exit, label %bb63.i
      -
      -bb63.i:		; preds = %entry
      -	%yy.0.i = sub i64 0, %14		;  [#uses=1]
      -	invoke void @system__arith_64__scaled_divide( { i64, i64 }* noalias sret %0, i64 %13, i64 %yy.0.i, i64 %16, i8 1 )
      -			to label %invcont.i unwind label %lpad.i
      -
      -invcont.i:		; preds = %bb63.i
      -	%21 = load i64* %18, align 8		;  [#uses=1]
      -	store i64 %21, i64* %1, align 8
      -	%22 = load i64* %19, align 8		;  [#uses=0]
      -	%23 = invoke i64 @system__exn_lli__exn_long_long_integer( i64 10, i32 0 ) readnone
      -			to label %ce3806g__fxio__put__put_scaled__4.1346.exit unwind label %lpad.i		;  [#uses=0]
      -
      -lpad.i:		; preds = %invcont.i, %bb63.i
      -	%eh_ptr.i = call i8* @llvm.eh.exception( )		;  [#uses=2]
      -	%eh_select103.i = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr.i, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value )		;  [#uses=0]
      -	call void @llvm.stackrestore( i8* %17 )
      -	%24 = call i32 (...)* @_Unwind_Resume( i8* %eh_ptr.i )		;  [#uses=0]
      -	unreachable
      -
      -ce3806g__fxio__put__put_scaled__4.1346.exit:		; preds = %invcont.i, %entry
      -	%25 = load i64* %1, align 8		;  [#uses=1]
      -	call fastcc void @ce3806g__fxio__put__put_int64__4.1339( %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i64 %25, i32 -1 )
      -	call void @llvm.stackrestore( i8* %savedstack )
      -	%26 = load i32* %12, align 4		;  [#uses=4]
      -	%27 = load i32* %8, align 8		;  [#uses=1]
      -	%28 = icmp slt i32 %26, %27		;  [#uses=1]
      -	%.pre = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1		;  [#uses=1]
      -	br i1 %28, label %bb71, label %bb72.preheader
      -
      -bb71:		; preds = %ce3806g__fxio__put__put_scaled__4.1346.exit
      -	%29 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1		;  [#uses=2]
      -	store i32 0, i32* %29, align 4
      -	br label %bb72.preheader
      -
      -bb72.preheader:		; preds = %ce3806g__fxio__put__put_scaled__4.1346.exit, %bb71
      -	%.pre-phi = phi i32* [ %29, %bb71 ], [ %.pre, %ce3806g__fxio__put__put_scaled__4.1346.exit ]		;  [#uses=5]
      -	%30 = load i32* %.pre-phi, align 4		;  [#uses=2]
      -	%31 = icmp slt i32 %30, -1		;  [#uses=1]
      -	br i1 %31, label %bb103, label %bb74
      -
      -bb74:		; preds = %bb102, %bb72.preheader
      -	%.rle10 = phi i32 [ %26, %bb72.preheader ], [ %119, %bb102 ]		;  [#uses=1]
      -	%.rle = phi i32 [ %30, %bb72.preheader ], [ %117, %bb102 ]		;  [#uses=4]
      -	%32 = phi i32 [ %26, %bb72.preheader ], [ %119, %bb102 ]		;  [#uses=1]
      -	%33 = load i32* %8, align 8		;  [#uses=1]
      -	%34 = add i32 %33, -1		;  [#uses=1]
      -	%35 = icmp eq i32 %32, %34		;  [#uses=1]
      -	br i1 %35, label %bb76, label %bb98
      -
      -bb76:		; preds = %bb74
      -	%36 = icmp slt i32 %.rle, 1		;  [#uses=1]
      -	br i1 %36, label %bb80, label %bb102
      -
      -bb80:		; preds = %bb76
      -	%37 = icmp sgt i32 %.rle, -1		;  [#uses=1]
      -	%.op = add i32 %.rle, 2		;  [#uses=1]
      -	%38 = select i1 %37, i32 %.op, i32 2		;  [#uses=1]
      -	%39 = load i8* %10, align 8		;  [#uses=1]
      -	%40 = zext i8 %39 to i32		;  [#uses=1]
      -	%41 = add i32 %38, %40		;  [#uses=2]
      -	%42 = load i32* %5, align 8		;  [#uses=1]
      -	%43 = icmp sgt i32 %41, %42		;  [#uses=1]
      -	br i1 %43, label %bb88, label %bb85
      -
      -bb85:		; preds = %bb80, %bb87
      -	%indvar4 = phi i32 [ %indvar.next5, %bb87 ], [ 0, %bb80 ]		;  [#uses=2]
      -	%j.0 = add i32 %indvar4, %41		;  [#uses=1]
      -	%44 = load i32* %12, align 4		;  [#uses=1]
      -	%45 = add i32 %44, 1		;  [#uses=2]
      -	store i32 %45, i32* %12, align 4
      -	%46 = load i32* %9, align 8		;  [#uses=1]
      -	%47 = load %struct.system__file_control_block__pstring** %4, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%48 = getelementptr %struct.system__file_control_block__pstring* %47, i32 0, i32 0		;  [#uses=1]
      -	%49 = load i8** %48, align 4		;  [#uses=1]
      -	%50 = sub i32 %45, %46		;  [#uses=1]
      -	%51 = getelementptr i8* %49, i32 %50		;  [#uses=1]
      -	store i8 32, i8* %51, align 1
      -	%52 = load i32* %5, align 8		;  [#uses=1]
      -	%53 = icmp eq i32 %52, %j.0		;  [#uses=1]
      -	br i1 %53, label %bb88, label %bb87
      -
      -bb87:		; preds = %bb85
      -	%indvar.next5 = add i32 %indvar4, 1		;  [#uses=1]
      -	br label %bb85
      -
      -bb88:		; preds = %bb85, %bb80
      -	%54 = load i8* %10, align 8		;  [#uses=1]
      -	%toBool89 = icmp eq i8 %54, 0		;  [#uses=1]
      -	br i1 %toBool89, label %bb91, label %bb90
      -
      -bb90:		; preds = %bb88
      -	%55 = load i32* %12, align 4		;  [#uses=1]
      -	%56 = add i32 %55, 1		;  [#uses=2]
      -	store i32 %56, i32* %12, align 4
      -	%57 = load i32* %9, align 8		;  [#uses=1]
      -	%58 = load %struct.system__file_control_block__pstring** %4, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%59 = getelementptr %struct.system__file_control_block__pstring* %58, i32 0, i32 0		;  [#uses=1]
      -	%60 = load i8** %59, align 4		;  [#uses=1]
      -	%61 = sub i32 %56, %57		;  [#uses=1]
      -	%62 = getelementptr i8* %60, i32 %61		;  [#uses=1]
      -	store i8 45, i8* %62, align 1
      -	br label %bb91
      -
      -bb91:		; preds = %bb88, %bb90
      -	%63 = load i32* %.pre-phi, align 4		;  [#uses=1]
      -	%64 = icmp slt i32 %63, 0		;  [#uses=1]
      -	br i1 %64, label %bb93, label %bb97
      -
      -bb93:		; preds = %bb91
      -	%65 = load i32* %12, align 4		;  [#uses=1]
      -	%66 = add i32 %65, 1		;  [#uses=2]
      -	store i32 %66, i32* %12, align 4
      -	%67 = load i32* %9, align 8		;  [#uses=1]
      -	%68 = load %struct.system__file_control_block__pstring** %4, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%69 = getelementptr %struct.system__file_control_block__pstring* %68, i32 0, i32 0		;  [#uses=1]
      -	%70 = load i8** %69, align 4		;  [#uses=1]
      -	%71 = sub i32 %66, %67		;  [#uses=1]
      -	%72 = getelementptr i8* %70, i32 %71		;  [#uses=1]
      -	store i8 48, i8* %72, align 1
      -	%73 = load i32* %12, align 4		;  [#uses=1]
      -	%74 = add i32 %73, 1		;  [#uses=2]
      -	store i32 %74, i32* %12, align 4
      -	%75 = load i32* %9, align 8		;  [#uses=1]
      -	%76 = load %struct.system__file_control_block__pstring** %4, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%77 = getelementptr %struct.system__file_control_block__pstring* %76, i32 0, i32 0		;  [#uses=1]
      -	%78 = load i8** %77, align 4		;  [#uses=1]
      -	%79 = sub i32 %74, %75		;  [#uses=1]
      -	%80 = getelementptr i8* %78, i32 %79		;  [#uses=1]
      -	store i8 46, i8* %80, align 1
      -	%81 = load i32* %.pre-phi, align 4		;  [#uses=2]
      -	%82 = icmp sgt i32 %81, -2		;  [#uses=1]
      -	br i1 %82, label %bb97, label %bb96
      -
      -bb96:		; preds = %bb96, %bb93
      -	%indvar = phi i32 [ 0, %bb93 ], [ %indvar.next, %bb96 ]		;  [#uses=2]
      -	%83 = load i32* %12, align 4		;  [#uses=1]
      -	%84 = add i32 %83, 1		;  [#uses=2]
      -	store i32 %84, i32* %12, align 4
      -	%85 = load i32* %9, align 8		;  [#uses=1]
      -	%86 = load %struct.system__file_control_block__pstring** %4, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%87 = getelementptr %struct.system__file_control_block__pstring* %86, i32 0, i32 0		;  [#uses=1]
      -	%88 = load i8** %87, align 4		;  [#uses=1]
      -	%89 = sub i32 %84, %85		;  [#uses=1]
      -	%90 = getelementptr i8* %88, i32 %89		;  [#uses=1]
      -	store i8 48, i8* %90, align 1
      -	%j8.01 = add i32 %indvar, %81		;  [#uses=1]
      -	%91 = add i32 %j8.01, 1		;  [#uses=1]
      -	%phitmp = icmp sgt i32 %91, -2		;  [#uses=1]
      -	%indvar.next = add i32 %indvar, 1		;  [#uses=1]
      -	br i1 %phitmp, label %bb97, label %bb96
      -
      -bb97:		; preds = %bb93, %bb96, %bb91
      -	%92 = load i32* %12, align 4		;  [#uses=1]
      -	%93 = add i32 %92, 1		;  [#uses=2]
      -	store i32 %93, i32* %12, align 4
      -	%94 = load i32* %9, align 8		;  [#uses=1]
      -	%95 = load %struct.system__file_control_block__pstring** %4, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%96 = getelementptr %struct.system__file_control_block__pstring* %95, i32 0, i32 0		;  [#uses=1]
      -	%97 = load i8** %96, align 4		;  [#uses=1]
      -	%98 = sub i32 %93, %94		;  [#uses=1]
      -	%99 = getelementptr i8* %97, i32 %98		;  [#uses=1]
      -	store i8 48, i8* %99, align 1
      -	br label %bb102
      -
      -bb98:		; preds = %bb74
      -	%100 = icmp eq i32 %.rle, -1		;  [#uses=1]
      -	br i1 %100, label %bb100, label %bb101
      -
      -bb100:		; preds = %bb98
      -	%101 = add i32 %.rle10, 1		;  [#uses=2]
      -	store i32 %101, i32* %12, align 4
      -	%102 = load i32* %9, align 8		;  [#uses=1]
      -	%103 = load %struct.system__file_control_block__pstring** %4, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%104 = getelementptr %struct.system__file_control_block__pstring* %103, i32 0, i32 0		;  [#uses=1]
      -	%105 = load i8** %104, align 4		;  [#uses=1]
      -	%106 = sub i32 %101, %102		;  [#uses=1]
      -	%107 = getelementptr i8* %105, i32 %106		;  [#uses=1]
      -	store i8 46, i8* %107, align 1
      -	br label %bb101
      -
      -bb101:		; preds = %bb98, %bb100
      -	%108 = load i32* %12, align 4		;  [#uses=1]
      -	%109 = add i32 %108, 1		;  [#uses=2]
      -	store i32 %109, i32* %12, align 4
      -	%110 = load i32* %9, align 8		;  [#uses=1]
      -	%111 = load %struct.system__file_control_block__pstring** %4, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%112 = getelementptr %struct.system__file_control_block__pstring* %111, i32 0, i32 0		;  [#uses=1]
      -	%113 = load i8** %112, align 4		;  [#uses=1]
      -	%114 = sub i32 %109, %110		;  [#uses=1]
      -	%115 = getelementptr i8* %113, i32 %114		;  [#uses=1]
      -	store i8 48, i8* %115, align 1
      -	br label %bb102
      -
      -bb102:		; preds = %bb76, %bb101, %bb97
      -	%116 = load i32* %.pre-phi, align 4		;  [#uses=1]
      -	%117 = add i32 %116, -1		;  [#uses=3]
      -	store i32 %117, i32* %.pre-phi, align 4
      -	%118 = icmp slt i32 %117, -1		;  [#uses=1]
      -	%119 = load i32* %12, align 4		;  [#uses=3]
      -	br i1 %118, label %bb103, label %bb74
      -
      -bb103:		; preds = %bb102, %bb72.preheader
      -	%.lcssa = phi i32 [ %26, %bb72.preheader ], [ %119, %bb102 ]		;  [#uses=1]
      -	ret i32 %.lcssa
      -}
      -
      -declare x86_fp80 @ada__text_io__float_aux__get(%struct.ada__text_io__text_afcb*, i32)
      -
      -declare void @__gnat_rcheck_12(i8*, i32) noreturn
      -
      -declare void @__gnat_rcheck_10(i8*, i32) noreturn
      -
      -declare i8* @llvm.eh.exception() nounwind
      -
      -declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind
      -
      -declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind
      -
      -declare void @__gnat_begin_handler(i8*) nounwind
      -
      -declare void @__gnat_raise_exception(%struct.system__standard_library__exception_data*, i8*, %struct.string___XUB*) noreturn
      -
      -declare void @__gnat_end_handler(i8*)
      -
      -declare i32 @__gnat_eh_personality(...)
      -
      -declare i32 @_Unwind_Resume(...)
      -
      -define internal fastcc void @ce3806g__fxio__put__put_int64__4.1339(%struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i64 %x, i32 %scale) nounwind {
      -entry:
      -	%0 = icmp eq i64 %x, 0		;  [#uses=1]
      -	br i1 %0, label %return, label %bb
      -
      -bb:		; preds = %entry
      -	%1 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1		;  [#uses=7]
      -	store i32 %scale, i32* %1, align 4
      -	%2 = add i64 %x, 9		;  [#uses=1]
      -	%3 = icmp ugt i64 %2, 18		;  [#uses=1]
      -	br i1 %3, label %bb18, label %bb19
      -
      -bb18:		; preds = %bb
      -	%4 = add i32 %scale, 1		;  [#uses=1]
      -	%5 = sdiv i64 %x, 10		;  [#uses=1]
      -	tail call fastcc void @ce3806g__fxio__put__put_int64__4.1339( %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i64 %5, i32 %4 )
      -	br label %bb19
      -
      -bb19:		; preds = %bb, %bb18
      -	%6 = srem i64 %x, 10		;  [#uses=3]
      -	%neg = sub i64 0, %6		;  [#uses=1]
      -	%abscond = icmp sgt i64 %6, -1		;  [#uses=1]
      -	%abs = select i1 %abscond, i64 %6, i64 %neg		;  [#uses=3]
      -	%7 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5		;  [#uses=16]
      -	%8 = load i32* %7, align 4		;  [#uses=2]
      -	%9 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 2		;  [#uses=1]
      -	%10 = load i32* %9, align 4		;  [#uses=1]
      -	%11 = add i32 %10, -1		;  [#uses=1]
      -	%12 = icmp eq i32 %8, %11		;  [#uses=1]
      -	br i1 %12, label %bb23, label %bb44
      -
      -bb23:		; preds = %bb19
      -	%13 = icmp ne i64 %abs, 0		;  [#uses=1]
      -	%14 = load i32* %1, align 4		;  [#uses=3]
      -	%15 = icmp slt i32 %14, 1		;  [#uses=1]
      -	%16 = or i1 %15, %13		;  [#uses=1]
      -	br i1 %16, label %bb27, label %bb48
      -
      -bb27:		; preds = %bb23
      -	%17 = icmp sgt i32 %14, -1		;  [#uses=1]
      -	%.op = add i32 %14, 2		;  [#uses=1]
      -	%18 = select i1 %17, i32 %.op, i32 2		;  [#uses=1]
      -	%19 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 6		;  [#uses=2]
      -	%20 = load i8* %19, align 1		;  [#uses=1]
      -	%21 = zext i8 %20 to i32		;  [#uses=1]
      -	%22 = add i32 %18, %21		;  [#uses=2]
      -	%23 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 0		;  [#uses=2]
      -	%24 = load i32* %23, align 4		;  [#uses=1]
      -	%25 = icmp sgt i32 %22, %24		;  [#uses=1]
      -	br i1 %25, label %bb34, label %bb31.preheader
      -
      -bb31.preheader:		; preds = %bb27
      -	%26 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4		;  [#uses=1]
      -	%27 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3		; <%struct.system__file_control_block__pstring**> [#uses=1]
      -	br label %bb31
      -
      -bb31:		; preds = %bb31.preheader, %bb33
      -	%indvar = phi i32 [ 0, %bb31.preheader ], [ %indvar.next, %bb33 ]		;  [#uses=2]
      -	%j.0 = add i32 %indvar, %22		;  [#uses=1]
      -	%28 = load i32* %7, align 4		;  [#uses=1]
      -	%29 = add i32 %28, 1		;  [#uses=2]
      -	store i32 %29, i32* %7, align 4
      -	%30 = load i32* %26, align 4		;  [#uses=1]
      -	%31 = load %struct.system__file_control_block__pstring** %27, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%32 = getelementptr %struct.system__file_control_block__pstring* %31, i32 0, i32 0		;  [#uses=1]
      -	%33 = load i8** %32, align 4		;  [#uses=1]
      -	%34 = sub i32 %29, %30		;  [#uses=1]
      -	%35 = getelementptr i8* %33, i32 %34		;  [#uses=1]
      -	store i8 32, i8* %35, align 1
      -	%36 = load i32* %23, align 4		;  [#uses=1]
      -	%37 = icmp eq i32 %36, %j.0		;  [#uses=1]
      -	br i1 %37, label %bb34, label %bb33
      -
      -bb33:		; preds = %bb31
      -	%indvar.next = add i32 %indvar, 1		;  [#uses=1]
      -	br label %bb31
      -
      -bb34:		; preds = %bb31, %bb27
      -	%38 = load i8* %19, align 1		;  [#uses=1]
      -	%toBool35 = icmp eq i8 %38, 0		;  [#uses=1]
      -	br i1 %toBool35, label %bb37, label %bb36
      -
      -bb36:		; preds = %bb34
      -	%39 = load i32* %7, align 4		;  [#uses=1]
      -	%40 = add i32 %39, 1		;  [#uses=2]
      -	store i32 %40, i32* %7, align 4
      -	%41 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4		;  [#uses=1]
      -	%42 = load i32* %41, align 4		;  [#uses=1]
      -	%43 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3		; <%struct.system__file_control_block__pstring**> [#uses=1]
      -	%44 = load %struct.system__file_control_block__pstring** %43, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%45 = getelementptr %struct.system__file_control_block__pstring* %44, i32 0, i32 0		;  [#uses=1]
      -	%46 = load i8** %45, align 4		;  [#uses=1]
      -	%47 = sub i32 %40, %42		;  [#uses=1]
      -	%48 = getelementptr i8* %46, i32 %47		;  [#uses=1]
      -	store i8 45, i8* %48, align 1
      -	br label %bb37
      -
      -bb37:		; preds = %bb34, %bb36
      -	%49 = load i32* %1, align 4		;  [#uses=1]
      -	%50 = icmp slt i32 %49, 0		;  [#uses=1]
      -	br i1 %50, label %bb39, label %bb43
      -
      -bb39:		; preds = %bb37
      -	%51 = load i32* %7, align 4		;  [#uses=1]
      -	%52 = add i32 %51, 1		;  [#uses=2]
      -	store i32 %52, i32* %7, align 4
      -	%53 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4		;  [#uses=3]
      -	%54 = load i32* %53, align 4		;  [#uses=1]
      -	%55 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3		; <%struct.system__file_control_block__pstring**> [#uses=3]
      -	%56 = load %struct.system__file_control_block__pstring** %55, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%57 = getelementptr %struct.system__file_control_block__pstring* %56, i32 0, i32 0		;  [#uses=1]
      -	%58 = load i8** %57, align 4		;  [#uses=1]
      -	%59 = sub i32 %52, %54		;  [#uses=1]
      -	%60 = getelementptr i8* %58, i32 %59		;  [#uses=1]
      -	store i8 48, i8* %60, align 1
      -	%61 = load i32* %7, align 4		;  [#uses=1]
      -	%62 = add i32 %61, 1		;  [#uses=2]
      -	store i32 %62, i32* %7, align 4
      -	%63 = load i32* %53, align 4		;  [#uses=1]
      -	%64 = load %struct.system__file_control_block__pstring** %55, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%65 = getelementptr %struct.system__file_control_block__pstring* %64, i32 0, i32 0		;  [#uses=1]
      -	%66 = load i8** %65, align 4		;  [#uses=1]
      -	%67 = sub i32 %62, %63		;  [#uses=1]
      -	%68 = getelementptr i8* %66, i32 %67		;  [#uses=1]
      -	store i8 46, i8* %68, align 1
      -	%69 = load i32* %1, align 4		;  [#uses=2]
      -	%70 = icmp sgt i32 %69, -2		;  [#uses=1]
      -	br i1 %70, label %bb43, label %bb42
      -
      -bb42:		; preds = %bb42, %bb39
      -	%indvar52 = phi i32 [ 0, %bb39 ], [ %indvar.next53, %bb42 ]		;  [#uses=2]
      -	%71 = load i32* %7, align 4		;  [#uses=1]
      -	%72 = add i32 %71, 1		;  [#uses=2]
      -	store i32 %72, i32* %7, align 4
      -	%73 = load i32* %53, align 4		;  [#uses=1]
      -	%74 = load %struct.system__file_control_block__pstring** %55, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%75 = getelementptr %struct.system__file_control_block__pstring* %74, i32 0, i32 0		;  [#uses=1]
      -	%76 = load i8** %75, align 4		;  [#uses=1]
      -	%77 = sub i32 %72, %73		;  [#uses=1]
      -	%78 = getelementptr i8* %76, i32 %77		;  [#uses=1]
      -	store i8 48, i8* %78, align 1
      -	%j15.050 = add i32 %indvar52, %69		;  [#uses=1]
      -	%79 = add i32 %j15.050, 1		;  [#uses=1]
      -	%phitmp = icmp sgt i32 %79, -2		;  [#uses=1]
      -	%indvar.next53 = add i32 %indvar52, 1		;  [#uses=1]
      -	br i1 %phitmp, label %bb43, label %bb42
      -
      -bb43:		; preds = %bb39, %bb42, %bb37
      -	%80 = trunc i64 %abs to i32		;  [#uses=1]
      -	%81 = getelementptr [10 x i8]* @.str3, i32 0, i32 %80		;  [#uses=1]
      -	%82 = load i8* %81, align 1		;  [#uses=1]
      -	%83 = load i32* %7, align 4		;  [#uses=1]
      -	%84 = add i32 %83, 1		;  [#uses=2]
      -	store i32 %84, i32* %7, align 4
      -	%85 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4		;  [#uses=1]
      -	%86 = load i32* %85, align 4		;  [#uses=1]
      -	%87 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3		; <%struct.system__file_control_block__pstring**> [#uses=1]
      -	%88 = load %struct.system__file_control_block__pstring** %87, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%89 = getelementptr %struct.system__file_control_block__pstring* %88, i32 0, i32 0		;  [#uses=1]
      -	%90 = load i8** %89, align 4		;  [#uses=1]
      -	%91 = sub i32 %84, %86		;  [#uses=1]
      -	%92 = getelementptr i8* %90, i32 %91		;  [#uses=1]
      -	store i8 %82, i8* %92, align 1
      -	br label %bb48
      -
      -bb44:		; preds = %bb19
      -	%93 = load i32* %1, align 4		;  [#uses=1]
      -	%94 = icmp eq i32 %93, -1		;  [#uses=1]
      -	%.pre = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4		;  [#uses=1]
      -	%.pre55 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3		; <%struct.system__file_control_block__pstring**> [#uses=1]
      -	br i1 %94, label %bb46, label %bb47
      -
      -bb46:		; preds = %bb44
      -	%95 = add i32 %8, 1		;  [#uses=2]
      -	store i32 %95, i32* %7, align 4
      -	%96 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4		;  [#uses=2]
      -	%97 = load i32* %96, align 4		;  [#uses=1]
      -	%98 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3		; <%struct.system__file_control_block__pstring**> [#uses=2]
      -	%99 = load %struct.system__file_control_block__pstring** %98, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%100 = getelementptr %struct.system__file_control_block__pstring* %99, i32 0, i32 0		;  [#uses=1]
      -	%101 = load i8** %100, align 4		;  [#uses=1]
      -	%102 = sub i32 %95, %97		;  [#uses=1]
      -	%103 = getelementptr i8* %101, i32 %102		;  [#uses=1]
      -	store i8 46, i8* %103, align 1
      -	br label %bb47
      -
      -bb47:		; preds = %bb44, %bb46
      -	%.pre-phi56 = phi %struct.system__file_control_block__pstring** [ %98, %bb46 ], [ %.pre55, %bb44 ]		; <%struct.system__file_control_block__pstring**> [#uses=1]
      -	%.pre-phi = phi i32* [ %96, %bb46 ], [ %.pre, %bb44 ]		;  [#uses=1]
      -	%104 = trunc i64 %abs to i32		;  [#uses=1]
      -	%105 = getelementptr [10 x i8]* @.str3, i32 0, i32 %104		;  [#uses=1]
      -	%106 = load i8* %105, align 1		;  [#uses=1]
      -	%107 = load i32* %7, align 4		;  [#uses=1]
      -	%108 = add i32 %107, 1		;  [#uses=2]
      -	store i32 %108, i32* %7, align 4
      -	%109 = load i32* %.pre-phi, align 4		;  [#uses=1]
      -	%110 = load %struct.system__file_control_block__pstring** %.pre-phi56, align 4		; <%struct.system__file_control_block__pstring*> [#uses=1]
      -	%111 = getelementptr %struct.system__file_control_block__pstring* %110, i32 0, i32 0		;  [#uses=1]
      -	%112 = load i8** %111, align 4		;  [#uses=1]
      -	%113 = sub i32 %108, %109		;  [#uses=1]
      -	%114 = getelementptr i8* %112, i32 %113		;  [#uses=1]
      -	store i8 %106, i8* %114, align 1
      -	br label %bb48
      -
      -bb48:		; preds = %bb23, %bb47, %bb43
      -	%115 = load i32* %1, align 4		;  [#uses=1]
      -	%116 = add i32 %115, -1		;  [#uses=1]
      -	store i32 %116, i32* %1, align 4
      -	ret void
      -
      -return:		; preds = %entry
      -	ret void
      -}
      -
      -declare i8* @llvm.stacksave() nounwind
      -
      -declare void @system__arith_64__scaled_divide({ i64, i64 }* noalias sret, i64, i64, i64, i8)
      -
      -declare i64 @system__exn_lli__exn_long_long_integer(i64, i32) readnone
      -
      -declare void @llvm.stackrestore(i8*) nounwind
      -
      -declare void @ada__text_io__generic_aux__put_item(%struct.ada__text_io__text_afcb*, i8*, %struct.string___XUB*)
      -
      -declare void @report__test(i8*, %struct.string___XUB*, i8*, %struct.string___XUB*)
      -
      -declare void @system__secondary_stack__ss_mark(%struct.string___XUB* noalias sret)
      -
      -declare void @system__exception_table__register_exception(%struct.system__standard_library__exception_data*)
      -
      -declare void @report__legal_file_name(%struct.system__file_control_block__pstring* noalias sret, i32, i8*, %struct.string___XUB*)
      -
      -declare %struct.ada__text_io__text_afcb* @ada__text_io__create(%struct.ada__text_io__text_afcb*, i8, i8*, %struct.string___XUB*, i8*, %struct.string___XUB*)
      -
      -declare void @system__secondary_stack__ss_release(i32, i32)
      -
      -declare void @report__not_applicable(i8*, %struct.string___XUB*)
      -
      -declare void @ada__text_io__set_output(%struct.ada__text_io__text_afcb*)
      -
      -declare %struct.ada__text_io__text_afcb* @ada__text_io__close(%struct.ada__text_io__text_afcb*)
      -
      -declare %struct.ada__text_io__text_afcb* @ada__text_io__open(%struct.ada__text_io__text_afcb*, i8, i8*, %struct.string___XUB*, i8*, %struct.string___XUB*)
      -
      -declare %struct.ada__text_io__text_afcb* @ada__text_io__standard_output()
      -
      -declare void @report__failed(i8*, %struct.string___XUB*)
      -
      -declare %struct.ada__text_io__text_afcb* @ada__text_io__delete(%struct.ada__text_io__text_afcb*)
      -
      -declare void @report__result()
      
      Modified: llvm/trunk/win32/Transforms/Transforms.vcproj
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Transforms/Transforms.vcproj?rev=56342&r1=56341&r2=56342&view=diff
      
      ==============================================================================
      --- llvm/trunk/win32/Transforms/Transforms.vcproj (original)
      +++ llvm/trunk/win32/Transforms/Transforms.vcproj Fri Sep 19 03:23:44 2008
      @@ -500,10 +500,6 @@
       					>
       				
       				
      -				
      -				
       				
      
      
      
      
      From baldrick at free.fr  Fri Sep 19 04:16:33 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Fri, 19 Sep 2008 09:16:33 -0000
      Subject: [llvm-commits] [llvm] r56343 -
      	/llvm/trunk/test/Transforms/AddReadAttrs/dg.exp
      Message-ID: <200809190916.m8J9GXWl012751@zion.cs.uiuc.edu>
      
      Author: baldrick
      Date: Fri Sep 19 04:16:32 2008
      New Revision: 56343
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56343&view=rev
      Log:
      Turn on these tests!
      
      Added:
          llvm/trunk/test/Transforms/AddReadAttrs/dg.exp
      
      Added: llvm/trunk/test/Transforms/AddReadAttrs/dg.exp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/AddReadAttrs/dg.exp?rev=56343&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Transforms/AddReadAttrs/dg.exp (added)
      +++ llvm/trunk/test/Transforms/AddReadAttrs/dg.exp Fri Sep 19 04:16:32 2008
      @@ -0,0 +1,3 @@
      +load_lib llvm.exp
      +
      +RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
      
      
      
      
      From baldrick at free.fr  Fri Sep 19 04:20:06 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Fri, 19 Sep 2008 09:20:06 -0000
      Subject: [llvm-commits] [llvm] r56344 -
       /llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll
      Message-ID: <200809190920.m8J9K6LQ012871@zion.cs.uiuc.edu>
      
      Author: baldrick
      Date: Fri Sep 19 04:20:05 2008
      New Revision: 56344
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56344&view=rev
      Log:
      Add test for improvement of readonly to readnone,
      and non-demotion of readnone to readonly.
      
      Modified:
          llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll
      
      Modified: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll?rev=56344&r1=56343&r2=56344&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll (original)
      +++ llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll Fri Sep 19 04:20:05 2008
      @@ -1,9 +1,18 @@
      -; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | grep readnone | count 2
      +; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | grep readnone | count 4
      + at x = global i32 0
      +
      +declare i32 @e() readnone
       
       define i32 @f() {
      -entry:
       	%tmp = call i32 @e( )		;  [#uses=1]
       	ret i32 %tmp
       }
       
      -declare i32 @e() readnone
      +define i32 @g() readonly {
      +	ret i32 0
      +}
      +
      +define i32 @h() readnone {
      +	%tmp = load i32* @x		;  [#uses=1]
      +	ret i32 %tmp
      +}
      
      
      
      
      From espindola at google.com  Fri Sep 19 09:09:11 2008
      From: espindola at google.com (Rafael Espindola)
      Date: Fri, 19 Sep 2008 15:09:11 +0100
      Subject: [llvm-commits] [patch] add bound checks to SmallVector
      In-Reply-To: <745E0CF5-3D34-4CB8-92D0-62B26033BBCC@apple.com>
      References: <38a0d8450808280918s29a70eefv76a5ee087925c7f@mail.gmail.com>
      	<8A6B72C7-A574-4BF3-A2FF-2C9D5F480615@apple.com>
      	<38a0d8450809050427v3cf211b0of4c945e5d1339a3f@mail.gmail.com>
      	<745E0CF5-3D34-4CB8-92D0-62B26033BBCC@apple.com>
      Message-ID: <38a0d8450809190709g783e7ad2if814b5a223136f72@mail.gmail.com>
      
      > Probably not sufficient. Can you try it on kimwitu++? We are
      > interested in llc time.
      
      Using kc.llvm.bc, the best llc times over 3 runs are
      
      debug build: 0m22.455s
      debug build + bound check: 0m22.447s
      opt build: 0m4.158s
      opt build + bound check: 0m4.170s
      
      The test were done on linux x86-64. Looks like noise only. OK to
      commit the patch?
      
      > Thanks,
      >
      > Evan
      
      
      Cheers,
      -- 
      Rafael Avila de Espindola
      
      Google | Gordon House | Barrow Street | Dublin 4 | Ireland
      Registered in Dublin, Ireland | Registration Number: 368047
      -------------- next part --------------
      A non-text attachment was scrubbed...
      Name: llvm-smallvector.patch
      Type: text/x-diff
      Size: 818 bytes
      Desc: not available
      Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080919/12eb321c/attachment.bin 
      
      From baldrick at free.fr  Fri Sep 19 09:34:37 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Fri, 19 Sep 2008 14:34:37 -0000
      Subject: [llvm-commits] [llvm] r56345 - /llvm/trunk/tools/opt/opt.cpp
      Message-ID: <200809191434.m8JEYb9S022690@zion.cs.uiuc.edu>
      
      Author: baldrick
      Date: Fri Sep 19 09:34:36 2008
      New Revision: 56345
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56345&view=rev
      Log:
      Turn on the AddReadAttrs pass.
      
      Modified:
          llvm/trunk/tools/opt/opt.cpp
      
      Modified: llvm/trunk/tools/opt/opt.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=56345&r1=56344&r2=56345&view=diff
      
      ==============================================================================
      --- llvm/trunk/tools/opt/opt.cpp (original)
      +++ llvm/trunk/tools/opt/opt.cpp Fri Sep 19 09:34:36 2008
      @@ -288,8 +288,10 @@
         }
         MPM.add(createInstructionCombiningPass());    // Clean up after IPCP & DAE
         MPM.add(createCFGSimplificationPass());       // Clean up after IPCP & DAE
      -  if (UnitAtATime)
      +  if (UnitAtATime) {
           MPM.add(createPruneEHPass());               // Remove dead EH info
      +    MPM.add(createAddReadAttrsPass());          // Set readonly/readnone attrs
      +  }
         if (OptLevel > 1)
           MPM.add(createFunctionInliningPass());      // Inline small functions
         if (OptLevel > 2)
      @@ -360,6 +362,7 @@
         addPass(PM, createCFGSimplificationPass());    // Clean up after IPCP & DAE
       
         addPass(PM, createPruneEHPass());              // Remove dead EH info
      +  addPass(PM, createAddReadAttrsPass());         // Set readonly/readnone attrs
       
         if (!DisableInline)
           addPass(PM, createFunctionInliningPass());   // Inline small functions
      
      
      
      
      From baldrick at free.fr  Fri Sep 19 09:37:06 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Fri, 19 Sep 2008 14:37:06 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56346 - in /llvm-gcc-4.2/trunk/gcc:
       llvm-backend.cpp llvm-linker-hack.cpp
      Message-ID: <200809191437.m8JEb68L022762@zion.cs.uiuc.edu>
      
      Author: baldrick
      Date: Fri Sep 19 09:37:06 2008
      New Revision: 56346
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56346&view=rev
      Log:
      Turn on the AddReadAttrs pass.
      
      Modified:
          llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
          llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
      
      Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=56346&r1=56345&r2=56346&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
      +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Fri Sep 19 09:37:06 2008
      @@ -400,8 +400,11 @@
           }
           PM->add(createInstructionCombiningPass());    // Clean up after IPCP & DAE
           PM->add(createCFGSimplificationPass());       // Clean up after IPCP & DAE
      -    if (flag_unit_at_a_time && flag_exceptions)
      -      PM->add(createPruneEHPass());               // Remove dead EH info
      +    if (flag_unit_at_a_time) {
      +      if (flag_exceptions)
      +        PM->add(createPruneEHPass());             // Remove dead EH info
      +      PM->add(createAddReadAttrsPass());          // Set readonly/readnone attrs
      +    }
           if (flag_inline_trees > 1)                    // respect -fno-inline-functions
             PM->add(createFunctionInliningPass());      // Inline small functions
           else if (NeedAlwaysInliner)
      
      Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=56346&r1=56345&r2=56346&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original)
      +++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Fri Sep 19 09:37:06 2008
      @@ -85,6 +85,7 @@
         llvm::createMemCpyOptPass();
         llvm::createDeadTypeEliminationPass();
         llvm::createLoopDeletionPass();
      +  llvm::createAddReadAttrsPass();
       
         std::string Err;
         llvm::TargetMachineRegistry::getClosestStaticTargetForModule(*MP->getModule(),
      
      
      
      
      From ggreif at gmail.com  Fri Sep 19 10:03:58 2008
      From: ggreif at gmail.com (Gabor Greif)
      Date: Fri, 19 Sep 2008 15:03:58 -0000
      Subject: [llvm-commits] [llvm] r56348 - in /llvm/trunk: include/llvm/Use.h
       include/llvm/Value.h lib/VMCore/Use.cpp lib/VMCore/Value.cpp
       lib/VMCore/getValue.cpp
      Message-ID: <200809191503.m8JF3x5M023675@zion.cs.uiuc.edu>
      
      Author: ggreif
      Date: Fri Sep 19 10:03:57 2008
      New Revision: 56348
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56348&view=rev
      Log:
      first shot at removing Use::Val
      untested, Use::swap() is definitely not done yet
      
      Added:
          llvm/trunk/lib/VMCore/getValue.cpp
            - copied unchanged from r56283, llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
      Modified:
          llvm/trunk/include/llvm/Use.h
          llvm/trunk/include/llvm/Value.h
          llvm/trunk/lib/VMCore/Use.cpp
          llvm/trunk/lib/VMCore/Value.cpp
      
      Modified: llvm/trunk/include/llvm/Use.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Use.h?rev=56348&r1=56347&r2=56348&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Use.h (original)
      +++ llvm/trunk/include/llvm/Use.h Fri Sep 19 10:03:57 2008
      @@ -66,11 +66,22 @@
       // Use is here to make keeping the "use" list of a Value up-to-date really easy.
       //
       class Use {
      -private:
      +  class UseWaymark;
      +  friend class UseWaymark;
      +  Value *getValue() const;
      +  /// nilUse - returns a 'token' that marks the end of the def/use chain
      +  static Use *nilUse(const Value *V) {
      +    return addTag((Use*)V, fullStopTagN);
      +  }
      +  static bool isNil(Use *U) { return extractTag(U) == fullStopTagN; }
      +  void showWaymarks() const;
      +  static bool isStop(Use *U) {
      +    return isStopTag(extractTag(U));
      +  }
      +public:
         /// init - specify Value and User
         /// @deprecated in 2.4, will be removed soon
         inline void init(Value *V, User *U);
      -public:
         /// swap - provide a fast substitute to std::swap
         /// that also works with less standard-compliant compilers
         void swap(Use &RHS);
      @@ -81,7 +92,7 @@
       
         /// Destructor - Only for zap()
         inline ~Use() {
      -    if (Val) removeFromList();
      +    if (Val1) removeFromList();
         }
       
         /// Default ctor - This leaves the Use completely uninitialized.  The only thing
      @@ -91,11 +102,22 @@
         enum PrevPtrTag { zeroDigitTag = noTag
                         , oneDigitTag = tagOne
                         , stopTag = tagTwo
      -                  , fullStopTag = tagThree };
      +                  , fullStopTag = tagThree
      +                  , tagMask = tagThree };
       
      +  enum NextPtrTag { zeroDigitTagN = tagTwo
      +                  , oneDigitTagN = tagOne
      +                  , stopTagN = noTag
      +                  , fullStopTagN = tagThree
      +                  , tagMaskN = tagThree };
      +
      +  static bool isStopTag(NextPtrTag T) {
      +    bool P[] = { true, false, false, true };
      +    return P[T];
      +  }
       public:
      -  operator Value*() const { return Val; }
      -  Value *get() const { return Val; }
      +  operator Value*() const { return get(); }
      +  inline Value *get() const;
         User *getUser() const;
         const Use* getImpliedUser() const;
         static Use *initTags(Use *Start, Use *Stop, ptrdiff_t Done = 0);
      @@ -108,31 +130,38 @@
           return RHS;
         }
         const Use &operator=(const Use &RHS) {
      -    set(RHS.Val);
      +    set(RHS.Val1);
           return *this;
         }
       
      -        Value *operator->()       { return Val; }
      -  const Value *operator->() const { return Val; }
      +        Value *operator->()       { return get(); }
      +  const Value *operator->() const { return get(); }
       
      -  Use *getNext() const { return Next; }
      +  Use *getNext() const { return extractTag(Next) == fullStopTagN
      +			   ? 0
      +			   : stripTag(Next); }
       private:
      -  Value *Val;
      +  Value *Val1;
         Use *Next, **Prev;
       
         void setPrev(Use **NewPrev) {
      -    Prev = transferTag(Prev, NewPrev);
      +    Prev = transferTag(Prev, NewPrev);
         }
         void addToList(Use **List) {
           Next = *List;
      -    if (Next) Next->setPrev(&Next);
      +    Use *StrippedNext(getNext());
      +    if (StrippedNext) StrippedNext->setPrev(&Next);
           setPrev(List);
           *List = this;
         }
         void removeFromList() {
      -    Use **StrippedPrev = stripTag(Prev);
      +    // __builtin_prefetch(Next);
      +    Use **StrippedPrev = stripTag(Prev);
      +    Use *StrippedNext(getNext());
      +    if (isStop(Next))
      +      assert((isStop(*StrippedPrev) || (StrippedNext ? isStop(StrippedNext->Next) : true)) && "joining digits?");
           *StrippedPrev = Next;
      -    if (Next) Next->setPrev(StrippedPrev);
      +    if (StrippedNext) StrippedNext->setPrev(StrippedPrev);
         }
       
         friend class Value;
      @@ -161,7 +190,10 @@
         typedef value_use_iterator _Self;
       
         Use *U;
      -  explicit value_use_iterator(Use *u) : U(u) {}
      +  explicit value_use_iterator(Use *u) : U(extractTag(u)
      +					  == Use::fullStopTagN
      +					  ? 0
      +					  : stripTag(u)) {}
         friend class Value;
       public:
         typedef typename super::reference reference;
      @@ -178,11 +210,11 @@
         }
       
         /// atEnd - return true if this iterator is equal to use_end() on the value.
      -  bool atEnd() const { return U == 0; }
      +  bool atEnd() const { return !U; }
       
         // Iterator traversal: forward iteration only
         _Self &operator++() {          // Preincrement
      -    assert(U && "Cannot increment end iterator!");
      +    assert(!atEnd() && "Cannot increment end iterator!");
           U = U->getNext();
           return *this;
         }
      @@ -190,9 +222,9 @@
           _Self tmp = *this; ++*this; return tmp;
         }
       
      -  // Retrieve a pointer to the current User.
      +  // Retrieve a reference to the current User
         UserTy *operator*() const {
      -    assert(U && "Cannot dereference end iterator!");
      +    assert(!atEnd() && "Cannot dereference end iterator!");
           return U->getUser();
         }
       
      @@ -206,6 +238,11 @@
         unsigned getOperandNo() const;
       };
       
      +Value *Use::get() const {
      +  return fullStopTagN == extractTag(Next)
      +    ? reinterpret_cast(stripTag(Next))
      +    : (Val1 == getValue() ? Val1 : 0); // should crash if not equal!
      +}
       
       template<> struct simplify_type > {
         typedef User* SimpleType;
      
      Modified: llvm/trunk/include/llvm/Value.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=56348&r1=56347&r2=56348&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Value.h (original)
      +++ llvm/trunk/include/llvm/Value.h Fri Sep 19 10:03:57 2008
      @@ -138,7 +138,7 @@
         typedef value_use_iterator       use_iterator;
         typedef value_use_iterator use_const_iterator;
       
      -  bool               use_empty() const { return UseList == 0; }
      +  bool               use_empty() const { return Use::isNil(UseList); }
         use_iterator       use_begin()       { return use_iterator(UseList); }
         use_const_iterator use_begin() const { return use_const_iterator(UseList); }
         use_iterator       use_end()         { return use_iterator(0);   }
      @@ -245,14 +245,16 @@
       }
         
       void Use::init(Value *V, User *) {
      -  Val = V;
      +  Val1 = V;
         if (V) V->addUse(*this);
      +  else Next = nilUse(0);
       }
       
       void Use::set(Value *V) {
      -  if (Val) removeFromList();
      -  Val = V;
      +  if (Val1) removeFromList();
      +  Val1 = V;
         if (V) V->addUse(*this);
      +  else Next = nilUse(0);
       }
       
       
      
      Modified: llvm/trunk/lib/VMCore/Use.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Use.cpp?rev=56348&r1=56347&r2=56348&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/Use.cpp (original)
      +++ llvm/trunk/lib/VMCore/Use.cpp Fri Sep 19 10:03:57 2008
      @@ -20,8 +20,31 @@
       //===----------------------------------------------------------------------===//
       
       void Use::swap(Use &RHS) {
      -  Value *V1(Val);
      -  Value *V2(RHS.Val);
      +  ptrdiff_t dist((char*)&RHS - (char*)this);
      +
      +  if (dist) {
      +    Use *valid1(stripTag(Next));
      +    Use *valid2(stripTag(RHS.Next));
      +    if (valid1 && valid2) {
      +      bool real1(fullStopTagN != extractTag(Next));
      +      bool real2(fullStopTagN != extractTag(RHS.Next));
      +      (char*&)*stripTag(Prev) += dist;
      +      (char*&)*stripTag(RHS.Prev) -= dist;
      +      if (real1)
      +	(char*&)valid1->Next += dist;
      +      if (real2)
      +        (char*&)valid2->Next -= dist;
      +
      +    }
      +
      +    // swap the members
      +    std::swap(Next, RHS.Next);
      +    Use** Prev1 = transferTag(Prev, stripTag(RHS.Prev));
      +    RHS.Prev = transferTag(RHS.Prev, stripTag(Prev));
      +    Prev = Prev1;
      +  }
      +  /*  Value *V1(Val1);
      +  Value *V2(RHS.Val1);
         if (V1 != V2) {
           if (V1) {
             removeFromList();
      @@ -29,19 +52,20 @@
       
           if (V2) {
             RHS.removeFromList();
      -      Val = V2;
      +      Val1 = V2;
             V2->addUse(*this);
           } else {
      -      Val = 0;
      +      Val1 = 0;
           }
       
           if (V1) {
      -      RHS.Val = V1;
      +      RHS.Val1 = V1;
             V1->addUse(RHS);
           } else {
      -      RHS.Val = 0;
      +      RHS.Val1 = 0;
           }
         }
      +  */
       }
       
       //===----------------------------------------------------------------------===//
      @@ -52,7 +76,7 @@
         const Use *Current = this;
       
         while (true) {
      -    unsigned Tag = extractTag((Current++)->Prev);
      +    unsigned Tag = extractTag((Current++)->Prev);
           switch (Tag) {
             case zeroDigitTag:
             case oneDigitTag:
      @@ -62,7 +86,7 @@
               ++Current;
               ptrdiff_t Offset = 1;
               while (true) {
      -          unsigned Tag = extractTag(Current->Prev);
      +          unsigned Tag = extractTag(Current->Prev);
                 switch (Tag) {
                   case zeroDigitTag:
                   case oneDigitTag:
      @@ -89,7 +113,8 @@
         ptrdiff_t Count = Done;
         while (Start != Stop) {
           --Stop;
      -    Stop->Val = 0;
      +    Stop->Val1 = 0;
      +    Stop->Next = nilUse(0);
           if (!Count) {
             Stop->Prev = reinterpret_cast(Done == 0 ? fullStopTag : stopTag);
             ++Done;
      
      Modified: llvm/trunk/lib/VMCore/Value.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=56348&r1=56347&r2=56348&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/Value.cpp (original)
      +++ llvm/trunk/lib/VMCore/Value.cpp Fri Sep 19 10:03:57 2008
      @@ -34,7 +34,7 @@
       
       Value::Value(const Type *ty, unsigned scid)
         : SubclassID(scid), SubclassData(0), VTy(checkType(ty)),
      -    UseList(0), Name(0) {
      +    UseList(Use::nilUse(this)), Name(0) {
         if (isa(this) || isa(this))
           assert((VTy->isFirstClassType() || VTy == Type::VoidTy ||
                   isa(ty) || VTy->getTypeID() == Type::StructTyID) &&
      @@ -298,7 +298,7 @@
       //
       void Value::uncheckedReplaceAllUsesWith(Value *New) {
         while (!use_empty()) {
      -    Use &U = *UseList;
      +    Use &U = *use_begin().U;
           // Must handle Constants specially, we cannot call replaceUsesOfWith on a
           // constant because they are uniqued.
           if (Constant *C = dyn_cast(U.getUser())) {
      
      
      
      
      From ggreif at gmail.com  Fri Sep 19 10:08:25 2008
      From: ggreif at gmail.com (Gabor Greif)
      Date: Fri, 19 Sep 2008 08:08:25 -0700 (PDT)
      Subject: [llvm-commits] [llvm] r56348 - in /llvm/trunk:
      	include/llvm/Use.h include/llvm/Value.h lib/VMCore/Use.cpp
      	lib/VMCore/Value.cpp lib/VMCore/getValue.cpp
      In-Reply-To: <200809191503.m8JF3x5M023675@zion.cs.uiuc.edu>
      References: <200809191503.m8JF3x5M023675@zion.cs.uiuc.edu>
      Message-ID: 
      
      Sorry, this was not intended to go on trunk, but on the branch!!!!
      
      
      I am backing it out now,
      greatest apologies!!!
      
         Gabor
      
      
      From ggreif at gmail.com  Fri Sep 19 10:13:21 2008
      From: ggreif at gmail.com (Gabor Greif)
      Date: Fri, 19 Sep 2008 15:13:21 -0000
      Subject: [llvm-commits] [llvm] r56349 - in /llvm/trunk: include/llvm/Use.h
       include/llvm/Value.h lib/VMCore/Use.cpp lib/VMCore/Value.cpp
       lib/VMCore/getValue.cpp
      Message-ID: <200809191513.m8JFDMpg023964@zion.cs.uiuc.edu>
      
      Author: ggreif
      Date: Fri Sep 19 10:13:20 2008
      New Revision: 56349
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56349&view=rev
      Log:
      backing out my last commit, it was not intended to go on the trunk
      
      Removed:
          llvm/trunk/lib/VMCore/getValue.cpp
      Modified:
          llvm/trunk/include/llvm/Use.h
          llvm/trunk/include/llvm/Value.h
          llvm/trunk/lib/VMCore/Use.cpp
          llvm/trunk/lib/VMCore/Value.cpp
      
      Modified: llvm/trunk/include/llvm/Use.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Use.h?rev=56349&r1=56348&r2=56349&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Use.h (original)
      +++ llvm/trunk/include/llvm/Use.h Fri Sep 19 10:13:20 2008
      @@ -66,22 +66,11 @@
       // Use is here to make keeping the "use" list of a Value up-to-date really easy.
       //
       class Use {
      -  class UseWaymark;
      -  friend class UseWaymark;
      -  Value *getValue() const;
      -  /// nilUse - returns a 'token' that marks the end of the def/use chain
      -  static Use *nilUse(const Value *V) {
      -    return addTag((Use*)V, fullStopTagN);
      -  }
      -  static bool isNil(Use *U) { return extractTag(U) == fullStopTagN; }
      -  void showWaymarks() const;
      -  static bool isStop(Use *U) {
      -    return isStopTag(extractTag(U));
      -  }
      -public:
      +private:
         /// init - specify Value and User
         /// @deprecated in 2.4, will be removed soon
         inline void init(Value *V, User *U);
      +public:
         /// swap - provide a fast substitute to std::swap
         /// that also works with less standard-compliant compilers
         void swap(Use &RHS);
      @@ -92,7 +81,7 @@
       
         /// Destructor - Only for zap()
         inline ~Use() {
      -    if (Val1) removeFromList();
      +    if (Val) removeFromList();
         }
       
         /// Default ctor - This leaves the Use completely uninitialized.  The only thing
      @@ -102,22 +91,11 @@
         enum PrevPtrTag { zeroDigitTag = noTag
                         , oneDigitTag = tagOne
                         , stopTag = tagTwo
      -                  , fullStopTag = tagThree
      -                  , tagMask = tagThree };
      +                  , fullStopTag = tagThree };
       
      -  enum NextPtrTag { zeroDigitTagN = tagTwo
      -                  , oneDigitTagN = tagOne
      -                  , stopTagN = noTag
      -                  , fullStopTagN = tagThree
      -                  , tagMaskN = tagThree };
      -
      -  static bool isStopTag(NextPtrTag T) {
      -    bool P[] = { true, false, false, true };
      -    return P[T];
      -  }
       public:
      -  operator Value*() const { return get(); }
      -  inline Value *get() const;
      +  operator Value*() const { return Val; }
      +  Value *get() const { return Val; }
         User *getUser() const;
         const Use* getImpliedUser() const;
         static Use *initTags(Use *Start, Use *Stop, ptrdiff_t Done = 0);
      @@ -130,38 +108,31 @@
           return RHS;
         }
         const Use &operator=(const Use &RHS) {
      -    set(RHS.Val1);
      +    set(RHS.Val);
           return *this;
         }
       
      -        Value *operator->()       { return get(); }
      -  const Value *operator->() const { return get(); }
      +        Value *operator->()       { return Val; }
      +  const Value *operator->() const { return Val; }
       
      -  Use *getNext() const { return extractTag(Next) == fullStopTagN
      -			   ? 0
      -			   : stripTag(Next); }
      +  Use *getNext() const { return Next; }
       private:
      -  Value *Val1;
      +  Value *Val;
         Use *Next, **Prev;
       
         void setPrev(Use **NewPrev) {
      -    Prev = transferTag(Prev, NewPrev);
      +    Prev = transferTag(Prev, NewPrev);
         }
         void addToList(Use **List) {
           Next = *List;
      -    Use *StrippedNext(getNext());
      -    if (StrippedNext) StrippedNext->setPrev(&Next);
      +    if (Next) Next->setPrev(&Next);
           setPrev(List);
           *List = this;
         }
         void removeFromList() {
      -    // __builtin_prefetch(Next);
      -    Use **StrippedPrev = stripTag(Prev);
      -    Use *StrippedNext(getNext());
      -    if (isStop(Next))
      -      assert((isStop(*StrippedPrev) || (StrippedNext ? isStop(StrippedNext->Next) : true)) && "joining digits?");
      +    Use **StrippedPrev = stripTag(Prev);
           *StrippedPrev = Next;
      -    if (StrippedNext) StrippedNext->setPrev(StrippedPrev);
      +    if (Next) Next->setPrev(StrippedPrev);
         }
       
         friend class Value;
      @@ -190,10 +161,7 @@
         typedef value_use_iterator _Self;
       
         Use *U;
      -  explicit value_use_iterator(Use *u) : U(extractTag(u)
      -					  == Use::fullStopTagN
      -					  ? 0
      -					  : stripTag(u)) {}
      +  explicit value_use_iterator(Use *u) : U(u) {}
         friend class Value;
       public:
         typedef typename super::reference reference;
      @@ -210,11 +178,11 @@
         }
       
         /// atEnd - return true if this iterator is equal to use_end() on the value.
      -  bool atEnd() const { return !U; }
      +  bool atEnd() const { return U == 0; }
       
         // Iterator traversal: forward iteration only
         _Self &operator++() {          // Preincrement
      -    assert(!atEnd() && "Cannot increment end iterator!");
      +    assert(U && "Cannot increment end iterator!");
           U = U->getNext();
           return *this;
         }
      @@ -222,9 +190,9 @@
           _Self tmp = *this; ++*this; return tmp;
         }
       
      -  // Retrieve a reference to the current User
      +  // Retrieve a pointer to the current User.
         UserTy *operator*() const {
      -    assert(!atEnd() && "Cannot dereference end iterator!");
      +    assert(U && "Cannot dereference end iterator!");
           return U->getUser();
         }
       
      @@ -238,11 +206,6 @@
         unsigned getOperandNo() const;
       };
       
      -Value *Use::get() const {
      -  return fullStopTagN == extractTag(Next)
      -    ? reinterpret_cast(stripTag(Next))
      -    : (Val1 == getValue() ? Val1 : 0); // should crash if not equal!
      -}
       
       template<> struct simplify_type > {
         typedef User* SimpleType;
      
      Modified: llvm/trunk/include/llvm/Value.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=56349&r1=56348&r2=56349&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Value.h (original)
      +++ llvm/trunk/include/llvm/Value.h Fri Sep 19 10:13:20 2008
      @@ -138,7 +138,7 @@
         typedef value_use_iterator       use_iterator;
         typedef value_use_iterator use_const_iterator;
       
      -  bool               use_empty() const { return Use::isNil(UseList); }
      +  bool               use_empty() const { return UseList == 0; }
         use_iterator       use_begin()       { return use_iterator(UseList); }
         use_const_iterator use_begin() const { return use_const_iterator(UseList); }
         use_iterator       use_end()         { return use_iterator(0);   }
      @@ -245,16 +245,14 @@
       }
         
       void Use::init(Value *V, User *) {
      -  Val1 = V;
      +  Val = V;
         if (V) V->addUse(*this);
      -  else Next = nilUse(0);
       }
       
       void Use::set(Value *V) {
      -  if (Val1) removeFromList();
      -  Val1 = V;
      +  if (Val) removeFromList();
      +  Val = V;
         if (V) V->addUse(*this);
      -  else Next = nilUse(0);
       }
       
       
      
      Modified: llvm/trunk/lib/VMCore/Use.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Use.cpp?rev=56349&r1=56348&r2=56349&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/Use.cpp (original)
      +++ llvm/trunk/lib/VMCore/Use.cpp Fri Sep 19 10:13:20 2008
      @@ -20,31 +20,8 @@
       //===----------------------------------------------------------------------===//
       
       void Use::swap(Use &RHS) {
      -  ptrdiff_t dist((char*)&RHS - (char*)this);
      -
      -  if (dist) {
      -    Use *valid1(stripTag(Next));
      -    Use *valid2(stripTag(RHS.Next));
      -    if (valid1 && valid2) {
      -      bool real1(fullStopTagN != extractTag(Next));
      -      bool real2(fullStopTagN != extractTag(RHS.Next));
      -      (char*&)*stripTag(Prev) += dist;
      -      (char*&)*stripTag(RHS.Prev) -= dist;
      -      if (real1)
      -	(char*&)valid1->Next += dist;
      -      if (real2)
      -        (char*&)valid2->Next -= dist;
      -
      -    }
      -
      -    // swap the members
      -    std::swap(Next, RHS.Next);
      -    Use** Prev1 = transferTag(Prev, stripTag(RHS.Prev));
      -    RHS.Prev = transferTag(RHS.Prev, stripTag(Prev));
      -    Prev = Prev1;
      -  }
      -  /*  Value *V1(Val1);
      -  Value *V2(RHS.Val1);
      +  Value *V1(Val);
      +  Value *V2(RHS.Val);
         if (V1 != V2) {
           if (V1) {
             removeFromList();
      @@ -52,20 +29,19 @@
       
           if (V2) {
             RHS.removeFromList();
      -      Val1 = V2;
      +      Val = V2;
             V2->addUse(*this);
           } else {
      -      Val1 = 0;
      +      Val = 0;
           }
       
           if (V1) {
      -      RHS.Val1 = V1;
      +      RHS.Val = V1;
             V1->addUse(RHS);
           } else {
      -      RHS.Val1 = 0;
      +      RHS.Val = 0;
           }
         }
      -  */
       }
       
       //===----------------------------------------------------------------------===//
      @@ -76,7 +52,7 @@
         const Use *Current = this;
       
         while (true) {
      -    unsigned Tag = extractTag((Current++)->Prev);
      +    unsigned Tag = extractTag((Current++)->Prev);
           switch (Tag) {
             case zeroDigitTag:
             case oneDigitTag:
      @@ -86,7 +62,7 @@
               ++Current;
               ptrdiff_t Offset = 1;
               while (true) {
      -          unsigned Tag = extractTag(Current->Prev);
      +          unsigned Tag = extractTag(Current->Prev);
                 switch (Tag) {
                   case zeroDigitTag:
                   case oneDigitTag:
      @@ -113,8 +89,7 @@
         ptrdiff_t Count = Done;
         while (Start != Stop) {
           --Stop;
      -    Stop->Val1 = 0;
      -    Stop->Next = nilUse(0);
      +    Stop->Val = 0;
           if (!Count) {
             Stop->Prev = reinterpret_cast(Done == 0 ? fullStopTag : stopTag);
             ++Done;
      
      Modified: llvm/trunk/lib/VMCore/Value.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Value.cpp?rev=56349&r1=56348&r2=56349&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/Value.cpp (original)
      +++ llvm/trunk/lib/VMCore/Value.cpp Fri Sep 19 10:13:20 2008
      @@ -34,7 +34,7 @@
       
       Value::Value(const Type *ty, unsigned scid)
         : SubclassID(scid), SubclassData(0), VTy(checkType(ty)),
      -    UseList(Use::nilUse(this)), Name(0) {
      +    UseList(0), Name(0) {
         if (isa(this) || isa(this))
           assert((VTy->isFirstClassType() || VTy == Type::VoidTy ||
                   isa(ty) || VTy->getTypeID() == Type::StructTyID) &&
      @@ -298,7 +298,7 @@
       //
       void Value::uncheckedReplaceAllUsesWith(Value *New) {
         while (!use_empty()) {
      -    Use &U = *use_begin().U;
      +    Use &U = *UseList;
           // Must handle Constants specially, we cannot call replaceUsesOfWith on a
           // constant because they are uniqued.
           if (Constant *C = dyn_cast(U.getUser())) {
      
      Removed: llvm/trunk/lib/VMCore/getValue.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/getValue.cpp?rev=56348&view=auto
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/getValue.cpp (original)
      +++ llvm/trunk/lib/VMCore/getValue.cpp (removed)
      @@ -1,474 +0,0 @@
      -//===-- Use.cpp - Implement the Use class ---------------------------------===//
      -//
      -//                     The LLVM Compiler Infrastructure
      -//
      -// This file is distributed under the University of Illinois Open Source
      -// License. See LICENSE.TXT for details.
      -//
      -//===----------------------------------------------------------------------===//
      -//
      -// This file implements the algorithm for finding the User of a Use.
      -//
      -//===----------------------------------------------------------------------===//
      -
      -#include "llvm/User.h"
      -// this can later be removed:
      -#include 
      -
      -namespace llvm {
      -
      -class Use::UseWaymark {
      -
      -  friend class Use;
      -
      -enum { spareBits = 2, requiredSteps = sizeof(Value*) * 8 - spareBits };
      -
      -/// repaintByCopying -- given a pattern and a
      -/// junk tagspace, copy the former's tags into
      -/// the latter
      -///
      -static inline void repaintByCopying(Use *Tagspace, Use *Junk) {
      -    for (int I = requiredSteps; I; --I) {
      -        Use *Next = stripTag(Junk->Next);
      -        Junk->Next = transferTag(Tagspace->Next, Next);
      -        Tagspace = stripTag(Tagspace->Next);
      -        Junk = Next;
      -    }
      -
      -    assert((extractTag(Junk->Next) == Use::stopTagN)
      -           && "Why repaint by copying if the next is not Stop?");
      -}
      -
      -
      -/// repaintByCalculating -- given a pattern and a
      -/// junk tagspace, compute tags into the latter
      -///
      -static inline void repaintByCalculating(unsigned long Tags, Use *Junk) {
      -    Tags >>= spareBits;
      -
      -    for (int I = requiredSteps - 1; I >= 0; --I) {
      -        Use::NextPtrTag Tag(Tags & (1 << I) ? Use::oneDigitTagN : Use::zeroDigitTagN);
      -        Use *Next = stripTag(Junk->Next);
      -        Junk->Next = transferTag(reinterpret_cast(Tag), Next);
      -        Junk = Next;
      -    }
      -
      -    assert((extractTag(Junk->Next) == Use::fullStopTagN)
      -           && "Why repaint by calculating if the next is not FullStop?");
      -}
      -
      -/// punchAwayDigits -- ensure that repainted area
      -/// begins with a stop
      -///
      -static inline void punchAwayDigits(Use **Uprev) {
      -  Uprev = stripTag(Uprev);
      -  // if (PrevU)
      -  //   assert(&PrevU->Next == Uprev && "U->Prev differs from PrevU?");
      -  *Uprev = stripTag(*Uprev);
      -}
      -
      -
      -/// gatherAndPotentiallyRepaint is invoked for either
      -///  - sweeping over (a small amount of) initial junk
      -///  - or sweeping over a great amount of junk which
      -///    provides enough space to reproduce the bit pattern
      -///    of the Value* at its end, in which case it gets
      -///    overpainted.
      -///  In any case this routine is invoked with U being
      -///  pointed at from a Use with a stop tag.
      -///
      -static inline Value *gatherAndPotentiallyRepaint(Use *U) {
      -  int Cushion = requiredSteps;
      -
      -  Use *Next(U->Next);
      -  // __builtin_prefetch(Next);
      -  Use::NextPtrTag Tag(extractTag(Next));
      -  Next = stripTag(Next);
      -
      -  // try to pick up exactly requiredSteps digits
      -  // from immediately behind the (precondition) stop
      -  unsigned long Acc(0);
      -  while (1) {
      -      if (Cushion <= 0) {
      -          assert((Tag == Use::fullStopTagN || Tag == Use::stopTagN)
      -                 && "More digits?");
      -          return reinterpret_cast(Acc << spareBits);
      -      }
      -
      -      switch (Tag) {
      -          case Use::fullStopTagN:
      -              return reinterpret_cast(Next);
      -          case Use::stopTagN: {
      -	      goto efficiency;
      -          }
      -          default:
      -              Acc = (Acc << 1) | (Tag & 1);
      -              Next = Next->Next;
      -              // __builtin_prefetch(Next);
      -              --Cushion;
      -              Tag = extractTag(Next);
      -              Next = stripTag(Next);
      -              continue;
      -      }
      -      break;
      -  }
      -
      -  while (Cushion > 0) {
      -    switch (Tag) {
      -    case Use::fullStopTagN:
      -        return reinterpret_cast(Next);
      -    case Use::stopTagN: {
      -        efficiency:
      -        // try to pick up exactly requiredSteps digits
      -        int digits = requiredSteps;
      -        Acc = 0;
      -
      -        while (1) {
      -            if (!digits)
      -                return reinterpret_cast(Acc << spareBits);
      -
      -            Next = Next->Next;
      -            // __builtin_prefetch(Next);
      -            --Cushion;
      -            Tag = extractTag(Next);
      -            Next = stripTag(Next);
      -            switch (Tag) {
      -                case Use::fullStopTagN:
      -                    if (Cushion <= 0) {
      -                        punchAwayDigits(U->Prev);
      -                        repaintByCalculating(reinterpret_cast(Next), U);
      -                    }
      -                    return reinterpret_cast(Next);
      -                case Use::stopTagN: {
      -                    if (Cushion <= 0) {
      -                        U = stripTag(U->Next);
      -                    }
      -                    goto efficiency;
      -                }
      -                default:
      -                    --digits;
      -                    Acc = (Acc << 1) | (Tag & 1);
      -                    if (Cushion <= 0) {
      -                        U = stripTag(U->Next);
      -                    }
      -                    continue;
      -            }
      -            break;
      -        }
      -    }
      -    // fall through
      -    default:
      -        Next = Next->Next;
      -        // __builtin_prefetch(Next);
      -        --Cushion;
      -        Tag = extractTag(Next);
      -        Next = stripTag(Next);
      -    } // switch
      -  } // while
      -
      -  // Now we know that we have a nice cushion between U and Next. Do the same
      -  // thing as above, but don't decrement Cushion any more, instead push U
      -  // forward. After the value is found, repaint beginning at U.
      -
      -  while (1) {
      -    switch (Tag) {
      -    case Use::fullStopTagN: {
      -        punchAwayDigits(U->Prev);
      -        repaintByCalculating(reinterpret_cast(Next), U);
      -        return reinterpret_cast(Next);
      -    }
      -    case Use::stopTagN: {
      -        // try to pick up exactly requiredSteps digits
      -        int digits = requiredSteps;
      -        Acc = 0;
      -        Use *Tagspace(Next);
      -
      -        while (1) {
      -            if (!digits) {
      -                punchAwayDigits(U->Prev);
      -                repaintByCopying(Tagspace, U);
      -                return reinterpret_cast(Acc << spareBits);
      -            }
      -
      -            Next = Next->Next;
      -            // __builtin_prefetch(Next);
      -            U = stripTag(U->Next);
      -            Tag = extractTag(Next);
      -            Next = stripTag(Next);
      -            switch (Tag) {
      -                case Use::fullStopTagN: {
      -                    punchAwayDigits(U->Prev);
      -                    repaintByCalculating(reinterpret_cast(Next), U);
      -                    return reinterpret_cast(Next);
      -                }
      -                case Use::stopTagN: {
      -                    break;
      -                }
      -                default:
      -                    --digits;
      -                    Acc = (Acc << 1) | (Tag & 1);
      -                    continue;
      -            }
      -            break;
      -        }
      -    }
      -    // fall through
      -    default:
      -        Next = Next->Next;
      -        // __builtin_prefetch(Next);
      -        U = stripTag(U->Next);
      -        Tag = extractTag(Next);
      -        Next = stripTag(Next);
      -    } // switch
      -  } // while
      -}
      -
      -
      -/// skipPotentiallyGathering is invoked for either
      -///  - picking up exactly ToGo digits
      -///  - or finding a stop which marks the beginning
      -///    of a repaintable area
      -///
      -static inline Value *skipPotentiallyGathering(Use *U,
      -                                              unsigned long Acc,
      -                                              int ToGo) {
      -  while (1) {
      -    if (!ToGo)
      -      return reinterpret_cast(Acc << spareBits);
      -
      -    Use *Next(U->Next);
      -    // __builtin_prefetch(Next);
      -    Use::NextPtrTag Tag(extractTag(Next));
      -    Next = stripTag(Next);
      -    switch (Tag) {
      -    case Use::fullStopTagN:
      -      return reinterpret_cast(Next);
      -    case Use::stopTagN:
      -      return gatherAndPotentiallyRepaint(Next);
      -    default:
      -      Acc = (Acc << 1) | (Tag & 1);
      -      --ToGo;
      -      U = Next;
      -    }
      -  }
      -}
      -
      -}; // class UseWaymark
      -
      -Value *Use::getValue() const {
      -  // __builtin_prefetch(Next);
      -  NextPtrTag Tag(extractTag(Next));
      -  switch (Tag) {
      -  case fullStopTagN:
      -      return reinterpret_cast(stripTag(Next));
      -  case stopTagN:
      -    return UseWaymark::gatherAndPotentiallyRepaint(Next);
      -  default:
      -    return UseWaymark::skipPotentiallyGathering(stripTag(Next),
      -                                    Tag & 1,
      -                                    Use::UseWaymark::requiredSteps - 1);
      -  }
      -}
      -
      -static char TagChar(int Tag) {
      -  return "s10S"[Tag];
      -}
      -
      -void Use::showWaymarks() const {
      -  const Use *me(this);
      -  if (NextPtrTag Tag = extractTag(me)) {
      -    me = stripTag(me);
      -    std::cerr << '(' << TagChar(Tag) << ')';
      -  }
      -
      -  me = me->Next;
      -  NextPtrTag TagHere = extractTag(me);
      -  std::cerr << TagChar(TagHere);
      -
      -  me = stripTag(me);
      -  if (TagHere == fullStopTagN) {
      -    std::cerr << " ---> " << me << std::endl;
      -    std::cerr << "1234567890123456789012345678901234567890123456789012345678901234567890" << std::endl;
      -    std::cerr << "         1         2         3         4         5         6         7" << std::endl;
      -  }
      -  else
      -    me->showWaymarks();
      -}
      -
      -} // namespace llvm
      -
      -#if 0
      -
      -// ################################################################
      -// ############################# TESTS ############################
      -// ################################################################
      -
      -using namespace llvm;
      -
      -namespace T1
      -{
      -    Use u00;
      -}
      -
      -namespace T2
      -{
      -    Use u00((Value*)0xCAFEBABCUL);
      -    Use u01(u00);
      -}
      -
      -namespace T3
      -{
      -    template 
      -    struct UseChain;
      -
      -    template <>
      -    struct UseChain<0> {
      -        Use first;
      -        UseChain(Value *V) : first(V) {}
      -        UseChain(Use &U) : first(U) {}
      -    };
      -
      -    template 
      -    struct UseChain {
      -        Use first;
      -        UseChain rest;
      -        UseChain(Value *V)
      -            : first(rest.first)
      -            , rest(V) {}
      -        UseChain(Use &U)
      -            : first(rest.first)
      -            , rest(U) {}
      -    };
      -
      -    UseChain<30> uc31((Value*)0xCAFEBABCUL);
      -    Use& u31(uc31.first);
      -    UseChain<31> uc32((Value*)0xCAFEBABCUL);
      -    Use& u32(uc32.first);
      -}
      -
      -namespace T4
      -{
      -    template 
      -    struct UseChain;
      -
      -    template 
      -    struct UseChain<0, PAT> {
      -        Use first;
      -        static const unsigned long Pat = PAT >> 2;
      -        UseChain(Value *V) : first(V) {}
      -        UseChain(Use &U) : first(U) {}
      -    };
      -
      -    template 
      -    struct UseChain {
      -        Use first;
      -        UseChain rest;
      -        static const unsigned long Digit = UseChain::Pat & 1;
      -        static const Use::NextPtrTag Tag = Digit ? Use::oneDigitTagN : Use::zeroDigitTagN;
      -        static const unsigned long Pat = UseChain::Pat >> 1;
      -        UseChain(Value *V = reinterpret_cast(PAT))
      -            : first(*addTag(&rest.first, Tag))
      -            , rest(V) {}
      -        UseChain(Use &U)
      -            : first(*addTag(&rest.first, Tag))
      -            , rest(U) {}
      -    };
      -
      -    UseChain<30, 0xCAFEBABCUL> uc31;
      -    Use& u31(uc31.first);
      -    Use us32(u31);
      -
      -    UseChain<29, 0xCAFEBABCUL> uc30;
      -    Use& u30(uc30.first);
      -    Use us31(u30);
      -
      -    T3::UseChain<3> s3a((Value*)0xCAFEBABCUL);
      -    UseChain<30, 0xCAFEBABCUL> uc31s3S(s3a.first);
      -    Use& m35(uc31s3S.first);
      -
      -    T3::UseChain<3> s3b((Value*)0xCAFEBABCUL);
      -    UseChain<29, 0xCAFEBABCUL> uc30s3S(s3b.first);
      -    Use& m34(uc30s3S.first);
      -    
      -    T3::UseChain<3> s3c((Value*)0xCAFEBABCUL);
      -    UseChain<25, 0xCAFEBABCUL> uc25s3S(s3c.first);
      -    Use& m30(uc25s3S.first);
      -
      -    Use ms36(m35);
      -    Use ms35(m34);
      -    Use ms31(m30);
      -    Use ms32(ms31);
      -
      -    UseChain<24, 0xCAFEBABCUL> uc25;
      -    Use& u25(uc25.first);
      -    T3::UseChain<10> m11s24dS(u25);
      -    Use& m36(m11s24dS.first);
      -
      -
      -    T3::UseChain<10> s10S((Value*)0xCAFEBABCUL);
      -    UseChain<20, 0xCAFEBABCUL> d20ss10S(s10S.first);
      -    T3::UseChain<20> s20sd20ss10S(d20ss10S.first);
      -    Use& m53(s20sd20ss10S.first);
      -}
      -
      -
      -int main(){
      -    if (NULL != T1::u00.getValue())
      -        return 1;
      -    if ((Value*)0xCAFEBABCUL != T2::u00.getValue())
      -        return 2;
      -    if ((Value*)0xCAFEBABCUL != T2::u01.getValue())
      -        return 2;
      -    if ((Value*)0xCAFEBABCUL != T3::u31.getValue())
      -        return 3;
      -    if ((Value*)0xCAFEBABCUL != T3::u32.getValue())
      -        return 3;
      -    if ((Value*)0xCAFEBABCUL != T3::u32.getValue()) // check the mutated value
      -        return 3;
      -    if ((Value*)0xCAFEBABCUL != T4::u31.getValue())
      -        return 4;
      -    if ((Value*)0xCAFEBABCUL != T4::u30.getValue())
      -        return 4;
      -    if ((Value*)0xCAFEBABCUL != T4::us32.getValue())
      -        return 4;
      -    if ((Value*)0xCAFEBABCUL != T4::us31.getValue())
      -        return 4;
      -
      -    // mixed tests
      -    if ((Value*)0xCAFEBABCUL != T4::m35.getValue())
      -        return 4;
      -    if ((Value*)0xCAFEBABCUL != T4::m34.getValue())
      -        return 4;
      -    if ((Value*)0xCAFEBABCUL != T4::m30.getValue())
      -        return 4;
      -    if ((Value*)0xCAFEBABCUL != T4::ms36.getValue())
      -        return 4;
      -    if ((Value*)0xCAFEBABCUL != T4::ms35.getValue())
      -        return 4;
      -    if ((Value*)0xCAFEBABCUL != T4::ms35.getValue()) // check the mutated value
      -        return 4;
      -    if ((Value*)0xCAFEBABCUL != T4::ms32.getValue())
      -        return 4;
      -    if ((Value*)0xCAFEBABCUL != T4::ms32.getValue())
      -        return 4;
      -    if ((Value*)0xCAFEBABCUL != T4::ms32.getValue()) // check the mutated value
      -        return 4;
      -
      -    T4::m36.showWaymarks();
      -    if ((Value*)0xCAFEBABCUL != T4::m36.getValue())
      -        return 4;
      -    T4::m36.showWaymarks();
      -    if ((Value*)0xCAFEBABCUL != T4::m36.getValue()) // check the mutated value
      -        return 4;
      -    T4::m36.showWaymarks();
      -
      -    T4::m53.showWaymarks();
      -    if ((Value*)0xCAFEBABCUL != T4::m53.getValue())
      -        return 4;
      -    T4::m53.showWaymarks();
      -    if ((Value*)0xCAFEBABCUL != T4::m53.getValue()) // check the mutated value
      -        return 4;
      -    T4::m53.showWaymarks();
      -}
      -
      -#endif
      
      
      
      
      From dpatel at apple.com  Fri Sep 19 11:05:02 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Fri, 19 Sep 2008 09:05:02 -0700
      Subject: [llvm-commits] [llvm] r56337 - in /llvm/trunk:
      	test/Analysis/CallGraph/2008-09-09-DirectCall.ll
      	test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll
      	test/Other/2002-01-31-CallGraph.ll tools/opt/AnalysisWrappers.cpp
      In-Reply-To: <200809190757.m8J7vA0C007167@zion.cs.uiuc.edu>
      References: <200809190757.m8J7vA0C007167@zion.cs.uiuc.edu>
      Message-ID: <0EE8C571-DA8D-4C9A-BE3F-F63486A77CB8@apple.com>
      
      
      On Sep 19, 2008, at 12:57 AM, Duncan Sands wrote:
      
      > Author: baldrick
      > Date: Fri Sep 19 02:57:09 2008
      > New Revision: 56337
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=56337&view=rev
      > Log:
      > Teach -callgraph to always print the callgraph (as the
      > description says it does), not just when -analyze is
      > used as well.  This means printing to stderr, so adjust
      > some tests.
      
      How about renaming -callgraph as -dump-callgraph ?
      -
      Devang
      >
      >
      > Modified:
      >    llvm/trunk/test/Analysis/CallGraph/2008-09-09-DirectCall.ll
      >    llvm/trunk/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll
      >    llvm/trunk/test/Other/2002-01-31-CallGraph.ll
      >    llvm/trunk/tools/opt/AnalysisWrappers.cpp
      >
      > Modified: llvm/trunk/test/Analysis/CallGraph/2008-09-09-DirectCall.ll
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/CallGraph/2008-09-09-DirectCall.ll?rev=56337&r1=56336&r2=56337&view=diff
      >
      > =
      > =
      > =
      > =
      > =
      > =
      > =
      > =
      > ======================================================================
      > --- llvm/trunk/test/Analysis/CallGraph/2008-09-09-DirectCall.ll  
      > (original)
      > +++ llvm/trunk/test/Analysis/CallGraph/2008-09-09-DirectCall.ll Fri  
      > Sep 19 02:57:09 2008
      > @@ -1,4 +1,4 @@
      > -; RUN: llvm-as < %s | opt -analyze -callgraph -disable-output |  
      > grep {Calls function 'callee'} | count 2
      > +; RUN: llvm-as < %s | opt -callgraph -disable-output |& grep {Calls  
      > function 'callee'} | count 2
      >
      > define internal void @callee(...) {
      > entry:
      >
      > Modified: llvm/trunk/test/Analysis/CallGraph/2008-09-09- 
      > UsedByGlobal.ll
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll?rev=56337&r1=56336&r2=56337&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll  
      > (original)
      > +++ llvm/trunk/test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll  
      > Fri Sep 19 02:57:09 2008
      > @@ -1,4 +1,4 @@
      > -; RUN: llvm-as < %s | opt -analyze -callgraph -disable-output |  
      > grep {Calls function}
      > +; RUN: llvm-as < %s | opt -callgraph -disable-output |& grep {Calls  
      > function}
      >
      > @a = global void ()* @f		;  [#uses=0]
      >
      >
      > Modified: llvm/trunk/test/Other/2002-01-31-CallGraph.ll
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/2002-01-31-CallGraph.ll?rev=56337&r1=56336&r2=56337&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Other/2002-01-31-CallGraph.ll (original)
      > +++ llvm/trunk/test/Other/2002-01-31-CallGraph.ll Fri Sep 19  
      > 02:57:09 2008
      > @@ -1,6 +1,6 @@
      > ;  Call graph construction crash: Not handling indirect calls right
      > ;
      > -; RUN: llvm-as < %s | opt -analyze -callgraph
      > +; RUN: llvm-as < %s | opt -analyze -callgraph >& /dev/null
      > ;
      >
      >         %FunTy = type i32 (i32)
      >
      > Modified: llvm/trunk/tools/opt/AnalysisWrappers.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/AnalysisWrappers.cpp?rev=56337&r1=56336&r2=56337&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/tools/opt/AnalysisWrappers.cpp (original)
      > +++ llvm/trunk/tools/opt/AnalysisWrappers.cpp Fri Sep 19 02:57:09 2008
      > @@ -66,7 +66,7 @@
      >   char ExternalFunctionsPassedConstants::ID = 0;
      >   RegisterPass
      >   P1("externalfnconstants", "Print external fn callsites passed  
      > constants");
      > -
      > +
      >   struct CallGraphPrinter : public ModulePass {
      >     static char ID; // Pass ID, replacement for typeid
      >     CallGraphPrinter() : ModulePass((intptr_t)&ID) {}
      > @@ -75,13 +75,12 @@
      >       AU.setPreservesAll();
      >       AU.addRequiredTransitive();
      >     }
      > -    virtual bool runOnModule(Module &M) { return false; }
      > -
      > -    virtual void print(std::ostream &OS, const Module *M) const {
      > -      getAnalysis().print(OS, M);
      > +    virtual bool runOnModule(Module &M) {
      > +      getAnalysis().print(std::cerr, &M);
      > +      return false;
      >     }
      >   };
      > -
      > +
      >   char CallGraphPrinter::ID = 0;
      >   RegisterPass
      >     P2("callgraph", "Print a call graph");
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 11:24:29 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Fri, 19 Sep 2008 09:24:29 -0700
      Subject: [llvm-commits] [patch] add bound checks to SmallVector
      In-Reply-To: <38a0d8450809190709g783e7ad2if814b5a223136f72@mail.gmail.com>
      References: <38a0d8450808280918s29a70eefv76a5ee087925c7f@mail.gmail.com>
      	<8A6B72C7-A574-4BF3-A2FF-2C9D5F480615@apple.com>
      	<38a0d8450809050427v3cf211b0of4c945e5d1339a3f@mail.gmail.com>
      	<745E0CF5-3D34-4CB8-92D0-62B26033BBCC@apple.com>
      	<38a0d8450809190709g783e7ad2if814b5a223136f72@mail.gmail.com>
      Message-ID: 
      
      
      On Sep 19, 2008, at 7:09 AM, Rafael Espindola wrote:
      
      >> Probably not sufficient. Can you try it on kimwitu++? We are
      >> interested in llc time.
      >
      > Using kc.llvm.bc, the best llc times over 3 runs are
      >
      > debug build: 0m22.455s
      > debug build + bound check: 0m22.447s
      > opt build: 0m4.158s
      > opt build + bound check: 0m4.170s
      >
      > The test were done on linux x86-64. Looks like noise only. OK to
      > commit the patch?
      
      Yes, thanks!
      
      Evan
      
      >
      >
      >> Thanks,
      >>
      >> Evan
      >
      >
      > Cheers,
      > --  
      > Rafael Avila de Espindola
      >
      > Google | Gordon House | Barrow Street | Dublin 4 | Ireland
      > Registered in Dublin, Ireland | Registration Number: 368047
      >  smallvector.patch>_______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From dpatel at apple.com  Fri Sep 19 11:17:43 2008
      From: dpatel at apple.com (Devang Patel)
      Date: Fri, 19 Sep 2008 09:17:43 -0700
      Subject: [llvm-commits] [llvm] r56341 - in /llvm/trunk: include/llvm/
      	include/llvm/Transforms/ lib/Transforms/IPO/
      	test/Analysis/GlobalsModRef/ test/Transforms/AddReadAttrs/
      In-Reply-To: <200809190817.m8J8H6I8010267@zion.cs.uiuc.edu>
      References: <200809190817.m8J8H6I8010267@zion.cs.uiuc.edu>
      Message-ID: <6AD051DB-59D0-4B0B-A429-F1DB3FA25A36@apple.com>
      
      
      On Sep 19, 2008, at 1:17 AM, Duncan Sands wrote:
      
      > +    Function *F = SCC[i]->getFunction();
      > +
      > +    if (F == 0)
      > +      // May write memory.
      > +      return false;
      
      ??
      
      > +
      > +    if (F->doesNotAccessMemory())
      > +      // Already perfect!
      > +      continue;
      > +
      > +    // Definitions with weak linkage may be overridden at linktime  
      > with
      > +    // something that writes memory, so treat them like declarations.
      > +    if (F->isDeclaration() || F->hasWeakLinkage()) {
      
      What about CommonLinkage, GhostLinkage etc..?
      
      >
      > +      if (!F->onlyReadsMemory())
      > +        // May write memory.
      > +        return false;
      > +
      > +      ReadsMemory = true;
      > +      continue;
      > +    }
      > +
      > +    // Scan the function body for explicit loads and stores, or  
      > calls to
      > +    // functions that may read or write memory.
      > +    for (inst_iterator II = inst_begin(F), E = inst_end(F); II !=  
      > E; ++II) {
      > +      Instruction *I = &*II;
      > +      if (LoadInst *LI = dyn_cast(I)) {
      > +        if (LI->isVolatile())
      > +          // Volatile loads may have side-effects, so treat them as  
      > writing
      > +          // memory.
      > +          return false;
      > +        ReadsMemory = true;
      
      How about using mayReadMemory() and mayWriteMemory() here ?
      
      -
      Devang
      >
      > +      } else if (isa(I) || isa(I) ||  
      > isa(I)) {
      > +        // Writes memory.
      > +        return false;
      > +      } else if (isa(I) || isa(I)) {
      > +        CallSite CS(I);
      > +
      > +        if (std::find(SCC.begin(), SCC.end(),  
      > CG[CS.getCalledFunction()]) !=
      > +            SCC.end())
      > +          // The callee is inside our current SCC - ignore it.
      > +          continue;
      > +
      > +        if (!CS.onlyReadsMemory())
      > +          // May write memory.
      > +          return false;
      > +
      > +        if (!CS.doesNotAccessMemory())
      > +          ReadsMemory = true;
      > +      }
      > +    }
      > +  }
      > +
      > +  // Success!  Functions in this SCC do not access memory, or only  
      > read memory.
      > +  // Give them the appropriate attribute.
      > +  bool MadeChange = false;
      > +  for (unsigned i = 0, e = SCC.size(); i != e; ++i) {
      > +    Function *F = SCC[i]->getFunction();
      > +
      > +    if (F->doesNotAccessMemory())
      > +      // Already perfect!
      > +      continue;
      > +
      > +    if (F->onlyReadsMemory() && ReadsMemory)
      > +      // No change.
      > +      continue;
      > +
      > +    MadeChange = true;
      > +
      > +    // Clear out any existing attributes.
      > +    F->removeParamAttr(0, ParamAttr::ReadOnly | ParamAttr::ReadNone);
      > +
      > +    // Add in the new attribute.
      > +    F->addParamAttr(0, ReadsMemory ? ParamAttr::ReadOnly :  
      > ParamAttr::ReadNone);
      > +
      > +    if (ReadsMemory)
      > +      NumReadOnly++;
      > +    else
      > +      NumReadNone++;
      > +  }
      > +
      > +  return MadeChange;
      > +}
      >
      > Removed: llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll?rev=56340&view=auto
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll  
      > (original)
      > +++ llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll  
      > (removed)
      > @@ -1,11 +0,0 @@
      > -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis  
      > | grep readnone
      > -
      > -define i32 @a() {
      > -	%tmp = call i32 @b( )		;  [#uses=1]
      > -	ret i32 %tmp
      > -}
      > -
      > -define i32 @b() {
      > -	%tmp = call i32 @a( )		;  [#uses=1]
      > -	ret i32 %tmp
      > -}
      >
      > Removed: llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll?rev=56340&view=auto
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll  
      > (original)
      > +++ llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll  
      > (removed)
      > @@ -1,9 +0,0 @@
      > -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis  
      > | grep readnone | count 2
      > -
      > -define i32 @f() {
      > -entry:
      > -	%tmp = call i32 @e( )		;  [#uses=1]
      > -	ret i32 %tmp
      > -}
      > -
      > -declare i32 @e() readnone
      >
      > Removed: llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll?rev=56340&view=auto
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll  
      > (original)
      > +++ llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll  
      > (removed)
      > @@ -1,9 +0,0 @@
      > -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis  
      > | grep readonly | count 2
      > -
      > -define i32 @f() {
      > -entry:
      > -	%tmp = call i32 @e( )		;  [#uses=1]
      > -	ret i32 %tmp
      > -}
      > -
      > -declare i32 @e() readonly
      >
      > Removed: llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13- 
      > VolatileRead.ll
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13-VolatileRead.ll?rev=56340&view=auto
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13- 
      > VolatileRead.ll (original)
      > +++ llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13- 
      > VolatileRead.ll (removed)
      > @@ -1,9 +0,0 @@
      > -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis  
      > | not grep read
      > -; PR2792
      > -
      > - at g = global i32 0		;  [#uses=1]
      > -
      > -define i32 @f() {
      > -	%t = volatile load i32* @g		;  [#uses=1]
      > -	ret i32 %t
      > -}
      >
      > Copied: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll  
      > (from r56242, llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03- 
      > Mutual.ll)
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll?p2=llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll&p1=llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll&r1=56242&r2=56341&rev=56341&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-Mutual.ll  
      > (original)
      > +++ llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-Mutual.ll Fri  
      > Sep 19 03:17:05 2008
      > @@ -1,4 +1,4 @@
      > -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis  
      > | grep readnone
      > +; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | grep readnone
      >
      > define i32 @a() {
      > 	%tmp = call i32 @b( )		;  [#uses=1]
      >
      > Propchange: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03- 
      > Mutual.ll
      >
      > ------------------------------------------------------------------------------
      >    svn:mergeinfo =
      >
      > Copied: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03- 
      > ReadNone.ll (from r56242, llvm/trunk/test/Analysis/GlobalsModRef/ 
      > 2008-09-03-ReadNone.ll)
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll?p2=llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll&p1=llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll&r1=56242&r2=56341&rev=56341&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadNone.ll  
      > (original)
      > +++ llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadNone.ll  
      > Fri Sep 19 03:17:05 2008
      > @@ -1,4 +1,4 @@
      > -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis  
      > | grep readnone | count 2
      > +; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | grep readnone  
      > | count 2
      >
      > define i32 @f() {
      > entry:
      >
      > Propchange: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03- 
      > ReadNone.ll
      >
      > ------------------------------------------------------------------------------
      >    svn:mergeinfo =
      >
      > Copied: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03- 
      > ReadOnly.ll (from r56242, llvm/trunk/test/Analysis/GlobalsModRef/ 
      > 2008-09-03-ReadOnly.ll)
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll?p2=llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll&p1=llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll&r1=56242&r2=56341&rev=56341&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-03-ReadOnly.ll  
      > (original)
      > +++ llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03-ReadOnly.ll  
      > Fri Sep 19 03:17:05 2008
      > @@ -1,4 +1,4 @@
      > -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis  
      > | grep readonly | count 2
      > +; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | grep readonly  
      > | count 2
      >
      > define i32 @f() {
      > entry:
      >
      > Propchange: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-03- 
      > ReadOnly.ll
      >
      > ------------------------------------------------------------------------------
      >    svn:mergeinfo =
      >
      > Copied: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-13- 
      > VolatileRead.ll (from r56242, llvm/trunk/test/Analysis/GlobalsModRef/ 
      > 2008-09-13-VolatileRead.ll)
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/AddReadAttrs/2008-09-13-VolatileRead.ll?p2=llvm/trunk/test/Transforms/AddReadAttrs/2008-09-13-VolatileRead.ll&p1=llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13-VolatileRead.ll&r1=56242&r2=56341&rev=56341&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/test/Analysis/GlobalsModRef/2008-09-13- 
      > VolatileRead.ll (original)
      > +++ llvm/trunk/test/Transforms/AddReadAttrs/2008-09-13- 
      > VolatileRead.ll Fri Sep 19 03:17:05 2008
      > @@ -1,4 +1,4 @@
      > -; RUN: llvm-as < %s | opt -globalsmodref-aa -markmodref | llvm-dis  
      > | not grep read
      > +; RUN: llvm-as < %s | opt -addreadattrs | llvm-dis | not grep read
      > ; PR2792
      >
      > @g = global i32 0		;  [#uses=1]
      >
      > Propchange: llvm/trunk/test/Transforms/AddReadAttrs/2008-09-13- 
      > VolatileRead.ll
      >
      > ------------------------------------------------------------------------------
      >    svn:mergeinfo =
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From gohman at apple.com  Fri Sep 19 12:01:56 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Fri, 19 Sep 2008 10:01:56 -0700 (PDT)
      Subject: [llvm-commits] [llvm] r56303 - in /llvm/trunk:
       include/llvm/System/Memory.h lib/ExecutionEngine/ExecutionEngine.cpp
       lib/ExecutionEngine/JIT/JITEmitter.cpp
       lib/ExecutionEngine/JIT/JITMemoryManager.cpp lib/System/Memory.cpp
       lib/System/Unix/Memory.inc
      In-Reply-To: <200809180754.m8I7sLr7009561@zion.cs.uiuc.edu>
      References: <200809180754.m8I7sLr7009561@zion.cs.uiuc.edu>
      Message-ID: <42184.76.220.41.203.1221843716.squirrel@webmail.apple.com>
      
      On Thu, September 18, 2008 12:54 am, Evan Cheng wrote:
      
      > +  // Mark code region readable and executable if it's not so already.
      > +  sys::Memory::SetRXPrivilege(FnStart, FnEnd-FnStart);
      
      Shouldn't this code check SetRXPrivilege's return value? It may
      not be able to do much if SetRXPrivilege fails, but printing to
      cerr and calling abort, as this code does to handle other errors,
      at least seems friendlier than the alternative, letting the code
      take a SIGSEGV later on.
      
      >  DefaultJITMemoryManager::DefaultJITMemoryManager() {
      >    // Allocate a 16M block of memory for functions.
      > +#if defined(__APPLE__) && defined(__arm__)
      > +  sys::MemoryBlock MemBlock = getNewMemoryBlock(4 << 20);
      > +#else
      >    sys::MemoryBlock MemBlock = getNewMemoryBlock(16 << 20);
      > +#endif
      
      This introduces a platform-specific magic number in
      platform-independent code, with no comment and no mention in
      the commit message.
      
      > +#if defined(__APPLE__) && defined(__arm__)
      > +  void *pa = ::mmap(start, pageSize*NumPages, PROT_READ|PROT_EXEC,
      > +                    flags, fd, 0);
      > +#else
      >    void *pa = ::mmap(start, pageSize*NumPages,
      > PROT_READ|PROT_WRITE|PROT_EXEC,
      >                      flags, fd, 0);
      > +#endif
      [...]
      > +#if defined(__APPLE__) && defined(__arm__)
      > +  kern_return_t kr = vm_protect(mach_task_self(), (vm_address_t)pa,
      > +                                (vm_size_t)(pageSize*NumPages), 0,
      > +                                VM_PROT_READ | VM_PROT_EXECUTE |
      > VM_PROT_COPY);
      > +  if (KERN_SUCCESS != kr) {
      > +    MakeErrMsg(ErrMsg, "vm_protect max RWX failed\n");
      > +    return sys::MemoryBlock();
      > +  }
      > +
      > +  kr = vm_protect(mach_task_self(), (vm_address_t)pa,
      > +                  (vm_size_t)(pageSize*NumPages), 0,
      > +                  VM_PROT_READ | VM_PROT_WRITE);
      > +  if (KERN_SUCCESS != kr) {
      > +    MakeErrMsg(ErrMsg, "vm_protect RW failed\n");
      > +    return sys::MemoryBlock();
      > +  }
      > +#endif
      
      The mmap change and the first call to vm_protect here suggest
      that something highly non-obvious is happening here, but this
      is lib/System and perhaps that's what this system needs.
      
      Looking at the second vm_protect call though, and the fact that
      this patch introduces a SetRXPrivilege API call, it looks like
      the intention might be to allocate the memory as RW for the JIT
      to write to it, and then to set it to RX when it's ready to be
      executed. Perhaps AllocateRWX should be renamed to AllocateRW?
      Even if it allocates memory RWX on systems with SetRXPrivilege
      as a no-op, it would be good to make the API consistent.
      
      Dan
      
      
      
      From dalej at apple.com  Fri Sep 19 12:37:04 2008
      From: dalej at apple.com (Dale Johannesen)
      Date: Fri, 19 Sep 2008 10:37:04 -0700
      Subject: [llvm-commits] [llvm-gcc-4.2] r56329 - in
      	/llvm-gcc-4.2/branches/Apple: Gaz/ Xcode-3.1.1/
      In-Reply-To: <200809190302.m8J32qlT023258@zion.cs.uiuc.edu>
      References: <200809190302.m8J32qlT023258@zion.cs.uiuc.edu>
      Message-ID: 
      
      
      On Sep 18, 2008, at 8:02 PMPDT, Bill Wendling wrote:
      
      > Author: void
      > Date: Thu Sep 18 22:02:51 2008
      > New Revision: 56329
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=56329&view=rev
      > Log:
      > Rename Gaz to Xcode-3.1.1
      
      The fate of all humorists.  Why do those without a sense of humor  
      always win? :)
      
      
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 12:38:47 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Fri, 19 Sep 2008 17:38:47 -0000
      Subject: [llvm-commits] [llvm] r56352 - in /llvm/trunk:
       lib/CodeGen/SimpleRegisterCoalescing.cpp
       lib/CodeGen/SimpleRegisterCoalescing.h test/CodeGen/X86/coalescer-remat.ll
      Message-ID: <200809191738.m8JHclQ6029422@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Fri Sep 19 12:38:47 2008
      New Revision: 56352
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56352&view=rev
      Log:
      Re-materalized definition instructions may be dead. Whack them.
      
      Added:
          llvm/trunk/test/CodeGen/X86/coalescer-remat.ll
      Modified:
          llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
          llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h
      
      Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=56352&r1=56351&r2=56352&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Fri Sep 19 12:38:47 2008
      @@ -479,6 +479,7 @@
         li_->ReplaceMachineInstrInMaps(CopyMI, NewMI);
         CopyMI->eraseFromParent();
         ReMatCopies.insert(CopyMI);
      +  ReMatDefs.insert(DefMI);
         ++NumReMats;
         return true;
       }
      @@ -2183,6 +2184,7 @@
       void SimpleRegisterCoalescing::releaseMemory() {
         JoinedCopies.clear();
         ReMatCopies.clear();
      +  ReMatDefs.clear();
       }
       
       static bool isZeroLengthInterval(LiveInterval *li) {
      @@ -2291,25 +2293,45 @@
               continue;
             }
       
      +      // Now check if this is a remat'ed def instruction which is now dead.
      +      if (ReMatDefs.count(MI)) {
      +        bool isDead = true;
      +        for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
      +          const MachineOperand &MO = MI->getOperand(i);
      +          if (!MO.isRegister() || MO.isDead())
      +            continue;
      +          unsigned Reg = MO.getReg();
      +          if (TargetRegisterInfo::isPhysicalRegister(Reg) ||
      +              !mri_->use_empty(Reg)) {
      +            isDead = false;
      +            break;
      +          }
      +        }
      +        if (isDead) {
      +          li_->RemoveMachineInstrFromMaps(mii);
      +          mii = mbbi->erase(mii);
      +        }
      +      }
      +
             // If the move will be an identity move delete it
      -      bool isMove = tii_->isMoveInstr(*mii, SrcReg, DstReg);
      +      bool isMove = tii_->isMoveInstr(*MI, SrcReg, DstReg);
             if (isMove && SrcReg == DstReg) {
               if (li_->hasInterval(SrcReg)) {
                 LiveInterval &RegInt = li_->getInterval(SrcReg);
                 // If def of this move instruction is dead, remove its live range
                 // from the dstination register's live interval.
      -          if (mii->registerDefIsDead(DstReg)) {
      -            if (!ShortenDeadCopySrcLiveRange(RegInt, mii))
      -              ShortenDeadCopyLiveRange(RegInt, mii);
      +          if (MI->registerDefIsDead(DstReg)) {
      +            if (!ShortenDeadCopySrcLiveRange(RegInt, MI))
      +              ShortenDeadCopyLiveRange(RegInt, MI);
                 }
               }
      -        li_->RemoveMachineInstrFromMaps(mii);
      +        li_->RemoveMachineInstrFromMaps(MI);
               mii = mbbi->erase(mii);
               ++numPeep;
             } else if (!isMove || !TurnCopyIntoImpDef(mii, mbb, DstReg, SrcReg)) {
               SmallSet UniqueUses;
      -        for (unsigned i = 0, e = mii->getNumOperands(); i != e; ++i) {
      -          const MachineOperand &mop = mii->getOperand(i);
      +        for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
      +          const MachineOperand &mop = MI->getOperand(i);
                 if (mop.isRegister() && mop.getReg() &&
                     TargetRegisterInfo::isVirtualRegister(mop.getReg())) {
                   unsigned reg = mop.getReg();
      
      Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h?rev=56352&r1=56351&r2=56352&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h (original)
      +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h Fri Sep 19 12:38:47 2008
      @@ -100,6 +100,10 @@
           ///
           SmallPtrSet ReMatCopies;
       
      +    /// ReMatDefs - Keep track of definition instructions which have
      +    /// been remat'ed.
      +    SmallPtrSet ReMatDefs;
      +
         public:
           static char ID; // Pass identifcation, replacement for typeid
           SimpleRegisterCoalescing() : MachineFunctionPass(&ID) {}
      
      Added: llvm/trunk/test/CodeGen/X86/coalescer-remat.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/coalescer-remat.ll?rev=56352&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/coalescer-remat.ll (added)
      +++ llvm/trunk/test/CodeGen/X86/coalescer-remat.ll Fri Sep 19 12:38:47 2008
      @@ -0,0 +1,15 @@
      +; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | grep xor | count 3
      +
      + at val = internal global i64 0		;  [#uses=1]
      +@"\01LC" = internal constant [7 x i8] c"0x%lx\0A\00"		; <[7 x i8]*> [#uses=1]
      +
      +define i32 @main() nounwind {
      +entry:
      +	%0 = tail call i64 @llvm.atomic.cmp.swap.i64.p0i64(i64* @val, i64 0, i64 1)		;  [#uses=1]
      +	%1 = tail call i32 (i8*, ...)* @printf(i8* getelementptr ([7 x i8]* @"\01LC", i32 0, i64 0), i64 %0) nounwind		;  [#uses=0]
      +	ret i32 0
      +}
      +
      +declare i64 @llvm.atomic.cmp.swap.i64.p0i64(i64*, i64, i64) nounwind
      +
      +declare i32 @printf(i8*, ...) nounwind
      
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 12:48:12 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Fri, 19 Sep 2008 10:48:12 -0700
      Subject: [llvm-commits] [llvm] r56326 - in /llvm/trunk:
      	include/llvm/CodeGen/LiveInterval.h
      	include/llvm/CodeGen/LiveIntervalAnalysis.h
      	lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp
      	lib/CodeGen/RegAllocLinearScan.cpp
      In-Reply-To: <200809190102.m8J12ZW2019167@zion.cs.uiuc.edu>
      References: <200809190102.m8J12ZW2019167@zion.cs.uiuc.edu>
      Message-ID: <51666910-CAA2-47A5-9F26-809138EE0E5F@apple.com>
      
      
      On Sep 18, 2008, at 6:02 PM, Dale Johannesen wrote:
      
      > Author: johannes
      > Date: Thu Sep 18 20:02:35 2008
      > New Revision: 56326
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=56326&view=rev
      > Log:
      > Remove AsmThatEarlyClobber etc. from LiveIntervalAnalysis
      > and redo as linked list walk.  Logic moved into RA.
      > Per review feedback.
      >
      >
      > Modified:
      >    llvm/trunk/include/llvm/CodeGen/LiveInterval.h
      >    llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
      >    llvm/trunk/lib/CodeGen/LiveInterval.cpp
      >    llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
      >    llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      >
      > Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=56326&r1=56325&r2=56326&view=diff
      >
      > =
      > =
      > =
      > =
      > =
      > =
      > =
      > =
      > ======================================================================
      > --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
      > +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Thu Sep 18  
      > 20:02:35 2008
      > @@ -105,12 +105,17 @@
      >                          // if the top bits is set, it represents a  
      > stack slot.
      >     unsigned preference; // preferred register to allocate for this  
      > interval
      >     float weight;        // weight of this interval
      > +    bool isEarlyClobber;
      > +    bool overlapsEarlyClobber;
      
      Hi Dale,
      
      I don't think we want two bits. I'd rather go with one bit and have  
      register allocator look at both use and def operands. What do you think?
      
      Evan
      
      >
      >     Ranges ranges;       // the ranges in which this register is live
      >     VNInfoList valnos;   // value#'s
      >
      >   public:
      > -    LiveInterval(unsigned Reg, float Weight, bool IsSS = false)
      > -      : reg(Reg), preference(0), weight(Weight) {
      > +    LiveInterval(unsigned Reg, float Weight, bool IsSS = false,
      > +                 bool IsEarlyClobber = false, bool  
      > OverlapsEarlyClobber = false)
      > +      : reg(Reg), preference(0), weight(Weight),
      > +        isEarlyClobber(IsEarlyClobber),
      > +        overlapsEarlyClobber(OverlapsEarlyClobber) {
      >       if (IsSS)
      >         reg = reg | (1U << (sizeof(unsigned)*8-1));
      >     }
      >
      > Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=56326&r1=56325&r2=56326&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
      > +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Thu Sep  
      > 18 20:02:35 2008
      > @@ -65,22 +65,6 @@
      >     AliasAnalysis *aa_;
      >     LiveVariables* lv_;
      >
      > -    /// AsmsWithEarlyClobber - maps a virtual register number to  
      > all the
      > -    /// inline asm's that have the register marked earlyclobber.
      > -    ///
      > -    std::multimap AsmsThatEarlyClobber;
      > -
      > -    /// AsmsWithEarlyClobberConflict - maps a virtual register number
      > -    /// to all the inline asm's that have earlyclobber operands  
      > elsewhere
      > -    /// and use the register as a (non-earlyclobber) input.
      > -    ///
      > -    /// Note: earlyclobber operands may not be assigned the same  
      > register as
      > -    /// each other, or as earlyclobber-conflict operands.  However  
      > two
      > -    /// earlyclobber-conflict operands may be assigned the same  
      > register if
      > -    /// they happen to contain the same value.
      > -    ///
      > -    std::multimap  
      > AsmsWithEarlyClobberConflict;
      > -
      >     /// Special pool allocator for VNInfo's (LiveInterval val#).
      >     ///
      >     BumpPtrAllocator VNInfoAllocator;
      > @@ -353,11 +337,6 @@
      >     unsigned getNumConflictsWithPhysReg(const LiveInterval &li,
      >                                         unsigned PhysReg) const;
      >
      > -    /// noEarlyclobberConflict - see whether virtual reg VReg has a  
      > conflict
      > -    /// with hard reg HReg because HReg is used as an earlyclobber  
      > register in
      > -    /// asm that also has VReg live into or across it.
      > -    bool noEarlyclobberConflict(unsigned VReg, VirtRegMap &vrm,  
      > unsigned HReg);
      > -
      >     /// computeNumbering - Compute the index numbering.
      >     void computeNumbering();
      >
      >
      > Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=56326&r1=56325&r2=56326&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
      > +++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Thu Sep 18 20:02:35 2008
      > @@ -686,6 +686,10 @@
      >     OS << "%reg" << reg;
      >
      >   OS << ',' << weight;
      > +  if (isEarlyClobber)
      > +    OS << ",earlyclobber";
      > +  if (overlapsEarlyClobber)
      > +    OS << ",overlapsearly";
      >
      >   if (empty())
      >     OS << " EMPTY";
      >
      > Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=56326&r1=56325&r2=56326&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
      > +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Thu Sep 18  
      > 20:02:35 2008
      > @@ -674,8 +674,6 @@
      > /// live interval is an interval [i, j) where 1 <= i <= j < N for
      > /// which a variable is live
      > void LiveIntervals::computeIntervals() {
      > -  AsmsThatEarlyClobber.clear();
      > -  AsmsWithEarlyClobberConflict.clear();
      >
      >   DOUT << "********** COMPUTING LIVE INTERVALS **********\n"
      >        << "********** Function: "
      > @@ -716,13 +714,15 @@
      >         if (MO.isRegister() && MO.getReg() && MO.isDef()) {
      >           handleRegisterDef(MBB, MI, MIIndex, MO, i);
      >           if (MO.isEarlyClobber()) {
      > -            AsmsThatEarlyClobber.insert(std::make_pair(MO.getReg(),  
      > MI));
      > +            LiveInterval &interval =   
      > getOrCreateInterval(MO.getReg());
      > +            interval.isEarlyClobber = true;
      >           }
      >         }
      >         if (MO.isRegister() && !MO.isDef() &&
      >             MO.getReg() &&  
      > TargetRegisterInfo::isVirtualRegister(MO.getReg()) &&
      >             MO.overlapsEarlyClobber()) {
      > -           
      > AsmsWithEarlyClobberConflict.insert(std::make_pair(MO.getReg(), MI));
      > +          LiveInterval &interval = getOrCreateInterval(MO.getReg());
      > +          interval.overlapsEarlyClobber = true;
      >         }
      >       }
      >
      > @@ -752,73 +752,6 @@
      >   return ResVal;
      > }
      >
      > -/// noEarlyclobberConflict - see whether virtual reg VReg has a  
      > conflict with
      > -/// hard reg HReg because of earlyclobbers.
      > -///
      > -/// Earlyclobber operands may not be assigned the same register as
      > -/// each other, or as earlyclobber-conflict operands (i.e. those that
      > -/// are non-earlyclobbered inputs to an asm that also has  
      > earlyclobbers).
      > -///
      > -/// Thus there are two cases to check for:
      > -/// 1.  VReg is an earlyclobber-conflict register and HReg is an  
      > earlyclobber
      > -/// register in some asm that also has VReg as an input.
      > -/// 2.  VReg is an earlyclobber register and HReg is an  
      > earlyclobber-conflict
      > -/// input elsewhere in some asm.
      > -/// In both cases HReg can be assigned by the user, or assigned  
      > early in
      > -/// register allocation.
      > -///
      > -/// Dropping the distinction between earlyclobber and earlyclobber- 
      > conflict,
      > -/// keeping only one multimap, looks promising, but two  
      > earlyclobber-conflict
      > -/// operands may be assigned the same register if they happen to  
      > contain the
      > -/// same value, and that implementation would prevent this.
      > -///
      > -bool LiveIntervals::noEarlyclobberConflict(unsigned VReg,  
      > VirtRegMap &vrm,
      > -                                           unsigned HReg) {
      > -  typedef std::multimap::iterator It;
      > -
      > -  // Short circuit the most common case.
      > -  if (AsmsWithEarlyClobberConflict.size()!=0) {
      > -    std::pair x =  
      > AsmsWithEarlyClobberConflict.equal_range(VReg);
      > -    for (It I = x.first; I!=x.second; I++) {
      > -      MachineInstr* MI = I->second;
      > -      for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
      > -        MachineOperand &MO = MI->getOperand(i);
      > -        if (MO.isRegister() && MO.isEarlyClobber()) {
      > -          unsigned PhysReg = MO.getReg();
      > -          if (PhysReg &&  
      > TargetRegisterInfo::isVirtualRegister(PhysReg)) {
      > -            if (!vrm.hasPhys(PhysReg))
      > -              continue;
      > -            PhysReg = vrm.getPhys(PhysReg);
      > -          }
      > -          if (PhysReg==HReg)
      > -            return false;
      > -        }
      > -      }
      > -    }
      > -  }
      > -  // Short circuit the most common case.
      > -  if (AsmsThatEarlyClobber.size()!=0) {
      > -    std::pair x = AsmsThatEarlyClobber.equal_range(VReg);
      > -    for (It I = x.first; I!=x.second; I++) {
      > -      MachineInstr* MI = I->second;
      > -      for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
      > -        MachineOperand &MO = MI->getOperand(i);
      > -        if (MO.isRegister() && MO.overlapsEarlyClobber()) {
      > -          unsigned PhysReg = MO.getReg();
      > -          if (PhysReg &&  
      > TargetRegisterInfo::isVirtualRegister(PhysReg)) {
      > -            if (!vrm.hasPhys(PhysReg))
      > -              continue;
      > -            PhysReg = vrm.getPhys(PhysReg);
      > -          }
      > -          if (PhysReg==HReg)
      > -            return false;
      > -        }
      > -      }
      > -    }
      > -  }
      > -  return true;
      > -}
      > -
      > LiveInterval* LiveIntervals::createInterval(unsigned reg) {
      >   float Weight = TargetRegisterInfo::isPhysicalRegister(reg) ?
      >                        HUGE_VALF : 0.0F;
      >
      > Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56326&r1=56325&r2=56326&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
      > +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Thu Sep 18  
      > 20:02:35 2008
      > @@ -173,6 +173,8 @@
      >
      >     void ComputeRelatedRegClasses();
      >
      > +    bool noEarlyClobberConflict(LiveInterval *cur, unsigned RegNo);
      > +
      >     template 
      >     void printIntervals(const char* const str, ItTy i, ItTy e) const {
      >       if (str) DOUT << str << " intervals:\n";
      > @@ -1001,6 +1003,73 @@
      >     unhandled_.push(added[i]);
      > }
      >
      > +/// noEarlyClobberConflict - see whether LiveInternal cur has a  
      > conflict with
      > +/// hard reg HReg because of earlyclobbers.
      > +///
      > +/// Earlyclobber operands may not be assigned the same register as
      > +/// each other, or as earlyclobber-conflict operands (i.e. those that
      > +/// are non-earlyclobbered inputs to an asm that also has  
      > earlyclobbers).
      > +///
      > +/// Thus there are two cases to check for:
      > +/// 1.  cur->reg is an earlyclobber-conflict register and HReg is an
      > +/// earlyclobber register in some asm that also has cur->reg as an  
      > input.
      > +/// 2.  cur->reg is an earlyclobber register and HReg is an
      > +/// earlyclobber-conflict input, or a different earlyclobber  
      > register,
      > +/// elsewhere in some asm.
      > +/// In both cases HReg can be assigned by the user, or assigned  
      > early in
      > +/// register allocation.
      > +///
      > +/// Dropping the distinction between earlyclobber and earlyclobber- 
      > conflict,
      > +/// keeping only one bit, looks promising, but two earlyclobber- 
      > conflict
      > +/// operands may be assigned the same register if they happen to  
      > contain the
      > +/// same value, and that implementation would prevent this.
      > +///
      > +bool RALinScan::noEarlyClobberConflict(LiveInterval *cur, unsigned  
      > HReg) {
      > +  if (cur->overlapsEarlyClobber) {
      > +    for (MachineRegisterInfo::use_iterator I = mri_->use_begin(cur- 
      > >reg),
      > +          E = mri_->use_end(); I!=E; ++I) {
      > +      MachineInstr *MI = I.getOperand().getParent();
      > +      if (MI->getOpcode()==TargetInstrInfo::INLINEASM) {
      > +        for (int i = MI->getNumOperands()-1; i>=0; --i) {
      > +          MachineOperand &MO = MI->getOperand(i);
      > +          if (MO.isRegister() && MO.getReg() && MO.isEarlyClobber()  
      > &&
      > +              HReg==MO.getReg()) {
      > +            DOUT << "  earlyclobber conflict: " <<
      > +                  "%reg" << cur->reg << ", " << tri_->getName(HReg)  
      > << "\n\t";
      > +            return false;
      > +          }
      > +        }
      > +      }
      > +    }
      > +  }
      > +  if (cur->isEarlyClobber) {
      > +    for (MachineRegisterInfo::def_iterator I = mri_->def_begin(cur- 
      > >reg),
      > +          E = mri_->def_end(); I!=E; ++I) {
      > +      MachineInstr *MI = I.getOperand().getParent();
      > +      if (MI->getOpcode()==TargetInstrInfo::INLINEASM) {
      > +        // make sure cur->reg is really clobbered in this  
      > instruction.
      > +        bool earlyClobberFound = false, overlapFound = false;
      > +        for (int i = MI->getNumOperands()-1; i>=0; --i) {
      > +          MachineOperand &MO = MI->getOperand(i);
      > +          if (MO.isRegister() && MO.getReg()) {
      > +            if ((MO.overlapsEarlyClobber() || MO.isEarlyClobber()) &&
      > +                HReg==MO.getReg())
      > +              overlapFound = true;
      > +            if (MO.isEarlyClobber() && cur->reg==MO.getReg())
      > +              earlyClobberFound = true;
      > +          }
      > +        }
      > +        if (earlyClobberFound && overlapFound) {
      > +          DOUT << "  earlyclobber conflict: " <<
      > +                  "%reg" << cur->reg << ", " << tri_->getName(HReg)  
      > << "\n\t";
      > +          return false;
      > +        }
      > +      }
      > +    }
      > +  }
      > +  return true;
      > +}
      > +
      > /// getFreePhysReg - return a free physical register for this  
      > virtual register
      > /// interval if we have one, otherwise return 0.
      > unsigned RALinScan::getFreePhysReg(LiveInterval *cur) {
      > @@ -1049,7 +1118,7 @@
      >   assert(I != E && "No allocatable register in this register class!");
      >   for (; I != E; ++I)
      >     if (prt_->isRegAvail(*I) &&
      > -        li_->noEarlyclobberConflict(cur->reg, *vrm_, *I)) {
      > +        noEarlyClobberConflict(cur, *I)) {
      >       FreeReg = *I;
      >       if (FreeReg < inactiveCounts.size())
      >         FreeRegInactiveCount = inactiveCounts[FreeReg];
      > @@ -1070,7 +1139,7 @@
      >     unsigned Reg = *I;
      >     if (prt_->isRegAvail(Reg) && Reg < inactiveCounts.size() &&
      >         FreeRegInactiveCount < inactiveCounts[Reg] &&
      > -        li_->noEarlyclobberConflict(cur->reg, *vrm_, Reg)) {
      > +        noEarlyClobberConflict(cur, *I)) {
      >       FreeReg = Reg;
      >       FreeRegInactiveCount = inactiveCounts[Reg];
      >       if (FreeRegInactiveCount == MaxInactiveCount)
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From dalej at apple.com  Fri Sep 19 12:50:25 2008
      From: dalej at apple.com (Dale Johannesen)
      Date: Fri, 19 Sep 2008 10:50:25 -0700
      Subject: [llvm-commits] [llvm] r56326 - in /llvm/trunk:
      	include/llvm/CodeGen/LiveInterval.h
      	include/llvm/CodeGen/LiveIntervalAnalysis.h	lib/CodeGen/LiveInterval.cpp
      	lib/CodeGen/LiveIntervalAnalysis.cpp	lib/CodeGen/RegAllocLinearScan.cpp
      In-Reply-To: <51666910-CAA2-47A5-9F26-809138EE0E5F@apple.com>
      References: <200809190102.m8J12ZW2019167@zion.cs.uiuc.edu>
      	<51666910-CAA2-47A5-9F26-809138EE0E5F@apple.com>
      Message-ID: <10574389-E3FC-4024-AD0D-A462B01F39B4@apple.com>
      
      
      On Sep 19, 2008, at 10:48 AMPDT, Evan Cheng wrote:
      >>
      >>    float weight;        // weight of this interval
      >> +    bool isEarlyClobber;
      >> +    bool overlapsEarlyClobber;
      >
      > Hi Dale,
      >
      > I don't think we want two bits. I'd rather go with one bit and have
      > register allocator look at both use and def operands. What do you  
      > think?
      
      The comment explains why I don't want to do this:
      >>
      >> +/// Dropping the distinction between earlyclobber and earlyclobber-
      >> conflict,
      >> +/// keeping only one bit, looks promising, but two earlyclobber-
      >> conflict
      >> +/// operands may be assigned the same register if they happen to
      >> contain the
      >> +/// same value, and that implementation would prevent this.
      
      
      
      From kremenek at apple.com  Fri Sep 19 13:01:14 2008
      From: kremenek at apple.com (Ted Kremenek)
      Date: Fri, 19 Sep 2008 18:01:14 -0000
      Subject: [llvm-commits] [llvm] r56355 - /llvm/trunk/include/llvm/ADT/APSInt.h
      Message-ID: <200809191801.m8JI1Efp030252@zion.cs.uiuc.edu>
      
      Author: kremenek
      Date: Fri Sep 19 13:01:14 2008
      New Revision: 56355
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56355&view=rev
      Log:
      Added static methods to APSInt: getMinValue and getMaxValue.
      
      Modified:
          llvm/trunk/include/llvm/ADT/APSInt.h
      
      Modified: llvm/trunk/include/llvm/ADT/APSInt.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APSInt.h?rev=56355&r1=56354&r2=56355&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/ADT/APSInt.h (original)
      +++ llvm/trunk/include/llvm/ADT/APSInt.h Fri Sep 19 13:01:14 2008
      @@ -234,6 +234,20 @@
           return APSInt(~static_cast(*this), IsUnsigned);
         }
         
      +  /// getMaxValue - Return the APSInt representing the maximum integer value
      +  ///  with the given bit width and signedness.
      +  static APSInt getMaxValue(uint32_t numBits, bool Signed) {
      +    return APSInt(Signed ? APInt::getSignedMaxValue(numBits)
      +                         : APInt::getMaxValue(numBits), Signed);
      +  }
      +  
      +  /// getMinValue - Return the APSInt representing the minimum integer value
      +  ///  with the given bit width and signedness.
      +  static APSInt getMinValue(uint32_t numBits, bool Signed) {
      +    return APSInt(Signed ? APInt::getSignedMinValue(numBits)
      +                         : APInt::getMinValue(numBits), Signed);
      +  }
      +  
         /// Profile - Used to insert APSInt objects, or objects that contain APSInt
         ///  objects, into FoldingSets.
         void Profile(FoldingSetNodeID& ID) const;
      
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 13:04:10 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Fri, 19 Sep 2008 11:04:10 -0700
      Subject: [llvm-commits] [llvm] r56326 - in /llvm/trunk:
      	include/llvm/CodeGen/LiveInterval.h
      	include/llvm/CodeGen/LiveIntervalAnalysis.h	lib/CodeGen/LiveInterval.cpp
      	lib/CodeGen/LiveIntervalAnalysis.cpp	lib/CodeGen/RegAllocLinearScan.cpp
      In-Reply-To: <10574389-E3FC-4024-AD0D-A462B01F39B4@apple.com>
      References: <200809190102.m8J12ZW2019167@zion.cs.uiuc.edu>
      	<51666910-CAA2-47A5-9F26-809138EE0E5F@apple.com>
      	<10574389-E3FC-4024-AD0D-A462B01F39B4@apple.com>
      Message-ID: <5C7E7977-A85C-44DB-8D61-5A8AF02E9C6A@apple.com>
      
      
      On Sep 19, 2008, at 10:50 AM, Dale Johannesen wrote:
      
      >
      > On Sep 19, 2008, at 10:48 AMPDT, Evan Cheng wrote:
      >>>
      >>>   float weight;        // weight of this interval
      >>> +    bool isEarlyClobber;
      >>> +    bool overlapsEarlyClobber;
      >>
      >> Hi Dale,
      >>
      >> I don't think we want two bits. I'd rather go with one bit and have
      >> register allocator look at both use and def operands. What do you
      >> think?
      >
      > The comment explains why I don't want to do this:
      
      Sorry, I don't follow. Can you provide an example?
      
      Evan
      
      >
      >>>
      >>> +/// Dropping the distinction between earlyclobber and earlyclobber-
      >>> conflict,
      >>> +/// keeping only one bit, looks promising, but two earlyclobber-
      >>> conflict
      >>> +/// operands may be assigned the same register if they happen to
      >>> contain the
      >>> +/// same value, and that implementation would prevent this.
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From kremenek at apple.com  Fri Sep 19 13:07:52 2008
      From: kremenek at apple.com (Ted Kremenek)
      Date: Fri, 19 Sep 2008 18:07:52 -0000
      Subject: [llvm-commits] [llvm] r56356 - /llvm/tags/checker/checker-94/
      Message-ID: <200809191807.m8JI7qK0030494@zion.cs.uiuc.edu>
      
      Author: kremenek
      Date: Fri Sep 19 13:07:52 2008
      New Revision: 56356
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56356&view=rev
      Log:
      Tagging checker-94.
      
      Added:
          llvm/tags/checker/checker-94/
            - copied from r56355, llvm/trunk/
      
      
      
      From gohman at apple.com  Fri Sep 19 13:09:19 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Fri, 19 Sep 2008 18:09:19 -0000
      Subject: [llvm-commits] [llvm] r56358 -
      	/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
      Message-ID: <200809191809.m8JI9JDA030560@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Fri Sep 19 13:09:19 2008
      New Revision: 56358
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56358&view=rev
      Log:
      Now that ConstantSDNode doesn't hold an APInt,
      use ARG_FLAGSSDNode as the most aligned node type,
      as it contains an int64_t, which is 8-byte
      aligned on mingw.
      
      Modified:
          llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
      
      Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=56358&r1=56357&r2=56358&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Fri Sep 19 13:09:19 2008
      @@ -2417,7 +2417,7 @@
       /// MostAlignedSDNode - The SDNode class with the greatest alignment
       /// requirement.
       ///
      -typedef ConstantSDNode MostAlignedSDNode;
      +typedef ARG_FLAGSSDNode MostAlignedSDNode;
       
       namespace ISD {
         /// isNormalLoad - Returns true if the specified node is a non-extending
      
      
      
      
      From isanbard at gmail.com  Fri Sep 19 13:19:07 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 11:19:07 -0700
      Subject: [llvm-commits] [llvm-gcc-4.2] r56329 - in
      	/llvm-gcc-4.2/branches/Apple: Gaz/ Xcode-3.1.1/
      In-Reply-To: 
      References: <200809190302.m8J32qlT023258@zion.cs.uiuc.edu>
      	
      Message-ID: <16e5fdf90809191119n53aa3855ic69e44342f05d4ea@mail.gmail.com>
      
      On Fri, Sep 19, 2008 at 10:37 AM, Dale Johannesen  wrote:
      >
      > On Sep 18, 2008, at 8:02 PMPDT, Bill Wendling wrote:
      >
      >> Author: void
      >> Date: Thu Sep 18 22:02:51 2008
      >> New Revision: 56329
      >>
      >> URL: http://llvm.org/viewvc/llvm-project?rev=56329&view=rev
      >> Log:
      >> Rename Gaz to Xcode-3.1.1
      >
      > The fate of all humorists.  Why do those without a sense of humor
      > always win? :)
      >
      At least for a time, I got to name it something silly. ;-)
      
      -bw
      
      
      From dalej at apple.com  Fri Sep 19 13:26:00 2008
      From: dalej at apple.com (Dale Johannesen)
      Date: Fri, 19 Sep 2008 11:26:00 -0700
      Subject: [llvm-commits] [llvm] r56326 - in /llvm/trunk:
      	include/llvm/CodeGen/LiveInterval.h
      	include/llvm/CodeGen/LiveIntervalAnalysis.h	lib/CodeGen/LiveInterval.cpp
      	lib/CodeGen/LiveIntervalAnalysis.cpp	lib/CodeGen/RegAllocLinearScan.cpp
      In-Reply-To: <5C7E7977-A85C-44DB-8D61-5A8AF02E9C6A@apple.com>
      References: <200809190102.m8J12ZW2019167@zion.cs.uiuc.edu>
      	<51666910-CAA2-47A5-9F26-809138EE0E5F@apple.com>
      	<10574389-E3FC-4024-AD0D-A462B01F39B4@apple.com>
      	<5C7E7977-A85C-44DB-8D61-5A8AF02E9C6A@apple.com>
      Message-ID: <21171FE7-D099-4281-B86A-F0944DD07C4B@apple.com>
      
      
      On Sep 19, 2008, at 11:04 AMPDT, Evan Cheng wrote:
      
      >
      > On Sep 19, 2008, at 10:50 AM, Dale Johannesen wrote:
      >
      >>
      >> On Sep 19, 2008, at 10:48 AMPDT, Evan Cheng wrote:
      >>>>
      >>>>  float weight;        // weight of this interval
      >>>> +    bool isEarlyClobber;
      >>>> +    bool overlapsEarlyClobber;
      >>>
      >>> Hi Dale,
      >>>
      >>> I don't think we want two bits. I'd rather go with one bit and have
      >>> register allocator look at both use and def operands. What do you
      >>> think?
      >>
      >> The comment explains why I don't want to do this:
      >
      > Sorry, I don't follow. Can you provide an example?
      
      void foo (int x, int y) {
         int z=x+y;
         int w=x+y;
         int t;
         asm volatile ("%0 %1 %2" : "=&r"(t) : "r"(z), "r"(w));
      }
      
      %1 and %2 can share a register, but if there is no way to distinguish  
      between earlyclobber and overlaps-earlyclobber, we can't do this.
      In theory this is a matter of correctness, it is possible to construct  
      cases where you run out of registers if you don't share.
      
      
      
      From isanbard at gmail.com  Fri Sep 19 13:34:50 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 18:34:50 -0000
      Subject: [llvm-commits] [llvm] r56359 - /llvm/trunk/include/llvm/Constants.h
      Message-ID: <200809191834.m8JIYsrj031499@zion.cs.uiuc.edu>
      
      Author: void
      Date: Fri Sep 19 13:34:40 2008
      New Revision: 56359
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56359&view=rev
      Log:
      Prevent warning about conversion from 64-bit to 32-bit by (yuck) casting...
      
      Modified:
          llvm/trunk/include/llvm/Constants.h
      
      Modified: llvm/trunk/include/llvm/Constants.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=56359&r1=56358&r2=56359&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Constants.h (original)
      +++ llvm/trunk/include/llvm/Constants.h Fri Sep 19 13:34:40 2008
      @@ -753,7 +753,7 @@
         /// operands replaced with the specified values.  The specified operands must
         /// match count and type with the existing ones.
         Constant *getWithOperands(const std::vector &Ops) const {
      -    return getWithOperands(&Ops[0], Ops.size());
      +    return getWithOperands(&Ops[0], (unsigned)Ops.size());
         }
         Constant *getWithOperands(Constant* const *Ops, unsigned NumOps) const;
         
      
      
      
      
      From isanbard at gmail.com  Fri Sep 19 13:48:02 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 18:48:02 -0000
      Subject: [llvm-commits] [llvm] r56360 - in /llvm/tags/Apple/llvmCore-2070.1:
       ./ include/llvm/Constants.h
      Message-ID: <200809191848.m8JIm255031951@zion.cs.uiuc.edu>
      
      Author: void
      Date: Fri Sep 19 13:47:59 2008
      New Revision: 56360
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56360&view=rev
      Log:
      Adding http://llvm.org/viewvc/llvm-project?rev=56359&view=rev to 2070.
      
      Added:
          llvm/tags/Apple/llvmCore-2070.1/
            - copied from r56340, llvm/tags/Apple/llvmCore-2070/
      Modified:
          llvm/tags/Apple/llvmCore-2070.1/include/llvm/Constants.h
      
      Modified: llvm/tags/Apple/llvmCore-2070.1/include/llvm/Constants.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2070.1/include/llvm/Constants.h?rev=56360&r1=56340&r2=56360&view=diff
      
      ==============================================================================
      --- llvm/tags/Apple/llvmCore-2070.1/include/llvm/Constants.h (original)
      +++ llvm/tags/Apple/llvmCore-2070.1/include/llvm/Constants.h Fri Sep 19 13:47:59 2008
      @@ -753,7 +753,7 @@
         /// operands replaced with the specified values.  The specified operands must
         /// match count and type with the existing ones.
         Constant *getWithOperands(const std::vector &Ops) const {
      -    return getWithOperands(&Ops[0], Ops.size());
      +    return getWithOperands(&Ops[0], (unsigned)Ops.size());
         }
         Constant *getWithOperands(Constant* const *Ops, unsigned NumOps) const;
         
      
      
      
      
      From isanbard at gmail.com  Fri Sep 19 13:49:11 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 18:49:11 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56361 -
      	/llvm-gcc-4.2/tags/Apple/llvmCore-2070.1/
      Message-ID: <200809191849.m8JInBsi031998@zion.cs.uiuc.edu>
      
      Author: void
      Date: Fri Sep 19 13:49:11 2008
      New Revision: 56361
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56361&view=rev
      Log:
      Tagging 2070 as 2070.1 to coincide with llvmCore-2070.1
      
      Added:
          llvm-gcc-4.2/tags/Apple/llvmCore-2070.1/
            - copied from r56360, llvm-gcc-4.2/tags/Apple/llvmgcc42-2070/
      
      
      
      From isanbard at gmail.com  Fri Sep 19 13:49:46 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 18:49:46 -0000
      Subject: [llvm-commits] [llvm] r56362 - /llvm/tags/Apple/llvmCore-2070/trunk/
      Message-ID: <200809191849.m8JInkKj032022@zion.cs.uiuc.edu>
      
      Author: void
      Date: Fri Sep 19 13:49:46 2008
      New Revision: 56362
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56362&view=rev
      Log:
      Creating llvmCore-2070 branch
      
      Added:
          llvm/tags/Apple/llvmCore-2070/trunk/
            - copied from r56361, llvm/trunk/
      
      
      
      From isanbard at gmail.com  Fri Sep 19 13:50:08 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 18:50:08 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56363 -
      	/llvm-gcc-4.2/tags/Apple/llvmgcc42-2070/trunk/
      Message-ID: <200809191850.m8JIo8nJ032057@zion.cs.uiuc.edu>
      
      Author: void
      Date: Fri Sep 19 13:50:08 2008
      New Revision: 56363
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56363&view=rev
      Log:
      Creating llvmgcc42-2070 branch
      
      Added:
          llvm-gcc-4.2/tags/Apple/llvmgcc42-2070/trunk/
            - copied from r56362, llvm-gcc-4.2/trunk/
      
      
      
      From dalej at apple.com  Fri Sep 19 13:52:32 2008
      From: dalej at apple.com (Dale Johannesen)
      Date: Fri, 19 Sep 2008 18:52:32 -0000
      Subject: [llvm-commits] [llvm] r56364 -
      	/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      Message-ID: <200809191852.m8JIqW5d032135@zion.cs.uiuc.edu>
      
      Author: johannes
      Date: Fri Sep 19 13:52:31 2008
      New Revision: 56364
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56364&view=rev
      Log:
      Make earlyclobber stuff work when virtual regs
      have previously been assigned conflicting physreg.
      
      
      Modified:
          llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      
      Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56364&r1=56363&r2=56364&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
      +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Fri Sep 19 13:52:31 2008
      @@ -174,6 +174,7 @@
           void ComputeRelatedRegClasses();
       
           bool noEarlyClobberConflict(LiveInterval *cur, unsigned RegNo);
      +    unsigned findPhysReg(MachineOperand &MO);
       
           template 
           void printIntervals(const char* const str, ItTy i, ItTy e) const {
      @@ -1003,6 +1004,19 @@
           unhandled_.push(added[i]);
       }
       
      +/// findPhysReg - get the physical register, if any, assigned to this operand.
      +/// This may be an original physical register, or the physical register which
      +/// has been assigned to a virtual register.
      +unsigned RALinScan::findPhysReg(MachineOperand &MO) {
      +  unsigned PhysReg = MO.getReg();
      +  if (PhysReg && TargetRegisterInfo::isVirtualRegister(PhysReg)) {
      +    if (!vrm_->hasPhys(PhysReg))
      +      return 0;
      +    PhysReg = vrm_->getPhys(PhysReg);
      +  }
      +  return PhysReg;
      +}
      +
       /// noEarlyClobberConflict - see whether LiveInternal cur has a conflict with
       /// hard reg HReg because of earlyclobbers.  
       ///
      @@ -1032,11 +1046,13 @@
             if (MI->getOpcode()==TargetInstrInfo::INLINEASM) {
               for (int i = MI->getNumOperands()-1; i>=0; --i) {
                 MachineOperand &MO = MI->getOperand(i);
      -          if (MO.isRegister() && MO.getReg() && MO.isEarlyClobber() &&
      -              HReg==MO.getReg()) {
      -            DOUT << "  earlyclobber conflict: " << 
      +          if (MO.isRegister() && MO.isEarlyClobber()) {
      +            unsigned PhysReg = findPhysReg(MO);
      +            if (HReg==PhysReg) {
      +              DOUT << "  earlyclobber conflict: " << 
                         "%reg" << cur->reg << ", " << tri_->getName(HReg) << "\n\t";
      -            return false;
      +              return false;
      +            }
                 }
               }
             }
      @@ -1051,10 +1067,12 @@
               bool earlyClobberFound = false, overlapFound = false;
               for (int i = MI->getNumOperands()-1; i>=0; --i) {
                 MachineOperand &MO = MI->getOperand(i);
      -          if (MO.isRegister() && MO.getReg()) {
      -            if ((MO.overlapsEarlyClobber() || MO.isEarlyClobber()) && 
      -                HReg==MO.getReg())
      -              overlapFound = true;
      +          if (MO.isRegister()) {
      +            if ((MO.overlapsEarlyClobber() || MO.isEarlyClobber())) {
      +              unsigned PhysReg = findPhysReg(MO);
      +              if (HReg==PhysReg)
      +                overlapFound = true;
      +            }
                   if (MO.isEarlyClobber() && cur->reg==MO.getReg())
                     earlyClobberFound = true;
                 }
      
      
      
      
      From isanbard at gmail.com  Fri Sep 19 15:06:48 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 20:06:48 -0000
      Subject: [llvm-commits] [llvm] r56365 - /llvm/tags/Apple/llvmCore-2070/trunk/
      Message-ID: <200809192006.m8JK6m9N001969@zion.cs.uiuc.edu>
      
      Author: void
      Date: Fri Sep 19 15:06:47 2008
      New Revision: 56365
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56365&view=rev
      Log:
      Delete bogus tag
      
      Removed:
          llvm/tags/Apple/llvmCore-2070/trunk/
      
      
      
      From isanbard at gmail.com  Fri Sep 19 15:07:00 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Fri, 19 Sep 2008 20:07:00 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56366 -
      	/llvm-gcc-4.2/tags/Apple/llvmgcc42-2070/trunk/
      Message-ID: <200809192007.m8JK70K0001991@zion.cs.uiuc.edu>
      
      Author: void
      Date: Fri Sep 19 15:07:00 2008
      New Revision: 56366
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56366&view=rev
      Log:
      Delete bogus tag
      
      Removed:
          llvm-gcc-4.2/tags/Apple/llvmgcc42-2070/trunk/
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 15:59:22 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Fri, 19 Sep 2008 20:59:22 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56370 - in /llvm-gcc-4.2/trunk/gcc:
       config/darwin.c config/darwin.h llvm-backend.cpp
      Message-ID: <200809192059.m8JKxMPk003704@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Fri Sep 19 15:59:22 2008
      New Revision: 56370
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56370&view=rev
      Log:
      Determine the correct target triple string when -mmacosx-version-min is specified. This is Mac OS X only.
      
      Modified:
          llvm-gcc-4.2/trunk/gcc/config/darwin.c
          llvm-gcc-4.2/trunk/gcc/config/darwin.h
          llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=56370&r1=56369&r2=56370&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Fri Sep 19 15:59:22 2008
      @@ -2671,4 +2671,43 @@
         return type_node == ccfstring_type_node;
       }
       /* APPLE LOCAL end radar 4985544 */
      +
      +/* APPLE LOCAL begin radar 6230142 */
      +bool darwin_llvm_override_target_version(const char *triple, char **new_triple) {
      +  int len = 0, version = 0;
      +
      +  if (!darwin_macosx_version_min)
      +    return false;
      +  
      +  /* Triple string is expected to look something like 'i386-apple-darwin?'. */
      +  len = strlen (triple);
      +  if (len < 7)
      +    return false;
      +  if (strncmp (&triple[len - 7], "darwin", 6) != 0)
      +    return (char *)triple;
      +
      +  /* llvm-gcc doesn't support pre-10.0 systems. */
      +  version = strverscmp (darwin_macosx_version_min, "10.0");
      +  if (version < 0)
      +    return false;
      +
      +  /* 10.0 is darwin4. */
      +  version += 4;
      +  
      +  /* Darwin version number will be 2 digits for 10.6 and up.  */
      +  if (version >= 10)
      +    ++len;
      +  *new_triple = ggc_alloc (len+1);
      +  strcpy (*new_triple, triple);
      +  if (version >= 10)
      +    {
      +      (*new_triple)[len-2] = '1';
      +      version -= 10;
      +    }
      +  (*new_triple)[len-1] = '0' + version;
      +  (*new_triple)[len] = '\0';
      +  
      +  return true;
      +}
      +/* APPLE LOCAL end radar 6230142 */
       #include "gt-darwin.h"
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=56370&r1=56369&r2=56370&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Fri Sep 19 15:59:22 2008
      @@ -1564,4 +1564,10 @@
       #undef TARGET_BUILD_SYSROOT_PATH
       #define TARGET_BUILD_SYSROOT_PATH(S,P) darwin_build_sysroot_path((S), (P))
       /* LLVM LOCAL end sysroot */
      +
      +/* APPLE LOCAL begin radar 6230142 */
      +extern bool darwin_llvm_override_target_version(const char*, char**);
      +#define LLVM_OVERRIDE_TARGET_VERSION(T,N)        \
      +  darwin_llvm_override_target_version(T,N)
      +/* APPLE LOCAL end radar 6230142 */
       #endif /* CONFIG_DARWIN_H */
      
      Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=56370&r1=56369&r2=56370&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
      +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Fri Sep 19 15:59:22 2008
      @@ -192,6 +192,13 @@
             TargetTriple = Arch + TargetTriple.substr(DashPos);
         }
       #endif
      +#ifdef LLVM_OVERRIDE_TARGET_VERSION
      +  char *NewTriple;
      +  bool OverRidden = LLVM_OVERRIDE_TARGET_VERSION(TargetTriple.c_str(),
      +                                                 &NewTriple);
      +  if (OverRidden)
      +    TargetTriple = std::string(NewTriple);
      +#endif
         TheModule->setTargetTriple(TargetTriple);
         
         TheTypeConverter = new TypeConverter();
      
      
      
      
      From gohman at apple.com  Fri Sep 19 17:17:03 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Fri, 19 Sep 2008 22:17:03 -0000
      Subject: [llvm-commits] [llvm] r56371 - in /llvm/trunk:
       lib/CodeGen/SelectionDAG/FastISel.cpp lib/Target/X86/X86FastISel.cpp
       test/CodeGen/X86/fast-isel-mem.ll
      Message-ID: <200809192217.m8JMH5X4006288@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Fri Sep 19 17:16:54 2008
      New Revision: 56371
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56371&view=rev
      Log:
      Refactor X86SelectConstAddr, folding it into X86SelectAddress. This
      results in better code for globals. Also, unbreak the local CSE for
      GlobalValue stub loads.
      
      Modified:
          llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
          llvm/trunk/lib/Target/X86/X86FastISel.cpp
          llvm/trunk/test/CodeGen/X86/fast-isel-mem.ll
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=56371&r1=56370&r2=56371&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Fri Sep 19 17:16:54 2008
      @@ -44,15 +44,10 @@
         }
       
         if (ConstantInt *CI = dyn_cast(V)) {
      -    if (CI->getValue().getActiveBits() > 64)
      -      return TargetMaterializeConstant(CI);
      -    // Don't cache constant materializations.  To do so would require
      -    // tracking what uses they dominate.
      -    Reg = FastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue());
      -  } else if (isa(V)) {
      -    return TargetMaterializeConstant(cast(V));
      +    if (CI->getValue().getActiveBits() <= 64)
      +      Reg = FastEmit_i(VT, VT, ISD::Constant, CI->getZExtValue());
         } else if (isa(V)) {
      -    return TargetMaterializeAlloca(cast(V));
      +    Reg = TargetMaterializeAlloca(cast(V));
         } else if (isa(V)) {
           Reg = FastEmit_i(VT, VT, ISD::Constant, 0);
         } else if (ConstantFP *CF = dyn_cast(V)) {
      @@ -64,18 +59,15 @@
       
             uint64_t x[2];
             uint32_t IntBitWidth = IntVT.getSizeInBits();
      -      if (Flt.convertToInteger(x, IntBitWidth, /*isSigned=*/true,
      -                               APFloat::rmTowardZero) != APFloat::opOK)
      -        return TargetMaterializeConstant(CF);
      -      APInt IntVal(IntBitWidth, 2, x);
      -
      -      unsigned IntegerReg = FastEmit_i(IntVT.getSimpleVT(), IntVT.getSimpleVT(),
      -                                       ISD::Constant, IntVal.getZExtValue());
      -      if (IntegerReg == 0)
      -        return TargetMaterializeConstant(CF);
      -      Reg = FastEmit_r(IntVT.getSimpleVT(), VT, ISD::SINT_TO_FP, IntegerReg);
      -      if (Reg == 0)
      -        return TargetMaterializeConstant(CF);
      +      if (!Flt.convertToInteger(x, IntBitWidth, /*isSigned=*/true,
      +                                APFloat::rmTowardZero) != APFloat::opOK) {
      +        APInt IntVal(IntBitWidth, 2, x);
      +
      +        unsigned IntegerReg = FastEmit_i(IntVT.getSimpleVT(), IntVT.getSimpleVT(),
      +                                         ISD::Constant, IntVal.getZExtValue());
      +        if (IntegerReg != 0)
      +          Reg = FastEmit_r(IntVT.getSimpleVT(), VT, ISD::SINT_TO_FP, IntegerReg);
      +      }
           }
         } else if (ConstantExpr *CE = dyn_cast(V)) {
           if (!SelectOperator(CE, CE->getOpcode())) return 0;
      @@ -88,8 +80,10 @@
         }
         
         if (!Reg && isa(V))
      -    return TargetMaterializeConstant(cast(V));
      +    Reg = TargetMaterializeConstant(cast(V));
         
      +  // Don't cache constant materializations in the general ValueMap.
      +  // To do so would require tracking what uses they dominate.
         LocalValueMap[V] = Reg;
         return Reg;
       }
      
      Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=56371&r1=56370&r2=56371&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Fri Sep 19 17:16:54 2008
      @@ -72,10 +72,7 @@
         bool X86FastEmitExtend(ISD::NodeType Opc, MVT DstVT, unsigned Src, MVT SrcVT,
                                unsigned &ResultReg);
         
      -  bool X86SelectConstAddr(Value *V, unsigned &Op0,
      -                          bool isCall = false, bool inReg = false);
      -
      -  bool X86SelectAddress(Value *V, X86AddressMode &AM);
      +  bool X86SelectAddress(Value *V, X86AddressMode &AM, bool isCall);
       
         bool X86SelectLoad(Instruction *I);
         
      @@ -281,56 +278,9 @@
           return false;
       }
       
      -/// X86SelectConstAddr - Select and emit code to materialize constant address.
      -/// 
      -bool X86FastISel::X86SelectConstAddr(Value *V, unsigned &Op0,
      -                                     bool isCall, bool inReg) {
      -  // FIXME: Only GlobalAddress for now.
      -  GlobalValue *GV = dyn_cast(V);
      -  if (!GV)
      -    return false;
      -
      -  if (Subtarget->GVRequiresExtraLoad(GV, TM, isCall)) {
      -    // Issue load from stub if necessary.
      -    unsigned Opc = 0;
      -    const TargetRegisterClass *RC = NULL;
      -    if (TLI.getPointerTy() == MVT::i32) {
      -      Opc = X86::MOV32rm;
      -      RC  = X86::GR32RegisterClass;
      -    } else {
      -      Opc = X86::MOV64rm;
      -      RC  = X86::GR64RegisterClass;
      -    }
      -    Op0 = createResultReg(RC);
      -    X86AddressMode AM;
      -    AM.GV = GV;
      -    addFullAddress(BuildMI(MBB, TII.get(Opc), Op0), AM);
      -    // Prevent loading GV stub multiple times in same MBB.
      -    LocalValueMap[V] = Op0;
      -  } else if (inReg) {
      -    unsigned Opc = 0;
      -    const TargetRegisterClass *RC = NULL;
      -    if (TLI.getPointerTy() == MVT::i32) {
      -      Opc = X86::LEA32r;
      -      RC  = X86::GR32RegisterClass;
      -    } else {
      -      Opc = X86::LEA64r;
      -      RC  = X86::GR64RegisterClass;
      -    }
      -    Op0 = createResultReg(RC);
      -    X86AddressMode AM;
      -    AM.GV = GV;
      -    addFullAddress(BuildMI(MBB, TII.get(Opc), Op0), AM);
      -    // Prevent materializing GV address multiple times in same MBB.
      -    LocalValueMap[V] = Op0;
      -  }
      -
      -  return true;
      -}
      -
       /// X86SelectAddress - Attempt to fill in an address from the given value.
       ///
      -bool X86FastISel::X86SelectAddress(Value *V, X86AddressMode &AM) {
      +bool X86FastISel::X86SelectAddress(Value *V, X86AddressMode &AM, bool isCall) {
         User *U;
         unsigned Opcode = Instruction::UserOp1;
         if (Instruction *I = dyn_cast(V)) {
      @@ -345,19 +295,20 @@
         default: break;
         case Instruction::BitCast:
           // Look past bitcasts.
      -    return X86SelectAddress(U->getOperand(0), AM);
      +    return X86SelectAddress(U->getOperand(0), AM, isCall);
       
         case Instruction::IntToPtr:
           // Look past no-op inttoptrs.
           if (TLI.getValueType(U->getOperand(0)->getType()) == TLI.getPointerTy())
      -      return X86SelectAddress(U->getOperand(0), AM);
      +      return X86SelectAddress(U->getOperand(0), AM, isCall);
       
         case Instruction::PtrToInt:
           // Look past no-op ptrtoints.
           if (TLI.getValueType(U->getType()) == TLI.getPointerTy())
      -      return X86SelectAddress(U->getOperand(0), AM);
      +      return X86SelectAddress(U->getOperand(0), AM, isCall);
       
         case Instruction::Alloca: {
      +    if (isCall) break;
           // Do static allocas.
           const AllocaInst *A = cast(V);
           DenseMap::iterator SI = StaticAllocaMap.find(A);
      @@ -369,15 +320,17 @@
         }
       
         case Instruction::Add: {
      +    if (isCall) break;
           // Adds of constants are common and easy enough.
           if (ConstantInt *CI = dyn_cast(U->getOperand(1))) {
             AM.Disp += CI->getZExtValue();
      -      return X86SelectAddress(U->getOperand(0), AM);
      +      return X86SelectAddress(U->getOperand(0), AM, isCall);
           }
           break;
         }
       
         case Instruction::GetElementPtr: {
      +    if (isCall) break;
           // Pattern-match simple GEPs.
           uint64_t Disp = AM.Disp;
           unsigned IndexReg = AM.IndexReg;
      @@ -414,7 +367,7 @@
           AM.IndexReg = IndexReg;
           AM.Scale = Scale;
           AM.Disp = Disp;
      -    return X86SelectAddress(U->getOperand(0), AM);
      +    return X86SelectAddress(U->getOperand(0), AM, isCall);
         unsupported_gep:
           // Ok, the GEP indices weren't all covered.
           break;
      @@ -422,19 +375,37 @@
         }
       
         // Handle constant address.
      -  // FIXME: If load type is something we can't handle, this can result in
      -  // a dead stub load instruction.
      -  if (isa(V) && X86SelectConstAddr(V, AM.Base.Reg)) {
      -    if (AM.Base.Reg == 0)
      -      AM.GV = cast(V);
      -  } else {
      -    AM.Base.Reg = getRegForValue(V);
      -    if (AM.Base.Reg == 0)
      -      // Unhandled operand. Halt "fast" selection and bail.
      -      return false;
      +  if (GlobalValue *GV = dyn_cast(V)) {
      +    if (Subtarget->GVRequiresExtraLoad(GV, TM, isCall)) {
      +      // Check to see if we've already materialized this
      +      // value in a register in this block.
      +      if (unsigned Reg = LocalValueMap[V])
      +        return Reg;
      +      // Issue load from stub if necessary.
      +      unsigned Opc = 0;
      +      const TargetRegisterClass *RC = NULL;
      +      if (TLI.getPointerTy() == MVT::i32) {
      +        Opc = X86::MOV32rm;
      +        RC  = X86::GR32RegisterClass;
      +      } else {
      +        Opc = X86::MOV64rm;
      +        RC  = X86::GR64RegisterClass;
      +      }
      +      AM.Base.Reg = createResultReg(RC);
      +      X86AddressMode LocalAM;
      +      LocalAM.GV = GV;
      +      addFullAddress(BuildMI(MBB, TII.get(Opc), AM.Base.Reg), LocalAM);
      +      // Prevent loading GV stub multiple times in same MBB.
      +      LocalValueMap[V] = AM.Base.Reg;
      +    } else {
      +      AM.GV = GV;
      +    }
      +    return true;
         }
       
      -  return true;
      +  // If all else fails, just materialize the value in a register.
      +  AM.Base.Reg = getRegForValue(V);
      +  return AM.Base.Reg != 0;
       }
       
       /// X86SelectStore - Select and emit code to implement store instructions.
      @@ -448,7 +419,7 @@
           return false;    
       
         X86AddressMode AM;
      -  if (!X86SelectAddress(I->getOperand(1), AM))
      +  if (!X86SelectAddress(I->getOperand(1), AM, false))
           return false;
       
         return X86FastEmitStore(VT, Val, AM);
      @@ -462,7 +433,7 @@
           return false;
       
         X86AddressMode AM;
      -  if (!X86SelectAddress(I->getOperand(0), AM))
      +  if (!X86SelectAddress(I->getOperand(0), AM, false))
           return false;
       
         unsigned ResultReg = 0;
      @@ -849,13 +820,19 @@
       
         // Materialize callee address in a register. FIXME: GV address can be
         // handled with a CALLpcrel32 instead.
      +  X86AddressMode CalleeAM;
      +  if (!X86SelectAddress(Callee, CalleeAM, true))
      +    return false;
         unsigned CalleeOp = 0;
      -  if (!isa(Callee) || !X86SelectConstAddr(Callee, CalleeOp, true)) {
      -    CalleeOp = getRegForValue(Callee);
      -    if (CalleeOp == 0)
      -      // Unhandled operand. Halt "fast" selection and bail.
      -      return false;    
      -  }
      +  GlobalValue *GV = 0;
      +  if (CalleeAM.Base.Reg != 0) {
      +    assert(CalleeAM.GV == 0);
      +    CalleeOp = CalleeAM.Base.Reg;
      +  } else if (CalleeAM.GV != 0) {
      +    assert(CalleeAM.GV != 0);
      +    GV = CalleeAM.GV;
      +  } else
      +    return false;
       
         // Allow calls which produce i1 results.
         bool AndToI1 = false;
      @@ -976,7 +953,7 @@
           : (Subtarget->is64Bit() ? X86::CALL64pcrel32 : X86::CALLpcrel32);
         MachineInstrBuilder MIB = CalleeOp
           ? BuildMI(MBB, TII.get(CallOpc)).addReg(CalleeOp)
      -    :BuildMI(MBB, TII.get(CallOpc)).addGlobalAddress(cast(Callee));
      +    : BuildMI(MBB, TII.get(CallOpc)).addGlobalAddress(GV);
         // Add implicit physical register uses to the call.
         while (!RegArgs.empty()) {
           MIB.addReg(RegArgs.back());
      @@ -1132,10 +1109,18 @@
           break;
         }
         
      -  unsigned ResultReg = createResultReg(RC);
      +  // Materialize addresses with LEA instructions.
         if (isa(C)) {
      -    if (X86SelectConstAddr(C, ResultReg, false, true))
      +    X86AddressMode AM;
      +    if (X86SelectAddress(C, AM, false)) {
      +      if (TLI.getPointerTy() == MVT::i32)
      +        Opc = X86::LEA32r;
      +      else
      +        Opc = X86::LEA64r;
      +      unsigned ResultReg = createResultReg(RC);
      +      addFullAddress(BuildMI(MBB, TII.get(Opc), ResultReg), AM);
             return ResultReg;
      +    }
           return 0;
         }
         
      @@ -1148,13 +1133,14 @@
         }
         
         unsigned MCPOffset = MCP.getConstantPoolIndex(C, Align);
      +  unsigned ResultReg = createResultReg(RC);
         addConstantPoolReference(BuildMI(MBB, TII.get(Opc), ResultReg), MCPOffset);
         return ResultReg;
       }
       
       unsigned X86FastISel::TargetMaterializeAlloca(AllocaInst *C) {
         X86AddressMode AM;
      -  if (!X86SelectAddress(C, AM))
      +  if (!X86SelectAddress(C, AM, false))
           return 0;
         unsigned Opc = Subtarget->is64Bit() ? X86::LEA64r : X86::LEA32r;
         TargetRegisterClass* RC = TLI.getRegClassFor(TLI.getPointerTy());
      
      Modified: llvm/trunk/test/CodeGen/X86/fast-isel-mem.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fast-isel-mem.ll?rev=56371&r1=56370&r2=56371&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/fast-isel-mem.ll (original)
      +++ llvm/trunk/test/CodeGen/X86/fast-isel-mem.ll Fri Sep 19 17:16:54 2008
      @@ -1,5 +1,5 @@
       ; RUN: llvm-as < %s | llc -fast-isel -mtriple=i386-apple-darwin | \
      -; RUN:   grep mov | grep lazy_ptr | count 2
      +; RUN:   grep lazy_ptr, | count 2
       ; RUN: llvm-as < %s | llc -fast-isel -march=x86 -relocation-model=static | \
       ; RUN:   grep lea
       
      
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 17:49:43 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Fri, 19 Sep 2008 22:49:43 -0000
      Subject: [llvm-commits] [llvm] r56372 -
      	/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      Message-ID: <200809192249.m8JMnh4N007336@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Fri Sep 19 17:49:39 2008
      New Revision: 56372
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56372&view=rev
      Log:
      Continue after removing the current MI.
      
      Modified:
          llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=56372&r1=56371&r2=56372&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Fri Sep 19 17:49:39 2008
      @@ -2310,6 +2310,7 @@
               if (isDead) {
                 li_->RemoveMachineInstrFromMaps(mii);
                 mii = mbbi->erase(mii);
      +          continue;
               }
             }
       
      
      
      
      
      From dalej at apple.com  Fri Sep 19 18:28:22 2008
      From: dalej at apple.com (Dale Johannesen)
      Date: Fri, 19 Sep 2008 23:28:22 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56374 -
      	/llvm-gcc-4.2/trunk/gcc/config/darwin.h
      Message-ID: <200809192328.m8JNSM85008505@zion.cs.uiuc.edu>
      
      Author: johannes
      Date: Fri Sep 19 18:28:21 2008
      New Revision: 56374
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56374&view=rev
      Log:
      Unbreak build.
      
      
      Modified:
          llvm-gcc-4.2/trunk/gcc/config/darwin.h
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=56374&r1=56373&r2=56374&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Fri Sep 19 18:28:21 2008
      @@ -1566,8 +1566,11 @@
       /* LLVM LOCAL end sysroot */
       
       /* APPLE LOCAL begin radar 6230142 */
      +/* libgcc2 is strict c90; bool doesn't work. */
      +#ifndef IN_LIBGCC2
       extern bool darwin_llvm_override_target_version(const char*, char**);
       #define LLVM_OVERRIDE_TARGET_VERSION(T,N)        \
         darwin_llvm_override_target_version(T,N)
      +#endif /* IN_LIBGCC2 */
       /* APPLE LOCAL end radar 6230142 */
       #endif /* CONFIG_DARWIN_H */
      
      
      
      
      From gohman at apple.com  Fri Sep 19 18:42:05 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Fri, 19 Sep 2008 23:42:05 -0000
      Subject: [llvm-commits] [llvm] r56376 -
      	/llvm/trunk/lib/Target/X86/X86FastISel.cpp
      Message-ID: <200809192342.m8JNg5qj008915@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Fri Sep 19 18:42:04 2008
      New Revision: 56376
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56376&view=rev
      Log:
      Fix a FastISel GlobalVariable CSE bug.
      
      Modified:
          llvm/trunk/lib/Target/X86/X86FastISel.cpp
      
      Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=56376&r1=56375&r2=56376&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Fri Sep 19 18:42:04 2008
      @@ -379,8 +379,10 @@
           if (Subtarget->GVRequiresExtraLoad(GV, TM, isCall)) {
             // Check to see if we've already materialized this
             // value in a register in this block.
      -      if (unsigned Reg = LocalValueMap[V])
      -        return Reg;
      +      if (unsigned Reg = LocalValueMap[V]) {
      +        AM.Base.Reg = Reg;
      +        return true;
      +      }
             // Issue load from stub if necessary.
             unsigned Opc = 0;
             const TargetRegisterClass *RC = NULL;
      
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 19:13:08 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Sat, 20 Sep 2008 00:13:08 -0000
      Subject: [llvm-commits] [llvm] r56377 -
      	/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
      Message-ID: <200809200013.m8K0D8SB009854@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Fri Sep 19 19:13:08 2008
      New Revision: 56377
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56377&view=rev
      Log:
      80 column violation.
      
      Modified:
          llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
      
      Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp?rev=56377&r1=56376&r2=56377&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp (original)
      +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp Fri Sep 19 19:13:08 2008
      @@ -508,10 +508,14 @@
           // Output linker support code for dllexported globals
         if (!DLLExportedGVs.empty() || !DLLExportedFns.empty()) {
           SwitchToDataSection("");
      -    O << "; WARNING: The following code is valid only with MASM v8.x and (possible) higher\n"
      -      << "; This version of MASM is usually shipped with Microsoft Visual Studio 2005\n"
      -      << "; or (possible) further versions. Unfortunately, there is no way to support\n"
      -      << "; dllexported symbols in the earlier versions of MASM in fully automatic way\n\n";
      +    O << "; WARNING: The following code is valid only with MASM v8.x"
      +      << "and (possible) higher\n"
      +      << "; This version of MASM is usually shipped with Microsoft "
      +      << "Visual Studio 2005\n"
      +      << "; or (possible) further versions. Unfortunately, there is no "
      +      << "way to support\n"
      +      << "; dllexported symbols in the earlier versions of MASM in fully "
      +      << "automatic way\n\n";
           O << "_drectve\t segment info alias('.drectve')\n";
         }
       
      
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 19:13:45 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Sat, 20 Sep 2008 00:13:45 -0000
      Subject: [llvm-commits] [llvm] r56378 - in /llvm/trunk:
       lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
       test/CodeGen/X86/darwin-stub.ll
      Message-ID: <200809200013.m8K0DkA6009882@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Fri Sep 19 19:13:45 2008
      New Revision: 56378
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56378&view=rev
      Log:
      No need to print function stubs for Mac OS X 10.5 and up. Linker will handle it.
      
      Added:
          llvm/trunk/test/CodeGen/X86/darwin-stub.ll
      Modified:
          llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
      
      Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=56378&r1=56377&r2=56378&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
      +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Fri Sep 19 19:13:45 2008
      @@ -392,8 +392,13 @@
             if (GV->isDeclaration() || GV->isWeakForLinker()) {
               // Dynamically-resolved functions need a stub for the function.
               if (isCallOp && isa(GV)) {
      -          FnStubs.insert(Name);
      -          printSuffixedName(Name, "$stub");
      +          // Function stubs are no longer needed for Mac OS X 10.5 and up.
      +          if (Subtarget->isTargetDarwin() && Subtarget->getDarwinVers() >= 9) {
      +            O << Name;
      +          } else {
      +            FnStubs.insert(Name);
      +            printSuffixedName(Name, "$stub");
      +          }
               } else {
                 GVStubs.insert(Name);
                 printSuffixedName(Name, "$non_lazy_ptr");
      @@ -475,7 +480,9 @@
           bool needCloseParen = false;
           std::string Name(TAI->getGlobalPrefix());
           Name += MO.getSymbolName();
      -    if (isCallOp && shouldPrintStub(TM, Subtarget)) {
      +    // Print function stub suffix unless it's Mac OS X 10.5 and up.
      +    if (isCallOp && shouldPrintStub(TM, Subtarget) && 
      +        !(Subtarget->isTargetDarwin() && Subtarget->getDarwinVers() >= 9)) {
             FnStubs.insert(Name);
             printSuffixedName(Name, "$stub");
             return;
      
      Added: llvm/trunk/test/CodeGen/X86/darwin-stub.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/darwin-stub.ll?rev=56378&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/darwin-stub.ll (added)
      +++ llvm/trunk/test/CodeGen/X86/darwin-stub.ll Fri Sep 19 19:13:45 2008
      @@ -0,0 +1,12 @@
      +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin  |     grep stub
      +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin9 | not grep stub
      +
      +@"\01LC" = internal constant [13 x i8] c"Hello World!\00"		; <[13 x i8]*> [#uses=1]
      +
      +define i32 @main() nounwind {
      +entry:
      +	%0 = tail call i32 @puts(i8* getelementptr ([13 x i8]* @"\01LC", i32 0, i32 0)) nounwind		;  [#uses=0]
      +	ret i32 0
      +}
      +
      +declare i32 @puts(i8*)
      
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 19:24:06 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Fri, 19 Sep 2008 17:24:06 -0700
      Subject: [llvm-commits] [llvm-gcc-4.2] r56374 -
      	/llvm-gcc-4.2/trunk/gcc/config/darwin.h
      In-Reply-To: <200809192328.m8JNSM85008505@zion.cs.uiuc.edu>
      References: <200809192328.m8JNSM85008505@zion.cs.uiuc.edu>
      Message-ID: 
      
      Ugh. Let me change bool to unsigned.
      
      Sorry about that.
      
      Evan
      
      On Sep 19, 2008, at 4:28 PM, Dale Johannesen wrote:
      
      > Author: johannes
      > Date: Fri Sep 19 18:28:21 2008
      > New Revision: 56374
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=56374&view=rev
      > Log:
      > Unbreak build.
      >
      >
      > Modified:
      >    llvm-gcc-4.2/trunk/gcc/config/darwin.h
      >
      > Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h
      > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=56374&r1=56373&r2=56374&view=diff
      >
      > =
      > =
      > =
      > =
      > =
      > =
      > =
      > =
      > ======================================================================
      > --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original)
      > +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Fri Sep 19 18:28:21 2008
      > @@ -1566,8 +1566,11 @@
      > /* LLVM LOCAL end sysroot */
      >
      > /* APPLE LOCAL begin radar 6230142 */
      > +/* libgcc2 is strict c90; bool doesn't work. */
      > +#ifndef IN_LIBGCC2
      > extern bool darwin_llvm_override_target_version(const char*, char**);
      > #define LLVM_OVERRIDE_TARGET_VERSION(T,N)        \
      >   darwin_llvm_override_target_version(T,N)
      > +#endif /* IN_LIBGCC2 */
      > /* APPLE LOCAL end radar 6230142 */
      > #endif /* CONFIG_DARWIN_H */
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 19:38:13 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Sat, 20 Sep 2008 00:38:13 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56379 - in
      	/llvm-gcc-4.2/trunk/gcc/config: darwin.c darwin.h
      Message-ID: <200809200038.m8K0cDQQ010606@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Fri Sep 19 19:38:13 2008
      New Revision: 56379
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56379&view=rev
      Log:
      Use unsigned instead of bool.
      
      Modified:
          llvm-gcc-4.2/trunk/gcc/config/darwin.c
          llvm-gcc-4.2/trunk/gcc/config/darwin.h
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=56379&r1=56378&r2=56379&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Fri Sep 19 19:38:13 2008
      @@ -2673,23 +2673,23 @@
       /* APPLE LOCAL end radar 4985544 */
       
       /* APPLE LOCAL begin radar 6230142 */
      -bool darwin_llvm_override_target_version(const char *triple, char **new_triple) {
      +unsigned darwin_llvm_override_target_version(const char *triple, char **new_triple) {
         int len = 0, version = 0;
       
         if (!darwin_macosx_version_min)
      -    return false;
      +    return 0;
         
         /* Triple string is expected to look something like 'i386-apple-darwin?'. */
         len = strlen (triple);
         if (len < 7)
      -    return false;
      +    return 0;
         if (strncmp (&triple[len - 7], "darwin", 6) != 0)
           return (char *)triple;
       
         /* llvm-gcc doesn't support pre-10.0 systems. */
         version = strverscmp (darwin_macosx_version_min, "10.0");
         if (version < 0)
      -    return false;
      +    return 0;
       
         /* 10.0 is darwin4. */
         version += 4;
      @@ -2707,7 +2707,7 @@
         (*new_triple)[len-1] = '0' + version;
         (*new_triple)[len] = '\0';
         
      -  return true;
      +  return 1;
       }
       /* APPLE LOCAL end radar 6230142 */
       #include "gt-darwin.h"
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=56379&r1=56378&r2=56379&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Fri Sep 19 19:38:13 2008
      @@ -1567,10 +1567,8 @@
       
       /* APPLE LOCAL begin radar 6230142 */
       /* libgcc2 is strict c90; bool doesn't work. */
      -#ifndef IN_LIBGCC2
      -extern bool darwin_llvm_override_target_version(const char*, char**);
      +extern unsigned darwin_llvm_override_target_version(const char*, char**);
       #define LLVM_OVERRIDE_TARGET_VERSION(T,N)        \
         darwin_llvm_override_target_version(T,N)
      -#endif /* IN_LIBGCC2 */
       /* APPLE LOCAL end radar 6230142 */
       #endif /* CONFIG_DARWIN_H */
      
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 20:18:27 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Fri, 19 Sep 2008 18:18:27 -0700
      Subject: [llvm-commits] [llvm] r56326 - in /llvm/trunk:
      	include/llvm/CodeGen/LiveInterval.h
      	include/llvm/CodeGen/LiveIntervalAnalysis.h	lib/CodeGen/LiveInterval.cpp
      	lib/CodeGen/LiveIntervalAnalysis.cpp	lib/CodeGen/RegAllocLinearScan.cpp
      In-Reply-To: <21171FE7-D099-4281-B86A-F0944DD07C4B@apple.com>
      References: <200809190102.m8J12ZW2019167@zion.cs.uiuc.edu>
      	<51666910-CAA2-47A5-9F26-809138EE0E5F@apple.com>
      	<10574389-E3FC-4024-AD0D-A462B01F39B4@apple.com>
      	<5C7E7977-A85C-44DB-8D61-5A8AF02E9C6A@apple.com>
      	<21171FE7-D099-4281-B86A-F0944DD07C4B@apple.com>
      Message-ID: <0C211098-EF53-4086-AD50-6CCD90BF9557@apple.com>
      
      
      On Sep 19, 2008, at 11:26 AM, Dale Johannesen wrote:
      
      >
      > On Sep 19, 2008, at 11:04 AMPDT, Evan Cheng wrote:
      >
      >>
      >> On Sep 19, 2008, at 10:50 AM, Dale Johannesen wrote:
      >>
      >>>
      >>> On Sep 19, 2008, at 10:48 AMPDT, Evan Cheng wrote:
      >>>>>
      >>>>> float weight;        // weight of this interval
      >>>>> +    bool isEarlyClobber;
      >>>>> +    bool overlapsEarlyClobber;
      >>>>
      >>>> Hi Dale,
      >>>>
      >>>> I don't think we want two bits. I'd rather go with one bit and have
      >>>> register allocator look at both use and def operands. What do you
      >>>> think?
      >>>
      >>> The comment explains why I don't want to do this:
      >>
      >> Sorry, I don't follow. Can you provide an example?
      >
      > void foo (int x, int y) {
      >   int z=x+y;
      >   int w=x+y;
      >   int t;
      >   asm volatile ("%0 %1 %2" : "=&r"(t) : "r"(z), "r"(w));
      > }
      >
      > %1 and %2 can share a register, but if there is no way to distinguish
      > between earlyclobber and overlaps-earlyclobber, we can't do this.
      > In theory this is a matter of correctness, it is possible to construct
      > cases where you run out of registers if you don't share.
      
      Ok. Although please use bitfield to pack them in order to save memory.  
      Actually, we can probably pack "preference" field in as well. So 3  
      bits for isEarlyClobber, overlapsEarlyClobber, and hasPreference. Use  
      the rest of a uint32_t for "preferred register".
      
      Evan
      
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 20:26:28 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Sat, 20 Sep 2008 01:26:28 -0000
      Subject: [llvm-commits] [llvm] r56380 -
      	/llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll
      Message-ID: <200809200126.m8K1QS1Z012094@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Fri Sep 19 20:26:27 2008
      New Revision: 56380
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56380&view=rev
      Log:
      Clean up the test.
      
      Modified:
          llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll
      
      Modified: llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll?rev=56380&r1=56379&r2=56380&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll (original)
      +++ llvm/trunk/test/CodeGen/X86/2008-09-17-inline-asm-1.ll Fri Sep 19 20:26:27 2008
      @@ -1,7 +1,7 @@
      -; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl %eax, %eax"
      -; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl %edx, %edx"
      -; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl (%eax), %eax"
      -; RUN: llvm-as < %s | llc -o - -march=x86 | not grep "movl (%edx), %edx"
      +; RUN: llvm-as < %s | llc -march=x86 | not grep "movl %eax, %eax"
      +; RUN: llvm-as < %s | llc -march=x86 | not grep "movl %edx, %edx"
      +; RUN: llvm-as < %s | llc -march=x86 | not grep "movl (%eax), %eax"
      +; RUN: llvm-as < %s | llc -march=x86 | not grep "movl (%edx), %edx"
       
       ; %0 must not be put in EAX or EDX.
       ; In the first asm, $0 and $2 must not be put in EAX.
      
      
      
      
      From evan.cheng at apple.com  Fri Sep 19 20:28:06 2008
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Sat, 20 Sep 2008 01:28:06 -0000
      Subject: [llvm-commits] [llvm] r56381 - in /llvm/trunk:
       lib/CodeGen/RegAllocLinearScan.cpp
       test/CodeGen/X86/2008-09-19-RegAllocBug.ll
      Message-ID: <200809200128.m8K1S6C7012153@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Fri Sep 19 20:28:05 2008
      New Revision: 56381
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56381&view=rev
      Log:
      Fix PR2808. When regalloc runs out of register, it spill a physical register around the live interval being allocated. Do not continue to try to spill another register, just grab the physical register and move on.
      
      Added:
          llvm/trunk/test/CodeGen/X86/2008-09-19-RegAllocBug.ll
      Modified:
          llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      
      Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56381&r1=56380&r2=56381&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
      +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Fri Sep 19 20:28:05 2008
      @@ -855,9 +855,12 @@
           // All registers must have inf weight. Just grab one!
           minReg = BestPhysReg ? BestPhysReg : *RC->allocation_order_begin(*mf_);
           if (cur->weight == HUGE_VALF ||
      -        li_->getApproximateInstructionCount(*cur) == 0)
      +        li_->getApproximateInstructionCount(*cur) == 0) {
             // Spill a physical register around defs and uses.
             li_->spillPhysRegAroundRegDefsUses(*cur, minReg, *vrm_);
      +      assignRegOrStackSlotAtInterval(cur);
      +      return;
      +    }
         }
       
         // Find up to 3 registers to consider as spill candidates.
      
      Added: llvm/trunk/test/CodeGen/X86/2008-09-19-RegAllocBug.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-19-RegAllocBug.ll?rev=56381&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/2008-09-19-RegAllocBug.ll (added)
      +++ llvm/trunk/test/CodeGen/X86/2008-09-19-RegAllocBug.ll Fri Sep 19 20:28:05 2008
      @@ -0,0 +1,22 @@
      +; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin
      +; PR2808
      +
      + at g_3 = external global i32		;  [#uses=1]
      +
      +define i32 @func_4() nounwind {
      +entry:
      +	%0 = load i32* @g_3, align 4		;  [#uses=2]
      +	%1 = trunc i32 %0 to i8		;  [#uses=1]
      +	%2 = sub i8 1, %1		;  [#uses=1]
      +	%3 = sext i8 %2 to i32		;  [#uses=1]
      +	%.0 = ashr i32 %3, select (i1 icmp ne (i8 zext (i1 icmp ugt (i32 ptrtoint (i32 ()* @func_4 to i32), i32 3) to i8), i8 0), i32 0, i32 ptrtoint (i32 ()* @func_4 to i32))		;  [#uses=1]
      +	%4 = urem i32 %0, %.0		;  [#uses=1]
      +	%5 = icmp eq i32 %4, 0		;  [#uses=1]
      +	br i1 %5, label %return, label %bb4
      +
      +bb4:		; preds = %entry
      +	ret i32 undef
      +
      +return:		; preds = %entry
      +	ret i32 undef
      +}
      
      
      
      
      From dalej at apple.com  Fri Sep 19 21:03:04 2008
      From: dalej at apple.com (Dale Johannesen)
      Date: Sat, 20 Sep 2008 02:03:04 -0000
      Subject: [llvm-commits] [llvm] r56384 - in /llvm/trunk/lib/CodeGen:
       RegAllocLinearScan.cpp SimpleRegisterCoalescing.cpp
      Message-ID: <200809200203.m8K234YA013252@zion.cs.uiuc.edu>
      
      Author: johannes
      Date: Fri Sep 19 21:03:04 2008
      New Revision: 56384
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56384&view=rev
      Log:
      Teach coalescer about earlyclobber bits.
      Check bits for preferred register.
      
      
      Modified:
          llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
          llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      
      Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56384&r1=56383&r2=56384&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
      +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Fri Sep 19 21:03:04 2008
      @@ -1122,9 +1122,12 @@
         unsigned FreeRegInactiveCount = 0;
       
         // If copy coalescer has assigned a "preferred" register, check if it's
      -  // available first.
      +  // available first.  Coalescer can create new earlyclobber interferences,
      +  // so we need to check that.
         if (cur->preference) {
      -    if (prt_->isRegAvail(cur->preference) && RC->contains(cur->preference)) {
      +    if (prt_->isRegAvail(cur->preference) && 
      +        RC->contains(cur->preference) &&
      +        noEarlyClobberConflict(cur, cur->preference)) {
             DOUT << "\t\tassigned the preferred register: "
                  << tri_->getName(cur->preference) << "\n";
             return cur->preference;
      
      Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=56384&r1=56383&r2=56384&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Fri Sep 19 21:03:04 2008
      @@ -1206,6 +1206,14 @@
         DOUT << " and "; DstInt.print(DOUT, tri_);
         DOUT << ": ";
       
      +  // If one interval is earlyclobber and the other is overlaps-earlyclobber,
      +  // we cannot coalesce them.
      +  if ((SrcInt.isEarlyClobber && DstInt.overlapsEarlyClobber) ||
      +      (DstInt.isEarlyClobber && SrcInt.overlapsEarlyClobber)) {
      +    DOUT << "\t\tCannot join due to earlyclobber.";
      +    return false;
      +  }
      +
         // Check if it is necessary to propagate "isDead" property.
         if (!isExtSubReg && !isInsSubReg) {
           MachineOperand *mopd = CopyMI->findRegisterDefOperand(DstReg, false);
      @@ -1366,6 +1374,10 @@
         if (TargetRegisterInfo::isVirtualRegister(DstReg))
           RemoveUnnecessaryKills(DstReg, *ResDstInt);
       
      +  // Merge the earlyclobber bits.
      +  ResDstInt->isEarlyClobber |= ResSrcInt->isEarlyClobber;
      +  ResDstInt->overlapsEarlyClobber |= ResSrcInt->overlapsEarlyClobber;
      +
         if (isInsSubReg)
           // Avoid:
           // r1024 = op
      
      
      
      
      From dalej at apple.com  Fri Sep 19 21:10:47 2008
      From: dalej at apple.com (Dale Johannesen)
      Date: Fri, 19 Sep 2008 19:10:47 -0700
      Subject: [llvm-commits] [llvm] r56326 - in /llvm/trunk:
      	include/llvm/CodeGen/LiveInterval.h
      	include/llvm/CodeGen/LiveIntervalAnalysis.h	lib/CodeGen/LiveInterval.cpp
      	lib/CodeGen/LiveIntervalAnalysis.cpp	lib/CodeGen/RegAllocLinearScan.cpp
      In-Reply-To: <0C211098-EF53-4086-AD50-6CCD90BF9557@apple.com>
      References: <200809190102.m8J12ZW2019167@zion.cs.uiuc.edu>
      	<51666910-CAA2-47A5-9F26-809138EE0E5F@apple.com>
      	<10574389-E3FC-4024-AD0D-A462B01F39B4@apple.com>
      	<5C7E7977-A85C-44DB-8D61-5A8AF02E9C6A@apple.com>
      	<21171FE7-D099-4281-B86A-F0944DD07C4B@apple.com>
      	<0C211098-EF53-4086-AD50-6CCD90BF9557@apple.com>
      Message-ID: <642B525C-90FD-401C-B32A-484BE73A6AE6@apple.com>
      
      
      On Sep 19, 2008, at 6:18 PM, Evan Cheng wrote:
      >>>> On Sep 19, 2008, at 10:48 AMPDT, Evan Cheng wrote:
      >>>>>>
      >>>>>> float weight;        // weight of this interval
      >>>>>> +    bool isEarlyClobber;
      >>>>>> +    bool overlapsEarlyClobber;
      >>>>>
      >>>>>
      > Ok. Although please use bitfield to pack them in order to save memory.
      
      I considered that.  Bitfields are slower, and do not save any memory...
      
      > Actually, we can probably pack "preference" field in as well. So 3
      > bits for isEarlyClobber, overlapsEarlyClobber, and hasPreference. Use
      > the rest of a uint32_t for "preferred register".
      
      ...unless you do this as well.  Would you be OK with char/char/short?   
      That is faster.  Anybody out there got more than 64K hard registers?
      
      
      
      
      
      
      From clattner at apple.com  Fri Sep 19 22:42:31 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Fri, 19 Sep 2008 20:42:31 -0700
      Subject: [llvm-commits] [llvm] r56326 - in /llvm/trunk:
      	include/llvm/CodeGen/LiveInterval.h
      	include/llvm/CodeGen/LiveIntervalAnalysis.h	lib/CodeGen/LiveInterval.cpp
      	lib/CodeGen/LiveIntervalAnalysis.cpp	lib/CodeGen/RegAllocLinearScan.cpp
      In-Reply-To: <642B525C-90FD-401C-B32A-484BE73A6AE6@apple.com>
      References: <200809190102.m8J12ZW2019167@zion.cs.uiuc.edu>
      	<51666910-CAA2-47A5-9F26-809138EE0E5F@apple.com>
      	<10574389-E3FC-4024-AD0D-A462B01F39B4@apple.com>
      	<5C7E7977-A85C-44DB-8D61-5A8AF02E9C6A@apple.com>
      	<21171FE7-D099-4281-B86A-F0944DD07C4B@apple.com>
      	<0C211098-EF53-4086-AD50-6CCD90BF9557@apple.com>
      	<642B525C-90FD-401C-B32A-484BE73A6AE6@apple.com>
      Message-ID: <731EFAA5-164A-4985-B31C-FF023E0670A0@apple.com>
      
      
      On Sep 19, 2008, at 7:10 PM, Dale Johannesen wrote:
      
      >
      > On Sep 19, 2008, at 6:18 PM, Evan Cheng wrote:
      >>>>> On Sep 19, 2008, at 10:48 AMPDT, Evan Cheng wrote:
      >>>>>>>
      >>>>>>> float weight;        // weight of this interval
      >>>>>>> +    bool isEarlyClobber;
      >>>>>>> +    bool overlapsEarlyClobber;
      >>>>>>
      >>>>>>
      >> Ok. Although please use bitfield to pack them in order to save  
      >> memory.
      >
      > I considered that.  Bitfields are slower, and do not save any  
      > memory...
      >
      >> Actually, we can probably pack "preference" field in as well. So 3
      >> bits for isEarlyClobber, overlapsEarlyClobber, and hasPreference. Use
      >> the rest of a uint32_t for "preferred register".
      >
      > ...unless you do this as well.  Would you be OK with char/char/short?
      > That is faster.  Anybody out there got more than 64K hard registers?
      
      That seems reasonable to me, but please put a comment by them  
      indicating why they have those types,
      
      -Chris
      
      
      From isanbard at gmail.com  Sat Sep 20 04:58:11 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Sat, 20 Sep 2008 09:58:11 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56386 -
      	/llvm-gcc-4.2/trunk/gcc/config/darwin.c
      Message-ID: <200809200958.m8K9wBwW010112@zion.cs.uiuc.edu>
      
      Author: void
      Date: Sat Sep 20 04:58:10 2008
      New Revision: 56386
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56386&view=rev
      Log:
      Fix a segfault. If we had a version string like "i386-apple-darwin9.5.0", then
      this would return a non-zero value, but wouldn't fill the "new_triple" variable
      which is then used to make a string. I don't know if this fix is 100% correct.
      That is, I don't know if it catches all cases.
      
      Modified:
          llvm-gcc-4.2/trunk/gcc/config/darwin.c
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=56386&r1=56385&r2=56386&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Sat Sep 20 04:58:10 2008
      @@ -2672,19 +2672,21 @@
       }
       /* APPLE LOCAL end radar 4985544 */
       
      -/* APPLE LOCAL begin radar 6230142 */
      +/* LLVM LOCAL begin radar 6230142 */
       unsigned darwin_llvm_override_target_version(const char *triple, char **new_triple) {
         int len = 0, version = 0;
       
         if (!darwin_macosx_version_min)
           return 0;
         
      -  /* Triple string is expected to look something like 'i386-apple-darwin?'. */
      +  /* Triple string is expected to look something like 'i386-apple-darwin?' or
      +     'i386-apple-darwin9.5.0'  */
         len = strlen (triple);
         if (len < 7)
           return 0;
      -  if (strncmp (&triple[len - 7], "darwin", 6) != 0)
      -    return (char *)triple;
      +  if ((strncmp (&triple[len - 7], "darwin", 6) != 0) &&
      +      (len < 11 || strncmp (&triple[len - 11], "darwin", 6) != 0))
      +    return 0;
       
         /* llvm-gcc doesn't support pre-10.0 systems. */
         version = strverscmp (darwin_macosx_version_min, "10.0");
      @@ -2709,5 +2711,5 @@
         
         return 1;
       }
      -/* APPLE LOCAL end radar 6230142 */
      +/* LLVM LOCAL end radar 6230142 */
       #include "gt-darwin.h"
      
      
      
      
      From baldrick at free.fr  Sat Sep 20 11:45:59 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Sat, 20 Sep 2008 16:45:59 -0000
      Subject: [llvm-commits] [llvm] r56387 -
      	/llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp
      Message-ID: <200809201645.m8KGjx9l024047@zion.cs.uiuc.edu>
      
      Author: baldrick
      Date: Sat Sep 20 11:45:58 2008
      New Revision: 56387
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56387&view=rev
      Log:
      Implement review feedback from Devang: make use
      of mayReadFromMemory and mayWriteToMemory.
      
      Modified:
          llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp
      
      Modified: llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp?rev=56387&r1=56386&r2=56387&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp (original)
      +++ llvm/trunk/lib/Transforms/IPO/AddReadAttrs.cpp Sat Sep 20 11:45:58 2008
      @@ -54,7 +54,7 @@
           Function *F = SCC[i]->getFunction();
       
           if (F == 0)
      -      // May write memory.
      +      // External node - may write memory.
             return false;
       
           if (F->doesNotAccessMemory())
      @@ -72,34 +72,19 @@
             continue;
           }
       
      -    // Scan the function body for explicit loads and stores, or calls to
      -    // functions that may read or write memory.
      +    // Scan the function body for instructions that may read or write memory.
           for (inst_iterator II = inst_begin(F), E = inst_end(F); II != E; ++II) {
      -      Instruction *I = &*II;
      -      if (LoadInst *LI = dyn_cast(I)) {
      -        if (LI->isVolatile())
      -          // Volatile loads may have side-effects, so treat them as writing
      -          // memory.
      -          return false;
      -        ReadsMemory = true;
      -      } else if (isa(I) || isa(I) || isa(I)) {
      -        // Writes memory.
      -        return false;
      -      } else if (isa(I) || isa(I)) {
      -        CallSite CS(I);
      +      CallSite CS = CallSite::get(&*II);
      +
      +      // Ignore calls to functions in the same SCC.
      +      if (CS.getInstruction() &&
      +          std::find(SCC.begin(), SCC.end(), CG[CS.getCalledFunction()]) !=
      +          SCC.end())
      +        continue;
       
      -        if (std::find(SCC.begin(), SCC.end(), CG[CS.getCalledFunction()]) !=
      -            SCC.end())
      -          // The callee is inside our current SCC - ignore it.
      -          continue;
      -
      -        if (!CS.onlyReadsMemory())
      -          // May write memory.
      -          return false;
      -
      -        if (!CS.doesNotAccessMemory())
      -          ReadsMemory = true;
      -      }
      +      if (II->mayWriteToMemory())
      +        return false;
      +      ReadsMemory |= II->mayReadFromMemory();
           }
         }
       
      
      
      
      
      From baldrick at free.fr  Sat Sep 20 11:52:00 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Sat, 20 Sep 2008 18:52:00 +0200
      Subject: [llvm-commits] [llvm] r56341 - in /llvm/trunk: include/llvm/
      	include/llvm/Transforms/ lib/Transforms/IPO/
      	test/Analysis/GlobalsModRef/ test/Transforms/AddReadAttrs/
      In-Reply-To: <6AD051DB-59D0-4B0B-A429-F1DB3FA25A36@apple.com>
      References: <200809190817.m8J8H6I8010267@zion.cs.uiuc.edu>
      	<6AD051DB-59D0-4B0B-A429-F1DB3FA25A36@apple.com>
      Message-ID: <200809201852.01712.baldrick@free.fr>
      
      Hi Devang,
      
      > > +    if (F == 0)
      > > +      // May write memory.
      > > +      return false;
      > 
      > ??
      
      this occurs for the external nodes, which represent
      an unknown external function.  I've added a comment.
      
      > > +    if (F->isDeclaration() || F->hasWeakLinkage()) {
      > 
      > What about CommonLinkage, GhostLinkage etc..?
      
      I was following the logic in resolveAliasedGlobal (which
      shouldn't resolve aliases if they are not definitive, i.e.
      may be overridden).  Perhaps Anton can comment.  Anyway,
      hopefully PR2742 will take care of all such problems.
      
      > How about using mayReadMemory() and mayWriteMemory() here ?
      
      Good idea, done!
      
      Thanks for the review,
      
      Duncan.
      
      
      From dalej at apple.com  Sat Sep 20 12:45:21 2008
      From: dalej at apple.com (Dale Johannesen)
      Date: Sat, 20 Sep 2008 17:45:21 -0000
      Subject: [llvm-commits] [llvm] r56388 -
      	/llvm/trunk/include/llvm/CodeGen/LiveInterval.h
      Message-ID: <200809201745.m8KHjM7Z025675@zion.cs.uiuc.edu>
      
      Author: johannes
      Date: Sat Sep 20 12:45:21 2008
      New Revision: 56388
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56388&view=rev
      Log:
      Shorten and rearrange data fields to save a word of memory.
      Per review feedback.
      
      
      Modified:
          llvm/trunk/include/llvm/CodeGen/LiveInterval.h
      
      Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=56388&r1=56387&r2=56388&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Sat Sep 20 12:45:21 2008
      @@ -103,19 +103,20 @@
       
           unsigned reg;        // the register or stack slot of this interval
                                // if the top bits is set, it represents a stack slot.
      -    unsigned preference; // preferred register to allocate for this interval
           float weight;        // weight of this interval
      -    bool isEarlyClobber;
      -    bool overlapsEarlyClobber;
      +    // The next 3 fields pack into a single word (on most hosts).
      +    // Logically the first two could be bitfields, but that's slower.
      +    bool isEarlyClobber;  // marked earlyclobber in some asm
      +    bool overlapsEarlyClobber; // input to asm that has an earlyclobber
      +    unsigned short preference; // preferred register for this interval
           Ranges ranges;       // the ranges in which this register is live
           VNInfoList valnos;   // value#'s
       
         public:
           LiveInterval(unsigned Reg, float Weight, bool IsSS = false, 
                        bool IsEarlyClobber = false, bool OverlapsEarlyClobber = false)
      -      : reg(Reg), preference(0), weight(Weight), 
      -        isEarlyClobber(IsEarlyClobber), 
      -        overlapsEarlyClobber(OverlapsEarlyClobber) {
      +      : reg(Reg), weight(Weight), isEarlyClobber(IsEarlyClobber), 
      +        overlapsEarlyClobber(OverlapsEarlyClobber), preference(0)  {
             if (IsSS)
               reg = reg | (1U << (sizeof(unsigned)*8-1));
           }
      
      
      
      
      From asl at math.spbu.ru  Sat Sep 20 13:00:38 2008
      From: asl at math.spbu.ru (Anton Korobeynikov)
      Date: Sat, 20 Sep 2008 22:00:38 +0400
      Subject: [llvm-commits] [llvm] r56341 - in /llvm/trunk: include/llvm/
      	include/llvm/Transforms/ lib/Transforms/IPO/
      	test/Analysis/GlobalsModRef/ test/Transforms/AddReadAttrs/
      In-Reply-To: <200809201852.01712.baldrick@free.fr>
      References: <200809190817.m8J8H6I8010267@zion.cs.uiuc.edu>
      	<6AD051DB-59D0-4B0B-A429-F1DB3FA25A36@apple.com>
      	<200809201852.01712.baldrick@free.fr>
      Message-ID: 
      
      > I was following the logic in resolveAliasedGlobal (which
      > shouldn't resolve aliases if they are not definitive, i.e.
      > may be overridden).  Perhaps Anton can comment.  Anyway,
      > hopefully PR2742 will take care of all such problems.
      If this applies only to alias - then check for weak linkage only is
      correct: aliases can have only external, weak or internal linkage.
      resolveAliasedGlobal() walks through the alising chain until it will
      find weak alias (or non-alias).
      
      -- 
      With best regards, Anton Korobeynikov
      Faculty of Mathematics and Mechanics, Saint Petersburg State University
      
      
      From cedric.venet at laposte.net  Sat Sep 20 13:02:18 2008
      From: cedric.venet at laposte.net (Cedric Venet)
      Date: Sat, 20 Sep 2008 18:02:18 -0000
      Subject: [llvm-commits] [llvm] r56389 - in /llvm/trunk:
       include/llvm/CodeGen/MachineBasicBlock.h
       include/llvm/CodeGen/MachineFunction.h include/llvm/CodeGen/SelectionDAG.h
       include/llvm/CodeGen/SelectionDAGNodes.h win32/CodeGen/CodeGen.vcproj
       win32/Transforms/Transforms.vcproj
      Message-ID: <200809201802.m8KI2Inv026179@zion.cs.uiuc.edu>
      
      Author: venet
      Date: Sat Sep 20 13:02:18 2008
      New Revision: 56389
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56389&view=rev
      Log:
      Update VS projects.
      Change some class to struct for coherency.
      
      Modified:
          llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
          llvm/trunk/include/llvm/CodeGen/MachineFunction.h
          llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
          llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
          llvm/trunk/win32/CodeGen/CodeGen.vcproj
          llvm/trunk/win32/Transforms/Transforms.vcproj
      
      Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=56389&r1=56388&r2=56389&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Sat Sep 20 13:02:18 2008
      @@ -24,7 +24,8 @@
       class MachineFunction;
       
       template <>
      -class ilist_traits : public ilist_default_traits {
      +struct ilist_traits : public ilist_default_traits {
      +private:
         mutable MachineInstr Sentinel;
       
         // this is only set by the MachineBasicBlock owning the LiveList
      @@ -70,7 +71,7 @@
         bool IsLandingPad;
       
         // Intrusive list support
      -  friend class ilist_sentinel_traits;
      +  friend struct ilist_sentinel_traits;
         MachineBasicBlock() {}
       
         explicit MachineBasicBlock(MachineFunction &mf, const BasicBlock *bb);
      
      Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=56389&r1=56388&r2=56389&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Sat Sep 20 13:02:18 2008
      @@ -34,7 +34,7 @@
       class MachineJumpTableInfo;
       
       template <>
      -class ilist_traits
      +struct ilist_traits
           : public ilist_default_traits {
         mutable MachineBasicBlock Sentinel;
       public:
      
      Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=56389&r1=56388&r2=56389&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Sat Sep 20 13:02:18 2008
      @@ -36,7 +36,8 @@
       class MachineConstantPoolValue;
       class FunctionLoweringInfo;
       
      -template<> class ilist_traits : public ilist_default_traits {
      +template<> struct ilist_traits : public ilist_default_traits {
      +private:
         mutable SDNode Sentinel;
       public:
         ilist_traits() : Sentinel(ISD::DELETED_NODE, SDVTList()) {}
      
      Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=56389&r1=56388&r2=56389&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Sat Sep 20 13:02:18 2008
      @@ -43,7 +43,7 @@
       class CompileUnitDesc;
       template  struct DenseMapInfo;
       template  struct simplify_type;
      -template  class ilist_traits;
      +template  struct ilist_traits;
       
       /// SDVTList - This represents a list of ValueType's that has been intern'd by
       /// a SelectionDAG.  Instances of this simple value class are returned by
      @@ -1315,7 +1315,7 @@
       
       protected:
         friend class SelectionDAG;
      -  friend class ilist_traits;
      +  friend struct ilist_traits;
         
         /// getValueTypeList - Return a pointer to the specified value type.
         ///
      
      Modified: llvm/trunk/win32/CodeGen/CodeGen.vcproj
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/CodeGen/CodeGen.vcproj?rev=56389&r1=56388&r2=56389&view=diff
      
      ==============================================================================
      --- llvm/trunk/win32/CodeGen/CodeGen.vcproj (original)
      +++ llvm/trunk/win32/CodeGen/CodeGen.vcproj Sat Sep 20 13:02:18 2008
      @@ -1,7 +1,7 @@
       
       
       			
       			
      +			
      +			
       			
      @@ -540,6 +544,10 @@
       					>
       				
       				
      +				
      +				
       				
      
      Modified: llvm/trunk/win32/Transforms/Transforms.vcproj
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Transforms/Transforms.vcproj?rev=56389&r1=56388&r2=56389&view=diff
      
      ==============================================================================
      --- llvm/trunk/win32/Transforms/Transforms.vcproj (original)
      +++ llvm/trunk/win32/Transforms/Transforms.vcproj Sat Sep 20 13:02:18 2008
      @@ -1,7 +1,7 @@
       
       
       				
      +				
      +				
       				
      
      
      
      
      From sabre at nondot.org  Sat Sep 20 14:17:54 2008
      From: sabre at nondot.org (Chris Lattner)
      Date: Sat, 20 Sep 2008 19:17:54 -0000
      Subject: [llvm-commits] [llvm] r56391 -
      	/llvm/trunk/lib/Target/X86/README-SSE.txt
      Message-ID: <200809201917.m8KJHtps028913@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Sat Sep 20 14:17:53 2008
      New Revision: 56391
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56391&view=rev
      Log:
      add a note
      
      Modified:
          llvm/trunk/lib/Target/X86/README-SSE.txt
      
      Modified: llvm/trunk/lib/Target/X86/README-SSE.txt
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-SSE.txt?rev=56391&r1=56390&r2=56391&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/README-SSE.txt (original)
      +++ llvm/trunk/lib/Target/X86/README-SSE.txt Sat Sep 20 14:17:53 2008
      @@ -17,7 +17,7 @@
       
       //===---------------------------------------------------------------------===//
       
      -Think about doing i64 math in SSE regs.
      +Think about doing i64 math in SSE regs on x86-32.
       
       //===---------------------------------------------------------------------===//
       
      @@ -876,3 +876,34 @@
       subsd		%xmm1,		%xmm0	// x in double precision
       cvtsd2ss	%xmm0,		%xmm0	// x in single precision
       
      +//===---------------------------------------------------------------------===//
      +rdar://5907648
      +
      +This function:
      +
      +float foo(unsigned char x) {
      +  return x;
      +}
      +
      +compiles to (x86-32):
      +
      +define float @foo(i8 zeroext  %x) nounwind  {
      +	%tmp12 = uitofp i8 %x to float		;  [#uses=1]
      +	ret float %tmp12
      +}
      +
      +compiles to:
      +
      +_foo:
      +	subl	$4, %esp
      +	movzbl	8(%esp), %eax
      +	cvtsi2ss	%eax, %xmm0
      +	movss	%xmm0, (%esp)
      +	flds	(%esp)
      +	addl	$4, %esp
      +	ret
      +
      +We should be able to use:
      +  cvtsi2ss 8($esp), %xmm0
      +since we know the stack slot is already zext'd.
      +
      
      
      
      
      From isanbard at gmail.com  Sat Sep 20 18:08:06 2008
      From: isanbard at gmail.com (Bill Wendling)
      Date: Sat, 20 Sep 2008 23:08:06 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r56392 -
      	/llvm-gcc-4.2/trunk/gcc/config/darwin.c
      Message-ID: <200809202308.m8KN86Cf003630@zion.cs.uiuc.edu>
      
      Author: void
      Date: Sat Sep 20 18:08:03 2008
      New Revision: 56392
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56392&view=rev
      Log:
      3AM hacking leads to icky code
      
      Modified:
          llvm-gcc-4.2/trunk/gcc/config/darwin.c
      
      Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=56392&r1=56391&r2=56392&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original)
      +++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Sat Sep 20 18:08:03 2008
      @@ -2684,8 +2684,8 @@
         len = strlen (triple);
         if (len < 7)
           return 0;
      -  if ((strncmp (&triple[len - 7], "darwin", 6) != 0) &&
      -      (len < 11 || strncmp (&triple[len - 11], "darwin", 6) != 0))
      +  if (strncmp (&triple[len - 7], "darwin", 6) != 0 ||
      +      (len > 11 && strncmp (&triple[len - 11], "darwin", 6) != 0))
           return 0;
       
         /* llvm-gcc doesn't support pre-10.0 systems. */
      
      
      
      
      From baldrick at free.fr  Sun Sep 21 04:10:59 2008
      From: baldrick at free.fr (Duncan Sands)
      Date: Sun, 21 Sep 2008 11:10:59 +0200
      Subject: [llvm-commits] [llvm] r56341 - in /llvm/trunk: include/llvm/
      	include/llvm/Transforms/ lib/Transforms/IPO/
      	test/Analysis/GlobalsModRef/ test/Transforms/AddReadAttrs/
      In-Reply-To: 
      References: <200809190817.m8J8H6I8010267@zion.cs.uiuc.edu>
      	<200809201852.01712.baldrick@free.fr>
      	
      Message-ID: <200809211111.00045.baldrick@free.fr>
      
      On Saturday 20 September 2008 20:00:38 Anton Korobeynikov wrote:
      > > I was following the logic in resolveAliasedGlobal (which
      > > shouldn't resolve aliases if they are not definitive, i.e.
      > > may be overridden).  Perhaps Anton can comment.  Anyway,
      > > hopefully PR2742 will take care of all such problems.
      > If this applies only to alias - then check for weak linkage only is
      > correct: aliases can have only external, weak or internal linkage.
      > resolveAliasedGlobal() walks through the alising chain until it will
      > find weak alias (or non-alias).
      
      I see.  For functions, which linkage types mean that the body
      (definition) cannot be relied upon as being correct?  I'll add
      a method (isDefinitive?) for this.
      
      Thanks,
      
      Duncan.
      
      
      From asl at math.spbu.ru  Sun Sep 21 08:14:11 2008
      From: asl at math.spbu.ru (Anton Korobeynikov)
      Date: Sun, 21 Sep 2008 17:14:11 +0400
      Subject: [llvm-commits] [llvm] r56341 - in /llvm/trunk: include/llvm/
      	include/llvm/Transforms/ lib/Transforms/IPO/
      	test/Analysis/GlobalsModRef/ test/Transforms/AddReadAttrs/
      In-Reply-To: <200809211111.00045.baldrick@free.fr>
      References: <200809190817.m8J8H6I8010267@zion.cs.uiuc.edu>
      	<200809201852.01712.baldrick@free.fr>
      	
      	<200809211111.00045.baldrick@free.fr>
      Message-ID: 
      
      Hi, Duncan
      
      > I see.  For functions, which linkage types mean that the body
      > (definition) cannot be relied upon as being correct?  I'll add
      > a method (isDefinitive?) for this.
      AFAIR, isWeakForLinker() checks exactly for this stuff (weak +
      linkonce + common linkages).
      
      -- 
      With best regards, Anton Korobeynikov
      Faculty of Mathematics and Mechanics, Saint Petersburg State University
      
      
      From nicholas at mxc.ca  Sun Sep 21 09:47:27 2008
      From: nicholas at mxc.ca (Nick Lewycky)
      Date: Sun, 21 Sep 2008 07:47:27 -0700
      Subject: [llvm-commits] [llvm] r56341 - in /llvm/trunk: include/llvm/
       include/llvm/Transforms/ lib/Transforms/IPO/	test/Analysis/GlobalsModRef/
       test/Transforms/AddReadAttrs/
      In-Reply-To: 
      References: <200809190817.m8J8H6I8010267@zion.cs.uiuc.edu>	<200809201852.01712.baldrick@free.fr>		<200809211111.00045.baldrick@free.fr>
      	
      Message-ID: <48D65E7F.9020702@mxc.ca>
      
      Anton Korobeynikov wrote:
      > Hi, Duncan
      > 
      >> I see.  For functions, which linkage types mean that the body
      >> (definition) cannot be relied upon as being correct?  I'll add
      >> a method (isDefinitive?) for this.
      > AFAIR, isWeakForLinker() checks exactly for this stuff (weak +
      > linkonce + common linkages).
      
      I once asked what "isWeakForLinker" actually meant but didn't get a 
      response. I find "isDefinitive" a much better name, if that's what it's 
      actually doing!
      
      Nick
      
      
      
      From anton at korobeynikov.info  Sun Sep 21 09:56:13 2008
      From: anton at korobeynikov.info (Anton Korobeynikov)
      Date: Sun, 21 Sep 2008 18:56:13 +0400
      Subject: [llvm-commits] [llvm] r56341 - in /llvm/trunk: include/llvm/
      	include/llvm/Transforms/ lib/Transforms/IPO/
      	test/Analysis/GlobalsModRef/ test/Transforms/AddReadAttrs/
      In-Reply-To: <48D65E7F.9020702@mxc.ca>
      References: <200809190817.m8J8H6I8010267@zion.cs.uiuc.edu>
      	<200809201852.01712.baldrick@free.fr>
      	
      	<200809211111.00045.baldrick@free.fr>
      	
      	<48D65E7F.9020702@mxc.ca>
      Message-ID: 
      
      Hi, Nick
      
      > I once asked what "isWeakForLinker" actually meant but didn't get a
      > response.
      Sorry, maybe I didn't saw this e-mail. Actually, it was introduced,
      because in most places we checked for all 3 kinds of 'non-strong'
      linkage at once. And I thought, that having one helper will be better.
      
      Name was selected, because linker actually treats all such symbols as weak.
      
      -- 
      With best regards, Anton Korobeynikov
      Faculty of Mathematics and Mechanics, Saint Petersburg State University
      
      
      From clattner at apple.com  Sun Sep 21 13:28:59 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 11:28:59 -0700
      Subject: [llvm-commits] [llvm] r56188 - in /llvm/trunk:
      	lib/Analysis/IPA/GlobalsModRef.cpp
      	test/Analysis/GlobalsModRef/2008-09-13-VolatileRead.ll
      In-Reply-To: <200809131245.m8DCjo8D013095@zion.cs.uiuc.edu>
      References: <200809131245.m8DCjo8D013095@zion.cs.uiuc.edu>
      Message-ID: <28326511-DAD0-424A-BB0D-492BA8731268@apple.com>
      
      
      On Sep 13, 2008, at 5:45 AM, Duncan Sands wrote:
      
      > Author: baldrick
      > Date: Sat Sep 13 07:45:50 2008
      > New Revision: 56188
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=56188&view=rev
      > Log:
      > Fix PR2792: treat volatile loads as writing memory somewhere.
      > Treat stores as reading memory, just to play safe.
      
      FWIW, I agree that this is the right solution.  Thanks Duncan!
      
      -Chris
      
      
      
      From sabre at nondot.org  Sun Sep 21 13:38:32 2008
      From: sabre at nondot.org (Chris Lattner)
      Date: Sun, 21 Sep 2008 18:38:32 -0000
      Subject: [llvm-commits] [llvm] r56399 -
      	/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
      Message-ID: <200809211838.m8LIcWYC008756@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Sun Sep 21 13:38:31 2008
      New Revision: 56399
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56399&view=rev
      Log:
      don't print GlobalAddressSDNode's with an offset of zero as "foo0".
      
      Modified:
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=56399&r1=56398&r2=56399&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Sun Sep 21 13:38:31 2008
      @@ -126,12 +126,13 @@
           Op += ": " + ftostr(CSDN->getValueAPF());
         } else if (const GlobalAddressSDNode *GADN =
                    dyn_cast(Node)) {
      -    int offset = GADN->getOffset();
           Op += ": " + GADN->getGlobal()->getName();
      -    if (offset > 0)
      -      Op += "+" + itostr(offset);
      -    else
      -      Op += itostr(offset);
      +    if (int Offset = GADN->getOffset()) {
      +      if (Offset > 0)
      +        Op += "+" + itostr(Offset);
      +      else
      +        Op += itostr(Offset);
      +    }
         } else if (const FrameIndexSDNode *FIDN = dyn_cast(Node)) {
           Op += " " + itostr(FIDN->getIndex());
         } else if (const JumpTableSDNode *JTDN = dyn_cast(Node)) {
      
      
      
      
      From clattner at apple.com  Sun Sep 21 13:54:15 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 11:54:15 -0700
      Subject: [llvm-commits] [llvm] r55753 - in /llvm/trunk: include/llvm/
      	include/llvm/CodeGen/ lib/CodeGen/ lib/CodeGen/SelectionDAG/
      	lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/
      	lib/Target/IA64/ lib/Target/PowerPC/ lib/Target/Sparc/
      	lib/Target/X86/
      In-Reply-To: <200809040047.m840lEHv021608@zion.cs.uiuc.edu>
      References: <200809040047.m840lEHv021608@zion.cs.uiuc.edu>
      Message-ID: 
      
      On Sep 3, 2008, at 5:47 PM, Dale Johannesen wrote:
      > URL: http://llvm.org/viewvc/llvm-project?rev=55753&view=rev
      > Log:
      > Add intrinsics for log, log2, log10, exp, exp2.
      > No functional change (and no FE change to generate them).
      
      Hi Dale,
      
      Thanks for working on this.  Please factor this code a little bit:
      
      > +++ llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp Wed Sep  3 19:47:13  
      > 2008
      > @@ -160,6 +160,81 @@
      >                                I->arg_begin()->getType());
      >         }
      >         break;
      > +      case Intrinsic::log:
      > +        switch((int)I->arg_begin()->getType()->getTypeID()) {
      > +        case Type::FloatTyID:
      > +          EnsureFunctionExists(M, "logf", I->arg_begin(), I- 
      > >arg_end(),
      > +                               Type::FloatTy);
      > +        case Type::DoubleTyID:
      > +          EnsureFunctionExists(M, "log", I->arg_begin(), I- 
      > >arg_end(),
      > +                               Type::DoubleTy);
      > +        case Type::X86_FP80TyID:
      > +        case Type::FP128TyID:
      > +        case Type::PPC_FP128TyID:
      > +          EnsureFunctionExists(M, "logl", I->arg_begin(), I- 
      > >arg_end(),
      > +                               I->arg_begin()->getType());
      > +        }
      > +        break;
      > +      case Intrinsic::log2:
      > +        switch((int)I->arg_begin()->getType()->getTypeID()) {
      > +        case Type::FloatTyID:
      > +          EnsureFunctionExists(M, "log2f", I->arg_begin(), I- 
      > >arg_end(),
      > +                               Type::FloatTy);
      > +        case Type::DoubleTyID:
      > +          EnsureFunctionExists(M, "log2", I->arg_begin(), I- 
      > >arg_end(),
      > +                               Type::DoubleTy);
      > +        case Type::X86_FP80TyID:
      > +        case Type::FP128TyID:
      > +        case Type::PPC_FP128TyID:
      > +          EnsureFunctionExists(M, "log2l", I->arg_begin(), I- 
      > >arg_end(),
      > +                               I->arg_begin()->getType());
      > +        }
      > +        break;
      
      this pattern is repeated several times.  Please introduce a new  
      function, and something like:
      
      case Intrinsic::log:
         EnsureFPFunctionExists(I->arg_begin()->getType(), "logf", "log",  
      "logl");
         break;
      case Intrinsic::log2:
         EnsureFPFunctionExists(I->arg_begin()->getType(), "log2f", "log2",  
      "log2l");
         break;
      etc
      
      > @@ -857,6 +932,144 @@
      > +  case Intrinsic::log: {
      > +    static Constant *logfFCache = 0;
      > +    static Constant *logFCache = 0;
      > +    static Constant *logLDCache = 0;
      > +    switch (CI->getOperand(1)->getType()->getTypeID()) {
      > +    default: assert(0 && "Invalid type in log"); abort();
      > +    case Type::FloatTyID:
      > +      ReplaceCallWith("logf", CI, CI->op_begin()+1, CI->op_end(),
      > +                    Type::FloatTy, logfFCache);
      > +      break;
      > +    case Type::DoubleTyID:
      > +      ReplaceCallWith("log", CI, CI->op_begin()+1, CI->op_end(),
      > +                    Type::DoubleTy, logFCache);
      > +      break;
      > +    case Type::X86_FP80TyID:
      > +    case Type::FP128TyID:
      > +    case Type::PPC_FP128TyID:
      > +      ReplaceCallWith("logl", CI, CI->op_begin()+1, CI->op_end(),
      > +                    CI->getOperand(1)->getType(), logLDCache);
      > +      break;
      > +    }
      > +    break;
      > +  }
      
      Likewise here, this codegen code can be factored to call a helper.
      
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
      > +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Sep  3  
      > 19:47:13 2008
      > @@ -243,6 +243,16 @@
      >   setOperationAction(ISD::FCOS     , MVT::f64, Expand);
      >   setOperationAction(ISD::FREM     , MVT::f64, Expand);
      >   setOperationAction(ISD::FREM     , MVT::f32, Expand);
      > +  setOperationAction(ISD::FLOG     , MVT::f64, Expand);
      > +  setOperationAction(ISD::FLOG     , MVT::f32, Expand);
      > +  setOperationAction(ISD::FLOG2    , MVT::f64, Expand);
      > +  setOperationAction(ISD::FLOG2    , MVT::f32, Expand);
      > +  setOperationAction(ISD::FLOG10   , MVT::f64, Expand);
      > +  setOperationAction(ISD::FLOG10   , MVT::f32, Expand);
      > +  setOperationAction(ISD::FEXP     , MVT::f64, Expand);
      > +  setOperationAction(ISD::FEXP     , MVT::f32, Expand);
      > +  setOperationAction(ISD::FEXP2    , MVT::f64, Expand);
      > +  setOperationAction(ISD::FEXP2    , MVT::f32, Expand);
      
      Instead of doing this in every target, why not make the default be  
      Expand, and put this once in TargetLowering::TargetLowering, like we  
      do for ISD::TRAP and ConstantFP etc.  This lets the target get a sane  
      default behavior and override it in the derived constructor if they  
      really want to do something funny.
      
      >
      
      -Chris
      
      
      From clattner at apple.com  Sun Sep 21 13:56:45 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 11:56:45 -0700
      Subject: [llvm-commits] [llvm] r55973 - in /llvm/trunk:
      	include/llvm/Target/TargetAsmInfo.h
      	lib/CodeGen/AsmPrinter/AsmPrinter.cpp
      	lib/Target/ARM/ARMTargetAsmInfo.cpp
      	lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp
      	lib/Target/X86/X86TargetAsmInfo.cpp
      In-Reply-To: <200809090121.m891LMQL010215@zion.cs.uiuc.edu>
      References: <200809090121.m891LMQL010215@zion.cs.uiuc.edu>
      Message-ID: <0A3D4CAB-0019-4D9C-8A88-E944CFCA9925@apple.com>
      
      On Sep 8, 2008, at 6:21 PM, Dale Johannesen wrote:
      > URL: http://llvm.org/viewvc/llvm-project?rev=55973&view=rev
      > Log:
      > Fix logic for not emitting no-dead-strip for some
      > objects in llvm.used (thanks Anton).  Makes visible
      > the magic 'l' prefix for symbols on Darwin which are
      > to be passed through the assembler, then removed at
      > linktime (previously all references to this had been
      > hidden in the ObjC FE code, oh well).
      
      Ok
      
      > +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Sep  8  
      > 20:21:22 2008
      > @@ -462,7 +464,17 @@
      >
      >   for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
      >     const GlobalValue *GV = findGlobalValue(InitList->getOperand(i));
      > -    if (GV && (!GV->hasInternalLinkage() || isa(GV))) {
      > +    if (GV) {
      > +      if (GV->hasInternalLinkage() && !isa(GV) &&
      > +          ((strlen(TAI->getPrivateGlobalPrefix()) != 0 &&
      > +            Mang->getValueName(GV)
      > +              .substr(0,strlen(TAI->getPrivateGlobalPrefix())) ==
      > +              TAI->getPrivateGlobalPrefix()) ||
      > +           (strlen(TAI->getLessPrivateGlobalPrefix()) != 0 &&
      > +            Mang->getValueName(GV)
      > +              .substr(0,strlen(TAI->getLessPrivateGlobalPrefix())) ==
      > +              TAI->getLessPrivateGlobalPrefix())))
      > +        continue;
      
      Please add a big fat comment above this if, explaining what it is  
      doing and maybe even including an example.  Thanks,
      
      -Chris
      
      
      
      From clattner at apple.com  Sun Sep 21 13:58:23 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 11:58:23 -0700
      Subject: [llvm-commits] [llvm] r55973 - in /llvm/trunk:
      	include/llvm/Target/TargetAsmInfo.h
      	lib/CodeGen/AsmPrinter/AsmPrinter.cpp
      	lib/Target/ARM/ARMTargetAsmInfo.cpp
      	lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp
      	lib/Target/X86/X86TargetAsmInfo.cpp
      In-Reply-To: <0A3D4CAB-0019-4D9C-8A88-E944CFCA9925@apple.com>
      References: <200809090121.m891LMQL010215@zion.cs.uiuc.edu>
      	<0A3D4CAB-0019-4D9C-8A88-E944CFCA9925@apple.com>
      Message-ID: <29BFDCE6-97CE-494B-8FB1-5E62DF3AEE55@apple.com>
      
      On Sep 21, 2008, at 11:56 AM, Chris Lattner wrote:
      >> ++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Sep  8  
      >> 20:21:22 2008
      >> @@ -462,7 +464,17 @@
      >>
      >>  for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
      >>    const GlobalValue *GV = findGlobalValue(InitList->getOperand(i));
      >> -    if (GV && (!GV->hasInternalLinkage() || isa(GV))) {
      >> +    if (GV) {
      >> +      if (GV->hasInternalLinkage() && !isa(GV) &&
      >> +          ((strlen(TAI->getPrivateGlobalPrefix()) != 0 &&
      >> +            Mang->getValueName(GV)
      >> +              .substr(0,strlen(TAI->getPrivateGlobalPrefix())) ==
      >> +              TAI->getPrivateGlobalPrefix()) ||
      >> +           (strlen(TAI->getLessPrivateGlobalPrefix()) != 0 &&
      >> +            Mang->getValueName(GV)
      >> +              .substr(0,strlen(TAI->getLessPrivateGlobalPrefix()))  
      >> ==
      >> +              TAI->getLessPrivateGlobalPrefix())))
      >> +        continue;
      >
      > Please add a big fat comment above this if, explaining what it is  
      > doing and maybe even including an example.  Thanks,
      
      Oh, I see the code changed afterward, nevermind!
      
      -Chris
      
      
      From clattner at apple.com  Sun Sep 21 14:00:39 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 12:00:39 -0700
      Subject: [llvm-commits] [llvm] r55973 - in /llvm/trunk:
      	include/llvm/Target/TargetAsmInfo.h	lib/CodeGen/AsmPrinter/AsmPrinter.cpp
      	lib/Target/ARM/ARMTargetAsmInfo.cpp	lib/Target/PowerPC/PPCTargetAsmInfo.cpp
      	lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86Ta
      In-Reply-To: <7461877A-130F-4172-A3B7-D606E513FBA0@apple.com>
      References: 
      	<7461877A-130F-4172-A3B7-D606E513FBA0@apple.com>
      Message-ID: <2A05C955-ABA9-4034-A828-BA867682CF6F@apple.com>
      
      On Sep 9, 2008, at 11:19 AM, Dale Johannesen wrote:
      > On Sep 9, 2008, at 1:02 AMPDT, Anton Korobeynikov wrote:
      >> Hi, Dale
      >>
      >>> the magic 'l' prefix for symbols on Darwin which are
      >>> to be passed through the assembler, then removed at
      >>> linktime (previously all references to this had been
      >>> hidden in the ObjC FE code, oh well).
      >> Sorry for bothering you again, but changing semantics of llvm.used in
      >> such target- and language- specific way is a bit... uhm...
      >> questionable.
      >
      > The underlying problem is that two different characteristics are
      > involved:  "the compiler must not delete this symbol", and "the
      > compiler must emit something special to affect assembly- or link- time
      > behavior".   Currently both these key off llvm.used, which is not so
      > good because they are not the same thing and do not always apply to
      > the same symbols.  I have been patching the existing mechanism to make
      > it work, but I could be persuaded that a new mechanism is better.
      
      Ok, it sounds like overloading llvm.used like this is the problem.   
      Maybe the issues is that we need two different "used" lists? One that  
      is "must be in the assembler output" and "one that must be in the  
      linker output".  The current used list would be the later, and ObjC  
      could use the former?
      
      -Chris
      
      
      From clattner at apple.com  Sun Sep 21 14:01:42 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 12:01:42 -0700
      Subject: [llvm-commits] [llvm] r56189 - in /llvm/trunk:
      	include/llvm/CodeGen/
      	lib/CodeGen/	lib/Target/ARM/	lib/Target/PowerPC/
      	lib/Target/Sparc/	lib/Target/X86/
      In-Reply-To: <15FE807C-407B-4123-8ED6-8DC30FB3A706@apple.com>
      References: <200809131758.m8DHwOc8023051@zion.cs.uiuc.edu>
      	
      	<15FE807C-407B-4123-8ED6-8DC30FB3A706@apple.com>
      Message-ID: <6AE9DCC1-98E1-4C25-8B92-7D59A366DE64@apple.com>
      
      On Sep 18, 2008, at 11:06 AM, Dan Gohman wrote:
      >> Thanks for doing this Dan, but could you go the other way?  The short
      >> names are just as legible and are more concise.  I started converting
      >> all the old ones over to the short ones before but apparently got
      >> distracted and never finished, :(
      >
      > Ok, I'll change the code to the shorter names.
      
      Thanks!
      
      -Chris
      
      
      From anton at korobeynikov.info  Sun Sep 21 14:02:03 2008
      From: anton at korobeynikov.info (Anton Korobeynikov)
      Date: Sun, 21 Sep 2008 23:02:03 +0400
      Subject: [llvm-commits] [llvm] r55973 - in /llvm/trunk:
      	include/llvm/Target/TargetAsmInfo.h
      	lib/CodeGen/AsmPrinter/AsmPrinter.cpp
      	lib/Target/ARM/ARMTargetAsmInfo.cpp
      	lib/Target/PowerPC/PPCTargetAsmInfo.cpp
      	lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86Ta
      Message-ID: 
      
      > Oh, I see the code changed afterward, nevermind!
      Yeah, code slowly moves to encode target-dependent stuff in more
      explicit & generic way :)
      
      -- 
      With best regards, Anton Korobeynikov
      Faculty of Mathematics and Mechanics, Saint Petersburg State University
      
      
      From anton at korobeynikov.info  Sun Sep 21 14:04:40 2008
      From: anton at korobeynikov.info (Anton Korobeynikov)
      Date: Sun, 21 Sep 2008 23:04:40 +0400
      Subject: [llvm-commits] [llvm] r55973 - in /llvm/trunk:
      	include/llvm/Target/TargetAsmInfo.h
      	lib/CodeGen/AsmPrinter/AsmPrinter.cpp
      	lib/Target/ARM/ARMTargetAsmInfo.cpp
      	lib/Target/PowerPC/PPCTargetAsmInfo.cpp
      	lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86Ta
      In-Reply-To: <2A05C955-ABA9-4034-A828-BA867682CF6F@apple.com>
      References: 
      	<7461877A-130F-4172-A3B7-D606E513FBA0@apple.com>
      	<2A05C955-ABA9-4034-A828-BA867682CF6F@apple.com>
      Message-ID: 
      
      > Ok, it sounds like overloading llvm.used like this is the problem.
      > Maybe the issues is that we need two different "used" lists? One that
      > is "must be in the assembler output" and "one that must be in the
      > linker output".  The current used list would be the later, and ObjC
      > could use the former?
      I think your metadata proposal can solve almost all ObjC-related
      weirdness in symbols / sections stuff. Maybe it will be better to wait
      until it will be in mainline :)
      
      -- 
      With best regards, Anton Korobeynikov
      Faculty of Mathematics and Mechanics, Saint Petersburg State University
      
      
      From clattner at apple.com  Sun Sep 21 14:12:11 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 12:12:11 -0700
      Subject: [llvm-commits] [llvm] r55558 - in /llvm/trunk:
      	lib/CodeGen/SelectionDAG/DAGCombiner.cpp
      	lib/Target/X86/X86Instr64bit.td
      	lib/Target/X86/X86InstrInfo.td test/CodeGen/X86/shift-and.ll
      In-Reply-To: <200808300203.m7U23wZ7015651@zion.cs.uiuc.edu>
      References: <200808300203.m7U23wZ7015651@zion.cs.uiuc.edu>
      Message-ID: 
      
      On Aug 29, 2008, at 7:03 PM, Evan Cheng wrote:
      > Author: evancheng
      > Date: Fri Aug 29 21:03:58 2008
      > New Revision: 55558
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=55558&view=rev
      > Log:
      > Transform (x << (y&31)) -> (x << y). This takes advantage of the  
      > fact x86 shift instructions 2nd operand (shift count) is limited to  
      > 0 to 31 (or 63 in the x86-64 case).
      
      Ok, cool.
      
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
      > +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Aug 29  
      > 21:03:58 2008
      > @@ -2310,6 +2310,26 @@
      >   if (DAG.MaskedValueIsZero(SDValue(N, 0),
      >                              
      > APInt::getAllOnesValue(VT.getSizeInBits())))
      >     return DAG.getConstant(0, VT);
      > +  // fold (shl x, (trunc (and y, c))) -> (shl x, (and (trunc y), c))
      > +  // iff (trunc c) == c
      
      Three things:
      1) I don't think it matters if (trunc c) == c.  The bits that don't  
      match will get discarded anyway.
      2) I think you should check that the trunc and and only have a single  
      use.  If they don't, you could introduce extra computations of these  
      values.
      3) If the body of the dag combine is more than a couple lines, please  
      introduce a helper function so that the SHL/SRA/SRL cases aren't all  
      copies of each other.
      
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original)
      > +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Fri Aug 29 21:03:58  
      > 2008
      > @@ -1341,6 +1341,22 @@
      > // (shl x, 1) ==> (add x, x)
      > def : Pat<(shl GR64:$src1, (i8 1)), (ADD64rr GR64:$src1, GR64:$src1)>;
      >
      > +// (shl x (and y, 63)) ==> (shl x, y)
      > +def : Pat<(shl GR64:$src1, (and CL:$amt, 63)),
      > +          (SHL64rCL GR64:$src1)>;
      > +def : Pat<(store (shl (loadi64 addr:$dst), (and CL:$amt, 63)), addr: 
      > $dst),
      > +          (SHL64mCL addr:$dst)>;
      
      nice!
      
      -Chris
      
      
      
      From clattner at apple.com  Sun Sep 21 14:17:24 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 12:17:24 -0700
      Subject: [llvm-commits] [llvm-gcc-4.2] r55650 -
      	/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
      In-Reply-To: <200809022118.m82LIJeg019335@zion.cs.uiuc.edu>
      References: <200809022118.m82LIJeg019335@zion.cs.uiuc.edu>
      Message-ID: <2ABEF97F-1856-4090-B2C8-BE9EC57B2A0E@apple.com>
      
      On Sep 2, 2008, at 2:18 PM, Dale Johannesen wrote:
      > URL: http://llvm.org/viewvc/llvm-project?rev=55650&view=rev
      > Log:
      > Don't convert atomics that aren't supported by the target.
      > This gets us undefined functions at linktime instead of
      > crashes in llvm, which is what gcc does.
      
      Hi Dale,
      
      > +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Sep  2 16:18:19 2008
      > @@ -4590,82 +4590,113 @@
      >     return true;
      >   }
      >   case BUILT_IN_BOOL_COMPARE_AND_SWAP_8: {
      > +#if defined(TARGET_POWERPC)
      > +    if (!TARGET_64BIT)
      > +      return false;
      > +#endif
      >     Result = BuildCmpAndSwapAtomicBuiltin(exp,  
      > long_long_unsigned_type_node,
      >                                           true);
      
      llvm-convert.cpp is target independent code.  Checking for  
      TARGET_POWERPC here is not right.  Why not just check TARGET_64BIT or  
      something like that?  Does this happen on x86-32 as well?  If not,  
      maybe there some be some new LLVM_BUILTIN_ATOMIC_OK(...) macro, which  
      PPC defines.
      
      -Chris
      
      
      
      From clattner at apple.com  Sun Sep 21 14:21:24 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 12:21:24 -0700
      Subject: [llvm-commits] [llvm-gcc-4.2] r55783 -
      	in	/llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h
      In-Reply-To: <6D8ED505-CE40-4C69-B0FB-1418CAFD0087@apple.com>
      References: <200809041842.m84Igmf2008188@zion.cs.uiuc.edu>
      	<200809042223.51505.baldrick@free.fr>
      	
      	<200809051019.31647.baldrick@free.fr>
      	<6D8ED505-CE40-4C69-B0FB-1418CAFD0087@apple.com>
      Message-ID: 
      
      
      On Sep 5, 2008, at 9:55 AM, Dale Johannesen wrote:
      
      >
      > On Sep 5, 2008, at 1:19 AMPDT, Duncan Sands wrote:
      >
      >> Hi Dale,
      >>
      >>> I think it's wrong for the back end to be keying off the C names;  
      >>> not
      >>> all languages are C, not all dialects are C99, and not all
      >>> environments
      >>> are hosted.
      >>
      >> I also don't like keying off the name.  Maybe the SimplifyLibcalls
      >> pass
      >> could turn calls to math functions ("sin") into calls to llvm
      >> intrinsics
      >> ("llvm.sin"), which would concentrate this kind of thing in one  
      >> place.
      >
      > I think that is too late; we should already be into language-
      > independent code by that time.
      
      simplifylibcalls is specific to languages that use the standard C  
      runtime library, so that would be ok.
      
      -Chris
      
      
      
      From clattner at apple.com  Sun Sep 21 14:35:35 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 12:35:35 -0700
      Subject: [llvm-commits] [llvm] r55711 -
      	/llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp
      In-Reply-To: <16e5fdf90809031254x628ce86ftf8177a9451d5d618@mail.gmail.com>
      References: <200809031846.m83Ikb6u010144@zion.cs.uiuc.edu>
      	<16e5fdf90809031254x628ce86ftf8177a9451d5d618@mail.gmail.com>
      Message-ID: 
      
      
      On Sep 3, 2008, at 12:54 PM, Bill Wendling wrote:
      
      > On Wed, Sep 3, 2008 at 11:46 AM, Devang Patel   
      > wrote:
      >> --- llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp (original)
      >> +++ llvm/trunk/lib/Transforms/IPO/InlineSimple.cpp Wed Sep  3  
      >> 13:46:35 2008
      >> @@ -65,7 +65,7 @@
      >>
      >>  for (Module::iterator I = M.begin(), E = M.end();
      >>       I != E; ++I)
      >> -    if (!I->isDeclaration() && I->getNotes() == FN_NOTE_NoInline)
      >> +    if (!I->isDeclaration() && I->getNotes() & FN_NOTE_NoInline)
      >
      > I know that this is technically correct, but could you put parentheses
      > around the bitwise "and"? It makes it more readable if you don't have
      > the C operator precedence table memorized. :-)
      
      Better yet, please add a new "hasNote(FN_NOTE_NoInline)" method.  This  
      means callers won't have to do logical operations like this.  Using  
      logical operations exposes implementation details of notes that should  
      be private.
      
      -Chris
      
      
      From clattner at apple.com  Sun Sep 21 14:39:52 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 12:39:52 -0700
      Subject: [llvm-commits] [llvm] r55744 -
      	/llvm/trunk/lib/Transforms/Scalar/GVN.cpp
      In-Reply-To: <200809032306.m83N67sm018721@zion.cs.uiuc.edu>
      References: <200809032306.m83N67sm018721@zion.cs.uiuc.edu>
      Message-ID: 
      
      
      On Sep 3, 2008, at 4:06 PM, Owen Anderson wrote:
      
      > Author: resistor
      > Date: Wed Sep  3 18:06:07 2008
      > New Revision: 55744
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=55744&view=rev
      > Log:
      > Fix a bug that prevented PRE from applying in some cases.
      
      Testcase?
      
      -Chris
      
      >
      >
      > Modified:
      >    llvm/trunk/lib/Transforms/Scalar/GVN.cpp
      >
      > Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=55744&r1=55743&r2=55744&view=diff
      >
      > =
      > =
      > =
      > =
      > =
      > =
      > =
      > =
      > ======================================================================
      > --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
      > +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Wed Sep  3 18:06:07 2008
      > @@ -1131,9 +1131,11 @@
      >   }
      >
      >   if (EnablePRE) {
      > -    bool PREChanged = false;
      > -    while ((PREChanged = performPRE(F)))
      > +    bool PREChanged = true;
      > +    while (PREChanged) {
      > +      PREChanged = performPRE(F);
      >       changed |= PREChanged;
      > +    }
      >   }
      >
      >   return changed;
      > @@ -1256,7 +1258,7 @@
      >       unsigned succNum = 0;
      >       for (unsigned i = 0, e = PREPred->getTerminator()- 
      > >getNumSuccessors();
      >            i != e; ++i)
      > -        if (PREPred->getTerminator()->getSuccessor(i) == PREPred) {
      > +        if (PREPred->getTerminator()->getSuccessor(i) ==  
      > CurrentBlock) {
      >           succNum = i;
      >           break;
      >         }
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From clattner at apple.com  Sun Sep 21 14:42:56 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 12:42:56 -0700
      Subject: [llvm-commits] [llvm] r55781 -
      	/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp
      In-Reply-To: <200809041830.m84IUmxP007821@zion.cs.uiuc.edu>
      References: <200809041830.m84IUmxP007821@zion.cs.uiuc.edu>
      Message-ID: <7C829F8E-2755-408C-986D-3545AFDEBF80@apple.com>
      
      
      On Sep 4, 2008, at 11:30 AM, Dale Johannesen wrote:
      
      > Author: johannes
      > Date: Thu Sep  4 13:30:46 2008
      > New Revision: 55781
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=55781&view=rev
      > Log:
      > Add intrinsic forms of pow and exp2.  The non-intrinsic
      > forms remain to handle older IR files, but will go away soon.
      
      You want to remove handling of "powf" and only handle "llvm.pow.f32"?   
      Why?
      
      -Chris
      
      >
      >
      >
      > Modified:
      >    llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp
      >
      > Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=55781&r1=55780&r2=55781&view=diff
      >
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > = 
      > ======================================================================
      > --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original)
      > +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Thu Sep  4  
      > 13:30:46 2008
      > @@ -1246,9 +1246,19 @@
      >   Optimizations["powf"] = &Pow;
      >   Optimizations["pow"] = &Pow;
      >   Optimizations["powl"] = &Pow;
      > +  Optimizations["llvm.pow.f32"] = &Pow;
      > +  Optimizations["llvm.pow.f64"] = &Pow;
      > +  Optimizations["llvm.pow.f80"] = &Pow;
      > +  Optimizations["llvm.pow.f128"] = &Pow;
      > +  Optimizations["llvm.pow.ppcf128"] = &Pow;
      >   Optimizations["exp2l"] = &Exp2;
      >   Optimizations["exp2"] = &Exp2;
      >   Optimizations["exp2f"] = &Exp2;
      > +  Optimizations["llvm.exp2.ppcf128"] = &Exp2;
      > +  Optimizations["llvm.exp2.f128"] = &Exp2;
      > +  Optimizations["llvm.exp2.f80"] = &Exp2;
      > +  Optimizations["llvm.exp2.f64"] = &Exp2;
      > +  Optimizations["llvm.exp2.f32"] = &Exp2;
      >
      > #ifdef HAVE_FLOORF
      >   Optimizations["floor"] = &UnaryDoubleFP;
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From clattner at apple.com  Sun Sep 21 14:45:40 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 12:45:40 -0700
      Subject: [llvm-commits] [llvm] r55794 - in
      	/llvm/trunk/lib/Target/X86/AsmPrinter: X86ATTAsmPrinter.cpp
      	X86IntelAsmPrinter.cpp
      In-Reply-To: <200809051000.23606.baldrick@free.fr>
      References: <200809042103.m84L3fBo012834@zion.cs.uiuc.edu>
      	<200809051000.23606.baldrick@free.fr>
      Message-ID: 
      
      
      On Sep 5, 2008, at 1:00 AM, Duncan Sands wrote:
      
      > Hi Devang,
      >
      >>   unsigned FnAlign = OptimizeForSize ? 1 : 4;
      >> +  if (FnAlign == 4 && (F->getNotes() & FN_NOTE_OptimizeForSize))
      >> +    FnAlign = 1;
      >
      > There's no point in testing that FnAlign == 4 here.  I appreciate
      > that you may be trying for a small speedup, but it just makes the
      > code more fragile.
      
      Devang, ping.  Better yet, this should be:
      
      unsigned FnAlign = (OptimizeForSize || F- 
       >hasNote(FN_NOTE_OptimizeForSize)) ? 1 : 4;
      
      and eventually OptimizeForSize goes away.
      
      -Chris
      
      
      From clattner at apple.com  Sun Sep 21 14:47:19 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 12:47:19 -0700
      Subject: [llvm-commits] [llvm] r55807 - in /llvm/trunk:
      	lib/Target/X86/X86CallingConv.td lib/Target/X86/X86ISelLowering.cpp
      	test/CodeGen/X86/2007-08-13-SpillerReuse.ll
      	test/CodeGen/X86/2008-02-22-ReMatBug.ll
      	test/CodeGen/X86/coalescer-commute3.ll
      	test/CodeGen/X86/combine-lds.ll test/CodeGen/X86/fastcc.ll
      In-Reply-To: <200809042259.m84MxxkM017095@zion.cs.uiuc.edu>
      References: <200809042259.m84MxxkM017095@zion.cs.uiuc.edu>
      Message-ID: <484E2891-5028-440E-9C25-875007E6FC66@apple.com>
      
      
      On Sep 4, 2008, at 3:59 PM, Evan Cheng wrote:
      
      > Author: evancheng
      > Date: Thu Sep  4 17:59:58 2008
      > New Revision: 55807
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=55807&view=rev
      > Log:
      > For whatever the reason, x86 CallingConv::Fast (i.e. fastcc) was not  
      > passing scalar arguments in registers. This patch defines a new  
      > fastcc CC which is slightly different from the FastCall CC. In  
      > addition to passing integer arguments in ECX and EDX, it also  
      > specify doubles are passed in 8-byte slots which are 8-byte aligned  
      > (instead of 4-byte aligned). This avoids a potential performance  
      > hazard where doubles span cacheline boundaries.
      
      Okay, cool but:
      
      > @@ -1100,6 +1100,8 @@
      >     return CC_X86_32_FastCall;
      >   else if (CC == CallingConv::Fast && PerformTailCallOpt)
      >     return CC_X86_32_TailCall;
      > +  else if (CC == CallingConv::Fast)
      > +    return CC_X86_32_FastCC;
      
      Does this mean that "PerformTailCallOpt" changes the ABI?
      
      -Chris
      
      
      
      From resistor at mac.com  Sun Sep 21 15:43:25 2008
      From: resistor at mac.com (Owen Anderson)
      Date: Sun, 21 Sep 2008 20:43:25 -0000
      Subject: [llvm-commits] [llvm] r56410 -
      	/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
      Message-ID: <200809212043.m8LKhQIB028373@zion.cs.uiuc.edu>
      
      Author: resistor
      Date: Sun Sep 21 15:43:24 2008
      New Revision: 56410
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56410&view=rev
      Log:
      Fetch the starting index of the block when assigning intervals.  This gets live-in indices
      correct in the presence of things like EH labels.
      
      Modified:
          llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
      
      Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=56410&r1=56409&r2=56410&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
      +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Sun Sep 21 15:43:24 2008
      @@ -678,12 +678,12 @@
         DOUT << "********** COMPUTING LIVE INTERVALS **********\n"
              << "********** Function: "
              << ((Value*)mf_->getFunction())->getName() << '\n';
      -  // Track the index of the current machine instr.
      -  unsigned MIIndex = 0;
         
         for (MachineFunction::iterator MBBI = mf_->begin(), E = mf_->end();
              MBBI != E; ++MBBI) {
           MachineBasicBlock *MBB = MBBI;
      +    // Track the index of the current machine instr.
      +    unsigned MIIndex = getMBBStartIdx(MBB);
           DOUT << ((Value*)MBB->getBasicBlock())->getName() << ":\n";
       
           MachineBasicBlock::iterator MI = MBB->begin(), miEnd = MBB->end();
      
      
      
      
      From gohman at apple.com  Sun Sep 21 16:01:49 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Sun, 21 Sep 2008 21:01:49 -0000
      Subject: [llvm-commits] [llvm] r56411 -
      	/llvm/trunk/lib/Target/TargetRegisterInfo.cpp
      Message-ID: <200809212101.m8LL1nJj001352@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Sun Sep 21 16:01:49 2008
      New Revision: 56411
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56411&view=rev
      Log:
      Instead of building a list and sorting it just to find a maximum element,
      compute the maximum element directly.
      
      Modified:
          llvm/trunk/lib/Target/TargetRegisterInfo.cpp
      
      Modified: llvm/trunk/lib/Target/TargetRegisterInfo.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRegisterInfo.cpp?rev=56411&r1=56410&r2=56411&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/TargetRegisterInfo.cpp (original)
      +++ llvm/trunk/lib/Target/TargetRegisterInfo.cpp Sun Sep 21 16:01:49 2008
      @@ -35,17 +35,6 @@
       
       TargetRegisterInfo::~TargetRegisterInfo() {}
       
      -namespace {
      -  // Sort according to super- / sub- class relations.
      -  // i.e. super- register class < sub- register class.
      -  struct RCCompare {
      -    bool operator()(const TargetRegisterClass* const &LHS,
      -                    const TargetRegisterClass* const &RHS) {
      -      return RHS->hasSuperClass(LHS);
      -    }
      -  };
      -}
      -
       /// getPhysicalRegisterRegClass - Returns the Register Class of a physical
       /// register of the given type. If type is MVT::Other, then just return any
       /// register class the register belongs to.
      @@ -53,24 +42,18 @@
       TargetRegisterInfo::getPhysicalRegisterRegClass(unsigned reg, MVT VT) const {
         assert(isPhysicalRegister(reg) && "reg must be a physical register");
       
      -  // Pick the register class of the right type that contains this physreg.
      -  SmallVector RCs;
      +  // Pick the most super register class of the right type that contains
      +  // this physreg.
      +  const TargetRegisterClass* BestRC = 0;
         for (regclass_iterator I = regclass_begin(), E = regclass_end(); I != E; ++I){
      -    if ((VT == MVT::Other || (*I)->hasType(VT)) && (*I)->contains(reg))
      -      RCs.push_back(*I);
      -  }
      -
      -  if (RCs.size() == 1)
      -    return RCs[0];
      -
      -  if (RCs.size()) {
      -    // Multiple compatible register classes. Get the super- class.
      -    std::stable_sort(RCs.begin(), RCs.end(), RCCompare());
      -    return RCs[0];
      +    const TargetRegisterClass* RC = *I;
      +    if ((VT == MVT::Other || RC->hasType(VT)) && RC->contains(reg) &&
      +        (!BestRC || BestRC->hasSuperClass(RC)))
      +      BestRC = RC;
         }
       
      -  assert(false && "Couldn't find the register class");
      -  return 0;
      +  assert(BestRC && "Couldn't find the register class");
      +  return BestRC;
       }
       
       /// getAllocatableSetForRC - Toggle the bits that represent allocatable
      
      
      
      
      From clattner at apple.com  Sun Sep 21 16:09:51 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 14:09:51 -0700
      Subject: [llvm-commits] [llvm] r55973 - in /llvm/trunk:
      	include/llvm/Target/TargetAsmInfo.h	lib/CodeGen/AsmPrinter/AsmPrinter.cpp
      	lib/Target/ARM/ARMTargetAsmInfo.cpp	lib/Target/PowerPC/PPCTargetAsmInfo.cpp
      	lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86Ta
      In-Reply-To: 
      References: 
      	<7461877A-130F-4172-A3B7-D606E513FBA0@apple.com>
      	<2A05C955-ABA9-4034-A828-BA867682CF6F@apple.com>
      	
      Message-ID: <1CABC954-7CE3-488D-BA8B-430FBFD0AEC4@apple.com>
      
      
      On Sep 21, 2008, at 12:04 PM, Anton Korobeynikov wrote:
      
      >> Ok, it sounds like overloading llvm.used like this is the problem.
      >> Maybe the issues is that we need two different "used" lists? One that
      >> is "must be in the assembler output" and "one that must be in the
      >> linker output".  The current used list would be the later, and ObjC
      >> could use the former?
      > I think your metadata proposal can solve almost all ObjC-related
      > weirdness in symbols / sections stuff. Maybe it will be better to wait
      > until it will be in mainline :)
      
      I chatted with Daniel about that.  It is possible in theory, but that  
      would push a lot of the objc metadata encoding logic off into the  
      backend.  This is possible, but it seems better to keep it in the ObjC  
      front-end, at least right now.
      
      If there were a client that wanted to walk the LLVM IR *and* a higher  
      level form of the ObjC metadata, then it might make sense to do this.
      
      -Chris
      
      
      From gohman at apple.com  Sun Sep 21 16:11:42 2008
      From: gohman at apple.com (Dan Gohman)
      Date: Sun, 21 Sep 2008 21:11:42 -0000
      Subject: [llvm-commits] [llvm] r56412 - in /llvm/trunk:
       include/llvm/CodeGen/LiveVariables.h lib/CodeGen/LiveVariables.cpp
      Message-ID: <200809212111.m8LLBgJN003948@zion.cs.uiuc.edu>
      
      Author: djg
      Date: Sun Sep 21 16:11:41 2008
      New Revision: 56412
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56412&view=rev
      Log:
      Factor out code into HandleVirtRegDef, for consistency with
      Handle{Virt,Phys}Reg{Def,Use}. Remove a redundant check
      for register zero, and redundant checks for isPhysicalRegister.
      
      Modified:
          llvm/trunk/include/llvm/CodeGen/LiveVariables.h
          llvm/trunk/lib/CodeGen/LiveVariables.cpp
      
      Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveVariables.h?rev=56412&r1=56411&r2=56412&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/LiveVariables.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/LiveVariables.h Sun Sep 21 16:11:41 2008
      @@ -263,6 +263,7 @@
         void MarkVirtRegAliveInBlock(VarInfo& VRInfo, MachineBasicBlock* DefBlock,
                                      MachineBasicBlock *BB,
                                      std::vector &WorkList);
      +  void HandleVirtRegDef(unsigned reg, MachineInstr *MI);
         void HandleVirtRegUse(unsigned reg, MachineBasicBlock *MBB,
                               MachineInstr *MI);
       };
      
      Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=56412&r1=56411&r2=56412&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original)
      +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Sun Sep 21 16:11:41 2008
      @@ -177,6 +177,14 @@
           MarkVirtRegAliveInBlock(VRInfo, MRI->getVRegDef(reg)->getParent(), *PI);
       }
       
      +void LiveVariables::HandleVirtRegDef(unsigned Reg, MachineInstr *MI) {
      +  VarInfo &VRInfo = getVarInfo(Reg);
      +
      +  if (VRInfo.AliveBlocks.none())
      +    // If vr is not alive in any block, then defaults to dead.
      +    VRInfo.Kills.push_back(MI);
      +}
      +
       /// FindLastPartialDef - Return the last partial def of the specified register.
       /// Also returns the sub-register that's defined.
       MachineInstr *LiveVariables::FindLastPartialDef(unsigned Reg,
      @@ -552,8 +560,6 @@
               const MachineOperand &MO = MI->getOperand(i);
               if (MO.isRegister() && MO.getReg()) {
                 unsigned MOReg = MO.getReg();
      -          if (!MOReg)
      -            continue;
                 if (MO.isUse())
                   UseRegs.push_back(MOReg);
                 if (MO.isDef())
      @@ -566,24 +572,17 @@
               unsigned MOReg = UseRegs[i];
               if (TargetRegisterInfo::isVirtualRegister(MOReg))
                 HandleVirtRegUse(MOReg, MBB, MI);
      -        else if (TargetRegisterInfo::isPhysicalRegister(MOReg) &&
      -                 !ReservedRegisters[MOReg])
      +        else if (!ReservedRegisters[MOReg])
                 HandlePhysRegUse(MOReg, MI);
             }
       
             // Process all defs.
             for (unsigned i = 0, e = DefRegs.size(); i != e; ++i) {
               unsigned MOReg = DefRegs[i];
      -        if (TargetRegisterInfo::isVirtualRegister(MOReg)) {
      -          VarInfo &VRInfo = getVarInfo(MOReg);
      -
      -          if (VRInfo.AliveBlocks.none())
      -            // If vr is not alive in any block, then defaults to dead.
      -            VRInfo.Kills.push_back(MI);
      -        } else if (TargetRegisterInfo::isPhysicalRegister(MOReg) &&
      -                   !ReservedRegisters[MOReg]) {
      +        if (TargetRegisterInfo::isVirtualRegister(MOReg))
      +          HandleVirtRegDef(MOReg, MI);
      +        else if (!ReservedRegisters[MOReg])
                 HandlePhysRegDef(MOReg, MI);
      -        }
             }
           }
       
      
      
      
      
      From clattner at apple.com  Sun Sep 21 16:34:35 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 14:34:35 -0700
      Subject: [llvm-commits] [llvm] r55859 - in /llvm/trunk:
      	include/llvm/Analysis/CallGraph.h
      	lib/Analysis/IPA/CallGraph.cpp lib/Transforms/IPO/PruneEH.cpp
      	lib/Transforms/Utils/InlineFunction.cpp
      In-Reply-To: <200809052143.m85Lh5AS012722@zion.cs.uiuc.edu>
      References: <200809052143.m85Lh5AS012722@zion.cs.uiuc.edu>
      Message-ID: <359F1A29-F6E0-402E-B8ED-7E95C4EBE427@apple.com>
      
      
      On Sep 5, 2008, at 2:43 PM, Duncan Sands wrote:
      
      > Author: baldrick
      > Date: Fri Sep  5 16:43:04 2008
      > New Revision: 55859
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=55859&view=rev
      > Log:
      > Delete the removeCallEdgeTo callgraph method,
      > because it does not maintain a correct list
      > of callsites.  I discovered (see following
      > commit) that the inliner will create a wrong
      > callgraph if it is fed a callgraph with
      > correct edges but incorrect callsites.  These
      > were created by Prune-EH, and while it wasn't
      > done via removeCallEdgeTo, it could have been
      > done via removeCallEdgeTo, which is an accident
      > waiting to happen.  Use removeCallEdgeFor
      > instead.
      
      Nice!  Does this allow the patch in http://llvm.org/bugs/show_bug.cgi?id=2221 
        to go in now?
      
      -Chris
      
      
      From sabre at nondot.org  Sun Sep 21 16:44:29 2008
      From: sabre at nondot.org (Chris Lattner)
      Date: Sun, 21 Sep 2008 21:44:29 -0000
      Subject: [llvm-commits] [llvm] r56413 -
      	/llvm/trunk/lib/Target/X86/X86FastISel.cpp
      Message-ID: <200809212144.m8LLiUjh009395@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Sun Sep 21 16:44:29 2008
      New Revision: 56413
      
      URL: http://llvm.org/viewvc/llvm-project?rev=56413&view=rev
      Log:
      Fold immediates into X86 shifts with fast isel.  This generates:
      
      sarl    $3, %ecx
      
      instead of:
      
      movl    $3, %ecx
      sarl    %cl, %edx
      
      This shrinks fast isel 176.gcc by about 2000 instructions (.3%)
      
      
      Modified:
          llvm/trunk/lib/Target/X86/X86FastISel.cpp
      
      Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=56413&r1=56412&r2=56413&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Sun Sep 21 16:44:29 2008
      @@ -618,43 +618,42 @@
       }
       
       bool X86FastISel::X86SelectShift(Instruction *I) {
      -  unsigned CReg = 0;
      -  unsigned Opc = 0;
      +  unsigned CReg = 0, OpReg = 0, OpImm = 0;
         const TargetRegisterClass *RC = NULL;
         if (I->getType() == Type::Int8Ty) {
           CReg = X86::CL;
           RC = &X86::GR8RegClass;
           switch (I->getOpcode()) {
      -    case Instruction::LShr: Opc = X86::SHR8rCL; break;
      -    case Instruction::AShr: Opc = X86::SAR8rCL; break;
      -    case Instruction::Shl:  Opc = X86::SHL8rCL; break;
      +    case Instruction::LShr: OpReg = X86::SHR8rCL; OpImm = X86::SHR8ri; break;
      +    case Instruction::AShr: OpReg = X86::SAR8rCL; OpImm = X86::SAR8ri; break;
      +    case Instruction::Shl:  OpReg = X86::SHL8rCL; OpImm = X86::SHL8ri; break;
           default: return false;
           }
         } else if (I->getType() == Type::Int16Ty) {
           CReg = X86::CX;
           RC = &X86::GR16RegClass;
           switch (I->getOpcode()) {
      -    case Instruction::LShr: Opc = X86::SHR16rCL; break;
      -    case Instruction::AShr: Opc = X86::SAR16rCL; break;
      -    case Instruction::Shl:  Opc = X86::SHL16rCL; break;
      +    case Instruction::LShr: OpReg = X86::SHR16rCL; OpImm = X86::SHR16ri; break;
      +    case Instruction::AShr: OpReg = X86::SAR16rCL; OpImm = X86::SAR16ri; break;
      +    case Instruction::Shl:  OpReg = X86::SHL16rCL; OpImm = X86::SHL16ri; break;
           default: return false;
           }
         } else if (I->getType() == Type::Int32Ty) {
           CReg = X86::ECX;
           RC = &X86::GR32RegClass;
           switch (I->getOpcode()) {
      -    case Instruction::LShr: Opc = X86::SHR32rCL; break;
      -    case Instruction::AShr: Opc = X86::SAR32rCL; break;
      -    case Instruction::Shl:  Opc = X86::SHL32rCL; break;
      +    case Instruction::LShr: OpReg = X86::SHR32rCL; OpImm = X86::SHR32ri; break;
      +    case Instruction::AShr: OpReg = X86::SAR32rCL; OpImm = X86::SAR32ri; break;
      +    case Instruction::Shl:  OpReg = X86::SHL32rCL; OpImm = X86::SHL32ri; break;
           default: return false;
           }
         } else if (I->getType() == Type::Int64Ty) {
           CReg = X86::RCX;
           RC = &X86::GR64RegClass;
           switch (I->getOpcode()) {
      -    case Instruction::LShr: Opc = X86::SHR64rCL; break;
      -    case Instruction::AShr: Opc = X86::SAR64rCL; break;
      -    case Instruction::Shl:  Opc = X86::SHL64rCL; break;
      +    case Instruction::LShr: OpReg = X86::SHR64rCL; OpImm = X86::SHR64ri; break;
      +    case Instruction::AShr: OpReg = X86::SAR64rCL; OpImm = X86::SAR64ri; break;
      +    case Instruction::Shl:  OpReg = X86::SHL64rCL; OpImm = X86::SHL64ri; break;
           default: return false;
           }
         } else {
      @@ -667,11 +666,21 @@
       
         unsigned Op0Reg = getRegForValue(I->getOperand(0));
         if (Op0Reg == 0) return false;
      +  
      +  // Fold immediate in shl(x,3).
      +  if (ConstantInt *CI = dyn_cast(I->getOperand(1))) {
      +    unsigned ResultReg = createResultReg(RC);
      +    BuildMI(MBB, TII.get(OpImm), 
      +            ResultReg).addReg(Op0Reg).addImm(CI->getZExtValue());
      +    UpdateValueMap(I, ResultReg);
      +    return true;
      +  }
      +  
         unsigned Op1Reg = getRegForValue(I->getOperand(1));
         if (Op1Reg == 0) return false;
         TII.copyRegToReg(*MBB, MBB->end(), CReg, Op1Reg, RC, RC);
         unsigned ResultReg = createResultReg(RC);
      -  BuildMI(MBB, TII.get(Opc), ResultReg).addReg(Op0Reg);
      +  BuildMI(MBB, TII.get(OpReg), ResultReg).addReg(Op0Reg);
         UpdateValueMap(I, ResultReg);
         return true;
       }
      
      
      
      
      From clattner at apple.com  Sun Sep 21 16:57:07 2008
      From: clattner at apple.com (Chris Lattner)
      Date: Sun, 21 Sep 2008 14:57:07 -0700
      Subject: [llvm-commits] [llvm] r55900 -
      	/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
      In-Reply-To: <200809081422.m88EMGcI005300@zion.cs.uiuc.edu>
      References: <200809081422.m88EMGcI005300@zion.cs.uiuc.edu>
      Message-ID: <3C22819F-55ED-4A0A-A022-880304FA60A8@apple.com>
      
      
      On Sep 8, 2008, at 7:22 AM, Anton Korobeynikov wrote:
      
      > Author: asl
      > Date: Mon Sep  8 09:22:16 2008
      > New Revision: 55900
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=55900&view=rev
      > Log:
      > We do support EH on x86-64!
      
      Awesome!  2.4 is going to be great!
      
      -Chris
      
      
      
      From sabre at nondot.org  Sun Sep 21 17:15:38 2008
      From: sabre at nondot.org (Chris Lattner)
      Date: Sun, 21 Sep 2008 17:15:38 -0500
      Subject: [llvm-commits] CVS: llvm-www/pubs/2008-08-RTCodegen.html
      Message-ID: <200809212215.m8LMFcQp013300@zion.cs.uiuc.edu>
      
      
      
      Changes in directory llvm-www/pubs:
      
      2008-08-RTCodegen.html updated: 1.1 -> 1.2
      ---
      Log message:
      
      remove ligatures and other non-ascii characters, slice lines.
      
      
      ---
      Diffs of the changes:  (+7 -7)
      
       2008-08-RTCodegen.html |   14 +++++++-------
       1 files changed, 7 insertions(+), 7 deletions(-)
      
      
      Index: llvm-www/pubs/2008-08-RTCodegen.html
      diff -u llvm-www/pubs/2008-08-RTCodegen.html:1.1 llvm-www/pubs/2008-08-RTCodegen.html:1.2
      --- llvm-www/pubs/2008-08-RTCodegen.html:1.1	Fri Sep  5 12:36:33 2008
      +++ llvm-www/pubs/2008-08-RTCodegen.html	Sun Sep 21 17:14:08 2008
      @@ -17,16 +17,16 @@
       

      Abstract:

      Typical material systems are based on a collection of properties - that are set on a per???object or per???surface basis usually by evalua- - tion of a description ???le at run???time. Shading of hit points is then + that are set on a per-object or per-surface basis usually by +evaluation of a description file at run-time. Shading of hit points is then implemented by interpreting these properties. In order to be able - to support a large feature set, different code paths need to be cre- - ated, e.g. for re???ection and refraction effects. Conditions for the + to support a large feature set, different code paths need to be +created, e.g. for reflection and refraction effects. Conditions for the branches associated with these fragments of functionality need to be evaluated for each shaded ray, which may degrade performance - considerably. Material speci???c optimization opportunities are also - missed out by having a generic function for all material con???gura- - tions. We propose the use of run???time code generation for materials. + considerably. Material specific optimization opportunities are also + missed out by having a generic function for all material +configurations. We propose the use of run-time code generation for materials.
      From clattner at apple.com Sun Sep 21 17:51:43 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 15:51:43 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r55796 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200809091007.28699.baldrick@free.fr> References: <200809042123.m84LNekC013647@zion.cs.uiuc.edu> <200809061907.24993.baldrick@free.fr> <106476C8-8DBF-4B11-9595-FEDA920E40AD@apple.com> <200809091007.28699.baldrick@free.fr> Message-ID: <410AEDE8-3428-450D-849A-70CA900EA2C7@apple.com> On Sep 9, 2008, at 1:07 AM, Duncan Sands wrote: >>> Hi Dale, thinking about this more, I started wondering >>> why you want to produce llvm.pow and friends at all. >>> Does it actually bring any advantage? >> >> Functionally, no, the point is to get C semantics out of the >> optimizers. > > Well, given that you have several versions of each routine > (eg: pow that writes errno, pow that does not write errno > but uses the rounding mode, pow that does not write errno > and does not use the rounding mode), that makes for a lot > of intrinsics! Don't forget that SimplifyLibcalls performs > simplifications that apply to all those different pow variants. If anyone cared enough, this could be modeled by adding additional i1 arguments to llvm.pow. There is no need to make multiple different intrinsics. > That said, I think it is useful to distinguish between > SimplifyLibcalls (SLC) and the rest of the compiler. Yes, SLC is specific to code that is using the standard C library. If you were writing a compiler for some language which had 'sin' mean something unusual, you'd just not run it. > The SLC pass is special in that it only exists to muck > around with the standard system library, so it's not > unreasonable that it recognizes standard library functions. > It can always be turned off (llvm-gcc has logic for that). Yes, however, this also isn't sufficient. GCC has options like -fno- builtin-sin or something like that (which disable individual builtins). There are a couple of ways to handle this. One way to handle this is to completely disable simplifylibcalls (and friends) when any builtin is disabled. Another is to add an intrinsic for every standard C function we care about (not very attractive, but possible) and have the front-end do the lowering of call to intrinsic. A third approach would be to add a note attribute to functions that are disabled, e.g. a "not a builtin function" attribute or something like that. > So, excluding SLC, what about the rest of the compiler? > > Well, ConstantFolding.cpp will constant fold a range of > libcalls too. That's not so great - something should be > done about this (not sure what). Probably llvm-gcc's > logic should turn this off too, but it currently doesn't... Yes, this would require solution #2 or #3 if anyone cared enough. > The other place is codegen: > SelectionDAGBuild.cpp turns several things into SDNodes: > not just pow and cos intrinsics but also functions called > "cos". Two comments about this: (1) it implies that the > llvm intrinsics must be readnone and not readonly; (2) I > think the recognizing of names like "sin" should be dropped > and only intrinsics used here (this is maybe what you had in > mind). Let me explain (1): why an SDNode shouldn't be generated > unless the function is readnone. Consider the following > program: There are really two issues w.r.t. rounding mode. 1) we don't model it at all in the IR. Theoretically, we'd like to support the C99 pragmas, avoid moving FP operations (like adds) across rounding mode changes, etc. 2) in the absence of proper modeling, we aren't always conservative about our handling. For example, you're example of moving a cos across a rounding mode change. However, we already move add/sub/mul/ div across rounding mode changes, so I'm not sure how cos is that different. -Chris From clattner at apple.com Sun Sep 21 17:54:55 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 15:54:55 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r55796 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200809092138.09813.baldrick@free.fr> References: <200809042123.m84LNekC013647@zion.cs.uiuc.edu> <200809091007.28699.baldrick@free.fr> <200809092138.09813.baldrick@free.fr> Message-ID: On Sep 9, 2008, at 12:38 PM, Duncan Sands wrote: >> Whether an implementation sets errno (as Darwin does not) is a target >> dependency. c99 does not require it. Again a target may do target- >> dependent optimizations if it wants. (Of course this property may be >> shared by many targets so some abstraction would be useful; I am not >> saying these optimizations belong in the X86-specific code, for >> example.) >> >> So, I don't think it's necessary to represent either of these >> properties in the IR as such; > > I don't follow you. On linux the "pow" standard library function > sets errno. If my program calls "pow" and uses errno, you can't > just ignore that property of "pow". If I'm doing careful numerics > that relies on the rounding mode, the fact that the result of "pow" > depends on the rounding mode is important and can't just be ignored. > (People who want to ignore it can use -ffast-math, which results in > a "readnone" pow). OTOH, a flavor of this is also a front-end issue: fortran code never uses errno, so it is safe (in fortran) to optimize to a representation that doesn't generate errno. -Chris From clattner at apple.com Sun Sep 21 17:59:54 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 15:59:54 -0700 Subject: [llvm-commits] [llvm] r55864 - in /llvm/trunk: lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/2008-09-05-sinttofp-2xi32.ll In-Reply-To: <200809052307.m85N75hI015259@zion.cs.uiuc.edu> References: <200809052307.m85N75hI015259@zion.cs.uiuc.edu> Message-ID: <27DC9906-6759-4CC5-90CA-0784FF63F8B4@apple.com> On Sep 5, 2008, at 4:07 PM, Eli Friedman wrote: > Author: efriedma > Date: Fri Sep 5 18:07:03 2008 > New Revision: 55864 > > URL: http://llvm.org/viewvc/llvm-project?rev=55864&view=rev > Log: > Fix for PR2687: Add patterns to match sint_to_fp and fp_to_sint for > <2 x > i32>. This is a little messy, but it works. > > We should really get rid of the intrinsics, though, since they map > perfectly well to standard LLVM instructions. I completely agree. The rule has always been that the front-end should lower builtins/intrinsics into non-intrinsic LLVM IR whenever possible. Are you interested in tackling this? It would just require changing llvm-gcc, clang, and adding autoupgrade support for these. -Chris > > > > Added: > llvm/trunk/test/CodeGen/X86/2008-09-05-sinttofp-2xi32.ll > Modified: > llvm/trunk/lib/Target/X86/X86InstrSSE.td > > Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=55864&r1=55863&r2=55864&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) > +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Fri Sep 5 18:07:03 2008 > @@ -3080,6 +3080,10 @@ > (Int_CVTDQ2PSrr VR128:$src)>, Requires<[HasSSE2]>; > def : Pat<(v4i32 (fp_to_sint (v4f32 VR128:$src))), > (Int_CVTTPS2DQrr VR128:$src)>, Requires<[HasSSE2]>; > +def : Pat<(v2f64 (sint_to_fp (v2i32 VR64:$src))), > + (Int_CVTPI2PDrr VR64:$src)>, Requires<[HasSSE2]>; > +def : Pat<(v2i32 (fp_to_sint (v2f64 VR128:$src))), > + (Int_CVTTPD2PIrr VR128:$src)>, Requires<[HasSSE2]>; > > // Use movaps / movups for SSE integer load / store (one byte > shorter). > def : Pat<(alignedloadv4i32 addr:$src), > > Added: llvm/trunk/test/CodeGen/X86/2008-09-05-sinttofp-2xi32.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-09-05-sinttofp-2xi32.ll?rev=55864&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/X86/2008-09-05-sinttofp-2xi32.ll (added) > +++ llvm/trunk/test/CodeGen/X86/2008-09-05-sinttofp-2xi32.ll Fri > Sep 5 18:07:03 2008 > @@ -0,0 +1,15 @@ > +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep cvttpd2pi > | count 1 > +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep cvtpi2pd | > count 1 > +; PR2687 > + > +define <2 x double> @a(<2 x i32> %x) nounwind { > +entry: > + %y = sitofp <2 x i32> %x to <2 x double> > + ret <2 x double> %y > +} > + > +define <2 x i32> @b(<2 x double> %x) nounwind { > +entry: > + %y = fptosi <2 x double> %x to <2 x i32> > + ret <2 x i32> %y > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Sun Sep 21 18:17:14 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 16:17:14 -0700 Subject: [llvm-commits] [llvm] r55968 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp In-Reply-To: <200809090028.m890SO7g008287@zion.cs.uiuc.edu> References: <200809090028.m890SO7g008287@zion.cs.uiuc.edu> Message-ID: On Sep 8, 2008, at 5:28 PM, Bill Wendling wrote: > Author: void > Date: Mon Sep 8 19:28:24 2008 > New Revision: 55968 > > URL: http://llvm.org/viewvc/llvm-project?rev=55968&view=rev > Log: > Add support for floating-point calculations of log2 with limited > precisions of 6 > and 18. Hi Bill, This looks like great work, but is it possible to factor this somehow? It looks like a lot of this is building expressions of the form (x+c1)*c2. Maybe a helper that took the two constants would simplify stuff? Alternatively, maybe you could just change: DAG.getConstantFP(APFloat(APInt(32, 0xbcd2769e)), MVT::f32)); Into a call to a static function: getF32Cst(DAG, 0xbcd2769e) which would return the SDOperand. -Chris > > > Modified: > llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=55968&r1=55967&r2=55968&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp > (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon > Sep 8 19:28:24 2008 > @@ -2755,7 +2755,6 @@ > > /// visitExp - lower an exp intrinsic. Handles the special sequences > /// for limited-precision mode. > - > void > SelectionDAGLowering::visitExp(CallInst &I) { > SDValue result; > @@ -2768,7 +2767,6 @@ > > /// visitLog - lower a log intrinsic. Handles the special sequences > /// for limited-precision mode. > - > void > SelectionDAGLowering::visitLog(CallInst &I) { > SDValue result; > @@ -2779,108 +2777,225 @@ > setValue(&I, result); > } > > -/// visitLog2 - lower a log2 intrinsic. Handles the special > sequences > -/// for limited-precision mode. > - > +/// visitLog2 - Lower a log2 intrinsic. Handles the special > sequences for > +/// limited-precision mode. > void > SelectionDAGLowering::visitLog2(CallInst &I) { > SDValue result; > + > if (getValue(I.getOperand(1)).getValueType() == MVT::f32 && > - LimitFloatPrecision>0 && LimitFloatPrecision<=12) { > - SDValue operand = getValue(I.getOperand(1)); > - SDValue operand1 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, > operand); > - SDValue t0 = DAG.getNode(ISD::SRL, MVT::i32, operand1, > - DAG.getConstant(23, > MVT::i32)); > - SDValue t1 = DAG.getNode(ISD::AND, MVT::i32, t0, > - DAG.getConstant(255, > MVT::i32)); > + LimitFloatPrecision > 0 && LimitFloatPrecision <= 18) { > + SDValue Op = getValue(I.getOperand(1)); > + SDValue Op1 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, Op); > + > + // Get the exponent, which is most of log and scale by log(2): > + // > + // LogOfExponent = (float) (((Op1 & 0x7f800000) >> 23) - 127); > + // > + // where Op1 is the hexidecimal representation of floating > point value. > + SDValue t0 = DAG.getNode(ISD::AND, MVT::i32, Op1, > + DAG.getConstant(0x7f800000, MVT::i32)); > + SDValue t1 = DAG.getNode(ISD::SRL, MVT::i32, t0, > + DAG.getConstant(23, MVT::i32)); > SDValue t2 = DAG.getNode(ISD::SUB, MVT::i32, t1, > - DAG.getConstant(127, > MVT::i32)); > - SDValue t3 = DAG.getNode(ISD::UINT_TO_FP, MVT::f32, t2); > - SDValue t4 = DAG.getNode(ISD::OR, MVT::i32, operand1, > - DAG.getConstant(1065353216, > MVT::i32)); > - SDValue t5 = DAG.getNode(ISD::AND, MVT::i32, t4, > - DAG.getConstant(1073741823, > MVT::i32)); > - SDValue t6 = DAG.getNode(ISD::BIT_CONVERT, MVT::f32, t5); > - SDValue t7 = DAG.getNode(ISD::FMUL, MVT::f32, t6, > - DAG.getConstantFP(APFloat( > - APInt(32, 0xbda7262e)), MVT::f32)); > - SDValue t8 = DAG.getNode(ISD::FADD, MVT::f32, t7, > - DAG.getConstantFP(APFloat( > - APInt(32, 0x3f25280b)), MVT::f32)); > - SDValue t9 = DAG.getNode(ISD::FMUL, MVT::f32, t8, t6); > - SDValue t10 = DAG.getNode(ISD::FSUB, MVT::f32, t9, > - DAG.getConstantFP(APFloat( > - APInt(32, 0x4007b923)), MVT::f32)); > - SDValue t11 = DAG.getNode(ISD::FMUL, MVT::f32, t10, t6); > - SDValue t12 = DAG.getNode(ISD::FADD, MVT::f32, t11, > - DAG.getConstantFP(APFloat( > - APInt(32, 0x40823e2f)), MVT::f32)); > - SDValue t13 = DAG.getNode(ISD::FMUL, MVT::f32, t12, t6); > - SDValue t14 = DAG.getNode(ISD::FSUB, MVT::f32, t13, > - DAG.getConstantFP(APFloat( > - APInt(32, 0x4020d29c)), MVT::f32)); > - result = DAG.getNode(ISD::FADD, MVT::f32, t3, t14); > + DAG.getConstant(127, MVT::i32)); > + SDValue LogOfExponent = DAG.getNode(ISD::UINT_TO_FP, MVT::f32, > t2); > + > + // Get the significand and build it into a floating-point > number with > + // exponent of 1: > + // > + // Op1 = (Op1 & 0x007fffff) | 0x3f800000; > + // > + // where Op1 is the hexidecimal representation of floating > point value. > + SDValue t4 = DAG.getNode(ISD::AND, MVT::i32, Op1, > + DAG.getConstant(0x007fffff, MVT::i32)); > + SDValue t5 = DAG.getNode(ISD::OR, MVT::i32, t4, > + DAG.getConstant(0x3f800000, MVT::i32)); > + SDValue X = DAG.getNode(ISD::BIT_CONVERT, MVT::f32, t5); > + > + // Different possible minimax approximations of significand in > + // floating-point for various degrees of accuracy over [1,2]. > + if (LimitFloatPrecision <= 6) { > + // For floating-point precision of 6: > + // > + // Log2ofMantissa = -1.6749035f + (2.0246817f - .34484768f > * x) * x; > + // > + // error 0.0049451742, which is more than 7 bits > + SDValue t8 = DAG.getNode(ISD::FMUL, MVT::f32, X, > + DAG.getConstantFP(APFloat( > + APInt(32, 0xbeb08fe0)), MVT::f32)); > + SDValue t9 = DAG.getNode(ISD::FADD, MVT::f32, t8, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x40019463)), MVT::f32)); > + SDValue t10 = DAG.getNode(ISD::FMUL, MVT::f32, t9, X); > + SDValue Log2ofMantissa = DAG.getNode(ISD::FSUB, MVT::f32, t10, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x3fd6633d)), > MVT::f32)); > + > + result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, > Log2ofMantissa); > + } else if (LimitFloatPrecision > 6 && LimitFloatPrecision <= > 12) { > + // For floating-point precision of 12: > + // > + // Log2ofMantissa = > + // -2.51285454f + > + // (4.07009056f + > + // (-2.12067489f + > + // (.645142248f - 0.816157886e-1f * x) * x) * x) * x; > + // > + // error 0.0000876136000, which is better than 13 bits > + SDValue t8 = DAG.getNode(ISD::FMUL, MVT::f32, X, > + DAG.getConstantFP(APFloat( > + APInt(32, 0xbda7262e)), MVT::f32)); > + SDValue t9 = DAG.getNode(ISD::FADD, MVT::f32, t8, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x3f25280b)), MVT::f32)); > + SDValue t10 = DAG.getNode(ISD::FMUL, MVT::f32, t9, X); > + SDValue t11 = DAG.getNode(ISD::FSUB, MVT::f32, t10, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x4007b923)), MVT::f32)); > + SDValue t12 = DAG.getNode(ISD::FMUL, MVT::f32, t11, X); > + SDValue t13 = DAG.getNode(ISD::FADD, MVT::f32, t12, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x40823e2f)), MVT::f32)); > + SDValue t14 = DAG.getNode(ISD::FMUL, MVT::f32, t13, X); > + SDValue Log2ofMantissa = DAG.getNode(ISD::FSUB, MVT::f32, t14, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x4020d29c)), > MVT::f32)); > + > + result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, > Log2ofMantissa); > + } else { // LimitFloatPrecision > 12 && LimitFloatPrecision <= 18 > + // For floating-point precision of 18: > + // > + // Log2ofMantissa = > + // -3.0400495f + > + // (6.1129976f + > + // (-5.3420409f + > + // (3.2865683f + > + // (-1.2669343f + > + // (0.27515199f - > + // 0.25691327e-1f * x) * x) * x) * x) * x) * x; > + // > + // error 0.0000018516, which is better than 18 bits > + SDValue t8 = DAG.getNode(ISD::FMUL, MVT::f32, X, > + DAG.getConstantFP(APFloat( > + APInt(32, 0xbcd2769e)), MVT::f32)); > + SDValue t9 = DAG.getNode(ISD::FADD, MVT::f32, t8, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x3e8ce0b9)), MVT::f32)); > + SDValue t10 = DAG.getNode(ISD::FMUL, MVT::f32, t9, X); > + SDValue t11 = DAG.getNode(ISD::FSUB, MVT::f32, t10, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x3fa22ae7)), MVT::f32)); > + SDValue t12 = DAG.getNode(ISD::FMUL, MVT::f32, t11, X); > + SDValue t13 = DAG.getNode(ISD::FADD, MVT::f32, t12, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x40525723)), MVT::f32)); > + SDValue t14 = DAG.getNode(ISD::FMUL, MVT::f32, t13, X); > + SDValue t15 = DAG.getNode(ISD::FSUB, MVT::f32, t14, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x40aaf200)), MVT::f32)); > + SDValue t16 = DAG.getNode(ISD::FMUL, MVT::f32, t15, X); > + SDValue t17 = DAG.getNode(ISD::FADD, MVT::f32, t16, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x40c39dad)), MVT::f32)); > + SDValue t18 = DAG.getNode(ISD::FMUL, MVT::f32, t17, X); > + SDValue Log2ofMantissa = DAG.getNode(ISD::FSUB, MVT::f32, t18, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x4042902c)), > MVT::f32)); > + > + result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, > Log2ofMantissa); > + } > } else { > - // No special expansion. > + // No special expansion. > result = DAG.getNode(ISD::FLOG2, > getValue(I.getOperand(1)).getValueType(), > getValue(I.getOperand(1))); > } > + > setValue(&I, result); > } > > -/// visitLog10 - lower a log10 intrinsic. Handles the special > sequences > -/// for limited-precision mode. > - > +/// visitLog10 - Lower a log10 intrinsic. Handles the special > sequences for > +/// limited-precision mode. > void > SelectionDAGLowering::visitLog10(CallInst &I) { > SDValue result; > if (getValue(I.getOperand(1)).getValueType() == MVT::f32 && > - LimitFloatPrecision>0 && LimitFloatPrecision<=12) { > - SDValue operand = getValue(I.getOperand(1)); > - SDValue operand1 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, > operand); > - SDValue t0 = DAG.getNode(ISD::SRL, MVT::i32, operand1, > - DAG.getConstant(23, > MVT::i32)); > - SDValue t1 = DAG.getNode(ISD::AND, MVT::i32, t0, > - DAG.getConstant(255, > MVT::i32)); > + LimitFloatPrecision > 0 && LimitFloatPrecision <= 18) { > + SDValue Op = getValue(I.getOperand(1)); > + SDValue Op1 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, Op); > + > + // Get the exponent, which is most of log10 and scale by > log10(2). > + // > + // #define LOG10OF2 0.30102999f > + // Log10ofExponent = (float)(((Op1 & 0x7f800000) >> 23) - > 127) * LOG10OF2; > + // > + // where Op1 is the hexidecimal value of the floating-point > number. > + SDValue t0 = DAG.getNode(ISD::AND, MVT::i32, Op1, > + DAG.getConstant(0x7f800000, MVT::i32)); > + SDValue t1 = DAG.getNode(ISD::SRL, MVT::i32, t0, > + DAG.getConstant(23, MVT::i32)); > SDValue t2 = DAG.getNode(ISD::SUB, MVT::i32, t1, > - DAG.getConstant(127, > MVT::i32)); > + DAG.getConstant(127, MVT::i32)); > SDValue t3 = DAG.getNode(ISD::UINT_TO_FP, MVT::f32, t2); > - SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, > - DAG.getConstantFP(APFloat( > - APInt(32, 0x3e9a209a)), MVT::f32)); > - SDValue t5 = DAG.getNode(ISD::OR, MVT::i32, operand1, > - DAG.getConstant(1065353216, > MVT::i32)); > - SDValue t6 = DAG.getNode(ISD::AND, MVT::i32, t5, > - DAG.getConstant(1073741823, > MVT::i32)); > - SDValue t7 = DAG.getNode(ISD::BIT_CONVERT, MVT::f32, t6); > - SDValue t8 = DAG.getNode(ISD::FMUL, MVT::f32, t7, > - DAG.getConstantFP(APFloat( > - APInt(32, 0x3d431f31)), MVT::f32)); > - SDValue t9 = DAG.getNode(ISD::FSUB, MVT::f32, t8, > - DAG.getConstantFP(APFloat( > - APInt(32, 0x3ea21fb2)), MVT::f32)); > - SDValue t10 = DAG.getNode(ISD::FMUL, MVT::f32, t9, t7); > - SDValue t11 = DAG.getNode(ISD::FADD, MVT::f32, t10, > - DAG.getConstantFP(APFloat( > - APInt(32, 0x3f6ae232)), MVT::f32)); > - SDValue t12 = DAG.getNode(ISD::FMUL, MVT::f32, t11, t7); > - SDValue t13 = DAG.getNode(ISD::FSUB, MVT::f32, t12, > - DAG.getConstantFP(APFloat( > - APInt(32, 0x3f25f7c3)), MVT::f32)); > - result = DAG.getNode(ISD::FADD, MVT::f32, t4, t13); > + SDValue LogOfExponent = DAG.getNode(ISD::FMUL, MVT::f32, t3, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x3e9a209a)), MVT::f32)); > + > + // Get the significand and build it into a floating-point > number with > + // exponent of 1: > + // > + // Op1 = (Op1 & 0x007fffff) | 0x3f800000; > + // > + // where Op1 is the hexidecimal representation of floating > point value. > + SDValue t4 = DAG.getNode(ISD::AND, MVT::i32, Op1, > + DAG.getConstant(0x007fffff, MVT::i32)); > + SDValue t5 = DAG.getNode(ISD::OR, MVT::i32, t4, > + DAG.getConstant(0x3f800000, MVT::i32)); > + SDValue X = DAG.getNode(ISD::BIT_CONVERT, MVT::f32, t5); > + > + if (LimitFloatPrecision <= 6) { > + } else if (LimitFloatPrecision > 6 && LimitFloatPrecision <= > 12) { > + // For floating-point precision of 12: > + // > + // Log10ofMantissa = > + // -0.64831180f + > + // (0.91751397f + > + // (-0.31664806f + 0.47637168e-1f * x) * x) * x; > + // > + // error 0.00019228036, which is better than 12 bits > + SDValue t6 = DAG.getNode(ISD::FMUL, MVT::f32, X, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x3d431f31)), MVT::f32)); > + SDValue t7 = DAG.getNode(ISD::FSUB, MVT::f32, t6, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x3ea21fb2)), MVT::f32)); > + SDValue t8 = DAG.getNode(ISD::FMUL, MVT::f32, t7, X); > + SDValue t9 = DAG.getNode(ISD::FADD, MVT::f32, t8, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x3f6ae232)), MVT::f32)); > + SDValue t10 = DAG.getNode(ISD::FMUL, MVT::f32, t9, X); > + SDValue t11 = DAG.getNode(ISD::FSUB, MVT::f32, t10, > + DAG.getConstantFP(APFloat( > + APInt(32, 0x3f25f7c3)), MVT::f32)); > + SDValue Log10ofMantissa = DAG.getNode(ISD::FP_ROUND, > MVT::f32, t11, > + DAG.getConstant(0, > MVT::i32)); > + > + result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, > Log10ofMantissa); > + } else { // LimitFloatPrecision > 12 && LimitFloatPrecision <= 18 > + } > } else { > - // No special expansion. > + // No special expansion. > result = DAG.getNode(ISD::FLOG10, > getValue(I.getOperand(1)).getValueType(), > getValue(I.getOperand(1))); > } > + > setValue(&I, result); > } > > /// visitExp2 - lower an exp2 intrinsic. Handles the special > sequences > /// for limited-precision mode. > - > void > SelectionDAGLowering::visitExp2(CallInst &I) { > SDValue result; > @@ -2910,7 +3025,7 @@ > SDValue t11 = DAG.getNode(ISD::ADD, MVT::i32, t10, t3); > result = DAG.getNode(ISD::BIT_CONVERT, MVT::f32, t11); > } else { > - // No special expansion. > + // No special expansion. > result = DAG.getNode(ISD::FEXP2, > getValue(I.getOperand(1)).getValueType(), > getValue(I.getOperand(1))); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Sun Sep 21 18:30:18 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 21 Sep 2008 23:30:18 -0000 Subject: [llvm-commits] [llvm] r56415 - /llvm/trunk/include/llvm/CodeGen/MachineOperand.h Message-ID: <200809212330.m8LNUId1015522@zion.cs.uiuc.edu> Author: lattner Date: Sun Sep 21 18:30:17 2008 New Revision: 56415 URL: http://llvm.org/viewvc/llvm-project?rev=56415&view=rev Log: explain what earlyclobber actually is. Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=56415&r1=56414&r2=56415&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Sun Sep 21 18:30:17 2008 @@ -68,9 +68,9 @@ /// This is only valid on definitions of registers. bool IsDead : 1; - /// IsEarlyClobber - True if this MO_Register operand is marked earlyclobber - /// in an inline asm. Flag is not valid for any other case. See gcc doc - /// for description of earlyclobber. + /// IsEarlyClobber - True if this MO_Register 'def' operand is written to + /// by the MachineInstr before all input registers are read. This is used to + /// model the GCC inline asm '&' constraint modifier. bool IsEarlyClobber : 1; /// OverlapsEarlyClobber - True if this MO_Register operand is used as an From clattner at apple.com Sun Sep 21 18:41:33 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 16:41:33 -0700 Subject: [llvm-commits] [llvm] r56310 - /llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp In-Reply-To: <200809181822.m8IIMW2k002887@zion.cs.uiuc.edu> References: <200809181822.m8IIMW2k002887@zion.cs.uiuc.edu> Message-ID: <47A144A2-3B20-467D-8EAA-FB90DF12E434@apple.com> On Sep 18, 2008, at 11:22 AM, Dan Gohman wrote: > Author: djg > Date: Thu Sep 18 13:22:32 2008 > New Revision: 56310 > > URL: http://llvm.org/viewvc/llvm-project?rev=56310&view=rev > Log: > Don't consider instructions with implicit physical register > defs to be necessarily live. Why do defs of physical registers even matter? Can't you just look at kill/dead markers? -Chris > > > Modified: > llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp > > Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp?rev=56310&r1=56309&r2=56310&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp (original) > +++ llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Thu Sep 18 > 13:22:32 2008 > @@ -64,7 +64,8 @@ > const MachineOperand &MO = MI->getOperand(i); > if (MO.isRegister() && MO.isDef()) { > unsigned Reg = MO.getReg(); > - if (TargetRegisterInfo::isPhysicalRegister(Reg) || > + if ((!MO.isImplicit() && > + TargetRegisterInfo::isPhysicalRegister(Reg)) || > !MRI.use_empty(Reg)) { > // This def has a use. Don't delete the instruction! > AllDefsDead = false; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Sun Sep 21 18:49:50 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 16:49:50 -0700 Subject: [llvm-commits] [llvm] r56255 - /llvm/trunk/tools/opt/opt.cpp In-Reply-To: <6D3040B2-EA0A-43C4-9A34-0DDE4B94471F@apple.com> References: <200809162225.m8GMPEhG014334@zion.cs.uiuc.edu> <200809170820.50181.baldrick@free.fr> <6D3040B2-EA0A-43C4-9A34-0DDE4B94471F@apple.com> Message-ID: <97F440A8-C7A0-45A4-9D10-41E4F4AB40B4@apple.com> On Sep 17, 2008, at 9:05 AM, Devang Patel wrote: >> >> (2) stick this in a library somewhere and have llvm-gcc use it too. > > I tried. Remember PassManagerUtils.cpp's short lived existence ? :) > This causes circular dependencies, unless you create a separate new > library for just one routine. Feel free to fix this, if you're > inclined to do so. Extra bonus points if you also cover pass sequence > selection from llvm-ld and lto :) > Just stick the code for this into a header instead of a .cpp file. -Chris From clattner at apple.com Sun Sep 21 18:53:57 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 16:53:57 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r56052 - in /llvm-gcc-4.2/trunk/gcc: common.opt llvm-backend.cpp In-Reply-To: <200809100713.m8A7D6fk020332@zion.cs.uiuc.edu> References: <200809100713.m8A7D6fk020332@zion.cs.uiuc.edu> Message-ID: <802C7B9A-36D6-418C-B779-23E158E4FA62@apple.com> On Sep 10, 2008, at 12:13 AM, Bill Wendling wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=56052&view=rev > Log: > Add the -flimited-precision to the front-end. We error out if a > value other > than 6, 12, or 18 is supplied. Cool > +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Sep 10 02:13:05 2008 > @@ -159,6 +159,19 @@ > + > + std::string Arg = "--limit-float-precision="; > + Arg += utostr(flag_limited_precision); > + ArgStrings.push_back(Arg); Minor simplification, just use: > + ArgStrings.push_back("--limit-float- > precision="+utostr(flag_limited_precision)); -Chris > > + } > + > if (llvm_optns) { > std::string Opts = llvm_optns; > for (std::string Opt = getToken(Opts); !Opt.empty(); Opt = > getToken(Opts)) > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Sun Sep 21 19:12:40 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 22 Sep 2008 00:12:40 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r56417 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200809220012.m8M0Cf56016926@zion.cs.uiuc.edu> Author: void Date: Sun Sep 21 19:12:40 2008 New Revision: 56417 URL: http://llvm.org/viewvc/llvm-project?rev=56417&view=rev Log: Small simplification. No functionality change. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=56417&r1=56416&r2=56417&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Sun Sep 21 19:12:40 2008 @@ -161,8 +161,7 @@ std::vector ArgStrings; if (flag_limited_precision > 0) { - std::string Arg = "--limit-float-precision="; - Arg += utostr(flag_limited_precision); + std::string Arg("--limit-float-precision="+utostr(flag_limited_precision)); ArgStrings.push_back(Arg); } From isanbard at gmail.com Sun Sep 21 19:44:35 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 22 Sep 2008 00:44:35 -0000 Subject: [llvm-commits] [llvm] r56418 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Message-ID: <200809220044.m8M0iaTi017782@zion.cs.uiuc.edu> Author: void Date: Sun Sep 21 19:44:35 2008 New Revision: 56418 URL: http://llvm.org/viewvc/llvm-project?rev=56418&view=rev Log: Add helper function to get a 32-bit floating point constant. No functionality change. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=56418&r1=56417&r2=56418&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Sun Sep 21 19:44:35 2008 @@ -2738,12 +2738,12 @@ } -// GetSignificand - Get the significand and build it into a floating-point -// number with exponent of 1: -// -// Op = (Op & 0x007fffff) | 0x3f800000; -// -// where Op is the hexidecimal representation of floating point value. +/// GetSignificand - Get the significand and build it into a floating-point +/// number with exponent of 1: +/// +/// Op = (Op & 0x007fffff) | 0x3f800000; +/// +/// where Op is the hexidecimal representation of floating point value. static SDValue GetSignificand(SelectionDAG &DAG, SDValue Op) { SDValue t1 = DAG.getNode(ISD::AND, MVT::i32, Op, @@ -2753,11 +2753,11 @@ return DAG.getNode(ISD::BIT_CONVERT, MVT::f32, t2); } -// GetExponent - Get the exponent: -// -// (float)((Op1 >> 23) - 127); -// -// where Op is the hexidecimal representation of floating point value. +/// GetExponent - Get the exponent: +/// +/// (float)((Op1 >> 23) - 127); +/// +/// where Op is the hexidecimal representation of floating point value. static SDValue GetExponent(SelectionDAG &DAG, SDValue Op) { SDValue t1 = DAG.getNode(ISD::SRL, MVT::i32, Op, @@ -2767,6 +2767,12 @@ return DAG.getNode(ISD::UINT_TO_FP, MVT::f32, t2); } +/// getF32Constant - Get 32-bit floating point constant. +static SDValue +getF32Constant(SelectionDAG &DAG, unsigned Flt) { + return DAG.getConstantFP(APFloat(APInt(32, Flt)), MVT::f32); +} + /// Inlined utility function to implement binary input atomic intrinsics for /// visitIntrinsicCall: I is a call instruction /// Op is the associated NodeType for I @@ -2798,8 +2804,7 @@ // #define LOG2OFe 1.4426950f // IntegerPartOfX = ((int32_t)(X * LOG2OFe)); SDValue t0 = DAG.getNode(ISD::FMUL, MVT::f32, Op, - DAG.getConstantFP(APFloat( - APInt(32, 0x3fb8aa3b)), MVT::f32)); + getF32Constant(DAG, 0x3fb8aa3b)); SDValue IntegerPartOfX = DAG.getNode(ISD::FP_TO_SINT, MVT::i32, t0); // FractionalPartOfX = (X * LOG2OFe) - (float)IntegerPartOfX; @@ -2819,15 +2824,12 @@ // // error 0.0144103317, which is 6 bits SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e814304)), MVT::f32)); + getF32Constant(DAG, 0x3e814304)); SDValue t3 = DAG.getNode(ISD::FADD, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f3c50c8)), MVT::f32)); + getF32Constant(DAG, 0x3f3c50c8)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f7f5e7e)), MVT::f32)); + getF32Constant(DAG, 0x3f7f5e7e)); SDValue TwoToFracPartOfX = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, t5); // Add the exponent into the result in integer domain. @@ -2845,19 +2847,15 @@ // // 0.000107046256 error, which is 13 to 14 bits SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0x3da235e3)), MVT::f32)); + getF32Constant(DAG, 0x3da235e3)); SDValue t3 = DAG.getNode(ISD::FADD, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e65b8f3)), MVT::f32)); + getF32Constant(DAG, 0x3e65b8f3)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f324b07)), MVT::f32)); + getF32Constant(DAG, 0x3f324b07)); SDValue t6 = DAG.getNode(ISD::FMUL, MVT::f32, t5, X); SDValue t7 = DAG.getNode(ISD::FADD, MVT::f32, t6, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f7ff8fd)), MVT::f32)); + getF32Constant(DAG, 0x3f7ff8fd)); SDValue TwoToFracPartOfX = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, t7); // Add the exponent into the result in integer domain. @@ -2878,31 +2876,24 @@ // // error 2.47208000*10^(-7), which is better than 18 bits SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0x3924b03e)), MVT::f32)); + getF32Constant(DAG, 0x3924b03e)); SDValue t3 = DAG.getNode(ISD::FADD, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3ab24b87)), MVT::f32)); + getF32Constant(DAG, 0x3ab24b87)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x3c1d8c17)), MVT::f32)); + getF32Constant(DAG, 0x3c1d8c17)); SDValue t6 = DAG.getNode(ISD::FMUL, MVT::f32, t5, X); SDValue t7 = DAG.getNode(ISD::FADD, MVT::f32, t6, - DAG.getConstantFP(APFloat( - APInt(32, 0x3d634a1d)), MVT::f32)); + getF32Constant(DAG, 0x3d634a1d)); SDValue t8 = DAG.getNode(ISD::FMUL, MVT::f32, t7, X); SDValue t9 = DAG.getNode(ISD::FADD, MVT::f32, t8, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e75fe14)), MVT::f32)); + getF32Constant(DAG, 0x3e75fe14)); SDValue t10 = DAG.getNode(ISD::FMUL, MVT::f32, t9, X); SDValue t11 = DAG.getNode(ISD::FADD, MVT::f32, t10, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f317234)), MVT::f32)); + getF32Constant(DAG, 0x3f317234)); SDValue t12 = DAG.getNode(ISD::FMUL, MVT::f32, t11, X); SDValue t13 = DAG.getNode(ISD::FADD, MVT::f32, t12, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f800000)), MVT::f32)); + getF32Constant(DAG, 0x3f800000)); SDValue TwoToFracPartOfX = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, t13); // Add the exponent into the result in integer domain. @@ -2935,8 +2926,7 @@ // Scale the exponent by log(2) [0.69314718f]. SDValue Exp = GetExponent(DAG, Op1); SDValue LogOfExponent = DAG.getNode(ISD::FMUL, MVT::f32, Exp, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f317218)), MVT::f32)); + getF32Constant(DAG, 0x3f317218)); // Get the significand and build it into a floating-point number with // exponent of 1. @@ -2951,15 +2941,12 @@ // // error 0.0034276066, which is better than 8 bits SDValue t0 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0xbe74c456)), MVT::f32)); + getF32Constant(DAG, 0xbe74c456)); SDValue t1 = DAG.getNode(ISD::FADD, MVT::f32, t0, - DAG.getConstantFP(APFloat( - APInt(32, 0x3fb3a2b1)), MVT::f32)); + getF32Constant(DAG, 0x3fb3a2b1)); SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, t1, X); SDValue LogOfMantissa = DAG.getNode(ISD::FSUB, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f949a29)), MVT::f32)); + getF32Constant(DAG, 0x3f949a29)); result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, LogOfMantissa); } else if (LimitFloatPrecision > 6 && LimitFloatPrecision <= 12) { @@ -2973,23 +2960,18 @@ // // error 0.000061011436, which is 14 bits SDValue t0 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0xbd67b6d6)), MVT::f32)); + getF32Constant(DAG, 0xbd67b6d6)); SDValue t1 = DAG.getNode(ISD::FADD, MVT::f32, t0, - DAG.getConstantFP(APFloat( - APInt(32, 0x3ee4f4b8)), MVT::f32)); + getF32Constant(DAG, 0x3ee4f4b8)); SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, t1, X); SDValue t3 = DAG.getNode(ISD::FSUB, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3fbc278b)), MVT::f32)); + getF32Constant(DAG, 0x3fbc278b)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x40348e95)), MVT::f32)); + getF32Constant(DAG, 0x40348e95)); SDValue t6 = DAG.getNode(ISD::FMUL, MVT::f32, t5, X); SDValue LogOfMantissa = DAG.getNode(ISD::FSUB, MVT::f32, t6, - DAG.getConstantFP(APFloat( - APInt(32, 0x3fdef31a)), MVT::f32)); + getF32Constant(DAG, 0x3fdef31a)); result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, LogOfMantissa); } else { // LimitFloatPrecision > 12 && LimitFloatPrecision <= 18 @@ -3005,31 +2987,24 @@ // // error 0.0000023660568, which is better than 18 bits SDValue t0 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0xbc91e5ac)), MVT::f32)); + getF32Constant(DAG, 0xbc91e5ac)); SDValue t1 = DAG.getNode(ISD::FADD, MVT::f32, t0, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e4350aa)), MVT::f32)); + getF32Constant(DAG, 0x3e4350aa)); SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, t1, X); SDValue t3 = DAG.getNode(ISD::FSUB, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f60d3e3)), MVT::f32)); + getF32Constant(DAG, 0x3f60d3e3)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x4011cdf0)), MVT::f32)); + getF32Constant(DAG, 0x4011cdf0)); SDValue t6 = DAG.getNode(ISD::FMUL, MVT::f32, t5, X); SDValue t7 = DAG.getNode(ISD::FSUB, MVT::f32, t6, - DAG.getConstantFP(APFloat( - APInt(32, 0x406cfd1c)), MVT::f32)); + getF32Constant(DAG, 0x406cfd1c)); SDValue t8 = DAG.getNode(ISD::FMUL, MVT::f32, t7, X); SDValue t9 = DAG.getNode(ISD::FADD, MVT::f32, t8, - DAG.getConstantFP(APFloat( - APInt(32, 0x408797cb)), MVT::f32)); + getF32Constant(DAG, 0x408797cb)); SDValue t10 = DAG.getNode(ISD::FMUL, MVT::f32, t9, X); SDValue LogOfMantissa = DAG.getNode(ISD::FSUB, MVT::f32, t10, - DAG.getConstantFP(APFloat( - APInt(32, 0x4006dcab)), MVT::f32)); + getF32Constant(DAG, 0x4006dcab)); result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, LogOfMantissa); } @@ -3070,15 +3045,12 @@ // // error 0.0049451742, which is more than 7 bits SDValue t0 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0xbeb08fe0)), MVT::f32)); + getF32Constant(DAG, 0xbeb08fe0)); SDValue t1 = DAG.getNode(ISD::FADD, MVT::f32, t0, - DAG.getConstantFP(APFloat( - APInt(32, 0x40019463)), MVT::f32)); + getF32Constant(DAG, 0x40019463)); SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, t1, X); SDValue Log2ofMantissa = DAG.getNode(ISD::FSUB, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3fd6633d)), MVT::f32)); + getF32Constant(DAG, 0x3fd6633d)); result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, Log2ofMantissa); } else if (LimitFloatPrecision > 6 && LimitFloatPrecision <= 12) { @@ -3092,23 +3064,18 @@ // // error 0.0000876136000, which is better than 13 bits SDValue t0 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0xbda7262e)), MVT::f32)); + getF32Constant(DAG, 0xbda7262e)); SDValue t1 = DAG.getNode(ISD::FADD, MVT::f32, t0, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f25280b)), MVT::f32)); + getF32Constant(DAG, 0x3f25280b)); SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, t1, X); SDValue t3 = DAG.getNode(ISD::FSUB, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x4007b923)), MVT::f32)); + getF32Constant(DAG, 0x4007b923)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x40823e2f)), MVT::f32)); + getF32Constant(DAG, 0x40823e2f)); SDValue t6 = DAG.getNode(ISD::FMUL, MVT::f32, t5, X); SDValue Log2ofMantissa = DAG.getNode(ISD::FSUB, MVT::f32, t6, - DAG.getConstantFP(APFloat( - APInt(32, 0x4020d29c)), MVT::f32)); + getF32Constant(DAG, 0x4020d29c)); result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, Log2ofMantissa); } else { // LimitFloatPrecision > 12 && LimitFloatPrecision <= 18 @@ -3125,31 +3092,24 @@ // // error 0.0000018516, which is better than 18 bits SDValue t0 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0xbcd2769e)), MVT::f32)); + getF32Constant(DAG, 0xbcd2769e)); SDValue t1 = DAG.getNode(ISD::FADD, MVT::f32, t0, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e8ce0b9)), MVT::f32)); + getF32Constant(DAG, 0x3e8ce0b9)); SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, t1, X); SDValue t3 = DAG.getNode(ISD::FSUB, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3fa22ae7)), MVT::f32)); + getF32Constant(DAG, 0x3fa22ae7)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x40525723)), MVT::f32)); + getF32Constant(DAG, 0x40525723)); SDValue t6 = DAG.getNode(ISD::FMUL, MVT::f32, t5, X); SDValue t7 = DAG.getNode(ISD::FSUB, MVT::f32, t6, - DAG.getConstantFP(APFloat( - APInt(32, 0x40aaf200)), MVT::f32)); + getF32Constant(DAG, 0x40aaf200)); SDValue t8 = DAG.getNode(ISD::FMUL, MVT::f32, t7, X); SDValue t9 = DAG.getNode(ISD::FADD, MVT::f32, t8, - DAG.getConstantFP(APFloat( - APInt(32, 0x40c39dad)), MVT::f32)); + getF32Constant(DAG, 0x40c39dad)); SDValue t10 = DAG.getNode(ISD::FMUL, MVT::f32, t9, X); SDValue Log2ofMantissa = DAG.getNode(ISD::FSUB, MVT::f32, t10, - DAG.getConstantFP(APFloat( - APInt(32, 0x4042902c)), MVT::f32)); + getF32Constant(DAG, 0x4042902c)); result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, Log2ofMantissa); } @@ -3176,8 +3136,7 @@ // Scale the exponent by log10(2) [0.30102999f]. SDValue Exp = GetExponent(DAG, Op1); SDValue LogOfExponent = DAG.getNode(ISD::FMUL, MVT::f32, Exp, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e9a209a)), MVT::f32)); + getF32Constant(DAG, 0x3e9a209a)); // Get the significand and build it into a floating-point number with // exponent of 1. @@ -3192,15 +3151,12 @@ // // error 0.0014886165, which is 6 bits SDValue t0 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0xbdd49a13)), MVT::f32)); + getF32Constant(DAG, 0xbdd49a13)); SDValue t1 = DAG.getNode(ISD::FADD, MVT::f32, t0, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f1c0789)), MVT::f32)); + getF32Constant(DAG, 0x3f1c0789)); SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, t1, X); SDValue Log10ofMantissa = DAG.getNode(ISD::FSUB, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f011300)), MVT::f32)); + getF32Constant(DAG, 0x3f011300)); result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, Log10ofMantissa); } else if (LimitFloatPrecision > 6 && LimitFloatPrecision <= 12) { @@ -3213,19 +3169,15 @@ // // error 0.00019228036, which is better than 12 bits SDValue t0 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0x3d431f31)), MVT::f32)); + getF32Constant(DAG, 0x3d431f31)); SDValue t1 = DAG.getNode(ISD::FSUB, MVT::f32, t0, - DAG.getConstantFP(APFloat( - APInt(32, 0x3ea21fb2)), MVT::f32)); + getF32Constant(DAG, 0x3ea21fb2)); SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, t1, X); SDValue t3 = DAG.getNode(ISD::FADD, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f6ae232)), MVT::f32)); + getF32Constant(DAG, 0x3f6ae232)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue Log10ofMantissa = DAG.getNode(ISD::FSUB, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f25f7c3)), MVT::f32)); + getF32Constant(DAG, 0x3f25f7c3)); result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, Log10ofMantissa); } else { // LimitFloatPrecision > 12 && LimitFloatPrecision <= 18 @@ -3240,27 +3192,21 @@ // // error 0.0000037995730, which is better than 18 bits SDValue t0 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0x3c5d51ce)), MVT::f32)); + getF32Constant(DAG, 0x3c5d51ce)); SDValue t1 = DAG.getNode(ISD::FSUB, MVT::f32, t0, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e00685a)), MVT::f32)); + getF32Constant(DAG, 0x3e00685a)); SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, t1, X); SDValue t3 = DAG.getNode(ISD::FADD, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3efb6798)), MVT::f32)); + getF32Constant(DAG, 0x3efb6798)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FSUB, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f88d192)), MVT::f32)); + getF32Constant(DAG, 0x3f88d192)); SDValue t6 = DAG.getNode(ISD::FMUL, MVT::f32, t5, X); SDValue t7 = DAG.getNode(ISD::FADD, MVT::f32, t6, - DAG.getConstantFP(APFloat( - APInt(32, 0x3fc4316c)), MVT::f32)); + getF32Constant(DAG, 0x3fc4316c)); SDValue t8 = DAG.getNode(ISD::FMUL, MVT::f32, t7, X); SDValue Log10ofMantissa = DAG.getNode(ISD::FSUB, MVT::f32, t8, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f57ce70)), MVT::f32)); + getF32Constant(DAG, 0x3f57ce70)); result = DAG.getNode(ISD::FADD, MVT::f32, LogOfExponent, Log10ofMantissa); } @@ -3303,15 +3249,12 @@ // // error 0.0144103317, which is 6 bits SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e814304)), MVT::f32)); + getF32Constant(DAG, 0x3e814304)); SDValue t3 = DAG.getNode(ISD::FADD, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f3c50c8)), MVT::f32)); + getF32Constant(DAG, 0x3f3c50c8)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f7f5e7e)), MVT::f32)); + getF32Constant(DAG, 0x3f7f5e7e)); SDValue t6 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, t5); SDValue TwoToFractionalPartOfX = DAG.getNode(ISD::ADD, MVT::i32, t6, IntegerPartOfX); @@ -3327,19 +3270,15 @@ // // error 0.000107046256, which is 13 to 14 bits SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0x3da235e3)), MVT::f32)); + getF32Constant(DAG, 0x3da235e3)); SDValue t3 = DAG.getNode(ISD::FADD, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e65b8f3)), MVT::f32)); + getF32Constant(DAG, 0x3e65b8f3)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f324b07)), MVT::f32)); + getF32Constant(DAG, 0x3f324b07)); SDValue t6 = DAG.getNode(ISD::FMUL, MVT::f32, t5, X); SDValue t7 = DAG.getNode(ISD::FADD, MVT::f32, t6, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f7ff8fd)), MVT::f32)); + getF32Constant(DAG, 0x3f7ff8fd)); SDValue t8 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, t7); SDValue TwoToFractionalPartOfX = DAG.getNode(ISD::ADD, MVT::i32, t8, IntegerPartOfX); @@ -3357,31 +3296,24 @@ // (0.136028312e-2f + 0.157059148e-3f *x)*x)*x)*x)*x)*x; // error 2.47208000*10^(-7), which is better than 18 bits SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0x3924b03e)), MVT::f32)); + getF32Constant(DAG, 0x3924b03e)); SDValue t3 = DAG.getNode(ISD::FADD, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3ab24b87)), MVT::f32)); + getF32Constant(DAG, 0x3ab24b87)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x3c1d8c17)), MVT::f32)); + getF32Constant(DAG, 0x3c1d8c17)); SDValue t6 = DAG.getNode(ISD::FMUL, MVT::f32, t5, X); SDValue t7 = DAG.getNode(ISD::FADD, MVT::f32, t6, - DAG.getConstantFP(APFloat( - APInt(32, 0x3d634a1d)), MVT::f32)); + getF32Constant(DAG, 0x3d634a1d)); SDValue t8 = DAG.getNode(ISD::FMUL, MVT::f32, t7, X); SDValue t9 = DAG.getNode(ISD::FADD, MVT::f32, t8, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e75fe14)), MVT::f32)); + getF32Constant(DAG, 0x3e75fe14)); SDValue t10 = DAG.getNode(ISD::FMUL, MVT::f32, t9, X); SDValue t11 = DAG.getNode(ISD::FADD, MVT::f32, t10, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f317234)), MVT::f32)); + getF32Constant(DAG, 0x3f317234)); SDValue t12 = DAG.getNode(ISD::FMUL, MVT::f32, t11, X); SDValue t13 = DAG.getNode(ISD::FADD, MVT::f32, t12, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f800000)), MVT::f32)); + getF32Constant(DAG, 0x3f800000)); SDValue t14 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, t13); SDValue TwoToFractionalPartOfX = DAG.getNode(ISD::ADD, MVT::i32, t14, IntegerPartOfX); @@ -3426,8 +3358,7 @@ // #define LOG2OF10 3.3219281f // IntegerPartOfX = (int32_t)(x * LOG2OF10); SDValue t0 = DAG.getNode(ISD::FMUL, MVT::f32, Op, - DAG.getConstantFP(APFloat( - APInt(32, 0x40549a78)), MVT::f32)); + getF32Constant(DAG, 0x40549a78)); SDValue IntegerPartOfX = DAG.getNode(ISD::FP_TO_SINT, MVT::i32, t0); // FractionalPartOfX = x - (float)IntegerPartOfX; @@ -3447,15 +3378,12 @@ // // error 0.0144103317, which is 6 bits SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e814304)), MVT::f32)); + getF32Constant(DAG, 0x3e814304)); SDValue t3 = DAG.getNode(ISD::FADD, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f3c50c8)), MVT::f32)); + getF32Constant(DAG, 0x3f3c50c8)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f7f5e7e)), MVT::f32)); + getF32Constant(DAG, 0x3f7f5e7e)); SDValue t6 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, t5); SDValue TwoToFractionalPartOfX = DAG.getNode(ISD::ADD, MVT::i32, t6, IntegerPartOfX); @@ -3471,19 +3399,15 @@ // // error 0.000107046256, which is 13 to 14 bits SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0x3da235e3)), MVT::f32)); + getF32Constant(DAG, 0x3da235e3)); SDValue t3 = DAG.getNode(ISD::FADD, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e65b8f3)), MVT::f32)); + getF32Constant(DAG, 0x3e65b8f3)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f324b07)), MVT::f32)); + getF32Constant(DAG, 0x3f324b07)); SDValue t6 = DAG.getNode(ISD::FMUL, MVT::f32, t5, X); SDValue t7 = DAG.getNode(ISD::FADD, MVT::f32, t6, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f7ff8fd)), MVT::f32)); + getF32Constant(DAG, 0x3f7ff8fd)); SDValue t8 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, t7); SDValue TwoToFractionalPartOfX = DAG.getNode(ISD::ADD, MVT::i32, t8, IntegerPartOfX); @@ -3501,31 +3425,24 @@ // (0.136028312e-2f + 0.157059148e-3f *x)*x)*x)*x)*x)*x; // error 2.47208000*10^(-7), which is better than 18 bits SDValue t2 = DAG.getNode(ISD::FMUL, MVT::f32, X, - DAG.getConstantFP(APFloat( - APInt(32, 0x3924b03e)), MVT::f32)); + getF32Constant(DAG, 0x3924b03e)); SDValue t3 = DAG.getNode(ISD::FADD, MVT::f32, t2, - DAG.getConstantFP(APFloat( - APInt(32, 0x3ab24b87)), MVT::f32)); + getF32Constant(DAG, 0x3ab24b87)); SDValue t4 = DAG.getNode(ISD::FMUL, MVT::f32, t3, X); SDValue t5 = DAG.getNode(ISD::FADD, MVT::f32, t4, - DAG.getConstantFP(APFloat( - APInt(32, 0x3c1d8c17)), MVT::f32)); + getF32Constant(DAG, 0x3c1d8c17)); SDValue t6 = DAG.getNode(ISD::FMUL, MVT::f32, t5, X); SDValue t7 = DAG.getNode(ISD::FADD, MVT::f32, t6, - DAG.getConstantFP(APFloat( - APInt(32, 0x3d634a1d)), MVT::f32)); + getF32Constant(DAG, 0x3d634a1d)); SDValue t8 = DAG.getNode(ISD::FMUL, MVT::f32, t7, X); SDValue t9 = DAG.getNode(ISD::FADD, MVT::f32, t8, - DAG.getConstantFP(APFloat( - APInt(32, 0x3e75fe14)), MVT::f32)); + getF32Constant(DAG, 0x3e75fe14)); SDValue t10 = DAG.getNode(ISD::FMUL, MVT::f32, t9, X); SDValue t11 = DAG.getNode(ISD::FADD, MVT::f32, t10, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f317234)), MVT::f32)); + getF32Constant(DAG, 0x3f317234)); SDValue t12 = DAG.getNode(ISD::FMUL, MVT::f32, t11, X); SDValue t13 = DAG.getNode(ISD::FADD, MVT::f32, t12, - DAG.getConstantFP(APFloat( - APInt(32, 0x3f800000)), MVT::f32)); + getF32Constant(DAG, 0x3f800000)); SDValue t14 = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, t13); SDValue TwoToFractionalPartOfX = DAG.getNode(ISD::ADD, MVT::i32, t14, IntegerPartOfX); From isanbard at gmail.com Sun Sep 21 19:45:00 2008 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 21 Sep 2008 17:45:00 -0700 Subject: [llvm-commits] [llvm] r55968 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp In-Reply-To: References: <200809090028.m890SO7g008287@zion.cs.uiuc.edu> Message-ID: <199D8BE5-7FC2-42BD-8D0F-C23A070D335F@gmail.com> On Sep 21, 2008, at 4:17 PM, Chris Lattner wrote: > On Sep 8, 2008, at 5:28 PM, Bill Wendling wrote: > >> Author: void >> Date: Mon Sep 8 19:28:24 2008 >> New Revision: 55968 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=55968&view=rev >> Log: >> Add support for floating-point calculations of log2 with limited >> precisions of 6 >> and 18. > > Hi Bill, > > This looks like great work, but is it possible to factor this > somehow? It looks like a lot of this is building expressions of the > form (x+c1)*c2. Maybe a helper that took the two constants would > simplify stuff? > > Alternatively, maybe you could just change: > > DAG.getConstantFP(APFloat(APInt(32, > 0xbcd2769e)), MVT::f32)); > > Into a call to a static function: > > getF32Cst(DAG, 0xbcd2769e) > > which would return the SDOperand. > I have deemed this a "good idea" and have henceforth totally implemented it. :-) -bw From clattner at apple.com Sun Sep 21 20:04:13 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 18:04:13 -0700 Subject: [llvm-commits] [llvm] r55968 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp In-Reply-To: <199D8BE5-7FC2-42BD-8D0F-C23A070D335F@gmail.com> References: <200809090028.m890SO7g008287@zion.cs.uiuc.edu> <199D8BE5-7FC2-42BD-8D0F-C23A070D335F@gmail.com> Message-ID: <02F15131-3E81-40E2-A206-2BB3B07653CD@apple.com> On Sep 21, 2008, at 5:45 PM, Bill Wendling wrote: >> Into a call to a static function: >> >> getF32Cst(DAG, 0xbcd2769e) >> >> which would return the SDOperand. >> > I have deemed this a "good idea" and have henceforth totally > implemented it. Thanks Bill :) -Chris From clattner at apple.com Sun Sep 21 20:07:35 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 18:07:35 -0700 Subject: [llvm-commits] [llvm] r56326 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp In-Reply-To: <21171FE7-D099-4281-B86A-F0944DD07C4B@apple.com> References: <200809190102.m8J12ZW2019167@zion.cs.uiuc.edu> <51666910-CAA2-47A5-9F26-809138EE0E5F@apple.com> <10574389-E3FC-4024-AD0D-A462B01F39B4@apple.com> <5C7E7977-A85C-44DB-8D61-5A8AF02E9C6A@apple.com> <21171FE7-D099-4281-B86A-F0944DD07C4B@apple.com> Message-ID: <195CE7BA-AB94-40AC-B4E6-EB01AC814EE6@apple.com> On Sep 19, 2008, at 11:26 AM, Dale Johannesen wrote: >>> On Sep 19, 2008, at 10:48 AMPDT, Evan Cheng wrote: >>>>> >>>>> float weight; // weight of this interval >>>>> + bool isEarlyClobber; >>>>> + bool overlapsEarlyClobber; >>>> >>>> Hi Dale, >>>> >>>> I don't think we want two bits. I'd rather go with one bit and have >>>> register allocator look at both use and def operands. What do you >>>> think? >>> >>> The comment explains why I don't want to do this: >> >> Sorry, I don't follow. Can you provide an example? > > void foo (int x, int y) { > int z=x+y; > int w=x+y; > int t; > asm volatile ("%0 %1 %2" : "=&r"(t) : "r"(z), "r"(w)); > } > > %1 and %2 can share a register, but if there is no way to distinguish > between earlyclobber and overlaps-earlyclobber, we can't do this. > In theory this is a matter of correctness, it is possible to construct > cases where you run out of registers if you don't share. I don't get this at all. How can a *live interval* be an earlyclobber? It seems that the easy and natural way to model this is that the def starts one notch earlier in the use slot of an instruction, instead of it's normal place (the def slot). In other words, I don't understand why this needs to be modeled explicitly in live intervals, the construction of live intervals should just handle the early clobber def as starting one slot early. -Chris From clattner at apple.com Sun Sep 21 20:11:11 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 18:11:11 -0700 Subject: [llvm-commits] [llvm] r56290 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h include/llvm/CodeGen/MachineOperand.h include/llvm/CodeGen/ScheduleDAG.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/MachineInstr.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/SelectionDAG/ScheduleDAGEmit.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp test/CodeGen/X86/2008-09-17-inline-asm-1.ll In-Reply-To: <200809172113.m8HLDDWK014018@zion.cs.uiuc.edu> References: <200809172113.m8HLDDWK014018@zion.cs.uiuc.edu> Message-ID: On Sep 17, 2008, at 2:13 PM, Dale Johannesen wrote: > Author: johannes > Date: Wed Sep 17 16:13:11 2008 > New Revision: 56290 > > URL: http://llvm.org/viewvc/llvm-project?rev=56290&view=rev > Log: > Add a bit to mark operands of asm's that conflict > with an earlyclobber operand elsewhere. Propagate > this bit and the earlyclobber bit through SDISel. > Change linear-scan RA not to allocate regs in a way > that conflicts with an earlyclobber. See also comments. Ok, as per my previous email, I'm either missing something, or the approach is wrong, that said: > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Wed Sep 17 > 16:13:11 2008 > @@ -73,6 +73,12 @@ > /// for description of earlyclobber. > bool IsEarlyClobber : 1; > > + /// OverlapsEarlyClobber - True if this MO_Register operand is > used as an > + /// input to an inline asm that has the earlyclobber bit set on > some other > + /// operand. Flag is not valid for any other case. See gcc doc > + /// for description of earlyclobber. > + bool OverlapsEarlyClobber : 1; Why do you need this bit on MachineOperand? This seems like a property that could be computed by whatever pass wants it, not something that should be stored in MachineOperand. -Chris From clattner at apple.com Sun Sep 21 20:12:37 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 18:12:37 -0700 Subject: [llvm-commits] [llvm] r56384 - in /llvm/trunk/lib/CodeGen: RegAllocLinearScan.cpp SimpleRegisterCoalescing.cpp In-Reply-To: <200809200203.m8K234YA013252@zion.cs.uiuc.edu> References: <200809200203.m8K234YA013252@zion.cs.uiuc.edu> Message-ID: <4F71A860-E342-4A07-8211-0A59A1AA154D@apple.com> On Sep 19, 2008, at 7:03 PM, Dale Johannesen wrote: > Author: johannes > Date: Fri Sep 19 21:03:04 2008 > New Revision: 56384 > > URL: http://llvm.org/viewvc/llvm-project?rev=56384&view=rev > Log: > Teach coalescer about earlyclobber bits. > Check bits for preferred register. If you model the early clobber def as starting one slot early, it will explicitly conflict with all inputs to the asm, and this can be backed out. -Chris > > > > Modified: > llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp > llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp > > Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56384&r1=56383&r2=56384&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) > +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Fri Sep 19 > 21:03:04 2008 > @@ -1122,9 +1122,12 @@ > unsigned FreeRegInactiveCount = 0; > > // If copy coalescer has assigned a "preferred" register, check if > it's > - // available first. > + // available first. Coalescer can create new earlyclobber > interferences, > + // so we need to check that. > if (cur->preference) { > - if (prt_->isRegAvail(cur->preference) && RC->contains(cur- > >preference)) { > + if (prt_->isRegAvail(cur->preference) && > + RC->contains(cur->preference) && > + noEarlyClobberConflict(cur, cur->preference)) { > DOUT << "\t\tassigned the preferred register: " > << tri_->getName(cur->preference) << "\n"; > return cur->preference; > > Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=56384&r1=56383&r2=56384&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) > +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Fri Sep 19 > 21:03:04 2008 > @@ -1206,6 +1206,14 @@ > DOUT << " and "; DstInt.print(DOUT, tri_); > DOUT << ": "; > > + // If one interval is earlyclobber and the other is overlaps- > earlyclobber, > + // we cannot coalesce them. > + if ((SrcInt.isEarlyClobber && DstInt.overlapsEarlyClobber) || > + (DstInt.isEarlyClobber && SrcInt.overlapsEarlyClobber)) { > + DOUT << "\t\tCannot join due to earlyclobber."; > + return false; > + } > + > // Check if it is necessary to propagate "isDead" property. > if (!isExtSubReg && !isInsSubReg) { > MachineOperand *mopd = CopyMI->findRegisterDefOperand(DstReg, > false); > @@ -1366,6 +1374,10 @@ > if (TargetRegisterInfo::isVirtualRegister(DstReg)) > RemoveUnnecessaryKills(DstReg, *ResDstInt); > > + // Merge the earlyclobber bits. > + ResDstInt->isEarlyClobber |= ResSrcInt->isEarlyClobber; > + ResDstInt->overlapsEarlyClobber |= ResSrcInt->overlapsEarlyClobber; > + > if (isInsSubReg) > // Avoid: > // r1024 = op > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From ofv at wanadoo.es Sun Sep 21 20:08:50 2008 From: ofv at wanadoo.es (Oscar Fuentes) Date: Mon, 22 Sep 2008 01:08:50 -0000 Subject: [llvm-commits] [llvm] r56419 - in /llvm/trunk: ./ cmake/ cmake/modules/ examples/ examples/Fibonacci/ include/llvm/ADT/ include/llvm/Config/ include/llvm/Support/ lib/Analysis/ lib/Analysis/IPA/ lib/Archive/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/CodeGen/ lib/CodeGen/AsmPrinter/ lib/CodeGen/SelectionDAG/ lib/Debugger/ lib/ExecutionEngine/ lib/ExecutionEngine/Interpreter/ lib/ExecutionEngine/JIT/ lib/Linker/ lib/Support/ lib/System/ lib/Target/ lib/Target/X86/ lib/Target/X86/AsmPrinter/ lib/Transform... Message-ID: <200809220108.m8M18pZu018730@zion.cs.uiuc.edu> Author: ofv Date: Sun Sep 21 20:08:49 2008 New Revision: 56419 URL: http://llvm.org/viewvc/llvm-project?rev=56419&view=rev Log: Initial support for the CMake build system. Added: llvm/trunk/CMakeLists.txt llvm/trunk/cmake/ llvm/trunk/cmake/config-ix.cmake (with props) llvm/trunk/cmake/config-w32.cmake (with props) llvm/trunk/cmake/modules/ llvm/trunk/cmake/modules/AddLLVM.cmake (with props) llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake (with props) llvm/trunk/cmake/modules/CheckCxxHashmap.cmake (with props) llvm/trunk/cmake/modules/CheckCxxHashset.cmake (with props) llvm/trunk/cmake/modules/FindBison.cmake (with props) llvm/trunk/cmake/modules/LLVMConfig.cmake (with props) llvm/trunk/examples/CMakeLists.txt llvm/trunk/examples/Fibonacci/CMakeLists.txt llvm/trunk/include/llvm/ADT/hash_map.cmake llvm/trunk/include/llvm/ADT/hash_set.cmake llvm/trunk/include/llvm/ADT/iterator.cmake llvm/trunk/include/llvm/Config/config.h.cmake llvm/trunk/include/llvm/Support/DataTypes.h.cmake llvm/trunk/lib/Analysis/CMakeLists.txt llvm/trunk/lib/Analysis/IPA/CMakeLists.txt llvm/trunk/lib/Archive/CMakeLists.txt llvm/trunk/lib/AsmParser/CMakeLists.txt llvm/trunk/lib/Bitcode/Reader/CMakeLists.txt llvm/trunk/lib/Bitcode/Writer/CMakeLists.txt llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt llvm/trunk/lib/CodeGen/CMakeLists.txt llvm/trunk/lib/CodeGen/SelectionDAG/CMakeLists.txt llvm/trunk/lib/Debugger/CMakeLists.txt llvm/trunk/lib/ExecutionEngine/CMakeLists.txt llvm/trunk/lib/ExecutionEngine/Interpreter/CMakeLists.txt llvm/trunk/lib/ExecutionEngine/JIT/CMakeLists.txt llvm/trunk/lib/Linker/CMakeLists.txt llvm/trunk/lib/Support/CMakeLists.txt llvm/trunk/lib/System/CMakeLists.txt llvm/trunk/lib/Target/CMakeLists.txt llvm/trunk/lib/Target/X86/AsmPrinter/CMakeLists.txt llvm/trunk/lib/Target/X86/CMakeLists.txt llvm/trunk/lib/Transforms/Hello/CMakeLists.txt llvm/trunk/lib/Transforms/IPO/CMakeLists.txt llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt llvm/trunk/lib/Transforms/Utils/CMakeLists.txt llvm/trunk/lib/VMCore/CMakeLists.txt llvm/trunk/tools/CMakeLists.txt llvm/trunk/tools/bugpoint/CMakeLists.txt llvm/trunk/tools/llc/CMakeLists.txt llvm/trunk/tools/lli/CMakeLists.txt llvm/trunk/tools/llvm-ar/CMakeLists.txt llvm/trunk/tools/llvm-as/CMakeLists.txt llvm/trunk/tools/llvm-bcanalyzer/CMakeLists.txt llvm/trunk/tools/llvm-config/CMakeLists.txt llvm/trunk/tools/llvm-db/CMakeLists.txt llvm/trunk/tools/llvm-dis/CMakeLists.txt llvm/trunk/tools/llvm-extract/CMakeLists.txt llvm/trunk/tools/llvm-ld/CMakeLists.txt llvm/trunk/tools/llvm-link/CMakeLists.txt llvm/trunk/tools/llvm-nm/CMakeLists.txt llvm/trunk/tools/llvm-prof/CMakeLists.txt llvm/trunk/tools/llvm-ranlib/CMakeLists.txt llvm/trunk/tools/llvm-stub/CMakeLists.txt llvm/trunk/tools/llvmc2/CMakeLists.txt llvm/trunk/tools/opt/CMakeLists.txt llvm/trunk/utils/TableGen/CMakeLists.txt Added: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/CMakeLists.txt (added) +++ llvm/trunk/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,137 @@ +cmake_minimum_required(VERSION 2.6.1) + +set(PACKAGE_NAME llvm) +set(PACKAGE_VERSION svn) +set(PACKAGE_BUGREPORT "ofv at wanadoo.es") +#set(PACKAGE_BUGREPORT "llvmbugs at cs.uiuc.edu") + +include(FindPerl) + +set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include/llvm) +set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin) +set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples) + +# TODO: Support user-specified targets: +set(LLVM_TARGETS_TO_BUILD X86) + +if( NOT MSVC ) + set(CMAKE_CXX_LINK_EXECUTABLE "sh -c \"${CMAKE_CXX_LINK_EXECUTABLE}\"") +endif( NOT MSVC ) + +# TODO: Eliminate? +get_filename_component(llvm_include_path ${LLVM_MAIN_SRC_DIR}/include ABSOLUTE) + +#get_filename_component(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm ABSOLUTE) +set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm) + +# Add path for custom modules +set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} + "${LLVM_MAIN_SRC_DIR}/cmake" + "${LLVM_MAIN_SRC_DIR}/cmake/modules" + ) + +if(WIN32) + set(LLVM_ON_WIN32 1) + set(LLVM_ON_UNIX 0) + set(LTDL_SHLIB_EXT ".dll") + set(EXEEXT ".exe") + # Maximum path length is 160 for non-unicode paths + set(MAXPATHLEN 160) +else(WIN32) + if(UNIX) + set(LLVM_ON_WIN32 0) + set(LLVM_ON_UNIX 1) + set(LTDL_SHLIB_EXT ".so") + set(EXEEXT "") + # FIXME: Maximum path length is currently set to 'safe' fixed value + set(MAXPATHLEN 2024) + else(UNIX) + MESSAGE(SEND_ERROR "Unable to determine platform") + endif(UNIX) +endif(WIN32) + +if( EXISTS ${LLVM_TOOLS_BINARY_DIR}/llvm-config ) + set(HAVE_LLVM_CONFIG 1) +endif( EXISTS ${LLVM_TOOLS_BINARY_DIR}/llvm-config ) +# find_file(HAVE_LLVM_CONFIG llvm-config ${LLVM_TOOLS_BINARY_DIR}) +# message(STATUS ${HAVE_LLVM_CONFIG}) + +if( MSVC ) + message(STATUS "Configuring using MSVC hack.") + include(config-w32) +else( MSVC ) + message(STATUS "Configuring traditional style.") + include(config-ix) +endif( MSVC ) + +set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} ) +set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) +set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib ) + +# set(CMAKE_VERBOSE_MAKEFILE true) + +add_definitions( -D__STDC_LIMIT_MACROS ) + +if( LLVM_ON_UNIX ) + add_definitions( -DLLVM_ON_UNIX ) +else( LLVM_ON_UNIX ) + add_definitions( -DLLVM_ON_WIN32 ) +endif( LLVM_ON_UNIX ) + +if( MSVC ) + add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS ) + add_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS ) + add_definitions( -D_SCL_SECURE_NO_DEPRECATE ) +endif( MSVC ) + +include_directories( ${LLVM_BINARY_DIR}/include ${llvm_include_path}) +#link_directories( d:/dev/lib ) + +#add_subdirectory(lib) + +include(AddLLVM) +include(AddPartiallyLinkedObject) + +add_subdirectory(lib/Support) +add_subdirectory(lib/System) +add_subdirectory(utils/TableGen) + +add_custom_command(OUTPUT ${llvm_builded_incs_dir}/Intrinsics.gen + COMMAND tblgen -gen-intrinsic -I ${llvm_include_path} ${llvm_include_path}/llvm/Intrinsics.td -o ${llvm_builded_incs_dir}/Intrinsics.gen + DEPENDS tblgen + COMMENT "Building intrinsics.gen...") + +add_custom_target(intrinsics_gen ALL + DEPENDS ${llvm_builded_incs_dir}/Intrinsics.gen) + +add_subdirectory(lib/VMCore) +add_subdirectory(lib/CodeGen) +add_subdirectory(lib/CodeGen/SelectionDAG) +add_subdirectory(lib/CodeGen/AsmPrinter) +add_subdirectory(lib/Bitcode/Reader) +add_subdirectory(lib/Bitcode/Writer) +add_subdirectory(lib/Transforms/Utils) +add_subdirectory(lib/Transforms/Instrumentation) +add_subdirectory(lib/Transforms/Scalar) +add_subdirectory(lib/Transforms/IPO) +add_subdirectory(lib/Transforms/Hello) +add_subdirectory(lib/Linker) +add_subdirectory(lib/Analysis) +add_subdirectory(lib/Analysis/IPA) +add_subdirectory(lib/Target/X86) +add_subdirectory(lib/Target/X86/AsmPrinter) +add_subdirectory(lib/ExecutionEngine) +add_subdirectory(lib/ExecutionEngine/Interpreter) +add_subdirectory(lib/ExecutionEngine/JIT) +add_subdirectory(lib/Target) +add_subdirectory(lib/AsmParser) +add_subdirectory(lib/Debugger) +# TODO: lib/Target/CBackEnd +add_subdirectory(lib/Archive) + +add_subdirectory(tools) + +add_subdirectory(examples) Added: llvm/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/cmake/config-ix.cmake (added) +++ llvm/trunk/cmake/config-ix.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,93 @@ + +# include checks +include(CheckIncludeFile) +check_include_file(argz.h HAVE_ARGZ_H) +check_include_file(assert.h HAVE_ASSERT_H) +check_include_file(dirent.h HAVE_DIRENT_H) +check_include_file(dl.h HAVE_DL_H) +check_include_file(dld.h HAVE_DLD_H) +check_include_file(dlfcn.h HAVE_DLFCN_H) +check_include_file(errno.h HAVE_ERRNO_H) +check_include_file(execinfo.h HAVE_EXECINFO_H) +check_include_file(fcntl.h HAVE_FCNTL_H) +check_include_file(inttypes.h HAVE_INTTYPES_H) +check_include_file(limits.h HAVE_LIMITS_H) +check_include_file(link.h HAVE_LINK_H) +check_include_file(malloc.h HAVE_MALLOC_H) +check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H) +check_include_file(memory.h HAVE_MEMORY_H) +check_include_file(ndir.h HAVE_NDIR_H) +check_include_file(pthread.h HAVE_PTHREAD_H) +check_include_file(setjmp.h HAVE_SETJMP_H) +check_include_file(signal.h HAVE_SIGNAL_H) +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(stdio.h HAVE_STDIO_H) +check_include_file(stdlib.h HAVE_STDLIB_H) +check_include_file(sys/dir.h HAVE_SYS_DIR_H) +check_include_file(sys/dl.h HAVE_SYS_DL_H) +check_include_file(sys/mman.h HAVE_SYS_MMAN_H) +check_include_file(sys/ndir.h HAVE_SYS_NDIR_H) +check_include_file(sys/param.h HAVE_SYS_PARAM_H) +check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H) +check_include_file(sys/stat.h HAVE_SYS_STAT_H) +check_include_file(sys/time.h HAVE_SYS_TIME_H) +check_include_file(sys/types.h HAVE_SYS_TYPES_H) +check_include_file(unistd.h HAVE_UNISTD_H) +check_include_file(utime.h HAVE_UTIME_H) + +# function checks +include(CheckSymbolExists) +check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE) +check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE) +check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT) +check_symbol_exists(isinf cmath HAVE_ISINF_IN_CMATH) +check_symbol_exists(isinf math.h HAVE_ISINF_IN_MATH_H) +check_symbol_exists(isnan cmath HAVE_ISNAN_IN_CMATH) +check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H) +check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) +check_symbol_exists(pthread_mutex_lock pthread.h HAVE_PTHREAD_MUTEX_LOCK) + +if( MINGW ) + # tbi: Comprobar que existen las librerias: + set(HAVE_LIBIMAGEHLP 1) + set(HAVE_LIBPSAPI 1) + # include(CheckLibraryExists) + # CHECK_LIBRARY_EXISTS(imagehlp ??? . HAVE_LIBIMAGEHLP) +endif( MINGW ) + +# Classes +include(CheckCxxHashmap) +include(CheckCxxHashset) +check_hashmap() +check_hashset() + +# FIXME: Signal handler return type, currently hardcoded to 'void' +set(RETSIGTYPE void) + +# Disable multithreading for now +set(ENABLE_THREADS 0) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/Config/config.h.cmake + ${LLVM_BINARY_DIR}/include/llvm/Config/config.h + ) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/ADT/iterator.cmake + ${LLVM_BINARY_DIR}/include/llvm/ADT/iterator.h + ) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/Support/DataTypes.h.cmake + ${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h + ) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/ADT/hash_map.cmake + ${LLVM_BINARY_DIR}/include/llvm/ADT/hash_map.h + ) + +configure_file( + ${LLVM_MAIN_INCLUDE_DIR}/ADT/hash_set.cmake + ${LLVM_BINARY_DIR}/include/llvm/ADT/hash_set.h + ) Propchange: llvm/trunk/cmake/config-ix.cmake ------------------------------------------------------------------------------ svn:executable = * Added: llvm/trunk/cmake/config-w32.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-w32.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/cmake/config-w32.cmake (added) +++ llvm/trunk/cmake/config-w32.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,9 @@ +# tbi: Configurar ficheros. +configure_file(${llvm_include_path}/llvm/ADT/hash_map.h.in ${llvm_builded_incs_dir}/ADT/hash_map.h) +configure_file(${llvm_include_path}/llvm/ADT/hash_set.h.in ${llvm_builded_incs_dir}/ADT/hash_set.h) +configure_file(${llvm_include_path}/llvm/ADT/iterator.h.in ${llvm_builded_incs_dir}/ADT/iterator.h) +configure_file(${llvm_include_path}/llvm/Support/DataTypes.h.in ${llvm_builded_incs_dir}/Support/DataTypes.h) +configure_file(${llvm_include_path}/llvm/Config/config.h.in ${llvm_builded_incs_dir}/Config/config.h) + +file(READ ${llvm_include_path}/../win32/config.h vc_config_text) +file(APPEND ${llvm_builded_incs_dir}/Config/config.h ${vc_config_text}) Propchange: llvm/trunk/cmake/config-w32.cmake ------------------------------------------------------------------------------ svn:executable = * Added: llvm/trunk/cmake/modules/AddLLVM.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/cmake/modules/AddLLVM.cmake (added) +++ llvm/trunk/cmake/modules/AddLLVM.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,39 @@ +include(LLVMConfig) + +macro(add_llvm_library name) + add_library( ${name} ${ARGN} ) + set( llvm_libs ${llvm_libs} ${name} PARENT_SCOPE) +endmacro(add_llvm_library name) + + +macro(add_llvm_executable name) + add_executable(${name} ${ARGN}) + if( LLVM_LINK_COMPONENTS ) + llvm_config(${name} ${LLVM_LINK_COMPONENTS}) + endif( LLVM_LINK_COMPONENTS ) + if( MSVC ) + target_link_libraries(${name} ${llvm_libs}) + else( MSVC ) + add_dependencies(${name} llvm-config.target) + set_target_properties(${name} + PROPERTIES + LINK_FLAGS "-L ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}") + if( MINGW ) + target_link_libraries(${name} DbgHelp psapi) + elseif( CMAKE_HOST_UNIX ) + target_link_libraries(${name} dl) + endif( MINGW ) + endif( MSVC ) +endmacro(add_llvm_executable name) + + +macro(add_llvm_tool name) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR}) + add_llvm_executable(${name} ${ARGN}) +endmacro(add_llvm_tool name) + + +macro(add_llvm_example name) +# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_EXAMPLES_BINARY_DIR}) + add_llvm_executable(${name} ${ARGN}) +endmacro(add_llvm_example name) Propchange: llvm/trunk/cmake/modules/AddLLVM.cmake ------------------------------------------------------------------------------ svn:executable = * Added: llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake (added) +++ llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,21 @@ + +macro(add_partially_linked_object lib) + if( MSVC ) + add_llvm_library( ${lib} ${ARGN}) + else( MSVC ) + set(pll ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${lib}.o) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib) + add_library( ${lib} STATIC ${ARGN}) + add_custom_command(OUTPUT ${pll} + MESSAGE "Building ${lib}.o..." + DEPENDS ${lib} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib + COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX} + COMMAND ld -r *${CMAKE_CXX_OUTPUT_EXTENSION} -o ${pll} + COMMAND rm -f *${CMAKE_CXX_OUTPUT_EXTENSION} + ) + add_custom_target(${lib}_pll ALL DEPENDS ${pll}) + set( llvm_libs ${llvm_libs} ${pll} PARENT_SCOPE) + endif( MSVC ) +endmacro(add_partially_linked_object lib) Propchange: llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake ------------------------------------------------------------------------------ svn:executable = * Added: llvm/trunk/cmake/modules/CheckCxxHashmap.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CheckCxxHashmap.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/cmake/modules/CheckCxxHashmap.cmake (added) +++ llvm/trunk/cmake/modules/CheckCxxHashmap.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,53 @@ +# - Check if for hash_map. +# CHECK_HASHMAP () +# + +include(CheckCXXSourceCompiles) + +macro(CHECK_HASHMAP) + message(STATUS "Checking for C++ hash_map implementation...") + check_cxx_source_compiles(" + #include + int main() { + __gnu_cxx::hash_map t; + } +" + HAVE_GNU_EXT_HASH_MAP + ) + if(HAVE_GNU_EXT_HASH_MAP) + message(STATUS "C++ hash_map found in 'ext' dir in namespace __gnu_cxx::") + endif(HAVE_GNU_EXT_HASH_MAP) + + check_cxx_source_compiles(" + #include + int main() { + std::hash_map t; + } +" + HAVE_STD_EXT_HASH_MAP + ) + if(HAVE_STD_EXT_HASH_MAP) + message(STATUS "C++ hash_map found in 'ext' dir in namespace std::") + endif(HAVE_STD_EXT_HASH_MAP) + + check_cxx_source_compiles(" + #include + int main() { + hash_map t; + } +" + HAVE_GLOBAL_HASH_MAP + ) + if(HAVE_GLOBAL_HASH_MAP) + message(STATUS "C++ hash_map found in global namespace") + endif(HAVE_GLOBAL_HASH_MAP) + + if(NOT HAVE_GNU_EXT_HASH_MAP) + if(NOT HAVE_STD_EXT_HASH_MAP) + if(NOT HAVE_GLOBAL_HASH_MAP) + message(STATUS "C++ hash_map not found") + endif(NOT HAVE_GLOBAL_HASH_MAP) + endif(NOT HAVE_STD_EXT_HASH_MAP) + endif(NOT HAVE_GNU_EXT_HASH_MAP) + +endmacro(CHECK_HASHMAP) Propchange: llvm/trunk/cmake/modules/CheckCxxHashmap.cmake ------------------------------------------------------------------------------ svn:executable = * Added: llvm/trunk/cmake/modules/CheckCxxHashset.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CheckCxxHashset.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/cmake/modules/CheckCxxHashset.cmake (added) +++ llvm/trunk/cmake/modules/CheckCxxHashset.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,52 @@ +# - Check if for hash_set. +# CHECK_HASHSET () +# + +include(CheckCXXSourceCompiles) + +macro(CHECK_HASHSET) + message(STATUS "Checking for C++ hash_set implementation...") + check_cxx_source_compiles(" + #include + int main() { + __gnu_cxx::hash_set t; + } +" + HAVE_GNU_EXT_HASH_SET + ) + if(HAVE_GNU_EXT_HASH_SET) + message(STATUS "C++ hash_set found in 'ext' dir in namespace __gnu_cxx::") + endif(HAVE_GNU_EXT_HASH_SET) + + check_cxx_source_compiles(" + #include + int main() { + std::hash_set t; + } +" + HAVE_STD_EXT_HASH_SET + ) + if(HAVE_STD_EXT_HASH_SET) + message(STATUS "C++ hash_set found in 'ext' dir in namespace std::") + endif(HAVE_STD_EXT_HASH_SET) + + check_cxx_source_compiles(" + #include + int main() { + hash_set t; + } +" + HAVE_GLOBAL_HASH_SET + ) + if(HAVE_GLOBAL_HASH_SET) + message(STATUS "C++ hash_set found in global namespace") + endif(HAVE_GLOBAL_HASH_SET) + + if(NOT HAVE_GNU_EXT_HASH_SET) + if(NOT HAVE_STD_EXT_HASH_SET) + if(NOT HAVE_GLOBAL_HASH_SET) + message(STATUS "C++ hash_set not found") + endif(NOT HAVE_GLOBAL_HASH_SET) + endif(NOT HAVE_STD_EXT_HASH_SET) + endif(NOT HAVE_GNU_EXT_HASH_SET) +endmacro(CHECK_HASHSET) Propchange: llvm/trunk/cmake/modules/CheckCxxHashset.cmake ------------------------------------------------------------------------------ svn:executable = * Added: llvm/trunk/cmake/modules/FindBison.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/FindBison.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/cmake/modules/FindBison.cmake (added) +++ llvm/trunk/cmake/modules/FindBison.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,52 @@ +# - Try to find Bison +# Once done this will define +# +# BISON_FOUND - system has Bison +# BISON_EXECUTABLE - path of the bison executable +# BISON_VERSION - the version string, like "2.5.31" +# + +MACRO(FIND_BISON) + FIND_PROGRAM(BISON_EXECUTABLE NAMES bison) + + IF(BISON_EXECUTABLE) + SET(BISON_FOUND TRUE) + + EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version + OUTPUT_VARIABLE _BISON_VERSION + ) + string (REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" BISON_VERSION "${_bison_VERSION}") + ENDIF(BISON_EXECUTABLE) + + IF(BISON_FOUND) + IF(NOT Bison_FIND_QUIETLY) + MESSAGE(STATUS "Found Bison: ${BISON_EXECUTABLE}") + ENDIF(NOT Bison_FIND_QUIETLY) + ELSE(BISON_FOUND) + IF(Bison_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find Bison") + ENDIF(Bison_FIND_REQUIRED) + ENDIF(BISON_FOUND) +ENDMACRO(FIND_BISON) + +MACRO(BISON_GENERATOR _PREFIX _Y_INPUT _H_OUTPUT _CPP_OUTPUT) + IF(BISON_EXECUTABLE) + GET_FILENAME_COMPONENT(_Y_DIR ${_Y_INPUT} PATH) + ADD_CUSTOM_COMMAND( + OUTPUT ${_CPP_OUTPUT} + OUTPUT ${_H_OUTPUT} + DEPENDS ${_Y_INPUT} + COMMAND ${BISON_EXECUTABLE} + ARGS + -p ${_PREFIX} -o"${_CPP_OUTPUT}" + --defines="${_H_OUTPUT}" ${_Y_INPUT} + WORKING_DIRECTORY ${_Y_DIR} + ) + SET_SOURCE_FILES_PROPERTIES( + ${_CPP_OUTPUT} ${_H_OUTPUT} + GENERATED + ) + ELSE(BISON_EXECUTABLE) + MESSAGE(SEND_ERROR "Can't find bison program, and it's required") + ENDIF(BISON_EXECUTABLE) +ENDMACRO(BISON_GENERATOR) Propchange: llvm/trunk/cmake/modules/FindBison.cmake ------------------------------------------------------------------------------ svn:executable = * Added: llvm/trunk/cmake/modules/LLVMConfig.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMConfig.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/cmake/modules/LLVMConfig.cmake (added) +++ llvm/trunk/cmake/modules/LLVMConfig.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,57 @@ +macro(llvm_config executable link_components) + if( MSVC ) + msvc_llvm_config(${executable} ${link_components}) + else( MSVC ) + nix_llvm_config(${executable} ${link_components}) + endif( MSVC ) +endmacro(llvm_config executable link_components) + + +macro(msvc_llvm_config executable link_components) + foreach(c ${link_components}) + message(STATUS ${c}) + if( c STREQUAL "jit" ) + message(STATUS "linking jit") + set_target_properties(${executable} + PROPERTIES + LINK_FLAGS "/INCLUDE:_X86TargetMachineModule") + endif( c STREQUAL "jit" ) + endforeach(c) + target_link_libraries(${executable} ${llvm_libs}) +endmacro(msvc_llvm_config executable link_components) + + +macro(nix_llvm_config executable link_components) + set(lc "") + foreach(c ${LLVM_LINK_COMPONENTS}) + set(lc "${lc} ${c}") + endforeach(c) + if( NOT HAVE_LLVM_CONFIG ) + target_link_libraries(${executable} + "`${LLVM_TOOLS_BINARY_DIR}/llvm-config --libs ${lc}`") + else( NOT HAVE_LLVM_CONFIG ) + # tbi: Error handling. + if( NOT PERL_FOUND ) + message(FATAL_ERROR "Perl required but not found!") + endif( NOT PERL_FOUND ) + execute_process( + COMMAND sh -c "${PERL_EXECUTABLE} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/llvm-config --libs ${lc}" + RESULT_VARIABLE rv + OUTPUT_VARIABLE libs + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT rv EQUAL 0) + message(FATAL_ERROR "llvm-config failed for executable ${executable}") + endif(NOT rv EQUAL 0) + string(REPLACE " " ";" libs ${libs}) + foreach(c ${libs}) + if(c MATCHES ".*\\.o") + get_filename_component(fn ${c} NAME) + target_link_libraries(${executable} + ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${fn}) + else(c MATCHES ".*\\.o") + string(REPLACE "-l" "" fn ${c}) + target_link_libraries(${executable} ${fn}) + endif(c MATCHES ".*\\.o") + endforeach(c) + endif( NOT HAVE_LLVM_CONFIG ) +endmacro(nix_llvm_config executable link_components) Propchange: llvm/trunk/cmake/modules/LLVMConfig.cmake ------------------------------------------------------------------------------ svn:executable = * Added: llvm/trunk/examples/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/examples/CMakeLists.txt (added) +++ llvm/trunk/examples/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1 @@ +add_subdirectory(Fibonacci) \ No newline at end of file Added: llvm/trunk/examples/Fibonacci/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Fibonacci/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/examples/Fibonacci/CMakeLists.txt (added) +++ llvm/trunk/examples/Fibonacci/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS jit interpreter nativecodegen) + +add_llvm_example(Fibonacci + fibonacci.cpp + ) Added: llvm/trunk/include/llvm/ADT/hash_map.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/hash_map.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/include/llvm/ADT/hash_map.cmake (added) +++ llvm/trunk/include/llvm/ADT/hash_map.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,150 @@ +//===-- llvm/ADT/hash_map - "Portable" wrapper around hash_map --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file provides a wrapper around the mysterious header file +// that seems to move around between GCC releases into and out of namespaces at +// will. #including this header will cause hash_map to be available in the +// global namespace. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_HASH_MAP +#define LLVM_ADT_HASH_MAP + +// Compiler Support Matrix +// +// Version Namespace Header File +// 2.95.x :: hash_map +// 3.0.4 std ext/hash_map +// 3.1 __gnu_cxx ext/hash_map +// HP aCC6 std stdex/rw/hashm*ap.h +// MS VC++ stdext hash_map + +#cmakedefine HAVE_GNU_EXT_HASH_MAP +#cmakedefine HAVE_STD_EXT_HASH_MAP +#cmakedefine HAVE_GLOBAL_HASH_MAP +#cmakedefine HAVE_RW_STDEX_HASH_MAP_H + +#if defined(HAVE_GNU_EXT_HASH_MAP) +// This is for GCC-3.1+ which puts hash in ext/hash_map +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE __gnu_cxx +# endif + +// GCC 3.0.x puts hash_map in and in the std namespace. +#elif defined(HAVE_STD_EXT_HASH_MAP) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE std +# endif + +// Older compilers such as GCC before version 3.0 do not keep +// extensions in the `ext' directory, and ignore the `std' namespace. +#elif defined(HAVE_GLOBAL_HASH_MAP) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE std +# endif + +// HP aCC doesn't include an SGI-like hash_map. For this platform (or +// any others using Rogue Wave Software's Tools.h++ library), we wrap +// around them in std:: +#elif defined(HAVE_RW_STDEX_HASH_MAP_H) +# include +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE std +# endif + +// Support Microsoft VC++. +#elif defined(_MSC_VER) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE stdext + using std::_Distance; +# endif + +// Give a warning if we couldn't find it, instead of (or in addition to) +// randomly doing something dumb. +#else +# warning "Autoconfiguration failed to find the hash_map header file." +#endif + +// we wrap Rogue Wave Tools.h++ rw_hashmap into something SGI-looking, here: +#ifdef HAVE_RW_STDEX_HASH_MAP_H +namespace HASH_NAMESPACE { + +template struct hash { + unsigned int operator()(const unsigned int& x) const { + return x; + } +}; + +template , + class _EqualKey = equal_to, + class _A = allocator > +class hash_map : public rw_hashmap { +}; + +template , + class _EqualKey = equal_to, + class _A = allocator > +class hash_multimap : public rw_hashmultimap { +}; + +} // end HASH_NAMESPACE; +#endif + +// Include vector because ext/hash_map includes stl_vector.h and leaves +// out specializations like stl_bvector.h, causing link conflicts. +#include + +#ifdef _MSC_VER + +// GCC and VC++ have differing ways of implementing hash_maps. As it's not +// standardized, that's to be expected. This adapter class allows VC++ +// hash_map to use GCC's hash classes. +namespace stdext { + template struct hash; + + // Provide a hash function for unsigned ints... + template<> struct hash { + inline size_t operator()(unsigned int Val) const { + return Val; + } + }; + + template class hash_compare > { + std::less comp; + public: + enum { bucket_size = 4 }; + enum { min_buckets = 8 }; + hash_compare() {} + hash_compare(std::less pred) : comp(pred) {} + size_t operator()(const Key& key) const { return hash()(key); } + bool operator()(const Key& k1, const Key& k2) const { return comp(k1, k2); } + }; +} + +#endif + +using HASH_NAMESPACE::hash_map; +using HASH_NAMESPACE::hash_multimap; +using HASH_NAMESPACE::hash; + +#include "llvm/ADT/HashExtras.h" + +#endif Added: llvm/trunk/include/llvm/ADT/hash_set.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/hash_set.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/include/llvm/ADT/hash_set.cmake (added) +++ llvm/trunk/include/llvm/ADT/hash_set.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,111 @@ +//===-- llvm/ADT/hash_set - "Portable" wrapper around hash_set --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// vim:ft=cpp +// +// This file provides a wrapper around the mysterious header file +// that seems to move around between GCC releases into and out of namespaces at +// will. #including this header will cause hash_set to be available in the +// global namespace. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_HASH_SET +#define LLVM_ADT_HASH_SET + +// Compiler Support Matrix +// +// Version Namespace Header File +// 2.95.x :: hash_set +// 3.0.4 std ext/hash_set +// 3.1 __gnu_cxx ext/hash_set +// HP aCC6 std stdex/rw/hashset.h +// MS VC++ stdext hash_set + +#cmakedefine HAVE_GNU_EXT_HASH_SET +#cmakedefine HAVE_STD_EXT_HASH_SET +#cmakedefine HAVE_GLOBAL_HASH_SET +#cmakedefine HAVE_RW_STDEX_HASH_SET_H + +// GCC versions 3.1 and later put hash_set in and in +// the __gnu_cxx namespace. +#if defined(HAVE_GNU_EXT_HASH_SET) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE __gnu_cxx +# endif + +// GCC 3.0.x puts hash_set in and in the std namespace. +#elif defined(HAVE_STD_EXT_HASH_SET) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE std +# endif + +// Older compilers such as GCC before version 3.0 do not keep +// extensions in the `ext' directory, and ignore the `std' namespace. +#elif defined(HAVE_GLOBAL_HASH_SET) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE std +# endif + +// HP aCC doesn't include an SGI-like hash_set. For this platform (or +// any others using Rogue Wave Software's Tools.h++ library), we wrap +// around them in std:: +#elif defined(HAVE_RW_STDEX_HASH_SET_H) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE std +# endif + +// Support Microsoft VC++. +#elif defined(_MSC_VER) +# include +# ifndef HASH_NAMESPACE +# define HASH_NAMESPACE stdext +# endif + +// Give a warning if we couldn't find it, instead of (or in addition to) +// randomly doing something dumb. +#else +# warning "Autoconfiguration failed to find the hash_set header file." +#endif + +// we wrap Rogue Wave Tools.h++ rw_hashset into something SGI-looking, here: +#ifdef HAVE_RW_STDEX_HASH_SET_H +namespace HASH_NAMESPACE { + +/* +template struct hash { + unsigned int operator()(const unsigned int& x) const { + return x; + } +}; +*/ + +template , + class _EqualKey = equal_to, + class _A = allocator > +class hash_set : + public rw_hashset { +}; + +} // end HASH_NAMESPACE; +#endif + +using HASH_NAMESPACE::hash_set; + +// Include vector because ext/hash_set includes stl_vector.h and leaves +// out specializations like stl_bvector.h, causing link conflicts. +#include + +#include "llvm/ADT/HashExtras.h" + +#endif Added: llvm/trunk/include/llvm/ADT/iterator.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/iterator.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/include/llvm/ADT/iterator.cmake (added) +++ llvm/trunk/include/llvm/ADT/iterator.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,79 @@ +//===-- llvm/ADT/iterator - Portable wrapper around --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file provides a wrapper around the mysterious header file. +// In GCC 2.95.3, the file defines a bidirectional_iterator class (and other +// friends), instead of the standard iterator class. In GCC 3.1, the +// bidirectional_iterator class got moved out and the new, standards compliant, +// iterator<> class was added. Because there is nothing that we can do to get +// correct behavior on both compilers, we have this header with #ifdef's. Gross +// huh? +// +// By #includ'ing this file, you get the contents of plus the +// following classes in the global namespace: +// +// 1. bidirectional_iterator +// 2. forward_iterator +// +// The #if directives' expressions are filled in by Autoconf. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_ITERATOR +#define LLVM_ADT_ITERATOR + +#include + +#undef HAVE_BI_ITERATOR +#undef HAVE_STD_ITERATOR +#undef HAVE_FWD_ITERATOR + +// defined by Kevin +#define HAVE_STD_ITERATOR 1 + +#ifdef _MSC_VER +# define HAVE_BI_ITERATOR 0 +# define HAVE_STD_ITERATOR 1 +# define HAVE_FWD_ITERATOR 0 +#endif + +#if !HAVE_BI_ITERATOR +# if HAVE_STD_ITERATOR +/// If the bidirectional iterator is not defined, we attempt to define it in +/// terms of the C++ standard iterator. Otherwise, we import it with a "using" +/// statement. +/// +template +struct bidirectional_iterator + : public std::iterator { +}; +# else +# error "Need to have standard iterator to define bidirectional iterator!" +# endif +#else +using std::bidirectional_iterator; +#endif + +#if !HAVE_FWD_ITERATOR +# if HAVE_STD_ITERATOR +/// If the forward iterator is not defined, attempt to define it in terms of +/// the C++ standard iterator. Otherwise, we import it with a "using" statement. +/// +template +struct forward_iterator + : public std::iterator { +}; +# else +# error "Need to have standard iterator to define forward iterator!" +# endif +#else +using std::forward_iterator; +#endif + +#endif Added: llvm/trunk/include/llvm/Config/config.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.cmake (added) +++ llvm/trunk/include/llvm/Config/config.h.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,558 @@ + +/************************************** +** Created by Kevin from config.h.in ** +***************************************/ + +/* Define if dlopen(0) will open the symbols of the program */ +#undef CAN_DLOPEN_SELF + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define if CBE is enabled for printf %a output */ +#undef ENABLE_CBE_PRINTF_A + +/* Define if position independent code is enabled */ +#undef ENABLE_PIC + +/* Define if threads enabled */ +#cmakedefine ENABLE_THREADS ${ENABLE_THREADS} + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the `argz_append' function. */ +#undef HAVE_ARGZ_APPEND + +/* Define to 1 if you have the `argz_create_sep' function. */ +#undef HAVE_ARGZ_CREATE_SEP + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ARGZ_H ${HAVE_ARGZ_H} + +/* Define to 1 if you have the `argz_insert' function. */ +#undef HAVE_ARGZ_INSERT + +/* Define to 1 if you have the `argz_next' function. */ +#undef HAVE_ARGZ_NEXT + +/* Define to 1 if you have the `argz_stringify' function. */ +#undef HAVE_ARGZ_STRINGIFY + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ASSERT_H ${HAVE_ASSERT_H} + +/* Define to 1 if you have the `backtrace' function. */ +#undef HAVE_BACKTRACE + +/* Define to 1 if you have the `bcopy' function. */ +#undef HAVE_BCOPY + +/* Does not have bi-directional iterator */ +#undef HAVE_BI_ITERATOR + +/* Define to 1 if you have the `ceilf' function. */ +#undef HAVE_CEILF + +/* Define to 1 if you have the `closedir' function. */ +#undef HAVE_CLOSEDIR + +/* Define to 1 if you have the header file. */ +#undef HAVE_CTYPE_H + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#cmakedefine HAVE_DIRENT_H ${HAVE_DIRENT_H} + +/* Define if you have the GNU dld library. */ +#undef HAVE_DLD + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLD_H ${HAVE_DLD_H} + +/* Define to 1 if you have the `dlerror' function. */ +#undef HAVE_DLERROR + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H ${HAVE_DLFCN_H} + +/* Define if dlopen() is available on this platform. */ +#undef HAVE_DLOPEN + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DL_H ${HAVE_DL_H} + +/* Define if the dot program is available */ +#undef HAVE_DOT + +/* Define if the dotty program is available */ +#undef HAVE_DOTTY + +/* Define if you have the _dyld_func_lookup function. */ +#undef HAVE_DYLD + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ERRNO_H ${HAVE_ERRNO_H} + +/* Define to 1 if the system has the type `error_t'. */ +#undef HAVE_ERROR_T + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_EXECINFO_H ${HAVE_EXECINFO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FCNTL_H ${HAVE_FCNTL_H} + +/* Set to 1 if the finite function is found in */ +#undef HAVE_FINITE_IN_IEEEFP_H + +/* Define to 1 if you have the `floorf' function. */ +#undef HAVE_FLOORF + +/* Does not have forward iterator */ +#undef HAVE_FWD_ITERATOR + +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define to 1 if you have the `getpagesize' function. */ +#cmakedefine HAVE_GETPAGESIZE ${HAVE_GETPAGESIZE} + +/* Define to 1 if you have the `getrlimit' function. */ +#undef HAVE_GETRLIMIT + +/* Define to 1 if you have the `getrusage' function. */ +#cmakedefine HAVE_GETRUSAGE ${HAVE_GETRUSAGE} + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Does not have */ +#undef HAVE_GLOBAL_HASH_MAP + +/* Does not have hash_set in global namespace */ +#undef HAVE_GLOBAL_HASH_SET + +/* Does not have ext/hash_map */ +#undef HAVE_GNU_EXT_HASH_MAP + +/* Does not have hash_set in gnu namespace */ +#undef HAVE_GNU_EXT_HASH_SET + +/* Define if the Graphviz program is available */ +#undef HAVE_GRAPHVIZ + +/* Define if the gv program is available */ +#undef HAVE_GV + +/* Define to 1 if you have the `index' function. */ +#undef HAVE_INDEX + +/* Define to 1 if the system has the type `int64_t'. */ +#undef HAVE_INT64_T + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H} + +/* Define to 1 if you have the `isatty' function. */ +#undef HAVE_ISATTY + +/* Set to 1 if the isinf function is found in */ +#cmakedefine HAVE_ISINF_IN_CMATH ${HAVE_ISINF_IN_CMATH} + +/* Set to 1 if the isinf function is found in */ +#cmakedefine HAVE_ISINF_IN_MATH_H ${HAVE_ISINF_IN_MATH_H} + +/* Set to 1 if the isnan function is found in */ +#cmakedefine HAVE_ISNAN_IN_CMATH ${HAVE_ISNAN_IN_CMATH} + +/* Set to 1 if the isnan function is found in */ +#cmakedefine HAVE_ISNAN_IN_MATH_H ${HAVE_ISNAN_IN_MATH_H} + +/* Define if you have the libdl library or equivalent. */ +#undef HAVE_LIBDL + +/* Define to 1 if you have the `elf' library (-lelf). */ +#undef HAVE_LIBELF + +/* Define to 1 if you have the `imagehlp' library (-limagehlp). */ +#cmakedefine HAVE_LIBIMAGEHLP ${HAVE_LIBIMAGEHLP} + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `psapi' library (-lpsapi). */ +#cmakedefine HAVE_LIBPSAPI ${HAVE_LIBPSAPI} + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD + +/* Define to 1 if you have the `udis86' library (-ludis86). */ +#undef HAVE_LIBUDIS86 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIMITS_H ${HAVE_LIMITS_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LINK_H ${HAVE_LINK_H} + +/* Define if you can use -Wl,-R. to pass -R. to the linker, in order to add + the current directory to the dynamic linker search path. */ +#undef HAVE_LINK_R + +/* Define to 1 if you have the `longjmp' function. */ +#undef HAVE_LONGJMP + +/* Define if lt_dlopen() is available on this platform */ +#undef HAVE_LT_DLOPEN + +/* Define to 1 if you have the header file. */ +#undef HAVE_MACH_MACH_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MACH_O_DYLD_H + +/* Define if mallinfo() is available on this platform. */ +#cmakedefine HAVE_MALLINFO ${HAVE_MALLINFO} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MALLOC_H ${HAVE_MALLOC_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MALLOC_MALLOC_H ${HAVE_MALLOC_MALLOC_H} + +/* Define to 1 if you have the `malloc_zone_statistics' function. */ +#undef HAVE_MALLOC_ZONE_STATISTICS + +/* Define to 1 if you have the `memcpy' function. */ +#undef HAVE_MEMCPY + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MEMORY_H ${HAVE_MEMORY_H} + +/* Define to 1 if you have the `mkdtemp' function. */ +#undef HAVE_MKDTEMP + +/* Define to 1 if you have the `mkstemp' function. */ +#undef HAVE_MKSTEMP + +/* Define to 1 if you have the `mktemp' function. */ +#undef HAVE_MKTEMP + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if + it uses MAP_ANON */ +#undef HAVE_MMAP_ANONYMOUS + +/* Define if mmap() can map files into memory */ +#undef HAVE_MMAP_FILE + +/* define if the compiler implements namespaces */ +#undef HAVE_NAMESPACES + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#cmakedefine HAVE_NDIR_H ${HAVE_NDIR_H} + +/* Define to 1 if you have the `nearbyintf' function. */ +#undef HAVE_NEARBYINTF + +/* Define to 1 if you have the `opendir' function. */ +#undef HAVE_OPENDIR + +/* Define if libtool can extract symbol lists from object files. */ +#undef HAVE_PRELOADED_SYMBOLS + +/* Define to have the %a format string */ +#undef HAVE_PRINTF_A + +/* Have pthread_mutex_lock */ +#cmakedefine HAVE_PTHREAD_MUTEX_LOCK ${HAVE_PTHREAD_MUTEX_LOCK} + +/* Define to 1 if srand48/lrand48/drand48 exist in */ +#undef HAVE_RAND48 + +/* Define to 1 if you have the `readdir' function. */ +#undef HAVE_READDIR + +/* Define to 1 if you have the `realpath' function. */ +#undef HAVE_REALPATH + +/* Define to 1 if you have the `rindex' function. */ +#undef HAVE_RINDEX + +/* Define to 1 if you have the `rintf' function. */ +#undef HAVE_RINTF + +/* Define to 1 if you have the `roundf' function. */ +#undef HAVE_ROUNDF + +/* Define to 1 if you have the `sbrk' function. */ +#undef HAVE_SBRK + +/* Define to 1 if you have the `setjmp' function. */ +#undef HAVE_SETJMP + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SETJMP_H ${HAVE_SETJMP_H} + +/* Define to 1 if you have the `setrlimit' function. */ +#cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT} + +/* Define if you have the shl_load function. */ +#undef HAVE_SHL_LOAD + +/* Define to 1 if you have the `siglongjmp' function. */ +#undef HAVE_SIGLONGJMP + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SIGNAL_H ${HAVE_SIGNAL_H} + +/* Define to 1 if you have the `sigsetjmp' function. */ +#undef HAVE_SIGSETJMP + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDIO_H ${HAVE_STDIO_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDLIB_H ${HAVE_STDLIB_H} + +/* Does not have ext/hash_map> */ +#undef HAVE_STD_EXT_HASH_MAP + +/* Does not have hash_set in std namespace */ +#undef HAVE_STD_EXT_HASH_SET + +/* Set to 1 if the std::isinf function is found in */ +#undef HAVE_STD_ISINF_IN_CMATH + +/* Set to 1 if the std::isnan function is found in */ +#undef HAVE_STD_ISNAN_IN_CMATH + +/* Does not have std namespace iterator */ +#undef HAVE_STD_ITERATOR + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strcmp' function. */ +#undef HAVE_STRCMP + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the `strerror_r' function. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strrchr' function. */ +#undef HAVE_STRRCHR + +/* Define to 1 if you have the `strtoll' function. */ +#undef HAVE_STRTOLL + +/* Define to 1 if you have the `strtoq' function. */ +#undef HAVE_STRTOQ + +/* Define to 1 if you have the `sysconf' function. */ +#undef HAVE_SYSCONF + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#cmakedefine HAVE_SYS_DIR_H ${HAVE_SYS_DIR_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_DL_H ${HAVE_SYS_DL_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_MMAN_H ${} + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#cmakedefine HAVE_SYS_NDIR_H ${HAVE_SYS_NDIR_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_PARAM_H ${HAVE_SYS_PARAM_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H ${HAVE_SYS_STAT_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H ${HAVE_SYS_TIME_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H} + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if the system has the type `uint64_t'. */ +#undef HAVE_UINT64_T + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H ${HAVE_UNISTD_H} + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UTIME_H ${HAVE_UTIME_H} + +/* Define to 1 if the system has the type `u_int64_t'. */ +#undef HAVE_U_INT64_T + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINDOWS_H + +/* Installation directory for binary executables */ +#undef LLVM_BINDIR + +/* Time at which LLVM was configured */ +#undef LLVM_CONFIGTIME + +/* Installation directory for documentation */ +#undef LLVM_DATADIR + +/* Installation directory for config files */ +#undef LLVM_ETCDIR + +/* Installation directory for include files */ +#undef LLVM_INCLUDEDIR + +/* Installation directory for .info files */ +#undef LLVM_INFODIR + +/* Installation directory for libraries */ +#undef LLVM_LIBDIR + +/* Installation directory for man pages */ +#undef LLVM_MANDIR + +/* Define if this is Unixish platform */ +#cmakedefine LLVM_ON_UNIX ${LLVM_ON_UNIX} + +/* Define if this is Win32ish platform */ +#cmakedefine LLVM_ON_WIN32 ${LLVM_ON_WIN32} + +/* Added by Kevin -- Maximum path length */ +#cmakedefine MAXPATHLEN ${MAXPATHLEN} + +/* Define to path to dot program if found or 'echo dot' otherwise */ +#undef LLVM_PATH_DOT + +/* Define to path to dotty program if found or 'echo dotty' otherwise */ +#undef LLVM_PATH_DOTTY + +/* Define to path to Graphviz program if found or 'echo Graphviz' otherwise */ +#undef LLVM_PATH_GRAPHVIZ + +/* Define to path to gv program if found or 'echo gv' otherwise */ +#undef LLVM_PATH_GV + +/* Installation prefix directory */ +#undef LLVM_PREFIX + +/* Define if the OS needs help to load dependent libraries for dlopen(). */ +#undef LTDL_DLOPEN_DEPLIBS + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LTDL_OBJDIR + +/* Define to the name of the environment variable that determines the dynamic + library search path. */ +#undef LTDL_SHLIBPATH_VAR + +/* Define to the extension used for shared libraries, say, ".so". */ +#cmakedefine LTDL_SHLIB_EXT "${LTDL_SHLIB_EXT}" + +/* Define to the system default library search path. */ +#undef LTDL_SYSSEARCHPATH + +/* Define if /dev/zero should be used when mapping RWX memory, or undefine if + its not necessary */ +#undef NEED_DEV_ZERO_FOR_MMAP + +/* Define if dlsym() requires a leading underscore in symbol names. */ +#undef NEED_USCORE + +/* Define to the address where bug reports for this package should be sent. */ +#cmakedefine PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}" + +/* Define to the full name of this package. */ +#cmakedefine PACKAGE_NAME "${PACKAGE_NAME}" + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}" + +/* Define as the return type of signal handlers (`int' or `void'). */ +#cmakedefine RETSIGTYPE ${RETSIGTYPE} + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if the `S_IS*' macros in do not work properly. */ +#undef STAT_MACROS_BROKEN + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define to 1 if your declares `struct tm'. */ +#undef TM_IN_SYS_TIME + +/* Define if use udis86 library */ +#undef USE_UDIS86 + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to a type to use for `error_t' if it is not otherwise available. */ +#undef error_t + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t Added: llvm/trunk/include/llvm/Support/DataTypes.h.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DataTypes.h.cmake?rev=56419&view=auto ============================================================================== --- llvm/trunk/include/llvm/Support/DataTypes.h.cmake (added) +++ llvm/trunk/include/llvm/Support/DataTypes.h.cmake Sun Sep 21 20:08:49 2008 @@ -0,0 +1,134 @@ +//===-- include/Support/DataTypes.h - Define fixed size types ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains definitions to figure out the size of _HOST_ data types. +// This file is important because different host OS's define different macros, +// which makes portability tough. This file exports the following definitions: +// +// [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types +// [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. +// +// No library is required when using these functinons. +// +//===----------------------------------------------------------------------===// + +#ifndef SUPPORT_DATATYPES_H +#define SUPPORT_DATATYPES_H + +#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H} +#cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H} +#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H} +#undef HAVE_UINT64_T +#undef HAVE_U_INT64_T + +// FIXME: UGLY HACK (Added by Kevin) +#define HAVE_UINT64_T 1 + +#ifndef _MSC_VER + +// Note that this header's correct operation depends on __STDC_LIMIT_MACROS +// being defined. We would define it here, but in order to prevent Bad Things +// happening when system headers or C++ STL headers include stdint.h before +// we define it here, we define it on the g++ command line (in Makefile.rules). +#if !defined(__STDC_LIMIT_MACROS) +# error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h" +#endif + +// Note that includes , if this is a C99 system. +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_INTTYPES_H +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef __cplusplus +#include +#else +#include +#endif + +#ifdef _AIX +#include "llvm/Support/AIXDataTypesFix.h" +#endif + +// Handle incorrect definition of uint64_t as u_int64_t +#ifndef HAVE_UINT64_T +#ifdef HAVE_U_INT64_T +typedef u_int64_t uint64_t; +#else +# error "Don't have a definition for uint64_t on this platform" +#endif +#endif + +#ifdef _OpenBSD_ +#define INT8_MAX 127 +#define INT8_MIN -128 +#define UINT8_MAX 255 +#define INT16_MAX 32767 +#define INT16_MIN -32768 +#define UINT16_MAX 65535 +#define INT32_MAX 2147483647 +#define INT32_MIN -2147483648 +#define UINT32_MAX 4294967295U +#endif + +#else /* _MSC_VER */ +// Visual C++ doesn't provide standard integer headers, but it does provide +// built-in data types. +#include +#include +#include +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed int ssize_t; +#define INT8_MAX 127 +#define INT8_MIN -128 +#define UINT8_MAX 255 +#define INT16_MAX 32767 +#define INT16_MIN -32768 +#define UINT16_MAX 65535 +#define INT32_MAX 2147483647 +#define INT32_MIN -2147483648 +#define UINT32_MAX 4294967295U +#endif /* _MSC_VER */ + +/* Set defaults for constants which we cannot find. */ +#if !defined(INT64_MAX) +# define INT64_MAX 9223372036854775807LL +#endif +#if !defined(INT64_MIN) +# define INT64_MIN ((-INT64_MAX)-1) +#endif +#if !defined(UINT64_MAX) +# define UINT64_MAX 0xffffffffffffffffULL +#endif + +#if __GNUC__ > 3 +#define END_WITH_NULL __attribute__((sentinel)) +#else +#define END_WITH_NULL +#endif + +#ifndef HUGE_VALF +#define HUGE_VALF (float)HUGE_VAL +#endif + +#endif /* SUPPORT_DATATYPES_H */ Added: llvm/trunk/lib/Analysis/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Analysis/CMakeLists.txt (added) +++ llvm/trunk/lib/Analysis/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,29 @@ +add_llvm_library(LLVMAnalysis + AliasAnalysis.cpp + AliasAnalysisCounter.cpp + AliasAnalysisEvaluator.cpp + AliasDebugger.cpp + AliasSetTracker.cpp + Analysis.cpp + BasicAliasAnalysis.cpp + CFGPrinter.cpp + ConstantFolding.cpp + InstCount.cpp + Interval.cpp + IntervalPartition.cpp + LibCallAliasAnalysis.cpp + LibCallSemantics.cpp + LoopInfo.cpp + LoopPass.cpp + LoopVR.cpp + MemoryDependenceAnalysis.cpp + PostDominators.cpp + ProfileInfo.cpp + ProfileInfoLoader.cpp + ProfileInfoLoaderPass.cpp + ScalarEvolution.cpp + ScalarEvolutionExpander.cpp + SparsePropagation.cpp + Trace.cpp + ValueTracking.cpp + ) Added: llvm/trunk/lib/Analysis/IPA/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Analysis/IPA/CMakeLists.txt (added) +++ llvm/trunk/lib/Analysis/IPA/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,7 @@ +add_llvm_library(LLVMipa + Andersens.cpp + CallGraph.cpp + CallGraphSCCPass.cpp + FindUsedTypes.cpp + GlobalsModRef.cpp + ) Added: llvm/trunk/lib/Archive/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Archive/CMakeLists.txt (added) +++ llvm/trunk/lib/Archive/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,5 @@ +add_llvm_library(LLVMArchive + Archive.cpp + ArchiveReader.cpp + ArchiveWriter.cpp + ) \ No newline at end of file Added: llvm/trunk/lib/AsmParser/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/AsmParser/CMakeLists.txt (added) +++ llvm/trunk/lib/AsmParser/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,15 @@ +# AsmParser, with a Bison generated parser: +include(FindBison) +find_bison() +bison_generator( + "llvmAsm" + "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.y" + "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.h" + "${CMAKE_CURRENT_SOURCE_DIR}/llvmAsmParser.cpp" + ) + +add_llvm_library(LLVMAsmParser + llvmAsmParser.cpp # Generated from llvmAsmParser.y + LLLexer.cpp + Parser.cpp + ) Added: llvm/trunk/lib/Bitcode/Reader/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/CMakeLists.txt (added) +++ llvm/trunk/lib/Bitcode/Reader/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,7 @@ +add_llvm_library(LLVMBitReader + BitReader.cpp + BitcodeReader.cpp + Deserialize.cpp + DeserializeAPFloat.cpp + DeserializeAPInt.cpp + ) \ No newline at end of file Added: llvm/trunk/lib/Bitcode/Writer/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/CMakeLists.txt (added) +++ llvm/trunk/lib/Bitcode/Writer/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,9 @@ +add_llvm_library(LLVMBitWriter + BitWriter.cpp + BitcodeWriter.cpp + BitcodeWriterPass.cpp + Serialize.cpp + SerializeAPFloat.cpp + SerializeAPInt.cpp + ValueEnumerator.cpp + ) Added: llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt (added) +++ llvm/trunk/lib/CodeGen/AsmPrinter/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,5 @@ +add_llvm_library(LLVMAsmPrinter + AsmPrinter.cpp + DwarfWriter.cpp + OcamlGCPrinter.cpp + ) Added: llvm/trunk/lib/CodeGen/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/CMakeLists.txt (added) +++ llvm/trunk/lib/CodeGen/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,48 @@ +add_llvm_library(LLVMCodeGen + BranchFolding.cpp + DeadMachineInstructionElim.cpp + ELFWriter.cpp + GCMetadata.cpp + GCMetadataPrinter.cpp + GCStrategy.cpp + IfConversion.cpp + IntrinsicLowering.cpp + LLVMTargetMachine.cpp + LiveInterval.cpp + LiveIntervalAnalysis.cpp + LiveStackAnalysis.cpp + LiveVariables.cpp + LoopAligner.cpp + LowerSubregs.cpp + MachOWriter.cpp + MachineBasicBlock.cpp + MachineDominators.cpp + MachineFunction.cpp + MachineInstr.cpp + MachineLICM.cpp + MachineLoopInfo.cpp + MachineModuleInfo.cpp + MachinePassRegistry.cpp + MachineRegisterInfo.cpp + MachineSink.cpp + OcamlGC.cpp + PHIElimination.cpp + Passes.cpp + PostRASchedulerList.cpp + PrologEpilogInserter.cpp + PseudoSourceValue.cpp + RegAllocBigBlock.cpp + RegAllocLinearScan.cpp + RegAllocLocal.cpp + RegAllocSimple.cpp + RegisterCoalescer.cpp + RegisterScavenging.cpp + ShadowStackGC.cpp + SimpleRegisterCoalescing.cpp + StackSlotColoring.cpp + StrongPHIElimination.cpp + TargetInstrInfoImpl.cpp + TwoAddressInstructionPass.cpp + UnreachableBlockElim.cpp + VirtRegMap.cpp + ) Added: llvm/trunk/lib/CodeGen/SelectionDAG/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/CMakeLists.txt (added) +++ llvm/trunk/lib/CodeGen/SelectionDAG/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,21 @@ +add_llvm_library(LLVMSelectionDAG + CallingConvLower.cpp + DAGCombiner.cpp + FastISel.cpp + LegalizeDAG.cpp + LegalizeFloatTypes.cpp + LegalizeIntegerTypes.cpp + LegalizeTypes.cpp + LegalizeTypesGeneric.cpp + LegalizeVectorTypes.cpp + ScheduleDAG.cpp + ScheduleDAGEmit.cpp + ScheduleDAGFast.cpp + ScheduleDAGList.cpp + ScheduleDAGRRList.cpp + SelectionDAGBuild.cpp + SelectionDAG.cpp + SelectionDAGISel.cpp + SelectionDAGPrinter.cpp + TargetLowering.cpp + ) Added: llvm/trunk/lib/Debugger/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Debugger/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Debugger/CMakeLists.txt (added) +++ llvm/trunk/lib/Debugger/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,10 @@ +add_llvm_library(LLVMDebugger + Debugger.cpp + ProgramInfo.cpp + RuntimeInfo.cpp + SourceFile.cpp + SourceLanguage-CFamily.cpp + SourceLanguage-CPlusPlus.cpp + SourceLanguage-Unknown.cpp + SourceLanguage.cpp + ) Added: llvm/trunk/lib/ExecutionEngine/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/ExecutionEngine/CMakeLists.txt (added) +++ llvm/trunk/lib/ExecutionEngine/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,4 @@ +add_llvm_library(LLVMExecutionEngine + ExecutionEngine.cpp + ExecutionEngineBindings.cpp + ) Added: llvm/trunk/lib/ExecutionEngine/Interpreter/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/ExecutionEngine/Interpreter/CMakeLists.txt (added) +++ llvm/trunk/lib/ExecutionEngine/Interpreter/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,5 @@ +add_partially_linked_object(LLVMInterpreter + Execution.cpp + ExternalFunctions.cpp + Interpreter.cpp + ) Added: llvm/trunk/lib/ExecutionEngine/JIT/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/CMakeLists.txt (added) +++ llvm/trunk/lib/ExecutionEngine/JIT/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,11 @@ +# TODO: Support other architectures. See Makefile. +add_definitions(-DENABLE_X86_JIT) + +add_partially_linked_object(LLVMJIT + Intercept.cpp + JIT.cpp + JITDwarfEmitter.cpp + JITEmitter.cpp + JITMemoryManager.cpp + TargetSelect.cpp + ) Added: llvm/trunk/lib/Linker/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Linker/CMakeLists.txt (added) +++ llvm/trunk/lib/Linker/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,6 @@ +add_llvm_library(LLVMLinker + LinkArchives.cpp + LinkItems.cpp + LinkModules.cpp + Linker.cpp + ) Added: llvm/trunk/lib/Support/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Support/CMakeLists.txt (added) +++ llvm/trunk/lib/Support/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,29 @@ +add_llvm_library(LLVMSupport + APFloat.cpp + APInt.cpp + APSInt.cpp + Allocator.cpp + Annotation.cpp + CommandLine.cpp + ConstantRange.cpp + Debug.cpp + Dwarf.cpp + FileUtilities.cpp + FoldingSet.cpp + GraphWriter.cpp + IsInf.cpp + IsNAN.cpp + ManagedStatic.cpp + MemoryBuffer.cpp + PluginLoader.cpp + SlowOperationInformer.cpp + SmallPtrSet.cpp + Statistic.cpp + Streams.cpp + StringExtras.cpp + StringMap.cpp + StringPool.cpp + SystemUtils.cpp + Timer.cpp + raw_ostream.cpp + ) Added: llvm/trunk/lib/System/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/System/CMakeLists.txt (added) +++ llvm/trunk/lib/System/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,13 @@ +add_llvm_library(LLVMSystem + Alarm.cpp + Disassembler.cpp + DynamicLibrary.cpp + IncludeFile.cpp + Memory.cpp + Mutex.cpp + Path.cpp + Process.cpp + Program.cpp + Signals.cpp + TimeValue.cpp + ) Added: llvm/trunk/lib/Target/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Target/CMakeLists.txt (added) +++ llvm/trunk/lib/Target/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,17 @@ +add_llvm_library(LLVMTarget + DarwinTargetAsmInfo.cpp + ELFTargetAsmInfo.cpp + SubtargetFeature.cpp + Target.cpp + TargetAsmInfo.cpp + TargetData.cpp + TargetFrameInfo.cpp + TargetInstrInfo.cpp + TargetMachOWriterInfo.cpp + TargetMachine.cpp + TargetMachineRegistry.cpp + TargetRegisterInfo.cpp + TargetSubtarget.cpp + ) + +# TODO: Support other targets besides X86. See Makefile. \ No newline at end of file Added: llvm/trunk/lib/Target/X86/AsmPrinter/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/CMakeLists.txt (added) +++ llvm/trunk/lib/Target/X86/AsmPrinter/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,7 @@ +include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. ) + +add_llvm_library(LLVMX86AsmPrinter + X86ATTAsmPrinter.cpp + X86AsmPrinter.cpp + X86IntelAsmPrinter.cpp + ) Added: llvm/trunk/lib/Target/X86/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Target/X86/CMakeLists.txt (added) +++ llvm/trunk/lib/Target/X86/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,56 @@ +macro(x86tgen ofn) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} + COMMAND tblgen ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${llvm_include_path} ${CMAKE_CURRENT_SOURCE_DIR}/X86.td -o ${ofn} + DEPENDS tblgen ${CMAKE_CURRENT_SOURCE_DIR}/X86.td + COMMENT "Building ${ofn}..." + ) +endmacro(x86tgen) + +x86tgen(X86GenRegisterInfo.h.inc -gen-register-desc-header) +x86tgen(X86GenRegisterNames.inc -gen-register-enums) +x86tgen(X86GenRegisterInfo.inc -gen-register-desc) +x86tgen(X86GenInstrNames.inc -gen-instr-enums) +x86tgen(X86GenInstrInfo.inc -gen-instr-desc) +x86tgen(X86GenAsmWriter.inc -gen-asm-writer) +x86tgen(X86GenAsmWriter1.inc -gen-asm-writer -asmwriternum=1) +x86tgen(X86GenDAGISel.inc -gen-dag-isel) +x86tgen(X86GenFastISel.inc -gen-fast-isel) +x86tgen(X86GenCallingConv.inc -gen-callingconv) +x86tgen(X86GenSubtarget.inc -gen-subtarget) + +add_custom_target(X86Table_gen echo Tablegenning + DEPENDS + ${llvm_builded_incs_dir}/Intrinsics.gen + ${CMAKE_CURRENT_BINARY_DIR}/X86GenRegisterInfo.h.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenRegisterNames.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenRegisterInfo.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenInstrNames.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenInstrInfo.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenAsmWriter.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenAsmWriter1.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenDAGISel.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenFastISel.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenCallingConv.inc + ${CMAKE_CURRENT_BINARY_DIR}/X86GenSubtarget.inc + ) + +include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) + +add_partially_linked_object(LLVMX86CodeGen + X86CodeEmitter.cpp + X86ELFWriterInfo.cpp + X86FloatingPoint.cpp + X86ISelDAGToDAG.cpp + X86ISelLowering.cpp + X86InstrInfo.cpp + X86JITInfo.cpp + X86RegisterInfo.cpp + X86Subtarget.cpp + X86TargetAsmInfo.cpp + X86TargetMachine.cpp + X86FastISel.cpp + ) + +add_dependencies(LLVMX86CodeGen + X86Table_gen +) Added: llvm/trunk/lib/Transforms/Hello/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Hello/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/Hello/CMakeLists.txt (added) +++ llvm/trunk/lib/Transforms/Hello/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,3 @@ +add_llvm_library( LLVMHello + Hello.cpp + ) Added: llvm/trunk/lib/Transforms/IPO/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/IPO/CMakeLists.txt (added) +++ llvm/trunk/lib/Transforms/IPO/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,24 @@ +add_llvm_library(LLVMipo + AddReadAttrs.cpp + ArgumentPromotion.cpp + ConstantMerge.cpp + DeadArgumentElimination.cpp + DeadTypeElimination.cpp + ExtractGV.cpp + GlobalDCE.cpp + GlobalOpt.cpp + IndMemRemoval.cpp + InlineAlways.cpp + Inliner.cpp + InlineSimple.cpp + Internalize.cpp + IPConstantPropagation.cpp + LoopExtractor.cpp + LowerSetJmp.cpp + PartialSpecialization.cpp + PruneEH.cpp + RaiseAllocations.cpp + StripDeadPrototypes.cpp + StripSymbols.cpp + StructRetPromotion.cpp + ) Added: llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt (added) +++ llvm/trunk/lib/Transforms/Instrumentation/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,6 @@ +add_llvm_library(LLVMInstrumentation + BlockProfiling.cpp + EdgeProfiling.cpp + ProfilingUtils.cpp + RSProfiling.cpp + ) Added: llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt (added) +++ llvm/trunk/lib/Transforms/Scalar/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,32 @@ +add_llvm_library(LLVMScalarOpts + ADCE.cpp + BasicBlockPlacement.cpp + CodeGenPrepare.cpp + CondPropagate.cpp + ConstantProp.cpp + DCE.cpp + DeadStoreElimination.cpp + GVN.cpp + GVNPRE.cpp + IndVarSimplify.cpp + InstructionCombining.cpp + JumpThreading.cpp + LICM.cpp + LoopDeletion.cpp + LoopIndexSplit.cpp + LoopRotation.cpp + LoopStrengthReduce.cpp + LoopUnroll.cpp + LoopUnswitch.cpp + MemCpyOptimizer.cpp + PredicateSimplifier.cpp + Reassociate.cpp + Reg2Mem.cpp + SCCP.cpp + Scalar.cpp + ScalarReplAggregates.cpp + SimplifyCFGPass.cpp + SimplifyLibCalls.cpp + TailDuplication.cpp + TailRecursionElimination.cpp + ) Added: llvm/trunk/lib/Transforms/Utils/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/Utils/CMakeLists.txt (added) +++ llvm/trunk/lib/Transforms/Utils/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,26 @@ +add_llvm_library(LLVMTransformUtils + BasicBlockUtils.cpp + BasicInliner.cpp + BreakCriticalEdges.cpp + CloneFunction.cpp + CloneLoop.cpp + CloneModule.cpp + CloneTrace.cpp + CodeExtractor.cpp + DemoteRegToStack.cpp + InlineCost.cpp + InlineFunction.cpp + LCSSA.cpp + Local.cpp + LoopSimplify.cpp + LowerAllocations.cpp + LowerInvoke.cpp + LowerSwitch.cpp + Mem2Reg.cpp + PromoteMemoryToRegister.cpp + SimplifyCFG.cpp + UnifyFunctionExitNodes.cpp + UnrollLoop.cpp + ValueMapper.cpp + InstructionNamer.cpp + ) Added: llvm/trunk/lib/VMCore/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/lib/VMCore/CMakeLists.txt (added) +++ llvm/trunk/lib/VMCore/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,32 @@ +add_llvm_library(LLVMVMCore + AsmWriter.cpp + AutoUpgrade.cpp + BasicBlock.cpp + ConstantFold.cpp + Constants.cpp + Core.cpp + DebugInfoBuilder.cpp + Dominators.cpp + Function.cpp + Globals.cpp + InlineAsm.cpp + Instruction.cpp + Instructions.cpp + IntrinsicInst.cpp + LeakDetector.cpp + Mangler.cpp + Module.cpp + ModuleProvider.cpp + ParameterAttributes.cpp + Pass.cpp + PassManager.cpp + Type.cpp + TypeSymbolTable.cpp + Use.cpp + Value.cpp + ValueSymbolTable.cpp + ValueTypes.cpp + Verifier.cpp + ) + +add_dependencies( LLVMVMCore ${llvm_builded_incs_dir}/Intrinsics.gen ) \ No newline at end of file Added: llvm/trunk/tools/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/CMakeLists.txt (added) +++ llvm/trunk/tools/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,32 @@ +# NOTE: The tools are organized into five groups of four consisting of one +# large and three small executables. This is done to minimize memory load +# in parallel builds. Please retain this ordering. + +if( NOT MSVC ) + add_subdirectory(llvm-config) +endif( NOT MSVC ) + +add_subdirectory(opt) +add_subdirectory(llvm-as) +add_subdirectory(llvm-dis) + +add_subdirectory(llc) +add_subdirectory(llvm-ranlib) +add_subdirectory(llvm-ar) +add_subdirectory(llvm-nm) + +add_subdirectory(llvm-ld) +add_subdirectory(llvm-prof) +add_subdirectory(llvm-link) +add_subdirectory(lli) + +# gccas and gccld are deprecated: +# add_subdirectory(gccas) +# add_subdirectory(gccld) +add_subdirectory(llvm-extract) +add_subdirectory(llvm-db) + +add_subdirectory(bugpoint) +add_subdirectory(llvm-bcanalyzer) +add_subdirectory(llvm-stub) +add_subdirectory(llvmc2) Added: llvm/trunk/tools/bugpoint/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/bugpoint/CMakeLists.txt (added) +++ llvm/trunk/tools/bugpoint/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,16 @@ +set(LLVM_LINK_COMPONENTS asmparser instrumentation scalaropts ipo + linker bitreader bitwriter) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(bugpoint + BugDriver.cpp + CrashDebugger.cpp + ExecutionDriver.cpp + ExtractFunction.cpp + FindBugs.cpp + Miscompilation.cpp + OptimizerDriver.cpp + TestPasses.cpp + ToolRunner.cpp + bugpoint.cpp + ) Added: llvm/trunk/tools/llc/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llc/CMakeLists.txt (added) +++ llvm/trunk/tools/llc/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS ${LLVM_TARGETS_TO_BUILD} bitreader asmprinter) + +add_llvm_tool(llc + llc.cpp + ) Added: llvm/trunk/tools/lli/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/lli/CMakeLists.txt (added) +++ llvm/trunk/tools/lli/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS jit interpreter nativecodegen bitreader selectiondag) + +add_llvm_tool(lli + lli.cpp + ) Added: llvm/trunk/tools/llvm-ar/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-ar/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-ar/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,8 @@ +set(LLVM_LINK_COMPONENTS archive) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-ar + llvm-ar.cpp + ) + +# TODO: Support check-local. Added: llvm/trunk/tools/llvm-as/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-as/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-as/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-as/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,6 @@ +set(LLVM_LINK_COMPONENTS asmparser bitwriter) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-as + llvm-as.cpp + ) Added: llvm/trunk/tools/llvm-bcanalyzer/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-bcanalyzer/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-bcanalyzer/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-bcanalyzer/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,6 @@ +set(LLVM_LINK_COMPONENTS bitreader) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-bcanalyzer + llvm-bcanalyzer.cpp + ) Added: llvm/trunk/tools/llvm-config/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-config/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-config/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,102 @@ +include(TestBigEndian) + +if( NOT PERL_FOUND ) + message(FATAL_ERROR "Perl required but not found!") +endif( NOT PERL_FOUND ) + +set(PERL ${PERL_EXECUTABLE}) +set(VERSION PACKAGE_VERSION) +set(PREFIX ${LLVM_BINARY_DIR}) # TODO: Root for `make install'. +execute_process(COMMAND date + OUTPUT_VARIABLE LLVM_CONFIGTIME + OUTPUT_STRIP_TRAILING_WHITESPACE) +set(abs_top_srcdir ${LLVM_MAIN_SRC_DIR}) +set(abs_top_builddir ${LLVM_BINARY_DIR}) +# LLVM_ON_UNIX and LLVM_ON_WIN32 already set. +# those are set to blank by `autoconf' on MinGW, so it seems they are not required: +#set(LLVMGCCDIR "") +#set(LLVMGCC "") +#set(LLVMGXX "") +#set(LLVMGCC_VERSION "") +#set(LLVMGCC_MAJVERS "") +test_big_endian(IS_BIG_ENDIAN) +if( IS_BIG_ENDIAN ) + set(ENDIAN "big") +else( IS_BIG_ENDIAN ) + set(ENDIAN "little") +endif( IS_BIG_ENDIAN ) +set(SHLIBEXT ${LTDL_SHLIB_EXT}) +#EXEEXT already set. +set(OS "${CMAKE_SYSTEM}") +set(ARCH "X86") # TODO: This gives "i686" in Linux: "${CMAKE_SYSTEM_PROCESSOR}") +# TODO: avoid using autoconf: +set(config_guess ${LLVM_MAIN_SRC_DIR}/autoconf/config.guess) +execute_process(COMMAND sh ${config_guess} + RESULT_VARIABLE TT_RV + OUTPUT_VARIABLE LLVM_TARGET_TRIPLET + OUTPUT_STRIP_TRAILING_WHITESPACE) +message(STATUS "Target triplet: ${LLVM_TARGET_TRIPLET}") +if( NOT TT_RV EQUAL 0 ) + message(FATAL_ERROR "Failed to execute ${config_guess}") +endif( NOT TT_RV EQUAL 0 ) +set(target ${LLVM_TARGET_TRIPLET}) +set(TARGETS_TO_BUILD "X86") # TODO +set(TARGET_HAS_JIT "1") # TODO + +# Avoids replacement at config-time: +set(LLVM_CPPFLAGS "@LLVM_CPPFLAGS@") +set(LLVM_CFLAGS "@LLVM_CFLAGS@") +set(LLVM_CXXFLAGS "@LLVM_CXXFLAGS@") +set(LLVM_LDFLAGS "@LLVM_LDFLAGS@") +set(LIBS "@LIBS@") +set(LLVM_BUILDMODE "@LLVM_BUILDMODE@") + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.in.in + ${CMAKE_CURRENT_BINARY_DIR}/llvm-config.in + @ONLY +) + +set(LIBDEPS ${CMAKE_CURRENT_BINARY_DIR}/LibDeps.txt) +set(LIBDEPS_TMP ${CMAKE_CURRENT_BINARY_DIR}/LibDeps.txt.tmp) +set(FINAL_LIBDEPS ${CMAKE_CURRENT_BINARY_DIR}/FinalLibDeps.txt) +set(LLVM_CONFIG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/llvm-config) +set(LLVM_CONFIG_IN ${CMAKE_CURRENT_BINARY_DIR}/llvm-config.in) + +# set(LIBDEPS LibDeps.txt) +# set(LIBDEPS_TMP LibDeps.txt.tmp) +# set(FINAL_LIBDEPS FinalLibDeps.txt) + +add_custom_command(OUTPUT ${LIBDEPS_TMP} + COMMAND ${PERL_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/GenLibDeps.pl -flat ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} > ${LIBDEPS_TMP} + DEPENDS ${llvm_libs} + COMMENT "Regenerating ${LIBDEPS_TMP}") + +add_custom_command(OUTPUT ${LIBDEPS} + COMMAND cmp -s ${LIBDEPS_TMP} ${LIBDEPS} || \( cp ${LIBDEPS_TMP} ${LIBDEPS} && echo "Updated ${LIBDEPS} because dependencies changed" \) + DEPENDS ${LIBDEPS_TMP}) + +add_custom_command(OUTPUT ${FINAL_LIBDEPS} + COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/find-cycles.pl < ${LIBDEPS} > ${FINAL_LIBDEPS} || rm -f ${FINAL_LIBDEPS} + DEPENDS ${LIBDEPS} + COMMENT "Checking for cyclic dependencies between LLVM libraries.") + +add_custom_command(OUTPUT ${LLVM_CONFIG} + COMMAND echo 's, at LLVM_CPPFLAGS@,${CMAKE_CPP_FLAGS},' > temp.sed + COMMAND echo 's, at LLVM_CFLAGS@,${CMAKE_C_FLAGS},' >> temp.sed + COMMAND echo 's, at LLVM_CXXFLAGS@,${CMAKE_CXX_FLAGS},' >> temp.sed + # TODO: Use general flags for linking, not just for shared libs: + COMMAND echo 's, at LLVM_LDFLAGS@,${CMAKE_SHARED_LINKER_FLAGS},' >> temp.sed + COMMAND echo 's, at LIBS@,,' >> temp.sed # TODO: System libs + COMMAND echo 's, at LLVM_BUILDMODE@,${CMAKE_BUILD_TYPE},' >> temp.sed + COMMAND sed -f temp.sed < ${LLVM_CONFIG_IN} > ${LLVM_CONFIG} + COMMAND rm temp.sed + COMMAND cat ${FINAL_LIBDEPS} >> ${LLVM_CONFIG} + COMMAND chmod +x ${LLVM_CONFIG} + COMMAND cd ${LLVM_BINARY_DIR} && ${CMAKE_COMMAND} -U HAVE_LLVM_CONFIG ${LLVM_MAIN_SRC_DIR} + DEPENDS ${FINAL_LIBDEPS} ${LLVM_CONFIG_IN} + COMMENT "Building llvm-config script." + ) + +add_custom_target(llvm-config.target ALL + DEPENDS ${LLVM_CONFIG}) \ No newline at end of file Added: llvm/trunk/tools/llvm-db/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-db/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-db/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-db/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,8 @@ +set(LLVM_LINK_COMPONENTS debugger) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-db + CLIDebugger.cpp + Commands.cpp + llvm-db.cpp + ) Added: llvm/trunk/tools/llvm-dis/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dis/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-dis/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-dis/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,6 @@ +set(LLVM_LINK_COMPONENTS bitreader) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-dis + llvm-dis.cpp + ) Added: llvm/trunk/tools/llvm-extract/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-extract/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-extract/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-extract/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS ipo bitreader bitwriter) + +add_llvm_tool(llvm-extract + llvm-extract.cpp + ) Added: llvm/trunk/tools/llvm-ld/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-ld/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-ld/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,7 @@ +set(LLVM_LINK_COMPONENTS ipo scalaropts linker archive bitwriter) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-ld + Optimize.cpp + llvm-ld.cpp + ) Added: llvm/trunk/tools/llvm-link/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-link/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-link/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS linker bitreader bitwriter) + +add_llvm_tool(llvm-link + llvm-link.cpp + ) Added: llvm/trunk/tools/llvm-nm/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-nm/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-nm/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,5 @@ +set(LLVM_LINK_COMPONENTS archive bitreader) + +add_llvm_tool(llvm-nm + llvm-nm.cpp + ) Added: llvm/trunk/tools/llvm-prof/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-prof/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-prof/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-prof/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,6 @@ +set(LLVM_LINK_COMPONENTS bitreader analysis) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-prof + llvm-prof.cpp + ) Added: llvm/trunk/tools/llvm-ranlib/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ranlib/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-ranlib/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-ranlib/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,6 @@ +set(LLVM_LINK_COMPONENTS archive) +set(LLVM_REQUIRES_EH 1) + +add_llvm_tool(llvm-ranlib + llvm-ranlib.cpp + ) Added: llvm/trunk/tools/llvm-stub/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-stub/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvm-stub/CMakeLists.txt (added) +++ llvm/trunk/tools/llvm-stub/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,3 @@ +add_llvm_tool(llvm-stub + llvm-stub.c + ) Added: llvm/trunk/tools/llvmc2/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/llvmc2/CMakeLists.txt (added) +++ llvm/trunk/tools/llvmc2/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,32 @@ +set(LLVM_LINK_COMPONENTS support system) +set(LLVM_REQUIRES_EH 1) + +macro(tgen ofn) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} + COMMAND tblgen ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${llvm_include_path} ${CMAKE_CURRENT_SOURCE_DIR}/Graph.td -o ${ofn} + DEPENDS + tblgen + ${CMAKE_CURRENT_SOURCE_DIR}/Common.td + ${CMAKE_CURRENT_SOURCE_DIR}/Graph.td + ${CMAKE_CURRENT_SOURCE_DIR}/Tools.td + COMMENT "Building ${ofn}..." + ) +endmacro(tgen ofn) + +tgen(AutoGenerated.inc -gen-llvmc) + +add_custom_target(AutoGenerated_ct echo Tablegenning + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/AutoGenerated.inc + ) + +include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) + +add_llvm_tool(llvmc2 + Action.cpp + AutoGenerated.cpp + CompilationGraph.cpp + llvmc.cpp + ) + +add_dependencies(llvmc2 AutoGenerated_ct) Added: llvm/trunk/tools/opt/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/tools/opt/CMakeLists.txt (added) +++ llvm/trunk/tools/opt/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,9 @@ +set(LLVM_REQUIRES_EH 1) +set(LLVM_LINK_COMPONENTS bitreader bitwriter instrumentation scalaropts ipo) + +add_llvm_tool(opt + AnalysisWrappers.cpp + GraphPrinters.cpp + PrintSCC.cpp + opt.cpp + ) Added: llvm/trunk/utils/TableGen/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CMakeLists.txt?rev=56419&view=auto ============================================================================== --- llvm/trunk/utils/TableGen/CMakeLists.txt (added) +++ llvm/trunk/utils/TableGen/CMakeLists.txt Sun Sep 21 20:08:49 2008 @@ -0,0 +1,26 @@ +add_executable(tblgen + AsmWriterEmitter.cpp + CallingConvEmitter.cpp + CodeEmitterGen.cpp + CodeGenDAGPatterns.cpp + CodeGenInstruction.cpp + CodeGenTarget.cpp + DAGISelEmitter.cpp + InstrEnumEmitter.cpp + InstrInfoEmitter.cpp + IntrinsicEmitter.cpp + LLVMCConfigurationEmitter.cpp + Record.cpp + RegisterInfoEmitter.cpp + SubtargetEmitter.cpp + TGLexer.cpp + TGParser.cpp + TableGen.cpp + TableGenBackend.cpp + FastISelEmitter.cpp + ) + +target_link_libraries(tblgen LLVMSupport LLVMSystem) +if( MINGW ) + target_link_libraries(tblgen imagehlp psapi) +endif( MINGW ) From evan.cheng at apple.com Sun Sep 21 21:41:04 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Sun, 21 Sep 2008 19:41:04 -0700 Subject: [llvm-commits] [llvm] r56384 - in /llvm/trunk/lib/CodeGen: RegAllocLinearScan.cpp SimpleRegisterCoalescing.cpp In-Reply-To: <4F71A860-E342-4A07-8211-0A59A1AA154D@apple.com> References: <200809200203.m8K234YA013252@zion.cs.uiuc.edu> <4F71A860-E342-4A07-8211-0A59A1AA154D@apple.com> Message-ID: On Sep 21, 2008, at 6:12 PM, Chris Lattner wrote: > > On Sep 19, 2008, at 7:03 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Fri Sep 19 21:03:04 2008 >> New Revision: 56384 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=56384&view=rev >> Log: >> Teach coalescer about earlyclobber bits. >> Check bits for preferred register. > > If you model the early clobber def as starting one slot early, it will > explicitly conflict with all inputs to the asm, and this can be backed > out. While that's the correct approach, it breaks all kinds of assumptions in liveintervals and the coalescer. It will make the problem much more complicated. I don't think it's worth the effort. Besides, from uArch point of view, "early clobber" is totally bogus. It should really be "no read bypass". The correct way to model it would be to delay read by one cycle. Evan > > > -Chris > >> >> >> >> Modified: >> llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp >> llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp >> >> Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=56384&r1=56383&r2=56384&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) >> +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Fri Sep 19 >> 21:03:04 2008 >> @@ -1122,9 +1122,12 @@ >> unsigned FreeRegInactiveCount = 0; >> >> // If copy coalescer has assigned a "preferred" register, check if >> it's >> - // available first. >> + // available first. Coalescer can create new earlyclobber >> interferences, >> + // so we need to check that. >> if (cur->preference) { >> - if (prt_->isRegAvail(cur->preference) && RC->contains(cur- >>> preference)) { >> + if (prt_->isRegAvail(cur->preference) && >> + RC->contains(cur->preference) && >> + noEarlyClobberConflict(cur, cur->preference)) { >> DOUT << "\t\tassigned the preferred register: " >> << tri_->getName(cur->preference) << "\n"; >> return cur->preference; >> >> Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=56384&r1=56383&r2=56384&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Fri Sep 19 >> 21:03:04 2008 >> @@ -1206,6 +1206,14 @@ >> DOUT << " and "; DstInt.print(DOUT, tri_); >> DOUT << ": "; >> >> + // If one interval is earlyclobber and the other is overlaps- >> earlyclobber, >> + // we cannot coalesce them. >> + if ((SrcInt.isEarlyClobber && DstInt.overlapsEarlyClobber) || >> + (DstInt.isEarlyClobber && SrcInt.overlapsEarlyClobber)) { >> + DOUT << "\t\tCannot join due to earlyclobber."; >> + return false; >> + } >> + >> // Check if it is necessary to propagate "isDead" property. >> if (!isExtSubReg && !isInsSubReg) { >> MachineOperand *mopd = CopyMI->findRegisterDefOperand(DstReg, >> false); >> @@ -1366,6 +1374,10 @@ >> if (TargetRegisterInfo::isVirtualRegister(DstReg)) >> RemoveUnnecessaryKills(DstReg, *ResDstInt); >> >> + // Merge the earlyclobber bits. >> + ResDstInt->isEarlyClobber |= ResSrcInt->isEarlyClobber; >> + ResDstInt->overlapsEarlyClobber |= ResSrcInt- >> >overlapsEarlyClobber; >> + >> if (isInsSubReg) >> // Avoid: >> // r1024 = op >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Sun Sep 21 21:42:03 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Sun, 21 Sep 2008 19:42:03 -0700 Subject: [llvm-commits] [llvm] r56310 - /llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp In-Reply-To: <47A144A2-3B20-467D-8EAA-FB90DF12E434@apple.com> References: <200809181822.m8IIMW2k002887@zion.cs.uiuc.edu> <47A144A2-3B20-467D-8EAA-FB90DF12E434@apple.com> Message-ID: This happens before livevariables. Remember we don't run LV at -O0. Evan On Sep 21, 2008, at 4:41 PM, Chris Lattner wrote: > > On Sep 18, 2008, at 11:22 AM, Dan Gohman wrote: > >> Author: djg >> Date: Thu Sep 18 13:22:32 2008 >> New Revision: 56310 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=56310&view=rev >> Log: >> Don't consider instructions with implicit physical register >> defs to be necessarily live. > > Why do defs of physical registers even matter? Can't you just look at > kill/dead markers? > > -Chris > >> >> >> Modified: >> llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp >> >> Modified: llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp?rev=56310&r1=56309&r2=56310&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp (original) >> +++ llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp Thu Sep 18 >> 13:22:32 2008 >> @@ -64,7 +64,8 @@ >> const MachineOperand &MO = MI->getOperand(i); >> if (MO.isRegister() && MO.isDef()) { >> unsigned Reg = MO.getReg(); >> - if (TargetRegisterInfo::isPhysicalRegister(Reg) || >> + if ((!MO.isImplicit() && >> + TargetRegisterInfo::isPhysicalRegister(Reg)) || >> !MRI.use_empty(Reg)) { >> // This def has a use. Don't delete the instruction! >> AllDefsDead = false; >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From lattner at cs.uiuc.edu Sun Sep 21 22:08:45 2008 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 21 Sep 2008 22:08:45 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2008-08-23/ Message-ID: <200809220308.m8M38jSb022601@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2008-08-23: --- Log message: Directory /home/vadve/shared/PublicCVS/llvm-www/devmtg/2008-08-23 added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From ofv at wanadoo.es Sun Sep 21 21:33:43 2008 From: ofv at wanadoo.es (Oscar Fuentes) Date: Mon, 22 Sep 2008 02:33:43 -0000 Subject: [llvm-commits] [llvm] r56425 - /llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake Message-ID: <200809220233.m8M2Xhrw021329@zion.cs.uiuc.edu> Author: ofv Date: Sun Sep 21 21:33:43 2008 New Revision: 56425 URL: http://llvm.org/viewvc/llvm-project?rev=56425&view=rev Log: add_partially_linked_object: Replaced nonexistent MESSAGE option in add_custom_command with COMMENT. It was forcing unconditional command execution. Modified: llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake Modified: llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake?rev=56425&r1=56424&r2=56425&view=diff ============================================================================== --- llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake (original) +++ llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake Sun Sep 21 21:33:43 2008 @@ -8,7 +8,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib) add_library( ${lib} STATIC ${ARGN}) add_custom_command(OUTPUT ${pll} - MESSAGE "Building ${lib}.o..." + COMMENT "Building ${lib}.o..." DEPENDS ${lib} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX} From sabre at nondot.org Sun Sep 21 22:12:18 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 21 Sep 2008 22:12:18 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2008-08-23/binaries_are_not_only_output.pdf index.html llvm_first_steps.pdf llvm_intro.pdf llvm_partial.pdf llvmjittut.pdf py2llvm.pdf rsltollvm.pdf Message-ID: <200809220312.m8M3CIXp022769@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2008-08-23: binaries_are_not_only_output.pdf added (r1.1) index.html added (r1.1) llvm_first_steps.pdf added (r1.1) llvm_intro.pdf added (r1.1) llvm_partial.pdf added (r1.1) llvmjittut.pdf added (r1.1) py2llvm.pdf added (r1.1) rsltollvm.pdf added (r1.1) --- Log message: initial checkin of Japan Gathering page --- Diffs of the changes: (+106 -0) binaries_are_not_only_output.pdf | 0 index.html | 106 +++++++++++++++++++++++++++++++++++++++ llvm_first_steps.pdf | 0 llvm_intro.pdf | 0 llvm_partial.pdf | 0 llvmjittut.pdf | 0 py2llvm.pdf | 0 rsltollvm.pdf | 0 8 files changed, 106 insertions(+) Index: llvm-www/devmtg/2008-08-23/binaries_are_not_only_output.pdf Index: llvm-www/devmtg/2008-08-23/index.html diff -c /dev/null llvm-www/devmtg/2008-08-23/index.html:1.1 *** /dev/null Sun Sep 21 22:12:16 2008 --- llvm-www/devmtg/2008-08-23/index.html Sun Sep 21 22:10:52 2008 *************** *** 0 **** --- 1,106 ---- + + +
      2008 LLVM Developers' Gathering in Japan
      + +

      This was the first LLVM gathering held on 23 Aug, 2008 in Japan.

      + +

      In the gathering, we introduced LLVM and explored use of LLVM for various + projects. Around 40 people was attended this gathering, so it was a bit larger + gathering in Japan.

      + +

      Following are sides used at the gathering, see also the Google Groups site.

      + +
      Proceedings
      + +

      The slides are in a mix of English and Japanese. Note that the Japanese + slides can be generally understood by English speakers by using online + translation tools such as Google translate.

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      MediaWhoDescription
      + [Slides Jp] + syoyoLLVM Overview
      + [Slides En] + syoyoUsing LLVM's JIT infastructure
      + [Slides En] + syoyoPartial evaluation with LLVM
      + [Slides En] + nyaxtLLVM First Steps [Code] +
      + [Slides Jp] + shinhAn LLVM benchmark
      + [Slides Jp] + syoyopy2llvm: Python to LLVM translator [Code]
      + [Slides En] + syoyoRSL (RenderMan Shading Language) - LLVM compiler project + proposal
      + [Slides Jp] + omoBinaries are not only output
      + + + +
      +
      + Valid CSS! + Valid HTML 4.01! +
      Last modified: $Date: 2008/09/22 03:10:52 $ +
      + + Index: llvm-www/devmtg/2008-08-23/llvm_first_steps.pdf Index: llvm-www/devmtg/2008-08-23/llvm_intro.pdf Index: llvm-www/devmtg/2008-08-23/llvm_partial.pdf Index: llvm-www/devmtg/2008-08-23/llvmjittut.pdf Index: llvm-www/devmtg/2008-08-23/py2llvm.pdf Index: llvm-www/devmtg/2008-08-23/rsltollvm.pdf From sabre at nondot.org Sun Sep 21 22:13:10 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 21 Sep 2008 22:13:10 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2008-08-23/index.html Message-ID: <200809220313.m8M3DAmC022846@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2008-08-23: index.html updated: 1.1 -> 1.2 --- Log message: link to the first page --- Diffs of the changes: (+2 -2) index.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/devmtg/2008-08-23/index.html diff -u llvm-www/devmtg/2008-08-23/index.html:1.1 llvm-www/devmtg/2008-08-23/index.html:1.2 --- llvm-www/devmtg/2008-08-23/index.html:1.1 Sun Sep 21 22:10:52 2008 +++ llvm-www/devmtg/2008-08-23/index.html Sun Sep 21 22:12:49 2008 @@ -56,7 +56,7 @@ - [Slides Jp] + [Slides Jp] shinh An LLVM benchmark @@ -100,7 +100,7 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2008/09/22 03:10:52 $ +
      Last modified: $Date: 2008/09/22 03:12:49 $ From sabre at nondot.org Sun Sep 21 22:14:16 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 21 Sep 2008 22:14:16 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/index.html Message-ID: <200809220314.m8M3EG3F022918@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg: index.html updated: 1.3 -> 1.4 --- Log message: link to japan meeting --- Diffs of the changes: (+4 -3) index.html | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm-www/devmtg/index.html diff -u llvm-www/devmtg/index.html:1.3 llvm-www/devmtg/index.html:1.4 --- llvm-www/devmtg/index.html:1.3 Sun Aug 3 16:10:27 2008 +++ llvm-www/devmtg/index.html Sun Sep 21 22:13:54 2008 @@ -5,8 +5,9 @@

      We have had these meetings so far:

      @@ -18,7 +19,7 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2008/08/03 21:10:27 $ +
      Last modified: $Date: 2008/09/22 03:13:54 $ From sabre at nondot.org Sun Sep 21 22:15:15 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 21 Sep 2008 22:15:15 -0500 Subject: [llvm-commits] CVS: llvm-www/header.incl Message-ID: <200809220315.m8M3FESA022983@zion.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.71 -> 1.72 --- Log message: add japan meeting --- Diffs of the changes: (+1 -0) header.incl | 1 + 1 files changed, 1 insertion(+) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.71 llvm-www/header.incl:1.72 --- llvm-www/header.incl:1.71 Sun Aug 3 16:04:44 2008 +++ llvm-www/header.incl Sun Sep 21 22:14:51 2008 @@ -93,6 +93,7 @@ Developer Mtgs
      + Aug 23, 2008
      Aug 1, 2008
      May 25, 2007
      From sabre at nondot.org Sun Sep 21 22:15:56 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 21 Sep 2008 22:15:56 -0500 Subject: [llvm-commits] CVS: llvm-www/header.incl Message-ID: <200809220315.m8M3FuIh023041@zion.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.72 -> 1.73 --- Log message: fix link --- Diffs of the changes: (+1 -1) header.incl | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.72 llvm-www/header.incl:1.73 --- llvm-www/header.incl:1.72 Sun Sep 21 22:14:51 2008 +++ llvm-www/header.incl Sun Sep 21 22:15:35 2008 @@ -93,7 +93,7 @@ Developer Mtgs
      - Aug 23, 2008
      + Aug 23, 2008
      Aug 1, 2008
      May 25, 2007
      From sabre at nondot.org Sun Sep 21 22:20:46 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 21 Sep 2008 22:20:46 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2008-08-23/index.html Message-ID: <200809220320.m8M3Kk70023222@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2008-08-23: index.html updated: 1.2 -> 1.3 --- Log message: In tokyo --- Diffs of the changes: (+2 -2) index.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/devmtg/2008-08-23/index.html diff -u llvm-www/devmtg/2008-08-23/index.html:1.2 llvm-www/devmtg/2008-08-23/index.html:1.3 --- llvm-www/devmtg/2008-08-23/index.html:1.2 Sun Sep 21 22:12:49 2008 +++ llvm-www/devmtg/2008-08-23/index.html Sun Sep 21 22:20:21 2008 @@ -2,7 +2,7 @@
      2008 LLVM Developers' Gathering in Japan
      -

      This was the first LLVM gathering held on 23 Aug, 2008 in Japan.

      +

      This was the first LLVM gathering held on 23 Aug, 2008 in Tokyo, Japan.

      In the gathering, we introduced LLVM and explored use of LLVM for various projects. Around 40 people was attended this gathering, so it was a bit larger @@ -100,7 +100,7 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2008/09/22 03:12:49 $ +
      Last modified: $Date: 2008/09/22 03:20:21 $ From sabre at nondot.org Sun Sep 21 22:20:46 2008 From: sabre at nondot.org (Chris Lattner) Date: Sun, 21 Sep 2008 22:20:46 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/index.html Message-ID: <200809220320.m8M3KkmB023220@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg: index.html updated: 1.4 -> 1.5 --- Log message: In tokyo --- Diffs of the changes: (+2 -2) index.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/devmtg/index.html diff -u llvm-www/devmtg/index.html:1.4 llvm-www/devmtg/index.html:1.5 --- llvm-www/devmtg/index.html:1.4 Sun Sep 21 22:13:54 2008 +++ llvm-www/devmtg/index.html Sun Sep 21 22:20:21 2008 @@ -5,7 +5,7 @@

      We have had these meetings so far:

      @@ -19,7 +19,7 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2008/09/22 03:13:54 $ +
      Last modified: $Date: 2008/09/22 03:20:21 $ From clattner at apple.com Sun Sep 21 22:26:22 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 20:26:22 -0700 Subject: [llvm-commits] [llvm] r56384 - in /llvm/trunk/lib/CodeGen: RegAllocLinearScan.cpp SimpleRegisterCoalescing.cpp In-Reply-To: References: <200809200203.m8K234YA013252@zion.cs.uiuc.edu> <4F71A860-E342-4A07-8211-0A59A1AA154D@apple.com> Message-ID: <8D81D6DA-8289-49E2-B352-53C6C313FDA8@apple.com> On Sep 21, 2008, at 7:41 PM, Evan Cheng wrote: >> If you model the early clobber def as starting one slot early, it >> will >> explicitly conflict with all inputs to the asm, and this can be >> backed >> out. > > While that's the correct approach, it breaks all kinds of assumptions > in liveintervals and the coalescer. It will make the problem much more > complicated. I don't think it's worth the effort. What sorts of assumptions? > Besides, from uArch point of view, "early clobber" is totally bogus. > It should really be "no read bypass". The correct way to model it > would be to delay read by one cycle. It typically doesn't have anything to do with a micro architecture, it has to do with the fact that an inline asm has multiple instructions. For example if you had an inline asm with: "$out0 = inst1 $in1, 4 $out1 = inst2 $in2, 142" Then you'd have to mark $out0 as being an early clobber, because it is stored to before $in2 is read. -Chris From clattner at apple.com Sun Sep 21 22:27:01 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 20:27:01 -0700 Subject: [llvm-commits] [llvm] r56310 - /llvm/trunk/lib/CodeGen/DeadMachineInstructionElim.cpp In-Reply-To: References: <200809181822.m8IIMW2k002887@zion.cs.uiuc.edu> <47A144A2-3B20-467D-8EAA-FB90DF12E434@apple.com> Message-ID: On Sep 21, 2008, at 7:42 PM, Evan Cheng wrote: > This happens before livevariables. Remember we don't run LV at -O0. Not even local liveness? That would be enough to handle physregs. -Chris From clattner at apple.com Sun Sep 21 22:35:26 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 20:35:26 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r55683 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200809030030.m830UAow025707@zion.cs.uiuc.edu> References: <200809030030.m830UAow025707@zion.cs.uiuc.edu> Message-ID: <9A1C108B-0D97-43F0-A358-EF94B5C5B1A5@apple.com> On Sep 2, 2008, at 5:30 PM, Devang Patel wrote: > Author: dpatel > Date: Tue Sep 2 19:30:09 2008 > New Revision: 55683 > > URL: http://llvm.org/viewvc/llvm-project?rev=55683&view=rev > Log: > Use function notes to encode attribute noinline. > +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Sep 2 19:30:09 2008 > @@ -651,12 +651,15 @@ > AttributeUsedGlobals.insert(Fn); > > // Handle noinline Functions > - if (lookup_attribute ("noinline", DECL_ATTRIBUTES (FnDecl))) { > + if (lookup_attribute ("noinline", DECL_ATTRIBUTES (FnDecl))) > + Fn->setNotes(FN_NOTE_NoInline); This should probably use something like "addNote(x)". If it had other notes for some reason, you wouldn't want to clobber them all. -Chris From clattner at apple.com Sun Sep 21 22:36:30 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 20:36:30 -0700 Subject: [llvm-commits] [llvm] r55673 - in /llvm/trunk: lib/Transforms/IPO/Inliner.cpp test/Transforms/Inline/2008-09-02-AlwaysInline.ll test/Transforms/Inline/2008-09-02-NoInline.ll In-Reply-To: References: <200809022216.m82MGDNg021600@zion.cs.uiuc.edu> <200809030859.25530.baldrick@free.fr> Message-ID: On Sep 3, 2008, at 9:41 AM, Devang Patel wrote: > > On Sep 2, 2008, at 11:59 PM, Duncan Sands wrote: > >> Hi Devang, >> >>> respect inline=never and inline=always notes. >> >> what happens if you set inline=always on a function >> that calls itself? Does the inliner go into an >> infinite loop? > > That'd be a bug. Ok, so what happens now? Is that a bug in the current code, or have you fixed that? -Chris From clattner at apple.com Sun Sep 21 22:40:26 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 20:40:26 -0700 Subject: [llvm-commits] [llvm] r55638 - /llvm/trunk/include/llvm/Function.h In-Reply-To: References: <200809021833.m82IXtBb013569@zion.cs.uiuc.edu> Message-ID: On Sep 3, 2008, at 10:39 AM, Devang Patel wrote: > On Sep 3, 2008, at 4:09 AM, Anton Korobeynikov wrote: >> Hello, Devang >> >>> +typedef unsigned FunctionNotes; >>> +const FunctionNotes FP_None = 0; >>> +const FunctionNotes FP_NoInline = 1<<0; >>> +const FunctionNotes FP_AlwaysInline = 1<<1; >>> +const FunctionNotes FP_OptimizeForSize = 1<<2; >> I don't see, how this differs from attribute applied to result of >> function. Also, how this is connected with your proposal? From your >> proposal I thought, that notes should allow users to pass arbitrary >> strings to differents parts of their code, allowing them to parse >> and >> use them accordingly. > > No, that was not the goal. These notes are not a replacement for > annotation instructions. Ok, but how are these any different from the current function attributes that we support (like nounwind)? >> Are we planning to add new "type" of note here each time we need it? >> This seems to be pretty inconvenient. What will happen, when we'll >> have > 64 different notes, or, "variadic" notes, say "foo=N", where N >> can be any integer (for example, some threshold, etc)? > > The idea is to encode the reason that impacts some threshold instead > of directly encoding threshold. Because the threshold is usually > specific to a transformation where the reason behind the threshold may > impact other passes also, for example encoding optimize-for-size is a > better then encoding inline-threshold=200. I agree. > IMO, thresholds are implementation details that never > should be exposed to end users. We, llvm developers, should fine tune > them to meet developers' needs. The magic numbers associated with a > threshold usually confuses developers and restricts llvm developers. > For example, keep meaning of -inline-threshold=200 consistent even > though you fixed a bug in how inline costs are calculated! I really really agree :) >> Are we planning >> to drop "custom" notes? If yes - them now I'm just seeing duplicating >> existing paramattrs functionality. > > paramattrs are associated with parameter, this is associated with the > definition. Some of the paramattrs can be used with call/invoke > instructions, e.g. nounwind. Where as notes are never associated with > call/invoke instruction. I guess that I don't understand what you're saying here. Are you saying that there should be two "namespaces", one for function attributes and one for arg/retval attributes? Are you saying that attributes are distinct from notes because attributes are applied to call sites also? It seems that function attributes are strictly more general than notes, why not just add these as attributes? -Chris From nicholas at mxc.ca Sun Sep 21 22:42:59 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 21 Sep 2008 22:42:59 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2008-08-23/index.html Message-ID: <200809220342.m8M3gxEV024389@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2008-08-23: index.html updated: 1.3 -> 1.4 --- Log message: Fix a typo; sides -> slides --- Diffs of the changes: (+2 -2) index.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/devmtg/2008-08-23/index.html diff -u llvm-www/devmtg/2008-08-23/index.html:1.3 llvm-www/devmtg/2008-08-23/index.html:1.4 --- llvm-www/devmtg/2008-08-23/index.html:1.3 Sun Sep 21 22:20:21 2008 +++ llvm-www/devmtg/2008-08-23/index.html Sun Sep 21 22:42:25 2008 @@ -8,7 +8,7 @@ projects. Around 40 people was attended this gathering, so it was a bit larger gathering in Japan.

      -

      Following are sides used at the gathering, see also the Following are slides used at the gathering, see also the Google Groups site.

      Proceedings
      @@ -100,7 +100,7 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2008/09/22 03:20:21 $ +
      Last modified: $Date: 2008/09/22 03:42:25 $ From clattner at apple.com Sun Sep 21 22:43:09 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 20:43:09 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r55718 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <200809032001.m83K1RkI012649@zion.cs.uiuc.edu> References: <200809032001.m83K1RkI012649@zion.cs.uiuc.edu> Message-ID: <4DF68CD0-1A0C-4B54-AE37-0F8D18FDF11D@apple.com> On Sep 3, 2008, at 1:01 PM, Devang Patel wrote: > Author: dpatel > Date: Wed Sep 3 15:01:27 2008 > New Revision: 55718 > > URL: http://llvm.org/viewvc/llvm-project?rev=55718&view=rev > Log: > Use AlwaysInliner to handle always_inline functions, if regular > inliner is not used. Ok > + else { > + // The inliner pass won't be inserted based on command line > options. > + // Use AlwaysInliner to handle functions that are marked as > always_inline. > + bool NeedAlwaysInliner = false; > + for (Module::iterator I = TheModule->begin(), E = TheModule- > >end(); > + I != E; ++I) > + if (!I->isDeclaration() && I->getNotes() == > FN_NOTE_AlwaysInline) { > + NeedAlwaysInliner = true; > + break; > + } > + if (NeedAlwaysInliner) > + PM->add(createAlwaysInlinerPass()); Please don't do this loop here, just unconditionally add it to the passmgr. Is there some advantage to checking here (in llvmgcc) rather than in the pass itself? -Chris > > + } > if (optimize > 2) > PM->add(createArgumentPromotionPass()); // Scalarize > uninlined fn args > if (!flag_no_simplify_libcalls) > @@ -431,7 +444,7 @@ > if (optimize > 1 && flag_unit_at_a_time) > PM->add(createConstantMergePass()); // Merge dup global > constants > } > - > + > if (emit_llvm_bc) { > // Emit an LLVM .bc file to the output. This is used when passed > // -emit-llvm -c to the GCC driver. > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Sun Sep 21 23:13:05 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 21:13:05 -0700 Subject: [llvm-commits] [llvm] r55745 - /llvm/trunk/lib/Transforms/IPO/Inliner.cpp In-Reply-To: <200809042047.18686.baldrick@free.fr> References: <200809032306.m83N69Hs018733@zion.cs.uiuc.edu> <200809041031.45519.baldrick@free.fr> <99BE46F1-475D-45AE-BAE7-B5B5095CE943@apple.com> <200809042047.18686.baldrick@free.fr> Message-ID: >> I disagree. If the programmer did not want F to get very big then he >> should not use -O3 to compiler F. I agree with Devang here, if a function is compiled at -O3, the inliner should try to inline *into* it, even if it may grow that function. If a function is compiled with -Os, the compiler should avoid growing that function. Devang, please make sure this is spelled out clearly in LangRef >> > Well, maybe. People doing LTO might be surprised that the routines > they carefully compiled originally using -Os have grown jumbo-sized > in the final bitcode. Normal people use -Os or -O3 for their whole program :). I don't think there are any existing programs using the gnu toolchain that would have this problem. > So I think in fact there is no issue here after all! Even better :) -Chris From clattner at apple.com Sun Sep 21 23:24:20 2008 From: clattner at apple.com (Chris Lattner) Date: Sun, 21 Sep 2008 21:24:20 -0700 Subject: [llvm-commits] [llvm] r56268 - in /llvm/trunk: include/llvm/CodeGen/LinkAllCodegenComponents.h include/llvm/CodeGen/Passes.h lib/CodeGen/DeadMachineInstructionElim.cpp In-Reply-To: <200809170043.m8H0hPQK019214@zion.cs.uiuc.edu> References: <200809170043.m8H0hPQK019214@zion.cs.uiuc.edu> Message-ID: On Sep 16, 2008, at 5:43 PM, Dan Gohman wrote: > Author: djg > Date: Tue Sep 16 19:43:24 2008 > New Revision: 56268 > > URL: http://llvm.org/viewvc/llvm-project?rev=56268&view=rev > Log: > Add a new MachineInstr-level DCE pass. It is very simple, and is > intended to > be used with fast-isel. Ok. > +bool > DeadMachineInstructionElim::runOnMachineFunction(MachineFunction > &MF) { > + bool AnyChanges = false; > + const MachineRegisterInfo &MRI = MF.getRegInfo(); > + const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); > + bool SawStore = true; > + > + // Loop over all instructions in all blocks, from bottom to top, > so that it's > + // more likely that chains of dependent but ultimately dead > instructions will > + // be cleaned up. > + for (MachineFunction::reverse_iterator I = MF.rbegin(), E = > MF.rend(); > + I != E; ++I) { This looks pretty nice to me. The one big "problem" is that defs of physregs prevent an instruction from being removed. Since physreg defs can only be local before regalloc, and since you're walking backward through the block already, can you just keep track of uses of physregs as you scan backward? > + MachineBasicBlock *MBB = &*I; > + for (MachineBasicBlock::reverse_iterator MII = MBB->rbegin(), > + MIE = MBB->rend(); MII != MIE; ) { > + MachineInstr *MI = &*MII; > + > + // Don't delete instructions with side effects. > + if (MI->isSafeToMove(&TII, SawStore)) { Is this really the right predicate? Why not check explicitly for side effects? Just to avoid nesting, how about: if (!MI->isSafeToMove(&TII, SawStore)) { ++MII; continue; } > > + // Examine each operand. > + bool AllDefsDead = true; > + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { > + const MachineOperand &MO = MI->getOperand(i); > + if (MO.isRegister() && MO.isDef()) { > + unsigned Reg = MO.getReg(); > + if (TargetRegisterInfo::isPhysicalRegister(Reg) || > + !MRI.use_empty(Reg)) { > + // This def has a use. Don't delete the instruction! > + AllDefsDead = false; > + break; > + } > + } > + } Please split this out to a helper function. > > + > + // If there are no defs with uses, the instruction is dead. > + if (AllDefsDead) { > + // Clear out the operands to take the registers out of > their > + // use chains. > + while (unsigned Num = MI->getNumOperands()) > + MI->RemoveOperand(Num-1); Why do you need to do this? Just deleting the MI should be enough. -Chris From nicholas at mxc.ca Sun Sep 21 23:31:16 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 21 Sep 2008 23:31:16 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/2008-08-23/index.html Message-ID: <200809220431.m8M4VGwX026066@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg/2008-08-23: index.html updated: 1.4 -> 1.5 --- Log message: Fix comma-spliced sentence. --- Diffs of the changes: (+2 -2) index.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/devmtg/2008-08-23/index.html diff -u llvm-www/devmtg/2008-08-23/index.html:1.4 llvm-www/devmtg/2008-08-23/index.html:1.5 --- llvm-www/devmtg/2008-08-23/index.html:1.4 Sun Sep 21 22:42:25 2008 +++ llvm-www/devmtg/2008-08-23/index.html Sun Sep 21 23:30:48 2008 @@ -8,7 +8,7 @@ projects. Around 40 people was attended this gathering, so it was a bit larger gathering in Japan.

      -

      Following are slides used at the gathering, see also the Following are slides used at the gathering. See also the Google Groups site.

      Proceedings
      @@ -100,7 +100,7 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2008/09/22 03:42:25 $ +
      Last modified: $Date: 2008/09/22 04:30:48 $