[llvm-commits] CVS: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp

2007-01-15 Thread Nick Lewycky


Changes in directory llvm/lib/Transforms/Scalar:

PredicateSimplifier.cpp updated: 1.47 -> 1.48
---
Log message:

Don't print address of ETNode. Print the DFSNumIn which uniquely identifies
the basic block and is stable across runs in gdb or valgrind.

Make Node::update handle edges which dominate and are tighter than
existing edges.

Replace makeEqual's "squeeze theorem" code. Fixes miscompilation.

Gate the calls to defToOps and opsToDef. Before this, we were getting IG
edges about values which weren't even defined in the dominated area. This
reduces the size of the IG by about half.


---
Diffs of the changes:  (+65 -34)

 PredicateSimplifier.cpp |   99 +++-
 1 files changed, 65 insertions(+), 34 deletions(-)


Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp
diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.47 
llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.48
--- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.47 Fri Jan 12 
20:05:28 2007
+++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp  Mon Jan 15 08:30:07 2007
@@ -263,7 +263,7 @@
   "24", "25", "u>", "   u>=", "u<", "   u<=",
   "!=", "31" };
   os << "  " << names[NI->LV] << " " << NI->To
- << "(" << NI->Subtree << ")\n";
+ << " (" << NI->Subtree->getDFSNumIn() << ")\n";
 }
   }
 #endif
