[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.y

2007-01-07 Thread Reid Spencer


Changes in directory llvm/tools/llvm-upgrade:

UpgradeParser.y updated: 1.35 -> 1.36
---
Log message:

Upgrade the llvm.isunordered intrinsics to "fcmp uno" instruction.


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

 UpgradeParser.y |   38 --
 1 files changed, 24 insertions(+), 14 deletions(-)


Index: llvm/tools/llvm-upgrade/UpgradeParser.y
diff -u llvm/tools/llvm-upgrade/UpgradeParser.y:1.35 
llvm/tools/llvm-upgrade/UpgradeParser.y:1.36
--- llvm/tools/llvm-upgrade/UpgradeParser.y:1.35Sat Jan  6 00:03:09 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.y Sun Jan  7 02:07:10 2007
@@ -1872,21 +1872,31 @@
 delete $2.val;
   }
   | OptTailCall OptCallingConv TypesV ValueRef '(' ValueRefListE ')'  {
-if (!$2->empty())
-  *$1 += " " + *$2;
-if (!$1->empty())
-  *$1 += " ";
-*$1 += $3->getNewTy() + " " + *$4.val + "(";
-for (unsigned i = 0; i < $6->size(); ++i) {
-  ValueInfo& VI = (*$6)[i];
-  *$1 += *VI.val;
-  if (i+1 < $6->size())
-*$1 += ", ";
-  VI.destroy();
+// map llvm.isunordered to "fcmp uno" 
+if (*$4.val == "%llvm.isunordered.f32" ||
+*$4.val == "%llvm.isunordered.f64") {
+  $$.val = new std::string( "fcmp uno " + *(*$6)[0].val + ", ");
+  size_t pos = (*$6)[1].val->find(' ');
+  assert(pos != std::string::npos && "no space?");
+  *$$.val += (*$6)[1].val->substr(pos+1);
+  $$.type = TypeInfo::get("bool", BoolTy);
+} else {
+  if (!$2->empty())
+*$1 += " " + *$2;
+  if (!$1->empty())
+*$1 += " ";
+  *$1 += $3->getNewTy() + " " + *$4.val + "(";
+  for (unsigned i = 0; i < $6->size(); ++i) {
+ValueInfo& VI = (*$6)[i];
+*$1 += *VI.val;
+if (i+1 < $6->size())
+  *$1 += ", ";
+VI.destroy();
+  }
+  *$1 += ")";
+  $$.val = $1;
+  $$.type = getFunctionReturnType($3);
 }
-*$1 += ")";
-$$.val = $1;
-$$.type = getFunctionReturnType($3);
 delete $2; $4.destroy(); delete $6;
   }
   | MemoryInst ;



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


[llvm-commits] CVS: llvm/tools/llvm-upgrade/UpgradeParser.cpp UpgradeParser.cpp.cvs UpgradeParser.y.cvs

2007-01-07 Thread Reid Spencer


Changes in directory llvm/tools/llvm-upgrade:

UpgradeParser.cpp updated: 1.37 -> 1.38
UpgradeParser.cpp.cvs updated: 1.35 -> 1.36
UpgradeParser.y.cvs updated: 1.34 -> 1.35
---
Log message:

Regenerate.


---
Diffs of the changes:  (+104 -74)

 UpgradeParser.cpp |   70 --
 UpgradeParser.cpp.cvs |   70 --
 UpgradeParser.y.cvs   |   38 +--
 3 files changed, 104 insertions(+), 74 deletions(-)


Index: llvm/tools/llvm-upgrade/UpgradeParser.cpp
diff -u llvm/tools/llvm-upgrade/UpgradeParser.cpp:1.37 
llvm/tools/llvm-upgrade/UpgradeParser.cpp:1.38
--- llvm/tools/llvm-upgrade/UpgradeParser.cpp:1.37  Sat Jan  6 00:04:32 2007
+++ llvm/tools/llvm-upgrade/UpgradeParser.cpp   Sun Jan  7 02:07:39 2007
@@ -1580,9 +1580,9 @@
 1598,  1601,  1607,  1607,  1609,  1614,  1619,  1624,  1632,  1640,
 1647,  1669,  1674,  1680,  1686,  1694,  1712,  1720,  1729,  1733,
 1740,  1741,  1745,  1750,  1753,  1762,  1770,  1779,  1787,  1795,
-1800,  1809,  1837,  1843,  1849,  1856,  1862,  1868,  1874,  1892,
-1897,  1898,  1902,  1903,  1906,  1914,  1923,  1931,  1940,  1946,
-1955,  1964
+1800,  1809,  1837,  1843,  1849,  1856,  1862,  1868,  1874,  1902,
+1907,  1908,  1912,  1913,  1916,  1924,  1933,  1941,  1950,  1956,
+1965,  1974
 };
 #endif
 
@@ -4340,42 +4340,52 @@
   case 288:
 #line 1874 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
 {
-if (!(yyvsp[-5].String)->empty())
-  *(yyvsp[-6].String) += " " + *(yyvsp[-5].String);
-if (!(yyvsp[-6].String)->empty())
-  *(yyvsp[-6].String) += " ";
-*(yyvsp[-6].String) += (yyvsp[-4].Type)->getNewTy() + " " + 
*(yyvsp[-3].Value).val + "(";
-for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
-  ValueInfo& VI = (*(yyvsp[-1].ValList))[i];
-  *(yyvsp[-6].String) += *VI.val;
-  if (i+1 < (yyvsp[-1].ValList)->size())
-*(yyvsp[-6].String) += ", ";
-  VI.destroy();
+// map llvm.isunordered to "fcmp uno" 
+if (*(yyvsp[-3].Value).val == "%llvm.isunordered.f32" ||
+*(yyvsp[-3].Value).val == "%llvm.isunordered.f64") {
+  (yyval.Value).val = new std::string( "fcmp uno " + 
*(*(yyvsp[-1].ValList))[0].val + ", ");
+  size_t pos = (*(yyvsp[-1].ValList))[1].val->find(' ');
+  assert(pos != std::string::npos && "no space?");
+  *(yyval.Value).val += (*(yyvsp[-1].ValList))[1].val->substr(pos+1);
+  (yyval.Value).type = TypeInfo::get("bool", BoolTy);
+} else {
+  if (!(yyvsp[-5].String)->empty())
+*(yyvsp[-6].String) += " " + *(yyvsp[-5].String);
+  if (!(yyvsp[-6].String)->empty())
+*(yyvsp[-6].String) += " ";
+  *(yyvsp[-6].String) += (yyvsp[-4].Type)->getNewTy() + " " + 
*(yyvsp[-3].Value).val + "(";
+  for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
+ValueInfo& VI = (*(yyvsp[-1].ValList))[i];
+*(yyvsp[-6].String) += *VI.val;
+if (i+1 < (yyvsp[-1].ValList)->size())
+  *(yyvsp[-6].String) += ", ";
+VI.destroy();
+  }
+  *(yyvsp[-6].String) += ")";
+  (yyval.Value).val = (yyvsp[-6].String);
+  (yyval.Value).type = getFunctionReturnType((yyvsp[-4].Type));
 }
-*(yyvsp[-6].String) += ")";
-(yyval.Value).val = (yyvsp[-6].String);
-(yyval.Value).type = getFunctionReturnType((yyvsp[-4].Type));
 delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); delete 
(yyvsp[-1].ValList);
   ;}
 break;
 
   case 290:
-#line 1897 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1907 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
 { (yyval.ValList) = (yyvsp[0].ValList); ;}
 break;
 
   case 291:
-#line 1898 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1908 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
 {  (yyval.ValList) = new ValueList(); ;}
 break;
 
   case 293:
-#line 1903 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1913 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
 { (yyval.String) = new std::string(); ;}
 break;
 
   case 294:
