[llvm-commits] [llvm] r46307 - in /llvm/trunk: lib/Target/X86/X86ISelDAGToDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/fp-stack-direct-ret.ll test/CodeGen/

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Thu Jan 24 02:07:48 2008
New Revision: 46307

URL: http://llvm.org/viewvc/llvm-project?rev=46307&view=rev
Log:
Significantly simplify and improve handling of FP function results on x86-32.
This case returns the value in ST(0) and then has to convert it to an SSE
register.  This causes significant codegen ugliness in some cases.  For 
example in the trivial fp-stack-direct-ret.ll testcase we used to generate:

_bar:
subl$28, %esp
callL_foo$stub
fstpl   16(%esp)
movsd   16(%esp), %xmm0
movsd   %xmm0, 8(%esp)
fldl8(%esp)
addl$28, %esp
ret

because we move the result of foo() into an XMM register, then have to
move it back for the return of bar.

Instead of hacking ever-more special cases into the call result lowering code
we take a much simpler approach: on x86-32, fp return is modeled as always 
returning into an f80 register which is then truncated to f32 or f64 as needed.
Similarly for a result, we model it as an extension to f80 + return.

This exposes the truncate and extensions to the dag combiner, allowing target
independent code to hack on them, eliminating them in this case.  This gives 
us this code for the example above:

_bar:
subl$12, %esp
callL_foo$stub
addl$12, %esp
ret

The nasty aspect of this is that these conversions are not legal, but we want
the second pass of dag combiner (post-legalize) to be able to hack on them.
To handle this, we lie to legalize and say they are legal, then custom expand
them on entry to the isel pass (PreprocessForFPConvert).  This is gross, but
less gross than the code it is replacing :)

This also allows us to generate better code in several other cases.  For 
example on fp-stack-ret-conv.ll, we now generate:

_test:
subl$12, %esp
callL_foo$stub
fstps   8(%esp)
movl16(%esp), %eax
cvtss2sd8(%esp), %xmm0
movsd   %xmm0, (%eax)
addl$12, %esp
ret

where before we produced (incidentally, the old bad code is identical to what
gcc produces):

_test:
subl$12, %esp
callL_foo$stub
fstpl   (%esp)
cvtsd2ss(%esp), %xmm0
cvtss2sd%xmm0, %xmm0
movl16(%esp), %eax
movsd   %xmm0, (%eax)
addl$12, %esp
ret

Note that we generate slightly worse code on pr1505b.ll due to a scheduling 
deficiency that is unrelated to this patch.


Added:
llvm/trunk/test/CodeGen/X86/fp-stack-direct-ret.ll
llvm/trunk/test/CodeGen/X86/fp-stack-ret-conv.ll
Modified:
llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86InstrSSE.td
llvm/trunk/test/CodeGen/X86/pr1505b.ll

Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=46307&r1=46306&r2=46307&view=diff

==
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Thu Jan 24 02:07:48 2008
@@ -156,7 +156,8 @@
 bool TryFoldLoad(SDOperand P, SDOperand N,
  SDOperand &Base, SDOperand &Scale,
  SDOperand &Index, SDOperand &Disp);
-void InstructionSelectPreprocess(SelectionDAG &DAG);
+void PreprocessForRMW(SelectionDAG &DAG);
+void PreprocessForFPConvert(SelectionDAG &DAG);
 
 /// SelectInlineAsmMemoryOperand - Implement addressing mode selection for
 /// inline asm expressions.
@@ -350,9 +351,10 @@
  Store.getOperand(2), Store.getOperand(3));
 }
 
-/// InstructionSelectPreprocess - Preprocess the DAG to allow the instruction
-/// selector to pick more load-modify-store instructions. This is a common
-/// case:
+/// PreprocessForRMW - Preprocess the DAG to make instruction selection better.
+/// This is only run if not in -fast mode (aka -O0).
+/// This allows the instruction selector to pick more read-modify-write
+/// instructions. This is a common case:
 ///
 /// [Load chain]
 /// ^
@@ -389,7 +391,7 @@
 ///   \  /
 ///\/
 ///   [Store]
-void X86DAGToDAGISel::InstructionSelectPreprocess(SelectionDAG &DAG) {
+void X86DAGToDAGISel::PreprocessForRMW(SelectionDAG &DAG) {
   for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(),
  E = DAG.allnodes_end(); I != E; ++I) {
 if (!ISD::isNON_TRUNCStore(I))
@@ -459,6 +461,66 @@
   }
 }
 
+
+/// PreprocessForFPConvert - Walk over the dag lowering fpround and fpextend
+/// nodes that target the FP stack to be store and load to the stack.  This is 
a
+/// gross hack.  We would like to simply mark these as being illegal, but when
+/// we do that, legalize produces these when it expands calls, then expands
+/// these in the same legalize pass.  W

[llvm-commits] [llvm-gcc-4.2] r46308 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

2008-01-24 Thread Bill Wendling
Author: void
Date: Thu Jan 24 02:09:17 2008
New Revision: 46308

URL: http://llvm.org/viewvc/llvm-project?rev=46308&view=rev
Log:
The initialization for _OBJC_IVAR_$_.b symbols are dropped
for -O0. As it turns out, the LLVM variable is created at -O0 before the
initialization is set to the correct value. It defaults to 0, so these use the
zero filled directive, which is wrong.

Reset the initialization on LLVM variables when needed.

objc2-bitfield-abi-1.m is a testcase that exercises this.

Modified:
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

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=46308&r1=46307&r2=46308&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Thu Jan 24 02:09:17 2008
@@ -10659,6 +10659,13 @@
   tree decl = TREE_PURPOSE (chain);
   tree offset = TREE_VALUE (chain);
   finish_var_decl (decl, offset);  
+  /* LOCAL LLVM begin - radar 5698757 */
+#ifdef ENABLE_LLVM
+  /* Reset the initializer for this reference as it may have changed with
+ -O0  */
+  reset_initializer_llvm (decl);
+#endif
+  /* LOCAL LLVM end - radar 5698757 */
 }
 }
 


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.2] r46309 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

2008-01-24 Thread Bill Wendling
Author: void
Date: Thu Jan 24 02:11:43 2008
New Revision: 46309

URL: http://llvm.org/viewvc/llvm-project?rev=46309&view=rev
Log:
Only reset the initializer at -O0.

Modified:
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

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=46309&r1=46308&r2=46309&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Thu Jan 24 02:11:43 2008
@@ -10659,13 +10659,14 @@
   tree decl = TREE_PURPOSE (chain);
   tree offset = TREE_VALUE (chain);
   finish_var_decl (decl, offset);  
-  /* LOCAL LLVM begin - radar 5698757 */
+  /* LLVM LOCAL begin - radar 5698757 */
 #ifdef ENABLE_LLVM
   /* Reset the initializer for this reference as it may have changed with
  -O0  */
-  reset_initializer_llvm (decl);
+  if (!optimize)
+reset_initializer_llvm (decl);
 #endif
-  /* LOCAL LLVM end - radar 5698757 */
+  /* LLVM LOCAL end - radar 5698757 */
 }
 }
 


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-www/www-index.html

2008-01-24 Thread Tanya Lattner


Changes in directory llvm-www:

www-index.html updated: 1.150 -> 1.151
---
Log message:

Update 2.2 release schedule.


---
Diffs of the changes:  (+5 -5)

 www-index.html |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)


Index: llvm-www/www-index.html
diff -u llvm-www/www-index.html:1.150 llvm-www/www-index.html:1.151
--- llvm-www/www-index.html:1.150   Wed Jan  9 12:37:54 2008
+++ llvm-www/www-index.html Thu Jan 24 02:12:47 2008
@@ -119,11 +119,11 @@
   LLVM 2.2 release schedule:
 
 Jan 16, 2008: Branch creation/Code Freeze (9PM PST).
-Jan 18, 2008: First round of pre-release testing begins.
-Jan 28, 2008: Pre-release testing ends. 
-Jan 30, 2008: Second round of pre-release testing begins.
-Feb  3, 2008: Pre-release testing ends.
-Feb  4, 2008: 2.2 released.
+Jan 24, 2008: First round of pre-release testing begins.
+Feb  1, 2008: Pre-release testing ends. 
+Feb  3, 2008: Second round of pre-release testing begins.
+Feb  10, 2008: Pre-release testing ends.
+Feb  11, 2008: 2.2 released.
 
 
 



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.0] r46311 - /llvm-gcc-4.0/trunk/gcc/objc/objc-act.c

2008-01-24 Thread Bill Wendling
Author: void
Date: Thu Jan 24 02:51:17 2008
New Revision: 46311

URL: http://llvm.org/viewvc/llvm-project?rev=46311&view=rev
Log:
backporting r46308:

The initialization for _OBJC_IVAR_$_.b symbols are
dropped
for -O0. As it turns out, the LLVM variable is created at -O0 before the
initialization is set to the correct value. It defaults to 0, so these
use the
zero filled directive, which is wrong.

Reset the initialization on LLVM variables when needed.

objc2-bitfield-abi-1.m is a testcase that exercises this.


Modified:
llvm-gcc-4.0/trunk/gcc/objc/objc-act.c

Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=46311&r1=46310&r2=46311&view=diff

==
--- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Thu Jan 24 02:51:17 2008
@@ -10635,6 +10635,14 @@
   tree decl = TREE_PURPOSE (chain);
   tree offset = TREE_VALUE (chain);
   finish_var_decl (decl, offset);  
+  /* LLVM LOCAL begin - radar 5698757 */
+#ifdef ENABLE_LLVM
+  /* Reset the initializer for this reference as it may have changed with
+ -O0  */
+  if (!optimize)
+reset_initializer_llvm (decl);
+#endif
+  /* LLVM LOCAL end - radar 5698757 */
 }
 }
 


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46305 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2008-01-24 Thread Duncan Sands
Hi Chris,

> +// Add any uses of the old node to the worklist if they have a single
> +// use.  They may be dead after this node is deleted.
> +for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
> +  AddToWorkList(N->getOperand(i).Val);

the comment says "if they have a single use", but the operands are added
unconditionally...

Ciao,

Duncan.
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.0] r46312 - /llvm-gcc-4.0/trunk/gcc/objc/objc-act.c

2008-01-24 Thread Bill Wendling
Author: void
Date: Thu Jan 24 03:48:00 2008
New Revision: 46312

URL: http://llvm.org/viewvc/llvm-project?rev=46312&view=rev
Log:
Ahem...reset_initializer_llvm doesn't exist in 4.0...

Modified:
llvm-gcc-4.0/trunk/gcc/objc/objc-act.c

Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=46312&r1=46311&r2=46312&view=diff

==
--- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Thu Jan 24 03:48:00 2008
@@ -10635,14 +10635,6 @@
   tree decl = TREE_PURPOSE (chain);
   tree offset = TREE_VALUE (chain);
   finish_var_decl (decl, offset);  
-  /* LLVM LOCAL begin - radar 5698757 */
-#ifdef ENABLE_LLVM
-  /* Reset the initializer for this reference as it may have changed with
- -O0  */
-  if (!optimize)
-reset_initializer_llvm (decl);
-#endif
-  /* LLVM LOCAL end - radar 5698757 */
 }
 }
 


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm-gcc-4.2] r46281 - in /llvm-gcc-4.2/trunk/gcc: config/darwin.h objc/objc-act.c

2008-01-24 Thread Duncan Sands
On Thursday 24 January 2008 08:45:28 Bill Wendling wrote:
> Hi Duncan,
> 
> >> GCC barfs this to the .s file directly:
> >>
> >> .objc_class_name_CrashTestPlugin=0
> >> .globl .objc_class_name_CrashTestPlugin
> >
> > it looks like you write this directly to a file
> > containing LLVM IR.  I guess this is OK as long
> > as no-one is using the global in the IR (otherwise
> > the verifier will barf).  Is that the case?
> >
> This is what I understand to be happening. The GCC version of this  
> doesn't even create a tree node for these, so it shouldn't be  
> generating a use of it. I'm taking that to imply that the GCC to LLVM  
> converter won't create a use of it.

Does this work whether writing LLVM assembler or
LLVM bitcode?

Ciao,

D.
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46305 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2008-01-24 Thread Chris Lattner

On Jan 24, 2008, at 1:05 AM, Duncan Sands wrote:

