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

2006-03-01 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.35 -> 1.36
MachineDebugInfo.cpp updated: 1.19 -> 1.20
---
Log message:

Basic array support.


---
Diffs of the changes:  (+197 -10)

 DwarfWriter.cpp  |   73 +--
 MachineDebugInfo.cpp |  134 +--
 2 files changed, 197 insertions(+), 10 deletions(-)


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.35 
llvm/lib/CodeGen/DwarfWriter.cpp:1.36
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.35   Tue Feb 28 14:15:07 2006
+++ llvm/lib/CodeGen/DwarfWriter.cppWed Mar  1 11:53:02 2006
@@ -1072,12 +1072,12 @@
 // Determine which derived type.
 unsigned T = 0;
 switch (DerivedTy->getTag()) {
-case DI_TAG_typedef:   T = DW_TAG_typedef;break;
-case DI_TAG_pointer:   T = DW_TAG_pointer_type;   break;
-case DI_TAG_reference: T = DW_TAG_reference_type; break;
-case DI_TAG_const: T = DW_TAG_const_type; break;
-case DI_TAG_volatile:  T = DW_TAG_volatile_type;  break;
-case DI_TAG_restrict:  T = DW_TAG_restrict_type;  break;
+case DI_TAG_typedef:   T = DW_TAG_typedef; break;
+case DI_TAG_pointer:   T = DW_TAG_pointer_type;break;
+case DI_TAG_reference: T = DW_TAG_reference_type;  break;
+case DI_TAG_const: T = DW_TAG_const_type;  break;
+case DI_TAG_volatile:  T = DW_TAG_volatile_type;   break;
+case DI_TAG_restrict:  T = DW_TAG_restrict_type;   break;
 default: assert( 0 && "Unknown tag on derived type");
 }
 
@@ -1088,6 +1088,67 @@
 if (TypeDesc *FromTy = DerivedTy->getFromType()) {
Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4, NewType(Unit, FromTy));
 }
+  } else if (CompositeTypeDesc *CompTy = dyn_cast(TyDesc)) {
+// Determine which composite type.
+unsigned T = 0;
+switch (CompTy->getTag()) {
+case DI_TAG_array: T = DW_TAG_array_type;   break;
+case DI_TAG_struct:T = DW_TAG_structure_type;   break;
+case DI_TAG_union: T = DW_TAG_union_type;   break;
+case DI_TAG_enum:  T = DW_TAG_enumeration_type; break;
+default: assert( 0 && "Unknown tag on composite type");
+}
+
+// Create specific DIE.
+Slot = Ty = new DIE(T);
+std::vector &Elements = CompTy->getElements();
+
+switch (CompTy->getTag()) {
+case DI_TAG_array: {
+  // Add element type.
+  if (TypeDesc *FromTy = CompTy->getFromType()) {
+ Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4, NewType(Unit, FromTy));
+  }
+  // Don't emit size attribute.
+  Size = 0;
+  
+  // Construct an anonymous type for index type.
+  DIE *IndexTy = new DIE(DW_TAG_base_type);
+  IndexTy->AddUInt(DW_AT_byte_size, 0, 4);
+  IndexTy->AddUInt(DW_AT_encoding, DW_FORM_data1, DW_ATE_signed);
+  // Add to context.
+  Unit->getDie()->AddChild(IndexTy);
+
+  // Add subranges to array type.
+  for(unsigned i = 0, N = Elements.size(); i < N; ++i) {
+SubrangeDesc *SRD = cast(Elements[i]);
+int64_t Lo = SRD->getLo();
+int64_t Hi = SRD->getHi();
+DIE *Subrange = new DIE(DW_TAG_subrange_type);
+
+// If a range is available.
+if (Lo != Hi) {
+  Subrange->AddDIEntry(DW_AT_type, DW_FORM_ref4, IndexTy);
+  // Only add low if non-zero.
+  if (Lo) Subrange->AddUInt(DW_AT_lower_bound, 0, Lo);
+  Subrange->AddUInt(DW_AT_upper_bound, 0, Hi);
+}
+Ty->AddChild(Subrange);
+  }
+  
+  break;
+}
+case DI_TAG_struct: {
+  break;
+}
+case DI_TAG_union: {
+  break;
+}
+case DI_TAG_enum: {
+  break;
+}
+default: break;
+}
   }
   
   assert(Ty && "Type not supported yet");


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.19 
llvm/lib/CodeGen/MachineDebugInfo.cpp:1.20
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.19  Tue Feb 28 14:15:07 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp   Wed Mar  1 11:53:02 2006
@@ -197,6 +197,7 @@
   ///
   virtual void Apply(int &Field) { ++Count; }
   virtual void Apply(unsigned &Field){ ++Count; }
+  virtual void Apply(int64_t &Field) { ++Count; }
   virtual void Apply(uint64_t &Field){ ++Count; }
   virtual void Apply(bool &Field){ ++Count; }
   virtual void Apply(std::string &Field) { ++Count; }
@@ -234,6 +235,10 @@
 Constant *C = CI->getOperand(I++);
 Field = cast(C)->getValue();
   }
