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

2006-11-30 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

DwarfWriter.cpp updated: 1.103 -> 1.104
---
Log message:

Temp fix to deal gdb issue.

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

 DwarfWriter.cpp |7 ++-
 1 files changed, 6 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.103 
llvm/lib/CodeGen/DwarfWriter.cpp:1.104
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.103  Wed Nov 29 10:55:57 2006
+++ llvm/lib/CodeGen/DwarfWriter.cppThu Nov 30 05:09:42 2006
@@ -2198,7 +2198,8 @@
 unsigned ContentSize = Die->getSize() +
sizeof(int16_t) + // DWARF version number
sizeof(int32_t) + // Offset Into Abbrev. Section
-   sizeof(int8_t);   // Pointer Size (in bytes)
+   sizeof(int8_t) +  // Pointer Size (in bytes)
+   sizeof(int32_t);  // FIXME - extra pad for gdb bug.

 EmitInt32(ContentSize);  EOL("Length of Compilation Unit Info");
 EmitInt16(DWARF_VERSION); EOL("DWARF version number");
@@ -2207,6 +2208,10 @@
 EmitInt8(TAI->getAddressSize()); EOL("Address Size (in bytes)");
   
 EmitDIE(Die);
+EmitInt8(0); EOL("Extra Pad For GDB"); // FIXME - extra pad for gdb bug.
+EmitInt8(0); EOL("Extra Pad For GDB"); // FIXME - extra pad for gdb bug.
+EmitInt8(0); EOL("Extra Pad For GDB"); // FIXME - extra pad for gdb bug.
+EmitInt8(0); EOL("Extra Pad For GDB"); // FIXME - extra pad for gdb bug.
 EmitLabel("info_end", Unit->getID());
 
 O << "\n";



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


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

2006-11-30 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

MachineDebugInfo.cpp updated: 1.60 -> 1.61
DwarfWriter.cpp updated: 1.104 -> 1.105
---
Log message:

Change global descriptor names to provide name, full name and linkage name.


---
Diffs of the changes:  (+35 -36)

 DwarfWriter.cpp  |   59 +++
 MachineDebugInfo.cpp |   12 ++
 2 files changed, 35 insertions(+), 36 deletions(-)


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.60 
llvm/lib/CodeGen/MachineDebugInfo.cpp:1.61
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.60  Sun Nov 26 19:05:09 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp   Thu Nov 30 08:35:45 2006
@@ -1048,7 +1048,8 @@
 : AnchoredDesc(T)
 , Context(0)
 , Name("")
-, DisplayName("")
+, FullName("")
+, LinkageName("")
 , File(NULL)
 , Line(0)
 , TyDesc(NULL)
@@ -1063,7 +1064,8 @@
 
   Visitor->Apply(Context);
   Visitor->Apply(Name);
-  if (getVersion() > LLVMDebugVersion4) Visitor->Apply(DisplayName);
+  Visitor->Apply(FullName);
+  Visitor->Apply(LinkageName);
   Visitor->Apply(File);
   Visitor->Apply(Line);
   Visitor->Apply(TyDesc);
@@ -1117,7 +1119,8 @@
 << "Tag(" << getTag() << "), "
 << "Anchor(" << getAnchor() << "), "
 << "Name(\"" << getName() << "\"), "
-<< "DisplayName(\"" << getDisplayName() << "\"), "
+<< "FullName(\"" << getFullName() << "\"), "
+<< "LinkageName(\"" << getLinkageName() << "\"), "
 << "File(" << getFile() << "),"
 << "Line(" << getLine() << "),"
 << "Type(" << getType() << "), "
@@ -1170,7 +1173,8 @@
 << "Tag(" << getTag() << "), "
 << "Anchor(" << getAnchor() << "), "
 << "Name(\"" << getName() << "\"), "
-<< "DisplayName(\"" << getDisplayName() << "\"), "
+<< "FullName(\"" << getFullName() << "\"), "
+<< "LinkageName(\"" << getLinkageName() << "\"), "
 << "File(" << getFile() << "),"
 << "Line(" << getLine() << "),"
 << "Type(" << getType() << "), "


Index: llvm/lib/CodeGen/DwarfWriter.cpp
diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.104 
llvm/lib/CodeGen/DwarfWriter.cpp:1.105
--- llvm/lib/CodeGen/DwarfWriter.cpp:1.104  Thu Nov 30 05:09:42 2006
+++ llvm/lib/CodeGen/DwarfWriter.cppThu Nov 30 08:35:45 2006
@@ -1587,11 +1587,13 @@
 DIE *Static = new DIE(DW_TAG_variable);
 
 // Add name and mangled name.
-const std::string &Name = StaticDesc->getDisplayName();
-const std::string &MangledName = StaticDesc->getName();
+const std::string &Name = StaticDesc->getName();
+const std::string &LinkageName = StaticDesc->getLinkageName();
 AddString(Static, DW_AT_name, DW_FORM_string, Name);
-AddString(Static, DW_AT_MIPS_linkage_name, DW_FORM_string,
-  MangledName);
+if (!LinkageName.empty()) {
+  AddString(Static, DW_AT_MIPS_linkage_name, DW_FORM_string,
+LinkageName);
+}
 
 // Add location.
 AddSourceLine(Static, StaticDesc->getFile(), 
StaticDesc->getLine());
@@ -1613,17 +1615,15 @@
 DIE *Method = new DIE(DW_TAG_subprogram);

 // Add name and mangled name.
-const std::string &Name = MethodDesc->getDisplayName();
-const std::string &MangledName = MethodDesc->getName();
-bool IsCTor = false;
+const std::string &Name = MethodDesc->getName();
+const std::string &LinkageName = MethodDesc->getLinkageName();
+
+AddString(Method, DW_AT_name, DW_FORM_string, Name);
+bool IsCTor = TyDesc->getName() == Name;
 
-if (Name.empty()) {
-  AddString(Method, DW_AT_name, DW_FORM_string, MangledName);  
  
-  IsCTor = TyDesc->getName() == MangledName;
-} else {
-  AddString(Method, DW_AT_name, DW_FORM_string, Name);
+if (!LinkageName.empty()) {
   AddString(Method, DW_AT_MIPS_linkage_name, DW_FORM_string,
-MangledName);
+LinkageName);
 }
 
 // Add location.
@@ -1752,16 +1752,15 @@
 // Get the global variable itself.
 GlobalVariable *GV = GVD->getGlobalVariable();
 
-const std::string &Name = GVD->hasMangledName() ? GVD->getDisplayName()
-: GVD->getName();
-const std::string &MangledName = GVD->hasMangledName() ? GVD->getName()
-   : "";
+const std::string &Name = GVD->getName();
+const std::string &FullName = GVD->getFullName();
+const std::string &Lin

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

2006-11-30 Thread Jim Laskey


Changes in directory llvm/include/llvm/CodeGen:

MachineDebugInfo.h updated: 1.46 -> 1.47
---
Log message:

Change global descriptor names to provide name, full name and linkage name.


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

 MachineDebugInfo.h |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h
diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.46 
llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.47
--- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.46   Wed Nov  8 08:16:39 2006
+++ llvm/include/llvm/CodeGen/MachineDebugInfo.hThu Nov 30 08:35:45 2006
@@ -53,7 +53,8 @@
 // Debug info constants.
 
 enum {
-  LLVMDebugVersion = (5 << 16), // Current version of debug 
information.
+  LLVMDebugVersion = (6 << 16), // Current version of debug 
information.
+  LLVMDebugVersion5 = (5 << 16),// Constant for version 5.
   LLVMDebugVersion4 = (4 << 16),// Constant for version 4.
   LLVMDebugVersionMask = 0x // Mask for version number.
 };
@@ -582,7 +583,8 @@
 private:
   DebugInfoDesc *Context;   // Context debug descriptor.
   std::string Name; // Global name.
-  std::string DisplayName;  // C++ unmangled name.
+  std::string FullName; // Fully qualified name.
+  std::string LinkageName;  // Name for binding to MIPS linkage.
   DebugInfoDesc *File;  // Defined compile unit (may be NULL.)
   unsigned Line;// Defined line# (may be zero.)
   DebugInfoDesc *TyDesc;// Type debug descriptor.
@@ -596,7 +598,8 @@
   // Accessors
   DebugInfoDesc *getContext()const { return Context; }
   const std::string &getName()   const { return Name; }
-  const std::string &getDisplayName()const { return DisplayName; }
+  const std::string &getFullName()   const { return FullName; }
+  const std::string &getLinkageName()const { return LinkageName; }
   CompileUnitDesc *getFile() const {
 return static_cast(File);
   }
@@ -608,7 +611,8 @@
   bool isDefinition()const { return IsDefinition; }
   void setContext(DebugInfoDesc *C){ Context = C; }
   void setName(const std::string &N)   { Name = N; }
-  void setDisplayName(const std::string &N){ DisplayName = N; }
+  void setFullName(const std::string &N)   { FullName = N; }
+  void setLinkageName(const std::string &N){ LinkageName = N; }
   void setFile(CompileUnitDesc *U) {
 File = static_cast(U);
   }
@@ -618,9 +622,6 @@
   }
   void setIsStatic(bool IS){ IsStatic = IS; }
   void setIsDefinition(bool ID){ IsDefinition = ID; }
-  bool hasMangledName()  const {
-return !DisplayName.empty();
-  }
 
   /// ApplyToFields - Target the visitor to the fields of the GlobalDesc.
   ///



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


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

2006-11-30 Thread Jim Laskey


Changes in directory llvm/docs:

SourceLevelDebugging.html updated: 1.25 -> 1.26
---
Log message:

Update docs

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

 SourceLevelDebugging.html |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)


Index: llvm/docs/SourceLevelDebugging.html
diff -u llvm/docs/SourceLevelDebugging.html:1.25 
llvm/docs/SourceLevelDebugging.html:1.26
--- llvm/docs/SourceLevelDebugging.html:1.25Mon Aug 21 17:57:31 2006
+++ llvm/docs/SourceLevelDebugging.html Thu Nov 30 08:36:22 2006
@@ -389,7 +389,8 @@
 {  }*,  ;; Global variable anchor = cast (%llvm.dbg.anchor.type* %llvm.dbg.global_variables to {  }*),  
 {  }*,  ;; Reference to context descriptor
 sbyte*, ;; Name
-sbyte*, ;; Display name (unmangled name if Name is the C++ mangled name)
+sbyte*, ;; Display name (fully qualified C++ name)
+sbyte*, ;; MIPS linkage name (for C++)
 {  }*,  ;; Reference to compile unit where defined
 uint,   ;; Line number where defined
 {  }*,  ;; Reference to type descriptor
@@ -417,7 +418,8 @@
 {  }*,  ;; Subprogram anchor = cast (%llvm.dbg.anchor.type* %llvm.dbg.subprograms to {  }*),  
 {  }*,  ;; Reference to context descriptor
 sbyte*, ;; Name
-sbyte*, ;; Display name (unmangled name if Name is the C++ mangled name)
+sbyte*, ;; Display name (fully qualified C++ name)
+sbyte*, ;; MIPS linkage name (for C++)
 {  }*,  ;; Reference to compile unit where defined
 uint,   ;; Line number where defined
 {  }*,  ;; Reference to type descriptor
@@ -1773,7 +1775,7 @@
 
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>LLVM Compiler Infrastructure
-  Last modified: $Date: 2006/08/21 22:57:31 $
+  Last modified: $Date: 2006/11/30 14:36:22 $
 
 
 



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


[llvm-commits] [llvm-gcc4] gcc/llvm-debug.cpp

2006-11-30 Thread Jim Laskey

Index: gcc/llvm-debug.cpp
===
--- gcc/llvm-debug.cpp  (revision 120721)
+++ gcc/llvm-debug.cpp  (working copy)
@@ -182,18 +182,19 @@
   return Location;
}
-/// GetGlobalName - Returns the name and mangled name of a global  
item (function

-/// or global variable.)
-static void GetGlobalName(tree Node, const char *&name, const char  
*&asmname) {

+/// GetGlobalNames - Sets the names for a global descriptor.
+///
+static void GetGlobalNames(tree Node, GlobalDesc *Global) {
   tree decl_name = DECL_NAME(Node);
   if (decl_name != NULL && IDENTIFIER_POINTER (decl_name) != NULL) {
-  name = lang_hooks.decl_printable_name (Node, 0);
-
-  if (TREE_PUBLIC(Node) &&
-  DECL_ASSEMBLER_NAME(Node) != DECL_NAME(Node) &&
-  !DECL_ABSTRACT(Node)) {
-  asmname = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(Node));
-  }
+Global->setName(lang_hooks.decl_printable_name (Node, 0));
+Global->setFullName(lang_hooks.decl_printable_name (Node, 1));
+
+if (TREE_PUBLIC(Node) &&
+DECL_ASSEMBLER_NAME(Node) != DECL_NAME(Node) &&
+!DECL_ABSTRACT(Node)) {
+Global->setLinkageName(IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME 
(Node)));

+}
   }
}
@@ -255,9 +256,7 @@
   }
   // Get name information.
-  const char *name = "";
-  const char *asmname = "";
-  GetGlobalName(FnDecl, name, asmname);
+  GetGlobalNames(FnDecl, Subprogram);

   // Gather location information.
   CompileUnitDesc *Unit = getOrCreateCompileUnit(CurFullPath);