> Hi Chris,
>
>> +// Add any uses of the old node to the worklist if they  
>> have a single
>> +// use.  They may be dead after this node is deleted.
>> +for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
>> +  AddToWorkList(N->getOperand(i).Val);
>
> the comment says "if they have a single use", but the operands are  
> added
> unconditionally...

Nice catch.  The issue is that a node can use another node multiple  
times (add x, x). I'll update the comment, thanks.

-Chris
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46313 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Thu Jan 24 11:10:01 2008
New Revision: 46313

URL: http://llvm.org/viewvc/llvm-project?rev=46313&view=rev
Log:
clarify a comment, thanks Duncan.

Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=46313&r1=46312&r2=46313&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Jan 24 11:10:01 2008
@@ -607,8 +607,9 @@
 AddToWorkList(RV.Val);
 AddUsersToWorkList(RV.Val);
 
-// Add any uses of the old node to the worklist if they have a single
-// use.  They may be dead after this node is deleted.
+// Add any uses of the old node to the worklist in case this node is 
the
+// last one that uses them.  They may become dead after this node is
+// deleted.
 for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
   AddToWorkList(N->getOperand(i).Val);
   


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46314 - in /llvm/trunk: include/llvm/Argument.h lib/VMCore/Function.cpp

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Thu Jan 24 11:47:11 2008
New Revision: 46314

URL: http://llvm.org/viewvc/llvm-project?rev=46314&view=rev
Log:
Add hasByValAttr() and hasNoAliasAttr() methods to the Argument class.

Modified:
llvm/trunk/include/llvm/Argument.h
llvm/trunk/lib/VMCore/Function.cpp

Modified: llvm/trunk/include/llvm/Argument.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Argument.h?rev=46314&r1=46313&r2=46314&view=diff

==
--- llvm/trunk/include/llvm/Argument.h (original)
+++ llvm/trunk/include/llvm/Argument.h Thu Jan 24 11:47:11 2008
@@ -39,13 +39,24 @@
   /// Argument ctor - If Function argument is specified, this argument is
   /// inserted at the end of the argument list for the function.
   ///
-  explicit Argument(const Type *Ty,
-const std::string &Name = "",
+  explicit Argument(const Type *Ty, const std::string &Name = "",
 Function *F = 0);
 
   inline const Function *getParent() const { return Parent; }
   inline   Function *getParent()   { return Parent; }
 
+  /// getArgNo - Return the index of this formal argument in its containing
+  /// function.  For example in "void foo(int a, float b)" a is 0 and b is 1. 
+  unsigned getArgNo() const;
+  
+  /// hasByValAttr - Return true if this argument has the byval attribute on it
+  /// in its containing function.
+  bool hasByValAttr() const;
+
+  /// hasNoAliasAttr - Return true if this argument has the noalias attribute 
on
+  /// it in its containing function.
+  bool hasNoAliasAttr() const;
+  
   virtual void print(std::ostream &OS) const;
   void print(std::ostream *OS) const {
 if (OS) print(*OS);

Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=46314&r1=46313&r2=46314&view=diff

==
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Thu Jan 24 11:47:11 2008
@@ -75,6 +75,37 @@
 LeakDetector::removeGarbageObject(this);
 }
 
+/// getArgNo - Return the index of this formal argument in its containing
+/// function.  For example in "void foo(int a, float b)" a is 0 and b is 1. 
+unsigned Argument::getArgNo() const {
+  const Function *F = getParent();
+  assert(F && "Argument is not in a function");
+  
+  Function::const_arg_iterator AI = F->arg_begin();
+  unsigned ArgIdx = 0;
+  for (; &*AI != this; ++AI)
+++ArgIdx;
+
+  return ArgIdx;
+}
+
+/// hasByValAttr - Return true if this argument has the byval attribute on it
+/// in its containing function.
+bool Argument::hasByValAttr() const {
+  if (!isa(getType())) return false;
+  return getParent()->paramHasAttr(getArgNo()+1, ParamAttr::ByVal);
+}
+
+/// hasNoAliasAttr - Return true if this argument has the noalias attribute on
+/// it in its containing function.
+bool Argument::hasNoAliasAttr() const {
+  if (!isa(getType())) return false;
+  return getParent()->paramHasAttr(getArgNo()+1, ParamAttr::NoAlias);
+}
+
+
+
+
 
//===--===//
 // Helper Methods in Function
 
//===--===//


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46315 - in /llvm/trunk: lib/Analysis/BasicAliasAnalysis.cpp test/Analysis/BasicAA/byval.ll

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Thu Jan 24 12:00:32 2008
New Revision: 46315

URL: http://llvm.org/viewvc/llvm-project?rev=46315&view=rev
Log:
Teach basicaa that 'byval' arguments define a new memory location that
can't be aliased to other known objects.  This allows us to know that byval 
pointer args don't alias globals, etc.

Added:
llvm/trunk/test/Analysis/BasicAA/byval.ll
Modified:
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=46315&r1=46314&r2=46315&view=diff

==
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Thu Jan 24 12:00:32 2008
@@ -138,9 +138,10 @@
   return new BasicAliasAnalysis();
 }
 
-// getUnderlyingObject - This traverses the use chain to figure out what object
-// the specified value points to.  If the value points to, or is derived from, 
a
-// unique object or an argument, return it.
+/// getUnderlyingObject - This traverses the use chain to figure out what 
object
+/// the specified value points to.  If the value points to, or is derived from,
+/// a unique object or an argument, return it.  This returns:
+///Arguments, GlobalVariables, Functions, Allocas, Mallocs.
 static const Value *getUnderlyingObject(const Value *V) {
   if (!isa(V->getType())) return 0;
 
@@ -241,41 +242,29 @@
 //
 AliasAnalysis::ModRefResult
 BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
-  if (!isa(P))
-if (const AllocationInst *AI =
-  dyn_cast_or_null(getUnderlyingObject(P))) {
+  if (!isa(P)) {
+const Value *Object = getUnderlyingObject(P);
+// Allocations and byval arguments are "new" objects.
+if (isa(Object) ||
+(isa(Object) && cast(Object)->hasByValAttr())) {
   // Okay, the pointer is to a stack allocated object.  If we can prove 
that
   // the pointer never "escapes", then we know the call cannot clobber it,
   // because it simply can't get its address.
-  if (!AddressMightEscape(AI))
+  if (!AddressMightEscape(Object))
 return NoModRef;
 
   // If this is a tail call and P points to a stack location, we know that
   // the tail call cannot access or modify the local stack.
   if (CallInst *CI = dyn_cast(CS.getInstruction()))
-if (CI->isTailCall() && isa(AI))
+if (CI->isTailCall() && !isa(Object))
   return NoModRef;
 }
+  }
 
   // The AliasAnalysis base class has some smarts, lets use them.
   return AliasAnalysis::getModRefInfo(CS, P, Size);
 }
 
-static bool isNoAliasArgument(const Argument *Arg) {
-  const Function *Func = Arg->getParent();
-  const ParamAttrsList *Attr = Func->getParamAttrs();
-  if (Attr) {
-unsigned Idx = 1;
-for (Function::const_arg_iterator I = Func->arg_begin(), 
-  E = Func->arg_end(); I != E; ++I, ++Idx) {
-  if (&(*I) == Arg && 
-   Attr->paramHasAttr(Idx, ParamAttr::NoAlias))
-return true;
-}
-  }
-  return false;
-}
-
 // alias - Provide a bunch of ad-hoc rules to disambiguate in common cases, 
such
 // as array references.  Note that this function is heavily tail recursive.
 // Hopefully we have a smart C++ compiler.  :)
@@ -317,9 +306,12 @@
 
 // If they are two different objects, and one is a noalias argument
 // then they do not alias.
-if (O1 != O2 && isNoAliasArgument(O1Arg))
+if (O1 != O2 && O1Arg->hasNoAliasAttr())
   return NoAlias;
-  
+
+// Byval arguments can't alias globals or other arguments.
+if (O1 != O2 && O1Arg->hasByValAttr()) return NoAlias;
+
 // Otherwise, nothing is known...
   } 
   
@@ -329,16 +321,18 @@
 
 // If they are two different objects, and one is a noalias argument
 // then they do not alias.
-if (O1 != O2 && isNoAliasArgument(O2Arg))
+if (O1 != O2 && O2Arg->hasNoAliasAttr())
   return NoAlias;
   
+// Byval arguments can't alias globals or other arguments.
+if (O1 != O2 && O2Arg->hasByValAttr()) return NoAlias;
+
 // Otherwise, nothing is known...
   
-  } else if (O1 != O2) {
-if (!isa(O1))
-  // If they are two different objects, and neither is an argument,
-  // we know that we have no alias...
-  return NoAlias;
+  } else if (O1 != O2 && !isa(O1)) {
+// If they are two different objects, and neither is an argument,
+// we know that we have no alias.
+return NoAlias;
   }
 
   // If they are the same object, they we can look at the indexes.  If they
@@ -347,9 +341,15 @@
   // can't tell anything.
 }
 
-
-if (!isa(O1) && isa(V2))
-  return NoAlias;// Unique values don't alias 

Re: [llvm-commits] [llvm-gcc-4.2] r46281 - in /llvm-gcc-4.2/trunk/gcc: config/darwin.h objc/objc-act.c

2008-01-24 Thread Bill Wendling
On Jan 24, 2008 3:31 AM, Duncan Sands <[EMAIL PROTECTED]> wrote:
>
> On Thursday 24 January 2008 08:45:28 Bill Wendling wrote:
> > Hi Duncan,
> >
> > >> GCC barfs this to the .s file directly:
> > >>
> > >> .objc_class_name_CrashTestPlugin=0
> > >> .globl .objc_class_name_CrashTestPlugin
> > >
> > > it looks like you write this directly to a file
> > > containing LLVM IR.  I guess this is OK as long
> > > as no-one is using the global in the IR (otherwise
> > > the verifier will barf).  Is that the case?
> > >
> > This is what I understand to be happening. The GCC version of this
> > doesn't even create a tree node for these, so it shouldn't be
> > generating a use of it. I'm taking that to imply that the GCC to LLVM
> > converter won't create a use of it.
>
> Does this work whether writing LLVM assembler or
> LLVM bitcode?
>
This is how it's output to the .ll file:

module asm "\09.objc_class_name_Sub2=0"
module asm "\09.globl .objc_class_name_Sub2"

So yes. Note that this is something already being done. See the
ASM_DECLARE_UNRESOLVED_REFERENCE macro in the gcc/config/darwin.h
file.

-bw
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46316 - /llvm/trunk/include/llvm/ADT/APSInt.h

2008-01-24 Thread Ted Kremenek
Author: kremenek
Date: Thu Jan 24 12:59:52 2008
New Revision: 46316

URL: http://llvm.org/viewvc/llvm-project?rev=46316&view=rev
Log:
Added additional overloaded operators for APSInt to match the operators of
APInt.

While some operators were already specifically overloaded for APSInt, others
resulted in using the overloaded operator methods in APInt, which would result
in the signedness bit being lost.

Modified the APSInt(APInt&) constructor to be "explicit" and to take an
extra (optional) flag to indicate the signedness.  Making the ctor explicit
will catch any implicit conversations between APSInt -> APInt -> APSInt that
results in the signedness flag being lost.

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=46316&r1=46315&r2=46316&view=diff

==
--- llvm/trunk/include/llvm/ADT/APSInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APSInt.h Thu Jan 24 12:59:52 2008
@@ -26,7 +26,9 @@
   /// APSInt ctor - Create an APSInt with the specified width, default to
   /// unsigned.
   explicit APSInt(uint32_t BitWidth) : APInt(BitWidth, 0), IsUnsigned(true) {}
-  APSInt(const APInt &I) : APInt(I), IsUnsigned(true) {}
+
+  explicit APSInt(const APInt &I, bool isUnsigned = true) 
+   : APInt(I), IsUnsigned(isUnsigned) {}
 
   APSInt &operator=(const APSInt &RHS) {
 APInt::operator=(RHS); 
@@ -58,6 +60,21 @@
 return APInt::toString(Radix, isSigned());
   }
   