+  virtual void Apply(int64_t &Field) {
+Constant *C = CI->getOperand(I++);
+Field = cast(C)->getValue();
+  }
   virtual void Apply(uint64_t &Field) {
 Constant *C = CI->getOperand(I++);
 Field = cast(C)->getValue();
@@ -290,6 +295,9 @@
   virtual void Apply(unsigned &Field) {
 Elements.push_back(ConstantUInt::get(Type::UIntTy, Field));
   }
+  virtual void Apply(int64_t &Field) {

[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h

2006-03-01 Thread Jim Laskey


Changes in directory llvm/include/llvm/CodeGen:

MachineDebugInfo.h updated: 1.22 -> 1.23
---
Log message:

Basic array support.


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

 MachineDebugInfo.h |  120 ++---
 1 files changed, 114 insertions(+), 6 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h
diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.22 
llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.23
--- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.22   Tue Feb 28 14:15:07 2006
+++ llvm/include/llvm/CodeGen/MachineDebugInfo.hWed Mar  1 11:53:02 2006
@@ -67,6 +67,11 @@
   DI_TAG_typedef,
   DI_TAG_pointer,
   DI_TAG_reference,
+  DI_TAG_array,
+  DI_TAG_struct,
+  DI_TAG_union,
+  DI_TAG_enum,
+  DI_TAG_subrange,
   DI_TAG_const,
   DI_TAG_volatile,
   DI_TAG_restrict
@@ -88,6 +93,7 @@
   /// appropriate action for the type of field.
   virtual void Apply(int &Field) = 0;
   virtual void Apply(unsigned &Field) = 0;
+  virtual void Apply(int64_t &Field) = 0;
   virtual void Apply(uint64_t &Field) = 0;
   virtual void Apply(bool &Field) = 0;
   virtual void Apply(std::string &Field) = 0;
@@ -130,7 +136,7 @@
   // Subclasses should supply the following static methods.
   
   // Implement isa/cast/dyncast.
-  static bool classof(const DebugInfoDesc *)  { return true; }
+  static bool classof(const DebugInfoDesc *) { return true; }
   
   
//======//
   // Subclasses should supply the following virtual methods.
@@ -341,7 +347,7 @@
   void setEncoding(unsigned E) { Encoding = E; }
 
   // Implement isa/cast/dyncast.
-  static bool classof(const BasicTypeDesc *)  { return true; }
+  static bool classof(const BasicTypeDesc *) { return true; }
   static bool classof(const DebugInfoDesc *D) {
 return D->getTag() == DI_TAG_basictype;
   }
@@ -350,6 +356,14 @@
   ///
   virtual void ApplyToFields(DIVisitor *Visitor);
 
+  /// getDescString - Return a string used to compose global names and labels.
+  ///
+  virtual const char *getDescString() const;
+
+  /// getTypeString - Return a string used to label this descriptor's type.
+  ///
+  virtual const char *getTypeString() const;
+
 #ifndef NDEBUG
   virtual void dump();
 #endif
@@ -371,7 +385,7 @@
   void setFromType(TypeDesc *F){ FromType = F; }
 
   // Implement isa/cast/dyncast.
-  static bool classof(const DerivedTypeDesc *)  { return true; }
+  static bool classof(const DerivedTypeDesc *) { return true; }
   static bool classof(const DebugInfoDesc *D) {
 unsigned T =  D->getTag();
 switch (T) {
@@ -382,14 +396,108 @@
 case DI_TAG_volatile:
 case DI_TAG_restrict:
   return true;
-default: return false;
+default: break;
 }
+return false;
   }
   
   /// ApplyToFields - Target the visitor to the fields of the  DerivedTypeDesc.
   ///
   virtual void ApplyToFields(DIVisitor *Visitor);
 
+  /// getDescString - Return a string used to compose global names and labels.
+  ///
+  virtual const char *getDescString() const;
+
+  /// getTypeString - Return a string used to label this descriptor's type.
+  ///
+  virtual const char *getTypeString() const;
+
+#ifndef NDEBUG
+  virtual void dump();
+#endif
+};
+
+//===--===//
+/// CompositeTypeDesc - This class packages debug information associated with a
+/// array/struct types (eg., arrays, struct, union, enums.)
+class CompositeTypeDesc : public DerivedTypeDesc {
+private:
+  std::vector Elements;// Information used to compose type.
+
+public:
+  CompositeTypeDesc(unsigned T);
+  
+  // Accessors
+  std::vector &getElements() { return Elements; }
+
+  // Implement isa/cast/dyncast.
+  static bool classof(const CompositeTypeDesc *) { return true; }
+  static bool classof(const DebugInfoDesc *D) {
+unsigned T =  D->getTag();
+switch (T) {
+case DI_TAG_array:
+case DI_TAG_struct:
+case DI_TAG_union:
+case DI_TAG_enum:
+  return true;
+default: break;
+}
+return false;
+  }
+  
+  /// ApplyToFields - Target the visitor to the fields of the 
CompositeTypeDesc.
+  ///
+  virtual void ApplyToFields(DIVisitor *Visitor);
+
+  /// getDescString - Return a string used to compose global names and labels.
+  ///
+  virtual const char *getDescString() const;
+
+  /// getTypeString - Return a string used to label this descriptor's type.
+  ///
+  virtual const char *getTypeString() const;
+
+#ifndef NDEBUG
+  virtual void dump();
+#endif
+};
+
+//===--===//
+/// SubrangeDesc - This class packages debug information associated with 
integer
+/// value ranges.
+class SubrangeDesc : public DebugInfoDesc {
+private:
+  int64_t Lo;   // Low value of range
+  int64_t Hi;   // High value of range
+
+public:
+  S

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

2006-03-01 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.37 -> 1.38
---
Log message:

Use context and not compile unit.


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

 DwarfWriter.cpp |   24 +---
 1 files changed, 13 insertions(+), 11 deletions(-)


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.37 
llvm/lib/CodeGen/DwarfWriter.cpp:1.38
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.37   Wed Mar  1 12:13:05 2006
+++ llvm/lib/CodeGen/DwarfWriter.cppWed Mar  1 12:20:30 2006
@@ -967,7 +967,7 @@
 /// NewBasicType - Creates a new basic type if necessary, then adds to the
 /// owner.
 /// FIXME - Should never be needed.
-DIE *DwarfWriter::NewBasicType(CompileUnit *Unit, Type *Ty) {
+DIE *DwarfWriter::NewBasicType(DIE *Context, Type *Ty) {
   DIE *&Slot = TypeToDieMap[Ty];
   if (Slot) return Slot;
   
@@ -1040,17 +1040,19 @@
   Slot->AddUInt  (DW_AT_byte_size, 0,  Size);
   Slot->AddUInt  (DW_AT_encoding,  DW_FORM_data1,  Encoding);
   
-  // Add to context owner.
-  Unit->getDie()->AddChild(Slot);
+  // Add to context.
+  Context->AddChild(Slot);
   
   return Slot;
 }
 
 /// NewType - Create a new type DIE.
 ///
-DIE *DwarfWriter::NewType(CompileUnit *Unit, TypeDesc *TyDesc) {
+DIE *DwarfWriter::NewType(DIE *Context, TypeDesc *TyDesc) {
   // FIXME - hack to get around NULL types short term.
-  if (!TyDesc)  return NewBasicType(Unit, Type::IntTy);
+  if (!TyDesc)  return NewBasicType(Context, Type::IntTy);
+  
+  // FIXME - Should handle other contexts that compile units.
 
   // Check for pre-existence.
   DIE *&Slot = DescToDieMap[TyDesc];
@@ -1085,7 +1087,7 @@
 
 // Map to main type, void will not have a type.
 if (TypeDesc *FromTy = DerivedTy->getFromType()) {
-   Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4, NewType(Unit, FromTy));
+   Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4, NewType(Context, FromTy));
 }
   } else if (CompositeTypeDesc *CompTy = dyn_cast(TyDesc)) {
 // Determine which composite type.
@@ -1106,7 +1108,7 @@
 case DI_TAG_array: {
   // Add element type.
   if (TypeDesc *FromTy = CompTy->getFromType()) {
- Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4, NewType(Unit, FromTy));
+ Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4, NewType(Context, FromTy));
   }
   // Don't emit size attribute.
   Size = 0;
@@ -1116,7 +1118,7 @@
   IndexTy->AddUInt(DW_AT_byte_size, 0, 4);
   IndexTy->AddUInt(DW_AT_encoding, DW_FORM_data1, DW_ATE_signed);
   // Add to context.
-  Unit->getDie()->AddChild(IndexTy);
+  Context->AddChild(IndexTy);
 
   // Add subranges to array type.
   for(unsigned i = 0, N = Elements.size(); i < N; ++i) {
@@ -1166,7 +1168,7 @@
   }
 
   // Add to context owner.
-  Unit->getDie()->AddChild(Ty);
+  Context->AddChild(Ty);
   
   return Slot;
 }
@@ -1226,7 +1228,7 @@
   unsigned Line = GVD->getLine();
   
   // Get the global's type.
-  DIE *Type = NewType(Unit, GVD->getTypeDesc()); 
+  DIE *Type = NewType(Unit->getDie(), GVD->getTypeDesc()); 
 
   // Create the globale variable DIE.
   DIE *VariableDie = new DIE(DW_TAG_variable);
@@ -1269,7 +1271,7 @@
   unsigned Line = 1;
   
   // FIXME - faking the type for the time being.
-  DIE *Type = NewBasicType(Unit, Type::IntTy); 
+  DIE *Type = NewBasicType(Unit->getDie(), Type::IntTy); 
 
   DIE *SubprogramDie = new DIE(DW_TAG_subprogram);
   SubprogramDie->AddString (DW_AT_name,  DW_FORM_string, Name);



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


[llvm-commits] CVS: llvm/include/llvm/CodeGen/DwarfWriter.h

2006-03-01 Thread Jim Laskey


Changes in directory llvm/include/llvm/CodeGen:

DwarfWriter.h updated: 1.27 -> 1.28
---
Log message:

Use context and not compile unit.


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

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


Index: llvm/include/llvm/CodeGen/DwarfWriter.h
diff -u llvm/include/llvm/CodeGen/DwarfWriter.h:1.27 
llvm/include/llvm/CodeGen/DwarfWriter.h:1.28
--- llvm/include/llvm/CodeGen/DwarfWriter.h:1.27Mon Feb 27 11:27:12 2006
+++ llvm/include/llvm/CodeGen/DwarfWriter.h Wed Mar  1 12:20:30 2006
@@ -296,13 +296,13 @@
   /// NewBasicType - Creates a new basic type if necessary, then adds to the
   /// owner.
   /// FIXME - Should never be needed.
-  DIE *NewBasicType(CompileUnit *Unit, Type *Ty);
+  DIE *NewBasicType(DIE *Context, Type *Ty);
 
 private:
 
   /// NewType - Create a new type DIE.
   ///
- DIE *DwarfWriter::NewType(CompileUnit *Unit, TypeDesc *TyDesc);
+ DIE *DwarfWriter::NewType(DIE *Context, TypeDesc *TyDesc);
   
   /// NewCompileUnit - Create new compile unit and it's die.
   ///



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


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

2006-03-01 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.36 -> 1.37
---
Log message:

I guess I can handle large type sizes.


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

 DwarfWriter.cpp |3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.36 
llvm/lib/CodeGen/DwarfWriter.cpp:1.37
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.36   Wed Mar  1 11:53:02 2006
+++ llvm/lib/CodeGen/DwarfWriter.cppWed Mar  1 12:13:05 2006
@@ -1058,8 +1058,7 @@
 
   // Get core information.
   const std::string &Name = TyDesc->getName();
-  // FIXME - handle larger sizes.
-  unsigned Size = TyDesc->getSize() >> 3;
+  uint64_t Size = TyDesc->getSize() >> 3;
   
   DIE *Ty = NULL;
   



___
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

2006-03-01 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.117 -> 1.118
---
Log message:

Fix a typo evan noticed


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

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


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.117 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.118
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.117 Tue Feb 28 22:53:38 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Wed Mar  1 13:55:35 2006
@@ -113,7 +113,7 @@
   private:
 
 /// SimplifyDemandedBits - Check the specified integer node value to see if
-/// it can be simplified or if things is uses can be simplified by bit
+/// it can be simplified or if things it uses can be simplified by bit
 /// propagation.  If so, return true.
 bool SimplifyDemandedBits(SDOperand Op) {
   TargetLowering::TargetLoweringOpt TLO(DAG);



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


[llvm-commits] CVS: llvm/include/llvm/Support/Dwarf.h

2006-03-01 Thread Jim Laskey


Changes in directory llvm/include/llvm/Support:

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

Switch back to using actual dwarf tags.  Simplifies code without loss to other
debug forms.


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

 Dwarf.h |   10 ++
 1 files changed, 10 insertions(+)


Index: llvm/include/llvm/Support/Dwarf.h
diff -u llvm/include/llvm/Support/Dwarf.h:1.3 
llvm/include/llvm/Support/Dwarf.h:1.4
--- llvm/include/llvm/Support/Dwarf.h:1.3   Mon Feb 27 16:37:23 2006
+++ llvm/include/llvm/Support/Dwarf.h   Wed Mar  1 14:39:35 2006
@@ -24,6 +24,16 @@
 // Dwarf constants as gleaned from the DWARF Debugging Information Format V.3
 // reference manual http://dwarf.freestandards.org .
 //
+
+// Do not mix the following two enumerations sets.  DW_TAG_invalid changes the
+// enumeration base type.
+
+enum llvm_dwarf_constants {
+  // llvm mock tags
+  DW_TAG_invalid = ~0U, // Tag for invalid results.
+  DW_TAG_anchor = 0,// Tag for descriptor anchors.
+};
+
 enum dwarf_constants {
   DWARF_VERSION = 2,
   



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


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

2006-03-01 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.38 -> 1.39
MachineDebugInfo.cpp updated: 1.20 -> 1.21
---
Log message:

Switch back to using actual dwarf tags.  Simplifies code without loss to other
debug forms.


---
Diffs of the changes:  (+103 -55)

 DwarfWriter.cpp  |   34 ++---
 MachineDebugInfo.cpp |  124 +++
 2 files changed, 103 insertions(+), 55 deletions(-)


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.38 
llvm/lib/CodeGen/DwarfWriter.cpp:1.39
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.38   Wed Mar  1 12:20:30 2006
+++ llvm/lib/CodeGen/DwarfWriter.cppWed Mar  1 14:39:35 2006
@@ -1070,42 +1070,20 @@
 unsigned Encoding = BasicTy->getEncoding();
 Ty->AddUInt  (DW_AT_encoding,  DW_FORM_data1, Encoding);
   } else if (DerivedTypeDesc *DerivedTy = dyn_cast(TyDesc)) {
-// Determine which derived type.
-unsigned T = 0;
-switch (DerivedTy->getTag()) {
-case DI_TAG_typedef:   T = DW_TAG_typedef; break;
-case DI_TAG_pointer:   T = DW_TAG_pointer_type;break;
-case DI_TAG_reference: T = DW_TAG_reference_type;  break;
-case DI_TAG_const: T = DW_TAG_const_type;  break;
-case DI_TAG_volatile:  T = DW_TAG_volatile_type;   break;
-case DI_TAG_restrict:  T = DW_TAG_restrict_type;   break;
-default: assert( 0 && "Unknown tag on derived type");
-}
-
 // Create specific DIE.
-Slot = Ty = new DIE(T);
+Slot = Ty = new DIE(DerivedTy->getTag());
 
 // Map to main type, void will not have a type.
 if (TypeDesc *FromTy = DerivedTy->getFromType()) {
Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4, NewType(Context, FromTy));
 }
   } else if (CompositeTypeDesc *CompTy = dyn_cast(TyDesc)) {
-// Determine which composite type.
-unsigned T = 0;
-switch (CompTy->getTag()) {
-case DI_TAG_array: T = DW_TAG_array_type;   break;
-case DI_TAG_struct:T = DW_TAG_structure_type;   break;
-case DI_TAG_union: T = DW_TAG_union_type;   break;
-case DI_TAG_enum:  T = DW_TAG_enumeration_type; break;
-default: assert( 0 && "Unknown tag on composite type");
-}
-
 // Create specific DIE.
-Slot = Ty = new DIE(T);
+Slot = Ty = new DIE(CompTy->getTag());
 std::vector &Elements = CompTy->getElements();
 
 switch (CompTy->getTag()) {
-case DI_TAG_array: {
+case DW_TAG_array_type: {
   // Add element type.
   if (TypeDesc *FromTy = CompTy->getFromType()) {
  Ty->AddDIEntry(DW_AT_type, DW_FORM_ref4, NewType(Context, FromTy));
@@ -1139,13 +1117,13 @@
   
   break;
 }
-case DI_TAG_struct: {
+case DW_TAG_structure_type: {
   break;
 }
-case DI_TAG_union: {
+case DW_TAG_union_type: {
   break;
 }
-case DI_TAG_enum: {
+case DW_TAG_enumeration_type: {
   break;
 }
 default: break;


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.20 
llvm/lib/CodeGen/MachineDebugInfo.cpp:1.21
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.20  Wed Mar  1 11:53:02 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp   Wed Mar  1 14:39:36 2006
@@ -20,6 +20,7 @@
 #include 
 
 using namespace llvm;
+using namespace llvm::dwarf;
 
 // Handle the Pass registration stuff necessary to use TargetData's.
 namespace {
@@ -492,29 +493,29 @@
 /// GlobalVariable.  
 unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) {
   ConstantUInt *C = getUIntOperand(GV, 0);
-  return C ? (unsigned)C->getValue() : (unsigned)DIInvalid;
+  return C ? (unsigned)C->getValue() : (unsigned)DW_TAG_invalid;
 }
 
 /// DescFactory - Create an instance of debug info descriptor based on Tag.
 /// Return NULL if not a recognized Tag.
 DebugInfoDesc *DebugInfoDesc::DescFactory(unsigned Tag) {
   switch (Tag) {
-  case DI_TAG_anchor:  return new AnchorDesc();
-  case DI_TAG_compile_unit:return new CompileUnitDesc();
-  case DI_TAG_global_variable: return new GlobalVariableDesc();
-  case DI_TAG_subprogram:  return new SubprogramDesc();
-  case DI_TAG_basictype:   return new BasicTypeDesc();
-  case DI_TAG_typedef:
-  case DI_TAG_pointer: 
-  case DI_TAG_reference:
-  case DI_TAG_const:
-  case DI_TAG_volatile: 
-  case DI_TAG_restrict:return new DerivedTypeDesc(Tag);
-  case DI_TAG_array:
-  case DI_TAG_struct:
-  case DI_TAG_union:
-  case DI_TAG_enum:return new CompositeTypeDesc(Tag);
-  case DI_TAG_subrange:return new SubrangeDesc();
+  case DW_TAG_anchor:   return new AnchorDesc();
+  case DW_TAG_compile_unit: return new CompileUnitDesc();
+  case DW_TAG_variable: return new GlobalVariableDesc();
+  case DW_TAG_subprogram:   return new SubprogramDesc();
+  case DW_TAG_base_type:return new BasicTypeDesc();
+  case DW_TAG_typedef:
+  case DW_TAG_pointer_type: 
+  case DW_TA

[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h

2006-03-01 Thread Jim Laskey


Changes in directory llvm/include/llvm/CodeGen:

MachineDebugInfo.h updated: 1.23 -> 1.24
---
Log message:

Switch back to using actual dwarf tags.  Simplifies code without loss to other
debug forms.


---
Diffs of the changes:  (+16 -72)

 MachineDebugInfo.h |   88 +
 1 files changed, 16 insertions(+), 72 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h
diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.23 
llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.24
--- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.23   Wed Mar  1 11:53:02 2006
+++ llvm/include/llvm/CodeGen/MachineDebugInfo.hWed Mar  1 14:39:35 2006
@@ -56,25 +56,6 @@
 
 enum {
   LLVMDebugVersion = 1, // Current version of debug 
information.
-  DIInvalid = ~0U,  // Invalid result indicator.
-  
-  // DebugInfoDesc type identifying tags.
-  DI_TAG_anchor = 0,
-  DI_TAG_compile_unit,
-  DI_TAG_global_variable,
-  DI_TAG_subprogram,
-  DI_TAG_basictype,
-  DI_TAG_typedef,
-  DI_TAG_pointer,
-  DI_TAG_reference,
-  DI_TAG_array,
-  DI_TAG_struct,
-  DI_TAG_union,
-  DI_TAG_enum,
-  DI_TAG_subrange,
-  DI_TAG_const,
-  DI_TAG_volatile,
-  DI_TAG_restrict
 };
 
 
//===--===//
@@ -166,23 +147,15 @@
   std::string Name; // Anchor type string.
   
 public:
-  AnchorDesc()
-  : DebugInfoDesc(DI_TAG_anchor)
-  , Name("")
-  {}
-  AnchorDesc(const std::string &N)
-  : DebugInfoDesc(DI_TAG_anchor)
-  , Name(N)
-  {}
+  AnchorDesc();
+  AnchorDesc(const std::string &N);
   
   // Accessors
   const std::string &getName() const { return Name; }
 
   // Implement isa/cast/dyncast.
   static bool classof(const AnchorDesc *) { return true; }
-  static bool classof(const DebugInfoDesc *D) {
-return D->getTag() == DI_TAG_anchor;
-  }
+  static bool classof(const DebugInfoDesc *D);
 
   /// getLinkage - get linkage appropriate for this type of descriptor.
   ///
@@ -259,9 +232,7 @@
 
   // Implement isa/cast/dyncast.
   static bool classof(const CompileUnitDesc *) { return true; }
-  static bool classof(const DebugInfoDesc *D) {
-return D->getTag() == DI_TAG_compile_unit;
-  }
+  static bool classof(const DebugInfoDesc *D);
   
   /// DebugVersionFromGlobal - Returns the version number from a compile unit
   /// GlobalVariable.  Return DIIValid if operand is not an unsigned int.
@@ -348,9 +319,7 @@
 
   // Implement isa/cast/dyncast.
   static bool classof(const BasicTypeDesc *) { return true; }
-  static bool classof(const DebugInfoDesc *D) {
-return D->getTag() == DI_TAG_basictype;
-  }
+  static bool classof(const DebugInfoDesc *D);
   
   /// ApplyToFields - Target the visitor to the fields of the  BasicTypeDesc.
   ///
@@ -386,20 +355,7 @@
 
   // Implement isa/cast/dyncast.
   static bool classof(const DerivedTypeDesc *) { return true; }
-  static bool classof(const DebugInfoDesc *D) {
-unsigned T =  D->getTag();
-switch (T) {
-case DI_TAG_typedef:
-case DI_TAG_pointer:
-case DI_TAG_reference:
-case DI_TAG_const:
-case DI_TAG_volatile:
-case DI_TAG_restrict:
-  return true;
-default: break;
-}
-return false;
-  }
+  static bool classof(const DebugInfoDesc *D);
   
   /// ApplyToFields - Target the visitor to the fields of the  DerivedTypeDesc.
   ///
@@ -433,18 +389,7 @@
 
   // Implement isa/cast/dyncast.
   static bool classof(const CompositeTypeDesc *) { return true; }
-  static bool classof(const DebugInfoDesc *D) {
-unsigned T =  D->getTag();
-switch (T) {
-case DI_TAG_array:
-case DI_TAG_struct:
-case DI_TAG_union:
-case DI_TAG_enum:
-  return true;
-default: break;
-}
-return false;
-  }
+  static bool classof(const DebugInfoDesc *D);
   
   /// ApplyToFields - Target the visitor to the fields of the 
CompositeTypeDesc.
   ///
@@ -482,9 +427,7 @@
 
   // Implement isa/cast/dyncast.
   static bool classof(const SubrangeDesc *) { return true; }
-  static bool classof(const DebugInfoDesc *D) {
-return D->getTag() == DI_TAG_subrange;
-  }
+  static bool classof(const DebugInfoDesc *D);
   
   /// ApplyToFields - Target the visitor to the fields of the SubrangeDesc.
   ///
@@ -554,9 +497,7 @@
  
   // Implement isa/cast/dyncast.
   static bool classof(const GlobalVariableDesc *) { return true; }
-  static bool classof(const DebugInfoDesc *D) {
-return D->getTag() == DI_TAG_global_variable; 
-  }
+  static bool classof(const DebugInfoDesc *D);
   
   /// ApplyToFields - Target the visitor to the fields of the
   /// GlobalVariableDesc.
@@ -594,9 +535,7 @@
   
   // Implement isa/cast/dyncast.
   static bool classof(const SubprogramDesc *) { return true; }
-  static bool classof(const DebugInfoDesc *D) {
-return D->getTag() == DI_TAG_subprogram;
-  }
+  static bool classof(const DebugInfoDesc *D);
   
   /// ApplyToFields - Target the visitor to 

[llvm-commits] CVS: llvm/include/llvm/Support/Dwarf.h

2006-03-01 Thread Jim Laskey


Changes in directory llvm/include/llvm/Support:

Dwarf.h updated: 1.4 -> 1.5
---
Log message:

Remove comma from enum list.


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

 Dwarf.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/Support/Dwarf.h
diff -u llvm/include/llvm/Support/Dwarf.h:1.4 
llvm/include/llvm/Support/Dwarf.h:1.5
--- llvm/include/llvm/Support/Dwarf.h:1.4   Wed Mar  1 14:39:35 2006
+++ llvm/include/llvm/Support/Dwarf.h   Wed Mar  1 14:48:20 2006
@@ -31,7 +31,7 @@
 enum llvm_dwarf_constants {
   // llvm mock tags
   DW_TAG_invalid = ~0U, // Tag for invalid results.
-  DW_TAG_anchor = 0,// Tag for descriptor anchors.
+  DW_TAG_anchor = 0 // Tag for descriptor anchors.
 };
 
 enum dwarf_constants {



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


[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h

2006-03-01 Thread Jim Laskey


Changes in directory llvm/include/llvm/CodeGen:

MachineDebugInfo.h updated: 1.24 -> 1.25
---
Log message:

Remove extra comma from enum list.


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

 MachineDebugInfo.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h
diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.24 
llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.25
--- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.24   Wed Mar  1 14:39:35 2006
+++ llvm/include/llvm/CodeGen/MachineDebugInfo.hWed Mar  1 14:49:44 2006
@@ -55,7 +55,7 @@
 // Debug info constants.
 
 enum {
-  LLVMDebugVersion = 1, // Current version of debug 
information.
+  LLVMDebugVersion = 1  // Current version of debug 
information.
 };
 
 
//===--===//



___
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/2006-03-01-dagcombineinfloop.ll

2006-03-01 Thread Chris Lattner


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

2006-03-01-dagcombineinfloop.ll added (r1.1)
---
Log message:

new testcase


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

 2006-03-01-dagcombineinfloop.ll |   98 
 1 files changed, 98 insertions(+)


Index: llvm/test/Regression/CodeGen/Generic/2006-03-01-dagcombineinfloop.ll
diff -c /dev/null 
llvm/test/Regression/CodeGen/Generic/2006-03-01-dagcombineinfloop.ll:1.1
*** /dev/null   Wed Mar  1 15:47:03 2006
--- llvm/test/Regression/CodeGen/Generic/2006-03-01-dagcombineinfloop.ll
Wed Mar  1 15:46:53 2006
***
*** 0 
--- 1,98 
+ ; RUN: llvm-as < %s | llc
+ ; Infinite loop in the dag combiner, reduced from 176.gcc.
+ 
+   %struct._obstack_chunk = type { sbyte*, %struct._obstack_chunk*, [4 x 
sbyte] }
+   %struct.anon = type { int }
+   %struct.lang_decl = type opaque
+   %struct.lang_type = type { int, [1 x %struct.tree_node*] }
+   %struct.obstack = type { int, %struct._obstack_chunk*, sbyte*, sbyte*, 
sbyte*, int, int, %struct._obstack_chunk* (...)*, void (...)*, sbyte*, ubyte }
+   %struct.rtx_def = type { ushort, ubyte, ubyte, [1 x %struct.anon] }
+   %struct.tree_common = type { %struct.tree_node*, %struct.tree_node*, 
ubyte, ubyte, ubyte, ubyte }
+   %struct.tree_decl = type { [12 x sbyte], sbyte*, int, 
%struct.tree_node*, uint, ubyte, ubyte, ubyte, ubyte, %struct.tree_node*, 
%struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, 
%struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, 
%struct.rtx_def*, %struct.anon, { %struct.rtx_def* }, %struct.tree_node*, 
%struct.lang_decl* }
+   %struct.tree_list = type { [12 x sbyte], %struct.tree_node*, 
%struct.tree_node* }
+   %struct.tree_node = type { %struct.tree_decl }
+   %struct.tree_type = type { [12 x sbyte], %struct.tree_node*, 
%struct.tree_node*, %struct.tree_node*, uint, ubyte, ubyte, ubyte, ubyte, uint, 
%struct.tree_node*, %struct.tree_node*, %struct.anon, %struct.tree_node*, 
%struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.tree_node*, 
%struct.tree_node*, %struct.tree_node*, %struct.tree_node*, %struct.obstack*, 
%struct.lang_type* }
+ %void_type_node = external global %struct.tree_node*  ; 
<%struct.tree_node**> [#uses=1]
+ %char_type_node = external global %struct.tree_node*  ; 
<%struct.tree_node**> [#uses=1]
+ %short_integer_type_node = external global %struct.tree_node* ; 
<%struct.tree_node**> [#uses=1]
+ %short_unsigned_type_node = external global %struct.tree_node*
; <%struct.tree_node**> [#uses=1]
+ %float_type_node = external global %struct.tree_node* ; 
<%struct.tree_node**> [#uses=1]
+ %signed_char_type_node = external global %struct.tree_node*   ; 
<%struct.tree_node**> [#uses=1]
+ %unsigned_char_type_node = external global %struct.tree_node* ; 
<%struct.tree_node**> [#uses=1]
+ 
+ implementation   ; Functions:
+ 
+ fastcc int %self_promoting_args_p(%struct.tree_node* %parms) {
+ entry:
+   %tmp915 = seteq %struct.tree_node* %parms, null ;  
[#uses=1]
+   br bool %tmp915, label %return, label %cond_true92.preheader
+ 
+ cond_true:; preds = %cond_true92
+   %tmp9.not = setne %struct.tree_node* %tmp2, %tmp7   ; 
 [#uses=1]
+   %tmp14 = seteq %struct.tree_node* %tmp2, null   ;  
[#uses=1]
+   %bothcond = or bool %tmp9.not, %tmp14   ;  [#uses=1]
+   br bool %bothcond, label %return, label %cond_next18
+ 
+ cond_next12:  ; preds = %cond_true92
+   %tmp14.old = seteq %struct.tree_node* %tmp2, null   ; 
 [#uses=1]
+   br bool %tmp14.old, label %return, label %cond_next18
+ 
+ cond_next18:  ; preds = %cond_next12, %cond_true
+   %tmp20 = cast %struct.tree_node* %tmp2 to %struct.tree_type*
; <%struct.tree_type*> [#uses=1]
+   %tmp21 = getelementptr %struct.tree_type* %tmp20, int 0, uint 17
; <%struct.tree_node**> [#uses=1]
+   %tmp22 = load %struct.tree_node** %tmp21; 
<%struct.tree_node*> [#uses=6]
+   %tmp24 = seteq %struct.tree_node* %tmp22, %tmp23; 
 [#uses=1]
+   br bool %tmp24, label %return, label %cond_next28
+ 
+ cond_next28:  ; preds = %cond_next18
+   %tmp30 = cast %struct.tree_node* %tmp2 to %struct.tree_common*  
; <%struct.tree_common*> [#uses=1]
+   %tmp = getelementptr %struct.tree_common* %tmp30, int 0, uint 2 
;  [#uses=1]
+   %tmp = cast ubyte* %tmp to uint*;  [#uses=1]
+   %tmp = load uint* %tmp  ;  [#uses=1]
+   %tmp32 = cast uint %tmp to ubyte;  [#uses=1]
+   %tmp33 = seteq ubyte %tmp32, 7  ;  [#uses=1]
+   br bool %tmp33, label %cond_true34, label %cond_next84
+ 
+ cond_true34:  ; preds = %cond_next28
+   %tmp40 = seteq %struct.tre

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

2006-03-01 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.118 -> 1.119
---
Log message:

Fix CodeGen/Generic/2006-03-01-dagcombineinfloop.ll, an infinite loop
in the dag combiner on 176.gcc on x86.


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

 DAGCombiner.cpp |   13 +
 1 files changed, 9 insertions(+), 4 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.118 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.119
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.118 Wed Mar  1 13:55:35 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp   Wed Mar  1 15:47:21 2006
@@ -1018,14 +1018,19 @@
 return N1;
   // fold (and (any_ext V), c) -> (zero_ext V) if 'and' only clears top bits.
   if (N1C && N0.getOpcode() == ISD::ANY_EXTEND) {
-unsigned InBits = MVT::getSizeInBits(N0.getOperand(0).getValueType());
+unsigned InMask = MVT::getIntVTBitMask(N0.getOperand(0).getValueType());
 if (TLI.MaskedValueIsZero(N0.getOperand(0),
-  ~N1C->getValue() & ((1ULL << InBits)-1))) {
+  ~N1C->getValue() & InMask)) {
+  SDOperand Zext = DAG.getNode(ISD::ZERO_EXTEND, N0.getValueType(),
+   N0.getOperand(0));
+  
+  // Replace uses of the AND with uses of the Zero extend node.
+  CombineTo(N, Zext);
+  
   // We actually want to replace all uses of the any_extend with the
   // zero_extend, to avoid duplicating things.  This will later cause this
   // AND to be folded.
-  CombineTo(N0.Val, DAG.getNode(ISD::ZERO_EXTEND, N0.getValueType(),
-N0.getOperand(0)));
+  CombineTo(N0.Val, Zext);
   return SDOperand();
 }
   }



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


[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Ptrdist/yacr2/channel.c

2006-03-01 Thread Andrew Lenharth


Changes in directory llvm-test/MultiSource/Benchmarks/Ptrdist/yacr2:

channel.c updated: 1.1 -> 1.2
---
Log message:

u matches unsigned int not unsigned long, so fix this broken program

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

 channel.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)


Index: llvm-test/MultiSource/Benchmarks/Ptrdist/yacr2/channel.c
diff -u llvm-test/MultiSource/Benchmarks/Ptrdist/yacr2/channel.c:1.1 
llvm-test/MultiSource/Benchmarks/Ptrdist/yacr2/channel.c:1.2
--- llvm-test/MultiSource/Benchmarks/Ptrdist/yacr2/channel.c:1.1Tue Nov 
 5 12:51:11 2002
+++ llvm-test/MultiSource/Benchmarks/Ptrdist/yacr2/channel.cWed Mar  1 
15:51:15 2006
@@ -87,7 +87,9 @@
 net = 0;
 do {
line++;
-   stat = fscanf(channelFP, "%u%u%u", &col, &bot, &top);
+   unsigned int c1, b1, t1;
+   stat = fscanf(channelFP, "%u%u%u", &c1, &b1, &t1);
+   col = c1; bot = b1; top = t1;
if (stat != EOF) {
if (stat == 3) {
/*
@@ -203,7 +205,9 @@
 line = 0;
 do {
line++;
-   stat = fscanf(channelFP, "%u%u%u", &col, &bot, &top);
+   unsigned int c1, b1, t1;
+   stat = fscanf(channelFP, "%u%u%u", &c1, &b1, &t1);
+   col = c1; bot = b1; top = t1;
if (stat != EOF) {
if (stat == 3) {
/*



___
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

2006-03-01 Thread Evan Cheng


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.194 -> 1.195
---
Log message:

AsmWriter should not print LLVM constant in comment. Assembler won't like
multi-line comments.


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

 AsmWriter.cpp |4 
 1 files changed, 4 deletions(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.194 llvm/lib/VMCore/AsmWriter.cpp:1.195
--- llvm/lib/VMCore/AsmWriter.cpp:1.194 Mon Feb 27 04:33:53 2006
+++ llvm/lib/VMCore/AsmWriter.cpp   Wed Mar  1 16:00:59 2006
@@ -26,7 +26,6 @@
 #include "llvm/Instructions.h"
 #include "llvm/Module.h"
 #include "llvm/SymbolTable.h"
-#include "llvm/Assembly/Writer.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/STLExtras.h"
@@ -1312,9 +1311,6 @@
   if (this == 0) { o << " constant value\n"; return; }
 
   o << ' ' << getType()->getDescription() << ' ';
-
-  std::map TypeTable;
-  WriteConstantInt(o, this, false, TypeTable, 0);
 }
 
 void Type::print(std::ostream &o) const {



___
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

2006-03-01 Thread Evan Cheng


Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.195 -> 1.196
---
Log message:

Back out my last check-in. Wrong place to fix it.


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

 AsmWriter.cpp |3 +++
 1 files changed, 3 insertions(+)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.195 llvm/lib/VMCore/AsmWriter.cpp:1.196
--- llvm/lib/VMCore/AsmWriter.cpp:1.195 Wed Mar  1 16:00:59 2006
+++ llvm/lib/VMCore/AsmWriter.cpp   Wed Mar  1 16:17:00 2006
@@ -1311,6 +1311,9 @@
   if (this == 0) { o << " constant value\n"; return; }
 
   o << ' ' << getType()->getDescription() << ' ';
+
+  std::map TypeTable;
+  WriteConstantInt(o, this, false, TypeTable, 0);
 }
 
 void Type::print(std::ostream &o) const {



___
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

2006-03-01 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.55 -> 1.56
---
Log message:

Don't print llvm constant in assmebly file. Assembler won't like comments that
span multiple lines.


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

 AsmPrinter.cpp |4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.55 
llvm/lib/CodeGen/AsmPrinter.cpp:1.56
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.55Fri Feb 24 14:21:58 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp Wed Mar  1 16:18:09 2006
@@ -11,6 +11,7 @@
 //
 
//===--===//
 
+#include "llvm/Assembly/Writer.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/Constants.h"
@@ -114,7 +115,8 @@
   EmitAlignment(MCP->getConstantPoolAlignment());
   for (unsigned i = 0, e = CP.size(); i != e; ++i) {
 O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << '_' << i
-  << ":\t\t\t\t\t" << CommentString << *CP[i].Val << '\n';
+  << ":\t\t\t\t\t" << CommentString << " ";
+WriteTypeSymbolic(O, CP[i].Val->getType(), 0) << '\n';
 EmitGlobalConstant(CP[i].Val);
 if (i != e-1) {
   unsigned EntSize = TM.getTargetData().getTypeSize(CP[i].Val->getType());



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


[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Ptrdist/anagram/anagram.c

2006-03-01 Thread Andrew Lenharth


Changes in directory llvm-test/MultiSource/Benchmarks/Ptrdist/anagram:

anagram.c updated: 1.2 -> 1.3
---
Log message:

you would almost think this was what sizeof was for, wouldn't you

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

 anagram.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm-test/MultiSource/Benchmarks/Ptrdist/anagram/anagram.c
diff -u llvm-test/MultiSource/Benchmarks/Ptrdist/anagram/anagram.c:1.2 
llvm-test/MultiSource/Benchmarks/Ptrdist/anagram/anagram.c:1.3
--- llvm-test/MultiSource/Benchmarks/Ptrdist/anagram/anagram.c:1.2  Wed Nov 
10 02:43:01 2004
+++ llvm-test/MultiSource/Benchmarks/Ptrdist/anagram/anagram.c  Wed Mar  1 
16:20:30 2006
@@ -147,7 +147,7 @@
  */
 
 typedef unsigned long Quad; /* for building our bit mask */
-#define MASK_BITS 32/* number of bits in a Quad */
+#define MASK_BITS (sizeof(Quad)*8)/* number of bits in a 
Quad */
 
 #define MAX_QUADS 2 /* controls largest phrase */
 



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


[llvm-commits] CVS: llvm/test/Regression/C++Frontend/2006-03-01-GimplifyCrash.cpp

2006-03-01 Thread Chris Lattner


Changes in directory llvm/test/Regression/C++Frontend:

2006-03-01-GimplifyCrash.cpp added (r1.1)
---
Log message:

testcase that crashed the new CFE


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

 2006-03-01-GimplifyCrash.cpp |   14 ++
 1 files changed, 14 insertions(+)


Index: llvm/test/Regression/C++Frontend/2006-03-01-GimplifyCrash.cpp
diff -c /dev/null 
llvm/test/Regression/C++Frontend/2006-03-01-GimplifyCrash.cpp:1.1
*** /dev/null   Wed Mar  1 16:45:22 2006
--- llvm/test/Regression/C++Frontend/2006-03-01-GimplifyCrash.cpp   Wed Mar 
 1 16:45:12 2006
***
*** 0 
--- 1,14 
+ // RUN: %llvmgxx -S %s -o -
+ 
+ struct PrefMapElem {
+   virtual ~PrefMapElem(); 
+   unsigned int fPrefId;
+ };
+ 
+ int foo() {
+   PrefMapElem* fMap;
+   if (fMap[0].fPrefId == 1)
+ return 1;
+   
+   return 0;
+ }



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


[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h

2006-03-01 Thread Jim Laskey


Changes in directory llvm/include/llvm/CodeGen:

MachineDebugInfo.h updated: 1.25 -> 1.26
---
Log message:

Support for enumerations.


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

 MachineDebugInfo.h |   38 ++
 1 files changed, 38 insertions(+)


Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h
diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.25 
llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.26
--- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.25   Wed Mar  1 14:49:44 2006
+++ llvm/include/llvm/CodeGen/MachineDebugInfo.hWed Mar  1 17:52:37 2006
@@ -447,6 +447,44 @@
 };
 
 
//===--===//
+/// EnumeratorDesc - This class packages debug information associated with
+/// named integer constants.
+class EnumeratorDesc : public DebugInfoDesc {
+private:
+  std::string Name; // Enumerator name.
+  int64_t Value;// Enumerator value.
+
+public:
+  EnumeratorDesc();
+  
+  // Accessors
+  const std::string &getName()   const { return Name; }
+  int64_t getValue() const { return Value; }
+  void setName(const std::string &N)   { Name = N; }
+  void setValue(int64_t V) { Value = V; }
+
+  // Implement isa/cast/dyncast.
+  static bool classof(const EnumeratorDesc *) { return true; }
+  static bool classof(const DebugInfoDesc *D);
+  
+  /// ApplyToFields - Target the visitor to the fields of the EnumeratorDesc.
+  ///
+  virtual void ApplyToFields(DIVisitor *Visitor);
+
+  /// getDescString - Return a string used to compose global names and labels.
+  ///
+  virtual const char *getDescString() const;
+
+  /// getTypeString - Return a string used to label this descriptor's type.
+  ///
+  virtual const char *getTypeString() const;
+
+#ifndef NDEBUG
+  virtual void dump();
+#endif
+};
+
+//===--===//
 /// GlobalDesc - This class is the base descriptor for global functions and
 /// variables.
 class GlobalDesc : public AnchoredDesc {



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


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

2006-03-01 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.39 -> 1.40
MachineDebugInfo.cpp updated: 1.21 -> 1.22
---
Log message:

Support for enumerations.


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

 DwarfWriter.cpp  |   15 +--
 MachineDebugInfo.cpp |   44 
 2 files changed, 57 insertions(+), 2 deletions(-)


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.39 
llvm/lib/CodeGen/DwarfWriter.cpp:1.40
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.39   Wed Mar  1 14:39:35 2006
+++ llvm/lib/CodeGen/DwarfWriter.cppWed Mar  1 17:52:37 2006
@@ -1109,8 +1109,8 @@
 if (Lo != Hi) {
   Subrange->AddDIEntry(DW_AT_type, DW_FORM_ref4, IndexTy);
   // Only add low if non-zero.
-  if (Lo) Subrange->AddUInt(DW_AT_lower_bound, 0, Lo);
-  Subrange->AddUInt(DW_AT_upper_bound, 0, Hi);
+  if (Lo) Subrange->AddSInt(DW_AT_lower_bound, 0, Lo);
+  Subrange->AddSInt(DW_AT_upper_bound, 0, Hi);
 }
 Ty->AddChild(Subrange);
   }
@@ -1124,6 +1124,17 @@
   break;
 }
 case DW_TAG_enumeration_type: {
+  // Add enumerators to enumeration type.
+  for(unsigned i = 0, N = Elements.size(); i < N; ++i) {
+EnumeratorDesc *ED = cast(Elements[i]);
+const std::string &Name = ED->getName();
+int64_t Value = ED->getValue();
+DIE *Enumerator = new DIE(DW_TAG_enumerator);
+Enumerator->AddString(DW_AT_name, DW_FORM_string, Name);
+Enumerator->AddSInt(DW_AT_const_value, DW_FORM_sdata, Value);
+Ty->AddChild(Enumerator);
+  }
+
   break;
 }
 default: break;


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.21 
llvm/lib/CodeGen/MachineDebugInfo.cpp:1.22
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.21  Wed Mar  1 14:39:36 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp   Wed Mar  1 17:52:37 2006
@@ -516,6 +516,7 @@
   case DW_TAG_union_type:
   case DW_TAG_enumeration_type: return new CompositeTypeDesc(Tag);
   case DW_TAG_subrange_type:return new SubrangeDesc();
+  case DW_TAG_enumerator:   return new EnumeratorDesc();
   default: break;
   }
   return NULL;
@@ -909,6 +910,49 @@
 
 
//===--===//
 
+EnumeratorDesc::EnumeratorDesc()
+: DebugInfoDesc(DW_TAG_enumerator)
+, Name("")
+, Value(0)
+{}
+
+// Implement isa/cast/dyncast.
+bool EnumeratorDesc::classof(const DebugInfoDesc *D) {
+  return D->getTag() == DW_TAG_enumerator;
+}
+
+/// ApplyToFields - Target the visitor to the fields of the EnumeratorDesc.
+///
+void EnumeratorDesc::ApplyToFields(DIVisitor *Visitor) {
+  DebugInfoDesc::ApplyToFields(Visitor);
+
+  Visitor->Apply(Name);
+  Visitor->Apply(Value);
+}
+
+/// getDescString - Return a string used to compose global names and labels.
+///
+const char *EnumeratorDesc::getDescString() const {
+  return "llvm.dbg.enumerator";
+}
+  
+/// getTypeString - Return a string used to label this descriptor's type.
+///
+const char *EnumeratorDesc::getTypeString() const {
+  return "llvm.dbg.enumerator.type";
+}
+
+#ifndef NDEBUG
+void EnumeratorDesc::dump() {
+  std::cerr << getDescString() << " "
+<< "Tag(" << getTag() << "), "
+<< "Name(" << Name << "), "
+<< "Value(" << Value << ")\n";
+}
+#endif
+
+//===--===//
+
 GlobalDesc::GlobalDesc(unsigned T)
 : AnchoredDesc(T)
 , Context(0)



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


[llvm-commits] CVS: llvm/include/llvm/CodeGen/DwarfWriter.h

2006-03-01 Thread Chris Lattner


Changes in directory llvm/include/llvm/CodeGen:

DwarfWriter.h updated: 1.28 -> 1.29
---
Log message:

Fix a compilation error with GCC 4.1.  Thanks to Vladimir Merzliakov for
pointing this out.


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

 DwarfWriter.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/include/llvm/CodeGen/DwarfWriter.h
diff -u llvm/include/llvm/CodeGen/DwarfWriter.h:1.28 
llvm/include/llvm/CodeGen/DwarfWriter.h:1.29
--- llvm/include/llvm/CodeGen/DwarfWriter.h:1.28Wed Mar  1 12:20:30 2006
+++ llvm/include/llvm/CodeGen/DwarfWriter.h Wed Mar  1 18:21:41 2006
@@ -302,7 +302,7 @@
 
   /// NewType - Create a new type DIE.
   ///
- DIE *DwarfWriter::NewType(DIE *Context, TypeDesc *TyDesc);
+ DIE *NewType(DIE *Context, TypeDesc *TyDesc);
   
   /// NewCompileUnit - Create new compile unit and it's die.
   ///



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


[llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/rem.ll

2006-03-01 Thread Chris Lattner


Changes in directory llvm/test/Regression/Transforms/InstCombine:

rem.ll updated: 1.11 -> 1.12
---
Log message:

add a couple more cases


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

 rem.ll |   17 +
 1 files changed, 17 insertions(+)


Index: llvm/test/Regression/Transforms/InstCombine/rem.ll
diff -u llvm/test/Regression/Transforms/InstCombine/rem.ll:1.11 
llvm/test/Regression/Transforms/InstCombine/rem.ll:1.12
--- llvm/test/Regression/Transforms/InstCombine/rem.ll:1.11 Mon Feb 27 
23:48:56 2006
+++ llvm/test/Regression/Transforms/InstCombine/rem.ll  Thu Mar  2 00:50:04 2006
@@ -60,3 +60,20 @@
%C = rem uint %B, 62 
ret uint %C
 }
+
+int %test10(ubyte %c) {
+%tmp.1 = cast ubyte %c to int
+%tmp.2 = mul int %tmp.1, 3
+%tmp.3 = cast int %tmp.2 to ulong
+%tmp.5 = rem ulong %tmp.3, 3
+%tmp.6 = cast ulong %tmp.5 to int
+ret int %tmp.6
+}
+
+int %test11(int %i) {
+%tmp.1 = and int %i, -2
+%tmp.3 = mul int %tmp.1, 3
+%tmp.5 = rem int %tmp.3, 6
+ret int %tmp.5
+}
+



___
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

2006-03-01 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.445 -> 1.446
---
Log message:

Generalize the REM folding code to handle another case Nick Lewycky
pointed out: realize the AND can provide factors and look through Casts.


---
Diffs of the changes:  (+43 -13)

 InstructionCombining.cpp |   56 ---
 1 files changed, 43 insertions(+), 13 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.445 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.446
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.445   Tue Feb 28 
13:47:20 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Mar  2 00:50:58 2006
@@ -1812,6 +1812,45 @@
 }
 
 
+/// GetFactor - If we can prove that the specified value is at least a multiple
+/// of some factor, return that factor.
+static Constant *GetFactor(Value *V) {
+  if (ConstantInt *CI = dyn_cast(V))
+return CI;
+  
+  // Unless we can be tricky, we know this is a multiple of 1.
+  Constant *Result = ConstantInt::get(V->getType(), 1);
+  
+  Instruction *I = dyn_cast(V);
+  if (!I) return Result;
+  
+  if (I->getOpcode() == Instruction::Mul) {
+// Handle multiplies by a constant, etc.
+return ConstantExpr::getMul(GetFactor(I->getOperand(0)),
+GetFactor(I->getOperand(1)));
+  } else if (I->getOpcode() == Instruction::Shl) {
+// (X< X * (1 << C)
+if (Constant *ShRHS = dyn_cast(I->getOperand(1))) {
+  ShRHS = ConstantExpr::getShl(Result, ShRHS);
+  return ConstantExpr::getMul(GetFactor(I->getOperand(0)), ShRHS);
+}
+  } else if (I->getOpcode() == Instruction::And) {
+if (ConstantInt *RHS = dyn_cast(I->getOperand(1))) {
+  // X & 0xFFF0 is known to be a multiple of 16.
+  unsigned Zeros = CountTrailingZeros_64(RHS->getZExtValue());
+  if (Zeros != V->getType()->getPrimitiveSizeInBits())
+return ConstantExpr::getShl(Result, 
+ConstantUInt::get(Type::UByteTy, Zeros));
+}
+  } else if (I->getOpcode() == Instruction::Cast) {
+Value *Op = I->getOperand(0);
+// Only handle int->int casts.
+if (!Op->getType()->isInteger()) return Result;
+return ConstantExpr::getCast(GetFactor(Op), V->getType());
+  }
+  return Result;
+}
+
 Instruction *InstCombiner::visitRem(BinaryOperator &I) {
   Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
   
@@ -1874,20 +1913,11 @@
   } else if (isa(Op0I)) {
 if (Instruction *NV = FoldOpIntoPhi(I))
   return NV;
-  } else if (Op0I->getOpcode() == Instruction::Mul) {
-// X*C1%C2 --> 0  iff  C1%C2 == 0
-if (ConstantInt *MulRHS = dyn_cast(Op0I->getOperand(1))) {
-  if (ConstantExpr::getRem(MulRHS, RHS)->isNullValue())
-return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
-}
-  } else if (Op0I->getOpcode() == Instruction::Shl) {
-// (X< 0  iff  (1<(Op0I->getOperand(1))) {
-  ShRHS = ConstantExpr::getShl(ConstantInt::get(I.getType(), 1), 
ShRHS);
-  if (ConstantExpr::getRem(ShRHS, RHS)->isNullValue())
-return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
-}
   }
+  
+  // X*C1%C2 --> 0  iff  C1%C2 == 0
+  if (ConstantExpr::getRem(GetFactor(Op0I), RHS)->isNullValue())
+return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
 }
   }
 



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