-#line 1906 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1916 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
 {
 *(yyvsp[-2].String) += " " + (yyvsp[-1].Type)->getNewTy();
 if (!(yyvsp[0].String)->empty())
@@ -4387,7 +4397,7 @@
 break;
 
   case 295:
-#line 1914 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1924 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
 {
 std::string Name = getUniqueName((yyvsp[-1].Value).val, (yyvsp[-2].Type));
 *(yyvsp[-5].String) += " " + (yyvsp[-4].Type)->getNewTy() + ", " + 
(yyvsp[-2].Type)->getNewTy() + " " + Name;
@@ -4400,7 +4410,7 @@
 break;
 
   case 296:
-#line 1923 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
+#line 1933 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser

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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/include/llvm:

Module.h updated: 1.78 -> 1.79
---
Log message:

Change the interface to Module::getOrInsertFunction to be easier to use,
to resolve PR1088: http://llvm.org/PR1088 , and to help PR411: 
http://llvm.org/PR411 .


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

 Module.h |   14 ++
 1 files changed, 10 insertions(+), 4 deletions(-)


Index: llvm/include/llvm/Module.h
diff -u llvm/include/llvm/Module.h:1.78 llvm/include/llvm/Module.h:1.79
--- llvm/include/llvm/Module.h:1.78 Sat Jan  6 01:24:43 2007
+++ llvm/include/llvm/Module.h  Sun Jan  7 02:09:25 2007
@@ -166,15 +166,21 @@
 /// @{
 public:
   /// getOrInsertFunction - Look up the specified function in the module symbol
-  /// table.  If it does not exist, add a prototype for the function and return
-  /// it.
-  Function *getOrInsertFunction(const std::string &Name, const FunctionType 
*T);
+  /// table.  Four possibilities:
+  ///   1. If it does not exist, add a prototype for the function and return 
it.
+  ///   2. If it exists, and has internal linkage, the existing function is
+  ///  renamed and a new one is inserted.
+  ///   3. Otherwise, if the existing function has the correct prototype, 
return
+  ///  the existing function.
+  ///   4. Finally, the function exists but has the wrong prototype: return the
+  ///  function with a constantexpr cast to the right prototype.
+  Constant *getOrInsertFunction(const std::string &Name, const FunctionType 
*T);
 
   /// getOrInsertFunction - Look up the specified function in the module symbol
   /// table.  If it does not exist, add a prototype for the function and return
   /// it.  This version of the method takes a null terminated list of function
   /// arguments, which makes it easier for clients to use.
-  Function *getOrInsertFunction(const std::string &Name, const Type *RetTy,...)
+  Constant *getOrInsertFunction(const std::string &Name, const Type *RetTy,...)
 END_WITH_NULL;
 
   /// getFunction - Look up the specified function in the module symbol table.



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


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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/VMCore:

Module.cpp updated: 1.71 -> 1.72
---
Log message:

Change the interface to Module::getOrInsertFunction to be easier to use,
to resolve PR1088: http://llvm.org/PR1088 , and to help PR411: 
http://llvm.org/PR411 .


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

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


Index: llvm/lib/VMCore/Module.cpp
diff -u llvm/lib/VMCore/Module.cpp:1.71 llvm/lib/VMCore/Module.cpp:1.72
--- llvm/lib/VMCore/Module.cpp:1.71 Sat Jan  6 01:24:44 2007
+++ llvm/lib/VMCore/Module.cpp  Sun Jan  7 02:09:25 2007
@@ -152,23 +152,35 @@
 // Methods for easy access to the functions in the module.
 //
 
-// getOrInsertFunction - Look up the specified function in the module symbol
-// table.  If it does not exist, add a prototype for the function and return
-// it.  This is nice because it allows most passes to get away with not 
handling
-// the symbol table directly for this common task.
-//
-Function *Module::getOrInsertFunction(const std::string &Name,
+Constant *Module::getOrInsertFunction(const std::string &Name,
   const FunctionType *Ty) {
   SymbolTable &SymTab = getValueSymbolTable();
 
-  // See if we have a definitions for the specified function already...
-  if (Value *V = SymTab.lookup(PointerType::get(Ty), Name)) {
-return cast(V);  // Yup, got it
-  } else { // Nope, add one
+  // See if we have a definitions for the specified function already.
+  Function *F =
+dyn_cast_or_null(SymTab.lookup(PointerType::get(Ty), Name));
+  if (F == 0) {
+// Nope, add it.
 Function *New = new Function(Ty, GlobalVariable::ExternalLinkage, Name);
 FunctionList.push_back(New);
-return New;// Return the new prototype...
+return New;// Return the new prototype.
   }
+
+  // Okay, the function exists.  Does it have externally visible linkage?
+  if (F->hasInternalLinkage()) {
+// Rename the function.
+F->setName(SymTab.getUniqueName(F->getType(), F->getName()));
+// Retry, now there won't be a conflict.
+return getOrInsertFunction(Name, Ty);
+  }
+
+  // If the function exists but has the wrong type, return a bitcast to the
+  // right type.
+  if (F->getFunctionType() != Ty)
+return ConstantExpr::getBitCast(F, PointerType::get(Ty));
+  
+  // Otherwise, we just found the existing function or a prototype.
+  return F;  
 }
 
 // getOrInsertFunction - Look up the specified function in the module symbol
@@ -176,7 +188,7 @@
 // This version of the method takes a null terminated list of function
 // arguments, which makes it easier for clients to use.
 //
-Function *Module::getOrInsertFunction(const std::string &Name,
+Constant *Module::getOrInsertFunction(const std::string &Name,
   const Type *RetTy, ...) {
   va_list Args;
   va_start(Args, RetTy);



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


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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen:

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

Change the interface to Module::getOrInsertFunction to be easier to use,to 
resolve PR1088: http://llvm.org/PR1088 , and to help PR411: 
http://llvm.org/PR411 .
This simplifies many clients also



---
Diffs of the changes:  (+40 -75)

 IntrinsicLowering.cpp |  115 +-
 1 files changed, 40 insertions(+), 75 deletions(-)


Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.55 
llvm/lib/CodeGen/IntrinsicLowering.cpp:1.56
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.55 Sat Dec 30 23:55:36 2006
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp  Sun Jan  7 02:12:01 2007
@@ -21,15 +21,14 @@
 using namespace llvm;
 
 template 
-static Function *EnsureFunctionExists(Module &M, const char *Name,
-  ArgIt ArgBegin, ArgIt ArgEnd,
-  const Type *RetTy) {
-  if (Function *F = M.getNamedFunction(Name)) return F;
-  // It doesn't already exist in the program, insert a new definition now.
+static void EnsureFunctionExists(Module &M, const char *Name,
+ ArgIt ArgBegin, ArgIt ArgEnd,
+ const Type *RetTy) {
+  // Insert a correctly-typed definition now.
   std::vector ParamTys;
   for (ArgIt I = ArgBegin; I != ArgEnd; ++I)
 ParamTys.push_back(I->getType());
-  return M.getOrInsertFunction(Name, FunctionType::get(RetTy, ParamTys, 
false));
+  M.getOrInsertFunction(Name, FunctionType::get(RetTy, ParamTys, false));
 }
 
 /// ReplaceCallWith - This function is used when we want to lower an intrinsic
@@ -38,53 +37,24 @@
 /// prototype doesn't match the arguments we expect to pass in.
 template 
 static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI,
- ArgIt ArgBegin, ArgIt ArgEnd, bool isSigned,
- const Type *RetTy, Function *&FCache) {
+ ArgIt ArgBegin, ArgIt ArgEnd,
+ const Type *RetTy, Constant *&FCache) {
   if (!FCache) {
 // If we haven't already looked up this function, check to see if the
 // program already contains a function with this name.
 Module *M = CI->getParent()->getParent()->getParent();
-FCache = M->getNamedFunction(NewFn);
-if (!FCache) {
-  // It doesn't already exist in the program, insert a new definition now.
-  std::vector ParamTys;
-  for (ArgIt I = ArgBegin; I != ArgEnd; ++I)
-ParamTys.push_back((*I)->getType());
-  FCache = M->getOrInsertFunction(NewFn,
- FunctionType::get(RetTy, ParamTys, 
false));
-}
-   }
-
-  const FunctionType *FT = FCache->getFunctionType();
-  std::vector Operands;
-  unsigned ArgNo = 0;
-  for (ArgIt I = ArgBegin; I != ArgEnd && ArgNo != FT->getNumParams(); 
-   ++I, ++ArgNo) {
-Value *Arg = *I;
-if (Arg->getType() != FT->getParamType(ArgNo)) {
-  Instruction::CastOps opcode = CastInst::getCastOpcode(Arg, isSigned,
-  FT->getParamType(ArgNo), isSigned);
-  Arg = CastInst::create(opcode, Arg, FT->getParamType(ArgNo), 
- Arg->getName(), CI);
-}
-Operands.push_back(Arg);
-  }
-  // Pass nulls into any additional arguments...
-  for (; ArgNo != FT->getNumParams(); ++ArgNo)
-Operands.push_back(Constant::getNullValue(FT->getParamType(ArgNo)));
-
-  std::string Name = CI->getName(); CI->setName("");
-  if (FT->getReturnType() == Type::VoidTy) Name.clear();
-  CallInst *NewCI = new CallInst(FCache, Operands, Name, CI);
-  if (!CI->use_empty()) {
-Value *V = NewCI;
-if (CI->getType() != NewCI->getType()) {
-  Instruction::CastOps opcode = CastInst::getCastOpcode(NewCI, isSigned,
-  CI->getType(), isSigned);
-  V = CastInst::create(opcode, NewCI, CI->getType(), Name, CI);
-}
-CI->replaceAllUsesWith(V);
+// Get or insert the definition now.
+std::vector ParamTys;
+for (ArgIt I = ArgBegin; I != ArgEnd; ++I)
+  ParamTys.push_back((*I)->getType());
+FCache = M->getOrInsertFunction(NewFn,
+FunctionType::get(RetTy, ParamTys, false));
   }
+
+  std::vector Operands(ArgBegin, ArgEnd);
+  CallInst *NewCI = new CallInst(FCache, Operands, CI->getName(), CI);
+  if (!CI->use_empty())
+CI->replaceAllUsesWith(NewCI);
   return NewCI;
 }
 
@@ -286,10 +256,9 @@
 // by the lowerinvoke pass.  In both cases, the right thing to do is to
 // convert the call to an explicit setjmp or longjmp call.
   case Intrinsic::setjmp: {
-static Function *SetjmpFCache = 0;
-static const unsigned castOpcodes[] = { Instruction::BitCast };
+static Constant *SetjmpFCache = 0;
 Value *V = ReplaceCallWith("setjmp", CI, CI->op_begin()+1, CI->op_end(),
-   castOpcodes, Type::

Re: [llvm-commits] PIC Codegen for Linux/X86. llvm-gcc patch

2007-01-07 Thread Chris Lattner

On Jan 6, 2007, at 5:43 AM, Anton Korobeynikov wrote:

> Hello, Everyone.
>
> Attached patch will allow llvm-gcc correctly generate PIC code, when
> -fPIC flag is supplied (surely, the PIC codegen patch for LLVM itself
> should be applied as well)

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/Transforms/IPO/SimplifyLibCalls.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

SimplifyLibCalls.cpp updated: 1.81 -> 1.82
---
Log message:

Change the interface to Module::getOrInsertFunction to be easier to use,to 
resolve PR1088: http://llvm.org/PR1088 , and to help PR411: 
http://llvm.org/PR411 .
This simplifies many clients also



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

 SimplifyLibCalls.cpp |  130 +++
 1 files changed, 49 insertions(+), 81 deletions(-)


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.81 
llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.82
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.81   Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cppSun Jan  7 02:12:01 2007
@@ -222,7 +222,7 @@
   const Type* getIntPtrType() const { return TD->getIntPtrType(); }
 
   /// @brief Return a Function* for the putchar libcall
-  Function* get_putchar() {
+  Constant *get_putchar() {
 if (!putchar_func)
   putchar_func = 
 M->getOrInsertFunction("putchar", Type::Int32Ty, Type::Int32Ty, NULL);
@@ -230,7 +230,7 @@
   }
 
   /// @brief Return a Function* for the puts libcall
-  Function* get_puts() {
+  Constant *get_puts() {
 if (!puts_func)
   puts_func = M->getOrInsertFunction("puts", Type::Int32Ty,
  PointerType::get(Type::Int8Ty),
@@ -239,7 +239,7 @@
   }
 
   /// @brief Return a Function* for the fputc libcall
-  Function* get_fputc(const Type* FILEptr_type) {
+  Constant *get_fputc(const Type* FILEptr_type) {
 if (!fputc_func)
   fputc_func = M->getOrInsertFunction("fputc", Type::Int32Ty, 
Type::Int32Ty,
   FILEptr_type, NULL);
@@ -247,7 +247,7 @@
   }
 
   /// @brief Return a Function* for the fputs libcall
-  Function* get_fputs(const Type* FILEptr_type) {
+  Constant *get_fputs(const Type* FILEptr_type) {
 if (!fputs_func)
   fputs_func = M->getOrInsertFunction("fputs", Type::Int32Ty,
   PointerType::get(Type::Int8Ty),
@@ -256,7 +256,7 @@
   }
 
   /// @brief Return a Function* for the fwrite libcall
-  Function* get_fwrite(const Type* FILEptr_type) {
+  Constant *get_fwrite(const Type* FILEptr_type) {
 if (!fwrite_func)
   fwrite_func = M->getOrInsertFunction("fwrite", TD->getIntPtrType(),
PointerType::get(Type::Int8Ty),
@@ -267,7 +267,7 @@
   }
 
   /// @brief Return a Function* for the sqrt libcall
-  Function* get_sqrt() {
+  Constant *get_sqrt() {
 if (!sqrt_func)
   sqrt_func = M->getOrInsertFunction("sqrt", Type::DoubleTy, 
  Type::DoubleTy, NULL);
@@ -275,7 +275,7 @@
   }
 
   /// @brief Return a Function* for the strlen libcall
-  Function* get_strcpy() {
+  Constant *get_strcpy() {
 if (!strcpy_func)
   strcpy_func = M->getOrInsertFunction("strcpy",
PointerType::get(Type::Int8Ty),
@@ -286,7 +286,7 @@
   }
 
   /// @brief Return a Function* for the strlen libcall
-  Function* get_strlen() {
+  Constant *get_strlen() {
 if (!strlen_func)
   strlen_func = M->getOrInsertFunction("strlen", TD->getIntPtrType(),
PointerType::get(Type::Int8Ty),
@@ -295,7 +295,7 @@
   }
 
   /// @brief Return a Function* for the memchr libcall
-  Function* get_memchr() {
+  Constant *get_memchr() {
 if (!memchr_func)
   memchr_func = M->getOrInsertFunction("memchr",
PointerType::get(Type::Int8Ty),
@@ -306,7 +306,7 @@
   }
 
   /// @brief Return a Function* for the memcpy libcall
-  Function* get_memcpy() {
+  Constant *get_memcpy() {
 if (!memcpy_func) {
   const Type *SBP = PointerType::get(Type::Int8Ty);
   const char *N = TD->getIntPtrType() == Type::Int32Ty ?
@@ -318,17 +318,17 @@
 return memcpy_func;
   }
 
-  Function *getUnaryFloatFunction(const char *Name, Function *&Cache) {
+  Constant *getUnaryFloatFunction(const char *Name, Constant *&Cache) {
 if (!Cache)
   Cache = M->getOrInsertFunction(Name, Type::FloatTy, Type::FloatTy, NULL);
 return Cache;
   }
   
-  Function *get_floorf() { return getUnaryFloatFunction("floorf", 
floorf_func);}
-  Function *get_ceilf()  { return getUnaryFloatFunction( "ceilf",  
ceilf_func);}
-  Function *get_roundf() { return getUnaryFloatFunction("roundf", 
roundf_func);}
-  Function *get_rintf()  { return getUnaryFloatFunction( "rintf",  
rintf_func);}
-  Function *get_nearbyintf() { return getUnaryFloatFunction("nearbyintf",
+  Constant *get_floorf() { return getUnaryFloatFunction("floorf", 
floorf_func);}
+  Constant *get_ceilf()  { return getUnaryFloatFunction( "ceilf",  
ceilf_func);}
+  Constant *get_roundf() { return getUnaryFloatFunction("roundf", 
roundf_func);}
+  Constant *get_rintf()  { return getUnaryFloatFunction( "

[llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerAllocations.cpp LowerInvoke.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Utils:

LowerAllocations.cpp updated: 1.69 -> 1.70
LowerInvoke.cpp updated: 1.49 -> 1.50
---
Log message:

Change the interface to Module::getOrInsertFunction to be easier to use,to 
resolve PR1088: http://llvm.org/PR1088 , and to help PR411: 
http://llvm.org/PR411 .
This simplifies many clients also



---
Diffs of the changes:  (+30 -100)

 LowerAllocations.cpp |   64 ++---
 LowerInvoke.cpp  |   66 +--
 2 files changed, 30 insertions(+), 100 deletions(-)


Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp
diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.69 
llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.70
--- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.69 Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/Utils/LowerAllocations.cpp  Sun Jan  7 02:12:01 2007
@@ -32,8 +32,8 @@
   /// %free calls.
   ///
   class VISIBILITY_HIDDEN LowerAllocations : public BasicBlockPass {
-Function *MallocFunc;   // Functions in the module we are processing
-Function *FreeFunc; // Initialized by doInitialization
+Constant *MallocFunc;   // Functions in the module we are processing
+Constant *FreeFunc; // Initialized by doInitialization
 bool LowerMallocArgToInteger;
   public:
 LowerAllocations(bool LowerToInt = false)
@@ -84,19 +84,12 @@
 // This function is always successful.
 //
 bool LowerAllocations::doInitialization(Module &M) {
-  const Type *SBPTy = PointerType::get(Type::Int8Ty);
-  MallocFunc = M.getNamedFunction("malloc");
-  FreeFunc   = M.getNamedFunction("free");
-
-  if (MallocFunc == 0) {
-// Prototype malloc as "void* malloc(...)", because we don't know in
-// doInitialization whether size_t is int or long.
-FunctionType *FT = FunctionType::get(SBPTy,std::vector(),true);
-MallocFunc = M.getOrInsertFunction("malloc", FT);
-  }
-  if (FreeFunc == 0)
-FreeFunc = M.getOrInsertFunction("free"  , Type::VoidTy, SBPTy, (Type *)0);
-
+  const Type *BPTy = PointerType::get(Type::Int8Ty);
+  // Prototype malloc as "char* malloc(...)", because we don't know in
+  // doInitialization whether size_t is int or long.
+  FunctionType *FT = FunctionType::get(BPTy, std::vector(), true);
+  MallocFunc = M.getOrInsertFunction("malloc", FT);
+  FreeFunc = M.getOrInsertFunction("free"  , Type::VoidTy, BPTy, (Type *)0);
   return true;
 }
 
@@ -145,27 +138,8 @@
 }
   }
 
-  const FunctionType *MallocFTy = MallocFunc->getFunctionType();
-  std::vector MallocArgs;
-
-  if (MallocFTy->getNumParams() > 0 || MallocFTy->isVarArg()) {
-if (MallocFTy->isVarArg()) {
-  if (MallocArg->getType() != IntPtrTy)
-MallocArg = CastInst::createIntegerCast(MallocArg, IntPtrTy, 
-false /*ZExt*/, "", I);
-} else if (MallocFTy->getNumParams() > 0 &&
-   MallocFTy->getParamType(0) != Type::Int32Ty)
-  MallocArg = CastInst::createIntegerCast(
-  MallocArg, MallocFTy->getParamType(0), false/*ZExt*/, "",I);
-MallocArgs.push_back(MallocArg);
-  }
-
-  // If malloc is prototyped to take extra arguments, pass nulls.
-  for (unsigned i = 1; i < MallocFTy->getNumParams(); ++i)
-   
MallocArgs.push_back(Constant::getNullValue(MallocFTy->getParamType(i)));
-
-  // Create the call to Malloc...
-  CallInst *MCall = new CallInst(MallocFunc, MallocArgs, "", I);
+  // Create the call to Malloc.
+  CallInst *MCall = new CallInst(MallocFunc, MallocArg, "", I);
   MCall->setTailCall();
 
   // Create a cast instruction to convert to the right type...
@@ -181,23 +155,11 @@
   Changed = true;
   ++NumLowered;
 } else if (FreeInst *FI = dyn_cast(I)) {
-  const FunctionType *FreeFTy = FreeFunc->getFunctionType();
-  std::vector FreeArgs;
-
-  if (FreeFTy->getNumParams() > 0 || FreeFTy->isVarArg()) {
-Value *MCast = FI->getOperand(0);
-if (FreeFTy->getNumParams() > 0 &&
-FreeFTy->getParamType(0) != MCast->getType())
-  MCast = new BitCastInst(MCast, FreeFTy->getParamType(0), "", I);
-FreeArgs.push_back(MCast);
-  }
-
-  // If malloc is prototyped to take extra arguments, pass nulls.
-  for (unsigned i = 1; i < FreeFTy->getNumParams(); ++i)
-   FreeArgs.push_back(Constant::getNullValue(FreeFTy->getParamType(i)));
+  Value *PtrCast = new BitCastInst(FI->getOperand(0),
+   PointerType::get(Type::Int8Ty), "", I);
 
   // Insert a call to the free function...
-  (new CallInst(FreeFunc, FreeArgs, "", I))->setTailCall();
+  (new CallInst(FreeFunc, PtrCast, "", I))->setTailCall();
 
   // Delete the old free instruction
   I = --BBIL.erase(I);


Index: llvm/lib/Transforms/Utils/LowerInvoke.cpp
diff -u llvm/lib/Transforms/Utils/LowerInvoke.c

[llvm-commits] CVS: llvm/tools/bugpoint/Miscompilation.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/tools/bugpoint:

Miscompilation.cpp updated: 1.83 -> 1.84
---
Log message:

relax type


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

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


Index: llvm/tools/bugpoint/Miscompilation.cpp
diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.83 
llvm/tools/bugpoint/Miscompilation.cpp:1.84
--- llvm/tools/bugpoint/Miscompilation.cpp:1.83 Sun Dec 31 00:02:26 2006
+++ llvm/tools/bugpoint/Miscompilation.cpp  Sun Jan  7 02:13:39 2007
@@ -673,7 +673,7 @@
 
   // Add the resolver to the Safe module.
   // Prototype: void *getPointerToNamedFunction(const char* Name)
-  Function *resolverFunc =
+  Constant *resolverFunc =
 Safe->getOrInsertFunction("getPointerToNamedFunction",
   PointerType::get(Type::Int8Ty),
   PointerType::get(Type::Int8Ty), (Type *)0);



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


[llvm-commits] CVS: llvm/examples/HowToUseJIT/HowToUseJIT.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/examples/HowToUseJIT:

HowToUseJIT.cpp updated: 1.13 -> 1.14
---
Log message:

add some casts to support a change in the getOrInsertFunction interface


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

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


Index: llvm/examples/HowToUseJIT/HowToUseJIT.cpp
diff -u llvm/examples/HowToUseJIT/HowToUseJIT.cpp:1.13 
llvm/examples/HowToUseJIT/HowToUseJIT.cpp:1.14
--- llvm/examples/HowToUseJIT/HowToUseJIT.cpp:1.13  Sat Dec 30 23:50:28 2006
+++ llvm/examples/HowToUseJIT/HowToUseJIT.cpp   Sun Jan  7 01:40:09 2007
@@ -52,8 +52,9 @@
   // Create the add1 function entry and insert this entry into module M.  The
   // function will have a return type of "int" and take an argument of "int".
   // The '0' terminates the list of argument types.
-  Function *Add1F = M->getOrInsertFunction("add1", Type::Int32Ty, 
Type::Int32Ty,
-   (Type *)0);
+  Function *Add1F =
+cast(M->getOrInsertFunction("add1", Type::Int32Ty, Type::Int32Ty,
+  (Type *)0));
 
   // Add a basic block to the function. As before, it automatically inserts
   // because of the last argument.
@@ -78,7 +79,8 @@
 
   // Now we going to create function `foo', which returns an int and takes no
   // arguments.
-  Function *FooF = M->getOrInsertFunction("foo", Type::Int32Ty, (Type *)0);
+  Function *FooF =
+cast(M->getOrInsertFunction("foo", Type::Int32Ty, (Type *)0));
 
   // Add a basic block to the FooF function.
   BB = new BasicBlock("EntryBlock", FooF);



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


[llvm-commits] CVS: llvm/examples/Fibonacci/fibonacci.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/examples/Fibonacci:

fibonacci.cpp updated: 1.14 -> 1.15
---
Log message:

add some casts to support a change in the getOrInsertFunction interface


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

 fibonacci.cpp |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


Index: llvm/examples/Fibonacci/fibonacci.cpp
diff -u llvm/examples/Fibonacci/fibonacci.cpp:1.14 
llvm/examples/Fibonacci/fibonacci.cpp:1.15
--- llvm/examples/Fibonacci/fibonacci.cpp:1.14  Sat Dec 30 23:50:27 2006
+++ llvm/examples/Fibonacci/fibonacci.cpp   Sun Jan  7 01:40:09 2007
@@ -38,8 +38,9 @@
 static Function *CreateFibFunction(Module *M) {
   // Create the fib function and insert it into module M.  This function is 
said
   // to return an int and take an int parameter.
-  Function *FibF = M->getOrInsertFunction("fib", Type::Int32Ty, Type::Int32Ty,
-  (Type *)0);
+  Function *FibF =
+cast(M->getOrInsertFunction("fib", Type::Int32Ty, Type::Int32Ty,
+  (Type *)0));
 
   // Add a basic block to the function.
   BasicBlock *BB = new BasicBlock("EntryBlock", FibF);



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


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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/Target/X86:

X86TargetAsmInfo.cpp updated: 1.17 -> 1.18
---
Log message:

relax type


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

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


Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp
diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.17 
llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.18
--- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.17   Wed Jan  3 12:16:48 2007
+++ llvm/lib/Target/X86/X86TargetAsmInfo.cppSun Jan  7 01:24:32 2007
@@ -185,7 +185,7 @@
 
   // Okay, we can do this xform, do so now.
   Module *M = CI->getParent()->getParent()->getParent();
-  Function *Int = M->getOrInsertFunction(IntName, Ty, Ty, (Type*)0);
+  Constant *Int = M->getOrInsertFunction(IntName, Ty, Ty, (Type*)0);
   
   Value *Op = CI->getOperand(1);
   Op = new CallInst(Int, Op, CI->getName(), CI);



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


[llvm-commits] CVS: llvm/examples/ParallelJIT/ParallelJIT.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/examples/ParallelJIT:

ParallelJIT.cpp updated: 1.8 -> 1.9
---
Log message:

add some casts to support a change in the getOrInsertFunction interface


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

 ParallelJIT.cpp |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/examples/ParallelJIT/ParallelJIT.cpp
diff -u llvm/examples/ParallelJIT/ParallelJIT.cpp:1.8 
llvm/examples/ParallelJIT/ParallelJIT.cpp:1.9
--- llvm/examples/ParallelJIT/ParallelJIT.cpp:1.8   Sat Dec 30 23:50:28 2006
+++ llvm/examples/ParallelJIT/ParallelJIT.cpp   Sun Jan  7 01:40:09 2007
@@ -29,13 +29,13 @@
 #include 
 using namespace llvm;
 
-static Function* createAdd1(Module* M)
-{
+static Function* createAdd1(Module *M) {
   // Create the add1 function entry and insert this entry into module M.  The
   // function will have a return type of "int" and take an argument of "int".
   // The '0' terminates the list of argument types.
-  Function *Add1F = M->getOrInsertFunction("add1", Type::Int32Ty, 
Type::Int32Ty,
-   (Type *)0);
+  Function *Add1F =
+cast(M->getOrInsertFunction("add1", Type::Int32Ty, Type::Int32Ty,
+  (Type *)0));
 
   // Add a basic block to the function. As before, it automatically inserts
   // because of the last argument.
@@ -59,12 +59,12 @@
   return Add1F;
 }
 
-static Function *CreateFibFunction(Module *M)
-{
+static Function *CreateFibFunction(Module *M) {
   // Create the fib function and insert it into module M.  This function is 
said
   // to return an int and take an int parameter.
-  Function *FibF = M->getOrInsertFunction("fib", Type::Int32Ty, Type::Int32Ty,
-  (Type *)0);
+  Function *FibF = 
+cast(M->getOrInsertFunction("fib", Type::Int32Ty, Type::Int32Ty,
+  (Type *)0));
 
   // Add a basic block to the function.
   BasicBlock *BB = new BasicBlock("EntryBlock", FibF);



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


[llvm-commits] CVS: llvm/lib/Transforms/Utils/InlineFunction.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Utils:

InlineFunction.cpp updated: 1.48 -> 1.49
---
Log message:

prepare for adjustment to getOrInsertFunction method


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

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


Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.48 
llvm/lib/Transforms/Utils/InlineFunction.cpp:1.49
--- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.48   Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/Utils/InlineFunction.cppSun Jan  7 01:54:34 2007
@@ -274,19 +274,21 @@
   // code with llvm.stacksave/llvm.stackrestore intrinsics.
   if (InlinedFunctionInfo.ContainsDynamicAllocas) {
 Module *M = Caller->getParent();
-const Type *SBytePtr = PointerType::get(Type::Int8Ty);
+const Type *BytePtr = PointerType::get(Type::Int8Ty);
 // Get the two intrinsics we care about.
-Function *StackSave, *StackRestore;
-StackSave= M->getOrInsertFunction("llvm.stacksave", SBytePtr, NULL);
+Constant *StackSave, *StackRestore;
+StackSave= M->getOrInsertFunction("llvm.stacksave", BytePtr, NULL);
 StackRestore = M->getOrInsertFunction("llvm.stackrestore", Type::VoidTy,
-  SBytePtr, NULL);
+  BytePtr, NULL);
 
 // If we are preserving the callgraph, add edges to the stacksave/restore
 // functions for the calls we insert.
 CallGraphNode *StackSaveCGN = 0, *StackRestoreCGN = 0, *CallerNode = 0;
 if (CG) {
-  StackSaveCGN= CG->getOrInsertFunction(StackSave);
-  StackRestoreCGN = CG->getOrInsertFunction(StackRestore);
+  // We know that StackSave/StackRestore are Function*'s, because they are
+  // intrinsics which must have the right types.
+  StackSaveCGN= CG->getOrInsertFunction(cast(StackSave));
+  StackRestoreCGN = CG->getOrInsertFunction(cast(StackRestore));
   CallerNode = (*CG)[Caller];
 }
   



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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

LowerGC.cpp updated: 1.17 -> 1.18
---
Log message:

relax some types


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

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


Index: llvm/lib/Transforms/Scalar/LowerGC.cpp
diff -u llvm/lib/Transforms/Scalar/LowerGC.cpp:1.17 
llvm/lib/Transforms/Scalar/LowerGC.cpp:1.18
--- llvm/lib/Transforms/Scalar/LowerGC.cpp:1.17 Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/Scalar/LowerGC.cpp  Sun Jan  7 00:56:34 2007
@@ -37,7 +37,7 @@
 
 /// GCRead/GCWrite - These are the functions provided by the garbage
 /// collector for read/write barriers.
-Function *GCRead, *GCWrite;
+Constant *GCRead, *GCWrite;
 
 /// RootChain - This is the global linked-list that contains the chain of 
GC
 /// roots.



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


[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp RSProfiling.cpp TraceBasicBlocks.cpp TraceValues.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Instrumentation:

ProfilingUtils.cpp updated: 1.13 -> 1.14
RSProfiling.cpp updated: 1.14 -> 1.15
TraceBasicBlocks.cpp updated: 1.20 -> 1.21
TraceValues.cpp updated: 1.79 -> 1.80
---
Log message:

relax some types


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

 ProfilingUtils.cpp   |2 +-
 RSProfiling.cpp  |2 +-
 TraceBasicBlocks.cpp |   11 +--
 TraceValues.cpp  |   26 +-
 4 files changed, 20 insertions(+), 21 deletions(-)


Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp
diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.13 
llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.14
--- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.13 Sat Dec 30 
23:48:39 2006
+++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp  Sun Jan  7 
01:22:20 2007
@@ -25,7 +25,7 @@
   const Type *ArgVTy = PointerType::get(PointerType::get(Type::Int8Ty));
   const PointerType *UIntPtr = PointerType::get(Type::Int32Ty);
   Module &M = *MainFn->getParent();
-  Function *InitFn = M.getOrInsertFunction(FnName, Type::Int32Ty, 
Type::Int32Ty,
+  Constant *InitFn = M.getOrInsertFunction(FnName, Type::Int32Ty, 
Type::Int32Ty,
ArgVTy, UIntPtr, Type::Int32Ty,
(Type *)0);
 


Index: llvm/lib/Transforms/Instrumentation/RSProfiling.cpp
diff -u llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.14 
llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.15
--- llvm/lib/Transforms/Instrumentation/RSProfiling.cpp:1.14Sat Dec 30 
23:48:39 2006
+++ llvm/lib/Transforms/Instrumentation/RSProfiling.cpp Sun Jan  7 01:22:20 2007
@@ -127,7 +127,7 @@
   //deciding when to sample.
   class CycleCounter : public Chooser {
 uint64_t rm;
-Function* F;
+Constant *F;
   public:
 CycleCounter(Module& m, uint64_t resetmask);
 virtual ~CycleCounter();


Index: llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.20 
llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.21
--- llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cpp:1.20   Sat Dec 
30 23:48:39 2006
+++ llvm/lib/Transforms/Instrumentation/TraceBasicBlocks.cppSun Jan  7 
01:22:20 2007
@@ -45,17 +45,16 @@
   DOUT << "InsertInstrumentationCall (\"" << BB->getName ()
<< "\", \"" << FnName << "\", " << BBNumber << ")\n";
   Module &M = *BB->getParent ()->getParent ();
-  Function *InstrFn = M.getOrInsertFunction (FnName, Type::VoidTy,
+  Constant *InstrFn = M.getOrInsertFunction (FnName, Type::VoidTy,
  Type::Int32Ty, (Type *)0);
-  std::vector Args (1);
-  Args[0] = ConstantInt::get (Type::Int32Ty, BBNumber);
-
-  // Insert the call after any alloca or PHI instructions...
+  
+  // Insert the call after any alloca or PHI instructions.
   BasicBlock::iterator InsertPos = BB->begin();
   while (isa(InsertPos) || isa(InsertPos))
 ++InsertPos;
 
-  new CallInst (InstrFn, Args, "", InsertPos);
+  new CallInst(InstrFn, ConstantInt::get (Type::Int32Ty, BBNumber),
+   "", InsertPos);
 }
 
 bool TraceBasicBlocks::runOnModule(Module &M) {


Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp
diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.79 
llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.80
--- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.79Sat Dec 30 
23:48:39 2006
+++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp Sun Jan  7 01:22:20 2007
@@ -36,7 +36,7 @@
cl::value_desc("function"), cl::Hidden);
 
 static void TraceValuesAtBBExit(BasicBlock *BB,
-Function *Printf, Function* HashPtrToSeqNum,
+Constant *Printf, Constant* HashPtrToSeqNum,
  std::vector 
*valuesStoredInFunction);
 
 // We trace a particular function if no functions to trace were specified
@@ -54,8 +54,8 @@
 
 namespace {
   struct ExternalFuncs {
-Function *PrintfFunc, *HashPtrFunc, *ReleasePtrFunc;
-Function *RecordPtrFunc, *PushOnEntryFunc, *ReleaseOnReturnFunc;
+Constant *PrintfFunc, *HashPtrFunc, *ReleasePtrFunc;
+Constant *RecordPtrFunc, *PushOnEntryFunc, *ReleaseOnReturnFunc;
 void doInitialization(Module &M); // Add prototypes for external functions
   };
 
@@ -224,7 +224,7 @@
 
 static void InsertPrintInst(Value *V, BasicBlock *BB, Instruction 
*InsertBefore,
 std::string Message,
-Function *Printf, Function* HashPtrToSeqNum) {
+Constant *Printf, Constant* HashPtrToSeqNum) {
   // Escape Message by replacing all % characters with %% chars.
   std::string Tmp;
   std::swap(Tmp, Message);
@@ -266,8 +266,8 @@
 
 static void InsertVerbosePrintInst(Value *V, BasicBlock *BB,

[llvm-commits] CVS: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/Bytecode/Reader:

ReaderWrappers.cpp updated: 1.60 -> 1.61
---
Log message:

remove support for old-style varargs upgrading


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

 ReaderWrappers.cpp |  112 ++---
 1 files changed, 6 insertions(+), 106 deletions(-)


Index: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp
diff -u llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.60 
llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.61
--- llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.60Fri Dec 15 13:49:23 2006
+++ llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Sun Jan  7 00:45:57 2007
@@ -183,106 +183,6 @@
 }
 
 
//===--===//
-// Varargs transmogrification code...
-//
-
-// CheckVarargs - This is used to automatically translate old-style varargs to
-// new style varargs for backwards compatibility.
-static ModuleProvider* CheckVarargs(ModuleProvider* MP) {
-  Module* M = MP->getModule();
-
-  // check to see if va_start takes arguements...
-  Function* F = M->getNamedFunction("llvm.va_start");
-  if(F == 0) return MP; //No varargs use, just return.
-
-  if (F->getFunctionType()->getNumParams() == 1)
-return MP; // Modern varargs processing, just return.
-
-  // If we get to this point, we know that we have an old-style module.
-  // Materialize the whole thing to perform the rewriting.
-  if (MP->materializeModule() == 0)
-return 0;
-
-  if(Function* F = M->getNamedFunction("llvm.va_start")) {
-assert(F->arg_size() == 0 && "Obsolete va_start takes 0 argument!");
-
-//foo = va_start()
-// ->
-//bar = alloca typeof(foo)
-//va_start(bar)
-//foo = load bar
-
-const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
-const Type* ArgTy = F->getFunctionType()->getReturnType();
-const Type* ArgTyPtr = PointerType::get(ArgTy);
-Function* NF = M->getOrInsertFunction("llvm.va_start",
-  RetTy, ArgTyPtr, (Type *)0);
-
-for(Value::use_iterator I = F->use_begin(), E = F->use_end(); I != E;)
-  if (CallInst* CI = dyn_cast(*I++)) {
-AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI);
-new CallInst(NF, bar, "", CI);
-Value* foo = new LoadInst(bar, "vastart.fix.2", CI);
-CI->replaceAllUsesWith(foo);
-CI->getParent()->getInstList().erase(CI);
-  }
-F->setName("");
-  }
-
-  if(Function* F = M->getNamedFunction("llvm.va_end")) {
-assert(F->arg_size() == 1 && "Obsolete va_end takes 1 argument!");
-//vaend foo
-// ->
-//bar = alloca 1 of typeof(foo)
-//vaend bar
-const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
-const Type* ArgTy = F->getFunctionType()->getParamType(0);
-const Type* ArgTyPtr = PointerType::get(ArgTy);
-Function* NF = M->getOrInsertFunction("llvm.va_end",
-  RetTy, ArgTyPtr, (Type *)0);
-
-for(Value::use_iterator I = F->use_begin(), E = F->use_end(); I != E;)
-  if (CallInst* CI = dyn_cast(*I++)) {
-AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI);
-new StoreInst(CI->getOperand(1), bar, CI);
-new CallInst(NF, bar, "", CI);
-CI->getParent()->getInstList().erase(CI);
-  }
-F->setName("");
-  }
-
-  if(Function* F = M->getNamedFunction("llvm.va_copy")) {
-assert(F->arg_size() == 1 && "Obsolete va_copy takes 1 argument!");
-//foo = vacopy(bar)
-// ->
-//a = alloca 1 of typeof(foo)
-//b = alloca 1 of typeof(foo)
-//store bar -> b
-//vacopy(a, b)
-//foo = load a
-
-const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID);
-const Type* ArgTy = F->getFunctionType()->getReturnType();
-const Type* ArgTyPtr = PointerType::get(ArgTy);
-Function* NF = M->getOrInsertFunction("llvm.va_copy",
-  RetTy, ArgTyPtr, ArgTyPtr, (Type 
*)0);
-
-for(Value::use_iterator I = F->use_begin(), E = F->use_end(); I != E;)
-  if (CallInst* CI = dyn_cast(*I++)) {
-AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI);
-AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI);
-new StoreInst(CI->getOperand(1), b, CI);
-new CallInst(NF, a, b, "", CI);
-Value* foo = new LoadInst(a, "vacopy.fix.3", CI);
-CI->replaceAllUsesWith(foo);
-CI->getParent()->getInstList().erase(CI);
-  }
-F->setName("");
-  }
-  return MP;
-}
-
-//===--===//
 // Wrapper functions
 
//===--===//
 
@@ -294,11 +194,11 @@
   const std::string &ModuleID,
   std::string *ErrMsg, 
   BytecodeHandler *H) {
-  BytecodeBufferReader* rdr = 
+  BytecodeBuff

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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/IPO:

LowerSetJmp.cpp updated: 1.35 -> 1.36
---
Log message:

relax types


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

 LowerSetJmp.cpp |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)


Index: llvm/lib/Transforms/IPO/LowerSetJmp.cpp
diff -u llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.35 
llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.36
--- llvm/lib/Transforms/IPO/LowerSetJmp.cpp:1.35Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/IPO/LowerSetJmp.cpp Sun Jan  7 00:59:47 2007
@@ -61,13 +61,13 @@
   class LowerSetJmp : public ModulePass,
   public InstVisitor {
 // LLVM library functions...
-Function* InitSJMap;// __llvm_sjljeh_init_setjmpmap
-Function* DestroySJMap; // __llvm_sjljeh_destroy_setjmpmap
-Function* AddSJToMap;   // __llvm_sjljeh_add_setjmp_to_map
-Function* ThrowLongJmp; // __llvm_sjljeh_throw_longjmp
-Function* TryCatchLJ;   // __llvm_sjljeh_try_catching_longjmp_exception
-Function* IsLJException;// __llvm_sjljeh_is_longjmp_exception
-Function* GetLJValue;   // __llvm_sjljeh_get_longjmp_value
+Constant *InitSJMap;// __llvm_sjljeh_init_setjmpmap
+Constant *DestroySJMap; // __llvm_sjljeh_destroy_setjmpmap
+Constant *AddSJToMap;   // __llvm_sjljeh_add_setjmp_to_map
+Constant *ThrowLongJmp; // __llvm_sjljeh_throw_longjmp
+Constant *TryCatchLJ;   // __llvm_sjljeh_try_catching_longjmp_exception
+Constant *IsLJException;// __llvm_sjljeh_is_longjmp_exception
+Constant *GetLJValue;   // __llvm_sjljeh_get_longjmp_value
 
 typedef std::pair SwitchValuePair;
 



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


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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.63 -> 1.64
---
Log message:

this is an overcomplex way to call exit :)


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

 lli.cpp |   13 +
 1 files changed, 1 insertion(+), 12 deletions(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.63 llvm/tools/lli/lli.cpp:1.64
--- llvm/tools/lli/lli.cpp:1.63 Sun Dec 31 00:02:26 2006
+++ llvm/tools/lli/lli.cpp  Sun Jan  7 00:43:08 2007
@@ -118,18 +118,7 @@
 // Run static destructors.
 EE->runStaticConstructorsDestructors(true);
 
-// If the program didn't explicitly call exit, call exit now, for the
-// program. This ensures that any atexit handlers get called correctly.
-Function *Exit = MP->getModule()->getOrInsertFunction("exit", Type::VoidTy,
-  Type::Int32Ty,
-  (Type *)0);
-
-std::vector Args;
-GenericValue ResultGV;
-ResultGV.Int32Val = Result;
-Args.push_back(ResultGV);
-EE->runFunction(Exit, Args);
-
+exit(Result);
 std::cerr << "ERROR: exit(" << Result << ") returned!\n";
 abort();
   } catch (const std::string& msg) {



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


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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.585 -> 1.586
---
Log message:

relax some types


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

 InstructionCombining.cpp |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.585 
llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.586
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.585   Sat Jan  6 
13:53:32 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sun Jan  7 00:58:05 2007
@@ -3552,8 +3552,7 @@
 FnName = "llvm.bswap.i64";
   else
 assert(0 && "Unknown integer type!");
-  Function *F = M->getOrInsertFunction(FnName, I.getType(), I.getType(), NULL);
-  
+  Constant *F = M->getOrInsertFunction(FnName, I.getType(), I.getType(), NULL);
   return new CallInst(F, V);
 }
 
@@ -6953,7 +6952,7 @@
 Name = "llvm.memcpy.i32";
   else
 Name = "llvm.memcpy.i64";
-  Function *MemCpy = M->getOrInsertFunction(Name,
+  Constant *MemCpy = M->getOrInsertFunction(Name,
  
CI.getCalledFunction()->getFunctionType());
   CI.setOperand(0, MemCpy);
   Changed = true;



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


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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/Analysis:

ConstantFolding.cpp updated: 1.8 -> 1.9
---
Log message:

remove llvm.isunordered


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

 ConstantFolding.cpp |5 -
 1 files changed, 5 deletions(-)


Index: llvm/lib/Analysis/ConstantFolding.cpp
diff -u llvm/lib/Analysis/ConstantFolding.cpp:1.8 
llvm/lib/Analysis/ConstantFolding.cpp:1.9
--- llvm/lib/Analysis/ConstantFolding.cpp:1.8   Sat Dec 30 23:48:39 2006
+++ llvm/lib/Analysis/ConstantFolding.cpp   Sun Jan  7 02:19:47 2007
@@ -35,8 +35,6 @@
   const std::string &Name = F->getName();
 
   switch (F->getIntrinsicID()) {
-  case Intrinsic::isunordered_f32:
-  case Intrinsic::isunordered_f64:
   case Intrinsic::sqrt_f32:
   case Intrinsic::sqrt_f64:
   case Intrinsic::bswap_i16:
@@ -178,9 +176,6 @@
   if (ConstantFP *Op2 = dyn_cast(Operands[1])) {
 double Op2V = Op2->getValue();
 
-if (Name == "llvm.isunordered.f32" || Name == "llvm.isunordered.f64")
-  return ConstantBool::get(IsNAN(Op1V) || IsNAN(Op2V));
-else
 if (Name == "pow") {
   errno = 0;
   double V = pow(Op1V, Op2V);



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


[llvm-commits] CVS: llvm/test/Regression/CodeGen/CBackend/2007-01-06-Signless.c

2007-01-07 Thread Reid Spencer


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

2007-01-06-Signless.c added (r1.1)
---
Log message:

Add a test case for PR1086: http://llvm.org/PR1086 


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

 2007-01-06-Signless.c |6 ++
 1 files changed, 6 insertions(+)


Index: llvm/test/Regression/CodeGen/CBackend/2007-01-06-Signless.c
diff -c /dev/null 
llvm/test/Regression/CodeGen/CBackend/2007-01-06-Signless.c:1.1
*** /dev/null   Sat Jan  6 21:27:49 2007
--- llvm/test/Regression/CodeGen/CBackend/2007-01-06-Signless.c Sat Jan  6 
21:27:39 2007
***
*** 0 
--- 1,6 
+ // RUN: %llvmgcc -S %s -o - | llvm-as | llc -march=c | \
+ // RUN:  grep '(unsigned short'
+ 
+ int Z = -1;
+ 
+ int test(unsigned short X, short Y) { return X+Y+Z; }



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


[llvm-commits] llvm-gcc patch applied

2007-01-07 Thread Chris Lattner

Update code to work with new Module::getOrInsertFunction
prototype.  Fix unordered comparison emission from being this:

%tmp = fcmp uno float %tmp, %tmp1   ;   
[#uses=1]
%tmp2 = call bool %llvm.isunordered.f32( float %tmp, float % 
tmp1 )

%tmp3 = or bool %tmp, %tmp2 ;  [#uses=1]

to now be:

%tmp = fcmp uno float %tmp, %tmp1

Index: llvm-convert.cpp
===
--- llvm-convert.cpp(revision 122083)
+++ llvm-convert.cpp(working copy)
@@ -551,26 +551,34 @@
   // Binary Operators
   case LT_EXPR: 
 Result = EmitCompare(exp, ICmpInst::ICMP_ULT, ICmpInst::ICMP_SLT, 
- FCmpInst::FCMP_OLT); break;
+ FCmpInst::FCMP_OLT);
+break;
   case LE_EXPR:
 Result = EmitCompare(exp, ICmpInst::ICMP_ULE, ICmpInst::ICMP_SLE,
- FCmpInst::FCMP_OLE); break;
+ FCmpInst::FCMP_OLE);
+break;
   case GT_EXPR:
 Result = EmitCompare(exp, ICmpInst::ICMP_UGT, ICmpInst::ICMP_SGT,
- FCmpInst::FCMP_OGT); break;
+ FCmpInst::FCMP_OGT);
+break;
   case GE_EXPR:
 Result = EmitCompare(exp, ICmpInst::ICMP_UGE, ICmpInst::ICMP_SGE, 
- FCmpInst::FCMP_OGE); break;
+ FCmpInst::FCMP_OGE);
+break;
   case EQ_EXPR:
 Result = EmitCompare(exp, ICmpInst::ICMP_EQ, ICmpInst::ICMP_EQ, 
- FCmpInst::FCMP_OEQ); break;
+ FCmpInst::FCMP_OEQ);
+break;
   case NE_EXPR:
 Result = EmitCompare(exp, ICmpInst::ICMP_NE, ICmpInst::ICMP_NE, 
- FCmpInst::FCMP_UNE); break;
+ FCmpInst::FCMP_UNE);
+break;
   case UNORDERED_EXPR: 
-Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_UNO); break;
+Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_UNO);
+break;
   case ORDERED_EXPR: 
-Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_ORD); break;
+Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_ORD);
+break;
   case UNLT_EXPR: Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_ULT); break;
   case UNLE_EXPR: Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_ULE); break;
   case UNGT_EXPR: Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_UGT); break;
@@ -936,7 +944,7 @@
 void TreeToLLVM::EmitMemCpy(Value *DestPtr, Value *SrcPtr, Value *Size, 
 unsigned Align) {
   const Type *SBP = PointerType::get(Type::Int8Ty);
-  static Function *MemCpy = 0;
+  static Constant *MemCpy = 0;
   const Type *IntPtr = TD.getIntPtrType();
   if (!MemCpy) {
 const char *Name = IntPtr == Type::Int32Ty ?
@@ -956,7 +964,7 @@
 void TreeToLLVM::EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, 
  unsigned Align) {
   const Type *SBP = PointerType::get(Type::Int8Ty);
-  static Function *MemMove = 0;
+  static Constant *MemMove = 0;
   const Type *IntPtr = TD.getIntPtrType();
   if (!MemMove) {
 const char *Name = IntPtr == Type::Int32Ty ?
@@ -975,7 +983,7 @@
 void TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, 
 unsigned Align) {
   const Type *SBP = PointerType::get(Type::Int8Ty);
-  static Function *MemSet = 0;
+  static Constant *MemSet = 0;
   const Type *IntPtr = TD.getIntPtrType();
   if (!MemSet) {
 const char *Name = IntPtr == Type::Int32Ty ?
@@ -2409,32 +2417,9 @@
   }
 
   // Handle floating point comparisons, if we get here.
-  Value *Result = 0;
-  if (FPPred)
-Result = new FCmpInst(FCmpInst::Predicate(FPPred), LHS, RHS, "tmp", CurBB);
+  Value *Result =
+new FCmpInst(FCmpInst::Predicate(FPPred), LHS, RHS, "tmp", CurBB);
   
-  if (CmpInst::isUnordered(FCmpInst::Predicate(FPPred))) {
-static Function *IsUnordF = 0, *IsUnordD = 0;
-Function *&Callee = LHS->getType() == Type::FloatTy ? IsUnordF : IsUnordD;
-const char *Name  = LHS->getType() == Type::FloatTy ?
- "llvm.isunordered.f32" : "llvm.isunordered.f64";
-
-if (Callee == 0)
-  Callee = TheModule->getOrInsertFunction(Name,
-  Type::BoolTy, LHS->getType(),
-  LHS->getType(), NULL);
-
-Value *IsUnord = new CallInst(Callee, LHS, RHS, "tmp", CurBB);
-if (Result)
-  Result = BinaryOperator::createOr(Result, IsUnord, "tmp", CurBB);
-else
-  Result = IsUnord;
-
-// If this is an ORDERED_EXPR, invert the result of the isunordered call.
-if (TREE_CODE(exp) == ORDERED_EXPR)
-  Result = BinaryOperator::createNot(Result, "tmp", CurBB);
-  }
-  
   // The GCC type is probably an int, not a bool.
   return CastToUIntType(Result, ConvertType(TREE_TYPE(exp)));
 }
@@ -3144,7 +3129,7 @@
  Value *DestLoc, Value *&Result) {
   if (DECL_BUILT_IN_CLASS(fndecl) == BUILT_IN_MD) {

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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.340 -> 1.341
---
Log message:

remove support for llvm.isunordered


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

 SelectionDAGISel.cpp |   22 --
 1 files changed, 22 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.340 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.341
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.340Thu Jan  4 
19:46:20 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Sun Jan  7 02:37:22 2007
@@ -843,22 +843,6 @@
   !InBlock(BOp->getOperand(1), CurBB->getBasicBlock())) {
 const BasicBlock *BB = CurBB->getBasicBlock();
 
-if (IntrinsicInst *II = dyn_cast(Cond))
-  if ((II->getIntrinsicID() == Intrinsic::isunordered_f32 ||
-   II->getIntrinsicID() == Intrinsic::isunordered_f64) &&
-  // The operands of the setcc have to be in this block.  We don't know
-  // how to export them from some other block.  If this is the first
-  // block of the sequence, no exporting is needed.
-  (CurBB == CurMBB ||
-   (isExportableFromCurrentBlock(II->getOperand(1), BB) &&
-isExportableFromCurrentBlock(II->getOperand(2), BB {
-SelectionDAGISel::CaseBlock CB(ISD::SETUO, II->getOperand(1),
-   II->getOperand(2), TBB, FBB, CurBB);
-SwitchCases.push_back(CB);
-return;
-  }
-
-
 // If the leaf of the tree is a comparison, merge the condition into 
 // the caseblock.
 if ((isa(Cond) || isa(Cond)) &&
@@ -2038,12 +2022,6 @@
 return 0;
   }
 
-  case Intrinsic::isunordered_f32:
-  case Intrinsic::isunordered_f64:
-setValue(&I, DAG.getSetCC(MVT::i1,getValue(I.getOperand(1)),
-  getValue(I.getOperand(2)), ISD::SETUO));
-return 0;
-
   case Intrinsic::sqrt_f32:
   case Intrinsic::sqrt_f64:
 setValue(&I, DAG.getNode(ISD::FSQRT,



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


[llvm-commits] CVS: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/projects/Stacker/lib/compiler:

StackerCompiler.cpp updated: 1.29 -> 1.30
---
Log message:

relax type


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

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


Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp
diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.29 
llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.30
--- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.29 Sat Dec 30 
23:50:28 2006
+++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp  Sun Jan  7 
02:39:27 2007
@@ -895,7 +895,7 @@
 case DUMP :  // Dump the stack (debugging aid)
 {
 if (echo) bb->setName("DUMP");
-Function* f = TheModule->getOrInsertFunction(
+Constant * f = TheModule->getOrInsertFunction(
 "_stacker_dump_stack_", DefinitionType);
 std::vector args;
 bb->getInstList().push_back( new CallInst( f, args ) );



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


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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/CodeGen:

IntrinsicLowering.cpp updated: 1.56 -> 1.57
---
Log message:

llvm 2.0 doesn't support llvm.isunordered.*


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

 IntrinsicLowering.cpp |   17 -
 1 files changed, 17 deletions(-)


Index: llvm/lib/CodeGen/IntrinsicLowering.cpp
diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.56 
llvm/lib/CodeGen/IntrinsicLowering.cpp:1.57
--- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.56 Sun Jan  7 02:12:01 2007
+++ llvm/lib/CodeGen/IntrinsicLowering.cpp  Sun Jan  7 02:52:43 2007
@@ -92,11 +92,6 @@
   Type::Int32Ty, (--(--I->arg_end()))->getType(),
   (Type *)0);
 break;
-  case Intrinsic::isunordered_f32:
-  case Intrinsic::isunordered_f64:
-EnsureFunctionExists(M, "isunordered", I->arg_begin(), I->arg_end(),
- Type::BoolTy);
-break;
   case Intrinsic::sqrt_f32:
   case Intrinsic::sqrt_f64:
 if(I->arg_begin()->getType() == Type::FloatTy)
@@ -392,18 +387,6 @@
 (*(CI->op_begin()+1))->getType(), MemsetFCache);
 break;
   }
-  case Intrinsic::isunordered_f32:
-  case Intrinsic::isunordered_f64: {
-Value *L = CI->getOperand(1);
-Value *R = CI->getOperand(2);
-
-Value *LIsNan = new FCmpInst(FCmpInst::FCMP_ONE, L, L, "LIsNan", CI);
-Value *RIsNan = new FCmpInst(FCmpInst::FCMP_ONE, R, R, "RIsNan", CI);
-CI->replaceAllUsesWith(
-  BinaryOperator::create(Instruction::Or, LIsNan, RIsNan,
- "isunordered", CI));
-break;
-  }
   case Intrinsic::sqrt_f32: {
 static Constant *sqrtfFCache = 0;
 ReplaceCallWith("sqrtf", CI, CI->op_begin()+1, CI->op_end(),



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


[llvm-commits] CVS: llvm/include/llvm/Intrinsics.td

2007-01-07 Thread Chris Lattner


Changes in directory llvm/include/llvm:

Intrinsics.td updated: 1.37 -> 1.38
---
Log message:

llvm 2.0 doesn't support llvm.isunordered.*


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

 Intrinsics.td |4 
 1 files changed, 4 deletions(-)


Index: llvm/include/llvm/Intrinsics.td
diff -u llvm/include/llvm/Intrinsics.td:1.37 
llvm/include/llvm/Intrinsics.td:1.38
--- llvm/include/llvm/Intrinsics.td:1.37Sun Dec 31 16:24:55 2006
+++ llvm/include/llvm/Intrinsics.td Sun Jan  7 02:52:43 2007
@@ -161,10 +161,6 @@
 }
 
 let Properties = [IntrNoMem] in {
-  def int_isunordered_f32 : Intrinsic<[llvm_bool_ty, 
-   llvm_float_ty,  llvm_float_ty]>;
-  def int_isunordered_f64 : Intrinsic<[llvm_bool_ty, 
-   llvm_double_ty, llvm_double_ty]>;
   def int_sqrt_f32 : Intrinsic<[llvm_float_ty , llvm_float_ty]>;
   def int_sqrt_f64 : Intrinsic<[llvm_double_ty, llvm_double_ty]>;
 



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


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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/docs:

LangRef.html updated: 1.188 -> 1.189
---
Log message:

llvm.isunordered is no longer alive.


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

 LangRef.html |   38 +-
 1 files changed, 1 insertion(+), 37 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.188 llvm/docs/LangRef.html:1.189
--- llvm/docs/LangRef.html:1.188Fri Jan  5 15:33:08 2007
+++ llvm/docs/LangRef.html  Sun Jan  7 02:53:26 2007
@@ -173,7 +173,6 @@
   'llvm.memcpy.*' Intrinsic
   'llvm.memmove.*' Intrinsic
   'llvm.memset.*' Intrinsic
-  'llvm.isunordered.*' 
Intrinsic
   'llvm.sqrt.*' Intrinsic
   'llvm.powi.*' Intrinsic
 
@@ -4212,41 +4211,6 @@
 
 
 
-  'llvm.isunordered.*' Intrinsic
-
-
-
-
-Syntax:
-
-  declare bool %llvm.isunordered.f32(float Val1, float  Val2)
-  declare bool %llvm.isunordered.f64(double Val1, double Val2)
-
-
-Overview:
-
-
-The 'llvm.isunordered' intrinsics return true if either or both of the
-specified floating point values is a NAN.
-
-
-Arguments:
-
-
-The arguments are floating point numbers of the same type.
-
-
-Semantics:
-
-
-If either or both of the arguments is a SNAN or QNAN, it returns true, 
otherwise
-false.
-
-
-
-
-
-
   'llvm.sqrt.*' Intrinsic
 
 
@@ -4504,7 +4468,7 @@
 
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/01/05 21:33:08 $
+  Last modified: $Date: 2007/01/07 08:53:26 $
 
 
 



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


[llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Vector/Altivec/2007-01-07-lvsl-lvsr-Regression.c

2007-01-07 Thread Jim Laskey


Changes in directory llvm-test/SingleSource/UnitTests/Vector/Altivec:

2007-01-07-lvsl-lvsr-Regression.c added (r1.1)
---
Log message:

Regression test for llvm-rs6000.cpp function cache overlap.

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

 2007-01-07-lvsl-lvsr-Regression.c |   28 
 1 files changed, 28 insertions(+)


Index: 
llvm-test/SingleSource/UnitTests/Vector/Altivec/2007-01-07-lvsl-lvsr-Regression.c
diff -c /dev/null 
llvm-test/SingleSource/UnitTests/Vector/Altivec/2007-01-07-lvsl-lvsr-Regression.c:1.1
*** /dev/null   Sun Jan  7 07:32:40 2007
--- 
llvm-test/SingleSource/UnitTests/Vector/Altivec/2007-01-07-lvsl-lvsr-Regression.c
   Sun Jan  7 07:32:30 2007
***
*** 0 
--- 1,28 
+ #include 
+ #include 
+ 
+ __vector unsigned char C_uchar1[2] = {
+   { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
+   { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 }
+ };
+ __vector unsigned char C_uchar2[2] = {
+   { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
+   { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 }
+ };
+ 
+ void print_vector(__vector unsigned char v) {
+   unsigned *vp = (unsigned *)&v;
+   printf("%08x%08x%08x%08x\n", vp[0], vp[1], vp[2], vp[3]);
+ }
+ 
+ int main(int argc, const char * argv[]) {
+   C_uchar1[0] = (__vector unsigned char)__builtin_altivec_lvsl(1,
+  (void 
*)&C_uchar1); 
+   C_uchar2[0] = (__vector unsigned char)__builtin_altivec_lvsr(1,
+  (void 
*)&C_uchar2); 
+   print_vector(C_uchar1[0]);
+   print_vector(C_uchar1[1]);
+   print_vector(C_uchar2[0]);
+   print_vector(C_uchar2[1]);
+   return 0;
+ }



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


[llvm-commits] [llvm-commit][llvm-gcc]llvm-rs6000.cpp function cache patch

2007-01-07 Thread Jim Laskey
When I converted the megamacro over to C, I should have listened to  
the alarms going off in my head when I saw "static Function *Cache =  
NULL;".  There should have been a per call site cache.  The result of  
this mistake was that the same function prototype was being used for  
several altivec builtins.  The fix is to pass in a cache from each  
call site.


Cheers,

-- Jim




FunctionCache.patch
Description: Binary data


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


Re: [llvm-commits] [llvm-commit][llvm-gcc]llvm-rs6000.cpp function cache patch

2007-01-07 Thread Jim Laskey

Ignore previous patch.  This one doesn't trounce Chris' patch.



FunctionCache.patch
Description: Binary data



On 7-Jan-07, at 09:49 AM, Jim Laskey wrote:

When I converted the megamacro over to C, I should have listened to  
the alarms going off in my head when I saw "static Function *Cache  
= NULL;".  There should have been a per call site cache.  The  
result of this mistake was that the same function prototype was  
being used for several altivec builtins.  The fix is to pass in a  
cache from each call site.


Cheers,

-- Jim



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




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


[llvm-commits] CVS: llvm/include/llvm/Transforms/Instrumentation.h

2007-01-07 Thread Chris Lattner


Changes in directory llvm/include/llvm/Transforms:

Instrumentation.h updated: 1.10 -> 1.11
---
Log message:

remove an old instrumentation pass that is not used anymore.


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

 Instrumentation.h |   12 
 1 files changed, 12 deletions(-)


Index: llvm/include/llvm/Transforms/Instrumentation.h
diff -u llvm/include/llvm/Transforms/Instrumentation.h:1.10 
llvm/include/llvm/Transforms/Instrumentation.h:1.11
--- llvm/include/llvm/Transforms/Instrumentation.h:1.10 Mon Nov 28 12:00:28 2005
+++ llvm/include/llvm/Transforms/Instrumentation.h  Sun Jan  7 12:12:13 2007
@@ -47,18 +47,6 @@
 ModulePass* createNullProfilerRSPass();
 FunctionPass* createRSProfilingPass();
 
-
-//===--===//
-// Support for inserting LLVM code to print values at basic block and function
-// exits.
-//
-
-// Just trace function entry/exit
-FunctionPass *createTraceValuesPassForBasicBlocks();
-
-// Trace BB's and methods
-FunctionPass *createTraceValuesPassForFunction();
-
 } // End llvm namespace
 
 #endif



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


[llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/TraceValues.cpp

2007-01-07 Thread Chris Lattner


Changes in directory llvm/lib/Transforms/Instrumentation:

TraceValues.cpp (r1.80) removed
---
Log message:

this pass is unused


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

 0 files changed



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


[llvm-commits] CVS: llvm/runtime/libtrace/Makefile README.txt tracelib.c tracelib.h

2007-01-07 Thread Chris Lattner


Changes in directory llvm/runtime/libtrace:

Makefile (r1.16) removed
README.txt (r1.3) removed
tracelib.c (r1.14) removed
tracelib.h (r1.5) removed
---
Log message:

the old trace values pass has been removed, remove its runtime library.


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

 0 files changed



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


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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/runtime:

Makefile updated: 1.30 -> 1.31
---
Log message:

the old trace values pass has been removed, remove its runtime library.


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

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


Index: llvm/runtime/Makefile
diff -u llvm/runtime/Makefile:1.30 llvm/runtime/Makefile:1.31
--- llvm/runtime/Makefile:1.30  Thu Nov 16 21:32:33 2006
+++ llvm/runtime/Makefile   Sun Jan  7 12:13:48 2007
@@ -18,7 +18,7 @@
$(Echo) "Warning: with llvm-gcc version 4 and beyond"
 else 
 ifneq ($(wildcard $(LLVMGCC)),)
-PARALLEL_DIRS  := GCCLibraries  libdummy libprofile libtrace GC
+PARALLEL_DIRS  := GCCLibraries  libdummy libprofile GC
 else
 PARALLEL_DIRS  := 
 install all ::



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


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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/include/llvm:

LinkAllPasses.h updated: 1.6 -> 1.7
---
Log message:

remove an old instrumentation pass that is not used anymore.


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

 LinkAllPasses.h |2 --
 1 files changed, 2 deletions(-)


Index: llvm/include/llvm/LinkAllPasses.h
diff -u llvm/include/llvm/LinkAllPasses.h:1.6 
llvm/include/llvm/LinkAllPasses.h:1.7
--- llvm/include/llvm/LinkAllPasses.h:1.6   Wed Dec 13 13:55:53 2006
+++ llvm/include/llvm/LinkAllPasses.h   Sun Jan  7 12:12:13 2007
@@ -106,8 +106,6 @@
   (void) llvm::createTailCallEliminationPass();
   (void) llvm::createTailDuplicationPass();
   (void) llvm::createTraceBasicBlockPass();
-  (void) llvm::createTraceValuesPassForBasicBlocks();
-  (void) llvm::createTraceValuesPassForFunction();
   (void) llvm::createUnifyFunctionExitNodesPass();
   (void) llvm::createCondPropagationPass();
   (void) llvm::createNullProfilerRSPass();



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


[llvm-commits] CVS: llvm/test/Feature/calltest.ll instructions.ll

2007-01-07 Thread Reid Spencer


Changes in directory llvm/test/Feature:

calltest.ll updated: 1.6 -> 1.7
instructions.ll updated: 1.4 -> 1.5
---
Log message:

Redefinition of functions is no longer permitted.


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

 calltest.ll |3 +--
 instructions.ll |4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)


Index: llvm/test/Feature/calltest.ll
diff -u llvm/test/Feature/calltest.ll:1.6 llvm/test/Feature/calltest.ll:1.7
--- llvm/test/Feature/calltest.ll:1.6   Fri Dec  1 22:23:07 2006
+++ llvm/test/Feature/calltest.ll   Sun Jan  7 13:33:49 2007
@@ -4,8 +4,7 @@
 
 %FunTy = type int(int)
 
-declare int "test"(...)   ; Test differences of prototype
-declare int "test"()  ; Differ only by vararg
+declare int "test"(int)   ; Test forward declaration merging
 
 implementation
 


Index: llvm/test/Feature/instructions.ll
diff -u llvm/test/Feature/instructions.ll:1.4 
llvm/test/Feature/instructions.ll:1.5
--- llvm/test/Feature/instructions.ll:1.4   Fri Dec  1 22:23:07 2006
+++ llvm/test/Feature/instructions.ll   Sun Jan  7 13:33:49 2007
@@ -12,13 +12,13 @@
 ret <4 x uint> %R
 }
 
-<4 x uint> %test_shufflevector(<4 x uint> %V) {
+<4 x uint> %test_shufflevector_u(<4 x uint> %V) {
 %R = shufflevector <4 x uint> %V, <4 x uint> %V, 
   <4 x uint> < uint 1, uint undef, uint 7, uint 2>
 ret <4 x uint> %R
 }
 
-<4 x float> %test_shufflevector(<4 x float> %V) {
+<4 x float> %test_shufflevector_f(<4 x float> %V) {
 %R = shufflevector <4 x float> %V, <4 x float> undef, 
   <4 x uint> < uint 1, uint undef, uint 7, uint 2>
 ret <4 x float> %R



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


[llvm-commits] Cummulative Patch Request

2007-01-07 Thread Reid Spencer
The SVN mirror is still not updating. It is stuck at r240 which is now
several days old. There have been many important changes and fixes since
then. Could someone please create a cumulative patch from r240 so the
mirror users only have one patch to apply?

Thanks,

Reid.

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

2007-01-07 Thread Reid Spencer


Changes in directory llvm/lib/Transforms/IPO:

SimplifyLibCalls.cpp updated: 1.82 -> 1.83
---
Log message:

Types should be const.


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

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


Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.82 
llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.83
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.82   Sun Jan  7 02:12:01 2007
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cppSun Jan  7 15:45:41 2007
@@ -1091,7 +1091,7 @@
 // Get the type we will cast to, based on size of the string
 Value* dest = ci->getOperand(1);
 Value* src = ci->getOperand(2);
-Type* castType = 0;
+const Type* castType = 0;
 switch (len)
 {
   case 0:
@@ -1195,7 +1195,7 @@
 // Get the type we will cast to, based on size of memory area to fill, and
 // and the value we will store there.
 Value* dest = ci->getOperand(1);
-Type* castType = 0;
+const Type* castType = 0;
 switch (len) {
   case 1:
 castType = Type::Int8Ty;



___
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/DeadStoreElimination/2006-06-27-AST-Remove.ll

2007-01-07 Thread Reid Spencer


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

2006-06-27-AST-Remove.ll updated: 1.3 -> 1.4
---
Log message:

llvm.isunordered.* are gone.


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

 2006-06-27-AST-Remove.ll |2 --
 1 files changed, 2 deletions(-)


Index: 
llvm/test/Regression/Transforms/DeadStoreElimination/2006-06-27-AST-Remove.ll
diff -u 
llvm/test/Regression/Transforms/DeadStoreElimination/2006-06-27-AST-Remove.ll:1.3
 
llvm/test/Regression/Transforms/DeadStoreElimination/2006-06-27-AST-Remove.ll:1.4
--- 
llvm/test/Regression/Transforms/DeadStoreElimination/2006-06-27-AST-Remove.ll:1.3
   Sun Dec 31 00:01:59 2006
+++ 
llvm/test/Regression/Transforms/DeadStoreElimination/2006-06-27-AST-Remove.ll   
Sun Jan  7 17:30:23 2007
@@ -1105,8 +1105,6 @@
 
 declare void (int)* %signal(int, void (int)*)
 
-declare bool %llvm.isunordered.f64(double, double)
-
 declare fastcc void %hash_extract_pv(int, sbyte*)
 
 declare double %difftime(int, int)



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


[llvm-commits] [llvm-gcc] Cumulative Patch 2007-01-07

2007-01-07 Thread Reid Spencer
All,

Attached is a cumulative patch with all changes in the Apple repository
since the mirror's r240 revision. If you haven't applied the various
patches sent in the last few days, this one will be much easier. 

The attached patch also contains one thing that the Apple repository
doesn't have: fixes to i386.h for changes in the result type of
Module::getOrInsertFunction.

This patch compiles/works fine for me on Linux/x86

Reid.
Index: gcc/llvm-convert.cpp
===
--- gcc/llvm-convert.cpp	(revision 240)
+++ gcc/llvm-convert.cpp	(working copy)
@@ -38,7 +38,6 @@
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/SmallVector.h"
 #include 
 
 extern "C" {
@@ -210,14 +209,20 @@
 void HandleScalarArgument(const llvm::Type *LLVMTy, tree type) {
   Value *ArgVal = AI;
   if (ArgVal->getType() != LLVMTy) {
-// If this is just a mismatch between integer types, this could be due
-// to K&R prototypes, where the forward proto defines the arg as int and
-// the actual impls is a short or char.
-assert(ArgVal->getType()->isIntegral() && LLVMTy->isIntegral() &&
-   "Lowerings don't match?");
-bool isSigned = type == 0 ? true : !TYPE_UNSIGNED(type);
-ArgVal = CastInst::createIntegerCast(ArgVal, LLVMTy, isSigned,
- NameStack.back(), CurBB);
+if (isa(ArgVal->getType()) && isa(LLVMTy)) {
+  // If this is GCC being sloppy about pointer types, insert a bitcast.
+  // See PR1083 for an example.
+  ArgVal = new BitCastInst(ArgVal, LLVMTy, "tmp", CurBB);
+} else {
+  // If this is just a mismatch between integer types, this could be due
+  // to K&R prototypes, where the forward proto defines the arg as int
+  // and the actual impls is a short or char.
+  assert(ArgVal->getType()->isIntegral() && LLVMTy->isIntegral() &&
+ "Lowerings don't match?");
+  bool isSigned = type == 0 ? true : !TYPE_UNSIGNED(type);
+  ArgVal = CastInst::createIntegerCast(ArgVal, LLVMTy, isSigned,
+   NameStack.back(), CurBB);
+}
   }
   assert(!LocStack.empty());
   Value *Loc = LocStack.back();
@@ -546,32 +551,40 @@
   // Binary Operators
   case LT_EXPR: 
 Result = EmitCompare(exp, ICmpInst::ICMP_ULT, ICmpInst::ICMP_SLT, 
- FCmpInst::FCMP_OLT); break;
+ FCmpInst::FCMP_OLT);
+break;
   case LE_EXPR:
 Result = EmitCompare(exp, ICmpInst::ICMP_ULE, ICmpInst::ICMP_SLE,
- FCmpInst::FCMP_OLE); break;
+ FCmpInst::FCMP_OLE);
+break;
   case GT_EXPR:
 Result = EmitCompare(exp, ICmpInst::ICMP_UGT, ICmpInst::ICMP_SGT,
- FCmpInst::FCMP_OGT); break;
+ FCmpInst::FCMP_OGT);
+break;
   case GE_EXPR:
 Result = EmitCompare(exp, ICmpInst::ICMP_UGE, ICmpInst::ICMP_SGE, 
- FCmpInst::FCMP_OGE); break;
+ FCmpInst::FCMP_OGE);
+break;
   case EQ_EXPR:
 Result = EmitCompare(exp, ICmpInst::ICMP_EQ, ICmpInst::ICMP_EQ, 
- FCmpInst::FCMP_OEQ); break;
+ FCmpInst::FCMP_OEQ);
+break;
   case NE_EXPR:
 Result = EmitCompare(exp, ICmpInst::ICMP_NE, ICmpInst::ICMP_NE, 
- FCmpInst::FCMP_UNE); break;
+ FCmpInst::FCMP_UNE);
+break;
   case UNORDERED_EXPR: 
-Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_UNO); break;
+Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_UNO);
+break;
   case ORDERED_EXPR: 
-Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_ORD); break;
+Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_ORD);
+break;
   case UNLT_EXPR: Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_ULT); break;
   case UNLE_EXPR: Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_ULE); break;
   case UNGT_EXPR: Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_UGT); break;
   case UNGE_EXPR: Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_UGE); break;
   case UNEQ_EXPR: Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_UEQ); break;
-  case LTGT_EXPR: Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_UNE); break;
+  case LTGT_EXPR: Result = EmitCompare(exp, 0, 0, FCmpInst::FCMP_ONE); break;
   case PLUS_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Add);break;
   case MINUS_EXPR:Result = EmitBinOp(exp, DestLoc, Instruction::Sub);break;
   case MULT_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::Mul);break;
@@ -931,7 +944,7 @@
 void TreeToLLVM::EmitMemCpy(Value *DestPtr, Value *SrcPtr, Value *Size, 
 unsigned Align) {
   const Type *SBP = PointerType::get(Type::Int8Ty);
-  static Function *MemCpy = 0;
+  stati

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

2007-01-07 Thread Reid Spencer


Changes in directory llvm/lib/Analysis:

ConstantRange.cpp updated: 1.23 -> 1.24
ScalarEvolution.cpp updated: 1.80 -> 1.81
---
Log message:

Convert uses of getPrimitiveSize that should be getPrimitiveSizeInBits.


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

 ConstantRange.cpp   |   17 -
 ScalarEvolution.cpp |   12 ++--
 2 files changed, 14 insertions(+), 15 deletions(-)


Index: llvm/lib/Analysis/ConstantRange.cpp
diff -u llvm/lib/Analysis/ConstantRange.cpp:1.23 
llvm/lib/Analysis/ConstantRange.cpp:1.24
--- llvm/lib/Analysis/ConstantRange.cpp:1.23Sat Dec 23 00:05:40 2006
+++ llvm/lib/Analysis/ConstantRange.cpp Sun Jan  7 19:26:33 2007
@@ -36,7 +36,7 @@
   if (Ty->isInteger()) {
 if (isSigned) {
   // Calculate 011...
-  unsigned TypeBits = Ty->getPrimitiveSize()*8;
+  unsigned TypeBits = Ty->getPrimitiveSizeInBits();
   int64_t Val = INT64_MAX; // All ones
   Val >>= 64-TypeBits; // Shift out unwanted 1 bits...
   return ConstantInt::get(Ty, Val);
@@ -53,7 +53,7 @@
   if (Ty->isInteger()) {
 if (isSigned) {
   // Calculate 11
-  unsigned TypeBits = Ty->getPrimitiveSize()*8;
+  unsigned TypeBits = Ty->getPrimitiveSizeInBits();
   int64_t Val = -1;// All ones
   Val <<= TypeBits-1;  // Shift over to the right spot
   return ConstantInt::get(Ty, Val);
@@ -334,13 +334,12 @@
 /// correspond to the possible range of values as if the source range had been
 /// zero extended.
 ConstantRange ConstantRange::zeroExtend(const Type *Ty) const {
-  assert(getLower()->getType()->getPrimitiveSize() < Ty->getPrimitiveSize() &&
- "Not a value extension");
+  unsigned SrcTySize = getLower()->getType()->getPrimitiveSizeInBits();
+  assert(SrcTySize < Ty->getPrimitiveSizeInBits() && "Not a value extension");
   if (isFullSet()) {
 // Change a source full set into [0, 1 << 8*numbytes)
-unsigned SrcTySize = getLower()->getType()->getPrimitiveSize();
 return ConstantRange(Constant::getNullValue(Ty),
- ConstantInt::get(Ty, 1ULL << SrcTySize*8));
+ ConstantInt::get(Ty, 1ULL << SrcTySize));
   }
 
   Constant *Lower = getLower();
@@ -355,9 +354,9 @@
 /// correspond to the possible range of values as if the source range had been
 /// truncated to the specified type.
 ConstantRange ConstantRange::truncate(const Type *Ty) const {
-  assert(getLower()->getType()->getPrimitiveSize() > Ty->getPrimitiveSize() &&
- "Not a value truncation");
-  uint64_t Size = 1ULL << Ty->getPrimitiveSize()*8;
+  unsigned SrcTySize = getLower()->getType()->getPrimitiveSizeInBits();
+  assert(SrcTySize > Ty->getPrimitiveSize() && "Not a value truncation");
+  uint64_t Size = 1ULL << Ty->getPrimitiveSizeInBits();
   if (isFullSet() || getSetSize() >= Size)
 return ConstantRange(getType());
 


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.80 
llvm/lib/Analysis/ScalarEvolution.cpp:1.81
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.80  Sat Jan  6 20:24:26 2007
+++ llvm/lib/Analysis/ScalarEvolution.cpp   Sun Jan  7 19:26:33 2007
@@ -196,8 +196,8 @@
   : SCEV(scTruncate), Op(op), Ty(ty) {
   assert(Op->getType()->isInteger() && Ty->isInteger() &&
  "Cannot truncate non-integer value!");
-  assert(Op->getType()->getPrimitiveSize() > Ty->getPrimitiveSize() &&
- "This is not a truncating conversion!");
+  assert(Op->getType()->getPrimitiveSizeInBits() > Ty->getPrimitiveSizeInBits()
+ && "This is not a truncating conversion!");
 }
 
 SCEVTruncateExpr::~SCEVTruncateExpr() {
@@ -222,8 +222,8 @@
   : SCEV(scZeroExtend), Op(op), Ty(ty) {
   assert(Op->getType()->isInteger() && Ty->isInteger() &&
  "Cannot zero extend non-integer value!");
-  assert(Op->getType()->getPrimitiveSize() < Ty->getPrimitiveSize() &&
- "This is not an extending conversion!");
+  assert(Op->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()
+ && "This is not an extending conversion!");
 }
 
 SCEVZeroExtendExpr::~SCEVZeroExtendExpr() {
@@ -461,9 +461,9 @@
   const Type *SrcTy = V->getType();
   assert(SrcTy->isInteger() && Ty->isInteger() &&
  "Cannot truncate or zero extend with non-integer arguments!");
-  if (SrcTy->getPrimitiveSize() == Ty->getPrimitiveSize())
+  if (SrcTy->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits())
 return V;  // No conversion
-  if (SrcTy->getPrimitiveSize() > Ty->getPrimitiveSize())
+  if (SrcTy->getPrimitiveSizeInBits() > Ty->getPrimitiveSizeInBits())
 return SCEVTruncateExpr::get(V, Ty);
   return SCEVZeroExtendExpr::get(V, Ty);
 }



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


[llvm-commits] CVS: llvm/CREDITS.TXT

2007-01-07 Thread Chandler Carruth


Changes in directory llvm:

CREDITS.TXT updated: 1.66 -> 1.67
---
Log message:

Testing commit, and adding an entry to CREDITS.TXT


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

 CREDITS.TXT |4 
 1 files changed, 4 insertions(+)


Index: llvm/CREDITS.TXT
diff -u llvm/CREDITS.TXT:1.66 llvm/CREDITS.TXT:1.67
--- llvm/CREDITS.TXT:1.66   Mon Aug 28 20:42:47 2006
+++ llvm/CREDITS.TXTSun Jan  7 21:10:00 2007
@@ -39,6 +39,10 @@
 E: [EMAIL PROTECTED]
 D: The `mem2reg' pass - promotes values stored in memory to registers
 
+N: Chandler Carruth
+E: [EMAIL PROTECTED]
+D: LinkTimeOptimizer for Linux, via binutils integration, and C API
+
 N: Casey Carter
 E: [EMAIL PROTECTED]
 D: Fixes to the Reassociation pass, various improvement patches



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


Re: [llvm-commits] CVS: llvm/tools/lli/lli.cpp

2007-01-07 Thread Reid Spencer
Chris,

This patch breaks:
   SingleSource/UnitTests/2003-05-14-AtExit
for sure and possibly:
   External/SPEC/CINT2000/252.eon/252.eon

Please revert or fix.

Reid.

On Sun, 2007-01-07 at 00:43 -0600, Chris Lattner wrote:
> 
> Changes in directory llvm/tools/lli:
> 
> lli.cpp updated: 1.63 -> 1.64
> ---
> Log message:
> 
> this is an overcomplex way to call exit :)
> 
> 
> ---
> Diffs of the changes:  (+1 -12)
> 
>  lli.cpp |   13 +
>  1 files changed, 1 insertion(+), 12 deletions(-)
> 
> 
> Index: llvm/tools/lli/lli.cpp
> diff -u llvm/tools/lli/lli.cpp:1.63 llvm/tools/lli/lli.cpp:1.64
> --- llvm/tools/lli/lli.cpp:1.63   Sun Dec 31 00:02:26 2006
> +++ llvm/tools/lli/lli.cppSun Jan  7 00:43:08 2007
> @@ -118,18 +118,7 @@
>  // Run static destructors.
>  EE->runStaticConstructorsDestructors(true);
>  
> -// If the program didn't explicitly call exit, call exit now, for the
> -// program. This ensures that any atexit handlers get called correctly.
> -Function *Exit = MP->getModule()->getOrInsertFunction("exit", 
> Type::VoidTy,
> -  Type::Int32Ty,
> -  (Type *)0);
> -
> -std::vector Args;
> -GenericValue ResultGV;
> -ResultGV.Int32Val = Result;
> -Args.push_back(ResultGV);
> -EE->runFunction(Exit, Args);
> -
> +exit(Result);
>  std::cerr << "ERROR: exit(" << Result << ") returned!\n";
>  abort();
>} catch (const std::string& msg) {
> 
> 
> 
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


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

2007-01-07 Thread Reid Spencer


Changes in directory llvm/lib/Analysis:

ConstantRange.cpp updated: 1.24 -> 1.25
---
Log message:

Fix a bug in an assert that would never trigger.


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

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


Index: llvm/lib/Analysis/ConstantRange.cpp
diff -u llvm/lib/Analysis/ConstantRange.cpp:1.24 
llvm/lib/Analysis/ConstantRange.cpp:1.25
--- llvm/lib/Analysis/ConstantRange.cpp:1.24Sun Jan  7 19:26:33 2007
+++ llvm/lib/Analysis/ConstantRange.cpp Sun Jan  7 23:34:39 2007
@@ -355,7 +355,7 @@
 /// truncated to the specified type.
 ConstantRange ConstantRange::truncate(const Type *Ty) const {
   unsigned SrcTySize = getLower()->getType()->getPrimitiveSizeInBits();
-  assert(SrcTySize > Ty->getPrimitiveSize() && "Not a value truncation");
+  assert(SrcTySize > Ty->getPrimitiveSizeInBits() && "Not a value truncation");
   uint64_t Size = 1ULL << Ty->getPrimitiveSizeInBits();
   if (isFullSet() || getSetSize() >= Size)
 return ConstantRange(getType());



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


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

2007-01-07 Thread Chandler Carruth


Changes in directory llvm/tools:

Makefile updated: 1.60 -> 1.61
---
Log message:

Build libLLVMlto on non-Darwin architectures. Resolves PR1055: 
http://llvm.org/PR1055 : http://llvm.org/PR1055: http://llvm.org/PR1055 


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

 Makefile |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/tools/Makefile
diff -u llvm/tools/Makefile:1.60 llvm/tools/Makefile:1.61
--- llvm/tools/Makefile:1.60Fri Dec  1 22:46:36 2006
+++ llvm/tools/Makefile Mon Jan  8 00:25:29 2007
@@ -22,8 +22,8 @@
 
 include $(LEVEL)/Makefile.config
 
-# Disable liblto on non-darwin platforms right now until LLVM is built PIC.
-ifeq ($(OS), Darwin)
+# Disable liblto on Windows until compatability is determined.
+ifneq ($(OS), MingW)
 PARALLEL_DIRS += lto
 endif
 



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


[llvm-commits] CVS: llvm/tools/lto/Makefile lto.cpp

2007-01-07 Thread Chandler Carruth


Changes in directory llvm/tools/lto:

Makefile updated: 1.6 -> 1.7
lto.cpp updated: 1.28 -> 1.29
---
Log message:

Build libLLVMlto on non-Darwin architectures. Resolves PR1055: 
http://llvm.org/PR1055 : http://llvm.org/PR1055: http://llvm.org/PR1055 


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

 Makefile |   10 +++---
 lto.cpp  |3 +++
 2 files changed, 10 insertions(+), 3 deletions(-)


Index: llvm/tools/lto/Makefile
diff -u llvm/tools/lto/Makefile:1.6 llvm/tools/lto/Makefile:1.7
--- llvm/tools/lto/Makefile:1.6 Thu Sep  7 16:36:55 2006
+++ llvm/tools/lto/Makefile Mon Jan  8 00:25:29 2007
@@ -11,9 +11,13 @@
 LIBRARYNAME = LLVMlto
 
 LINK_LIBS_IN_SHARED = 1
-SHARED_LIBRARY = 1
-LOADABLE_MODULE = 1
-DONT_BUILD_RELINKED = 1
+ifeq ($(OS),Darwin)
+  SHARED_LIBRARY = 1
+  LOADABLE_MODULE = 1
+  DONT_BUILD_RELINKED = 1
+else
+  BUILD_ARCHIVE = 1
+endif
 
 # Include this here so we can get the configuration of the targets
 # that have been configured for construction. We have to do this 


Index: llvm/tools/lto/lto.cpp
diff -u llvm/tools/lto/lto.cpp:1.28 llvm/tools/lto/lto.cpp:1.29
--- llvm/tools/lto/lto.cpp:1.28 Sat Jan  6 17:51:31 2007
+++ llvm/tools/lto/lto.cpp  Mon Jan  8 00:25:29 2007
@@ -455,6 +455,9 @@
   return LTO_OPT_SUCCESS;
 }
 
+/// Unused pure-virtual destructor. Must remain empty.
+LinkTimeOptimizer::~LinkTimeOptimizer() {}
+
 /// Destruct LTO. Delete all modules, symbols and target.
 LTO::~LTO() {
   



___
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

2007-01-07 Thread Reid Spencer


Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.304 -> 1.305
---
Log message:

Fix PR1090: http://llvm.org/PR1090 :
Implemented some llvm_fcmp_{pred} functions at the start of the function bodies 
and use them for fcmp instructions and constant expressions. These help
implement the ordered and unordered comparisons necessary for correct exectuion
of these comparisons.


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

 Writer.cpp |  138 ++---
 1 files changed, 97 insertions(+), 41 deletions(-)


Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.304 
llvm/lib/Target/CBackend/Writer.cpp:1.305
--- llvm/lib/Target/CBackend/Writer.cpp:1.304   Sat Jan  6 21:24:48 2007
+++ llvm/lib/Target/CBackend/Writer.cpp Mon Jan  8 00:58:32 2007
@@ -732,7 +732,6 @@
 case Instruction::Or:
 case Instruction::Xor:
 case Instruction::ICmp:
-case Instruction::FCmp:
 case Instruction::Shl:
 case Instruction::LShr:
 case Instruction::AShr:
@@ -771,25 +770,6 @@
   default: assert(0 && "Illegal ICmp predicate");
 }
 break;
-  case Instruction::FCmp:
-switch (CE->getPredicate()) {
-  case FCmpInst::FCMP_ORD: 
-  case FCmpInst::FCMP_UEQ: 
-  case FCmpInst::FCMP_OEQ: Out << " == "; break;
-  case FCmpInst::FCMP_UNO: 
-  case FCmpInst::FCMP_UNE: 
-  case FCmpInst::FCMP_ONE: Out << " != "; break;
-  case FCmpInst::FCMP_OLT:
-  case FCmpInst::FCMP_ULT: Out << " < "; break;
-  case FCmpInst::FCMP_OLE:
-  case FCmpInst::FCMP_ULE: Out << " <= "; break;
-  case FCmpInst::FCMP_OGT: 
-  case FCmpInst::FCMP_UGT: Out << " > "; break;
-  case FCmpInst::FCMP_OGE:
-  case FCmpInst::FCMP_UGE: Out << " >= "; break;
-  default: assert(0 && "Illegal FCmp predicate");
-}
-break;
   default: assert(0 && "Illegal opcode here!");
   }
   printConstantWithCast(CE->getOperand(1), CE->getOpcode());
@@ -798,7 +778,42 @@
   Out << ')';
   return;
 }
-
+case Instruction::FCmp: {
+  Out << '('; 
+  bool NeedsClosingParens = printConstExprCast(CE); 
+  if (CE->getPredicate() == FCmpInst::FCMP_FALSE)
+Out << "0";
+  else if (CE->getPredicate() == FCmpInst::FCMP_TRUE)
+Out << "1";
+  else {
+const char* op = 0;
+switch (CE->getPredicate()) {
+default: assert(0 && "Illegal FCmp predicate");
+case FCmpInst::FCMP_ORD: op = "ord"; break;
+case FCmpInst::FCMP_UNO: op = "uno"; break;
+case FCmpInst::FCMP_UEQ: op = "ueq"; break;
+case FCmpInst::FCMP_UNE: op = "une"; break;
+case FCmpInst::FCMP_ULT: op = "ult"; break;
+case FCmpInst::FCMP_ULE: op = "ule"; break;
+case FCmpInst::FCMP_UGT: op = "ugt"; break;
+case FCmpInst::FCMP_UGE: op = "uge"; break;
+case FCmpInst::FCMP_OEQ: op = "oeq"; break;
+case FCmpInst::FCMP_ONE: op = "one"; break;
+case FCmpInst::FCMP_OLT: op = "olt"; break;
+case FCmpInst::FCMP_OLE: op = "ole"; break;
+case FCmpInst::FCMP_OGT: op = "ogt"; break;
+case FCmpInst::FCMP_OGE: op = "oge"; break;
+}
+Out << "llvm_fcmp_" << op << "(";
+printConstantWithCast(CE->getOperand(0), CE->getOpcode());
+Out << ", ";
+printConstantWithCast(CE->getOperand(1), CE->getOpcode());
+Out << ")";
+  }
+  if (NeedsClosingParens)
+Out << "))";
+  Out << ')';
+}
 default:
   cerr << "CWriter Error: Unhandled constant expression: "
<< *CE << "\n";
@@ -1563,6 +1578,37 @@
 
   if (!M.empty())
 Out << "\n\n/* Function Bodies */\n";
+
+  // Emit some helper functions for dealing with FCMP instruction's 
+  // predicates
+  Out << "static inline int llvm_fcmp_ord(double X, double Y) { ";
+  Out << "return X == X && Y == Y; }\n";
+  Out << "static inline int llvm_fcmp_uno(double X, double Y) { ";
+  Out << "return X != X || Y != Y; }\n";
+  Out << "static inline int llvm_fcmp_ueq(double X, double Y) { ";
+  Out << "return X == Y || X != X || Y != Y; }\n";
+  Out << "static inline int llvm_fcmp_une(double X, double Y) { ";
+  Out << "return X != Y || X != X || Y != Y; }\n";
+  Out << "static inline int llvm_fcmp_ult(double X, double Y) { ";
+  Out << "return X <  Y || X != X || Y != Y; }\n";
+  Out << "static inline int llvm_fcmp_ugt(double X, double Y) { ";
+  Out << "return X >  Y || X != X || Y != Y; }\n";
+  Out << "static inline int llvm_fcmp_ule(double X, double Y) { ";
+  Out << "return X <= Y || X != X || Y != Y; }\n";
+  Out << "static inline int llvm_fcmp_uge(double X, double Y) { ";
+  Out << "return X >= Y || X != X || Y != Y; }\n";
+  Out << "static inline int llvm_fcmp_oeq(double X, double Y) { ";
+  Out << "return X == Y && X == X && Y == Y; }\n";
+  Out << "static inline int llvm

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

2007-01-07 Thread Chris Lattner
> +  // Emit some helper functions for dealing with FCMP instruction's
> +  // predicates
> +  Out << "static inline int llvm_fcmp_ord(double X, double Y) { ";
> +  Out << "return X == X && Y == Y; }\n";
> +  Out << "static inline int llvm_fcmp_uno(double X, double Y) { ";
> +  Out << "return X != X || Y != Y; }\n";
> +  Out << "static inline int llvm_fcmp_ueq(double X, double Y) { ";
> +  Out << "return X == Y || X != X || Y != Y; }\n";

These would be more obvious if written as:

   return X == Y || llvm_fcmp_uno(X, Y)

> +  Out << "static inline int llvm_fcmp_ult(double X, double Y) { ";
> +  Out << "return X <  Y || X != X || Y != Y; }\n";
> +  Out << "static inline int llvm_fcmp_ugt(double X, double Y) { ";
> +  Out << "return X >  Y || X != X || Y != Y; }\n";
> +  Out << "static inline int llvm_fcmp_ule(double X, double Y) { ";
> +  Out << "return X <= Y || X != X || Y != Y; }\n";
> +  Out << "static inline int llvm_fcmp_uge(double X, double Y) { ";
> +  Out << "return X >= Y || X != X || Y != Y; }\n";



> +  Out << "static inline int llvm_fcmp_une(double X, double Y) { ";
> +  Out << "return X != Y || X != X || Y != Y; }\n";
> +  Out << "static inline int llvm_fcmp_oeq(double X, double Y) { ";
> +  Out << "return X == Y && X == X && Y == Y; }\n";
> +  Out << "static inline int llvm_fcmp_olt(double X, double Y) { ";
> +  Out << "return X <  Y && X == X && Y == Y; }\n";
> +  Out << "static inline int llvm_fcmp_ogt(double X, double Y) { ";
> +  Out << "return X >  Y && X == X && Y == Y; }\n";
> +  Out << "static inline int llvm_fcmp_ole(double X, double Y) { ";
> +  Out << "return X <= Y && X == X && Y == Y; }\n";
> +  Out << "static inline int llvm_fcmp_oge(double X, double Y) { ";
> +  Out << "return X >= Y && X == X && Y == Y; }\n";

You can drop the 2nd and 3rd term of each of thse.

> +  Out << "static inline int llvm_fcmp_one(double X, double Y) { ";
> +  Out << "return X != Y && X == X && Y == Y; }\n";

This one is needed though.

-Chris


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


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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/tools/lli:

lli.cpp updated: 1.64 -> 1.65
---
Log message:

fix atexit.  This is an overcomplex way of calling exit, but it is required,
as the jit intercepts exit calls to implement atexit handlers.  This
fixes SingleSource/UnitTests/2003-05-14-AtExit


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

 lli.cpp |   19 ---
 1 files changed, 16 insertions(+), 3 deletions(-)


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.64 llvm/tools/lli/lli.cpp:1.65
--- llvm/tools/lli/lli.cpp:1.64 Sun Jan  7 00:43:08 2007
+++ llvm/tools/lli/lli.cpp  Mon Jan  8 01:36:34 2007
@@ -118,9 +118,22 @@
 // Run static destructors.
 EE->runStaticConstructorsDestructors(true);
 
-exit(Result);
-std::cerr << "ERROR: exit(" << Result << ") returned!\n";
-abort();
+// If the program didn't explicitly call exit, call exit now, for the
+// program. This ensures that any atexit handlers get called correctly.
+Constant *Exit = MP->getModule()->getOrInsertFunction("exit", Type::VoidTy,
+  Type::Int32Ty, NULL);
+if (Function *ExitF = dyn_cast(Exit)) {
+  std::vector Args;
+  GenericValue ResultGV;
+  ResultGV.Int32Val = Result;
+  Args.push_back(ResultGV);
+  EE->runFunction(ExitF, Args);
+  std::cerr << "ERROR: exit(" << Result << ") returned!\n";
+  abort();
+} else {
+  std::cerr << "ERROR: exit defined with wrong prototype!\n";
+  abort();
+}
   } catch (const std::string& msg) {
 std::cerr << argv[0] << ": " << msg << "\n";
   } catch (...) {



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


[llvm-commits] llvm-gcc portion of PR1093

2007-01-07 Thread Chris Lattner
This corrects llvm-gcc to always emit the llvm.va* intrinsics with  
i8* as the valist pointer type.  This fixes llvm-gcc to comply with  
PR1093.



Index: llvm-convert.cpp
===
--- llvm-convert.cpp(revision 122093)
+++ llvm-convert.cpp(working copy)
@@ -3624,15 +3624,11 @@
   tree fntype = TREE_TYPE(current_function_decl);
   
   static Constant *llvm_va_start_fn = 0;
-  if (!llvm_va_start_fn) {
-tree FnDecl = TREE_OPERAND(TREE_OPERAND(exp, 0), 0);
-const FunctionType *FnTy = 
-  cast(ConvertType(TREE_TYPE(FnDecl)));
+  static const Type *VPTy = PointerType::get(Type::Int8Ty);
+
+  if (!llvm_va_start_fn)
 llvm_va_start_fn = TheModule->getOrInsertFunction("llvm.va_start",
-  Type::VoidTy,
-  FnTy->getParamType(0),
-  NULL);
-  }
+  Type::VoidTy, VPTy, 
NULL);
   
   if (TYPE_ARG_TYPES(fntype) == 0 ||
   (TREE_VALUE(tree_last(TYPE_ARG_TYPES(fntype))) == void_type_node)) {
@@ -3653,42 +3649,33 @@
 
   const Type *FTy =
 cast(llvm_va_start_fn->getType())->getElementType();
-  ArgVal = CastToType(Instruction::BitCast, ArgVal, 
-  cast(FTy)->getParamType(0));
+  ArgVal = CastToType(Instruction::BitCast, ArgVal, VPTy);
   new CallInst(llvm_va_start_fn, ArgVal, "", CurBB);
   return true;
 }
 
 bool TreeToLLVM::EmitBuiltinVAEnd(tree exp) {
   static Constant *llvm_va_end_fn = 0;
-  if (!llvm_va_end_fn) {
-tree FnDecl = TREE_OPERAND(TREE_OPERAND(exp, 0), 0);
-const FunctionType *VAEndTy = 
-  cast(ConvertType(TREE_TYPE(FnDecl)));
-llvm_va_end_fn = TheModule->getOrInsertFunction("llvm.va_end", VAEndTy);
-  }
+  static const Type *VPTy = PointerType::get(Type::Int8Ty);
   
+  if (!llvm_va_end_fn)
+llvm_va_end_fn = TheModule->getOrInsertFunction("llvm.va_end", 
Type::VoidTy,
+VPTy, NULL);
+  
   Value *Arg = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
-  const Type *FTy =
-cast(llvm_va_end_fn->getType())->getElementType();
-  Arg = CastToType(Instruction::BitCast, Arg, 
-   cast(FTy)->getParamType(0));
-
+  Arg = CastToType(Instruction::BitCast, Arg, VPTy);
   new CallInst(llvm_va_end_fn, Arg, "", CurBB);
   return true;
 }
 
 bool TreeToLLVM::EmitBuiltinVACopy(tree exp) {
   static Constant *llvm_va_copy_fn = 0;
-  if (!llvm_va_copy_fn) {
-tree FnDecl = TREE_OPERAND(TREE_OPERAND(exp, 0), 0);
-const FunctionType *FnTy = 
-  cast(ConvertType(TREE_TYPE(FnDecl)));
-const Type *PtrVAListTy = FnTy->getParamType(0);
+  static const Type *VPTy = PointerType::get(Type::Int8Ty);
+
+  if (!llvm_va_copy_fn)
 llvm_va_copy_fn =
   TheModule->getOrInsertFunction("llvm.va_copy", Type::VoidTy,
- PtrVAListTy, PtrVAListTy, NULL);
-  }
+ VPTy, VPTy, NULL);
 
   tree Arg1T = TREE_VALUE(TREE_OPERAND(exp, 1));
   tree Arg2T = TREE_VALUE(TREE_CHAIN(TREE_OPERAND(exp, 1)));
@@ -3696,7 +3683,6 @@
   Value *Arg1 = Emit(Arg1T, 0);   // Emit the address of the destination.
   // The second arg of llvm.va_copy is a pointer to a valist.
   Value *Arg2;
-  const Type *VAListTy = cast(Arg1->getType())->getElementType();
   if (!isAggregateType(TREE_TYPE(Arg2T))) {
 // Emit it as a value, then store it to a temporary slot.
 Value *V2 = Emit(Arg2T, 0);
@@ -3705,15 +3691,13 @@
   } else {
 // If the target has aggregate valists, emit the srcval directly into a
 // temporary.
+const Type *VAListTy = 
cast(Arg1->getType())->getElementType();
 Arg2 = CreateTemporary(VAListTy);
 Emit(Arg2T, Arg2);
   }
   
-  const Type *FTy =
-cast(llvm_va_copy_fn->getType())->getElementType();
-  const Type *PtrList = cast(FTy)->getParamType(0);
-  Arg1 = CastToType(Instruction::BitCast, Arg1, PtrList);
-  Arg2 = CastToType(Instruction::BitCast, Arg2, PtrList);
+  Arg1 = CastToType(Instruction::BitCast, Arg1, VPTy);
+  Arg2 = CastToType(Instruction::BitCast, Arg2, VPTy);
   
   new CallInst(llvm_va_copy_fn, Arg1, Arg2, "", CurBB);
   return true;


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


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

2007-01-07 Thread Chris Lattner


Changes in directory llvm/docs:

LangRef.html updated: 1.189 -> 1.190
---
Log message:

Fully specify the type of the llvm.va* intrinsics.  This helps resolve 
Pr1093: http://llvm.org/PR1093 


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

 LangRef.html |   25 -
 1 files changed, 16 insertions(+), 9 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.189 llvm/docs/LangRef.html:1.190
--- llvm/docs/LangRef.html:1.189Sun Jan  7 02:53:26 2007
+++ llvm/docs/LangRef.html  Mon Jan  8 01:55:15 2007
@@ -3519,18 +3519,20 @@
 define i32 %test(i32 %X, ...) {
   ; Initialize variable argument processing
   %ap = alloca i8 *
-  call void %llvm.va_start(i8 ** %ap)
+  %ap2 = bitcast i8** %ap to i8*
+  call void %llvm.va_start(i8* %ap2)
 
   ; Read a single integer argument
   %tmp = va_arg i8 ** %ap, i32
 
   ; Demonstrate usage of llvm.va_copy and llvm.va_end
   %aq = alloca i8 *
-  call void %llvm.va_copy(i8 ** %aq, i8 ** %ap)
-  call void %llvm.va_end(i8 ** %aq)
+  %aq2 = bitcast i8** %aq to i8*
+  call void %llvm.va_copy(i8 *%aq2, i8* %ap2)
+  call void %llvm.va_end(i8* %aq2)
 
   ; Stop processing of arguments.
-  call void %llvm.va_end(i8 ** %ap)
+  call void %llvm.va_end(i8* %ap2)
   ret i32 %tmp
 }
 
@@ -3544,7 +3546,7 @@
 
 
 Syntax:
-  declare void %llvm.va_start(* )
+  declare void %llvm.va_start(i8* )
 Overview:
 The 'llvm.va_start' intrinsic initializes
 * for subsequent use by 
 Syntax:
-  declare void %llvm.va_end( )
+  declare void %llvm.va_end(i8* )
 Overview:
+
 The 'llvm.va_end' intrinsic destroys 
 which has been initialized previously with llvm.va_start
 or llvm.va_copy.
+
 Arguments:
+
 The argument is a va_list to destroy.
+
 Semantics:
+
 The 'llvm.va_end' intrinsic works just like the va_end
 macro available in C.  In a target-dependent way, it destroys the 
va_list.
 Calls to llvm.va_start and llvm.va_copy must be matched exactly
 with calls to llvm.va_end.
+
 
 
 
@@ -3597,8 +3605,7 @@
 Syntax:
 
 
-  declare void %llvm.va_copy(* ,
-  * )
+  declare void %llvm.va_copy(i8* , i8* )
 
 
 Overview:
@@ -4468,7 +4475,7 @@
 
   mailto:[EMAIL PROTECTED]">Chris Lattner
   http://llvm.org";>The LLVM Compiler Infrastructure
-  Last modified: $Date: 2007/01/07 08:53:26 $
+  Last modified: $Date: 2007/01/08 07:55:15 $
 
 
 



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