@@ -313,15 +313,24 @@
   LatticeVal LV = static_cast(I->LV & R);
   assert(validPredicate(LV) && "Invalid union of lattice values.");
   if (LV != I->LV) {
-if (Subtree == I->Subtree)
-  I->LV = LV;
-else {
+if (Subtree != I->Subtree) {
   assert(Subtree->DominatedBy(I->Subtree) &&
  "Find returned subtree that doesn't apply.");
 
   Edge edge(n, R, Subtree);
   iterator Insert = std::lower_bound(begin(), end(), edge);
-  Relations.insert(Insert, edge);
+  Relations.insert(Insert, edge); // invalidates I
+  I = find(n, Subtree);
+}
+
+// Also, we have to tighten any edge that Subtree dominates.
+for (iterator B = begin(); I->To == n; --I) {
+  if (I->Subtree->DominatedBy(Subtree)) {
+LatticeVal LV = static_cast(I->LV & R);
+assert(validPredicate(LV) && "Invalid union of lattice 
values.");
+I->LV = LV;
+  }
+  if (I == B) break;
 }
   }
 }
@@ -646,7 +655,8 @@
 for (NodeMapType::const_iterator I = NodeMap.begin(), E = NodeMap.end();
  I != E; ++I) {
   Node *N = node(I->index);
-  os << *I->V << " == " << I->index << "(" << I->Subtree << ")\n";
+  os << *I->V << " == " << I->index
+ << "(" << I->Subtree->getDFSNumIn() << ")\n";
   if (VisitedNodes.insert(N).second) {
 os << I->index << ". ";
 if (!N->getValue()) os << "(deleted node)\n";
@@ -819,27 +829,28 @@
 // We can't just merge %x and %y because the relationship with %z would
 // be EQ and that's invalid. What we're doing is looking for any nodes
 // %z such that %x <= %z and %y >= %z, and vice versa.
-//
-// Also handle %a <= %b and %c <= %a when adding %b <= %c.
 
 Node *N1 = IG.node(n1);
-Node::iterator end = N1->end();
-for (unsigned i = 0; i < Remove.size(); ++i) {
-  Node *N = IG.node(Remove[i]);
-  Value *V = N->getValue();
-  for (Node::iterator I = N->begin(), E = N->end(); I != E; ++I) {
-if (I->LV & EQ_BIT) {
-  if (Top == I->Subtree || Top->DominatedBy(I->Subtree)) {
-Node::iterator NI = N1->find(I->To, Top);
-if (NI != end) {
-  if (!(NI->LV & EQ_BIT)) return false;
-  if (isRelatedBy(V, IG.node(NI->To)->getValue(),
-  ICmpInst::ICMP_NE))
-return false;
-  Remove.insert(NI->To);
-}
-  }
-}
+Node *N2 = IG.node(n2);
+Node::iterator end = N2->end();
+
+// Find the intersection between N1 and N2 which is dominated by
+// Top. If we find %x where N1 <= %x <= N2 (or >=) then add %x to
+// Remove.
+for (Node::iterator I = N1->begin(), E = N1->end(); I != E; ++I) {
+  if (!(I->LV & EQ_BIT) || !Top->DominatedBy(I->Subtree)) continue;
+
+  unsigned ILV_s = I->LV & (SLT_BIT|SGT_BIT);
+  unsigned ILV_u = I->LV & (ULT_BIT|UGT_BIT);
+  Node::iterator NI = N2->find(I->To, Top);
+  if (NI != end) {
+LatticeVal NILV = reversePredicate(NI->LV);
+unsigned NILV_s = NILV & (SLT_BIT|SGT_BIT);
+unsigned NILV_u = NILV & (ULT_BIT|UGT_BIT);
+
+if ((ILV_s != (SLT_BIT|SGT_BIT) && IL

[llvm-commits] Fix obvious thinko/typo in EmitMinMaxExpr

2007-01-15 Thread Duncan Sands
Index: gcc/llvm-convert.cpp
===
--- gcc/llvm-convert.cpp(revision 248)
+++ gcc/llvm-convert.cpp(working copy)
@@ -2568,7 +2574,7 @@
   Instruction::CastOps opcode = CastInst::getCastOpcode(LHS, LHSIsSigned, Ty, 
 TyIsSigned);
   LHS = CastToType(opcode, LHS, Ty);
-  opcode = CastInst::getCastOpcode(LHS, LHSIsSigned, Ty, TyIsSigned);
+  opcode = CastInst::getCastOpcode(RHS, RHSIsSigned, Ty, TyIsSigned);
   RHS = CastToType(opcode, RHS, Ty);
   
   Value *Compare;
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] llvm-convert.cpp: abort on unhandled expression

2007-01-15 Thread Duncan Sands
Neater than just segfaulting, which in my experience is what happens
a bit later without this.

Index: gcc/llvm-convert.cpp
===
--- gcc/llvm-convert.cpp(revision 248)
+++ gcc/llvm-convert.cpp(working copy)
@@ -496,7 +496,7 @@
   default:
 std::cerr << "Unhandled expression!\n";
 debug_tree(exp);
-break;
+abort();
   case EH_FILTER_EXPR:
   case CATCH_EXPR: {
 static bool PrintedWarning = false;
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] Support VIEW_CONVERT_EXPR in TreeConstantToLLVM::Convert

2007-01-15 Thread Duncan Sands
Ignore the type change - constants don't care.

Index: gcc/llvm-convert.cpp
===
--- gcc/llvm-convert.cpp(revision 248)
+++ gcc/llvm-convert.cpp(working copy)
@@ -4260,6 +4380,7 @@
   case PLUS_EXPR:
   case MINUS_EXPR:return ConvertBinOp_CST(exp);
   case CONSTRUCTOR:   return ConvertCONSTRUCTOR(exp);
+  case VIEW_CONVERT_EXPR: return Convert(TREE_OPERAND(exp, 0));
   case ADDR_EXPR: 
 return ConstantExpr::getBitCast(EmitLV(TREE_OPERAND(exp, 0)),
  ConvertType(TREE_TYPE(exp)));
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] llvm-convert.cpp compile fix

2007-01-15 Thread Duncan Sands
Something like this is needed to get current llvm-gcc4 to compile.

Index: gcc/llvm-convert.cpp
===
--- gcc/llvm-convert.cpp(revision 248)
+++ gcc/llvm-convert.cpp(working copy)
@@ -221,7 +221,7 @@
   // If this is just a mismatch between integer types, this is due
   // to K&R prototypes, where the forward proto defines the arg as int
   // and the actual impls is a short or char.
-  assert(ArgVal->getType() == Type::Int32Ty && LLVMTy->isIntegral() &&
+  assert(ArgVal->getType() == Type::Int32Ty && LLVMTy->isInteger() &&
  "Lowerings don't match?");
   ArgVal = new TruncInst(ArgVal, LLVMTy, NameStack.back(), CurBB);
 }
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] llvm-gcc: sign matters for EXACT_DIV_EXPR

2007-01-15 Thread Duncan Sands
EXACT_DIV_EXPR can be used on signed operands, so it is wrong to always
turn it into UDiv.  Since EXACT_DIV_EXPR always gives the same result as
TRUNC_DIV_EXPR (it exists in gcc because it might give that result faster
on some targets, not because it gives a different result), it is pointless
to distinguish between the two in LLVM.

Index: gcc/llvm-convert.cpp
===
--- gcc/llvm-convert.cpp(revision 248)
+++ gcc/llvm-convert.cpp(working copy)
@@ -591,14 +591,12 @@
   case MINUS_EXPR:Result = EmitBinOp(exp, DestLoc, Instruction::Sub);break;
   case MULT_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Mul);break;
   case TRUNC_DIV_EXPR: 
+  case EXACT_DIV_EXPR: 
 if (TYPE_UNSIGNED(TREE_TYPE(exp)))
   Result = EmitBinOp(exp, DestLoc, Instruction::UDiv);
 else 
   Result = EmitBinOp(exp, DestLoc, Instruction::SDiv);
 break;
-  case EXACT_DIV_EXPR: 
-Result = EmitBinOp(exp, DestLoc, Instruction::UDiv);
-break;
   case RDIV_EXPR:  
 Result = EmitBinOp(exp, DestLoc, Instruction::FDiv);
 break;
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] llvm-convert.cpp compile fix

2007-01-15 Thread Chris Lattner
This is already in the repository, but must not have hit the mirror yet.

-Chris

On Jan 15, 2007, at 7:03 AM, Duncan Sands wrote:

> Something like this is needed to get current llvm-gcc4 to compile.
>
> Index: gcc/llvm-convert.cpp
> ===
> --- gcc/llvm-convert.cpp  (revision 248)
> +++ gcc/llvm-convert.cpp  (working copy)
> @@ -221,7 +221,7 @@
>// If this is just a mismatch between integer types,  
> this is due
>// to K&R prototypes, where the forward proto defines  
> the arg as int
>// and the actual impls is a short or char.
> -  assert(ArgVal->getType() == Type::Int32Ty && LLVMTy- 
> >isIntegral() &&
> +  assert(ArgVal->getType() == Type::Int32Ty && LLVMTy- 
> >isInteger() &&
>   "Lowerings don't match?");
>ArgVal = new TruncInst(ArgVal, LLVMTy, NameStack.back(),  
> CurBB);
>  }
> ___
> 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] Fix obvious thinko/typo in EmitMinMaxExpr

2007-01-15 Thread Chris Lattner
Applied, thanks!

On Jan 15, 2007, at 7:07 AM, Duncan Sands wrote:

> Index: gcc/llvm-convert.cpp
> ===
> --- gcc/llvm-convert.cpp  (revision 248)
> +++ gcc/llvm-convert.cpp  (working copy)
> @@ -2568,7 +2574,7 @@
>Instruction::CastOps opcode = CastInst::getCastOpcode(LHS,  
> LHSIsSigned, Ty,
>  TyIsSigned);
>LHS = CastToType(opcode, LHS, Ty);
> -  opcode = CastInst::getCastOpcode(LHS, LHSIsSigned, Ty, TyIsSigned);
> +  opcode = CastInst::getCastOpcode(RHS, RHSIsSigned, Ty, TyIsSigned);
>RHS = CastToType(opcode, RHS, Ty);
>
>Value *Compare;
> ___
> 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] Support VIEW_CONVERT_EXPR in TreeConstantToLLVM::Convert

2007-01-15 Thread Chris Lattner
Applied, thanks!

-Chris

On Jan 15, 2007, at 7:11 AM, Duncan Sands wrote:

> Ignore the type change - constants don't care.
>
> Index: gcc/llvm-convert.cpp
> ===
> --- gcc/llvm-convert.cpp  (revision 248)
> +++ gcc/llvm-convert.cpp  (working copy)
> @@ -4260,6 +4380,7 @@
>case PLUS_EXPR:
>case MINUS_EXPR:return ConvertBinOp_CST(exp);
>case CONSTRUCTOR:   return ConvertCONSTRUCTOR(exp);
> +  case VIEW_CONVERT_EXPR: return Convert(TREE_OPERAND(exp, 0));
>case ADDR_EXPR:
>  return ConstantExpr::getBitCast(EmitLV(TREE_OPERAND(exp, 0)),
>   ConvertType(TREE_TYPE(exp)));
> ___
> 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-gcc: sign matters for EXACT_DIV_EXPR

2007-01-15 Thread Chris Lattner
Applied, thanks!

On Jan 15, 2007, at 9:09 AM, Duncan Sands wrote:

> EXACT_DIV_EXPR can be used on signed operands, so it is wrong to  
> always
> turn it into UDiv.  Since EXACT_DIV_EXPR always gives the same  
> result as
> TRUNC_DIV_EXPR (it exists in gcc because it might give that result  
> faster
> on some targets, not because it gives a different result), it is  
> pointless
> to distinguish between the two in LLVM.

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


[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

2007-01-15 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.600 -> 1.601
---
Log message:

Fix a regression in my isIntegral patch that broke 471.omnetpp.  This is 
because TargetData::getTypeSize() returns the same for i1 and i8.  This fix
is not right for the full generality of bitwise types, but it fixes the
regression.


---
Diffs of the changes:  (+8 -6)

 InstructionCombining.cpp |   14 --
 1 files changed, 8 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.600 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.601
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.600   Mon Jan 15 
01:30:06 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jan 15 11:55:20 2007
@@ -7978,8 +7978,8 @@
   if (const PointerType *SrcTy = dyn_cast(CastOp->getType())) {
 const Type *SrcPTy = SrcTy->getElementType();
 
-if (DestPTy->isInteger() || isa(DestPTy) || 
-isa(DestPTy)) {
+if ((DestPTy->isInteger() && DestPTy != Type::Int1Ty) ||
+isa(DestPTy) || isa(DestPTy)) {
   // If the source is an array, the code below will not succeed.  Check to
   // see if a trivial 'gep P, 0, 0' will help matters.  Only do this for
   // constants.
@@ -7992,8 +7992,8 @@
 SrcPTy = SrcTy->getElementType();
   }
 
-  if ((SrcPTy->isInteger() || isa(SrcPTy) || 
-   isa(SrcPTy)) &&
+  if (((SrcPTy->isInteger() && SrcPTy != Type::Int1Ty) ||
+   isa(SrcPTy) || isa(SrcPTy)) &&
   // Do not allow turning this into a load of an integer, which is then
   // casted to a pointer, this pessimizes pointer analysis a lot.
   (isa(SrcPTy) == isa(LI.getType())) &&
@@ -8166,7 +8166,8 @@
   if (const PointerType *SrcTy = dyn_cast(CastOp->getType())) {
 const Type *SrcPTy = SrcTy->getElementType();
 
-if (DestPTy->isInteger() || isa(DestPTy)) {
+if ((DestPTy->isInteger() && DestPTy != Type::Int1Ty) ||
+isa(DestPTy)) {
   // If the source is an array, the code below will not succeed.  Check to
   // see if a trivial 'gep P, 0, 0' will help matters.  Only do this for
   // constants.
@@ -8179,7 +8180,8 @@
 SrcPTy = SrcTy->getElementType();
   }
 
-  if ((SrcPTy->isInteger() || isa(SrcPTy)) &&
+  if (((SrcPTy->isInteger() && SrcPTy != Type::Int1Ty) ||
+   isa(SrcPTy)) &&
   IC.getTargetData().getTypeSize(SrcPTy) ==
IC.getTargetData().getTypeSize(DestPTy)) {
 



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


[llvm-commits] CVS: llvm/docs/LangRef.html

2007-01-15 Thread Reid Spencer


Changes in directory llvm/docs:

LangRef.html updated: 1.198 -> 1.199
---
Log message:

Update documentation for parameter attributes for the syntax change.


---
Diffs of the changes:  (+11 -9)

 LangRef.html |   20 +++-
 1 files changed, 11 insertions(+), 9 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.198 llvm/docs/LangRef.html:1.199
--- llvm/docs/LangRef.html:1.198Sun Jan 14 19:54:13 2007
+++ llvm/docs/LangRef.html  Mon Jan 15 12:27:39 2007
@@ -687,27 +687,29 @@
   type so two functions types that differ only by the parameter attributes 
   are different function types.
 
-  Parameter attributes consist of an at sign (@) followed by either a single
-  keyword or a comma separate list of keywords enclosed in parentheses. For
+  Parameter attributes are simple keywords that follow the type specified. 
If
+  multiple parameter attributes are needed, they are space separated. For 
   example:
-%someFunc = i16 @zext (i8 @(sext) %someParam)
-%someFunc = i16 @zext (i8 @zext %someParam)
+%someFunc = i16 (i8 sext %someParam) zext
+%someFunc = i16 (i8 zext %someParam) zext
   Note that the two function types above are unique because the parameter 
has
-  a different attribute (@sext in the first one, @zext in the second).
+  a different attribute (sext in the first one, zext in the second). Also note
+  that the attribute for the function result (zext) comes immediately after the
+  argument list.
 
   Currently, only the following parameter attributes are defined:
   
-@zext
+zext
 This indicates that the parameter should be zero extended just before
 a call to this function.
-@sext
+sext
 This indicates that the parameter should be sign extended just before
 a call to this function.
   
 
   The current motivation for parameter attributes is to enable the sign and
   zero extend information necessary for the C calling convention to be passed
-  from the front end to LLVM. The @zext and @sext attributes
+  from the front end to LLVM. The zext and sext attributes
   are used by the code generator to perform the required extension. However, 
   parameter attributes are an orthogonal feature to calling conventions and
   may be used for other purposes in the future.
@@ -4485,7 +4487,7 @@
 
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/01/15 01:54:13 $
+  Last modified: $Date: 2007/01/15 18:27:39 $
 
 
 



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


[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp

2007-01-15 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.253 -> 1.254
---
Log message:

make this more efficient in release builds (time and space)



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

 AsmWriter.cpp |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.253 llvm/lib/VMCore/AsmWriter.cpp:1.254
--- llvm/lib/VMCore/AsmWriter.cpp:1.253 Sun Jan 14 20:27:26 2007
+++ llvm/lib/VMCore/AsmWriter.cpp   Mon Jan 15 12:28:18 2007
@@ -873,11 +873,9 @@
   abort();
 }
 switch (GV->getVisibility()) {
+default: assert(0 && "Invalid visibility style!");
 case GlobalValue::DefaultVisibility: break;
 case GlobalValue::HiddenVisibility: Out << "hidden "; break;
-default:
- cerr << "Invalid visibility style!\n";
- abort();
 }
   }
   
@@ -982,11 +980,9 @@
   abort();
 }
 switch (F->getVisibility()) {
+default: assert(0 && "Invalid visibility style!");
 case GlobalValue::DefaultVisibility: break;
 case GlobalValue::HiddenVisibility: Out << "hidden "; break;
-default:
- cerr << "Invalid visibility style!\n";
- abort();
 }
   }
 



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


[llvm-commits] CVS: llvm/docs/LangRef.html

2007-01-15 Thread Reid Spencer


Changes in directory llvm/docs:

LangRef.html updated: 1.199 -> 1.200
---
Log message:

One more @ to remove.


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

 LangRef.html |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.199 llvm/docs/LangRef.html:1.200
--- llvm/docs/LangRef.html:1.199Mon Jan 15 12:27:39 2007
+++ llvm/docs/LangRef.html  Mon Jan 15 12:28:34 2007
@@ -928,7 +928,7 @@
 function taking an i32, returning an i32
 
   
-float (i16 @sext, i32 *) *
+float (i16 sext, i32 *) *
 
 Pointer to a function that takes 
   an i16 that should be sign extended and a 
@@ -4487,7 +4487,7 @@
 
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/01/15 18:27:39 $
+  Last modified: $Date: 2007/01/15 18:28:34 $
 
 
 



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


Re: [llvm-commits] CVS: llvm/docs/BytecodeFormat.html LangRef.html

2007-01-15 Thread Chris Lattner
Nice work Anton, some comments below:

> @@ -1082,7 +1081,11 @@
>If this bit is set, a SectionID follows  
> this vbr.
>  
>  
> -  bit(10-31)
> +  bit(10-12)
> +  Visibility style: 0=Default, 1=Hidden.
> +
> +
> +  bit(13-31)
>Currently unassigned.
>  
>

Why reserve 3 bits for visibility?

> +
> + name="funclinkage_and_visibility">Linkage and
> +visibility word
> +
> +
> +
> +
> +  
> +
> +  Type
> +  Field Description
> +
> +
> +  bit(0-15)
> +  The linkage type of the function:  
> 0=External, 1=Weak,
> +2=Appending, 3=Internal, 4=LinkOnce, 5=DllImport,  
> 6=DllExport1
> +
> +
> +  bit(16-31)
> +  Visibility style: 0=Default, 1=Hidden.

Why reserve 16 bits for visibility? :)


Also, please add some info to LangRef.html about visibility.  Thanks!

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


[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/test-hidden.ll

2007-01-15 Thread Chris Lattner


Changes in directory llvm/test/Regression/CodeGen/X86:

test-hidden.ll updated: 1.1 -> 1.2
---
Log message:

test darwin too! :)


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

 test-hidden.ll |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/test/Regression/CodeGen/X86/test-hidden.ll
diff -u llvm/test/Regression/CodeGen/X86/test-hidden.ll:1.1 
llvm/test/Regression/CodeGen/X86/test-hidden.ll:1.2
--- llvm/test/Regression/CodeGen/X86/test-hidden.ll:1.1 Fri Jan 12 13:20:47 2007
+++ llvm/test/Regression/CodeGen/X86/test-hidden.ll Mon Jan 15 12:32:24 2007
@@ -1,5 +1,6 @@
 ; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu &&
-; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu | grep ".hidden" | wc -l 
| grep 2 
+; RUN: llvm-as < %s | llc -mtriple=i686-pc-linux-gnu | grep ".hidden" | wc -l 
| grep 2 &&
+; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin8.8.0 | grep 
".private_extern" | wc -l | grep 2 
 
 %struct.Person = type { i32 }
 %a = hidden global i32 0



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


[llvm-commits] CVS: llvm/win32/CBackend/CBackend.vcproj

2007-01-15 Thread Jeff Cohen


Changes in directory llvm/win32/CBackend:

CBackend.vcproj updated: 1.5 -> 1.6
---
Log message:

Unbreak VC++ build.

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

 CBackend.vcproj |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/win32/CBackend/CBackend.vcproj
diff -u llvm/win32/CBackend/CBackend.vcproj:1.5 
llvm/win32/CBackend/CBackend.vcproj:1.6
--- llvm/win32/CBackend/CBackend.vcproj:1.5 Sun Jan 29 22:07:07 2006
+++ llvm/win32/CBackend/CBackend.vcproj Mon Jan 15 14:27:18 2007
@@ -109,7 +109,7 @@
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"

UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">

+   
RelativePath="..\..\lib\Target\CBackend\CBackend.cpp">


http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/win32/CodeGen/CodeGen.vcproj

2007-01-15 Thread Jeff Cohen


Changes in directory llvm/win32/CodeGen:

CodeGen.vcproj updated: 1.25 -> 1.26
---
Log message:

Unbreak VC++ build.

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

 CodeGen.vcproj |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/win32/CodeGen/CodeGen.vcproj
diff -u llvm/win32/CodeGen/CodeGen.vcproj:1.25 
llvm/win32/CodeGen/CodeGen.vcproj:1.26
--- llvm/win32/CodeGen/CodeGen.vcproj:1.25  Sun Nov  5 13:31:28 2006
+++ llvm/win32/CodeGen/CodeGen.vcproj   Mon Jan 15 14:27:18 2007
@@ -292,6 +292,9 @@

RelativePath="..\..\include\llvm\CodeGen\RegAllocRegistry.h">


+   
+   

http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

2007-01-15 Thread Jeff Cohen


Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.88 -> 1.89
---
Log message:

Unbreak VC++ build.

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

 ScalarEvolution.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.88 
llvm/lib/Analysis/ScalarEvolution.cpp:1.89
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.88  Sun Jan 14 20:27:26 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Mon Jan 15 14:27:18 2007
@@ -1929,7 +1929,7 @@
 // Couldn't symbolically evaluate.
 if (!CondVal) return UnknownValue;
 
-if (CondVal->getZExtValue() == ExitWhen) {
+if (CondVal->getZExtValue() == uint64_t(ExitWhen)) {
   ConstantEvolutionLoopExitValue[PN] = PHIVal;
   ++NumBruteForceTripCountsComputed;
   return SCEVConstant::get(ConstantInt::get(Type::Int32Ty, IterationNum));



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


[llvm-commits] CVS: llvm/win32/llc/llc.vcproj

2007-01-15 Thread Jeff Cohen


Changes in directory llvm/win32/llc:

llc.vcproj updated: 1.9 -> 1.10
---
Log message:

Unbreak VC++ build.

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

 llc.vcproj |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/win32/llc/llc.vcproj
diff -u llvm/win32/llc/llc.vcproj:1.9 llvm/win32/llc/llc.vcproj:1.10
--- llvm/win32/llc/llc.vcproj:1.9   Sun Jan 29 22:07:07 2006
+++ llvm/win32/llc/llc.vcproj   Mon Jan 15 14:27:18 2007
@@ -37,7 +37,7 @@
Name="VCCustomBuildTool"/>

http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/win32/VMCore/VMCore.vcproj

2007-01-15 Thread Jeff Cohen


Changes in directory llvm/win32/VMCore:

VMCore.vcproj updated: 1.25 -> 1.26
---
Log message:

Unbreak VC++ build.

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

 VMCore.vcproj |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/win32/VMCore/VMCore.vcproj
diff -u llvm/win32/VMCore/VMCore.vcproj:1.25 
llvm/win32/VMCore/VMCore.vcproj:1.26
--- llvm/win32/VMCore/VMCore.vcproj:1.25Mon Jan  8 14:17:17 2007
+++ llvm/win32/VMCore/VMCore.vcproj Mon Jan 15 14:27:18 2007
@@ -291,6 +291,9 @@
RelativePath="..\..\include\llvm\PassManager.h">


+   
+   

http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2007-01-15 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.120 -> 1.121
---
Log message:

Do not record last users of Pass Manager.


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

 PassManager.cpp |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.120 
llvm/lib/VMCore/PassManager.cpp:1.121
--- llvm/lib/VMCore/PassManager.cpp:1.120   Fri Jan 12 14:07:16 2007
+++ llvm/lib/VMCore/PassManager.cpp Mon Jan 15 14:31:54 2007
@@ -594,8 +594,13 @@
   }
 }
 
-LastUses.push_back(P);
-TPM->setLastUser(LastUses, P);
+// Set P as P's last user until someone starts using P.
+// However, if P is a Pass Manager then it does not need
+// to record its last user.
+if (!dynamic_cast(P)) {
+  LastUses.push_back(P);
+  TPM->setLastUser(LastUses, P);
+}
 
 // Take a note of analysis required and made available by this pass.
 // Remove the analysis not preserved by this pass



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


Re: [llvm-commits] Potential Patch for PR1095

2007-01-15 Thread Chris Lattner
On Jan 9, 2007, at 12:25 AM, Bill Wendling wrote:
> Hi all,

Hey Bill, sorry for the delay.

> I would like someone to review this patch for PR1095. This gives us  
> a "dialect" for the assembler code if we're given something like:
>
>   __asm__("{cntlz|cntlzw} ...
>
> Before, we were defaulting to the first one. But there are some  
> platforms which need the second form.

This patch is very close.  Comments below:

Please add a .ll file regression test to llvm/test/Regression/CodeGen/ 
PowerPC.


--- include/llvm/Target/TargetAsmInfo.h 21 Dec 2006 21:24:35 -  1.18
+++ include/llvm/Target/TargetAsmInfo.h 9 Jan 2007 08:21:25 -
@@ -27,6 +27,11 @@
/// properties and features specific to the target.
class TargetAsmInfo {
protected:
+enum AsmDialect {
+  ASM_ATT,
+  ASM_INTEL
+};
+

The meaning of the various dialects vary across the targets.  This  
enum should move into the X86 backend.  The PowerPC backend should  
use PPC_OLD_MNEMONICS = 0 and PPC_NEW_MNEMONICS = 1.  Darwin should  
use new mnemonics of course.


@@ -128,6 +133,11 @@
  /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an  
8 byte
  /// boundary.
  bool AlignmentIsInBytes;  // Defaults to true
+
+//===--- Assembler Dialect Information  
===//
+
+/// AssemblerDialect - Which dialect of an assembler variant to  
use.
+AsmDialect AssemblerDialect; // Defaults to ASM_ATT

Please make this just an 'unsigned' and group it with InlineAsmStart/ 
InlineAsmEnd.  You could make the group comment be "Inline Asm  
Directives" or something.

Otherwise, the patch looks great.  Please make these changes and  
apply it.

Thanks Bill!

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


[llvm-commits] [PATCH] delete ManagedStatics

2007-01-15 Thread Devang Patel
Right now, ManagedStatics are not deleted (through llvm_shutdown) by  
llvm-gcc.
Here is the patch.

OK to install?
Thanks,
-
Devang

Index: llvm-backend.cpp
===
--- llvm-backend.cpp(revision 122487)
+++ llvm-backend.cpp(working copy)
@@ -45,6 +45,7 @@ Software Foundation, 59 Temple Place - S
  #include "llvm/Transforms/IPO.h"
  #include "llvm/ADT/StringExtras.h"
  #include "llvm/Support/Streams.h"
+#include "llvm/Support/ManagedStatic.h"
  #include 
  #undef VISIBILITY_HIDDEN
  extern "C" {
@@ -358,6 +359,7 @@ static void CreateStructorsList(std::vec
  // llvm_asm_file_end - Finish the .s file.
  void llvm_asm_file_end(void) {
timevar_push(TV_LLVM_PERFILE);
+  llvm_shutdown_obj X;  // Call llvm_shutdown() on exit.

// Add an llvm.global_ctors global if needed.
if (!StaticCtors.empty())

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


Re: [llvm-commits] [PATCH] delete ManagedStatics

2007-01-15 Thread Chris Lattner

On Jan 15, 2007, at 2:58 PM, Devang Patel wrote:

> Right now, ManagedStatics are not deleted (through llvm_shutdown) by
> llvm-gcc.
> Here is the patch.

Ahhh, right.  Yep, looks good.  Nice detective work,

-Chris

> OK to install?
> Thanks,
> -
> Devang
>
> Index: llvm-backend.cpp
> ===
> --- llvm-backend.cpp(revision 122487)
> +++ llvm-backend.cpp(working copy)
> @@ -45,6 +45,7 @@ Software Foundation, 59 Temple Place - S
>   #include "llvm/Transforms/IPO.h"
>   #include "llvm/ADT/StringExtras.h"
>   #include "llvm/Support/Streams.h"
> +#include "llvm/Support/ManagedStatic.h"
>   #include 
>   #undef VISIBILITY_HIDDEN
>   extern "C" {
> @@ -358,6 +359,7 @@ static void CreateStructorsList(std::vec
>   // llvm_asm_file_end - Finish the .s file.
>   void llvm_asm_file_end(void) {
> timevar_push(TV_LLVM_PERFILE);
> +  llvm_shutdown_obj X;  // Call llvm_shutdown() on exit.
>
> // Add an llvm.global_ctors global if needed.
> if (!StaticCtors.empty())
>
> ___
> 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] CVS: llvm/lib/VMCore/PassManager.cpp

2007-01-15 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.121 -> 1.122
---
Log message:

Remove extra white spaces. Fix comments.


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

 PassManager.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.121 
llvm/lib/VMCore/PassManager.cpp:1.122
--- llvm/lib/VMCore/PassManager.cpp:1.121   Mon Jan 15 14:31:54 2007
+++ llvm/lib/VMCore/PassManager.cpp Mon Jan 15 17:06:56 2007
@@ -559,7 +559,7 @@
 /// Add pass P into the PassVector. Update 
 /// AvailableAnalysis appropriately if ProcessAnalysis is true.
 void PMDataManager::add(Pass *P, 
- bool ProcessAnalysis) {
+bool ProcessAnalysis) {
 
   // This manager is going to manage pass P. Set up analysis resolver
   // to connect them.



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


[llvm-commits] CVS: llvm/include/llvm/PassManagers.h

2007-01-15 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManagers.h updated: 1.2 -> 1.3
---
Log message:

Remove extra white spaces. Fix comments.


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

 PassManagers.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/PassManagers.h
diff -u llvm/include/llvm/PassManagers.h:1.2 
llvm/include/llvm/PassManagers.h:1.3
--- llvm/include/llvm/PassManagers.h:1.2Fri Jan 12 14:07:16 2007
+++ llvm/include/llvm/PassManagers.hMon Jan 15 17:06:56 2007
@@ -1,4 +1,4 @@
-//===- PassManager.cpp - LLVM Pass Infrastructure Implementation 
--===//
+//===- llvm/PassManager.h - Pass Inftrastructre classes  *- C++ 
-*-===//
 //
 // The LLVM Compiler Infrastructure
 //
@@ -7,7 +7,7 @@
 //
 
//===--===//
 //
-// This file implements the LLVM Pass Manager infrastructure. 
+// This file declares the LLVM Pass Manager infrastructure. 
 //
 
//===--===//
 



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


Re: [llvm-commits] Potential Patch for PR1095

2007-01-15 Thread Bill Wendling
On 1/15/07, Chris Lattner <[EMAIL PROTECTED]> wrote:
> On Jan 9, 2007, at 12:25 AM, Bill Wendling wrote:
> > Hi all,
>
> Hey Bill, sorry for the delay.
>
Not a prob :-)

> > I would like someone to review this patch for PR1095. This gives us
> > a "dialect" for the assembler code if we're given something like:
> >
> >   __asm__("{cntlz|cntlzw} ...
> >
> > Before, we were defaulting to the first one. But there are some
> > platforms which need the second form.
>
> This patch is very close.  Comments below:
>
> Please add a .ll file regression test to llvm/test/Regression/CodeGen/
> PowerPC.
>
Will do.

>
> --- include/llvm/Target/TargetAsmInfo.h 21 Dec 2006 21:24:35 -  1.18
> +++ include/llvm/Target/TargetAsmInfo.h 9 Jan 2007 08:21:25 -
> @@ -27,6 +27,11 @@
> /// properties and features specific to the target.
> class TargetAsmInfo {
> protected:
> +enum AsmDialect {
> +  ASM_ATT,
> +  ASM_INTEL
> +};
> +
>
> The meaning of the various dialects vary across the targets.  This
> enum should move into the X86 backend.  The PowerPC backend should
> use PPC_OLD_MNEMONICS = 0 and PPC_NEW_MNEMONICS = 1.  Darwin should
> use new mnemonics of course.
>
Ah! This makes more sense now. I was worried that just having "ATT"
and "INTEL" was wrong.

>
> @@ -128,6 +133,11 @@
>   /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an
> 8 byte
>   /// boundary.
>   bool AlignmentIsInBytes;  // Defaults to true
> +
> +//===--- Assembler Dialect Information
> ===//
> +
> +/// AssemblerDialect - Which dialect of an assembler variant to
> use.
> +AsmDialect AssemblerDialect; // Defaults to ASM_ATT
>
> Please make this just an 'unsigned' and group it with InlineAsmStart/
> InlineAsmEnd.  You could make the group comment be "Inline Asm
> Directives" or something.
>
Okay.

> Otherwise, the patch looks great.  Please make these changes and
> apply it.
>
Will do! It'll probably be later today/tonight.

> Thanks Bill!
>
Thanks for the review! :-)

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


[llvm-commits] CVS: llvm/include/llvm/PassManagers.h

2007-01-15 Thread Devang Patel


Changes in directory llvm/include/llvm:

PassManagers.h updated: 1.3 -> 1.4
---
Log message:

Code refactoring.


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

 PassManagers.h |8 
 1 files changed, 8 insertions(+)


Index: llvm/include/llvm/PassManagers.h
diff -u llvm/include/llvm/PassManagers.h:1.3 
llvm/include/llvm/PassManagers.h:1.4
--- llvm/include/llvm/PassManagers.h:1.3Mon Jan 15 17:06:56 2007
+++ llvm/include/llvm/PassManagers.hMon Jan 15 20:00:38 2007
@@ -86,6 +86,13 @@
 
 namespace llvm {
 
+/// FunctionPassManager and PassManager, two top level managers, serve 
+/// as the public interface of pass manager infrastructure.
+enum TopLevelManagerType {
+  TLM_Function,  // FunctionPassManager
+  TLM_Pass   // PassManager
+};
+
 
//===--===//
 // PMTopLevelManager
 //
@@ -118,6 +125,7 @@
   /// then return NULL.
   Pass *findAnalysisPass(AnalysisID AID);
 
+  PMTopLevelManager(enum TopLevelManagerType t);
   virtual ~PMTopLevelManager(); 
 
   /// Add immutable pass and initialize it.



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


[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

2007-01-15 Thread Devang Patel


Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.122 -> 1.123
---
Log message:

Code refactoring.


---
Diffs of the changes:  (+21 -18)

 PassManager.cpp |   39 +--
 1 files changed, 21 insertions(+), 18 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.122 
llvm/lib/VMCore/PassManager.cpp:1.123
--- llvm/lib/VMCore/PassManager.cpp:1.122   Mon Jan 15 17:06:56 2007
+++ llvm/lib/VMCore/PassManager.cpp Mon Jan 15 20:00:38 2007
@@ -112,7 +112,8 @@
 public PMTopLevelManager {
 public:
 
-  FunctionPassManagerImpl(int Depth) : PMDataManager(Depth) { }
+  FunctionPassManagerImpl(int Depth) : PMDataManager(Depth),
+   PMTopLevelManager(TLM_Function) { }
 
   /// add - Add a pass to the queue of passes to run.  This passes ownership of
   /// the Pass to the PassManager.  When the PassManager is destroyed, the pass
@@ -151,13 +152,6 @@
   addImmutablePass(IP);
   recordAvailableAnalysis(IP);
 } else {
-  // Assign manager
-  if (activeStack.empty()) {
-FPPassManager *FPP = new FPPassManager(getDepth() + 1);
-FPP->setTopLevelManager(this->getTopLevelManager());
-addPassManager(FPP);
-activeStack.push(FPP);
-  }
   P->assignPassManager(activeStack);
 }
 
@@ -220,7 +214,8 @@
 
 public:
 
-  PassManagerImpl(int Depth) : PMDataManager(Depth) { }
+  PassManagerImpl(int Depth) : PMDataManager(Depth),
+   PMTopLevelManager(TLM_Pass) { }
 
   /// add - Add a pass to the queue of passes to run.  This passes ownership of
   /// the Pass to the PassManager.  When the PassManager is destroyed, the pass
@@ -251,15 +246,6 @@
   addImmutablePass(IP);
   recordAvailableAnalysis(IP);
 } else {
-
-  // Assign manager
-  if (activeStack.empty()) {
-MPPassManager *MPP = new MPPassManager(getDepth() + 1);
-MPP->setTopLevelManager(this->getTopLevelManager());
-addPassManager(MPP);
-activeStack.push(MPP);
-  }
-  
   P->assignPassManager(activeStack);
 }
 
@@ -331,6 +317,23 @@
 
//===--===//
 // PMTopLevelManager implementation
 
+/// Initialize top level manager. Create first pass manager.
+PMTopLevelManager::PMTopLevelManager (enum TopLevelManagerType t) {
+
+  if (t == TLM_Pass) {
+MPPassManager *MPP = new MPPassManager(1);
+MPP->setTopLevelManager(this);
+addPassManager(MPP);
+activeStack.push(MPP);
+  } 
+  else if (t == TLM_Function) {
+FPPassManager *FPP = new FPPassManager(1);
+FPP->setTopLevelManager(this);
+addPassManager(FPP);
+activeStack.push(FPP);
+  } 
+}
+
 /// Set pass P as the last user of the given analysis passes.
 void PMTopLevelManager::setLastUser(std::vector &AnalysisPasses, 
 Pass *P) {



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


[llvm-commits] [llvm-gcc] Potential bug in iasm_extra_clobbers ??

2007-01-15 Thread Reid Spencer
Applites,

While I've been perusing c-common.c, I have found a warning that you
might not be seeing because of compiler differences:

../../src-2/gcc/c-common.c: In function ‘iasm_extra_clobbers’:
../../src-2/gcc/c-common.c:7017: warning: comparison of unsigned expression < 0 
is always false

This comes from this function:

> static void
> iasm_extra_clobbers (const char *opcode, tree *clobbersp)
> {
>   struct iasm_op_clobber db[] = { IASM_EXTRA_CLOBBERS };

Note number of elements of db is 1.

>   struct iasm_op_clobber key;
>   struct iasm_op_clobber *r;
>   const char **clobbers;
>   int num;
> 
> /* APPLE LOCAL LLVM */
> #if defined(TARGET_IASM_EXTRA_CLOBBERS) && defined(ENABLE_CHECKING)
>   /* Ensure that the table is sorted. */
>   static int once;
>   if (once == 0)
> {
>   size_t i;
>   once = 1;
>   for (i=0; i < sizeof (db) / sizeof(db[0]) - 1; ++i)

Are you sure you want to subtract one from the size computation? Perhaps
at one time this was null terminated? In any event (sizeof(db) /
sizeof(db[0])) == 1, which if you subtract 1 from it is causing the
unsigned range warning on the comparison with i.

Not sure if this matters, but thought I'd point it out.

> gcc_assert (iasm_op_clobber_comp (&db[i+1], &db[i]) >= 0);
> }
> #endif
> 

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


[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp

2007-01-15 Thread Bill Wendling


Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.135 -> 1.136
---
Log message:

Fix for PR1095: http://llvm.org/PR1095 :
LLVM would miscompile ASM dialects when compiling for PPC. Added dialects for
the X86 and PPC backends. It defaults to "0", the first variant of a compound
inline asm expression.



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

 AsmPrinter.cpp |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.135 
llvm/lib/CodeGen/AsmPrinter.cpp:1.136
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.135   Sun Jan 14 20:27:26 2007
+++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Jan 15 21:42:04 2007
@@ -698,9 +698,9 @@
   
   O << TAI->getInlineAsmStart() << "\n\t";
 
-  // The variant of the current asmprinter: FIXME: change.
-  int AsmPrinterVariant = 0;
-  
+  // The variant of the current asmprinter.
+  int AsmPrinterVariant = TAI->getAssemblerDialect();
+
   int CurVariant = -1;// The number of the {.|.|.} region we are 
in.
   const char *LastEmitted = AsmStr; // One past the last character emitted.
   



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


[llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll

2007-01-15 Thread Bill Wendling


Changes in directory llvm/test/Regression/CodeGen/PowerPC:

2007-01-15-AsmDialect.ll added (r1.1)
---
Log message:

Fix for PR1095: http://llvm.org/PR1095 :
LLVM would miscompile ASM dialects when compiling for PPC. Added dialects for
the X86 and PPC backends. It defaults to "0", the first variant of a compound
inline asm expression.



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

 2007-01-15-AsmDialect.ll |   26 ++
 1 files changed, 26 insertions(+)


Index: llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll
diff -c /dev/null 
llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll:1.1
*** /dev/null   Mon Jan 15 21:42:14 2007
--- llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll   Mon Jan 
15 21:42:04 2007
***
*** 0 
--- 1,26 
+ ; RUN: llvm-as < %s | llc -march=ppc32 | grep cntlzw
+ 
+ define i32 %foo() {
+ entry:
+   %retval = alloca i32, align 4   ;  [#uses=2]
+   %tmp = alloca i32, align 4  ;  [#uses=2]
+   %ctz_x = alloca i32, align 4;  [#uses=3]
+   %ctz_c = alloca i32, align 4;  [#uses=2]
+   "alloca point" = bitcast i32 0 to i32   ;  [#uses=0]
+   store i32 61440, i32* %ctz_x
+   %tmp = load i32* %ctz_x ;  [#uses=1]
+   %tmp1 = sub i32 0, %tmp ;  [#uses=1]
+   %tmp2 = load i32* %ctz_x;  [#uses=1]
+   %tmp3 = and i32 %tmp1, %tmp2;  [#uses=1]
+   %tmp4 = call i32 asm "$(cntlz$|cntlzw$) $0,$1", 
"=r,r,~{dirflag},~{fpsr},~{flags}"( i32 %tmp3 ) ;  [#uses=1]
+   store i32 %tmp4, i32* %ctz_c
+   %tmp5 = load i32* %ctz_c;  [#uses=1]
+   store i32 %tmp5, i32* %tmp
+   %tmp6 = load i32* %tmp  ;  [#uses=1]
+   store i32 %tmp6, i32* %retval
+   br label %return
+ 
+ return:   ; preds = %entry
+   %retval = load i32* %retval ;  [#uses=1]
+   ret i32 %retval
+ }



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


[llvm-commits] CVS: llvm/lib/Target/TargetAsmInfo.cpp

2007-01-15 Thread Bill Wendling


Changes in directory llvm/lib/Target:

TargetAsmInfo.cpp updated: 1.12 -> 1.13
---
Log message:

Fix for PR1095: http://llvm.org/PR1095 :
LLVM would miscompile ASM dialects when compiling for PPC. Added dialects for
the X86 and PPC backends. It defaults to "0", the first variant of a compound
inline asm expression.



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

 TargetAsmInfo.cpp |1 +
 1 files changed, 1 insertion(+)


Index: llvm/lib/Target/TargetAsmInfo.cpp
diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.12 
llvm/lib/Target/TargetAsmInfo.cpp:1.13
--- llvm/lib/Target/TargetAsmInfo.cpp:1.12  Sun Jan 14 00:27:21 2007
+++ llvm/lib/Target/TargetAsmInfo.cpp   Mon Jan 15 21:42:04 2007
@@ -32,6 +32,7 @@
   FunctionAddrSuffix(""),
   InlineAsmStart("#APP"),
   InlineAsmEnd("#NO_APP"),
+  AssemblerDialect(0),
   ZeroDirective("\t.zero\t"),
   ZeroDirectiveSuffix(0),
   AsciiDirective("\t.ascii\t"),



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


[llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h

2007-01-15 Thread Bill Wendling


Changes in directory llvm/include/llvm/Target:

TargetAsmInfo.h updated: 1.19 -> 1.20
---
Log message:

Fix for PR1095: http://llvm.org/PR1095 :
LLVM would miscompile ASM dialects when compiling for PPC. Added dialects for
the X86 and PPC backends. It defaults to "0", the first variant of a compound
inline asm expression.



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

 TargetAsmInfo.h |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/Target/TargetAsmInfo.h
diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.19 
llvm/include/llvm/Target/TargetAsmInfo.h:1.20
--- llvm/include/llvm/Target/TargetAsmInfo.h:1.19   Sun Jan 14 00:27:21 2007
+++ llvm/include/llvm/Target/TargetAsmInfo.hMon Jan 15 21:42:04 2007
@@ -89,7 +89,10 @@
 /// emit before and after an inline assembly statement.
 const char *InlineAsmStart;   // Defaults to "#APP\n"
 const char *InlineAsmEnd; // Defaults to "#NO_APP\n"
-
+
+/// AssemblerDialect - Which dialect of an assembler variant to use.
+unsigned AssemblerDialect;// Defaults to 0
+
 //===--- Data Emission Directives 
-===//
 
 /// ZeroDirective - this should be set to the directive used to get some
@@ -128,7 +131,7 @@
 /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte
 /// boundary.
 bool AlignmentIsInBytes;  // Defaults to true
-
+
 //===--- Section Switching Directives 
-===//
 
 /// SwitchToSectionDirective - This is the directive used when we want to
@@ -343,6 +346,9 @@
 const char *getInlineAsmEnd() const {
   return InlineAsmEnd;
 }
+unsigned getAssemblerDialect() const {
+  return AssemblerDialect;
+}
 const char *getZeroDirective() const {
   return ZeroDirective;
 }



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


[llvm-commits] CVS: llvm/lib/Target/X86/X86TargetAsmInfo.cpp X86TargetAsmInfo.h

2007-01-15 Thread Bill Wendling


Changes in directory llvm/lib/Target/X86:

X86TargetAsmInfo.cpp updated: 1.25 -> 1.26
X86TargetAsmInfo.h updated: 1.3 -> 1.4
---
Log message:

Fix for PR1095: http://llvm.org/PR1095 :
LLVM would miscompile ASM dialects when compiling for PPC. Added dialects for
the X86 and PPC backends. It defaults to "0", the first variant of a compound
inline asm expression.



---
Diffs of the changes:  (+8 -1)

 X86TargetAsmInfo.cpp |7 +++
 X86TargetAsmInfo.h   |2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.25 
llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.26
--- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.25   Sun Jan 14 20:27:26 2007
+++ llvm/lib/Target/X86/X86TargetAsmInfo.cppMon Jan 15 21:42:04 2007
@@ -21,6 +21,12 @@
 #include "llvm/ADT/StringExtras.h"
 using namespace llvm;
 
+// ASM variant to use.
+enum {
+  X86_ATT   = 0,
+  X86_INTEL = 1
+};
+
 static const char* x86_asm_table[] = {"{si}", "S",
   "{di}", "D",
   "{ax}", "a",
@@ -38,6 +44,7 @@
   // FIXME - Should be simplified.
 
   AsmTransCBE = x86_asm_table;
+  AssemblerDialect = X86_ATT;
   
   switch (Subtarget->TargetType) {
   case X86Subtarget::isDarwin:


Index: llvm/lib/Target/X86/X86TargetAsmInfo.h
diff -u llvm/lib/Target/X86/X86TargetAsmInfo.h:1.3 
llvm/lib/Target/X86/X86TargetAsmInfo.h:1.4
--- llvm/lib/Target/X86/X86TargetAsmInfo.h:1.3  Tue Nov 28 19:14:06 2006
+++ llvm/lib/Target/X86/X86TargetAsmInfo.h  Mon Jan 15 21:42:04 2007
@@ -17,7 +17,7 @@
 #include "llvm/Target/TargetAsmInfo.h"
 
 namespace llvm {
-  
+
   // Forward declaration.
   class X86TargetMachine;
 



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


[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp

2007-01-15 Thread Bill Wendling


Changes in directory llvm/lib/Target/PowerPC:

PPCTargetAsmInfo.cpp updated: 1.11 -> 1.12
---
Log message:

Fix for PR1095: http://llvm.org/PR1095 :
LLVM would miscompile ASM dialects when compiling for PPC. Added dialects for
the X86 and PPC backends. It defaults to "0", the first variant of a compound
inline asm expression.



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

 PPCTargetAsmInfo.cpp |8 
 1 files changed, 8 insertions(+)


Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.11 
llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.12
--- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.11   Sun Jan 14 00:37:54 2007
+++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cppMon Jan 15 21:42:04 2007
@@ -16,6 +16,12 @@
 #include "llvm/Function.h"
 using namespace llvm;
 
+// ASM variant to use.
+enum {
+  PPC_OLD_MNEMONICS = 0,
+  PPC_NEW_MNEMONICS = 1
+};
+
 PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) {
   bool isPPC64 = TM.getSubtargetImpl()->isPPC64();
   
@@ -26,6 +32,7 @@
   LCOMMDirective = "\t.lcomm\t";
   InlineAsmStart = "# InlineAsm Start";
   InlineAsmEnd = "# InlineAsm End";
+  AssemblerDialect = PPC_OLD_MNEMONICS;
   
   NeedsSet = true;
   AddressSize = isPPC64 ? 8 : 4;
@@ -56,6 +63,7 @@
   UsedDirective = "\t.no_dead_strip\t";
   WeakRefDirective = "\t.weak_reference\t";
   HiddenDirective = "\t.private_extern\t";
+  AssemblerDialect = PPC_NEW_MNEMONICS;
 }
 
 LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM)



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


[llvm-commits] CVS: llvm/lib/Target/X86/X86TargetAsmInfo.cpp

2007-01-15 Thread Bill Wendling


Changes in directory llvm/lib/Target/X86:

X86TargetAsmInfo.cpp updated: 1.26 -> 1.27
---
Log message:

Make inline ASM the INTEL one if it's in that emission mode.


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

 X86TargetAsmInfo.cpp |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.26 
llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.27
--- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.26   Mon Jan 15 21:42:04 2007
+++ llvm/lib/Target/X86/X86TargetAsmInfo.cppMon Jan 15 22:13:03 2007
@@ -137,12 +137,12 @@
 DwarfRangesSection =  "\t.section\t.debug_ranges,\"dr\"";
 DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"dr\"";
 break;
-
-break;
+
   case X86Subtarget::isWindows:
 GlobalPrefix = "_";
 HasDotTypeDotSizeDirective = false;
 break;
+
   default: break;
   }
   
@@ -169,6 +169,8 @@
 TextSectionStartSuffix = "\tsegment 'CODE'";
 DataSectionStartSuffix = "\tsegment 'DATA'";
 SectionEndDirectiveSuffix = "\tends\n";
+
+AssemblerDialect = X86_INTEL;
   }
 }
 



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


[llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll

2007-01-15 Thread Bill Wendling


Changes in directory llvm/test/Regression/CodeGen/PowerPC:

2007-01-15-AsmDialect.ll updated: 1.1 -> 1.2
---
Log message:

Added a -mtriple flag to force darwin backend.


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

 2007-01-15-AsmDialect.ll |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll
diff -u llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll:1.1 
llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll:1.2
--- llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll:1.1   Mon Jan 
15 21:42:04 2007
+++ llvm/test/Regression/CodeGen/PowerPC/2007-01-15-AsmDialect.ll   Mon Jan 
15 22:15:20 2007
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=ppc32 | grep cntlzw
+; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 
cntlzw
 
 define i32 %foo() {
 entry:



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


[llvm-commits] [llvm-gcc] BITWIDTH.patch (for review only)

2007-01-15 Thread Reid Spencer
Here's a patch to give llvm-gcc the ability to specify arbitrary bit
widths with a new "bitwidth" attribute. The attribute is used like this:

int __attribute__((bitwidth(17)));

int __attribute__((bitwidth(23))) My32BitInt;

struct MyStruct {
  int __attribute__((bitwidth(5))) My5BitField;
  My32BitInt My32BitField;
};

void func(int __attribute__((bitwidth(23))) ) {...}

etc.

Note that no LLVM backend can currently handle this. I will be working
on making either the CBackEnd or LLI handle these correctly. Other
targets may or may not get implemented.

This patch has not been tested well (just Dejagnu) so please do not
apply it.

Reid.

Index: gcc/tree.h
===
--- gcc/tree.h	(revision 248)
+++ gcc/tree.h	(working copy)
@@ -1711,6 +1711,12 @@
 #define TYPE_CONTAINS_PLACEHOLDER_INTERNAL(NODE) \
   (TYPE_CHECK (NODE)->type.contains_placeholder_bits)
 
+/* APPLE LOCAL begin LLVM bit accurate integer types - ras */
+/* 1 if the bitwidth for this type was requested by "bitwidth" attribute,
+   0 if it is the default for this type.  */
+#define TYPE_USER_BITWIDTH(NODE) (TYPE_CHECK (NODE)->type.user_bitwidth)
+/* APPLE LOCAL end LLVM bit accurate integer types - ras */
+
 struct die_struct;
 
 struct tree_type GTY(())
@@ -1722,7 +1728,7 @@
   tree attributes;
   unsigned int uid;
 
-  unsigned int precision : 9;
+  unsigned int precision : 16;
   ENUM_BITFIELD(machine_mode) mode : 7;
 
   unsigned string_flag : 1;
@@ -1741,6 +1747,8 @@
   unsigned lang_flag_5 : 1;
   unsigned lang_flag_6 : 1;
   unsigned user_align : 1;
+  /* APPLE LOCAL LLVM bit accurate integer types - ras */
+  unsigned user_bitwidth : 1;
 
   unsigned int align;
   tree pointer_to;
@@ -2431,6 +2439,12 @@
 #define DECL_GIMPLE_FORMAL_TEMP_P(DECL) \
   DECL_CHECK (DECL)->decl.gimple_formal_temp
 
+/* APPLE LOCAL begin LLVM bit accurate integer types - ras */
+/* 1 if a bitwidth for this type was requested by "bitwidth" attribute,
+   0 if it is the default for this type.  */
+#define DECL_USER_BITWIDTH(NODE) (DECL_CHECK (NODE)->decl.user_bitwidth)
+/* APPLE LOCAL end LLVM bit accurate integer types - ras */
+
 /* Enumerate visibility settings.  */
 #ifndef SYMBOL_VISIBILITY_DEFINED
 #define SYMBOL_VISIBILITY_DEFINED
@@ -2510,6 +2524,9 @@
   unsigned iasm_dont_promote_to_static : 1;
   unsigned int iasm_frame_size;
   /* APPLE LOCAL end CW asm blocks */
+  /* APPLE LOCAL begin LLVM bit accurate integer types - ras */
+  unsigned int user_bitwidth : 1;
+  /* APPLE LOCAL end LLVM bit accurate integer types - ras */
 
   union tree_decl_u1 {
 /* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is
Index: gcc/llvm-types.cpp
===
--- gcc/llvm-types.cpp	(revision 248)
+++ gcc/llvm-types.cpp	(working copy)
@@ -62,24 +62,15 @@
 //   Type Conversion Utilities
 //===--===//
 
-static inline const Type *getIntegerType(unsigned Bits, bool isUnsigned) {
-  switch (Bits*2+isUnsigned) {
-  default: assert(0 && "Unknown integral type size!");
-  case   8*2+0: return Type::Int8Ty;
-  case   8*2+1: return Type::Int8Ty;
-  case  16*2+0: return Type::Int16Ty;
-  case  16*2+1: return Type::Int16Ty;
-  case  32*2+0: return Type::Int32Ty;
-  case  32*2+1: return Type::Int32Ty;
-  case  64*2+0: return Type::Int64Ty;
-  case  64*2+1: return Type::Int64Ty;
-  case 128*2+0:
-  case 128*2+1:
+static inline const Type *getIntegerType(unsigned Bits) {
+  if (Bits > 64) {
 static bool Warned = false;
-if (!Warned) fprintf(stderr, "WARNING: 128-bit integers not supported!\n");
+if (!Warned) fprintf(stderr, 
+ "WARNING: integers > 64 bits not supported yet!\n");
 Warned = true;
-return isUnsigned ? Type::Int64Ty : Type::Int64Ty;
+return Type::Int64Ty;
   }
+  return IntegerType::get(Bits);
 }
 
 // isPassedByInvisibleReference - Return true if an argument of the specified
@@ -292,7 +283,7 @@
 else { // Bools on some platforms take more space than LLVM bool (e.g. PPC).
   if (const Type *Ty = GET_TYPE_LLVM(type))
 return Ty;
-  const Type *Ty = getIntegerType(TREE_INT_CST_LOW(TYPE_SIZE(type)), true);
+  const Type *Ty = getIntegerType(TYPE_PRECISION(type));
   return SET_TYPE_LLVM(type, Ty);
 }
   case ENUMERAL_TYPE:
@@ -309,8 +300,7 @@
 // FALL THROUGH.
   case INTEGER_TYPE:
 if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty;
-return SET_TYPE_LLVM(type, getIntegerType(TREE_INT_CST_LOW(TYPE_SIZE(type)),
-  TYPE_UNSIGNED(type)));
+return SET_TYPE_LLVM(type, getIntegerType(TYPE_PRECISION(type)));
   case REAL_TYPE:
 if (const Type *Ty = GET_TYPE_LLVM(type)) return Ty;
 switch (TYPE_PRECISION(type)) {
Index: gcc/c-common.c
===
--- gcc/c-common.c	(revisio

[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2007-01-15 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.265 -> 1.266
---
Log message:

add options to view the dags before the first or second pass of dag combine.


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

 DAGCombiner.cpp |   18 ++
 1 files changed, 18 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.265 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.266
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.265 Mon Jan  8 17:04:05 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Mon Jan 15 22:55:25 2007
@@ -46,6 +46,20 @@
 STATISTIC(PostIndexedNodes, "Number of post-indexed nodes created");
 
 namespace {
+#ifndef NDEBUG
+  static cl::opt
+ViewDAGCombine1("view-dag-combine1-dags", cl::Hidden,
+cl::desc("Pop up a window to show dags before the first "
+ "dag combine pass"));
+  static cl::opt
+ViewDAGCombine2("view-dag-combine2-dags", cl::Hidden,
+cl::desc("Pop up a window to show dags before the second "
+ "dag combine pass"));
+#else
+  static const bool ViewDAGCombine1 = false;
+  static const bool ViewDAGCombine2 = false;
+#endif
+  
   static cl::opt
 CombinerAA("combiner-alias-analysis", cl::Hidden,
cl::desc("Turn on alias analysis during testing"));
@@ -4512,6 +4526,10 @@
 // SelectionDAG::Combine - This is the entry point for the file.
 //
 void SelectionDAG::Combine(bool RunningAfterLegalize, AliasAnalysis &AA) {
+  if (!RunningAfterLegalize && ViewDAGCombine1)
+viewGraph();
+  if (RunningAfterLegalize && ViewDAGCombine2)
+viewGraph();
   /// run - This is the main entry point to this class.
   ///
   DAGCombiner(*this, AA).Run(RunningAfterLegalize);



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


[llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2007-01-15-LoadSelectCycle.ll

2007-01-15 Thread Chris Lattner


Changes in directory llvm/test/Regression/CodeGen/Generic:

2007-01-15-LoadSelectCycle.ll added (r1.1)
---
Log message:

new testcase for PR1114: http://llvm.org/PR1114 


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

 2007-01-15-LoadSelectCycle.ll |   12 
 1 files changed, 12 insertions(+)


Index: llvm/test/Regression/CodeGen/Generic/2007-01-15-LoadSelectCycle.ll
diff -c /dev/null 
llvm/test/Regression/CodeGen/Generic/2007-01-15-LoadSelectCycle.ll:1.1
*** /dev/null   Mon Jan 15 23:59:00 2007
--- llvm/test/Regression/CodeGen/Generic/2007-01-15-LoadSelectCycle.ll  Mon Jan 
15 23:58:50 2007
***
*** 0 
--- 1,12 
+ ; RUN: llvm-as < %s | llc
+ ; PR1114
+ 
+ declare i1 %foo()
+ 
+ define i32 %test(i32* %A, i32* %B) {
+   %a = load i32* %A
+   %b = load i32* %B
+   %cond = call i1 %foo()
+   %c = select i1 %cond, i32 %a, i32 %b
+   ret i32 %c
+ }



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


[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2007-01-15 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.266 -> 1.267
---
Log message:

Fix PR1114: http://llvm.org/PR1114  and 
CodeGen/Generic/2007-01-15-LoadSelectCycle.ll by being
careful when folding "c ? load p : load q" that C doesn't reach either load.
If so, folding this into load (c ? p : q) will induce a cycle in the graph.


---
Diffs of the changes:  (+41 -25)

 DAGCombiner.cpp |   66 ++--
 1 files changed, 41 insertions(+), 25 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.266 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.267
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.266 Mon Jan 15 22:55:25 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Mon Jan 15 23:59:59 2007
@@ -3709,36 +3709,52 @@
 // the right thing to do, but nothing uses srcvalues now.  When they 
do,
 // turn SrcValue into a list of locations.
 SDOperand Addr;
-if (TheSelect->getOpcode() == ISD::SELECT)
-  Addr = DAG.getNode(ISD::SELECT, LLD->getBasePtr().getValueType(),
- TheSelect->getOperand(0), LLD->getBasePtr(),
- RLD->getBasePtr());
-else
-  Addr = DAG.getNode(ISD::SELECT_CC, LLD->getBasePtr().getValueType(),
+if (TheSelect->getOpcode() == ISD::SELECT) {
+  // Check that the condition doesn't reach either load.  If so, 
folding
+  // this will induce a cycle into the DAG.
+  if (!LLD->isPredecessor(TheSelect->getOperand(0).Val) &&
+  !RLD->isPredecessor(TheSelect->getOperand(0).Val)) {
+Addr = DAG.getNode(ISD::SELECT, LLD->getBasePtr().getValueType(),
+   TheSelect->getOperand(0), LLD->getBasePtr(),
+   RLD->getBasePtr());
+  }
+} else {
+  // Check that the condition doesn't reach either load.  If so, 
folding
+  // this will induce a cycle into the DAG.
+  if (!LLD->isPredecessor(TheSelect->getOperand(0).Val) &&
+  !RLD->isPredecessor(TheSelect->getOperand(0).Val) &&
+  !LLD->isPredecessor(TheSelect->getOperand(1).Val) &&
+  !RLD->isPredecessor(TheSelect->getOperand(1).Val)) {
+Addr = DAG.getNode(ISD::SELECT_CC, 
LLD->getBasePtr().getValueType(),
  TheSelect->getOperand(0),
  TheSelect->getOperand(1), 
  LLD->getBasePtr(), RLD->getBasePtr(),
  TheSelect->getOperand(4));
-  
-SDOperand Load;
-if (LLD->getExtensionType() == ISD::NON_EXTLOAD)
-  Load = DAG.getLoad(TheSelect->getValueType(0), LLD->getChain(),
- Addr,LLD->getSrcValue(), 
LLD->getSrcValueOffset());
-else {
-  Load = DAG.getExtLoad(LLD->getExtensionType(),
-TheSelect->getValueType(0),
-LLD->getChain(), Addr, LLD->getSrcValue(),
-LLD->getSrcValueOffset(),
-LLD->getLoadedVT());
+  }
+}
+
+if (Addr.Val) {
+  SDOperand Load;
+  if (LLD->getExtensionType() == ISD::NON_EXTLOAD)
+Load = DAG.getLoad(TheSelect->getValueType(0), LLD->getChain(),
+   Addr,LLD->getSrcValue(), 
+   LLD->getSrcValueOffset());
+  else {
+Load = DAG.getExtLoad(LLD->getExtensionType(),
+  TheSelect->getValueType(0),
+  LLD->getChain(), Addr, LLD->getSrcValue(),
+  LLD->getSrcValueOffset(),
+  LLD->getLoadedVT());
+  }
+  // Users of the select now use the result of the load.
+  CombineTo(TheSelect, Load);
+
+  // Users of the old loads now use the new load's chain.  We know the
+  // old-load value is dead now.
+  CombineTo(LHS.Val, Load.getValue(0), Load.getValue(1));
+  CombineTo(RHS.Val, Load.getValue(0), Load.getValue(1));
+  return true;
 }
-// Users of the select now use the result of the load.
-CombineTo(TheSelect, Load);
-  
-// Users of the old loads now use the new load's chain.  We know the
-// old-load value is dead now.
-CombineTo(LHS.Val, Load.getValue(0), Load.getValue(1));
-CombineTo(RHS.Val, Load.getValue(0), Load.getValue(1));
-return true;
   }
 }
   }



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


[llvm-commits] CVS: llvm/lib/Target/README.txt

2007-01-15 Thread Chris Lattner


Changes in directory llvm/lib/Target:

README.txt updated: 1.53 -> 1.54
---
Log message:

add a note: we need whole-function selectiondags :)


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

 README.txt |   28 
 1 files changed, 28 insertions(+)


Index: llvm/lib/Target/README.txt
diff -u llvm/lib/Target/README.txt:1.53 llvm/lib/Target/README.txt:1.54
--- llvm/lib/Target/README.txt:1.53 Sat Dec 23 00:05:41 2006
+++ llvm/lib/Target/README.txt  Tue Jan 16 00:39:48 2007
@@ -387,3 +387,31 @@
 to enable further optimizations.
 
 //===-===//
+
+Consider:
+
+typedef unsigned U32;
+typedef unsigned long long U64;
+int test (U32 *inst, U64 *regs) {
+U64 effective_addr2;
+U32 temp = *inst;
+int r1 = (temp >> 20) & 0xf;
+int b2 = (temp >> 16) & 0xf;
+effective_addr2 = temp & 0xfff;
+if (b2) effective_addr2 += regs[b2];
+b2 = (temp >> 12) & 0xf;
+if (b2) effective_addr2 += regs[b2];
+effective_addr2 &= regs[4];
+ if ((effective_addr2 & 3) == 0)
+return 1;
+return 0;
+}
+
+Note that only the low 2 bits of effective_addr2 are used.  On 32-bit systems,
+we don't eliminate the computation of the top half of effective_addr2 because
+we don't have whole-function selection dags.  On x86, this means we use one
+extra register for the function when effective_addr2 is declared as U64 than
+when it is declared U32.
+
+//===-===//
+



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


[llvm-commits] [patch] PR918

2007-01-15 Thread Gordon Henriksen
The attached patch fixes http://llvm.org/PR918 by preventing the C  
backend from emitting the problematic array typedefs. There's also a  
regression test.


— Gordon



PR918.tar.gz
Description: GNU Zip compressed data
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/test/Regression/CodeGen/CBackend/2007-01-15-NamedArrayType.ll

2007-01-15 Thread Chris Lattner


Changes in directory llvm/test/Regression/CodeGen/CBackend:

2007-01-15-NamedArrayType.ll added (r1.1)
---
Log message:

testcase for PR918: http://llvm.org/PR918 


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

 2007-01-15-NamedArrayType.ll |   11 +++
 1 files changed, 11 insertions(+)


Index: llvm/test/Regression/CodeGen/CBackend/2007-01-15-NamedArrayType.ll
diff -c /dev/null 
llvm/test/Regression/CodeGen/CBackend/2007-01-15-NamedArrayType.ll:1.1
*** /dev/null   Tue Jan 16 01:21:38 2007
--- llvm/test/Regression/CodeGen/CBackend/2007-01-15-NamedArrayType.ll  Tue Jan 
16 01:21:28 2007
***
*** 0 
--- 1,11 
+ ; RUN: llvm-as < %s | llc -march=c | not grep fixarray_array3
+ ; PR918
+ 
+ %structtype_s = type { i32 }
+ %fixarray_array3 = type [3 x %structtype_s]
+ 
+ define i32 %witness(%fixarray_array3* %p) {
+ %q = getelementptr %fixarray_array3* %p, i32 0, i32 0, i32 0
+ %v = load i32* %q
+ ret i32 %v
+ }



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


[llvm-commits] CVS: llvm/lib/Target/CBackend/CBackend.cpp

2007-01-15 Thread Chris Lattner


Changes in directory llvm/lib/Target/CBackend:

CBackend.cpp updated: 1.317 -> 1.318
---
Log message:

Fix PR918: http://llvm.org/PR918  by only using typedefs to name struct types.  
This makes the later
type ordering stuff work better.  This fixes PR918: http://llvm.org/PR918  and 
CodeGen/CBackend/2007-01-15-NamedArrayType.ll

Patch by Gordon Henriksen.



---
Diffs of the changes:  (+15 -8)

 CBackend.cpp |   23 +++
 1 files changed, 15 insertions(+), 8 deletions(-)


Index: llvm/lib/Target/CBackend/CBackend.cpp
diff -u llvm/lib/Target/CBackend/CBackend.cpp:1.317 
llvm/lib/Target/CBackend/CBackend.cpp:1.318
--- llvm/lib/Target/CBackend/CBackend.cpp:1.317 Sun Jan 14 20:27:26 2007
+++ llvm/lib/Target/CBackend/CBackend.cpp   Tue Jan 16 01:22:23 2007
@@ -269,13 +269,19 @@
   for (TypeSymbolTable::iterator TI = TST.begin(), TE = TST.end();
TI != TE; ) {
 TypeSymbolTable::iterator I = TI++;
-
-// If this is not used, remove it from the symbol table.
-std::set::iterator UTI = UT.find(I->second);
-if (UTI == UT.end())
+
+// If this isn't a struct type, remove it from our set of types to name.
+// This simplifies emission later.
+if (!isa(I->second)) {
   TST.remove(I);
-else
-  UT.erase(UTI);// Only keep one name for this type.
+} else {
+  // If this is not used, remove it from the symbol table.
+  std::set::iterator UTI = UT.find(I->second);
+  if (UTI == UT.end())
+TST.remove(I);
+  else
+UT.erase(UTI);// Only keep one name for this type.
+}
   }
 
   // UT now contains types that are not named.  Loop over it, naming
@@ -1694,10 +1700,11 @@
 
   Out << '\n';
 
-  // Now we can print out typedefs...
+  // Now we can print out typedefs.  Above, we guaranteed that this can only be
+  // for struct types.
   Out << "/* Typedefs */\n";
   for (I = TST.begin(); I != End; ++I) {
-const Type *Ty = cast(I->second);
+const StructType *Ty = cast(I->second);
 std::string Name = "l_" + Mang->makeNameProper(I->first);
 Out << "typedef ";
 printType(Out, Ty, false, Name);



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