+  APSInt& extend(uint32_t width) {
+if (IsUnsigned)
+  zext(width);
+else
+  sext(width);
+return *this;
+  }
+  
+  APSInt& extOrTrunc(uint32_t width) {
+  if (IsUnsigned)
+zextOrTrunc(width);
+  else
+sextOrTrunc(width);
+  return *this;
+  }
   
   const APSInt &operator%=(const APSInt &RHS) {
 assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
@@ -77,38 +94,21 @@
   }
   APSInt operator%(const APSInt &RHS) const {
 assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-return IsUnsigned ? urem(RHS) : srem(RHS);
+return IsUnsigned ? APSInt(urem(RHS), true) : APSInt(srem(RHS), false);
   }
   APSInt operator/(const APSInt &RHS) const {
 assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
-return IsUnsigned ? udiv(RHS) : sdiv(RHS);
+return IsUnsigned ? APSInt(udiv(RHS), true) : APSInt(sdiv(RHS), false);
   }
   
-  const APSInt &operator>>=(unsigned Amt) {
-*this = *this >> Amt;
-return *this;
+  APSInt operator>>(unsigned Amt) const {
+return IsUnsigned ? APSInt(lshr(Amt), true) : APSInt(ashr(Amt), false);
   }
-  
-  APSInt& extend(uint32_t width) {
-if (IsUnsigned)
-  zext(width);
-else
-  sext(width);
+  APSInt& operator>>=(unsigned Amt) {
+*this = *this >> Amt;
 return *this;
   }
   
-  APSInt& extOrTrunc(uint32_t width) {
-  if (IsUnsigned)
-zextOrTrunc(width);
-  else
-sextOrTrunc(width);
-  return *this;
-  }
-  
-  APSInt operator>>(unsigned Amt) const {
-return IsUnsigned ? lshr(Amt) : ashr(Amt);
-  }
-  
   inline bool operator<(const APSInt& RHS) const {
 assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
 return IsUnsigned ? ult(RHS) : slt(RHS);
@@ -126,6 +126,106 @@
 return IsUnsigned ? uge(RHS) : sge(RHS);
   }
   
+  // The remaining operators just wrap the logic of APInt, but retain the
+  // signedness information.
+  
+  APSInt operator<<(unsigned Bits) {
+return APSInt(static_cast(*this) << Bits, IsUnsigned);
+  }  
+  APSInt& operator<<=(unsigned Amt) {
+*this = *this << Amt;
+return *this;
+  }
+  
+  APSInt& operator++() {
+static_cast(*this)++;
+return *this;
+  }
+  APSInt& operator--() {
+static_cast(*this)++;
+return *this;
+  }
+  APSInt operator++(int) {
+return APSInt(++static_cast(*this), IsUnsigned);
+  }
+  APSInt operator--(int) {
+return APSInt(--static_cast(*this), IsUnsigned);
+  } 
+  APSInt operator-() const {
+return APSInt(-static_cast(*this), IsUnsigned);
+  }  
+  APSInt& operator+=(const APSInt& RHS) {
+assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
+static_cast(*this) += RHS;
+return *this;
+  }  
+  APSInt& operator-=(const APSInt& RHS) {
+assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
+static_cast(*this) -= RHS;
+return *this;
+  }
+  APSInt& operator*=(const APSInt& RHS) {
+assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
+static_cast(*this) *= RHS;
+return *this;
+  }
+  APSInt& operator&=(const APSInt& RHS) {
+assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
+static_cast(*this) &= RHS;
+return *this;
+  }
+  APSInt& operator|=(const APSInt& RHS) {
+assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!");
+static_cast(*this) |

[llvm-commits] [llvm] r46318 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Thu Jan 24 13:07:10 2008
New Revision: 46318

URL: http://llvm.org/viewvc/llvm-project?rev=46318&view=rev
Log:
getUnderlyingObject can return null, handle this.

Modified:
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=46318&r1=46317&r2=46318&view=diff

==
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Thu Jan 24 13:07:10 2008
@@ -245,8 +245,9 @@
   if (!isa(P)) {
 const Value *Object = getUnderlyingObject(P);
 // Allocations and byval arguments are "new" objects.
-if (isa(Object) ||
-(isa(Object) && cast(Object)->hasByValAttr())) {
+if (Object &&
+(isa(Object) ||
+ (isa(Object) && cast(Object)->hasByValAttr( {
   // Okay, the pointer is to a stack allocated object.  If we can prove 
that
   // the pointer never "escapes", then we know the call cannot clobber it,
   // because it simply can't get its address.


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46320 - /llvm/trunk/lib/CodeGen/ShadowStackCollector.cpp

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Thu Jan 24 13:28:11 2008
New Revision: 46320

URL: http://llvm.org/viewvc/llvm-project?rev=46320&view=rev
Log:
Don't dump the function!

Modified:
llvm/trunk/lib/CodeGen/ShadowStackCollector.cpp

Modified: llvm/trunk/lib/CodeGen/ShadowStackCollector.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ShadowStackCollector.cpp?rev=46320&r1=46319&r2=46320&view=diff

==
--- llvm/trunk/lib/CodeGen/ShadowStackCollector.cpp (original)
+++ llvm/trunk/lib/CodeGen/ShadowStackCollector.cpp Thu Jan 24 13:28:11 2008
@@ -426,8 +426,6 @@
 Roots[I].second->eraseFromParent();
   }
   
-  F.dump();
-  
   Roots.clear();
   return true;
 }


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.2] r46322 - /llvm-gcc-4.2/trunk/gcc/config/darwin.c

2008-01-24 Thread Dale Johannesen
Author: johannes
Date: Thu Jan 24 14:54:56 2008
New Revision: 46322

URL: http://llvm.org/viewvc/llvm-project?rev=46322&view=rev
Log:
Move some data into the correct sections for ObjC ABI V2.


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=46322&r1=46321&r2=46322&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Thu Jan 24 14:54:56 2008
@@ -1563,9 +1563,13 @@
   else if (!strncmp (name, "CLASS_REFERENCES", 16))
 return "__OBJC,__cls_refs,literal_pointers,no_dead_strip";
   else if (!strncmp (name, "CLASS_", 6))
-return "__OBJC,__class,regular,no_dead_strip";
+return (flag_objc_abi == 1 ? 
+"__OBJC,__class,regular,no_dead_strip" :
+"__DATA,__data");
   else if (!strncmp (name, "METACLASS_", 10))
-return "__OBJC,__meta_class,regular,no_dead_strip";
+return (flag_objc_abi == 1 ?
+"__OBJC,__meta_class,regular,no_dead_strip" :
+"__DATA,__data");
   else if (!strncmp (name, "CATEGORY_", 9))
 return "__OBJC,__category,regular,no_dead_strip";
   else if (!strncmp (name, "SELECTOR_REFERENCES", 19))


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.2] r46324 - in /llvm-gcc-4.2/trunk/gcc: config/darwin.h objc/objc-act.c

2008-01-24 Thread Bill Wendling
Author: void
Date: Thu Jan 24 15:00:50 2008
New Revision: 46324

URL: http://llvm.org/viewvc/llvm-project?rev=46324&view=rev
Log:
Don't output these directives for the new ObjC ABI.

Modified:
llvm-gcc-4.2/trunk/gcc/config/darwin.h
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

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=46324&r1=46323&r2=46324&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Thu Jan 24 15:00:50 2008
@@ -954,7 +954,7 @@
 #define ASM_DECLARE_CLASS_REFERENCE(FILE,NAME)  \
   do {  \
 if (FILE) { \
-  char *Buffer = alloca(strlen(NAME)+30);   \
+  char *Buffer = alloca(strlen(NAME) + 30); \
   sprintf(Buffer, "\t%s=0", NAME);  \
   llvm_emit_file_scope_asm(Buffer); \
   sprintf(Buffer, "\t.globl %s", NAME); \

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=46324&r1=46323&r2=46324&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Thu Jan 24 15:00:50 2008
@@ -18412,7 +18412,12 @@
 #ifdef ASM_DECLARE_CLASS_REFERENCE
   if (flag_next_runtime)
 {
-  ASM_DECLARE_CLASS_REFERENCE (asm_out_file, string);
+  /* LLVM LOCAL begin - radar 5702446 */
+#ifdef ENABLE_LLVM
+  if (flag_objc_abi != 2)
+#endif
+  /* LLVM LOCAL end - radar 5702446 */
+ASM_DECLARE_CLASS_REFERENCE (asm_out_file, string);
   return;
 }
   else


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] C++Frontend/2006-09-12-OpaqueStructCrash.cpp failing

2008-01-24 Thread Tanya Lattner
Using llvm-gcc4.0 on darwin8 x86, C++Frontend/2006-09-12- 
OpaqueStructCrash.cpp is failing (svn rev: 46324)

llvm/test/C++Frontend/2006-09-12-OpaqueStructCrash.cpp:27: internal  
compiler error: Bus error

-Tanya

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.2] r46325 - in /llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg: objc2-protocol-1.mm objc2-protocol-2.mm objc2-protocol-4.mm objc2-protocol-5.mm objc2-protocol-9.mm property-met

2008-01-24 Thread Dale Johannesen
Author: johannes
Date: Thu Jan 24 16:16:00 2008
New Revision: 46325

URL: http://llvm.org/viewvc/llvm-project?rev=46325&view=rev
Log:
Upgrade some more tests for llvm.  Llvm doesn't
mangle the names of some local symbols, and there's
no reason it should.


Modified:
llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-1.mm
llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-2.mm
llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-4.mm
llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-5.mm
llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-9.mm
llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/property-metadata-1.mm

Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-1.mm
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/objc2-protocol-1.mm?rev=46325&r1=46324&r2=46325&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-1.mm (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-1.mm Thu Jan 24 
16:16:00 2008
@@ -14,5 +14,7 @@
 int main() {
return (long) @protocol(Proto1);
 }
-/* { dg-final { scan-assembler "L_ZL23_OBJC_PROTOCOL_\\\$_Proto1:" } } */
-/* { dg-final { scan-assembler-not "_ZL23_OBJC_PROTOCOL_\\\$_Proto2" } } */
+/* LLVM LOCAL begin accept llvm syntax */
+/* { dg-final { scan-assembler "L_.*OBJC_PROTOCOL_\\\$_Proto1:" } } */
+/* { dg-final { scan-assembler-not ".*_OBJC_PROTOCOL_\\\$_Proto2" } } */
+/* LLVM LOCAL end */
\ No newline at end of file

Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-2.mm
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/objc2-protocol-2.mm?rev=46325&r1=46324&r2=46325&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-2.mm (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-2.mm Thu Jan 24 
16:16:00 2008
@@ -11,5 +11,7 @@
 
 @interface Super  { id isa; } @end
 @implementation Super @end
-/* { dg-final { scan-assembler "L_ZL23_OBJC_PROTOCOL_\\\$_Proto1:" } } */
-/* { dg-final { scan-assembler "L_ZL23_OBJC_PROTOCOL_\\\$_Proto2:" } } */
+/* LLVM LOCAL begin llvm syntax */
+/* { dg-final { scan-assembler "L_.*OBJC_PROTOCOL_\\\$_Proto1:" } } */
+/* { dg-final { scan-assembler "L_.*OBJC_PROTOCOL_\\\$_Proto2:" } } */
+/* LLVM LOCAL end */

Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-4.mm
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/objc2-protocol-4.mm?rev=46325&r1=46324&r2=46325&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-4.mm (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-4.mm Thu Jan 24 
16:16:00 2008
@@ -20,5 +20,7 @@
 {
return (long)@protocol(Proto2);
 }
-/* { dg-final { scan-assembler "L_ZL23_OBJC_PROTOCOL_\\\$_Proto1:" } } */
-/* { dg-final { scan-assembler "L_ZL23_OBJC_PROTOCOL_\\\$_Proto2:" } } */
+/* LLVM LOCAL begin llvm syntax */
+/* { dg-final { scan-assembler "L_.*OBJC_PROTOCOL_\\\$_Proto1:" } } */
+/* { dg-final { scan-assembler "L_.*OBJC_PROTOCOL_\\\$_Proto2:" } } */
+/* LLVM LOCAL end */

Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-5.mm
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/objc2-protocol-5.mm?rev=46325&r1=46324&r2=46325&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-5.mm (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-5.mm Thu Jan 24 
16:16:00 2008
@@ -13,4 +13,5 @@
 int main() {
return (long) @protocol(Proto1);
 }
-/* { dg-final { scan-assembler "L_ZL23_OBJC_PROTOCOL_\\\$_Proto1:" } } */
+/* LLVM LOCAL llvm syntax */
+/* { dg-final { scan-assembler "L_.*OBJC_PROTOCOL_\\\$_Proto1:" } } */

Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-9.mm
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/objc2-protocol-9.mm?rev=46325&r1=46324&r2=46325&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-9.mm (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-9.mm Thu Jan 24 
16:16:00 2008
@@ -18,5 +18,7 @@
 
 @implementation Foo (Category)
 @end
-/* { dg-final { scan-assembler "L_ZL23_OBJC_PROTOCOL_\\\$_Proto1:" } } */
-/* { dg-final { scan-assembler "L_ZL23_OBJC_PROTOCOL_\\\$_Proto2:" } } */
+/* LLVM LOCAL begin accept llvm syntax */
+/* { dg-final { scan-assembler "L_.*OBJC_PROTOCOL_\\\$_Proto1:" } } */
+/* { dg-final { scan-assembler "L_.*OBJC_PROT

[llvm-commits] CVS: llvm-www/pubs/2008-CGO-DagISel.html 2008-CGO-DagISel.pdf

2008-01-24 Thread Chris Lattner


Changes in directory llvm-www/pubs:

2008-CGO-DagISel.html added (r1.1)
2008-CGO-DagISel.pdf added (r1.1)
---
Log message:

add a paper on near optimal instruction selection


---
Diffs of the changes:  (+48 -0)

 2008-CGO-DagISel.html |   48 
 2008-CGO-DagISel.pdf  |0 
 2 files changed, 48 insertions(+)


Index: llvm-www/pubs/2008-CGO-DagISel.html
diff -c /dev/null llvm-www/pubs/2008-CGO-DagISel.html:1.1
*** /dev/null   Thu Jan 24 16:51:13 2008
--- llvm-www/pubs/2008-CGO-DagISel.html Thu Jan 24 16:51:03 2008
***
*** 0 
--- 1,48 
+ 
+ 
+ 
+   
+   
+   Near-Optimal Instruction Selection on DAGs
+ 
+ 
+ 
+ 
+ Near-Optimal Instruction Selection on DAGs
+ 
+ 
+   David Ryan Koes and Seth Copen Goldstein
+ 
+ 
+ Abstract:
+ 
+ Instruction selection is a key component of code generation. High 
+ quality instruction selection is of particular importance in the embedded 
space where complex instruction sets are common and code 
+ size is a prime concern. Although instruction selection on tree expressions 
is a well understood and easily solved problem, instruction selection on 
directed acyclic graphs is NP-complete. In this 
+ paper we present NOLTIS, a near-optimal, linear time instruction 
+ selection algorithm for DAG expressions. NOLTIS is easy to im- 
+ plement, fast, and effective with a demonstrated average code size 
+ improvement of 5.1% compared to the traditional tree decomposi- 
+ tion and tiling approach. 
+ 
+ 
+ Published:
+ "Near-Optimal Instruction Selection on DAGs"
+ David Ryan Koes and Seth Copen Goldstein
+ Proc. ACM Conference on Code Generation and Optimization (CGO'08), 
Boston, MA, 2008.
+ 
+ Download:
+ Paper:
+ 
+   Near-Optimal Instruction Selection on 
DAGs (PDF)
+ 
+ 
+ 
+ 
+   http://jigsaw.w3.org/css-validator/check/referer";>http://jigsaw.w3.org/css-validator/images/vcss"; alt="Valid CSS!">
+   http://validator.w3.org/check/referer";>http://www.w3.org/Icons/valid-html401"; alt="Valid HTML 4.01!" />
+ 
+ 
+ 


Index: llvm-www/pubs/2008-CGO-DagISel.pdf



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-www/pubs/index.html

2008-01-24 Thread Chris Lattner


Changes in directory llvm-www/pubs:

index.html updated: 1.61 -> 1.62
---
Log message:

add paper to index.


---
Diffs of the changes:  (+5 -0)

 index.html |5 +
 1 files changed, 5 insertions(+)


Index: llvm-www/pubs/index.html
diff -u llvm-www/pubs/index.html:1.61 llvm-www/pubs/index.html:1.62
--- llvm-www/pubs/index.html:1.61   Thu Jan 17 11:18:48 2008
+++ llvm-www/pubs/index.htmlThu Jan 24 16:52:43 2008
@@ -3,6 +3,11 @@
 
 
 
+"Near-Optimal Instruction Selection on 
DAGs"
+David Ryan Koes and Seth Copen Goldstein
+Proc. ACM Conference on Code Generation and Optimization (CGO'08), 
Boston, MA, 2008.
+
+
 
 Secure Virtual Architecture: A Safe Execution Environment for Commodity
 Operating SystemsJohn Criswell, Andrew Lenharth, Dinakar Dhurjati, and



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm-www/pubs/index.html 2008-CGO-DagISel.html

2008-01-24 Thread Chris Lattner


Changes in directory llvm-www/pubs:

index.html updated: 1.62 -> 1.63
2008-CGO-DagISel.html updated: 1.1 -> 1.2
---
Log message:

more formal name.


---
Diffs of the changes:  (+2 -2)

 2008-CGO-DagISel.html |2 +-
 index.html|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm-www/pubs/index.html
diff -u llvm-www/pubs/index.html:1.62 llvm-www/pubs/index.html:1.63
--- llvm-www/pubs/index.html:1.62   Thu Jan 24 16:52:43 2008
+++ llvm-www/pubs/index.htmlThu Jan 24 16:53:51 2008
@@ -5,7 +5,7 @@
 
 "Near-Optimal Instruction Selection on 
DAGs"
 David Ryan Koes and Seth Copen Goldstein
-Proc. ACM Conference on Code Generation and Optimization (CGO'08), 
Boston, MA, 2008.
+Proc. of the 2008 International Symposium on Code Generation and 
Optimization (CGO'08), Boston, MA, 2008.
 
 
 


Index: llvm-www/pubs/2008-CGO-DagISel.html
diff -u llvm-www/pubs/2008-CGO-DagISel.html:1.1 
llvm-www/pubs/2008-CGO-DagISel.html:1.2
--- llvm-www/pubs/2008-CGO-DagISel.html:1.1 Thu Jan 24 16:51:03 2008
+++ llvm-www/pubs/2008-CGO-DagISel.html Thu Jan 24 16:53:51 2008
@@ -29,7 +29,7 @@
 Published:
 "Near-Optimal Instruction Selection on DAGs"
 David Ryan Koes and Seth Copen Goldstein
-Proc. ACM Conference on Code Generation and Optimization (CGO'08), 
Boston, MA, 2008.
+Proc. of the 2008 International Symposium on Code Generation and 
Optimization (CGO'08), Boston, MA, 2008.
 
 Download:
 Paper:



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46331 - /llvm/tags/Apple/llvmCore-2011/

2008-01-24 Thread Bill Wendling
Author: void
Date: Thu Jan 24 17:29:26 2008
New Revision: 46331

URL: http://llvm.org/viewvc/llvm-project?rev=46331&view=rev
Log:
Creating llvmCore-2011 branch

Added:
llvm/tags/Apple/llvmCore-2011/
  - copied from r46330, llvm/trunk/

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.2] r46332 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2011/

2008-01-24 Thread Bill Wendling
Author: void
Date: Thu Jan 24 17:29:32 2008
New Revision: 46332

URL: http://llvm.org/viewvc/llvm-project?rev=46332&view=rev
Log:
Creating llvmgcc42-2011 branch

Added:
llvm-gcc-4.2/tags/Apple/llvmgcc42-2011/
  - copied from r46331, llvm-gcc-4.2/trunk/

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46333 - /llvm/trunk/test/CFrontend/2008-01-24-StructAlignAndBitFields.c

2008-01-24 Thread Devang Patel
Author: dpatel
Date: Thu Jan 24 17:55:34 2008
New Revision: 46333

URL: http://llvm.org/viewvc/llvm-project?rev=46333&view=rev
Log:
New test.

Added:
llvm/trunk/test/CFrontend/2008-01-24-StructAlignAndBitFields.c

Added: llvm/trunk/test/CFrontend/2008-01-24-StructAlignAndBitFields.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2008-01-24-StructAlignAndBitFields.c?rev=46333&view=auto

==
--- llvm/trunk/test/CFrontend/2008-01-24-StructAlignAndBitFields.c (added)
+++ llvm/trunk/test/CFrontend/2008-01-24-StructAlignAndBitFields.c Thu Jan 24 
17:55:34 2008
@@ -0,0 +1,6 @@
+// RUN: %llvmgcc %s -S -o -
+
+// This struct is not 4 byte aligned becaues bit-field 
+// type does not influence struct alignment.
+struct U { char a; short b; int c:25; char d; } u;
+


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.2] r46334 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

2008-01-24 Thread Devang Patel
Author: dpatel
Date: Thu Jan 24 17:56:38 2008
New Revision: 46334

URL: http://llvm.org/viewvc/llvm-project?rev=46334&view=rev
Log:
Fix 2008-01-24-StructAlignAndBitFields.c test case.
Bit-field type does not influence struct alignment.


Modified:
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=46334&r1=46333&r2=46334&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Thu Jan 24 17:56:38 2008
@@ -1747,6 +1747,11 @@
 
   // Handle bit-fields specially.
   if (isBitfield(Field)) {
+// Bit-field type does not influence structure alignment. 
+// For example, struct A { char a; short b; int c:25; char d; } does not
+// have 4 byte alignment. To enforce this rule, always use packed struct.
+if (!Info.isPacked())
+  return false;
 DecodeStructBitField(Field, Info);
 return true;
   }


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46337 - in /llvm/trunk/lib/Target/X86: X86RegisterInfo.cpp X86RegisterInfo.h X86RegisterInfo.td

2008-01-24 Thread Owen Anderson

Evan, Chris,

I've confirmed that basic testcases appear to be working with this  
change.


--Owen

On Jan 24, 2008, at 6:34 PM, Anton Korobeynikov wrote:


Author: asl
Date: Thu Jan 24 18:34:13 2008
New Revision: 46337

URL: http://llvm.org/viewvc/llvm-project?rev=46337&view=rev
Log:
Provide correct DWARF register numbering for debug information  
emission on x86-32/Darwin.

This should fix bunch of issues.

Modified:
   llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
   llvm/trunk/lib/Target/X86/X86RegisterInfo.h
   llvm/trunk/lib/Target/X86/X86RegisterInfo.td

Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=46337&r1=46336&r2=46337&view=diff

= 
= 
= 
= 
= 
= 
= 
= 
==

--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Jan 24  
18:34:13 2008

@@ -64,12 +64,15 @@
  unsigned Flavour = DWARFFlavour::X86_64;
  if (!Subtarget->is64Bit()) {
if (Subtarget->isTargetDarwin()) {
-  Flavour = DWARFFlavour::X86_32_Darwin;
+  if (isEH)
+Flavour = DWARFFlavour::X86_32_DarwinEH;
+  else
+Flavour = DWARFFlavour::X86_32_Generic;
} else if (Subtarget->isTargetCygMing()) {
  // Unsupported by now, just quick fallback
-  Flavour = DWARFFlavour::X86_32_ELF;
+  Flavour = DWARFFlavour::X86_32_Generic;
} else {
-  Flavour = DWARFFlavour::X86_32_ELF;
+  Flavour = DWARFFlavour::X86_32_Generic;
}
  }


Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=46337&r1=46336&r2=46337&view=diff

= 
= 
= 
= 
= 
= 
= 
= 
==

--- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Thu Jan 24 18:34:13  
2008

@@ -36,7 +36,7 @@
///
namespace DWARFFlavour {
  enum {
-X86_64 = 0, X86_32_Darwin = 1, X86_32_ELF = 2
+X86_64 = 0, X86_32_DarwinEH = 1, X86_32_Generic = 2
  };
}


Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.td?rev=46337&r1=46336&r2=46337&view=diff

= 
= 
= 
= 
= 
= 
= 
= 
==

--- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Thu Jan 24 18:34:13  
2008

@@ -25,11 +25,8 @@

  // Dwarf numbering is different for 32-bit and 64-bit, and there are
  // variations by target as well. Currently the first entry is for  
X86-64,

-  // second - for X86-32/Darwin and third for X86-32/Linux
-
-  // FIXME:  Comments in gcc indicate that Darwin uses different  
numbering
-  // for debug info and exception handling info:(  The numbering  
here is

-  // for exception handling.
+  // second - for EH on X86-32/Darwin and third is 'generic' one  
(X86-32/Linux

+  // and debug information on X86-32/Darwin)

  // 8-bit registers
  // Low registers


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




smime.p7s
Description: S/MIME cryptographic signature
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.0] r46338 - /llvm-gcc-4.0/trunk/gcc/llvm-types.cpp

2008-01-24 Thread Devang Patel
Author: dpatel
Date: Thu Jan 24 18:43:54 2008
New Revision: 46338

URL: http://llvm.org/viewvc/llvm-project?rev=46338&view=rev
Log:
Fix 2008-01-24-StructAlignAndBitFields.c test case.
Bit-field type does not influence struct alignment.


Modified:
llvm-gcc-4.0/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=46338&r1=46337&r2=46338&view=diff

==
--- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Thu Jan 24 18:43:54 2008
@@ -1529,9 +1529,14 @@
 
   // Handle bit-fields specially.
   if (DECL_BIT_FIELD_TYPE(Field)) {
-DecodeStructBitField(Field, Info);
-return true;
-  }
+ // Bit-field type does not influence structure alignment. 
+ // For example, struct A { char a; short b; int c:25; char d; } does not
+ // have 4 byte alignment. To enforce this rule, always use packed struct.
+ if (!Info.isPacked())
+   return false;
+ DecodeStructBitField(Field, Info);
+ return true;
+   }
 
   Info.allFieldsAreNotBitFields();
 


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46337 - in /llvm/trunk/lib/Target/X86: X86RegisterInfo.cpp X86RegisterInfo.h X86RegisterInfo.td

2008-01-24 Thread Anton Korobeynikov
Author: asl
Date: Thu Jan 24 18:34:13 2008
New Revision: 46337

URL: http://llvm.org/viewvc/llvm-project?rev=46337&view=rev
Log:
Provide correct DWARF register numbering for debug information emission on 
x86-32/Darwin.
This should fix bunch of issues.

Modified:
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
llvm/trunk/lib/Target/X86/X86RegisterInfo.h
llvm/trunk/lib/Target/X86/X86RegisterInfo.td

Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=46337&r1=46336&r2=46337&view=diff

==
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Jan 24 18:34:13 2008
@@ -64,12 +64,15 @@
   unsigned Flavour = DWARFFlavour::X86_64;
   if (!Subtarget->is64Bit()) {
 if (Subtarget->isTargetDarwin()) {
-  Flavour = DWARFFlavour::X86_32_Darwin;
+  if (isEH)
+Flavour = DWARFFlavour::X86_32_DarwinEH;
+  else
+Flavour = DWARFFlavour::X86_32_Generic;
 } else if (Subtarget->isTargetCygMing()) {
   // Unsupported by now, just quick fallback
-  Flavour = DWARFFlavour::X86_32_ELF;
+  Flavour = DWARFFlavour::X86_32_Generic;
 } else {
-  Flavour = DWARFFlavour::X86_32_ELF;
+  Flavour = DWARFFlavour::X86_32_Generic;
 }
   }
 

Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=46337&r1=46336&r2=46337&view=diff

==
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Thu Jan 24 18:34:13 2008
@@ -36,7 +36,7 @@
 ///
 namespace DWARFFlavour {
   enum {
-X86_64 = 0, X86_32_Darwin = 1, X86_32_ELF = 2
+X86_64 = 0, X86_32_DarwinEH = 1, X86_32_Generic = 2
   };
 } 
   

Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.td?rev=46337&r1=46336&r2=46337&view=diff

==
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Thu Jan 24 18:34:13 2008
@@ -25,11 +25,8 @@
 
   // Dwarf numbering is different for 32-bit and 64-bit, and there are 
   // variations by target as well. Currently the first entry is for X86-64, 
-  // second - for X86-32/Darwin and third for X86-32/Linux
-
-  // FIXME:  Comments in gcc indicate that Darwin uses different numbering
-  // for debug info and exception handling info:(  The numbering here is
-  // for exception handling.
+  // second - for EH on X86-32/Darwin and third is 'generic' one (X86-32/Linux
+  // and debug information on X86-32/Darwin)
 
   // 8-bit registers
   // Low registers


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46307 - in /llvm/trunk: lib/Target/X86/X86ISelDAGToDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/fp-stack-direct-ret.ll test/Code

2008-01-24 Thread Evan Cheng
Is there a bugzilla on the scheduling deficiency?

Thx,

Evan

On Jan 24, 2008, at 12:07 AM, Chris Lattner <[EMAIL PROTECTED]> wrote:

> Author: lattner
> Date: Thu Jan 24 02:07:48 2008
> New Revision: 46307
>
> URL: http://llvm.org/viewvc/llvm-project?rev=46307&view=rev
> Log:
> Significantly simplify and improve handling of FP function results  
> on x86-32.
> This case returns the value in ST(0) and then has to convert it to  
> an SSE
> register.  This causes significant codegen ugliness in some cases.   
> For
> example in the trivial fp-stack-direct-ret.ll testcase we used to  
> generate:
>
> _bar:
>subl$28, %esp
>callL_foo$stub
>fstpl16(%esp)
>movsd16(%esp), %xmm0
>movsd%xmm0, 8(%esp)
>fldl8(%esp)
>addl$28, %esp
>ret
>
> because we move the result of foo() into an XMM register, then have to
> move it back for the return of bar.
>
> Instead of hacking ever-more special cases into the call result  
> lowering code
> we take a much simpler approach: on x86-32, fp return is modeled as  
> always
> returning into an f80 register which is then truncated to f32 or f64  
> as needed.
> Similarly for a result, we model it as an extension to f80 + return.
>
> This exposes the truncate and extensions to the dag combiner,  
> allowing target
> independent code to hack on them, eliminating them in this case.   
> This gives
> us this code for the example above:
>
> _bar:
>subl$12, %esp
>callL_foo$stub
>addl$12, %esp
>ret
>
> The nasty aspect of this is that these conversions are not legal,  
> but we want
> the second pass of dag combiner (post-legalize) to be able to hack  
> on them.
> To handle this, we lie to legalize and say they are legal, then  
> custom expand
> them on entry to the isel pass (PreprocessForFPConvert).  This is  
> gross, but
> less gross than the code it is replacing :)
>
> This also allows us to generate better code in several other cases.   
> For
> example on fp-stack-ret-conv.ll, we now generate:
>
> _test:
>subl$12, %esp
>callL_foo$stub
>fstps8(%esp)
>movl16(%esp), %eax
>cvtss2sd8(%esp), %xmm0
>movsd%xmm0, (%eax)
>addl$12, %esp
>ret
>
> where before we produced (incidentally, the old bad code is  
> identical to what
> gcc produces):
>
> _test:
>subl$12, %esp
>callL_foo$stub
>fstpl(%esp)
>cvtsd2ss(%esp), %xmm0
>cvtss2sd%xmm0, %xmm0
>movl16(%esp), %eax
>movsd%xmm0, (%eax)
>addl$12, %esp
>ret
>
> Note that we generate slightly worse code on pr1505b.ll due to a  
> scheduling
> deficiency that is unrelated to this patch.
>
>
> Added:
>llvm/trunk/test/CodeGen/X86/fp-stack-direct-ret.ll
>llvm/trunk/test/CodeGen/X86/fp-stack-ret-conv.ll
> Modified:
>llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
>llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
>llvm/trunk/lib/Target/X86/X86InstrSSE.td
>llvm/trunk/test/CodeGen/X86/pr1505b.ll
>
> Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=46307&r1=46306&r2=46307&view=diff
>
> === 
> === 
> === 
> =
> --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Thu Jan 24  
> 02:07:48 2008
> @@ -156,7 +156,8 @@
> bool TryFoldLoad(SDOperand P, SDOperand N,
>  SDOperand &Base, SDOperand &Scale,
>  SDOperand &Index, SDOperand &Disp);
> -void InstructionSelectPreprocess(SelectionDAG &DAG);
> +void PreprocessForRMW(SelectionDAG &DAG);
> +void PreprocessForFPConvert(SelectionDAG &DAG);
>
> /// SelectInlineAsmMemoryOperand - Implement addressing mode  
> selection for
> /// inline asm expressions.
> @@ -350,9 +351,10 @@
>  Store.getOperand(2), Store.getOperand(3));
> }
>
> -/// InstructionSelectPreprocess - Preprocess the DAG to allow the  
> instruction
> -/// selector to pick more load-modify-store instructions. This is a  
> common
> -/// case:
> +/// PreprocessForRMW - Preprocess the DAG to make instruction  
> selection better.
> +/// This is only run if not in -fast mode (aka -O0).
> +/// This allows the instruction selector to pick more read-modify- 
> write
> +/// instructions. This is a common case:
> ///
> /// [Load chain]
> /// ^
> @@ -389,7 +391,7 @@
> ///   \  /
> ///\/
> ///   [Store]
> -void X86DAGToDAGISel::InstructionSelectPreprocess(SelectionDAG  
> &DAG) {
> +void X86DAGToDAGISel::PreprocessForRMW(SelectionDAG &DAG) {
>   for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(),
>  E = DAG.allnodes_end(); I != E; ++I) {
> if (!ISD::isNON_TRUNCStore(I))
> @@ -459,6 +461,66 @@
>   }
> }
>
> +
> +/// PreprocessForFPConvert - Walk over the dag lowering f

Re: [llvm-commits] [llvm] r46337 - in /llvm/trunk/lib/Target/X86: X86RegisterInfo.cpp X86RegisterInfo.h X86RegisterInfo.td

2008-01-24 Thread Evan Cheng
Woot. Thx a bunch. I'll look at more complicated cases.

Evan

On Jan 24, 2008, at 4:53 PM, Owen Anderson <[EMAIL PROTECTED]> wrote:

> Evan, Chris,
>
> I've confirmed that basic testcases appear to be working with this  
> change.
>
> --Owen
>
> On Jan 24, 2008, at 6:34 PM, Anton Korobeynikov wrote:
>
>> Author: asl
>> Date: Thu Jan 24 18:34:13 2008
>> New Revision: 46337
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=46337&view=rev
>> Log:
>> Provide correct DWARF register numbering for debug information  
>> emission on x86-32/Darwin.
>> This should fix bunch of issues.
>>
>> Modified:
>>   llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
>>   llvm/trunk/lib/Target/X86/X86RegisterInfo.h
>>   llvm/trunk/lib/Target/X86/X86RegisterInfo.td
>>
>> Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=46337&r1=46336&r2=46337&view=diff
>>
>> === 
>> === 
>> === 
>> =
>> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
>> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Jan 24  
>> 18:34:13 2008
>> @@ -64,12 +64,15 @@
>>  unsigned Flavour = DWARFFlavour::X86_64;
>>  if (!Subtarget->is64Bit()) {
>>if (Subtarget->isTargetDarwin()) {
>> -  Flavour = DWARFFlavour::X86_32_Darwin;
>> +  if (isEH)
>> +Flavour = DWARFFlavour::X86_32_DarwinEH;
>> +  else
>> +Flavour = DWARFFlavour::X86_32_Generic;
>>} else if (Subtarget->isTargetCygMing()) {
>>  // Unsupported by now, just quick fallback
>> -  Flavour = DWARFFlavour::X86_32_ELF;
>> +  Flavour = DWARFFlavour::X86_32_Generic;
>>} else {
>> -  Flavour = DWARFFlavour::X86_32_ELF;
>> +  Flavour = DWARFFlavour::X86_32_Generic;
>>}
>>  }
>>
>>
>> Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h
>> URL: 
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=46337&r1=46336&r2=46337&view=diff
>>
>> === 
>> === 
>> === 
>> =
>> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original)
>> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Thu Jan 24 18:34:13  
>> 2008
>> @@ -36,7 +36,7 @@
>> ///
>> namespace DWARFFlavour {
>>  enum {
>> -X86_64 = 0, X86_32_Darwin = 1, X86_32_ELF = 2
>> +X86_64 = 0, X86_32_DarwinEH = 1, X86_32_Generic = 2
>>  };
>> }
>>
>>
>> Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td
>> URL: 
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.td?rev=46337&r1=46336&r2=46337&view=diff
>>
>> === 
>> === 
>> === 
>> =
>> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original)
>> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Thu Jan 24  
>> 18:34:13 2008
>> @@ -25,11 +25,8 @@
>>
>>  // Dwarf numbering is different for 32-bit and 64-bit, and there are
>>  // variations by target as well. Currently the first entry is for  
>> X86-64,
>> -  // second - for X86-32/Darwin and third for X86-32/Linux
>> -
>> -  // FIXME:  Comments in gcc indicate that Darwin uses different  
>> numbering
>> -  // for debug info and exception handling info:(  The numbering  
>> here is
>> -  // for exception handling.
>> +  // second - for EH on X86-32/Darwin and third is 'generic' one  
>> (X86-32/Linux
>> +  // and debug information on X86-32/Darwin)
>>
>>  // 8-bit registers
>>  // Low registers
>>
>>
>> ___
>> llvm-commits mailing list
>> llvm-commits@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.2] r46340 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm.h objc/objc-act.c

2008-01-24 Thread Dale Johannesen
Author: johannes
Date: Thu Jan 24 19:44:38 2008
New Revision: 46340

URL: http://llvm.org/viewvc/llvm-project?rev=46340&view=rev
Log:
Fix more missing ObjC metadata at -O0.  This one is
a little trickier since the type needs to be redone also.


Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
llvm-gcc-4.2/trunk/gcc/llvm.h
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

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=46340&r1=46339&r2=46340&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Thu Jan 24 19:44:38 2008
@@ -815,6 +815,48 @@
   GV->setInitializer(Init);
 }
   
+/// reset_type_and_initializer_llvm - Change the type and initializer for 
+/// a global variable.
+void reset_type_and_initializer_llvm(tree decl) {
+  // If there were earlier errors we can get here when DECL_LLVM has not
+  // been set.  Don't crash.
+  if ((errorcount || sorrycount) && !DECL_LLVM(decl))
+return;
+
+  // Get or create the global variable now.
+  GlobalVariable *GV = cast(DECL_LLVM(decl));
+  
+  // Temporary to avoid infinite recursion (see comments emit_global_to_llvm)
+  GV->setInitializer(UndefValue::get(GV->getType()->getElementType()));
+
+  // Convert the initializer over.
+  Constant *Init = TreeConstantToLLVM::Convert(DECL_INITIAL(decl));
+
+  // If we had a forward definition that has a type that disagrees with our
+  // initializer, insert a cast now.  This sort of thing occurs when we have a
+  // global union, and the LLVM type followed a union initializer that is
+  // different from the union element used for the type.
+  if (GV->getType()->getElementType() != Init->getType()) {
+GV->removeFromParent();
+GlobalVariable *NGV = new GlobalVariable(Init->getType(), GV->isConstant(),
+ GV->getLinkage(), 0,
+ GV->getName(), TheModule);
+NGV->setVisibility(GV->getVisibility());
+GV->replaceAllUsesWith(ConstantExpr::getBitCast(NGV, GV->getType()));
+if (AttributeUsedGlobals.count(GV)) {
+  AttributeUsedGlobals.remove(GV);
+  AttributeUsedGlobals.insert(NGV);
+}
+changeLLVMValue(GV, NGV);
+delete GV;
+SET_DECL_LLVM(decl, NGV);
+GV = NGV;
+  }
+
+  // Set the initializer.
+  GV->setInitializer(Init);
+}
+  
 /// emit_global_to_llvm - Emit the specified VAR_DECL or aggregate CONST_DECL 
to
 /// LLVM as a global variable.  This function implements the end of
 /// assemble_variable.

Modified: llvm-gcc-4.2/trunk/gcc/llvm.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm.h?rev=46340&r1=46339&r2=46340&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm.h Thu Jan 24 19:44:38 2008
@@ -44,6 +44,11 @@
 /* make_decl_llvm - This is also defined in tree.h and used by macros there. */
 void make_decl_llvm(union tree_node*);
 
+/* reset_type_and_initializer_llvm - Change the initializer for a global 
+ * variable.
+ */
+void reset_type_and_initializer_llvm(union tree_node*);
+
 /* reset_initializer_llvm - Change the initializer for a global variable. */
 void reset_initializer_llvm(union tree_node*);
 

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=46340&r1=46339&r2=46340&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Thu Jan 24 19:44:38 2008
@@ -12269,6 +12269,11 @@
 build_fold_addr_expr 
(UOBJC_V2_VTABLE_decl)); 
 
   finish_var_decl (class_decl, initlist);
+  /* LLVM LOCAL begin */
+  /* At -O0, we may have emitted references to the decl earlier. */
+  if (!optimize)
+reset_type_and_initializer_llvm(class_decl);
+  /* LLVM LOCAL end */
   objc_add_to_class_list_chain (class_decl);
   if (CLASS_OR_CATEGORY_HAS_LOAD_IMPL (objc_implementation_context) != 
NULL_TREE)
 objc_add_to_nonlazy_class_list_chain (class_decl);


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46337 - in /llvm/trunk/lib/Target/X86: X86RegisterInfo.cpp X86RegisterInfo.h X86RegisterInfo.td

2008-01-24 Thread Dale Johannesen

On Jan 24, 2008, at 5:17 PM, Evan Cheng wrote:

> Woot. Thx a bunch. I'll look at more complicated cases.
>
> Evan

My bad.  Thanks Anton and sorry everybody.

> On Jan 24, 2008, at 4:53 PM, Owen Anderson <[EMAIL PROTECTED]> wrote:
>
>> Evan, Chris,
>>
>> I've confirmed that basic testcases appear to be working with this
>> change.
>>
>> --Owen
>>
>> On Jan 24, 2008, at 6:34 PM, Anton Korobeynikov wrote:
>>
>>> Author: asl
>>> Date: Thu Jan 24 18:34:13 2008
>>> New Revision: 46337
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=46337&view=rev
>>> Log:
>>> Provide correct DWARF register numbering for debug information
>>> emission on x86-32/Darwin.
>>> This should fix bunch of issues.
>>>
>>> Modified:
>>>  llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
>>>  llvm/trunk/lib/Target/X86/X86RegisterInfo.h
>>>  llvm/trunk/lib/Target/X86/X86RegisterInfo.td
>>>
>>> Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=46337&r1=46336&r2=46337&view=diff
>>>
>>> ===
>>> ===
>>> ===
>>> =
>>> 
>>> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
>>> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Jan 24
>>> 18:34:13 2008
>>> @@ -64,12 +64,15 @@
>>> unsigned Flavour = DWARFFlavour::X86_64;
>>> if (!Subtarget->is64Bit()) {
>>>   if (Subtarget->isTargetDarwin()) {
>>> -  Flavour = DWARFFlavour::X86_32_Darwin;
>>> +  if (isEH)
>>> +Flavour = DWARFFlavour::X86_32_DarwinEH;
>>> +  else
>>> +Flavour = DWARFFlavour::X86_32_Generic;
>>>   } else if (Subtarget->isTargetCygMing()) {
>>> // Unsupported by now, just quick fallback
>>> -  Flavour = DWARFFlavour::X86_32_ELF;
>>> +  Flavour = DWARFFlavour::X86_32_Generic;
>>>   } else {
>>> -  Flavour = DWARFFlavour::X86_32_ELF;
>>> +  Flavour = DWARFFlavour::X86_32_Generic;
>>>   }
>>> }
>>>
>>>
>>> Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=46337&r1=46336&r2=46337&view=diff
>>>
>>> ===
>>> ===
>>> ===
>>> =
>>> 
>>> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original)
>>> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Thu Jan 24 18:34:13
>>> 2008
>>> @@ -36,7 +36,7 @@
>>> ///
>>> namespace DWARFFlavour {
>>> enum {
>>> -X86_64 = 0, X86_32_Darwin = 1, X86_32_ELF = 2
>>> +X86_64 = 0, X86_32_DarwinEH = 1, X86_32_Generic = 2
>>> };
>>> }
>>>
>>>
>>> Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.td?rev=46337&r1=46336&r2=46337&view=diff
>>>
>>> ===
>>> ===
>>> ===
>>> =
>>> 
>>> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original)
>>> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Thu Jan 24
>>> 18:34:13 2008
>>> @@ -25,11 +25,8 @@
>>>
>>> // Dwarf numbering is different for 32-bit and 64-bit, and there are
>>> // variations by target as well. Currently the first entry is for
>>> X86-64,
>>> -  // second - for X86-32/Darwin and third for X86-32/Linux
>>> -
>>> -  // FIXME:  Comments in gcc indicate that Darwin uses different
>>> numbering
>>> -  // for debug info and exception handling info:(  The numbering
>>> here is
>>> -  // for exception handling.
>>> +  // second - for EH on X86-32/Darwin and third is 'generic' one
>>> (X86-32/Linux
>>> +  // and debug information on X86-32/Darwin)
>>>
>>> // 8-bit registers
>>> // Low registers
>>>
>>>
>>> ___
>>> llvm-commits mailing list
>>> llvm-commits@cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>> ___
>> llvm-commits mailing list
>> llvm-commits@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46218 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

2008-01-24 Thread Evan Cheng
Hi Owen,

I am not sure I completely understand the comment. Are you saying when  
a VReg is found to be live out of its definition block. This decides  
whether to place the copy in the definition block or in the use block?

Evan

On Jan 21, 2008, at 2:03 PM, Owen Anderson wrote:

> Author: resistor
> Date: Mon Jan 21 16:03:00 2008
> New Revision: 46218
>
> URL: http://llvm.org/viewvc/llvm-project?rev=46218&view=rev
> Log:
> Clarify a deviation from the original algorithm.
>
> Modified:
>llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
>
> Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=46218&r1=46217&r2=46218&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ==
> --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
> +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Mon Jan 21  
> 16:03:00 2008
> @@ -552,7 +552,10 @@
>   DomForestNode* child = *CI;
>
>   // If the current node is live-out of the defining block of  
> one of its
> -  // children, insert a copy for it
> +  // children, insert a copy for it.  NOTE: The paper actually  
> calls for
> +  // a more elaborate heuristic for determining whether to  
> insert copies
> +  // for the child or the parent.  In the interest of  
> simplicity, we're
> +  // just always choosing the parent.
>   if (isLiveOut(DFNode->getReg(),
>   MRI.getVRegDef(child->getReg())->getParent(), MRI, LV)) {
> // Insert copies for parent
>
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46218 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

2008-01-24 Thread Owen Anderson
The basic check is: if one parameter to a PHI is defined in a block  
that dominates the block that another parameter is defined in, and it  
is live-out of that dominated block, then the two must be  
simultaneously live, so they can't be coallesced.  The difference  
between our implementation and the paper's description is in the  
choice of which one to insert copies for.

--Owen

On Jan 24, 2008, at 8:13 PM, Evan Cheng wrote:

> Hi Owen,
>
> I am not sure I completely understand the comment. Are you saying when
> a VReg is found to be live out of its definition block. This decides
> whether to place the copy in the definition block or in the use block?
>
> Evan
>
> On Jan 21, 2008, at 2:03 PM, Owen Anderson wrote:
>
>> Author: resistor
>> Date: Mon Jan 21 16:03:00 2008
>> New Revision: 46218
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=46218&view=rev
>> Log:
>> Clarify a deviation from the original algorithm.
>>
>> Modified:
>>   llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
>>
>> Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=46218&r1=46217&r2=46218&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> = 
>> =
>> --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Mon Jan 21
>> 16:03:00 2008
>> @@ -552,7 +552,10 @@
>>  DomForestNode* child = *CI;
>>
>>  // If the current node is live-out of the defining block of
>> one of its
>> -  // children, insert a copy for it
>> +  // children, insert a copy for it.  NOTE: The paper actually
>> calls for
>> +  // a more elaborate heuristic for determining whether to
>> insert copies
>> +  // for the child or the parent.  In the interest of
>> simplicity, we're
>> +  // just always choosing the parent.
>>  if (isLiveOut(DFNode->getReg(),
>>  MRI.getVRegDef(child->getReg())->getParent(), MRI, LV)) {
>>// Insert copies for parent
>>
>>
>> ___
>> llvm-commits mailing list
>> llvm-commits@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46337 - in /llvm/trunk/lib/Target/X86: X86RegisterInfo.cpp X86RegisterInfo.h X86RegisterInfo.td

2008-01-24 Thread Evan Cheng
This allows gdb to examine local scalar variables, but not aggregate  
ones. There are also issues with parameters, even scalar ones.

Evan

On Jan 24, 2008, at 5:17 PM, Evan Cheng wrote:

> Woot. Thx a bunch. I'll look at more complicated cases.
>
> Evan
>
> On Jan 24, 2008, at 4:53 PM, Owen Anderson <[EMAIL PROTECTED]> wrote:
>
>> Evan, Chris,
>>
>> I've confirmed that basic testcases appear to be working with this
>> change.
>>
>> --Owen
>>
>> On Jan 24, 2008, at 6:34 PM, Anton Korobeynikov wrote:
>>
>>> Author: asl
>>> Date: Thu Jan 24 18:34:13 2008
>>> New Revision: 46337
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=46337&view=rev
>>> Log:
>>> Provide correct DWARF register numbering for debug information
>>> emission on x86-32/Darwin.
>>> This should fix bunch of issues.
>>>
>>> Modified:
>>>  llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
>>>  llvm/trunk/lib/Target/X86/X86RegisterInfo.h
>>>  llvm/trunk/lib/Target/X86/X86RegisterInfo.td
>>>
>>> Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=46337&r1=46336&r2=46337&view=diff
>>>
>>> ===
>>> ===
>>> ===
>>> = 
>>> 
>>> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
>>> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Jan 24
>>> 18:34:13 2008
>>> @@ -64,12 +64,15 @@
>>> unsigned Flavour = DWARFFlavour::X86_64;
>>> if (!Subtarget->is64Bit()) {
>>>   if (Subtarget->isTargetDarwin()) {
>>> -  Flavour = DWARFFlavour::X86_32_Darwin;
>>> +  if (isEH)
>>> +Flavour = DWARFFlavour::X86_32_DarwinEH;
>>> +  else
>>> +Flavour = DWARFFlavour::X86_32_Generic;
>>>   } else if (Subtarget->isTargetCygMing()) {
>>> // Unsupported by now, just quick fallback
>>> -  Flavour = DWARFFlavour::X86_32_ELF;
>>> +  Flavour = DWARFFlavour::X86_32_Generic;
>>>   } else {
>>> -  Flavour = DWARFFlavour::X86_32_ELF;
>>> +  Flavour = DWARFFlavour::X86_32_Generic;
>>>   }
>>> }
>>>
>>>
>>> Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.h
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.h?rev=46337&r1=46336&r2=46337&view=diff
>>>
>>> ===
>>> ===
>>> ===
>>> = 
>>> 
>>> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.h (original)
>>> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.h Thu Jan 24 18:34:13
>>> 2008
>>> @@ -36,7 +36,7 @@
>>> ///
>>> namespace DWARFFlavour {
>>> enum {
>>> -X86_64 = 0, X86_32_Darwin = 1, X86_32_ELF = 2
>>> +X86_64 = 0, X86_32_DarwinEH = 1, X86_32_Generic = 2
>>> };
>>> }
>>>
>>>
>>> Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.td?rev=46337&r1=46336&r2=46337&view=diff
>>>
>>> ===
>>> ===
>>> ===
>>> = 
>>> 
>>> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original)
>>> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Thu Jan 24
>>> 18:34:13 2008
>>> @@ -25,11 +25,8 @@
>>>
>>> // Dwarf numbering is different for 32-bit and 64-bit, and there are
>>> // variations by target as well. Currently the first entry is for
>>> X86-64,
>>> -  // second - for X86-32/Darwin and third for X86-32/Linux
>>> -
>>> -  // FIXME:  Comments in gcc indicate that Darwin uses different
>>> numbering
>>> -  // for debug info and exception handling info:(  The numbering
>>> here is
>>> -  // for exception handling.
>>> +  // second - for EH on X86-32/Darwin and third is 'generic' one
>>> (X86-32/Linux
>>> +  // and debug information on X86-32/Darwin)
>>>
>>> // 8-bit registers
>>> // Low registers
>>>
>>>
>>> ___
>>> llvm-commits mailing list
>>> llvm-commits@cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>> ___
>> llvm-commits mailing list
>> llvm-commits@cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.2] r46341 - /llvm-gcc-4.2/trunk/gcc/regclass.c

2008-01-24 Thread Bill Wendling
Author: void
Date: Thu Jan 24 21:24:25 2008
New Revision: 46341

URL: http://llvm.org/viewvc/llvm-project?rev=46341&view=rev
Log:
Don't define these if they aren't used by LLVM

Modified:
llvm-gcc-4.2/trunk/gcc/regclass.c

Modified: llvm-gcc-4.2/trunk/gcc/regclass.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/regclass.c?rev=46341&r1=46340&r2=46341&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/regclass.c (original)
+++ llvm-gcc-4.2/trunk/gcc/regclass.c Thu Jan 24 21:24:25 2008
@@ -167,6 +167,8 @@
 
 unsigned int reg_class_size[N_REG_CLASSES];
 
+/* LLVM LOCAL */
+#ifndef ENABLE_LLVM
 /* For each reg class, table listing all the containing classes.  */
 
 static enum reg_class reg_class_superclasses[N_REG_CLASSES][N_REG_CLASSES];
@@ -174,6 +176,8 @@
 /* For each reg class, table listing all the classes contained in it.  */
 
 static enum reg_class reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES];
+/* LLVM LOCAL */
+#endif
 
 /* For each pair of reg classes,
a largest reg class contained in their union.  */


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.2] r46342 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2012/

2008-01-24 Thread Bill Wendling
Author: void
Date: Thu Jan 24 21:25:57 2008
New Revision: 46342

URL: http://llvm.org/viewvc/llvm-project?rev=46342&view=rev
Log:
Creating llvmgcc42-2012 branch

Added:
llvm-gcc-4.2/tags/Apple/llvmgcc42-2012/
  - copied from r46341, llvm-gcc-4.2/trunk/

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46337 - in /llvm/trunk/lib/Target/X86: X86RegisterInfo.cpp X86RegisterInfo.h X86RegisterInfo.td

2008-01-24 Thread Chris Lattner
On Jan 24, 2008, at 4:53 PM, Owen Anderson wrote:
> Evan, Chris,
> I've confirmed that basic testcases appear to be working with this  
> change.

Awesome, thanks Anton and Owen!

-Chris

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46307 - in /llvm/trunk: lib/Target/X86/X86ISelDAGToDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/fp-stack-direct-ret.ll test/Code

2008-01-24 Thread Chris Lattner

On Jan 24, 2008, at 4:54 PM, Evan Cheng wrote:

> Is there a bugzilla on the scheduling deficiency?

Good idea!
http://llvm.org/bugs/show_bug.cgi?id=1944

-Chris

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46337 - in /llvm/trunk/lib/Target/X86: X86RegisterInfo.cpp X86RegisterInfo.h X86RegisterInfo.td

2008-01-24 Thread Anton Korobeynikov
Evan,

> This allows gdb to examine local scalar variables, but not aggregate  
> ones. There are also issues with parameters, even scalar ones.
Ok. Any other testcases? Owen, ready for another session? :)

-- 
With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46344 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/copysign-zero.ll

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Thu Jan 24 23:46:26 2008
New Revision: 46344

URL: http://llvm.org/viewvc/llvm-project?rev=46344&view=rev
Log:
Add target-specific dag combines for FAND(x,0) and FOR(x,0).  This allows
us to compile:

double test(double X) {
  return copysign(0.0, X);
}

into:

_test:
andpd   LCPI1_0(%rip), %xmm0
ret

instead of:
_test:
pxor%xmm1, %xmm1
andpd   LCPI1_0(%rip), %xmm1
movapd  %xmm0, %xmm2
andpd   LCPI1_1(%rip), %xmm2
movapd  %xmm1, %xmm0
orpd%xmm2, %xmm0
ret


Added:
llvm/trunk/test/CodeGen/X86/copysign-zero.ll
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=46344&r1=46343&r2=46344&view=diff

==
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Jan 24 23:46:26 2008
@@ -5627,16 +5627,42 @@
   return SDOperand();
 }
 
+/// PerformFORCombine - Do target-specific dag combines on X86ISD::FOR nodes.
+static SDOperand PerformFORCombine(SDNode *N, SelectionDAG &DAG) {
+  // FOR(0.0, x) -> x
+  // FOR(x, 0.0) -> x
+  if (ConstantFPSDNode *C = dyn_cast(N->getOperand(0)))
+if (C->getValueAPF().isPosZero())
+  return N->getOperand(1);
+  if (ConstantFPSDNode *C = dyn_cast(N->getOperand(1)))
+if (C->getValueAPF().isPosZero())
+  return N->getOperand(0);
+  return SDOperand();
+}
+
+/// PerformFANDCombine - Do target-specific dag combines on X86ISD::FAND nodes.
+static SDOperand PerformFANDCombine(SDNode *N, SelectionDAG &DAG) {
+  // FAND(0.0, x) -> 0.0
+  // FAND(x, 0.0) -> 0.0
+  if (ConstantFPSDNode *C = dyn_cast(N->getOperand(0)))
+if (C->getValueAPF().isPosZero())
+  return N->getOperand(0);
+  if (ConstantFPSDNode *C = dyn_cast(N->getOperand(1)))
+if (C->getValueAPF().isPosZero())
+  return N->getOperand(1);
+  return SDOperand();
+}
+
 
 SDOperand X86TargetLowering::PerformDAGCombine(SDNode *N,
DAGCombinerInfo &DCI) const {
   SelectionDAG &DAG = DCI.DAG;
   switch (N->getOpcode()) {
   default: break;
-  case ISD::VECTOR_SHUFFLE:
-return PerformShuffleCombine(N, DAG, Subtarget);
-  case ISD::SELECT:
-return PerformSELECTCombine(N, DAG, Subtarget);
+  case ISD::VECTOR_SHUFFLE: return PerformShuffleCombine(N, DAG, Subtarget);
+  case ISD::SELECT: return PerformSELECTCombine(N, DAG, Subtarget);
+  case X86ISD::FOR: return PerformFORCombine(N, DAG);
+  case X86ISD::FAND:return PerformFANDCombine(N, DAG);
   }
 
   return SDOperand();

Added: llvm/trunk/test/CodeGen/X86/copysign-zero.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/copysign-zero.ll?rev=46344&view=auto

==
--- llvm/trunk/test/CodeGen/X86/copysign-zero.ll (added)
+++ llvm/trunk/test/CodeGen/X86/copysign-zero.ll Thu Jan 24 23:46:26 2008
@@ -0,0 +1,14 @@
+; RUN: llvm-as < %s | llc | not grep orpd
+; RUN: llvm-as < %s | llc | grep andpd | count 1
+
+target datalayout = 
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-apple-darwin8"
+
+define double @test(double %X) nounwind  {
+entry:
+   %tmp2 = tail call double @copysign( double 0.00e+00, double %X ) 
nounwind readnone  ;  [#uses=1]
+   ret double %tmp2
+}
+
+declare double @copysign(double, double) nounwind readnone 
+


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46345 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Fri Jan 25 00:14:17 2008
New Revision: 46345

URL: http://llvm.org/viewvc/llvm-project?rev=46345&view=rev
Log:
optimize fxor like for

Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=46345&r1=46344&r2=46345&view=diff

==
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Jan 25 00:14:17 2008
@@ -5627,10 +5627,12 @@
   return SDOperand();
 }
 
-/// PerformFORCombine - Do target-specific dag combines on X86ISD::FOR nodes.
+/// PerformFORCombine - Do target-specific dag combines on X86ISD::FOR and
+/// X86ISD::FXOR nodes.
 static SDOperand PerformFORCombine(SDNode *N, SelectionDAG &DAG) {
-  // FOR(0.0, x) -> x
-  // FOR(x, 0.0) -> x
+  assert(N->getOpcode() == X86ISD::FOR || N->getOpcode() == X86ISD::FXOR);
+  // F[X]OR(0.0, x) -> x
+  // F[X]OR(x, 0.0) -> x
   if (ConstantFPSDNode *C = dyn_cast(N->getOperand(0)))
 if (C->getValueAPF().isPosZero())
   return N->getOperand(1);
@@ -5661,6 +5663,7 @@
   default: break;
   case ISD::VECTOR_SHUFFLE: return PerformShuffleCombine(N, DAG, Subtarget);
   case ISD::SELECT: return PerformSELECTCombine(N, DAG, Subtarget);
+  case X86ISD::FXOR:
   case X86ISD::FOR: return PerformFORCombine(N, DAG);
   case X86ISD::FAND:return PerformFANDCombine(N, DAG);
   }


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46346 - /llvm/trunk/include/llvm/CodeGen/SelectionDAG.h

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Fri Jan 25 00:20:20 2008
New Revision: 46346

URL: http://llvm.org/viewvc/llvm-project?rev=46346&view=rev
Log:
add a fixme.

Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAG.h

Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=46346&r1=46345&r2=46346&view=diff

==
--- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Fri Jan 25 00:20:20 2008
@@ -499,6 +499,8 @@
   /// isCommutativeBinOp - Returns true if the opcode is a commutative binary
   /// operation.
   static bool isCommutativeBinOp(unsigned Opcode) {
+// FIXME: This should get its info from the td file, so that we can include
+// target info.
 switch (Opcode) {
 case ISD::ADD:
 case ISD::MUL:


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46347 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Fri Jan 25 00:40:45 2008
New Revision: 46347

URL: http://llvm.org/viewvc/llvm-project?rev=46347&view=rev
Log:
include alignment and volatility information in -view-*-dags output

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=46347&r1=46346&r2=46347&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Fri Jan 25 
00:40:45 2008
@@ -164,13 +164,20 @@
   break;
 }
 if (doExt)
-  Op = Op + MVT::getValueTypeString(LD->getLoadedVT()) + ">";
-
+  Op += MVT::getValueTypeString(LD->getLoadedVT()) + ">";
+if (LD->isVolatile())
+  Op += "";
 Op += LD->getIndexedModeName(LD->getAddressingMode());
+if (LD->getAlignment() > 1)
+  Op += " A=" + utostr(LD->getAlignment());
   } else if (const StoreSDNode *ST = dyn_cast(Node)) {
 if (ST->isTruncatingStore())
-  Op = Op + "getStoredVT()) + ">";
+  Op += "getStoredVT()) + ">";
+if (ST->isVolatile())
+  Op += "";
 Op += ST->getIndexedModeName(ST->getAddressingMode());
+if (ST->getAlignment() > 1)
+  Op += " A=" + utostr(ST->getAlignment());
   }
 
 #if 0


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46348 - in /llvm/trunk: include/llvm/CodeGen/MachineFrameInfo.h lib/CodeGen/MachineFunction.cpp

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Fri Jan 25 01:19:06 2008
New Revision: 46348

URL: http://llvm.org/viewvc/llvm-project?rev=46348&view=rev
Log:
move MachineFrameInfo::CreateFixedObject out of line, give MachineFrameInfo
a reference to TargetFrameInfo.  Rearrange order of fields in StackObject to
save a word.

Modified:
llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
llvm/trunk/lib/CodeGen/MachineFunction.cpp

Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=46348&r1=46347&r2=46348&view=diff

==
--- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Fri Jan 25 01:19:06 2008
@@ -19,6 +19,7 @@
 class Type;
 class MachineModuleInfo;
 class MachineFunction;
+class TargetFrameInfo;
 
 /// The CalleeSavedInfo class tracks the information need to locate where a
 /// callee saved register in the current frame.  
@@ -82,17 +83,17 @@
 // Alignment - The required alignment of this stack slot.
 unsigned Alignment;
 
-// SPOffset - The offset of this object from the stack pointer on entry to
-// the function.  This field has no meaning for a variable sized element.
-int64_t SPOffset;
-
 // isImmutable - If true, the value of the stack object is set before
 // entering the function and is not modified inside the function. By
 // default, fixed objects are immutable unless marked otherwise.
 bool isImmutable;
+
+// SPOffset - The offset of this object from the stack pointer on entry to
+// the function.  This field has no meaning for a variable sized element.
+int64_t SPOffset;
 
 StackObject(uint64_t Sz, unsigned Al, int64_t SP, bool IM = false)
-  : Size(Sz), Alignment(Al), SPOffset(SP), isImmutable(IM) {}
+  : Size(Sz), Alignment(Al), isImmutable(IM), SPOffset(SP) {}
   };
 
   /// Objects - The list of stack objects allocated...
@@ -159,8 +160,11 @@
   /// of frame layouts.
   MachineModuleInfo *MMI;
   
+  /// TargetFrameInfo - Target information about frame layout.
+  ///
+  const TargetFrameInfo &TFI;
 public:
-  MachineFrameInfo() {
+  MachineFrameInfo(const TargetFrameInfo &tfi) : TFI(tfi) {
 StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0;
 HasVarSizedObjects = false;
 HasCalls = false;
@@ -264,12 +268,9 @@
   /// index with a negative value.
   ///
   int CreateFixedObject(uint64_t Size, int64_t SPOffset,
-bool Immutable = true) {
-assert(Size != 0 && "Cannot allocate zero size fixed stack objects!");
-Objects.insert(Objects.begin(), StackObject(Size, 1, SPOffset, Immutable));
-return -++NumFixedObjects;
-  }
-
+bool Immutable = true);
+  
+  
   /// isFixedObjectIndex - Returns true if the specified index corresponds to a
   /// fixed stack object.
   bool isFixedObjectIndex(int ObjectIdx) const {

Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=46348&r1=46347&r2=46348&view=diff

==
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Fri Jan 25 01:19:06 2008
@@ -126,7 +126,7 @@
   : Annotation(MF_AID), Fn(F), Target(TM) {
   RegInfo = new MachineRegisterInfo(*TM.getRegisterInfo());
   MFInfo = 0;
-  FrameInfo = new MachineFrameInfo();
+  FrameInfo = new MachineFrameInfo(*TM.getFrameInfo());
   ConstantPool = new MachineConstantPool(TM.getTargetData());
   
   // Set up jump table.
@@ -331,6 +331,19 @@
 //  MachineFrameInfo implementation
 
//===--===//
 
+/// CreateFixedObject - Create a new object at a fixed location on the stack.
+/// All fixed objects should be created before other objects are created for
+/// efficiency. By default, fixed objects are immutable. This returns an
+/// index with a negative value.
+///
+int MachineFrameInfo::CreateFixedObject(uint64_t Size, int64_t SPOffset,
+bool Immutable) {
+  assert(Size != 0 && "Cannot allocate zero size fixed stack objects!");
+  Objects.insert(Objects.begin(), StackObject(Size, 1, SPOffset, Immutable));
+  return -++NumFixedObjects;
+}
+
+
 void MachineFrameInfo::print(const MachineFunction &MF, std::ostream &OS) 
const{
   int ValOffset = MF.getTarget().getFrameInfo()->getOffsetOfLocalArea();
 


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46349 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Fri Jan 25 01:20:16 2008
New Revision: 46349

URL: http://llvm.org/viewvc/llvm-project?rev=46349&view=rev
Log:
Add skeletal code to increase the alignment of loads and stores when
we can infer it.  This will eventually help stuff, though it doesn't
do much right now because all fixed FI's have an alignment of 1.

Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=46349&r1=46348&r2=46349&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Jan 25 01:20:16 2008
@@ -14,6 +14,8 @@
 
 #define DEBUG_TYPE "dagcombine"
 #include "llvm/CodeGen/SelectionDAG.h"
+#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineFrameInfo.h"
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetLowering.h"
@@ -4074,11 +4076,37 @@
   return false;
 }
 
+/// InferAlignment - If we can infer some alignment information from this
+/// pointer, return it.
+static unsigned InferAlignment(SDOperand Ptr, SelectionDAG &DAG) {
+  // If this is a direct reference to a stack slot, use information about the
+  // stack slot's alignment.
+  if (FrameIndexSDNode *FI = dyn_cast(Ptr)) {
+return DAG.getMachineFunction().getFrameInfo()->
+ getObjectAlignment(FI->getIndex());
+  }
+  
+  // FIXME: Handle FI+CST.
+  
+  return 0;
+}
 
 SDOperand DAGCombiner::visitLOAD(SDNode *N) {
   LoadSDNode *LD  = cast(N);
   SDOperand Chain = LD->getChain();
   SDOperand Ptr   = LD->getBasePtr();
+  
+  // Try to infer better alignment information than the load already has.
+  if (LD->isUnindexed()) {
+if (unsigned Align = InferAlignment(Ptr, DAG)) {
+  if (Align > LD->getAlignment())
+return DAG.getExtLoad(LD->getExtensionType(), LD->getValueType(0),
+  Chain, Ptr, LD->getSrcValue(),
+  LD->getSrcValueOffset(), LD->getLoadedVT(),
+  LD->isVolatile(), Align);
+}
+  }
+  
 
   // If load is not volatile and there are no uses of the loaded value (and
   // the updated indexed value in case of indexed loads), change uses of the
@@ -4189,6 +4217,16 @@
   SDOperand Value = ST->getValue();
   SDOperand Ptr   = ST->getBasePtr();
   
+  // Try to infer better alignment information than the store already has.
+  if (ST->isUnindexed()) {
+if (unsigned Align = InferAlignment(Ptr, DAG)) {
+  if (Align > ST->getAlignment())
+return DAG.getTruncStore(Chain, Value, Ptr, ST->getSrcValue(),
+ ST->getSrcValueOffset(), ST->getStoredVT(),
+ ST->isVolatile(), Align);
+}
+  }
+  
   // If this is a store of a bit convert, store the input value if the
   // resultant store does not need a higher alignment than the original.
   if (Value.getOpcode() == ISD::BIT_CONVERT && !ST->isTruncatingStore() &&


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r46350 - /llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h

2008-01-24 Thread Chris Lattner
Author: lattner
Date: Fri Jan 25 01:29:34 2008
New Revision: 46350

URL: http://llvm.org/viewvc/llvm-project?rev=46350&view=rev
Log:
move this field back.  Moving the field causes miscompilations (!) of voronoi 
and others.

Modified:
llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h

Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=46350&r1=46349&r2=46350&view=diff

==
--- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Fri Jan 25 01:29:34 2008
@@ -83,17 +83,17 @@
 // Alignment - The required alignment of this stack slot.
 unsigned Alignment;
 
+// SPOffset - The offset of this object from the stack pointer on entry to
+// the function.  This field has no meaning for a variable sized element.
+int64_t SPOffset;
+
 // isImmutable - If true, the value of the stack object is set before
 // entering the function and is not modified inside the function. By
 // default, fixed objects are immutable unless marked otherwise.
 bool isImmutable;
 
-// SPOffset - The offset of this object from the stack pointer on entry to
-// the function.  This field has no meaning for a variable sized element.
-int64_t SPOffset;
-
 StackObject(uint64_t Sz, unsigned Al, int64_t SP, bool IM = false)
-  : Size(Sz), Alignment(Al), isImmutable(IM), SPOffset(SP) {}
+  : Size(Sz), Alignment(Al), SPOffset(SP), isImmutable(IM) {}
   };
 
   /// Objects - The list of stack objects allocated...


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46350 - /llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h

2008-01-24 Thread Evan Cheng
Ugh, really??

Evan
On Jan 24, 2008, at 11:29 PM, Chris Lattner wrote:

> Author: lattner
> Date: Fri Jan 25 01:29:34 2008
> New Revision: 46350
>
> URL: http://llvm.org/viewvc/llvm-project?rev=46350&view=rev
> Log:
> move this field back.  Moving the field causes miscompilations (!)  
> of voronoi and others.
>
> Modified:
>llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
>
> Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=46350&r1=46349&r2=46350&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ==
> --- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Fri Jan 25  
> 01:29:34 2008
> @@ -83,17 +83,17 @@
> // Alignment - The required alignment of this stack slot.
> unsigned Alignment;
>
> +// SPOffset - The offset of this object from the stack pointer  
> on entry to
> +// the function.  This field has no meaning for a variable  
> sized element.
> +int64_t SPOffset;
> +
> // isImmutable - If true, the value of the stack object is set  
> before
> // entering the function and is not modified inside the  
> function. By
> // default, fixed objects are immutable unless marked otherwise.
> bool isImmutable;
>
> -// SPOffset - The offset of this object from the stack pointer  
> on entry to
> -// the function.  This field has no meaning for a variable  
> sized element.
> -int64_t SPOffset;
> -
> StackObject(uint64_t Sz, unsigned Al, int64_t SP, bool IM = false)
> -  : Size(Sz), Alignment(Al), isImmutable(IM), SPOffset(SP) {}
> +  : Size(Sz), Alignment(Al), SPOffset(SP), isImmutable(IM) {}
>   };
>
>   /// Objects - The list of stack objects allocated...
>
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits