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

2006-05-23 Thread Vladimir Prus


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.248 -> 1.249
---
Log message:

Fix missing include

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

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.248 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.249
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.248Tue May 23 
01:40:47 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Tue May 23 08:43:15 2006
@@ -37,6 +37,7 @@
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetLowering.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Target/TargetOptions.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/MathExtras.h"



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


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

2006-05-23 Thread Vladimir Prus


Changes in directory llvm/include/llvm/CodeGen:

MachineFrameInfo.h updated: 1.17 -> 1.18
---
Log message:

Make class comment visible in Doxygen.


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

 MachineFrameInfo.h |   59 +++--
 1 files changed, 31 insertions(+), 28 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineFrameInfo.h
diff -u llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.17 
llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.18
--- llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.17   Fri Apr  7 11:34:45 2006
+++ llvm/include/llvm/CodeGen/MachineFrameInfo.hTue May 23 10:32:15 2006
@@ -6,34 +6,7 @@
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
 //
 
//===--===//
-//
-// The MachineFrameInfo class represents an abstract stack frame until
-// prolog/epilog code is inserted.  This class is key to allowing stack frame
-// representation optimizations, such as frame pointer elimination.  It also
-// allows more mundane (but still important) optimizations, such as reordering
-// of abstract objects on the stack frame.
-//
-// To support this, the class assigns unique integer identifiers to stack
-// objects requested clients.  These identifiers are negative integers for 
fixed
-// stack objects (such as arguments passed on the stack) or positive for 
objects
-// that may be reordered.  Instructions which refer to stack objects use a
-// special MO_FrameIndex operand to represent these frame indexes.
-//
-// Because this class keeps track of all references to the stack frame, it 
knows
-// when a variable sized object is allocated on the stack.  This is the sole
-// condition which prevents frame pointer elimination, which is an important
-// optimization on register-poor architectures.  Because original variable 
sized
-// alloca's in the source program are the only source of variable sized stack
-// objects, it is safe to decide whether there will be any variable sized
-// objects before all stack objects are known (for example, register allocator
-// spill code never needs variable sized objects).
-//
-// When prolog/epilog code emission is performed, the final stack frame is 
built
-// and the machine instructions are modified to refer to the actual stack
-// offsets of the object, eliminating all MO_FrameIndex operands from the
-// program.
-//
-//===--===//
+
 
 #ifndef LLVM_CODEGEN_MACHINEFRAMEINFO_H
 #define LLVM_CODEGEN_MACHINEFRAMEINFO_H
@@ -47,6 +20,36 @@
 class MachineDebugInfo;
 class MachineFunction;
 
+
+/// The MachineFrameInfo class represents an abstract stack frame until
+/// prolog/epilog code is inserted.  This class is key to allowing stack frame
+/// representation optimizations, such as frame pointer elimination.  It also
+/// allows more mundane (but still important) optimizations, such as reordering
+/// of abstract objects on the stack frame.
+///
+/// To support this, the class assigns unique integer identifiers to stack
+/// objects requested clients.  These identifiers are negative integers for
+/// fixed stack objects (such as arguments passed on the stack) or positive
+/// for objects that may be reordered.  Instructions which refer to stack
+/// objects use a special MO_FrameIndex operand to represent these frame
+/// indexes.
+///
+/// Because this class keeps track of all references to the stack frame, it
+/// knows when a variable sized object is allocated on the stack.  This is the
+/// sole condition which prevents frame pointer elimination, which is an
+/// important optimization on register-poor architectures.  Because original
+/// variable sized alloca's in the source program are the only source of
+/// variable sized stack objects, it is safe to decide whether there will be
+/// any variable sized objects before all stack objects are known (for
+/// example, register allocator spill code never needs variable sized
+/// objects).
+///
+/// When prolog/epilog code emission is performed, the final stack frame is
+/// built and the machine instructions are modified to refer to the actual
+/// stack offsets of the object, eliminating all MO_FrameIndex operands from
+/// the program.
+///
+/// @brief Abstract Stack Frame Information
 class MachineFrameInfo {
 
   // StackObject - Represent a single object allocated on the stack.



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


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

2006-05-23 Thread Evan Cheng


Changes in directory llvm/include/llvm/Target:

TargetOptions.h updated: 1.9 -> 1.10
---
Log message:

-enable-unsafe-fp-math implies -enable-finite-only-fp-math


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

 TargetOptions.h |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)


Index: llvm/include/llvm/Target/TargetOptions.h
diff -u llvm/include/llvm/Target/TargetOptions.h:1.9 
llvm/include/llvm/Target/TargetOptions.h:1.10
--- llvm/include/llvm/Target/TargetOptions.h:1.9Tue May 23 01:39:12 2006
+++ llvm/include/llvm/Target/TargetOptions.hTue May 23 13:18:46 2006
@@ -39,14 +39,15 @@
   /// this flag is off (the default), the code generator is not allowed to
   /// produce results that are "less precise" than IEEE allows.  This includes
   /// use of X86 instructions like FSIN and FCOS instead of libcalls.
+  /// UnsafeFPMath implies FiniteOnlyFPMath.
   extern bool UnsafeFPMath;
 
-  /// FiniteOnlyFPMath - This is enabled when the -enable-finite-only-fp-math
-  /// flag is specified on the command line. When this flag is off (default),
+  /// FiniteOnlyFPMath - This returns true when the -enable-finite-only-fp-math
+  /// option is specified on the command line. If this returns false (default),
   /// the code generator is not allowed to assume that FP arithmetic arguments
-  /// and results are never NaNs or +-Infs. This includes ignoring parity flag
-  /// (PF) when checking for FP equality.
-  extern bool FiniteOnlyFPMath;
+  /// and results are never NaNs or +-Infs.
+  extern bool FiniteOnlyFPMathOption;
+  extern bool FiniteOnlyFPMath();
 } // 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/CodeGen/SelectionDAG/SelectionDAGISel.cpp

2006-05-23 Thread Evan Cheng


Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.249 -> 1.250
---
Log message:

-enable-unsafe-fp-math implies -enable-finite-only-fp-math


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

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


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.249 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.250
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.249Tue May 23 
08:43:15 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp  Tue May 23 13:18:46 2006
@@ -1105,8 +1105,7 @@
   SDOperand Op1 = getValue(I.getOperand(0));
   SDOperand Op2 = getValue(I.getOperand(1));
   ISD::CondCode Opcode = SignedOpcode;
-  if ((!UnsafeFPMath && !FiniteOnlyFPMath) &&
-  I.getOperand(0)->getType()->isFloatingPoint())
+  if (!FiniteOnlyFPMath() && I.getOperand(0)->getType()->isFloatingPoint())
 Opcode = FPOpcode;
   else if (I.getOperand(0)->getType()->isUnsigned())
 Opcode = UnsignedOpcode;



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


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

2006-05-23 Thread Evan Cheng


Changes in directory llvm/lib/Target:

TargetMachine.cpp updated: 1.45 -> 1.46
---
Log message:

-enable-unsafe-fp-math implies -enable-finite-only-fp-math


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

 TargetMachine.cpp |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/TargetMachine.cpp
diff -u llvm/lib/Target/TargetMachine.cpp:1.45 
llvm/lib/Target/TargetMachine.cpp:1.46
--- llvm/lib/Target/TargetMachine.cpp:1.45  Tue May 23 01:39:12 2006
+++ llvm/lib/Target/TargetMachine.cpp   Tue May 23 13:18:46 2006
@@ -26,7 +26,7 @@
   bool NoFramePointerElim;
   bool NoExcessFPPrecision;
   bool UnsafeFPMath;
-  bool FiniteOnlyFPMath;
+  bool FiniteOnlyFPMathOption;
   Reloc::Model RelocationModel;
 };
 namespace {
@@ -52,7 +52,7 @@
   cl::opt
   EnableFiniteOnltFPMath("enable-finite-only-fp-math",
cl::desc("Enable optimizations that assumes non- NaNs / 
+-Infs"),
-   cl::location(FiniteOnlyFPMath),
+   cl::location(FiniteOnlyFPMathOption),
cl::init(false));
   cl::opt
   DefRelocationModel(
@@ -93,3 +93,11 @@
 void TargetMachine::setRelocationModel(Reloc::Model Model) {
   RelocationModel = Model;
 }
+
+namespace llvm {
+  /// FiniteOnlyFPMath - This returns true when the -enable-finite-only-fp-math
+  /// option is specified on the command line. If this returns false (default),
+  /// the code generator is not allowed to assume that FP arithmetic arguments
+  /// and results are never NaNs or +-Infs.
+  bool FiniteOnlyFPMath() { return UnsafeFPMath || FiniteOnlyFPMathOption; }
+};



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

2006-05-23 Thread Chris Lattner


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.207 -> 1.208
X86ISelLowering.h updated: 1.62 -> 1.63
---
Log message:

Implement an annoying part of the Darwin/X86 abi: the callee of a struct
return argument pops the hidden struct pointer if present, not the caller.

For example, in this testcase:

struct X { int D, E, F, G; };
struct X bar() {
  struct X a;
  a.D = 0;
  a.E = 1;
  a.F = 2;
  a.G = 3;
  return a;
}
void foo(struct X *P) {
  *P = bar();
}

We used to emit:

_foo:
subl $28, %esp
movl 32(%esp), %eax
movl %eax, (%esp)
call _bar
addl $28, %esp
ret
_bar:
movl 4(%esp), %eax
movl $0, (%eax)
movl $1, 4(%eax)
movl $2, 8(%eax)
movl $3, 12(%eax)
ret

This is correct on Linux/X86 but not Darwin/X86.  With this patch, we now
emit:

_foo:
subl $28, %esp
movl 32(%esp), %eax
movl %eax, (%esp)
call _bar
*** addl $24, %esp
ret
_bar:
movl 4(%esp), %eax
movl $0, (%eax)
movl $1, 4(%eax)
movl $2, 8(%eax)
movl $3, 12(%eax)
*** ret $4

For the record, GCC emits (which is functionally equivalent to our new code):

_bar:
movl4(%esp), %eax
movl$3, 12(%eax)
movl$2, 8(%eax)
movl$1, 4(%eax)
movl$0, (%eax)
ret $4
_foo:
pushl   %esi
subl$40, %esp
movl48(%esp), %esi
leal16(%esp), %eax
movl%eax, (%esp)
call_bar
subl$4, %esp
movl16(%esp), %eax
movl%eax, (%esi)
movl20(%esp), %eax
movl%eax, 4(%esi)
movl24(%esp), %eax
movl%eax, 8(%esi)
movl28(%esp), %eax
movl%eax, 12(%esi)
addl$40, %esp
popl%esi
ret

This fixes SingleSource/Benchmarks/CoyoteBench/fftbench with LLC and the
JIT, and fixes the X86-backend portion of PR729: http://llvm.cs.uiuc.edu/PR729 
.  The CBE still needs to
be updated.



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

 X86ISelLowering.cpp |   20 ++--
 X86ISelLowering.h   |2 +-
 2 files changed, 19 insertions(+), 3 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.207 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.208
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.207   Fri May 19 16:34:04 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue May 23 13:50:38 2006
@@ -393,7 +393,8 @@
 
   if (CallingConv == CallingConv::Fast && EnableFastCC)
 return LowerFastCCCallTo(Chain, RetTy, isTailCall, Callee, Args, DAG);
-  return  LowerallTo(Chain, RetTy, isVarArg, isTailCall, Callee, Args, 
DAG);
+  return  LowerallTo(Chain, RetTy, isVarArg, isTailCall, CallingConv,
+ Callee, Args, DAG);
 }
 
 
//===--===//
@@ -520,6 +521,12 @@
   ReturnAddrIndex = 0; // No return address slot generated yet.
   BytesToPopOnReturn = 0;  // Callee pops nothing.
   BytesCallerReserves = ArgOffset;
+  
+  // If this is a struct return on Darwin/X86, the callee pops the hidden 
struct
+  // pointer.
+  if (F.getCallingConv() == CallingConv::CSRet &&
+  Subtarget->isTargetDarwin())
+BytesToPopOnReturn = 4;
 }
 
 void X86TargetLowering::LowerCCCArguments(SDOperand Op, SelectionDAG &DAG) {
@@ -551,6 +558,7 @@
 std::pair
 X86TargetLowering::LowerallTo(SDOperand Chain, const Type *RetTy,
   bool isVarArg, bool isTailCall,
+  unsigned CallingConv,
   SDOperand Callee, ArgListTy &Args,
   SelectionDAG &DAG) {
   // Count how many bytes are to be pushed on the stack.
@@ -704,13 +712,21 @@
   Chain = DAG.getNode(X86ISD::CALL, NodeTys, Ops);
   InFlag = Chain.getValue(1);
 
+  // Create the CALLSEQ_END node.
+  unsigned NumBytesForCalleeToPush = 0;
+
+  // If this is is a call to a struct-return function on Darwin/X86, the callee
+  // pops the hidden struct pointer, so we have to push it back.
+  if (CallingConv == CallingConv::CSRet && Subtarget->isTargetDarwin())
+NumBytesForCalleeToPush = 4;
+  
   NodeTys.clear();
   NodeTys.push_back(MVT::Other);   // Returns a chain
   NodeTys.push_back(MVT::Flag);// Returns a flag for retval copy to use.
   Ops.clear();
   Ops.push_back(Chain);
   Ops.push_back(DAG.getConstant(NumBytes, getPointerTy()));
-  Ops.push_back(DAG.getConstant(0, getPointerTy()));
+  Ops.push_back(DAG.getConstant(NumBytesForCalleeToPush, getPointerTy()));
   Ops.push_back(InFlag);
   Chain = DAG.getNode(ISD::CALLSEQ_END, NodeTys, Ops);
   InFlag = Chain.getValue(1);


Index: llvm/lib/Target/X86/X86ISelLowering.h
diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.62 
llvm/lib/Target/X86/X86ISelLowering.h:1.63
--- llvm/lib/Target/

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

2006-05-23 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.208 -> 1.209
X86ISelLowering.h updated: 1.63 -> 1.64
---
Log message:

Remove PreprocessCCCArguments and PreprocessFastCCArguments now that
FORMAL_ARGUMENTS nodes include a token operand.


---
Diffs of the changes:  (+124 -253)

 X86ISelLowering.cpp |  341 ++--
 X86ISelLowering.h   |   36 -
 2 files changed, 124 insertions(+), 253 deletions(-)


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.208 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.209
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.208   Tue May 23 13:50:38 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue May 23 16:06:34 2006
@@ -358,22 +358,6 @@
   allowUnalignedMemoryAccesses = true; // x86 supports it!
 }
 
-std::vector
-X86TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
-  std::vector Args = TargetLowering::LowerArguments(F, DAG);
-
-  FormalArgs.clear();
-  FormalArgLocs.clear();
-
-  // This sets BytesToPopOnReturn, BytesCallerReserves, etc. which have to be
-  // set before the rest of the function can be lowered.
-  if (F.getCallingConv() == CallingConv::Fast && EnableFastCC)
-PreprocessFastCCArguments(Args, F, DAG);
-  else
-PreprocessCCCArguments(Args, F, DAG);
-  return Args;
-}
-
 std::pair
 X86TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy,
bool isVarArg, unsigned CallingConv,
@@ -463,11 +447,12 @@
   return Objs;
 }
 
-void X86TargetLowering::PreprocessCCCArguments(std::vector &Args,
-   Function &F, SelectionDAG &DAG) 
{
-  unsigned NumArgs = Args.size();
+SDOperand X86TargetLowering::LowerCCCArguments(SDOperand Op, SelectionDAG 
&DAG) {
+  unsigned NumArgs = Op.Val->getNumValues() - 1;
   MachineFunction &MF = DAG.getMachineFunction();
   MachineFrameInfo *MFI = MF.getFrameInfo();
+  SDOperand Root = Op.getOperand(0);
+  std::vector ArgValues;
 
   // Add DAG nodes to load the arguments...  On entry to a function on the X86,
   // the stack frame looks like this:
@@ -481,78 +466,53 @@
   unsigned NumXMMRegs = 0;  // XMM regs used for parameter passing.
   unsigned XMMArgRegs[] = { X86::XMM0, X86::XMM1, X86::XMM2 };
   for (unsigned i = 0; i < NumArgs; ++i) {
-SDOperand Op = Args[i];
-std::vector Objs = getFormalArgObjects(Op);
-for (std::vector::iterator I = Objs.begin(), E = Objs.end();
- I != E; ++I) {
-  SDOperand Obj = *I;
-  MVT::ValueType ObjectVT = Obj.getValueType();
-  unsigned ArgIncrement = 4;
-  unsigned ObjSize = 0;
-  unsigned ObjXMMRegs = 0;
-  HowToPassCCCArgument(ObjectVT, NumXMMRegs, ObjSize, ObjXMMRegs);
-  if (ObjSize >= 8)
-ArgIncrement = ObjSize;
-
-  if (ObjXMMRegs) {
-// Passed in a XMM register.
-unsigned Reg = AddLiveIn(MF, XMMArgRegs[NumXMMRegs],
+MVT::ValueType ObjectVT = Op.getValue(i).getValueType();
+unsigned ArgIncrement = 4;
+unsigned ObjSize = 0;
+unsigned ObjXMMRegs = 0;
+HowToPassCCCArgument(ObjectVT, NumXMMRegs, ObjSize, ObjXMMRegs);
+if (ObjSize >= 8)
+  ArgIncrement = ObjSize;
+
+SDOperand ArgValue;
+if (ObjXMMRegs) {
+  // Passed in a XMM register.
+  unsigned Reg = AddLiveIn(MF, XMMArgRegs[NumXMMRegs],
  X86::VR128RegisterClass);
-std::pair Loc =
-  std::make_pair(FALocInfo(FALocInfo::LiveInRegLoc, Reg, ObjectVT),
- FALocInfo());
-FormalArgLocs.push_back(Loc);
-NumXMMRegs += ObjXMMRegs;
-  } else {
-// Create the frame index object for this incoming parameter...
-int FI = MFI->CreateFixedObject(ObjSize, ArgOffset);
-std::pair Loc =
-  std::make_pair(FALocInfo(FALocInfo::StackFrameLoc, FI), FALocInfo());
-FormalArgLocs.push_back(Loc);
-ArgOffset += ArgIncrement;   // Move on to the next argument...
-  }
+  ArgValue= DAG.getCopyFromReg(Root, Reg, ObjectVT);
+  ArgValues.push_back(ArgValue);
+  NumXMMRegs += ObjXMMRegs;
+} else {
+  // Create the frame index object for this incoming parameter...
+  int FI = MFI->CreateFixedObject(ObjSize, ArgOffset);
+  SDOperand FIN = DAG.getFrameIndex(FI, getPointerTy());
+  ArgValue = DAG.getLoad(Op.Val->getValueType(i), Root, FIN,
+ DAG.getSrcValue(NULL));
+  ArgValues.push_back(ArgValue);
+  ArgOffset += ArgIncrement;   // Move on to the next argument...
 }
   }
 
+  ArgValues.push_back(Root);
+
   // If the function takes variable number of arguments, make a frame index for
   // the start of the first vararg value... for expansion of llvm.va_start.
-  if (F.isVarArg())
+  if (MF.getFunction()->isVarArg())
 VarArgsFrameIndex = MFI->CreateFixedObject(1, ArgOffset);
   ReturnAddrIndex = 0; // No return address slot genera

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

2006-05-23 Thread Evan Cheng


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.209 -> 1.210
---
Log message:

Better way to check for vararg.


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

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


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.209 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.210
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.209   Tue May 23 16:06:34 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue May 23 16:08:24 2006
@@ -497,7 +497,8 @@
 
   // If the function takes variable number of arguments, make a frame index for
   // the start of the first vararg value... for expansion of llvm.va_start.
-  if (MF.getFunction()->isVarArg())
+  bool isVarArg = cast(Op.getOperand(2))->getValue() != 0;
+  if (isVarArg)
 VarArgsFrameIndex = MFI->CreateFixedObject(1, ArgOffset);
   ReturnAddrIndex = 0; // No return address slot generated yet.
   BytesToPopOnReturn = 0;  // Callee pops nothing.



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

2006-05-23 Thread Chris Lattner


Changes in directory llvm/lib/Target/X86:

X86ISelLowering.cpp updated: 1.210 -> 1.211
---
Log message:

Fix file header comment


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

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


Index: llvm/lib/Target/X86/X86ISelLowering.cpp
diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.210 
llvm/lib/Target/X86/X86ISelLowering.cpp:1.211
--- llvm/lib/Target/X86/X86ISelLowering.cpp:1.210   Tue May 23 16:08:24 2006
+++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue May 23 18:20:42 2006
@@ -1,4 +1,4 @@
-//===-- X86ISelLowering.h - X86 DAG Lowering Interface --*- C++ 
-*-===//
+//===-- X86ISelLowering.cpp - X86 DAG Lowering Implementation 
-===//
 //
 // The LLVM Compiler Infrastructure
 //



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


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

2006-05-23 Thread Chris Lattner


Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.260 -> 1.261
---
Log message:

Print struct return functions and calls as actually returning the hidden
argument struct pointer, enabling ABI compatibility for the CBE with 
platforms with strange struct-return ABIs.  This fixes 252.eon and
CoyoteBench/fftbench on Darwin/X86 among other things.


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

 Writer.cpp |  246 ++---
 1 files changed, 171 insertions(+), 75 deletions(-)


Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.260 
llvm/lib/Target/CBackend/Writer.cpp:1.261
--- llvm/lib/Target/CBackend/Writer.cpp:1.260   Mon Apr 17 12:55:40 2006
+++ llvm/lib/Target/CBackend/Writer.cpp Tue May 23 18:39:48 2006
@@ -13,6 +13,7 @@
 
//===--===//
 
 #include "CTargetMachine.h"
+#include "llvm/CallingConv.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Module.h"
@@ -115,6 +116,9 @@
 const std::string &VariableName = "",
 bool IgnoreName = false);
 
+void printStructReturnPointerFunctionType(std::ostream &Out,
+  const PointerType *Ty);
+
 void writeOperand(Value *Operand);
 void writeOperandInternal(Value *Operand);
 
@@ -298,6 +302,35 @@
   return Changed;
 }
 
+/// printStructReturnPointerFunctionType - This is like printType for a struct
+/// return type, except, instead of printing the type as void (*)(Struct*, ...)
+/// print it as "Struct (*)(...)", for struct return functions.
+void CWriter::printStructReturnPointerFunctionType(std::ostream &Out,
+   const PointerType *TheTy) {
+  const FunctionType *FTy = cast(TheTy->getElementType());
+  std::stringstream FunctionInnards;
+  FunctionInnards << " (*) (";
+  bool PrintedType = false;
+
+  FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end();
+  const Type *RetTy = cast(I->get())->getElementType();
+  for (++I; I != E; ++I) {
+if (PrintedType)
+  FunctionInnards << ", ";
+printType(FunctionInnards, *I, "");
+PrintedType = true;
+  }
+  if (FTy->isVarArg()) {
+if (PrintedType)
+  FunctionInnards << ", ...";
+  } else if (!PrintedType) {
+FunctionInnards << "void";
+  }
+  FunctionInnards << ')';
+  std::string tstr = FunctionInnards.str();
+  printType(Out, RetTy, tstr);
+}
+
 
 // Pass the Type* and the variable name and this prints out the variable
 // declaration.
@@ -332,24 +365,24 @@
 
   switch (Ty->getTypeID()) {
   case Type::FunctionTyID: {
-const FunctionType *MTy = cast(Ty);
+const FunctionType *FTy = cast(Ty);
 std::stringstream FunctionInnards;
 FunctionInnards << " (" << NameSoFar << ") (";
-for (FunctionType::param_iterator I = MTy->param_begin(),
-   E = MTy->param_end(); I != E; ++I) {
-  if (I != MTy->param_begin())
+for (FunctionType::param_iterator I = FTy->param_begin(),
+   E = FTy->param_end(); I != E; ++I) {
+  if (I != FTy->param_begin())
 FunctionInnards << ", ";
   printType(FunctionInnards, *I, "");
 }
-if (MTy->isVarArg()) {
-  if (MTy->getNumParams())
+if (FTy->isVarArg()) {
+  if (FTy->getNumParams())
 FunctionInnards << ", ...";
-} else if (!MTy->getNumParams()) {
+} else if (!FTy->getNumParams()) {
   FunctionInnards << "void";
 }
 FunctionInnards << ')';
 std::string tstr = FunctionInnards.str();
-printType(Out, MTy->getReturnType(), tstr);
+printType(Out, FTy->getReturnType(), tstr);
 return Out;
   }
   case Type::StructTyID: {
@@ -1223,6 +1256,9 @@
 }
 
 void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
+  /// isCStructReturn - Should this function actually return a struct by-value?
+  bool isCStructReturn = F->getCallingConv() == CallingConv::CSRet;
+  
   if (F->hasInternalLinkage()) Out << "static ";
 
   // Loop over the arguments, printing them...
@@ -1233,55 +1269,97 @@
   // Print out the name...
   FunctionInnards << Mang->getValueName(F) << '(';
 
+  bool PrintedArg = false;
   if (!F->isExternal()) {
 if (!F->arg_empty()) {
+  Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
+  
+  // If this is a struct-return function, don't print the hidden
+  // struct-return argument.
+  if (isCStructReturn) {
+assert(I != E && "Invalid struct return function!");
+++I;
+  }
+  
   std::string ArgName;
-  if (F->arg_begin()->hasName() || !Prototype)
-ArgName = Mang->getValueName(F->arg_begin());
-  printType(FunctionInnards, F->arg_begin()->getType(), ArgName);
-  for (Function::const_arg_iterator I = ++F->arg_begin(), E = F->arg_end();
-   I != E; ++I) {
-FunctionInnar

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

2006-05-23 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

PPCISelLowering.cpp updated: 1.180 -> 1.181
---
Log message:

Handle SETO* like we handle SET*, restoring behavior after Evan's setcc
change.  This fixes PowerPC/fnegsel.ll.



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

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


Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.180 
llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.181
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.180   Wed May 17 14:00:46 2006
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Tue May 23 19:06:44 2006
@@ -1216,17 +1216,21 @@
 switch (CC) {
 default: break;   // SETUO etc aren't handled by fsel.
 case ISD::SETULT:
+case ISD::SETOLT:
 case ISD::SETLT:
   std::swap(TV, FV);  // fsel is natively setge, swap operands for setlt
 case ISD::SETUGE:
+case ISD::SETOGE:
 case ISD::SETGE:
   if (LHS.getValueType() == MVT::f32)   // Comparison is always 64-bits
 LHS = DAG.getNode(ISD::FP_EXTEND, MVT::f64, LHS);
   return DAG.getNode(PPCISD::FSEL, ResVT, LHS, TV, FV);
 case ISD::SETUGT:
+case ISD::SETOGT:
 case ISD::SETGT:
   std::swap(TV, FV);  // fsel is natively setge, swap operands for setlt
 case ISD::SETULE:
+case ISD::SETOLE:
 case ISD::SETLE:
   if (LHS.getValueType() == MVT::f32)   // Comparison is always 64-bits
 LHS = DAG.getNode(ISD::FP_EXTEND, MVT::f64, LHS);
@@ -1238,24 +1242,28 @@
   switch (CC) {
   default: break;   // SETUO etc aren't handled by fsel.
   case ISD::SETULT:
+  case ISD::SETOLT:
   case ISD::SETLT:
 Cmp = DAG.getNode(ISD::FSUB, CmpVT, LHS, RHS);
 if (Cmp.getValueType() == MVT::f32)   // Comparison is always 64-bits
   Cmp = DAG.getNode(ISD::FP_EXTEND, MVT::f64, Cmp);
   return DAG.getNode(PPCISD::FSEL, ResVT, Cmp, FV, TV);
   case ISD::SETUGE:
+  case ISD::SETOGE:
   case ISD::SETGE:
 Cmp = DAG.getNode(ISD::FSUB, CmpVT, LHS, RHS);
 if (Cmp.getValueType() == MVT::f32)   // Comparison is always 64-bits
   Cmp = DAG.getNode(ISD::FP_EXTEND, MVT::f64, Cmp);
   return DAG.getNode(PPCISD::FSEL, ResVT, Cmp, TV, FV);
   case ISD::SETUGT:
+  case ISD::SETOGT:
   case ISD::SETGT:
 Cmp = DAG.getNode(ISD::FSUB, CmpVT, RHS, LHS);
 if (Cmp.getValueType() == MVT::f32)   // Comparison is always 64-bits
   Cmp = DAG.getNode(ISD::FP_EXTEND, MVT::f64, Cmp);
   return DAG.getNode(PPCISD::FSEL, ResVT, Cmp, FV, TV);
   case ISD::SETULE:
+  case ISD::SETOLE:
   case ISD::SETLE:
 Cmp = DAG.getNode(ISD::FSUB, CmpVT, RHS, LHS);
 if (Cmp.getValueType() == MVT::f32)   // Comparison is always 64-bits



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


[llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/vector.ll

2006-05-23 Thread Chris Lattner


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

vector.ll updated: 1.10 -> 1.11
---
Log message:

New testcase


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

 vector.ll |9 +
 1 files changed, 9 insertions(+)


Index: llvm/test/Regression/CodeGen/Generic/vector.ll
diff -u llvm/test/Regression/CodeGen/Generic/vector.ll:1.10 
llvm/test/Regression/CodeGen/Generic/vector.ll:1.11
--- llvm/test/Regression/CodeGen/Generic/vector.ll:1.10 Thu Apr 13 12:10:03 2006
+++ llvm/test/Regression/CodeGen/Generic/vector.ll  Tue May 23 19:12:50 2006
@@ -56,6 +56,15 @@
   store %f8 %R, %f8 *%S
   ret void
 }
+
+void %test_div(%f8 *%P, %f8* %Q, %f8 *%S) {
+  %p = load %f8* %P
+  %q = load %f8* %Q
+  %R = div %f8 %p, %q
+  store %f8 %R, %f8 *%S
+  ret void
+}
+
 ;;; TEST VECTOR CONSTRUCTS
 
 void %test_cst(%f4 *%P, %f4 *%S) {



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


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

2006-05-23 Thread Chris Lattner


Changes in directory llvm/lib/Target/PowerPC:

PPCISelLowering.cpp updated: 1.181 -> 1.182
---
Log message:

Fix CodeGen/Generic/vector.ll:test_div with altivec.



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

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


Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp
diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.181 
llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.182
--- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.181   Tue May 23 19:06:44 2006
+++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Tue May 23 19:15:25 2006
@@ -208,6 +208,7 @@
   setOperationAction(ISD::SREM, (MVT::ValueType)VT, Expand);
   setOperationAction(ISD::UDIV, (MVT::ValueType)VT, Expand);
   setOperationAction(ISD::UREM, (MVT::ValueType)VT, Expand);
+  setOperationAction(ISD::FDIV, (MVT::ValueType)VT, Expand);
   setOperationAction(ISD::EXTRACT_VECTOR_ELT, (MVT::ValueType)VT, Expand);
   setOperationAction(ISD::INSERT_VECTOR_ELT, (MVT::ValueType)VT, Expand);
   setOperationAction(ISD::BUILD_VECTOR, (MVT::ValueType)VT, Expand);



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


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

2006-05-23 Thread Chris Lattner


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

fabs.ll updated: 1.7 -> 1.8
---
Log message:

One of these xforms is only safe with unsafe math enabled.


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

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


Index: llvm/test/Regression/CodeGen/X86/fabs.ll
diff -u llvm/test/Regression/CodeGen/X86/fabs.ll:1.7 
llvm/test/Regression/CodeGen/X86/fabs.ll:1.8
--- llvm/test/Regression/CodeGen/X86/fabs.ll:1.7Wed Mar 15 12:05:13 2006
+++ llvm/test/Regression/CodeGen/X86/fabs.llTue May 23 19:49:32 2006
@@ -1,5 +1,6 @@
 ; Make sure this testcase codegens to the fabs instruction, not a call to fabsf
-; RUN: llvm-as < %s | llc -march=x86 -mattr=-sse2,-sse3 | grep 'fabs$' | wc -l 
| grep 2
+; RUN: llvm-as < %s | llc -march=x86 -mattr=-sse2,-sse3 | grep 'fabs$' | wc -l 
| grep 1 && 
+; RUN: llvm-as < %s | llc -march=x86 -mattr=-sse2,-sse3 -enable-unsafe-fp-math 
 | grep 'fabs$' | wc -l | grep 2
 
 declare float %fabsf(float)
 



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