@@ -267,12 +266,6 @@
   Subprogram->setAnchor(SubprogramAnchor);
   Subprogram->setContext(Unit);
-  if (*asmname != '\0') {
-Subprogram->setName(asmname);
-Subprogram->setDisplayName(name);
-  } else {
-Subprogram->setName(name);
-  }
   Subprogram->setFile(Unit);
   Subprogram->setLine(CurLineNo);
   Subprogram->setType(SPTy);
@@ -411,9 +404,7 @@
   }

   // Get name information.
-  const char *name = "";
-  const char *asmname = "";
-  GetGlobalName(decl, name, asmname);
+  GetGlobalNames(decl, Global);
   // Gather location information.
   expanded_location location = expand_location(DECL_SOURCE_LOCATION 
(decl));

@@ -424,12 +415,6 @@
   // Fill in the blanks.
   Global->setAnchor(GlobalVariableAnchor);
   Global->setContext(Unit);
-  if (*asmname != '\0') {
-Global->setName(asmname);
-Global->setDisplayName(name);
-  } else {
-Global->setName(name);
-  }
   Global->setFile(Unit);
   Global->setLine(location.line);
   Global->setType(TyD);
@@ -726,20 +711,12 @@
   GlobalVariableDesc *Static = new GlobalVariableDesc();
   // Get name information.
-  const char *Name = "";
-  const char *ASMName = "";
-  GetGlobalName(Member, Name, ASMName);
+  GetGlobalNames(Member, Static);
   TypeDesc *TyD = getOrCreateType(TREE_TYPE(Member), Unit);

   // Fill in the blanks.
   Static->setContext(Unit);
-  if (*ASMName != '\0') {
-Static->setName(ASMName);
-Static->setDisplayName(Name);
-  } else {
-Static->setName(Name);
-  }
   Static->setFile(MemFile);
   Static->setLine(MemLoc.line);
   Static->setType(TyD);
@@ -760,9 +737,7 @@
 Subprogram = new SubprogramDesc();

 // Get name information.
-const char *name = "";
-const char *asmname = "";
-GetGlobalName(Member, name, asmname);
+GetGlobalNames(Member, Subprogram);

 // Get function type.
 TypeDesc *SPTy = getOrCreateType(TREE_TYPE(Member), Unit);
@@ -774,12 +749,6 @@
 }
 Subprogram->setContext(Unit);
-if (*asmname != '\0') {
-  Subprogram->setName(asmname);
-  Subprogram->setDisplayName(name);
-} else {
-  Subprogram->setName(name);
-}
 Subprogram->setFile(Unit);
 Subprogram->setLine(CurLineNo);
 Subprogram->setType(SPTy);



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


[llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-30-Pubnames.cpp

2006-11-30 Thread Jim Laskey


Changes in directory llvm/test/Regression/DebugInfo:

2006-11-30-Pubnames.cpp updated: 1.1 -> 1.2
---
Log message:

Correct comment

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

 2006-11-30-Pubnames.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/test/Regression/DebugInfo/2006-11-30-Pubnames.cpp
diff -u llvm/test/Regression/DebugInfo/2006-11-30-Pubnames.cpp:1.1 
llvm/test/Regression/DebugInfo/2006-11-30-Pubnames.cpp:1.2
--- llvm/test/Regression/DebugInfo/2006-11-30-Pubnames.cpp:1.1  Thu Nov 30 
09:25:59 2006
+++ llvm/test/Regression/DebugInfo/2006-11-30-Pubnames.cpp  Thu Nov 30 
09:31:49 2006
@@ -1,5 +1,5 @@
-// This is a regression test on debug info to make sure that we can get a
-// meaningful stack trace from a C++ program.
+// This is a regression test on debug info to make sure that we can access 
+// qualified global names.
 // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc --disable-fp-elim -o 
Output/Pubnames.s -f
 // RUN: as Output/Pubnames.s -o Output/Pubnames.o
 // RUN: g++ Output/Pubnames.o -o Output/Pubnames.exe



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


[llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-30-Pubnames.cpp

2006-11-30 Thread Jim Laskey


Changes in directory llvm/test/Regression/DebugInfo:

2006-11-30-Pubnames.cpp added (r1.1)
---
Log message:

Pubnames test

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

 2006-11-30-Pubnames.cpp |   19 +++
 1 files changed, 19 insertions(+)


Index: llvm/test/Regression/DebugInfo/2006-11-30-Pubnames.cpp
diff -c /dev/null llvm/test/Regression/DebugInfo/2006-11-30-Pubnames.cpp:1.1
*** /dev/null   Thu Nov 30 09:26:09 2006
--- llvm/test/Regression/DebugInfo/2006-11-30-Pubnames.cpp  Thu Nov 30 
09:25:59 2006
***
*** 0 
--- 1,19 
+ // This is a regression test on debug info to make sure that we can get a
+ // meaningful stack trace from a C++ program.
+ // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc --disable-fp-elim -o 
Output/Pubnames.s -f
+ // RUN: as Output/Pubnames.s -o Output/Pubnames.o
+ // RUN: g++ Output/Pubnames.o -o Output/Pubnames.exe
+ // RUN: ( echo "break main"; echo "run" ; echo "p Pubnames::pubname" ) > 
Output/Pubnames.gdbin 
+ // RUN: gdb -q -batch -n -x Output/Pubnames.gdbin Output/Pubnames.exe | tee 
Output/Pubnames.out | grep '10'
+ // XFAIL: i[1-9]86|alpha|ia64|arm
+ 
+ struct Pubnames {
+   static int pubname;
+ };
+ 
+ int Pubnames::pubname = 10;
+ 
+ int main (int argc, char** argv) {
+   Pubnames p;
+   return 0;
+ }



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


[llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-30-NoCompileUnit.cpp

2006-11-30 Thread Jim Laskey


Changes in directory llvm/test/Regression/DebugInfo:

2006-11-30-NoCompileUnit.cpp added (r1.1)
---
Log message:

Add compile unit size test

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

 2006-11-30-NoCompileUnit.cpp |   58 +++
 1 files changed, 58 insertions(+)


Index: llvm/test/Regression/DebugInfo/2006-11-30-NoCompileUnit.cpp
diff -c /dev/null 
llvm/test/Regression/DebugInfo/2006-11-30-NoCompileUnit.cpp:1.1
*** /dev/null   Thu Nov 30 09:36:54 2006
--- llvm/test/Regression/DebugInfo/2006-11-30-NoCompileUnit.cpp Thu Nov 30 
09:36:44 2006
***
*** 0 
--- 1,58 
+ // This is a regression test on debug info to make sure we don't hit a 
compile unit size
+ // issue with gdb.
+ // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc --disable-fp-elim -o 
Output/NoCompileUnit.s -f
+ // RUN: as Output/NoCompileUnit.s -o Output/NoCompileUnit.o
+ // RUN: g++ Output/NoCompileUnit.o -o Output/NoCompileUnit.exe
+ // RUN: ( echo "break main"; echo "run" ; echo "p NoCompileUnit::pubname" ) > 
Output/NoCompileUnit.gdbin 
+ // RUN: gdb -q -batch -n -x Output/NoCompileUnit.gdbin 
Output/NoCompileUnit.exe | tee Output/NoCompileUnit.out | not grep '"low == 
high"'
+ // XFAIL: i[1-9]86|alpha|ia64|arm
+ 
+ 
+ class MamaDebugTest {
+ private:
+   int N;
+   
+ protected:
+   MamaDebugTest(int n) : N(n) {}
+   
+   int getN() const { return N; }
+ 
+ };
+ 
+ class BabyDebugTest : public MamaDebugTest {
+ private:
+ 
+ public:
+   BabyDebugTest(int n) : MamaDebugTest(n) {}
+   
+   static int doh;
+   
+   int  doit() {
+ int N = getN();
+ int Table[N];
+ 
+ int sum = 0;
+ 
+ for (int i = 0; i < N; ++i) {
+   int j = i;
+   Table[i] = j;
+ }
+ for (int i = 0; i < N; ++i) {
+   int j = Table[i];
+   sum += j;
+ }
+ 
+ return sum;
+   }
+ 
+ };
+ 
+ int BabyDebugTest::doh;
+ 
+ 
+ int main(int argc, const char *argv[]) {
+   BabyDebugTest BDT(20);
+   return BDT.doit();
+ }
+ 
+ 



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


[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp

2006-11-30 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

GlobalOpt.cpp updated: 1.73 -> 1.74
---
Log message:

Fix a bug in globalopt due to the recent cast patch.


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

 GlobalOpt.cpp |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.73 
llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.74
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.73  Sun Nov 26 19:05:10 2006
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp   Thu Nov 30 11:26:08 2006
@@ -1713,7 +1713,8 @@
  getVal(Values, SI->getOperand(0)),
  getVal(Values, SI->getOperand(1)));
 } else if (CastInst *CI = dyn_cast(CurInst)) {
-  InstResult = ConstantExpr::getCast(getVal(Values, CI->getOperand(0)),
+  InstResult = ConstantExpr::getCast(CI->getOpcode(),
+ getVal(Values, CI->getOperand(0)),
  CI->getType());
 } else if (SelectInst *SI = dyn_cast(CurInst)) {
   InstResult = ConstantExpr::getSelect(getVal(Values, SI->getOperand(0)),



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


[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp

2006-11-30 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

GlobalOpt.cpp updated: 1.75 -> 1.76
---
Log message:

make it clear that this is always a zext


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

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


Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.75 
llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.76
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.75  Thu Nov 30 11:32:29 2006
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp   Thu Nov 30 11:35:08 2006
@@ -1177,7 +1177,7 @@
   LoadInst *NLI = new LoadInst(NewGV, Name+".b", LI);
   Value *NSI;
   if (IsOneZero)
-NSI = CastInst::createInferredCast(NLI, LI->getType(), Name, LI);
+NSI = new ZExtInst(NLI, LI->getType(), Name, LI);
   else
 NSI = new SelectInst(NLI, OtherVal, InitVal, Name, LI);
   LI->replaceAllUsesWith(NSI);



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


[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp

2006-11-30 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

GlobalOpt.cpp updated: 1.74 -> 1.75
---
Log message:

One more bugfix, 3 cases of making casts explicit.


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

 GlobalOpt.cpp |   13 -
 1 files changed, 8 insertions(+), 5 deletions(-)


Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.74 
llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.75
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.74  Thu Nov 30 11:26:08 2006
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp   Thu Nov 30 11:32:29 2006
@@ -572,7 +572,8 @@
   }
 } else if (CastInst *CI = dyn_cast(I)) {
   Changed |= OptimizeAwayTrappingUsesOfValue(CI,
-ConstantExpr::getCast(NewV, 
CI->getType()));
+ConstantExpr::getCast(CI->getOpcode(),
+  NewV, CI->getType()));
   if (CI->use_empty()) {
 Changed = true;
 CI->eraseFromParent();
@@ -670,7 +671,7 @@
 /// variable, and transforms the program as if it always contained the result 
of
 /// the specified malloc.  Because it is always the result of the specified
 /// malloc, there is no reason to actually DO the malloc.  Instead, turn the
-/// malloc into a global, and any laods of GV as uses of the new global.
+/// malloc into a global, and any loads of GV as uses of the new global.
 static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
  MallocInst *MI) {
   DOUT << "PROMOTING MALLOC GLOBAL: " << *GV << "  MALLOC = " << *MI;
@@ -707,7 +708,8 @@
 
   Constant *RepValue = NewGV;
   if (NewGV->getType() != GV->getType()->getElementType())
-RepValue = ConstantExpr::getCast(RepValue, 
GV->getType()->getElementType());
+RepValue = ConstantExpr::getCast(Instruction::BitCast,
+ RepValue, 
GV->getType()->getElementType());
 
   // If there is a comparison against null, we will insert a global bool to
   // keep track of whether the global was initialized yet or not.
@@ -1056,7 +1058,8 @@
   GV->getInitializer()->isNullValue()) {
 if (Constant *SOVC = dyn_cast(StoredOnceVal)) {
   if (GV->getInitializer()->getType() != SOVC->getType())
-SOVC = ConstantExpr::getCast(SOVC, GV->getInitializer()->getType());
+SOVC = ConstantExpr::getCast(Instruction::BitCast,
+ SOVC, GV->getInitializer()->getType());
 
   // Optimize away any trapping uses of the loaded value.
   if (OptimizeAwayTrappingUsesOfLoads(GV, SOVC))
@@ -1507,7 +1510,7 @@
   if (!GCL->use_empty()) {
 Constant *V = NGV;
 if (V->getType() != GCL->getType())
-  V = ConstantExpr::getCast(V, GCL->getType());
+  V = ConstantExpr::getCast(Instruction::BitCast, V, GCL->getType());
 GCL->replaceAllUsesWith(V);
   }
   GCL->eraseFromParent();



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


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

2006-11-30 Thread Jim Laskey


Changes in directory llvm/lib/CodeGen:

MachineDebugInfo.cpp updated: 1.61 -> 1.62
---
Log message:

better check for version

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

 MachineDebugInfo.cpp |   16 ++--
 1 files changed, 14 insertions(+), 2 deletions(-)


Index: llvm/lib/CodeGen/MachineDebugInfo.cpp
diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.61 
llvm/lib/CodeGen/MachineDebugInfo.cpp:1.62
--- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.61  Thu Nov 30 08:35:45 2006
+++ llvm/lib/CodeGen/MachineDebugInfo.cpp   Thu Nov 30 12:29:23 2006
@@ -1390,11 +1390,23 @@
 return false;
   }
 
-  // Get the Tag
+  // Get the Tag.
   unsigned Tag = DebugInfoDesc::TagFromGlobal(GV);
   
   // Check for user defined descriptors.
-  if (Tag == DW_TAG_invalid) return true;
+  if (Tag == DW_TAG_invalid) {
+ValiditySlot = Valid;
+return true;
+  }
+  
+  // Get the Version.
+  unsigned Version = DebugInfoDesc::VersionFromGlobal(GV);
+  
+  // Check for version mismatch.
+  if (Version != LLVMDebugVersion) {
+ValiditySlot = Invalid;
+return false;
+  }
 
   // Construct an empty DebugInfoDesc.
   DebugInfoDesc *DD = DebugInfoDesc::DescFactory(Tag);



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


[llvm-commits] CVS: llvm-www/poll/inc/core.inc.php

2006-11-30 Thread Reid Spencer


Changes in directory llvm-www/poll/inc:

core.inc.php updated: 1.1 -> 1.2
---
Log message:

Increase the cookie timeout to 100 days.


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

 core.inc.php |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm-www/poll/inc/core.inc.php
diff -u llvm-www/poll/inc/core.inc.php:1.1 llvm-www/poll/inc/core.inc.php:1.2
--- llvm-www/poll/inc/core.inc.php:1.1  Wed Nov 29 13:29:07 2006
+++ llvm-www/poll/inc/core.inc.php  Thu Nov 30 15:28:05 2006
@@ -70,7 +70,7 @@
   */
   $script_version  = '1.8';
 
-  $time_range  = '1440';// Minutes (60 minutes * 24 hours = 
1440 minutes)
+  $time_range  = '144000'; // Minutes (60 minutes * 24 hours = 
1440 minutes)
   $number_decimals = '2';
   $hide_results= false; // true, false
   $sort_results= 0; // 0 = off
@@ -692,4 +692,4 @@
 
 
 
-?>
\ No newline at end of file
+?>



___
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/X86ISelDAGToDAG.cpp X86ISelLowering.cpp X86ISelLowering.h X86InstrInfo.td X86InstrX86-64.td

2006-11-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelDAGToDAG.cpp updated: 1.132 -> 1.133
X86ISelLowering.cpp updated: 1.298 -> 1.299
X86ISelLowering.h updated: 1.80 -> 1.81
X86InstrInfo.td updated: 1.295 -> 1.296
X86InstrX86-64.td updated: 1.8 -> 1.9
---
Log message:

- Use a different wrapper node for RIP-relative GV, etc.
- Proper support for both small static and PIC modes under X86-64
- Some (non-optimal) support for medium modes.

---
Diffs of the changes:  (+81 -62)

 X86ISelDAGToDAG.cpp |   64 
 X86ISelLowering.cpp |   43 +-
 X86ISelLowering.h   |4 +++
 X86InstrInfo.td |5 +++-
 X86InstrX86-64.td   |   27 +
 5 files changed, 81 insertions(+), 62 deletions(-)


Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.132 
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.133
--- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.132   Wed Nov 29 17:46:27 2006
+++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Thu Nov 30 15:55:46 2006
@@ -590,63 +590,19 @@
 break;
   }
 
-  case ISD::TargetConstantPool:
-if (AM.BaseType == X86ISelAddressMode::RegBase &&
-AM.Base.Reg.Val == 0 &&
-AM.CP == 0) {
-  ConstantPoolSDNode *CP = cast(N);
-  AM.CP = CP->getConstVal();
-  AM.Align = CP->getAlignment();
-  AM.Disp += CP->getOffset();
-  return false;
-}
-break;
-
-  case ISD::TargetGlobalAddress:
-if (AM.BaseType == X86ISelAddressMode::RegBase &&
-AM.Base.Reg.Val == 0 &&
-AM.GV == 0) {
-  GlobalAddressSDNode *G = cast(N);
-  AM.GV = G->getGlobal();
-  AM.Disp += G->getOffset();
-  return false;
-}
-break;
-
-  case ISD::TargetExternalSymbol:
-if (isRoot &&
-AM.BaseType == X86ISelAddressMode::RegBase &&
-AM.Base.Reg.Val == 0) {
-  ExternalSymbolSDNode *S = cast(N.getOperand(0));
-  AM.ES = S->getSymbol();
-  return false;
-}
-break;
-
-  case ISD::TargetJumpTable:
-if (isRoot &&
-AM.BaseType == X86ISelAddressMode::RegBase &&
-AM.Base.Reg.Val == 0) {
-  JumpTableSDNode *J = cast(N.getOperand(0));
-  AM.JT = J->getIndex();
-  return false;
-}
-break;
-
   case X86ISD::Wrapper:
+  case X86ISD::WrapperRIP: {
+bool isRIP = N.getOpcode() == X86ISD::WrapperRIP;
+// Under X86-64 non-small code model, GV (and friends) are 64-bits.
+if (!isRIP && Subtarget->is64Bit() && TM.getCodeModel() != 
CodeModel::Small)
+  break;
+
 // If value is available in a register both base and index components have
 // been picked, we can't fit the result available in the register in the
 // addressing mode. Duplicate GlobalAddress or ConstantPool as 
displacement.
-
-// Can't fit GV or CP in addressing mode for X86-64 medium or large code
-// model since the displacement field is 32-bit. Ok for small code model.
-
-// For X86-64 PIC code, only allow GV / CP + displacement so we can use RIP
-// relative addressing mode.
-if (Subtarget->is64Bit() && TM.getCodeModel() != CodeModel::Small)
-  break;
 if (!Available || (AM.Base.Reg.Val && AM.IndexReg.Val)) {
-  bool isRIP = Subtarget->is64Bit();
+  // For X86-64 PIC code, only allow GV / CP + displacement so we can use
+  // RIP relative addressing mode.
   if (isRIP &&
   (AM.Base.Reg.Val || AM.Scale > 1 || AM.IndexReg.Val ||
AM.BaseType == X86ISelAddressMode::FrameIndexBase))
@@ -683,6 +639,7 @@
   }
 }
 break;
+  }
 
   case ISD::FrameIndex:
 if (AM.BaseType == X86ISelAddressMode::RegBase && AM.Base.Reg.Val == 0) {
@@ -1040,7 +997,8 @@
   SDOperand N0 = N.getOperand(0);
   SDOperand N1 = N.getOperand(1);
   if (N.Val->getValueType(0) == PtrVT &&
-  N0.getOpcode() == X86ISD::Wrapper &&
+  (N0.getOpcode() == X86ISD::Wrapper
+   || N0.getOpcode() == X86ISD::WrapperRIP) &&
   N1.getOpcode() == ISD::Constant) {
 unsigned Offset = (unsigned)cast(N1)->getValue();
 SDOperand C(0, 0);


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.298 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.299
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.298   Wed Nov 29 17:48:14 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Nov 30 15:55:46 2006
@@ -3832,8 +3832,15 @@
   SDOperand Result = DAG.getTargetConstantPool(CP->getConstVal(),
getPointerTy(),
CP->getAlignment());
+  // Use X86ISD::WrapperRIP if we are in X86-64 small / medium PIC mode.
+  TargetMachine &tm = getTargetMachine();
+  unsigned WrapperOpcode = (Subtarget->is64Bit() &&
+(tm.getCodeModel() == CodeModel::Small ||
+ tm.getCodeModel() == CodeModel::Medium) &&
+   

[llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/x86-64-mem.ll

2006-11-30 Thread Evan Cheng


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

x86-64-mem.ll added (r1.1)
---
Log message:

Add X86-64 load / store codegen tests.

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

 x86-64-mem.ll |   36 
 1 files changed, 36 insertions(+)


Index: llvm/test/Regression/CodeGen/X86/x86-64-mem.ll
diff -c /dev/null llvm/test/Regression/CodeGen/X86/x86-64-mem.ll:1.1
*** /dev/null   Thu Nov 30 16:07:10 2006
--- llvm/test/Regression/CodeGen/X86/x86-64-mem.ll  Thu Nov 30 16:07:00 2006
***
*** 0 
--- 1,36 
+ ; RUN: llvm-as < %s | llc -march=x86-64 &&
+ ; RUN: llvm-as < %s | llc -march=x86-64 | grep GOTPCREL | wc -l | grep 4 &&
+ ; RUN: llvm-as < %s | llc -march=x86-64 | grep rip | wc -l | grep 6 &&
+ ; RUN: llvm-as < %s | llc -march=x86-64 | grep movq | wc -l | grep 6 &&
+ ; RUN: llvm-as < %s | llc -march=x86-64 | grep leaq | wc -l | grep 1 &&
+ ; RUN: llvm-as < %s | llc -march=x86-64 -relocation-model=static | grep rip | 
wc -l | grep 4 &&
+ ; RUN: llvm-as < %s | llc -march=x86-64 -relocation-model=static | grep movl 
| wc -l | grep 2 &&
+ ; RUN: llvm-as < %s | llc -march=x86-64 -relocation-model=static | grep movq 
| wc -l | grep 2
+ 
+ %ptr = external global int*
+ %src = external global [0 x int]
+ %dst = external global [0 x int]
+ %lptr = internal global int* null
+ %ldst = internal global [500 x int] zeroinitializer, align 32
+ %lsrc = internal global [500 x int] zeroinitializer, align 32
+ %bsrc = internal global [50 x int] zeroinitializer, align 32
+ %bdst = internal global [50 x int] zeroinitializer, align 32
+ 
+ void %test1() {
+   %tmp = load int* getelementptr ([0 x int]* %src, int 0, int 0)
+   store int %tmp, int* getelementptr ([0 x int]* %dst, int 0, int 0)
+   ret void
+ }
+ 
+ void %test2() {
+   store int* getelementptr ([0 x int]* %dst, int 0, int 0), int** %ptr
+   ret void
+ }
+ 
+ void %test3() {
+   store int* getelementptr ([500 x int]* %ldst, int 0, int 0), int** %lptr
+   br label %return
+ 
+ return:
+   ret void
+ }



___
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/X86Subtarget.cpp X86Subtarget.h

2006-11-30 Thread Anton Korobeynikov


Changes in directory llvm/lib/Target/X86:

X86Subtarget.cpp updated: 1.41 -> 1.42
X86Subtarget.h updated: 1.21 -> 1.22
---
Log message:

Factor out GVRequiresExtraLoad() from .h to .cpp


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

 X86Subtarget.cpp |   17 +
 X86Subtarget.h   |   15 ++-
 2 files changed, 19 insertions(+), 13 deletions(-)


Index: llvm/lib/Target/X86/X86Subtarget.cpp
diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.41 
llvm/lib/Target/X86/X86Subtarget.cpp:1.42
--- llvm/lib/Target/X86/X86Subtarget.cpp:1.41   Tue Nov 28 20:00:40 2006
+++ llvm/lib/Target/X86/X86Subtarget.cppThu Nov 30 16:42:55 2006
@@ -27,6 +27,23 @@
 clEnumValEnd));
 
 
+/// True if accessing the GV requires an extra load. For Windows, dllimported
+/// symbols are indirect, loading the value at address GV rather then the
+/// value of GV itself. This means that the GlobalAddress must be in the base
+/// or index register of the address, not the GV offset field.
+bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV, bool 
isDirectCall) const
+{
+  if (isTargetDarwin()) {
+return (!isDirectCall &&
+(GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
+ (GV->isExternal() && !GV->hasNotBeenReadFromBytecode(;
+  } else if (isTargetCygwin() || isTargetWindows()) {
+return (GV->hasDLLImportLinkage());
+  }
+  
+  return false;
+}
+
 /// GetCpuIDAndInfo - Execute the specified cpuid and return the 4 values in 
the
 /// specified arguments.  If we can't run cpuid on the host, return true.
 bool X86::GetCpuIDAndInfo(unsigned value, unsigned *rEAX, unsigned *rEBX,


Index: llvm/lib/Target/X86/X86Subtarget.h
diff -u llvm/lib/Target/X86/X86Subtarget.h:1.21 
llvm/lib/Target/X86/X86Subtarget.h:1.22
--- llvm/lib/Target/X86/X86Subtarget.h:1.21 Mon Nov 20 18:01:06 2006
+++ llvm/lib/Target/X86/X86Subtarget.h  Thu Nov 30 16:42:55 2006
@@ -14,13 +14,13 @@
 #ifndef X86SUBTARGET_H
 #define X86SUBTARGET_H
 
-#include "llvm/GlobalValue.h"
 #include "llvm/Target/TargetSubtarget.h"
 
 #include 
 
 namespace llvm {
 class Module;
+class GlobalValue;
 
 class X86Subtarget : public TargetSubtarget {
 public:
@@ -111,18 +111,7 @@
   /// symbols are indirect, loading the value at address GV rather then the
   /// value of GV itself. This means that the GlobalAddress must be in the base
   /// or index register of the address, not the GV offset field.
-  bool GVRequiresExtraLoad(const GlobalValue* GV, bool isDirectCall) const
-  {
-if (isTargetDarwin()) {
-  return (!isDirectCall &&
-  (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
-   (GV->isExternal() && !GV->hasNotBeenReadFromBytecode(;
-} else if (isTargetCygwin() || isTargetWindows()) {
-  return (GV->hasDLLImportLinkage());
-}
-
-return false;
-  }
+  bool GVRequiresExtraLoad(const GlobalValue* GV, bool isDirectCall) const;
 };
 
 namespace X86 {



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


[llvm-commits] CVS: llvm-test/External/SPEC/CINT2000/252.eon/Makefile

2006-11-30 Thread Reid Spencer


Changes in directory llvm-test/External/SPEC/CINT2000/252.eon:

Makefile updated: 1.14 -> 1.15
---
Log message:

Allow this program to link against the correct llvm-gcc libraries and
thereby not crash in libstdc++.


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

 Makefile |1 +
 1 files changed, 1 insertion(+)


Index: llvm-test/External/SPEC/CINT2000/252.eon/Makefile
diff -u llvm-test/External/SPEC/CINT2000/252.eon/Makefile:1.14 
llvm-test/External/SPEC/CINT2000/252.eon/Makefile:1.15
--- llvm-test/External/SPEC/CINT2000/252.eon/Makefile:1.14  Fri Nov  3 
13:14:05 2006
+++ llvm-test/External/SPEC/CINT2000/252.eon/Makefile   Thu Nov 30 17:02:21 2006
@@ -3,6 +3,7 @@
 STDOUT_FILENAME = cook_log.out
 STDERR_FILENAME = cook_log.err
 FP_ABSTOLERANCE := 0.005
+LINK_WITH_LLVMGCC_LIBS := 1
 
 # Yes, we know this is an old crufty C++ benchmark.  Don't tell us about it 
GCC!
 CPPFLAGS = -include errno.h -Wno-deprecated -Wno-non-template-friend 
-DHAS_ERRLIST -DUSE_STRERROR -DSPEC_STDCPP -DNDEBUG



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


[llvm-commits] CVS: llvm-test/Makefile.programs

2006-11-30 Thread Reid Spencer


Changes in directory llvm-test:

Makefile.programs updated: 1.245 -> 1.246
---
Log message:

Add a facility for linking test programs against the llvm-gcc libraries
that it was produced with. Some programs will use libstdc++.a or libgcc.a
in such a way that it matters which version of those libraries is linked
into the program. Leaving it to the system compiler's discretion can
lead to runtime failures in the test program. So, to ensure that your
test programs link with the right libraries, enable the make variable
LINK_WITH_LLVMGCC_LIBS


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

 Makefile.programs |   20 +---
 1 files changed, 17 insertions(+), 3 deletions(-)


Index: llvm-test/Makefile.programs
diff -u llvm-test/Makefile.programs:1.245 llvm-test/Makefile.programs:1.246
--- llvm-test/Makefile.programs:1.245   Tue Nov 28 01:18:25 2006
+++ llvm-test/Makefile.programs Thu Nov 30 17:00:41 2006
@@ -94,6 +94,18 @@
 RUNSAFELY := $(PROGDIR)/RunSafelyAndStable.sh $(RUNTIMELIMIT) $(EXIT_OK)
 endif
 
+# LLVMGCCLD - This sets up the command to use for linking test programs
+# that were generated with llvm-gcc. Usually $(CC) is sufficient but, 
+# depending on libstdc++ and libgcc.a usage, it may be necessary to ensure
+# that the link is done against llvm-gcc's version of those libraries. If
+# the LINK_WITH_LLVMGCC_LIBS variable is set, then the link is done that
+# way. Unfortunately, this can't help JIT because it is always linked with
+# the libraries of lli.
+LLVMGCCLD := $(CC)
+ifdef LINK_WITH_LLVMGCC_LIBS
+LLVMGCCLD := $(CC) -L$(LLVMGCCDIR)/lib/gcc/$(LLVMGCCARCH) -L$(LLVMGCCDIR)/lib
+endif
+
 ifndef STDIN_FILENAME
 STDIN_FILENAME := /dev/null
 endif
@@ -295,7 +307,7 @@
 
 $(PROGRAMS_TO_TEST:%=Output/%.cbe): \
 Output/%.cbe: Output/%.cbe.c
-   -$(CC) $< $(LDFLAGS) $(CFLAGS) -fno-strict-aliasing -O2 -fno-inline 
$(TARGET_FLAGS) -o $@
+   -$(LLVMGCCLD) $< $(LDFLAGS) $(CFLAGS) -fno-strict-aliasing -O2 
-fno-inline $(TARGET_FLAGS) -o $@
 
 #
 # Compile a linked program to machine code with LLC.
@@ -321,11 +333,13 @@
 #
 $(PROGRAMS_TO_TEST:%=Output/%.llc): \
 Output/%.llc: Output/%.llc.s
-   -$(CC) $(CFLAGS) $< $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(TARGET_FLAGS) 
$(LDFLAGS) -o $@
+   -$(LLVMGCCLD) $(CFLAGS) $< $(LLCLIBS) $(LLCASSEMBLERFLAGS) \
+ $(TARGET_FLAGS) $(LDFLAGS) -o $@
 
 $(PROGRAMS_TO_TEST:%=Output/%.llc-beta): \
 Output/%.llc-beta: Output/%.llc-beta.s
-   -$(CC) $(CFLAGS) $< $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(TARGET_FLAGS) 
$(LDFLAGS) -o $@
+   -$(LLVMGCCLD) $(CFLAGS) $< $(LLCLIBS) $(LLCASSEMBLERFLAGS) \
+ $(TARGET_FLAGS) $(LDFLAGS) -o $@
 
 
 #



___
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-11-30 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.555 -> 1.556
---
Log message:

Remove 4 FIXMEs to hack around cast-to-bool problems which no longer exist.


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

 InstructionCombining.cpp |   49 ++-
 1 files changed, 3 insertions(+), 46 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.555 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.556
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.555   Wed Nov 29 
01:18:39 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Nov 30 17:13:36 2006
@@ -5778,13 +5778,6 @@
   unsigned SrcBitSize = SrcTy->getPrimitiveSizeInBits();
   unsigned DestBitSize = DestTy->getPrimitiveSizeInBits();
 
-  // FIXME. We currently implement cast-to-bool as a setne %X, 0. This is 
-  // because codegen cannot accurately perform a truncate to bool operation.
-  // Something goes wrong in promotion to a larger type. When CodeGen can
-  // handle a proper truncation to bool, this should be removed.
-  if (DestTy == Type::BoolTy)
-return BinaryOperator::createSetNE(Src, Constant::getNullValue(SrcTy)); 
-
   // See if we can simplify any instructions used by the LHS whose sole 
   // purpose is to compute bits we don't care about.
   uint64_t KnownZero = 0, KnownOne = 0;
@@ -6092,35 +6085,11 @@
 }
 
 Instruction *InstCombiner::visitFPToUI(CastInst &CI) {
-  if (Instruction *I = commonCastTransforms(CI))
-return I;
-
-  // FIXME. We currently implement cast-to-bool as a setne %X, 0. This is 
-  // because codegen cannot accurately perform a truncate to bool operation.
-  // Something goes wrong in promotion to a larger type. When CodeGen can
-  // handle a proper truncation to bool, this should be removed.
-  Value *Src = CI.getOperand(0);
-  const Type *SrcTy = Src->getType();
-  const Type *DestTy = CI.getType();
-  if (DestTy == Type::BoolTy)
-return BinaryOperator::createSetNE(Src, Constant::getNullValue(SrcTy)); 
-  return 0;
+  return commonCastTransforms(CI);
 }
 
 Instruction *InstCombiner::visitFPToSI(CastInst &CI) {
-  if (Instruction *I = commonCastTransforms(CI))
-return I;
-
-  // FIXME. We currently implement cast-to-bool as a setne %X, 0. This is 
-  // because codegen cannot accurately perform a truncate to bool operation.
-  // Something goes wrong in promotion to a larger type. When CodeGen can
-  // handle a proper truncation to bool, this should be removed.
-  Value *Src = CI.getOperand(0);
-  const Type *SrcTy = Src->getType();
-  const Type *DestTy = CI.getType();
-  if (DestTy == Type::BoolTy)
-return BinaryOperator::createSetNE(Src, Constant::getNullValue(SrcTy)); 
-  return 0;
+  return commonCastTransforms(CI);
 }
 
 Instruction *InstCombiner::visitUIToFP(CastInst &CI) {
@@ -6132,19 +6101,7 @@
 }
 
 Instruction *InstCombiner::visitPtrToInt(CastInst &CI) {
-  if (Instruction *I = commonCastTransforms(CI))
-return I;
-
-  // FIXME. We currently implement cast-to-bool as a setne %X, 0. This is 
-  // because codegen cannot accurately perform a truncate to bool operation.
-  // Something goes wrong in promotion to a larger type. When CodeGen can
-  // handle a proper truncation to bool, this should be removed.
-  Value *Src = CI.getOperand(0);
-  const Type *SrcTy = Src->getType();
-  const Type *DestTy = CI.getType();
-  if (DestTy == Type::BoolTy)
-return BinaryOperator::createSetNE(Src, Constant::getNullValue(SrcTy)); 
-  return 0;
+  return commonCastTransforms(CI);
 }
 
 Instruction *InstCombiner::visitIntToPtr(CastInst &CI) {



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


[llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp

2006-11-30 Thread Anton Korobeynikov


Changes in directory llvm/lib/Linker:

LinkModules.cpp updated: 1.119 -> 1.120
---
Log message:

Introducing external weak linkage. Darwin codegen should be added later.


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

 LinkModules.cpp |   36 
 1 files changed, 24 insertions(+), 12 deletions(-)


Index: llvm/lib/Linker/LinkModules.cpp
diff -u llvm/lib/Linker/LinkModules.cpp:1.119 
llvm/lib/Linker/LinkModules.cpp:1.120
--- llvm/lib/Linker/LinkModules.cpp:1.119   Mon Nov 27 04:09:12 2006
+++ llvm/lib/Linker/LinkModules.cpp Thu Nov 30 18:25:12 2006
@@ -360,6 +360,7 @@
 // If Src is external or if both Src & Drc are external..  Just link the
 // external globals, we aren't adding anything.
 if (Src->hasDLLImportLinkage()) {
+  // If one of GVs has DLLImport linkage, result should be dllimport'ed.
   if (Dest->isExternal()) {
 LinkFromSrc = true;
 LT = Src->getLinkage();
@@ -379,8 +380,9 @@
 LinkFromSrc = true; // Special cased.
 LT = Src->getLinkage();
   } else if (Src->hasWeakLinkage() || Src->hasLinkOnceLinkage()) {
-// At this point we know that Dest has LinkOnce, External, Weak, DLL* 
linkage.
-if (Dest->hasLinkOnceLinkage() && Src->hasWeakLinkage()) {
+// At this point we know that Dest has LinkOnce, External*, Weak, DLL* 
linkage.
+if ((Dest->hasLinkOnceLinkage() && Src->hasWeakLinkage()) ||
+Dest->hasExternalWeakLinkage()) {
   LinkFromSrc = true;
   LT = Src->getLinkage();
 } else {
@@ -388,16 +390,23 @@
   LT = Dest->getLinkage();
 }
   } else if (Dest->hasWeakLinkage() || Dest->hasLinkOnceLinkage()) {
-// At this point we know that Src has External or DLL* linkage.
-LinkFromSrc = true;
-LT = GlobalValue::ExternalLinkage;
+// At this point we know that Src has External* or DLL* linkage.
+if (Src->hasExternalWeakLinkage()) {
+  LinkFromSrc = false;
+  LT = Dest->getLinkage();
+} else {
+  LinkFromSrc = true;
+  LT = GlobalValue::ExternalLinkage;
+}
   } else {
 assert((Dest->hasExternalLinkage() ||
 Dest->hasDLLImportLinkage() ||
-Dest->hasDLLExportLinkage()) &&
+Dest->hasDLLExportLinkage() ||
+Dest->hasExternalWeakLinkage()) &&
(Src->hasExternalLinkage() ||
 Src->hasDLLImportLinkage() ||
-Src->hasDLLExportLinkage()) &&
+Src->hasDLLExportLinkage() ||
+Src->hasExternalWeakLinkage()) &&
"Unexpected linkage type!");
 return Error(Err, "Linking globals named '" + Src->getName() +
  "': symbol multiply defined!");
@@ -631,19 +640,22 @@
   ValueMap.insert(std::make_pair(SF, DF));
   DF->setLinkage(SF->getLinkage());
 } else if (SF->hasWeakLinkage() || SF->hasLinkOnceLinkage()) {
-  // At this point we know that DF has LinkOnce, Weak, or External linkage.
+  // At this point we know that DF has LinkOnce, Weak, or External* 
linkage.
   ValueMap.insert(std::make_pair(SF, DF));
 
   // Linkonce+Weak = Weak
-  if (DF->hasLinkOnceLinkage() && SF->hasWeakLinkage())
+  // *+External Weak = *
+  if ((DF->hasLinkOnceLinkage() && SF->hasWeakLinkage()) ||
+  DF->hasExternalWeakLinkage())
 DF->setLinkage(SF->getLinkage());
 
+
 } else if (DF->hasWeakLinkage() || DF->hasLinkOnceLinkage()) {
-  // At this point we know that SF has LinkOnce or External linkage.
+  // At this point we know that SF has LinkOnce or External* linkage.
   ValueMap.insert(std::make_pair(SF, DF));
-  if (!SF->hasLinkOnceLinkage())   // Don't inherit linkonce linkage
+  if (!SF->hasLinkOnceLinkage() && !SF->hasExternalWeakLinkage())
+// Don't inherit linkonce & external weak linkage
 DF->setLinkage(SF->getLinkage());
-
 } else if (SF->getLinkage() != DF->getLinkage()) {
   return Error(Err, "Functions named '" + SF->getName() +
"' have different linkage specifiers!");



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


[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp

2006-11-30 Thread Anton Korobeynikov


Changes in directory llvm/lib/ExecutionEngine:

ExecutionEngine.cpp updated: 1.89 -> 1.90
---
Log message:

Introducing external weak linkage. Darwin codegen should be added later.


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

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


Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.89 
llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.90
--- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.89   Mon Nov 27 17:54:50 2006
+++ llvm/lib/ExecutionEngine/ExecutionEngine.cppThu Nov 30 18:25:12 2006
@@ -681,7 +681,7 @@
 
 // Otherwise, we know it's linkonce/weak, replace it if this is a 
strong
 // symbol.
-if (GV->hasExternalLinkage())
+if (GV->hasExternalLinkage() || GVEntry->hasExternalWeakLinkage())
   GVEntry = GV;
   }
 }



___
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/Writer.cpp

2006-11-30 Thread Anton Korobeynikov


Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.289 -> 1.290
---
Log message:

Introducing external weak linkage. Darwin codegen should be added later.


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

 Writer.cpp |   15 +++
 1 files changed, 11 insertions(+), 4 deletions(-)


Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.289 
llvm/lib/Target/CBackend/Writer.cpp:1.290
--- llvm/lib/Target/CBackend/Writer.cpp:1.289   Tue Nov 28 17:07:32 2006
+++ llvm/lib/Target/CBackend/Writer.cpp Thu Nov 30 18:25:12 2006
@@ -1157,8 +1157,6 @@
   << "#define __attribute__(X)\n"
   << "#endif\n\n";
 
-#if 0
-  // At some point, we should support "external weak" vs. "weak" linkages.
   // On Mac OS X, "external weak" is spelled "__attribute__((weak_import))".
   Out << "#if defined(__GNUC__) && defined(__APPLE_CC__)\n"
   << "#define __EXTERNAL_WEAK__ __attribute__((weak_import))\n"
@@ -1167,7 +1165,6 @@
   << "#else\n"
   << "#define __EXTERNAL_WEAK__\n"
   << "#endif\n\n";
-#endif
 
   // For now, turn off the weak linkage attribute on Mac OS X. (See above.)
   Out << "#if defined(__GNUC__) && defined(__APPLE_CC__)\n"
@@ -1357,7 +1354,11 @@
 Out << "__declspec(dllimport) ";
 printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
 Out << ";\n";
-  }  
+  } else if (I->hasExternalWeakLinkage()) {
+Out << "extern ";
+printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
+Out << " __EXTERNAL_WEAK__ ;\n";
+  }
 }
   }
 
@@ -1370,9 +1371,13 @@
 // Don't print declarations for intrinsic functions.
 if (!I->getIntrinsicID() && I->getName() != "setjmp" && 
 I->getName() != "longjmp" && I->getName() != "_setjmp") {
+  if (I->hasExternalWeakLinkage())
+Out << "extern ";
   printFunctionSignature(I, true);
   if (I->hasWeakLinkage() || I->hasLinkOnceLinkage()) 
 Out << " __ATTRIBUTE_WEAK__";
+  if (I->hasExternalWeakLinkage())
+Out << " __EXTERNAL_WEAK__";
   if (StaticCtors.count(I))
 Out << " __ATTRIBUTE_CTOR__";
   if (StaticDtors.count(I))
@@ -1405,6 +1410,8 @@
   Out << " __attribute__((common))";
 else if (I->hasWeakLinkage())
   Out << " __ATTRIBUTE_WEAK__";
+else if (I->hasExternalWeakLinkage())
+  Out << " __EXTERNAL_WEAK__";
 Out << ";\n";
   }
   }



___
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/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86AsmPrinter.h

2006-11-30 Thread Anton Korobeynikov


Changes in directory llvm/lib/Target/X86:

X86ATTAsmPrinter.cpp updated: 1.74 -> 1.75
X86AsmPrinter.cpp updated: 1.213 -> 1.214
X86AsmPrinter.h updated: 1.35 -> 1.36
---
Log message:

Introducing external weak linkage. Darwin codegen should be added later.


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

 X86ATTAsmPrinter.cpp |4 
 X86AsmPrinter.cpp|   35 ---
 X86AsmPrinter.h  |3 +++
 3 files changed, 39 insertions(+), 3 deletions(-)


Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.74 
llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.75
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.74   Wed Nov 29 17:19:45 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cppThu Nov 30 18:25:12 2006
@@ -255,6 +255,10 @@
   }   
   O << Name;
 }
+
+if (GV->hasExternalWeakLinkage()) {
+  ExtWeakSymbols.insert(Name);
+}
 
 int Offset = MO.getOffset();
 if (Offset > 0)


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.213 
llvm/lib/Target/X86/X86AsmPrinter.cpp:1.214
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.213 Tue Oct 31 15:53:31 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp   Thu Nov 30 18:25:12 2006
@@ -128,11 +128,12 @@
   // from how MASM does things.  When making changes here don't forget to look
   // at X86IntelAsmPrinter::doFinalization().
   const TargetData *TD = TM.getTargetData();
-
+  
   // Print out module-level global variables here.
   for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
I != E; ++I) {
-if (!I->hasInitializer()) continue;   // External global require no code
+if (!I->hasInitializer() && !I->hasExternalWeakLinkage())
+  continue;   // External global require no code
 
 // Check to see if this is a special global used by LLVM, if so, emit it.
 if (EmitSpecialLLVMGlobal(I))
@@ -176,6 +177,17 @@
   O << "\t\t" << TAI->getCommentString() << " " << I->getName() << "\n";
 } else {
   switch (I->getLinkage()) {
+  case GlobalValue::ExternalWeakLinkage:
+   if (Subtarget->isTargetDarwin()) {
+ assert(0 && "External weak linkage for Darwin not implemented yet");
+   } else if (Subtarget->isTargetCygwin()) {
+ // There is no external weak linkage on Mingw32 platform.
+ // Defaulting just to external
+ O << "\t.globl " << name << "\n";
+   } else {
+ O << "\t.weak " << name << "\n";
+ break;
+   }
   case GlobalValue::LinkOnceLinkage:
   case GlobalValue::WeakLinkage:
 if (Subtarget->isTargetDarwin()) {
@@ -270,7 +282,24 @@
  i != e; ++i) {
 O << "\t.ascii \" -export:" << *i << "\"\n";
   }
- 
+
+  if (Subtarget->isTargetDarwin()) {
+if (ExtWeakSymbols.begin() != ExtWeakSymbols.end())
+  assert(0 && "External weak linkage for Darwin not implemented yet");
+  } else if (Subtarget->isTargetCygwin()) {
+// There is no external weak linkage on Mingw32 platform.
+// Defaulting to external
+  } else {
+if (ExtWeakSymbols.begin() != ExtWeakSymbols.end())
+  SwitchToDataSection("");
+
+for (std::set::iterator i = ExtWeakSymbols.begin(),
+ e = ExtWeakSymbols.end();
+ i != e; ++i) {
+  O << "\t.weak " << *i << "\n";
+}
+  }
+  
   if (Subtarget->isTargetDarwin()) {
 SwitchToDataSection("");
 


Index: llvm/lib/Target/X86/X86AsmPrinter.h
diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.35 
llvm/lib/Target/X86/X86AsmPrinter.h:1.36
--- llvm/lib/Target/X86/X86AsmPrinter.h:1.35Tue Oct 31 02:31:24 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.h Thu Nov 30 18:25:12 2006
@@ -84,6 +84,9 @@
 
   // Necessary for dllexport support
   std::set DLLExportedFns, DLLExportedGVs;
+
+  // Necessary for external weak linkage support
+  std::set ExtWeakSymbols;
   
   inline static bool isScale(const MachineOperand &MO) {
 return MO.isImmediate() &&



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


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

2006-11-30 Thread Anton Korobeynikov


Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.100 -> 1.101
---
Log message:

Introducing external weak linkage. Darwin codegen should be added later.


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

 ConstantFolding.cpp |7 ++-
 1 files changed, 2 insertions(+), 5 deletions(-)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.100 
llvm/lib/VMCore/ConstantFolding.cpp:1.101
--- llvm/lib/VMCore/ConstantFolding.cpp:1.100   Sun Nov 26 19:05:10 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp Thu Nov 30 18:25:12 2006
@@ -894,11 +894,8 @@
 
   case Instruction::PtrToInt:
 // Cast of a global address to boolean is always true.
-if (isa(V)) {
-  if (DestTy == Type::BoolTy)
-// FIXME: When we support 'external weak' references, we have to 
-// prevent this transformation from happening.  This code will need 
-// to be updated to ignore external weak symbols when we support it.
+if (const GlobalValue *GV = dyn_cast(V)) {
+  if (DestTy == Type::BoolTy && !GV->hasExternalWeakLinkage())
 return ConstantBool::getTrue();
 }
 break;



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


[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.cpp.cvs Lexer.l.cvs llvmAsmParser.cpp.cvs llvmAsmParser.y.cvs

2006-11-30 Thread Reid Spencer


Changes in directory llvm/lib/AsmParser:

Lexer.cpp.cvs updated: 1.15 -> 1.16
Lexer.l.cvs updated: 1.11 -> 1.12
llvmAsmParser.cpp.cvs updated: 1.27 -> 1.28
llvmAsmParser.y.cvs updated: 1.28 -> 1.29
---
Log message:

Regenerate.


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

 Lexer.cpp.cvs |  326 --
 Lexer.l.cvs   |   40 ++
 llvmAsmParser.cpp.cvs |8 -
 llvmAsmParser.y.cvs   |8 -
 4 files changed, 185 insertions(+), 197 deletions(-)


Index: llvm/lib/AsmParser/Lexer.cpp.cvs
diff -u llvm/lib/AsmParser/Lexer.cpp.cvs:1.15 
llvm/lib/AsmParser/Lexer.cpp.cvs:1.16
--- llvm/lib/AsmParser/Lexer.cpp.cvs:1.15   Sun Nov 26 19:05:09 2006
+++ llvm/lib/AsmParser/Lexer.cpp.cvsThu Nov 30 18:33:46 2006
@@ -20,7 +20,7 @@
 /* A lexical scanner generated by flex*/
 
 /* Scanner skeleton version:
- * $Header: /var/cvs/llvm/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.15 2006/11/27 
01:05:09 reid Exp $
+ * $Header: /var/cvs/llvm/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.16 2006/12/01 
00:33:46 reid Exp $
  */
 
 #define FLEX_SCANNER
@@ -893,7 +893,7 @@
 #define YY_MORE_ADJ 0
 #define YY_RESTORE_YY_MORE_OFFSET
 char *yytext;
-#line 1 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 1 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 #define INITIAL 0
 /*===-- Lexer.l - Scanner for llvm assembly files --*- C++ 
-*--===//
 //
@@ -908,7 +908,7 @@
 //
 
//===--===*/
 #define YY_NEVER_INTERACTIVE 1
-#line 28 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 28 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 #include "ParserInternals.h"
 #include "llvm/Module.h"
 #include 
@@ -935,17 +935,11 @@
   llvmAsmlval.type.obsolete = true; \
   return sym
 
-// Construct a token value for a non-obsolete type
-#define RET_TY(CType, sym) \
-  llvmAsmlval.TypeVal.type = new PATypeHolder(CType); \
-  llvmAsmlval.TypeVal.signedness = isSignless; \
-  return sym
-
 // Construct a token value for an obsolete token
-#define RET_TY_OBSOLETE(CType, sign, sym) \
-  llvmAsmlval.TypeVal.type = new PATypeHolder(CType); \
-  llvmAsmlval.TypeVal.signedness = sign; \
-  return sym
+#define RET_TY(CTYPE, SIGN, SYM) \
+  llvmAsmlval.TypeVal.type = new PATypeHolder(CTYPE); \
+  llvmAsmlval.TypeVal.signedness = SIGN; \
+  return SYM
 
 namespace llvm {
 
@@ -1055,7 +1049,7 @@
 /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing
  * it to deal with 64 bit numbers.
  */
-#line 1059 "Lexer.cpp"
+#line 1053 "Lexer.cpp"
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -1206,10 +1200,10 @@
register char *yy_cp = NULL, *yy_bp = NULL;
register int yy_act;
 
-#line 200 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 194 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 
 
-#line 1213 "Lexer.cpp"
+#line 1207 "Lexer.cpp"
 
if ( yy_init )
{
@@ -1302,607 +1296,607 @@
{ /* beginning of action switch */
 case 1:
 YY_RULE_SETUP
-#line 202 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 196 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 { /* Ignore comments for now */ }
YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 204 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 198 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 { return BEGINTOK; }
YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 205 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 199 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 { return ENDTOK; }
YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 206 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 200 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 { return TRUETOK;  }
YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 207 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 201 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 { return FALSETOK; }
YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 208 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 202 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 { return DECLARE; }
YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 209 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 203 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 { return GLOBAL; }
YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 210 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 204 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 { return CONSTANT; }
YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 211 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 205 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 { return INTERNAL; }
YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 212 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 206 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 { return LINKONCE; }
YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 213 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 207 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
 { return WEAK; }
YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 214 "/proj/llvm/llvm-1/lib/AsmParser/Lexer.l"
+#line 208 "/proj/llvm/llvm-4/

[llvm-commits] CVS: llvm/configure Makefile.config.in

2006-11-30 Thread Reid Spencer


Changes in directory llvm:

configure updated: 1.257 -> 1.258
Makefile.config.in updated: 1.68 -> 1.69
---
Log message:

For PR1019: http://llvm.org/PR1019 :
Add HAVE_PTHREAD to makefiles with support from configure and use it to
determine whether to build examples/ParallelJIT.
Patch by Anton Korobeynikov.


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

 Makefile.config.in |3 -
 configure  |  139 ++---
 2 files changed, 71 insertions(+), 71 deletions(-)


Index: llvm/configure
diff -u llvm/configure:1.257 llvm/configure:1.258
--- llvm/configure:1.257Thu Nov 16 21:32:33 2006
+++ llvm/configure  Thu Nov 30 18:37:14 2006
@@ -896,6 +896,7 @@
 ETAGSFLAGS
 LLVMGCC
 LLVMGXX
+HAVE_PTHREAD
 HUGE_VAL_SANITY
 ALLOCA
 MMAP_FILE
@@ -10298,7 +10299,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext < conftest.$ac_ext
+  echo '#line 12446 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -14160,11 +14161,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14163: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14164: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
-   echo "$as_me:14167: \$? = $ac_status" >&5
+   echo "$as_me:14168: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
  # The compiler can only warn and ignore the option if not recognized
  # So say no if there are warnings other than the usual output.
@@ -14428,11 +14429,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14431: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14432: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
-   echo "$as_me:14435: \$? = $ac_status" >&5
+   echo "$as_me:14436: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
  # The compiler can only warn and ignore the option if not recognized
  # So say no if there are warnings other than the usual output.
@@ -14532,11 +14533,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14535: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14536: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
-   echo "$as_me:14539: \$? = $ac_status" >&5
+   echo "$as_me:14540: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
  # The compiler can only warn and ignore the option if not recognized
@@ -16984,7 +16985,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext < conftest.$ac_ext <&5)
+   (eval echo "\"\$as_me:19456: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
-   echo "$as_me:19459: \$? = $ac_status" >&5
+   echo "$as_me:19460: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
  # The compiler can only warn and ignore the option if not recognized
  # So say no if there are warnings other than the usual output.
@@ -19556,11 +19557,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:19559: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19560: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
-   echo "$as_me:19563: \$? = $ac_status" >&5
+   echo "$as_me:19564: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
  # The compiler can only warn and ignore the option if not recognized
@@ -21126,11 +21127,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:21129: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:21130: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
-   echo "$as_me:21133: \$? = $ac_status" >&5
+   echo "$as_me:21134: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
  # The compiler can only warn and ignore the option if not recognized
  # So say no if there are warnings other than the usual output.
@@ -21230,11 +21231,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
-  

[llvm-commits] CVS: llvm/examples/Makefile

2006-11-30 Thread Reid Spencer


Changes in directory llvm/examples:

Makefile updated: 1.7 -> 1.8
---
Log message:

For PR1019: http://llvm.org/PR1019 :
Add HAVE_PTHREAD to makefiles with support from configure and use it to
determine whether to build examples/ParallelJIT.
Patch by Anton Korobeynikov.


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

 Makefile |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/examples/Makefile
diff -u llvm/examples/Makefile:1.7 llvm/examples/Makefile:1.8
--- llvm/examples/Makefile:1.7  Wed May 31 20:09:43 2006
+++ llvm/examples/Makefile  Thu Nov 30 18:37:14 2006
@@ -12,7 +12,7 @@
 
 PARALLEL_DIRS:= Fibonacci HowToUseJIT ModuleMaker BFtoLLVM
 
-ifeq ($(ENABLE_THREADS),1)
+ifeq ($(HAVE_PTHREAD),1)
 PARALLEL_DIRS += ParallelJIT 
 endif
 



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


[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y

2006-11-30 Thread Anton Korobeynikov


Changes in directory llvm/lib/AsmParser:

llvmAsmParser.y updated: 1.279 -> 1.280
---
Log message:

Introducing external weak linkage. Darwin codegen should be added later.


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

 llvmAsmParser.y |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.279 
llvm/lib/AsmParser/llvmAsmParser.y:1.280
--- llvm/lib/AsmParser/llvmAsmParser.y:1.279Tue Nov 28 16:47:12 2006
+++ llvm/lib/AsmParser/llvmAsmParser.y  Thu Nov 30 18:25:12 2006
@@ -2201,7 +2201,7 @@
 
 FnDeclareLinkage: /*default*/ |
   DLLIMPORT   { CurFun.Linkage = 
GlobalValue::DLLImportLinkage; } |
-  EXTERN_WEAK { CurFun.Linkage = 
GlobalValue::DLLImportLinkage; };
+  EXTERN_WEAK { CurFun.Linkage = 
GlobalValue::ExternalWeakLinkage; };
   
 FunctionProto : DECLARE { CurFun.isDeclare = true; } FnDeclareLinkage 
FunctionHeaderH {
 $$ = CurFun.CurrentFunction;



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


[llvm-commits] CVS: llvm/autoconf/configure.ac

2006-11-30 Thread Reid Spencer


Changes in directory llvm/autoconf:

configure.ac updated: 1.252 -> 1.253
---
Log message:

For PR1019: http://llvm.org/PR1019 :
Add HAVE_PTHREAD to makefiles with support from configure and use it to
determine whether to build examples/ParallelJIT.
Patch by Anton Korobeynikov.


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

 configure.ac |6 +-
 1 files changed, 5 insertions(+), 1 deletion(-)


Index: llvm/autoconf/configure.ac
diff -u llvm/autoconf/configure.ac:1.252 llvm/autoconf/configure.ac:1.253
--- llvm/autoconf/configure.ac:1.252Thu Nov 16 21:32:33 2006
+++ llvm/autoconf/configure.ac  Thu Nov 30 18:37:14 2006
@@ -637,7 +637,11 @@
 AC_CHECK_HEADERS([windows.h sys/mman.h sys/param.h sys/resource.h sys/time.h])
 AC_CHECK_HEADERS([sys/types.h malloc/malloc.h mach/mach.h])
 if test "$ENABLE_THREADS" -eq 1 ; then
-  AC_CHECK_HEADERS(pthread.h)
+  AC_CHECK_HEADER(pthread.h,
+  AC_SUBST(HAVE_PTHREAD, 1),
+  AC_SUBST(HAVE_PTHREAD, 0))
+else
+  AC_SUBST(HAVE_PTHREAD, 0)
 fi
 
 
dnl===---===



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


[llvm-commits] CVS: llvm/tools/opt/opt.cpp

2006-11-30 Thread Nick Lewycky


Changes in directory llvm/tools/opt:

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

Fix opt -o option. Don't pass a pointer to an auto variable which is going
away before it's needed, and don't try to delete that pointer!


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

 opt.cpp |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)


Index: llvm/tools/opt/opt.cpp
diff -u llvm/tools/opt/opt.cpp:1.121 llvm/tools/opt/opt.cpp:1.122
--- llvm/tools/opt/opt.cpp:1.121Tue Nov 28 18:19:40 2006
+++ llvm/tools/opt/opt.cpp  Thu Nov 30 18:43:14 2006
@@ -252,10 +252,9 @@
   Passes.add(createVerifierPass());
 
 // Write bytecode out to disk or cout as the last step...
-if (!NoOutput && !AnalyzeOnly) {
-  llvm_ostream L(*Out);
-  Passes.add(new WriteBytecodePass(&L, Out != &std::cout, !NoCompress));
-}
+llvm_ostream L(*Out);
+if (!NoOutput && !AnalyzeOnly)
+  Passes.add(new WriteBytecodePass(&L, false, !NoCompress));
 
 // Now that we have all of the passes ready, run them.
 Passes.run(*M.get());



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


[llvm-commits] CVS: llvm/tools/gccld/gccld.cpp

2006-11-30 Thread Nick Lewycky


Changes in directory llvm/tools/gccld:

gccld.cpp updated: 1.112 -> 1.113
---
Log message:

Remove extra header.


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

 gccld.cpp |1 -
 1 files changed, 1 deletion(-)


Index: llvm/tools/gccld/gccld.cpp
diff -u llvm/tools/gccld/gccld.cpp:1.112 llvm/tools/gccld/gccld.cpp:1.113
--- llvm/tools/gccld/gccld.cpp:1.112Tue Nov 28 18:19:40 2006
+++ llvm/tools/gccld/gccld.cpp  Thu Nov 30 19:05:14 2006
@@ -25,7 +25,6 @@
 #include "llvm/Module.h"
 #include "llvm/PassManager.h"
 #include "llvm/Bytecode/Reader.h"
-#include "llvm/Bytecode/WriteBytecodePass.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Transforms/Scalar.h"



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


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

2006-11-30 Thread Chris Lattner
Reid,

On Nov 30, 2006, at 4:25 PM, Anton Korobeynikov wrote:
> Introducing external weak linkage. Darwin codegen should be added  
> later.
>
> Index: llvm/lib/VMCore/ConstantFolding.cpp
> diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.100 llvm/lib/VMCore/ 
> ConstantFolding.cpp:1.101
> --- llvm/lib/VMCore/ConstantFolding.cpp:1.100 Sun Nov 26 19:05:10 2006
> +++ llvm/lib/VMCore/ConstantFolding.cpp   Thu Nov 30 18:25:12 2006
> @@ -894,11 +894,8 @@
>
>case Instruction::PtrToInt:
>  // Cast of a global address to boolean is always true.
> -if (isa(V)) {
> -  if (DestTy == Type::BoolTy)
> -// FIXME: When we support 'external weak' references, we  
> have to
> -// prevent this transformation from happening.  This code  
> will need
> -// to be updated to ignore external weak symbols when we  
> support it.
> +if (const GlobalValue *GV = dyn_cast(V)) {
> +  if (DestTy == Type::BoolTy && !GV->hasExternalWeakLinkage())
>  return ConstantBool::getTrue();
>

This code is wrong, but it's not anton's fault.  This is fallout from  
the cast patch.  ptrtoint(&GV, bool) is not guaranteed to be true,  
even with non-extern-weak symbols, as the ptrtoint truncates, it  
doesn't compare to null any more.

This code should be removed, and code should be added to  
ConstantFolding.cpp in the setne(&GV, null)/seteq(&GV, null) codepath  
to handle this.

Thanks,

-Chris


___
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/PPCISelLowering.cpp

2006-11-30 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

PPCISelLowering.cpp updated: 1.237 -> 1.238
---
Log message:

Fix the CodeGen/PowerPC/vec_constants.ll regression.


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

 PPCISelLowering.cpp |   15 +--
 1 files changed, 9 insertions(+), 6 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.237 
llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.238
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.237   Wed Nov 29 13:58:49 2006
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Thu Nov 30 19:45:39 2006
@@ -1958,13 +1958,17 @@
 static SDOperand BuildSplatI(int Val, unsigned SplatSize, MVT::ValueType VT,
  SelectionDAG &DAG) {
   assert(Val >= -16 && Val <= 15 && "vsplti is out of range!");
-  
-  // Force vspltis[hw] -1 to vspltisb -1.
-  if (Val == -1) SplatSize = 1;
-  
+
   static const MVT::ValueType VTys[] = { // canonical VT to use for each size.
 MVT::v16i8, MVT::v8i16, MVT::Other, MVT::v4i32
   };
+
+  MVT::ValueType ReqVT = VT != MVT::Other ? VT : VTys[SplatSize-1];
+  
+  // Force vspltis[hw] -1 to vspltisb -1 to canonicalize.
+  if (Val == -1)
+SplatSize = 1;
+  
   MVT::ValueType CanonicalVT = VTys[SplatSize-1];
   
   // Build a canonical splat for this value.
@@ -1973,8 +1977,7 @@
   Ops.assign(MVT::getVectorNumElements(CanonicalVT), Elt);
   SDOperand Res = DAG.getNode(ISD::BUILD_VECTOR, CanonicalVT,
   &Ops[0], Ops.size());
-  if (VT == MVT::Other) return Res;
-  return DAG.getNode(ISD::BIT_CONVERT, VT, Res);
+  return DAG.getNode(ISD::BIT_CONVERT, ReqVT, Res);
 }
 
 /// BuildIntrinsicOp - Return a binary operator intrinsic node with the



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


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

2006-11-30 Thread Reid Spencer
On Thu, 2006-11-30 at 17:33 -0800, Chris Lattner wrote:
> Reid,
> 
> On Nov 30, 2006, at 4:25 PM, Anton Korobeynikov wrote:
> > Introducing external weak linkage. Darwin codegen should be added  
> > later.
> >
> > Index: llvm/lib/VMCore/ConstantFolding.cpp
> > diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.100 llvm/lib/VMCore/ 
> > ConstantFolding.cpp:1.101
> > --- llvm/lib/VMCore/ConstantFolding.cpp:1.100   Sun Nov 26 19:05:10 2006
> > +++ llvm/lib/VMCore/ConstantFolding.cpp Thu Nov 30 18:25:12 2006
> > @@ -894,11 +894,8 @@
> >
> >case Instruction::PtrToInt:
> >  // Cast of a global address to boolean is always true.
> > -if (isa(V)) {
> > -  if (DestTy == Type::BoolTy)
> > -// FIXME: When we support 'external weak' references, we  
> > have to
> > -// prevent this transformation from happening.  This code  
> > will need
> > -// to be updated to ignore external weak symbols when we  
> > support it.
> > +if (const GlobalValue *GV = dyn_cast(V)) {
> > +  if (DestTy == Type::BoolTy && !GV->hasExternalWeakLinkage())
> >  return ConstantBool::getTrue();
> >
> 
> This code is wrong, but it's not anton's fault.  This is fallout from  
> the cast patch.  ptrtoint(&GV, bool) is not guaranteed to be true,  
> even with non-extern-weak symbols, as the ptrtoint truncates, it  
> doesn't compare to null any more.
> 
> This code should be removed, 

Okay, I agree. It should be removed.

> and code should be added to  
> ConstantFolding.cpp in the setne(&GV, null)/seteq(&GV, null) codepath  
> to handle this.

Which code path?  You mean you generally want a setne(&GV, null) to be
folded to ConstBool::True and seteq(&GV, null) to be folded to
ConstBool::False ?

> 
> 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/Transforms/InstCombine/cast-and-cast.ll

2006-11-30 Thread Reid Spencer


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

cast-and-cast.ll updated: 1.2 -> 1.3
---
Log message:

The InstCombine hack has been removed, no need to XFAIL this any more.


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

 cast-and-cast.ll |4 
 1 files changed, 4 deletions(-)


Index: llvm/test/Regression/Transforms/InstCombine/cast-and-cast.ll
diff -u llvm/test/Regression/Transforms/InstCombine/cast-and-cast.ll:1.2 
llvm/test/Regression/Transforms/InstCombine/cast-and-cast.ll:1.3
--- llvm/test/Regression/Transforms/InstCombine/cast-and-cast.ll:1.2Mon Nov 
27 14:01:48 2006
+++ llvm/test/Regression/Transforms/InstCombine/cast-and-cast.llThu Nov 
30 19:50:45 2006
@@ -1,9 +1,5 @@
 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast
 
-;; This requires Reid to remove the instcombine hack that turns trunc to bool 
into setne.
-; XFAIL: *
-
-
 bool %test1(uint %val) {
   %t1 = bitcast uint %val to int 
   %t2 = and int %t1, 1



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


[llvm-commits] External weak linkage. llvm-gcc support

2006-11-30 Thread Anton Korobeynikov
Hello, Everyone.

Please find patch for llvm-gcc4, which enables external weak linkage.
All "supporting" patches to LLVM has been commited to CVS HEAD already. 

Please note, that applying this patch will, probably, break crtstuff.c
compilation on Darwin, since there is no Darwin codegen for external
weak linkage inside.

PS: I've successfully bootstrapped llvm-gcc4 with these patches on
Linux.
-- 
With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.

diff -r 9e71153bc71b README.LLVM
--- a/README.LLVM	Thu Nov 30 11:14:19 2006 +
+++ b/README.LLVM	Fri Dec 01 02:41:38 2006 +0300
@@ -42,11 +42,7 @@ Below we assume the LLVM OBJDIR is $LLVM
 //===---
 Linux-specific Instructions:
 
-Until http://llvm.org/PR821 is fixed, you should configure with
---disable-threads.  This fixes problems linking libgcc.so.1 with
-undefined references to pthread_*.
-
-Until http://llvm.org/PR1006 is fixed, you should configure with
+Until http://llvm.org/PR1017 is fixed, you should configure with
 --disable-shared. This fixes problems when missing symbols in the stdc++ 
 library when trying to link llvm-g++. 
 
diff -r 9e71153bc71b gcc/crtstuff.c
--- a/gcc/crtstuff.c	Thu Nov 30 11:14:19 2006 +
+++ b/gcc/crtstuff.c	Sun Nov 26 03:58:43 2006 +0300
@@ -65,13 +65,6 @@ 02111-1307, USA.  */
 #include "coretypes.h"
 #include "tm.h"
 #include "unwind-dw2-fde.h"
-
-/* APPLE LOCAL begin LLVM */
-#ifdef __llvm__
- /* FIXME: Remove when external weak linkage will be alive. */
- #undef JCR_SECTION_NAME
-#endif
-/* APPLE LOCAL end LLVM */
 
 #ifndef FORCE_CODE_SECTION_ALIGN
 # define FORCE_CODE_SECTION_ALIGN
diff -r 9e71153bc71b gcc/llvm-backend.cpp
--- a/gcc/llvm-backend.cpp	Thu Nov 30 11:14:19 2006 +
+++ b/gcc/llvm-backend.cpp	Fri Dec 01 02:36:13 2006 +0300
@@ -670,6 +670,6 @@ void make_decl_llvm(tree decl) {
   // object.  Note that this is quite possibly a forward reference to the
   // object, so its type may change later.
   if (TREE_CODE(decl) == FUNCTION_DECL) {
 assert(Name[0] && "Function with empty name!");
 // If this function has already been created, reuse the decl.  This happens
 // when we have something like __builtin_memset and memset in the same file.
@@ -681,6 +683,11 @@ void make_decl_llvm(tree decl) {
   FnEntry = new Function(Ty, Function::ExternalLinkage, Name, TheModule);
   FnEntry->setCallingConv(CC);
 
+  // Check for external weak linkage
+  if (DECL_EXTERNAL(decl) && DECL_WEAK(decl)) {
+FnEntry->setLinkage(Function::ExternalWeakLinkage);
+  }
+  
 #ifdef TARGET_ADJUST_LLVM_LINKAGE
   TARGET_ADJUST_LLVM_LINKAGE(FnEntry,decl);
 #endif /* TARGET_ADJUST_LLVM_LINKAGE */
@@ -700,6 +707,11 @@ void make_decl_llvm(tree decl) {
 if (Name[0] == 0) {   // Global has no name.
   GV = new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage, 0,
   Name, TheModule);
+  
+  // Check for external weak linkage
+  if (DECL_EXTERNAL(decl) && DECL_WEAK(decl)) {
+GV->setLinkage(GlobalValue::ExternalWeakLinkage);
+  }
 
 #ifdef TARGET_ADJUST_LLVM_LINKAGE
   TARGET_ADJUST_LLVM_LINKAGE(GV,decl);
@@ -712,6 +724,11 @@ void make_decl_llvm(tree decl) {
   if (GVE == 0) {
 GVE = GV = new GlobalVariable(Ty, false, GlobalValue::ExternalLinkage,0,
   Name, TheModule);
+
+// Check for external weak linkage
+if (DECL_EXTERNAL(decl) && DECL_WEAK(decl)) {
+  GV->setLinkage(GlobalValue::ExternalWeakLinkage);
+}
 
 #ifdef TARGET_ADJUST_LLVM_LINKAGE
 TARGET_ADJUST_LLVM_LINKAGE(GV,decl);
@@ -743,11 +760,6 @@ void make_decl_llvm(tree decl) {
   }
 }
 
-#if 0
-// FIXME: When we support external weak globals, this is where we do it.
-x = gen_rtx_SYMBOL_REF(Pmode, name);
-SYMBOL_REF_WEAK(x) = DECL_WEAK(decl);
-#endif
 SET_DECL_LLVM(decl, GV);
   }
   timevar_pop(TV_LLVM_GLOBALS);
@@ -760,17 +772,21 @@ const char *llvm_get_decl_name(void *LLV
 }
 
 // llvm_mark_decl_weak - Used by varasm.c, called when a decl is found to be
-// weak, but it already had an llvm object created for it.  This marks the LLVM
+// weak, but it already had an llvm object created for it. This marks the LLVM
 // object weak as well.
 void llvm_mark_decl_weak(tree decl) {
   assert(DECL_LLVM_SET_P(decl) && DECL_WEAK(decl) &&
  isa(DECL_LLVM(decl)) && "Decl isn't marked weak!");
   GlobalValue *GV = cast(DECL_LLVM(decl));
 
-  if (!GV->isExternal() &&  // FIXME: Support external weak globals!
-  // Do not mark something that is already known to be linkonce or internal.
-  GV->getLinkage() == GlobalValue::ExternalLinkage)
-GV->setLinkage(GlobalValue::WeakLinkage);
+  // Do not mark something that is already known to be linkonce or internal.
+  if (GV->getLinkage() == GlobalValue::ExternalLinkage) {
+if (GV->isExternal()) {
+  GV->setLinkage(GlobalValue::

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

2006-11-30 Thread Chris Lattner
>
>> and code should be added to
>> ConstantFolding.cpp in the setne(&GV, null)/seteq(&GV, null) codepath
>> to handle this.
>
> Which code path?  You mean you generally want a setne(&GV, null) to be
> folded to ConstBool::True and seteq(&GV, null) to be folded to
> ConstBool::False ?

Yep exactly.  Unless the global is external weak.

-Chris

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


[llvm-commits] CVS: llvm/include/llvm/Config/config.h.in

2006-11-30 Thread Reid Spencer


Changes in directory llvm/include/llvm/Config:

config.h.in updated: 1.70 -> 1.71
---
Log message:

Define the HAVE_PTHREAD symbol.


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

 config.h.in |3 ---
 1 files changed, 3 deletions(-)


Index: llvm/include/llvm/Config/config.h.in
diff -u llvm/include/llvm/Config/config.h.in:1.70 
llvm/include/llvm/Config/config.h.in:1.71
--- llvm/include/llvm/Config/config.h.in:1.70   Sun Nov  5 11:08:18 2006
+++ llvm/include/llvm/Config/config.h.inThu Nov 30 21:46:01 2006
@@ -267,9 +267,6 @@
 /* Define to have the %a format string */
 #undef HAVE_PRINTF_A
 
-/* Define to 1 if you have the  header file. */
-#undef HAVE_PTHREAD_H
-
 /* Have pthread_mutex_lock */
 #undef HAVE_PTHREAD_MUTEX_LOCK
 



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


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

2006-11-30 Thread Reid Spencer


Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.101 -> 1.102
---
Log message:

Don't fold "ptrtoint GV to bool" since this should be doing a truncate not
a comparison against zero. Instead fold setne(GV,null) and seteq(GV,null)
to ConstantBool::True or ConstantBool::False, respectively.


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

 ConstantFolding.cpp |   34 +++---
 1 files changed, 27 insertions(+), 7 deletions(-)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.101 
llvm/lib/VMCore/ConstantFolding.cpp:1.102
--- llvm/lib/VMCore/ConstantFolding.cpp:1.101   Thu Nov 30 18:25:12 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp Thu Nov 30 21:56:30 2006
@@ -893,11 +893,6 @@
 break;
 
   case Instruction::PtrToInt:
-// Cast of a global address to boolean is always true.
-if (const GlobalValue *GV = dyn_cast(V)) {
-  if (DestTy == Type::BoolTy && !GV->hasExternalWeakLinkage())
-return ConstantBool::getTrue();
-}
 break;
   case Instruction::BitCast:
 // Check to see if we are casting a pointer to an aggregate to a pointer to
@@ -1371,10 +1366,35 @@
   case Instruction::Shl: C = ConstRules::get(V1, V2).shl(V1, V2); break;
   case Instruction::LShr:C = ConstRules::get(V1, V2).lshr(V1, V2); break;
   case Instruction::AShr:C = ConstRules::get(V1, V2).ashr(V1, V2); break;
-  case Instruction::SetEQ:   C = ConstRules::get(V1, V2).equalto(V1, V2); 
break;
+  case Instruction::SetEQ:   
+// SetEQ(null,GV) -> false
+if (V1->isNullValue()) {
+  if (const GlobalValue *GV = dyn_cast(V2))
+if (!GV->hasExternalWeakLinkage())
+  return ConstantBool::getFalse();
+// SetEQ(GV,null) -> false
+} else if (V2->isNullValue()) {
+  if (const GlobalValue *GV = dyn_cast(V1))
+if (!GV->hasExternalWeakLinkage())
+  return ConstantBool::getFalse();
+}
+C = ConstRules::get(V1, V2).equalto(V1, V2); 
+break;
   case Instruction::SetLT:   C = ConstRules::get(V1, V2).lessthan(V1, 
V2);break;
   case Instruction::SetGT:   C = ConstRules::get(V1, V2).lessthan(V2, 
V1);break;
-  case Instruction::SetNE:   // V1 != V2  ===  !(V1 == V2)
+  case Instruction::SetNE:   
+// SetNE(null,GV) -> true
+if (V1->isNullValue()) {
+  if (const GlobalValue *GV = dyn_cast(V2))
+if (!GV->hasExternalWeakLinkage())
+  return ConstantBool::getTrue();
+// SetNE(GV,null) -> true
+} else if (V2->isNullValue()) {
+  if (const GlobalValue *GV = dyn_cast(V1))
+if (!GV->hasExternalWeakLinkage())
+  return ConstantBool::getTrue();
+}
+// V1 != V2  ===  !(V1 == V2)
 C = ConstRules::get(V1, V2).equalto(V1, V2);
 if (C) return ConstantExpr::getNot(C);
 break;



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


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

2006-11-30 Thread Chris Lattner

On Nov 30, 2006, at 7:56 PM, Reid Spencer wrote:

>
>case Instruction::PtrToInt:
> -// Cast of a global address to boolean is always true.
> -if (const GlobalValue *GV = dyn_cast(V)) {
> -  if (DestTy == Type::BoolTy && !GV->hasExternalWeakLinkage())
> -return ConstantBool::getTrue();
> -}
>  break;

Thanks Reid, the patch looks great.  I think you can remove this  
empty case now though,

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


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

2006-11-30 Thread Reid Spencer
On Thu, 2006-11-30 at 20:51 -0800, Chris Lattner wrote:
> On Nov 30, 2006, at 7:56 PM, Reid Spencer wrote:
> 
> >
> >case Instruction::PtrToInt:
> > -// Cast of a global address to boolean is always true.
> > -if (const GlobalValue *GV = dyn_cast(V)) {
> > -  if (DestTy == Type::BoolTy && !GV->hasExternalWeakLinkage())
> > -return ConstantBool::getTrue();
> > -}
> >  break;
> 
> Thanks Reid, the patch looks great.  I think you can remove this  
> empty case now though,

The default asserts, trying to catch bad opcodes.

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


signature.asc
Description: This is a digitally signed message part
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


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

2006-11-30 Thread Chris Lattner

On Nov 30, 2006, at 9:01 PM, Reid Spencer wrote:

> On Thu, 2006-11-30 at 20:51 -0800, Chris Lattner wrote:
>> On Nov 30, 2006, at 7:56 PM, Reid Spencer wrote:
>>
>>>
>>>case Instruction::PtrToInt:
>>> -// Cast of a global address to boolean is always true.
>>> -if (const GlobalValue *GV = dyn_cast(V)) {
>>> -  if (DestTy == Type::BoolTy && !GV->hasExternalWeakLinkage())
>>> -return ConstantBool::getTrue();
>>> -}
>>>  break;
>>
>> Thanks Reid, the patch looks great.  I think you can remove this
>> empty case now though,
>
> The default asserts, trying to catch bad opcodes.

Ah, good call, thanks again!

-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/Transforms/ConstProp/2006-11-30-vector-cast.ll

2006-11-30 Thread Chris Lattner


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

2006-11-30-vector-cast.ll added (r1.1)
---
Log message:

new testcase


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

 2006-11-30-vector-cast.ll |7 +++
 1 files changed, 7 insertions(+)


Index: llvm/test/Regression/Transforms/ConstProp/2006-11-30-vector-cast.ll
diff -c /dev/null 
llvm/test/Regression/Transforms/ConstProp/2006-11-30-vector-cast.ll:1.1
*** /dev/null   Thu Nov 30 23:54:58 2006
--- llvm/test/Regression/Transforms/ConstProp/2006-11-30-vector-cast.ll Thu Nov 
30 23:54:48 2006
***
*** 0 
--- 1,7 
+ ; RUN: llvm-as < %s | opt -constprop | llvm-dis | grep 4294967295 &&
+ ; RUN: llvm-as < %s | opt -constprop | llvm-dis | not grep zeroinitializer
+ 
+ < 4 x uint> %test() {
+   %tmp40 = bitcast <2 x long> bitcast (<4 x int> < int 0, int 0, int -1, int 
0 > to <2 x long>) to <4 x uint>
+   ret <4 x uint> %tmp40
+ }



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


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

2006-11-30 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.102 -> 1.103
---
Log message:

Fix a typo introduced by the cast patch that horribly broke a lot of vector
code.  Testcase here: Transforms/ConstProp/2006-11-30-vector-cast.ll



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

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


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.102 
llvm/lib/VMCore/ConstantFolding.cpp:1.103
--- llvm/lib/VMCore/ConstantFolding.cpp:1.102   Thu Nov 30 21:56:30 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp Thu Nov 30 23:55:25 2006
@@ -743,7 +743,7 @@
 (SrcEltTy->isFloatingPoint() && DstEltTy->isFloatingPoint())) {
   for (unsigned i = 0; i != SrcNumElts; ++i)
 Result.push_back(
-  ConstantExpr::getCast(Instruction::BitCast, CP->getOperand(1), 
+  ConstantExpr::getCast(Instruction::BitCast, CP->getOperand(i), 
 DstEltTy));
   return ConstantPacked::get(Result);
 }



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


[llvm-commits] patch for pr1027

2006-11-30 Thread Chris Lattner
Simple patch, GCC's tree IR isn't as consistent as you might think,  
particularly the C++ front-end.

-Chris

Index: llvm-convert.cpp
===
--- llvm-convert.cpp(revision 120751)
+++ llvm-convert.cpp(working copy)
@@ -4911,13 +4911,6 @@
  FieldPtr = ConstantExpr::getCast(FieldPtr, PointerType::get 
(FieldTy));
}

-  // If this is a bitfield reference, return it as such.
-  if (DECL_SIZE(FieldDecl) && TREE_CODE(DECL_SIZE(FieldDecl)) ==  
INTEGER_CST &&
-  TREE_INT_CST_LOW(DECL_SIZE(FieldDecl)) != 8*TD.getTypeSize 
(FieldTy)) {
-assert(0 && "Cannot take the address of a bitfield!");
-abort();
-  }
-
assert(BitStart == 0 &&
   "It's a bitfield reference or we didn't get to the field!");
return FieldPtr;

___
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-11-30-ConstantExprCrash.cpp

2006-11-30 Thread Chris Lattner


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

2006-11-30-ConstantExprCrash.cpp added (r1.1)
---
Log message:

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


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

 2006-11-30-ConstantExprCrash.cpp |   27 +++
 1 files changed, 27 insertions(+)


Index: llvm/test/Regression/C++Frontend/2006-11-30-ConstantExprCrash.cpp
diff -c /dev/null 
llvm/test/Regression/C++Frontend/2006-11-30-ConstantExprCrash.cpp:1.1
*** /dev/null   Fri Dec  1 00:35:06 2006
--- llvm/test/Regression/C++Frontend/2006-11-30-ConstantExprCrash.cpp   Fri Dec 
 1 00:34:56 2006
***
*** 0 
--- 1,27 
+ // RUN: %llvmgxx %s -emit-llvm -S -o -
+ // PR1027
+ 
+ struct sys_var {
+   unsigned name_length;
+ 
+   bool no_support_one_shot;
+   sys_var() {}
+ };
+ 
+ 
+ struct sys_var_thd : public sys_var {
+ };
+ 
+ extern sys_var_thd sys_auto_is_null;
+ 
+ sys_var *getsys_variables() {
+   return &sys_auto_is_null;
+ }
+ 
+ sys_var *sys_variables = &sys_auto_is_null;
+ 
+ 
+ 
+ 
+ 
+ 



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


Re: [llvm-commits] External weak linkage. llvm-gcc support

2006-11-30 Thread Chris Lattner


On Nov 30, 2006, at 4:46 PM, Anton Korobeynikov wrote:


Hello, Everyone.

Please find patch for llvm-gcc4, which enables external weak linkage.
All "supporting" patches to LLVM has been commited to CVS HEAD  
already.


Please note, that applying this patch will, probably, break crtstuff.c
compilation on Darwin, since there is no Darwin codegen for external
weak linkage inside.

PS: I've successfully bootstrapped llvm-gcc4 with these patches on
Linux.


Looks great, applied, thanks!

-Chris___
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/X86AsmPrinter.cpp

2006-11-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86AsmPrinter.cpp updated: 1.214 -> 1.215
---
Log message:

Darwin X86 external weak linkage support.

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

 X86AsmPrinter.cpp |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.214 
llvm/lib/Target/X86/X86AsmPrinter.cpp:1.215
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.214 Thu Nov 30 18:25:12 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp   Fri Dec  1 01:15:24 2006
@@ -283,10 +283,7 @@
 O << "\t.ascii \" -export:" << *i << "\"\n";
   }
 
-  if (Subtarget->isTargetDarwin()) {
-if (ExtWeakSymbols.begin() != ExtWeakSymbols.end())
-  assert(0 && "External weak linkage for Darwin not implemented yet");
-  } else if (Subtarget->isTargetCygwin()) {
+  if (Subtarget->isTargetCygwin()) {
 // There is no external weak linkage on Mingw32 platform.
 // Defaulting to external
   } else {
@@ -296,7 +293,8 @@
 for (std::set::iterator i = ExtWeakSymbols.begin(),
  e = ExtWeakSymbols.end();
  i != e; ++i) {
-  O << "\t.weak " << *i << "\n";
+  O << (Subtarget->isTargetDarwin() ? "\t.weak_reference" : "\t.weak")
+<< " " << *i << "\n";
 }
   }
   



___
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/X86AsmPrinter.cpp

2006-11-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86AsmPrinter.cpp updated: 1.215 -> 1.216
---
Log message:

Fix indentation.

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

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


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.215 
llvm/lib/Target/X86/X86AsmPrinter.cpp:1.216
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.215 Fri Dec  1 01:15:24 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp   Fri Dec  1 01:17:00 2006
@@ -291,8 +291,7 @@
   SwitchToDataSection("");
 
 for (std::set::iterator i = ExtWeakSymbols.begin(),
- e = ExtWeakSymbols.end();
- i != e; ++i) {
+ e = ExtWeakSymbols.end(); i != e; ++i) {
   O << (Subtarget->isTargetDarwin() ? "\t.weak_reference" : "\t.weak")
 << " " << *i << "\n";
 }



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


[llvm-commits] CVS: llvm/test/Regression/CFrontend/extern-weak.c

2006-11-30 Thread Chris Lattner


Changes in directory llvm/test/Regression/CFrontend:

extern-weak.c added (r1.1)
---
Log message:

new testcase to verify external weak continues to work


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

 extern-weak.c |   13 +
 1 files changed, 13 insertions(+)


Index: llvm/test/Regression/CFrontend/extern-weak.c
diff -c /dev/null llvm/test/Regression/CFrontend/extern-weak.c:1.1
*** /dev/null   Fri Dec  1 01:14:36 2006
--- llvm/test/Regression/CFrontend/extern-weak.cFri Dec  1 01:14:26 2006
***
*** 0 
--- 1,13 
+ // RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep extern_weak
+ 
+ // TODO: Enable this when darwin gets weak support:
+ // : %llvmgcc -O3 -S -o - -emit-llvm | llvm-as | llc
+ 
+ #ifdef __APPLE_CC__
+ void foo() __attribute__((weak_import));
+ #else
+ void foo() __attribute__((weak));
+ #endif
+ 
+ void bar() { foo(); }
+ 



___
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/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp

2006-11-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ATTAsmPrinter.cpp updated: 1.75 -> 1.76
X86AsmPrinter.cpp updated: 1.216 -> 1.217
---
Log message:

Minor code clean up.

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

 X86ATTAsmPrinter.cpp |3 +--
 X86AsmPrinter.cpp|3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)


Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.75 
llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.76
--- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.75   Thu Nov 30 18:25:12 2006
+++ llvm/lib/Target/X86/X86ATTAsmPrinter.cppFri Dec  1 01:38:23 2006
@@ -256,9 +256,8 @@
   O << Name;
 }
 
-if (GV->hasExternalWeakLinkage()) {
+if (GV->hasExternalWeakLinkage())
   ExtWeakSymbols.insert(Name);
-}
 
 int Offset = MO.getOffset();
 if (Offset > 0)


Index: llvm/lib/Target/X86/X86AsmPrinter.cpp
diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.216 
llvm/lib/Target/X86/X86AsmPrinter.cpp:1.217
--- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.216 Fri Dec  1 01:17:00 2006
+++ llvm/lib/Target/X86/X86AsmPrinter.cpp   Fri Dec  1 01:38:23 2006
@@ -283,10 +283,9 @@
 O << "\t.ascii \" -export:" << *i << "\"\n";
   }
 
-  if (Subtarget->isTargetCygwin()) {
+  if (!Subtarget->isTargetCygwin()) {
 // There is no external weak linkage on Mingw32 platform.
 // Defaulting to external
-  } else {
 if (ExtWeakSymbols.begin() != ExtWeakSymbols.end())
   SwitchToDataSection("");
 



___
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/PPCAsmPrinter.cpp

2006-11-30 Thread Evan Cheng


Changes in directory llvm/lib/Target/PowerPC:

PPCAsmPrinter.cpp updated: 1.211 -> 1.212
---
Log message:

Darwin PPC external weak linkage support.

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

 PPCAsmPrinter.cpp |   16 +++-
 1 files changed, 15 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.211 
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.212
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.211 Tue Nov 28 12:21:52 2006
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp   Fri Dec  1 01:56:37 2006
@@ -52,6 +52,9 @@
 std::set FnStubs, GVStubs;
 const PPCSubtarget &Subtarget;
 
+// Necessary for external weak linkage support
+std::set ExtWeakSymbols;
+
 PPCAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
   : AsmPrinter(O, TM, T), Subtarget(TM.getSubtarget()) {
 }
@@ -159,6 +162,8 @@
 std::string Name = Mang->getValueName(GV);
 FnStubs.insert(Name);
 O << "L" << Name << "$stub";
+if (GV->hasExternalWeakLinkage())
+  ExtWeakSymbols.insert(Name);
 return;
   }
 }
@@ -330,8 +335,10 @@
 return;
   }
 }
-
 O << Name;
+
+if (GV->hasExternalWeakLinkage())
+  ExtWeakSymbols.insert(Name);
 return;
   }
 
@@ -633,6 +640,13 @@
 }
   }
 
+  if (ExtWeakSymbols.begin() != ExtWeakSymbols.end())
+SwitchToDataSection("");
+  for (std::set::iterator i = ExtWeakSymbols.begin(),
+   e = ExtWeakSymbols.end(); i != e; ++i) {
+O << "\t.weak_reference " << *i << "\n";
+  }
+
   bool isPPC64 = TD->getPointerSizeInBits() == 64;
 
   // Output stubs for dynamically-linked functions



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