Re: [llvm-commits] Patch for compiling with Mingw/Cygwin

2008-01-14 Thread Alain Frisch

Hello,

Sorry for not replying before. I was not subscribed to llvm-commits and 
did not see your email.


A couple of comments:  You really need to add some comments in  
Makefile.config.in over the stuff that sets SYSPATH to indicate what  
it is used for, and probably over the TableGen = ... line in  
Makefile.rules.  If you don't do this, someone may break this in the  
future.


Ok, done.

Another thing: does it work to add something like this to  
makefile.rules?


ifeq ($(OS),Cygwin)
  USE_CYGPATH := true  # Actually, it would be better to do the  
syspath stuff here and remove USE_CYGPATH

endif


cygpath should only be used when compiling for Mingw under Cygwin (ie, 
the gcc -mno-cygwin). I've done that instead:


ifneq (,$(findstring -mno-cygwin, $(CXX)))
  SYSPATH = $(shell echo $(1) | cygpath -m -f -)
else
  SYSPATH = $(1)
endif


The new patch is attached.


-- Alain
Index: Makefile.config.in
===
--- Makefile.config.in  (revision 45958)
+++ Makefile.config.in  (working copy)
@@ -265,3 +265,11 @@
 ALL_BINDINGS  := @ALL_BINDINGS@
 OCAML_LIBDIR  := @OCAML_LIBDIR@
 
+# When compiling under Mingw/Cygwin, executables such as tblgen
+# expect Windows paths, whereas the build system uses Unix paths.
+# The function SYSPATH transforms Unix paths into Windows paths.
+ifneq (,$(findstring -mno-cygwin, $(CXX)))
+  SYSPATH = $(shell echo $(1) | cygpath -m -f -)
+else
+  SYSPATH = $(1)
+endif
Index: lib/VMCore/Makefile
===
--- lib/VMCore/Makefile (revision 45958)
+++ lib/VMCore/Makefile (working copy)
@@ -21,7 +21,7 @@
 
 $(ObjDir)/Intrinsics.gen.tmp: $(ObjDir)/.dir $(INTRINSICTDS) $(TBLGEN)
$(Echo) Building Intrinsics.gen.tmp from Intrinsics.td
-   $(Verb) $(TableGen) $(INTRINSICTD) -o $@ -gen-intrinsic
+   $(Verb) $(TableGen) $(call SYSPATH, $(INTRINSICTD)) -o $(call SYSPATH, 
$@) -gen-intrinsic
 
 $(GENFILE): $(ObjDir)/Intrinsics.gen.tmp
$(Verb) $(CMP) -s $@ $< || ( $(CP) $< $@ && \
Index: Makefile.rules
===
--- Makefile.rules  (revision 45958)
+++ Makefile.rules  (working copy)
@@ -483,8 +483,14 @@
 ProgInstall   = $(INSTALL) $(Install.StripFlag) -m 0755 
 ScriptInstall = $(INSTALL) -m 0755 
 DataInstall   = $(INSTALL) -m 0644
-TableGen  = $(TBLGEN) -I $(PROJ_SRC_DIR) -I$(PROJ_SRC_ROOT)/include \
--I $(PROJ_SRC_ROOT)/lib/Target  
+
+# When compiling under Mingw/Cygwin, the tblgen tool expects Windows
+# paths. In this case, the SYSPATH function (defined in
+# Makefile.config) transforms Unix paths into Windows paths.
+TableGen  = $(TBLGEN) -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
+-I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
+-I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
+
 Archive   = $(AR) $(AR.Flags)
 LArchive  = $(LLVMToolDir)/llvm-ar rcsf
 ifdef RANLIB
@@ -1248,57 +1254,57 @@
 $(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
 $(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
$(Echo) "Building $(___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [test-suite] r45958 - /test-suite/trunk/Makefile.programs

2008-01-14 Thread Evan Cheng
Author: evancheng
Date: Mon Jan 14 02:30:36 2008
New Revision: 45958

URL: http://llvm.org/viewvc/llvm-project?rev=45958&view=rev
Log:
No need to pass CFLAGS to compile llc created assembly files.

Modified:
test-suite/trunk/Makefile.programs

Modified: test-suite/trunk/Makefile.programs
URL: 
http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=45958&r1=45957&r2=45958&view=diff

==
--- test-suite/trunk/Makefile.programs (original)
+++ test-suite/trunk/Makefile.programs Mon Jan 14 02:30:36 2008
@@ -374,11 +374,11 @@
 #
 $(PROGRAMS_TO_TEST:%=Output/%.llc): \
 Output/%.llc: Output/%.llc.s
-   -$(LLVMGCCLD) $(CFLAGS) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) 
$(TARGET_FLAGS) $(LDFLAGS)
+   -$(LLVMGCCLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(TARGET_FLAGS) 
$(LDFLAGS)
 
 $(PROGRAMS_TO_TEST:%=Output/%.llc-beta): \
 Output/%.llc-beta: Output/%.llc-beta.s
-   -$(LLVMGCCLD) $(CFLAGS) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) 
$(TARGET_FLAGS) $(LDFLAGS)
+   -$(LLVMGCCLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(TARGET_FLAGS) 
$(LDFLAGS)
 
 
 #


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


Re: [llvm-commits] [llvm-gcc-4.2] r45907 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-convert.c pp llvm-types.cpp

2008-01-14 Thread Duncan Sands
On Monday 14 January 2008 05:15:58 Duncan Sands wrote:
> > Thanks. I see you have fixed the crash in SelectionDAGISel.cpp?
> 
> Yes, and this fixes the Ada build.

Even better, there were no new failures in the ACATS testsuite.

Ciao,

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


[llvm-commits] [llvm] r45959 - /llvm/trunk/test/Verifier/byval-2.ll

2008-01-14 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 14 08:55:05 2008
New Revision: 45959

URL: http://llvm.org/viewvc/llvm-project?rev=45959&view=rev
Log:
Test that byval cannot be used with pointers to
types with no size.

Modified:
llvm/trunk/test/Verifier/byval-2.ll

Modified: llvm/trunk/test/Verifier/byval-2.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/byval-2.ll?rev=45959&r1=45958&r2=45959&view=diff

==
--- llvm/trunk/test/Verifier/byval-2.ll (original)
+++ llvm/trunk/test/Verifier/byval-2.ll Mon Jan 14 08:55:05 2008
@@ -1,2 +1,3 @@
 ; RUN: not llvm-as < %s -o /dev/null -f
-declare void @h(i32* %num) byval
+   %s = type opaque
+declare void @h(%s* byval %num)


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


[llvm-commits] [llvm] r45960 - /llvm/trunk/test/Verifier/byval-3.ll

2008-01-14 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 14 08:57:30 2008
New Revision: 45960

URL: http://llvm.org/viewvc/llvm-project?rev=45960&view=rev
Log:
This test is now the same as byval-1.ll, so remove it.

Removed:
llvm/trunk/test/Verifier/byval-3.ll

Removed: llvm/trunk/test/Verifier/byval-3.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/byval-3.ll?rev=45959&view=auto

==
--- llvm/trunk/test/Verifier/byval-3.ll (original)
+++ llvm/trunk/test/Verifier/byval-3.ll (removed)
@@ -1,2 +0,0 @@
-; RUN: not llvm-as < %s -o /dev/null -f
-declare void @h(i32 byval %num)


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


[llvm-commits] [llvm-gcc-4.2] r45963 - in /llvm-gcc-4.2/trunk/libstdc++-v3/config/cpu: i486/atomicity.h powerpc/atomic_word.h

2008-01-14 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 14 11:41:16 2008
New Revision: 45963

URL: http://llvm.org/viewvc/llvm-project?rev=45963&view=rev
Log:
LLVM supports the i486 asm expression, and hopefully
it supports the ppc one too.  So remove this evil
workaround.

Modified:
llvm-gcc-4.2/trunk/libstdc++-v3/config/cpu/i486/atomicity.h
llvm-gcc-4.2/trunk/libstdc++-v3/config/cpu/powerpc/atomic_word.h

Modified: llvm-gcc-4.2/trunk/libstdc++-v3/config/cpu/i486/atomicity.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/config/cpu/i486/atomicity.h?rev=45963&r1=45962&r2=45963&view=diff

==
--- llvm-gcc-4.2/trunk/libstdc++-v3/config/cpu/i486/atomicity.h (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/config/cpu/i486/atomicity.h Mon Jan 14 
11:41:16 2008
@@ -35,35 +35,19 @@
   __attribute__ ((__unused__))
   __exchange_and_add(volatile _Atomic_word* __mem, int __val)
   {
-// LLVM LOCAL
-#ifndef __llvm__
 register _Atomic_word __result;
 __asm__ __volatile__ ("lock; xadd{l} {%0,%1|%1,%0}"
  : "=r" (__result), "=m" (*__mem) 
  : "0" (__val), "m" (*__mem));
 return __result;
-// LLVM LOCAL begin
-#else
-   // FIXME: implement inline asm.
-   _Atomic_word __result = *__mem;
-   *__mem += __val;
-   return __result;
-#endif
-// LLVM LOCAL end
   }
   
   void
   __attribute__ ((__unused__))
   __atomic_add(volatile _Atomic_word* __mem, int __val)
   {
-// LLVM LOCAL
-#ifndef __llvm__
 __asm__ __volatile__ ("lock; add{l} {%1,%0|%0,%1}"
  : "=m" (*__mem) : "ir" (__val), "m" (*__mem));
-#else
- // FIXME: implement inline asm.
- *__mem += __val;
-#endif
   }
 
 _GLIBCXX_END_NAMESPACE

Modified: llvm-gcc-4.2/trunk/libstdc++-v3/config/cpu/powerpc/atomic_word.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/config/cpu/powerpc/atomic_word.h?rev=45963&r1=45962&r2=45963&view=diff

==
--- llvm-gcc-4.2/trunk/libstdc++-v3/config/cpu/powerpc/atomic_word.h (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/config/cpu/powerpc/atomic_word.h Mon Jan 14 
11:41:16 2008
@@ -31,14 +31,12 @@
 #define _GLIBCXX_ATOMIC_WORD_H 1
 
 typedef int _Atomic_word;
-/* LLVM LOCAL begin */
-#ifndef __llvm__   /* FIXME: implement inline asm */
+
 #define _GLIBCXX_READ_MEM_BARRIER __asm __volatile ("isync":::"memory")
 #ifdef __NO_LWSYNC__
 #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("sync":::"memory")
 #else
 #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("lwsync":::"memory")
 #endif
-#endif
-/* LLVM LOCAL end */
+
 #endif 


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


[llvm-commits] [llvm] r45964 - /llvm/trunk/utils/NewNightlyTest.pl

2008-01-14 Thread Evan Cheng
Author: evancheng
Date: Mon Jan 14 11:58:03 2008
New Revision: 45964

URL: http://llvm.org/viewvc/llvm-project?rev=45964&view=rev
Log:
Need a space to separate Make options.

Modified:
llvm/trunk/utils/NewNightlyTest.pl

Modified: llvm/trunk/utils/NewNightlyTest.pl
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/NewNightlyTest.pl?rev=45964&r1=45963&r2=45964&view=diff

==
--- llvm/trunk/utils/NewNightlyTest.pl (original)
+++ llvm/trunk/utils/NewNightlyTest.pl Mon Jan 14 11:58:03 2008
@@ -154,7 +154,7 @@
  $CONFIGUREARGS .= " --disable-jit"; next; }
   if (/^-disable-cbe$/){ $PROGTESTOPTS .= " DISABLE_CBE=1"; next; }
   if (/^-disable-lto$/){ $PROGTESTOPTS .= " DISABLE_LTO=1"; next; }
-  if (/^-test-opts$/)  { $PROGTESTOPTS .= "$ARGV[0]"; shift; next; }
+  if (/^-test-opts$/)  { $PROGTESTOPTS .= " $ARGV[0]"; shift; next; }
   if (/^-verbose$/){ $VERBOSE = 1; next; }
   if (/^-debug$/)  { $DEBUG = 1; next; }
   if (/^-nice$/)   { $NICE = "nice "; next; }


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


[llvm-commits] [llvm-gcc-4.2] r45968 - /llvm-gcc-4.2/trunk/build_gcc

2008-01-14 Thread Devang Patel
Author: dpatel
Date: Mon Jan 14 12:36:30 2008
New Revision: 45968

URL: http://llvm.org/viewvc/llvm-project?rev=45968&view=rev
Log:
Fix unnecessarily deep symlink. 

Modified:
llvm-gcc-4.2/trunk/build_gcc

Modified: llvm-gcc-4.2/trunk/build_gcc
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=45968&r1=45967&r2=45968&view=diff

==
--- llvm-gcc-4.2/trunk/build_gcc (original)
+++ llvm-gcc-4.2/trunk/build_gcc Mon Jan 14 12:36:30 2008
@@ -522,8 +522,8 @@
 # Set up the llvm-gcc/llvm-g++ symlinks.
 mkdir -p $DEST_DIR$LLVM_BIN_DIR
 cd $DEST_DIR$LLVM_BIN_DIR
-ln -s -f ../../../$DEST_ROOT/bin/llvm-gcc-$MAJ_VERS llvm-gcc-$MAJ_VERS || exit 
1
-ln -s -f ../../../$DEST_ROOT/bin/llvm-g++-$MAJ_VERS llvm-g++-$MAJ_VERS || exit 
1
+ln -s -f ../llvm-gcc-$MAJ_VERS/bin/llvm-gcc-$MAJ_VERS llvm-gcc-$MAJ_VERS || 
exit 1
+ln -s -f ../llvm-gcc-$MAJ_VERS/bin/llvm-g++-$MAJ_VERS llvm-g++-$MAJ_VERS || 
exit 1
 
 # FIXME: This is a hack to get things working.
 for h in $HOSTS ; do


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


[llvm-commits] [llvm] r45972 - in /llvm/trunk/lib/CodeGen: LLVMTargetMachine.cpp PostRASchedulerList.cpp

2008-01-14 Thread Chris Lattner
Author: lattner
Date: Mon Jan 14 13:00:06 2008
New Revision: 45972

URL: http://llvm.org/viewvc/llvm-project?rev=45972&view=rev
Log:
don't create the post-ra scheduler unless it is enabled.

Modified:
llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp

Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=45972&r1=45971&r2=45972&view=diff

==
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Mon Jan 14 13:00:06 2008
@@ -41,6 +41,12 @@
 cl::init(false), cl::Hidden,
 cl::desc("Perform loop-invariant code motion on machine code"));
 
+// When this works it will be on by default.
+static cl::opt
+DisablePostRAScheduler("disable-post-RA-scheduler",
+   cl::desc("Disable scheduling after register 
allocation"),
+   cl::init(true));
+
 FileModel::Model
 LLVMTargetMachine::addPassesToEmitFile(FunctionPassManager &PM,
std::ostream &Out,
@@ -103,7 +109,7 @@
   PM.add(createPrologEpilogCodeInserter());
   
   // Second pass scheduler.
-  if (!Fast)
+  if (!Fast && !DisablePostRAScheduler)
 PM.add(createPostRAScheduler());
 
   // Branch folding must be run after regalloc and prolog/epilog insertion.

Modified: llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp?rev=45972&r1=45971&r2=45972&view=diff

==
--- llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp (original)
+++ llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Mon Jan 14 13:00:06 2008
@@ -21,23 +21,11 @@
 #define DEBUG_TYPE "post-RA-sched"
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
-//#include "llvm/ADT/Statistic.h"
-//#include 
-//#include 
-#include "llvm/Support/CommandLine.h"
 using namespace llvm;
 
 namespace {
-  bool NoPostRAScheduling;
-
-  // When this works it will be on by default.
-  cl::opt
-  DisablePostRAScheduler("disable-post-RA-scheduler",
-   cl::desc("Disable scheduling after register allocation"),
-   cl::location(NoPostRAScheduling),
-   cl::init(true));
-
   class VISIBILITY_HIDDEN SchedulePostRATDList : public MachineFunctionPass {
   public:
 static char ID;
@@ -56,9 +44,6 @@
 }
 
 bool SchedulePostRATDList::runOnMachineFunction(MachineFunction &Fn) {
-  if (NoPostRAScheduling)
-return true;
-
   DOUT << "SchedulePostRATDList\n";
   MF = &Fn;
   TM = &MF->getTarget();


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


[llvm-commits] [llvm] r45971 - /llvm/trunk/lib/CodeGen/LiveInterval.cpp

2008-01-14 Thread Chris Lattner
Author: lattner
Date: Mon Jan 14 12:45:28 2008
New Revision: 45971

URL: http://llvm.org/viewvc/llvm-project?rev=45971&view=rev
Log:
remove dead #include

Modified:
llvm/trunk/lib/CodeGen/LiveInterval.cpp

Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=45971&r1=45970&r2=45971&view=diff

==
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Mon Jan 14 12:45:28 2008
@@ -24,7 +24,6 @@
 #include "llvm/Support/Streams.h"
 #include "llvm/Target/MRegisterInfo.h"
 #include 
-#include 
 #include 
 using namespace llvm;
 


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


[llvm-commits] [llvm] r45974 - /llvm/trunk/lib/VMCore/Instructions.cpp

2008-01-14 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 14 13:57:00 2008
New Revision: 45974

URL: http://llvm.org/viewvc/llvm-project?rev=45974&view=rev
Log:
Simplify CallInst::hasByValArgument using a new method.

Modified:
llvm/trunk/lib/VMCore/Instructions.cpp

Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=45974&r1=45973&r2=45974&view=diff

==
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Jan 14 13:57:00 2008
@@ -406,10 +406,7 @@
 
 /// @brief Determine if any call argument is an aggregate passed by value.
 bool CallInst::hasByValArgument() const {
-  for (unsigned i = 1, e = getNumOperands(); i != e; ++i)
-if (paramHasAttr(i, ParamAttr::ByVal))
-  return true;
-  return false;
+  return ParamAttrs && ParamAttrs->hasAttrSomewhere(ParamAttr::ByVal);
 }
 
 void CallInst::setDoesNotThrow(bool doesNotThrow) {


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


[llvm-commits] [llvm] r45973 - in /llvm/trunk: include/llvm/ParameterAttributes.h lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/ParameterAttributes.cpp test/Transforms/InstCombine/2008-01-

2008-01-14 Thread Duncan Sands
Author: baldrick
Date: Mon Jan 14 13:52:09 2008
New Revision: 45973

URL: http://llvm.org/viewvc/llvm-project?rev=45973&view=rev
Log:
I noticed that the trampoline straightening transformation could
drop attributes on varargs call arguments.  Also, it could generate
invalid IR if the transformed call already had the 'nest' attribute
somewhere (this can never happen for code coming from llvm-gcc,
but it's a theoretical possibility).  Fix both problems.

Added:
llvm/trunk/test/Transforms/InstCombine/2008-01-14-DoubleNest.ll
llvm/trunk/test/Transforms/InstCombine/2008-01-14-VarArgTrampoline.ll
Modified:
llvm/trunk/include/llvm/ParameterAttributes.h
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/trunk/lib/VMCore/ParameterAttributes.cpp

Modified: llvm/trunk/include/llvm/ParameterAttributes.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ParameterAttributes.h?rev=45973&r1=45972&r2=45973&view=diff

==
--- llvm/trunk/include/llvm/ParameterAttributes.h (original)
+++ llvm/trunk/include/llvm/ParameterAttributes.h Mon Jan 14 13:52:09 2008
@@ -53,7 +53,7 @@
 const uint16_t ReturnOnly = NoReturn | NoUnwind | ReadNone | ReadOnly;
 
 /// @brief Parameter attributes that do not apply to vararg call arguments.
-const uint16_t VarArgsIncompatible = Nest | StructRet;
+const uint16_t VarArgsIncompatible = StructRet;
 
 /// @brief Attributes that are mutually incompatible.
 const uint16_t MutuallyIncompatible[3] = {
@@ -171,6 +171,12 @@
   return getParamAttrs(i) & attr;
 }
 
+/// This returns whether the given attribute is set for at least one
+/// parameter or for the return value.
+/// @returns true if the parameter attribute is set somewhere
+/// @brief Determine if a ParameterAttributes is set somewhere
+bool hasAttrSomewhere(ParameterAttributes attr) const;
+
 /// The set of ParameterAttributes set in Attributes is converted to a
 /// string of equivalent mnemonics. This is, presumably, for writing out
 /// the mnemonics for the assembly writer. 

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=45973&r1=45972&r2=45973&view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jan 14 
13:52:09 2008
@@ -8385,6 +8385,12 @@
   Value *Callee = CS.getCalledValue();
   const PointerType *PTy = cast(Callee->getType());
   const FunctionType *FTy = cast(PTy->getElementType());
+  const ParamAttrsList *Attrs = CS.getParamAttrs();
+
+  // If the call already has the 'nest' attribute somewhere then give up -
+  // otherwise 'nest' would occur twice after splicing in the chain.
+  if (Attrs && Attrs->hasAttrSomewhere(ParamAttr::Nest))
+return 0;
 
   IntrinsicInst *Tramp =
 cast(cast(Callee)->getOperand(0));
@@ -8414,25 +8420,39 @@
   std::vector NewArgs;
   NewArgs.reserve(unsigned(CS.arg_end()-CS.arg_begin())+1);
 
+  ParamAttrsVector NewAttrs;
+  NewAttrs.reserve(Attrs ? Attrs->size() + 1 : 1);
+
   // Insert the nest argument into the call argument list, which may
-  // mean appending it.
+  // mean appending it.  Likewise for attributes.
+
+  // Add any function result attributes.
+  uint16_t Attr = Attrs ? Attrs->getParamAttrs(0) : 0;
+  if (Attr)
+NewAttrs.push_back (ParamAttrsWithIndex::get(0, Attr));
+
   {
 unsigned Idx = 1;
 CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end();
 do {
   if (Idx == NestIdx) {
-// Add the chain argument.
+// Add the chain argument and attributes.
 Value *NestVal = Tramp->getOperand(3);
 if (NestVal->getType() != NestTy)
   NestVal = new BitCastInst(NestVal, NestTy, "nest", Caller);
 NewArgs.push_back(NestVal);
+NewAttrs.push_back(ParamAttrsWithIndex::get(NestIdx, NestAttr));
   }
 
   if (I == E)
 break;
 
-  // Add the original argument.
+  // Add the original argument and attributes.
   NewArgs.push_back(*I);
+  Attr = Attrs ? Attrs->getParamAttrs(Idx) : 0;
+  if (Attr)
+NewAttrs.push_back
+  (ParamAttrsWithIndex::get(Idx + (Idx >= NestIdx), Attr));
 
   ++Idx, ++I;
 } while (1);
@@ -8440,41 +8460,28 @@
 
   // The trampoline may have been bitcast to a bogus type (FTy).
   // Handle this by synthesizing a new function type, equal to FTy
-  // with the chain parameter inserted.  Likewise for attributes.
+  // with the chain parameter inserted.
 
-  const ParamAttrsList *Attrs = CS.getParamAttrs();
   std::vector NewTypes;
-

Re: [llvm-commits] Patch for compiling with Mingw/Cygwin

2008-01-14 Thread Chris Lattner

On Jan 14, 2008, at 12:56 AM, Alain Frisch wrote:

> Hello,
>
> Sorry for not replying before. I was not subscribed to llvm-commits  
> and did not see your email.
>
>> A couple of comments:  You really need to add some comments in   
>> Makefile.config.in over the stuff that sets SYSPATH to indicate  
>> what  it is used for, and probably over the TableGen = ... line in   
>> Makefile.rules.  If you don't do this, someone may break this in  
>> the  future.
>
> Ok, done.
>
>> Another thing: does it work to add something like this to   
>> makefile.rules?
>> ifeq ($(OS),Cygwin)
>>  USE_CYGPATH := true  # Actually, it would be better to do the   
>> syspath stuff here and remove USE_CYGPATH
>> endif
>
> cygpath should only be used when compiling for Mingw under Cygwin  
> (ie, the gcc -mno-cygwin). I've done that instead:

Okay, this looks really good.  One final question before I commit: why  
does tblgen want a windows path instead of a unix path?  Can that be  
fixed in tblgen?  Doesn't this affect llvm-as and all other tools?

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


[llvm-commits] [llvm-gcc-4.2] r45979 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp

2008-01-14 Thread Chris Lattner
Author: lattner
Date: Mon Jan 14 16:27:52 2008
New Revision: 45979

URL: http://llvm.org/viewvc/llvm-project?rev=45979&view=rev
Log:
Fix test/C++Frontend/2007-03-27-FunctionVarRename.cpp with llvm-g++ 4.2,
which is PR1869.  This bug actually occurs in 4.0 as well, but 4.2 gets
unlucky and processes things in a different order.

Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=45979&r1=45978&r2=45979&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Jan 14 16:27:52 2008
@@ -1102,7 +1102,26 @@
   FnEntry->setVisibility(GlobalValue::ProtectedVisibility);
   }
 
-  assert(FnEntry->getName() == Name &&"Preexisting fn with the same 
name!");
+  // If FnEntry got renamed, then there is already an object with this name
+  // in the symbol table.  If this happens, the old one must be a forward
+  // decl, just replace it with a cast of the new one.
+  if (FnEntry->getName() != Name) {
+GlobalVariable *G = TheModule->getGlobalVariable(Name, true);
+assert(G && G->isDeclaration() && "A global turned into a function?");
+
+// Replace any uses of "G" with uses of FnEntry.
+Value *GInNewType = ConstantExpr::getBitCast(FnEntry, G->getType());
+G->replaceAllUsesWith(GInNewType);
+
+// Update the decl that points to G.
+changeLLVMValue(G, GInNewType);
+
+// Now we can give GV the proper name.
+FnEntry->takeName(G);
+
+// G is now dead, nuke it.
+G->eraseFromParent();
+  }
 }
 SET_DECL_LLVM(decl, FnEntry);
   } else {


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


[llvm-commits] [llvm-gcc-4.2] r45978 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

2008-01-14 Thread Bill Wendling
Author: void
Date: Mon Jan 14 16:18:42 2008
New Revision: 45978

URL: http://llvm.org/viewvc/llvm-project?rev=45978&view=rev
Log:
GCC emits .reference and .lazy_reference directives directly to the .s file. We
rather create the reference as data and then point that to what we then hope
is an external symbol. However, this symbol doesn't have to exist in some cases.
And, even without the .reference and .lazy_reference directives, we shouldn't
be emitting data refering to this symbol.

It would still be nice to have the .{lazy_}reference directives, but this will
suffice for the time being.

Modified:
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=45978&r1=45977&r2=45978&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Jan 14 16:18:42 2008
@@ -18255,19 +18255,15 @@
   tree decl;
   tree exp;
 
-  /* LLVM LOCAL begin */
-#ifdef ENABLE_LLVM
-#undef ASM_DECLARE_UNRESOLVED_REFERENCE
-#endif
-  /* LLVM LOCAL end */
-  
   sprintf (string, "%sobjc_class_name_%s",
   (flag_next_runtime ? "." : "__"), name);
 
 #ifdef ASM_DECLARE_UNRESOLVED_REFERENCE
   if (flag_next_runtime)
 {
+#ifndef ENABLE_LLVM
   ASM_DECLARE_UNRESOLVED_REFERENCE (asm_out_file, string);
+#endif
   return;
 }
 #endif


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


[llvm-commits] [test-suite] r45980 - in /test-suite/trunk: External/SPEC/CINT2000/252.eon/Makefile Makefile.programs Makefile.rules Makefile.tests MultiSource/Applications/spiff/Makefile MultiSource/M

2008-01-14 Thread Evan Cheng
Author: evancheng
Date: Mon Jan 14 16:33:19 2008
New Revision: 45980

URL: http://llvm.org/viewvc/llvm-project?rev=45980&view=rev
Log:
More makefile changes to make it easier to override default optimization level. 
This also fixes errenous 252.eon CBE performance regression.

Modified:
test-suite/trunk/External/SPEC/CINT2000/252.eon/Makefile
test-suite/trunk/Makefile.programs
test-suite/trunk/Makefile.rules
test-suite/trunk/Makefile.tests
test-suite/trunk/MultiSource/Applications/spiff/Makefile
test-suite/trunk/MultiSource/Makefile.multisrc
test-suite/trunk/SingleSource/Makefile.singlesrc

Modified: test-suite/trunk/External/SPEC/CINT2000/252.eon/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/CINT2000/252.eon/Makefile?rev=45980&r1=45979&r2=45980&view=diff

==
--- test-suite/trunk/External/SPEC/CINT2000/252.eon/Makefile (original)
+++ test-suite/trunk/External/SPEC/CINT2000/252.eon/Makefile Mon Jan 14 
16:33:19 2008
@@ -9,9 +9,6 @@
 
 include $(LEVEL)/Makefile.config
 
-# Yes, we know this is an old crufty C++ benchmark.  Don't tell us about it 
GCC!
-CFLAGS += -fno-exceptions -Wno-deprecated -Wno-non-template-friend 
-
 ifeq ($(ARCH),PowerPC)
  CPPFLAGS += -DFMAX_IS_DOUBLE
 endif
@@ -64,6 +61,10 @@
 mrSolidTexture.cc mrSphere.cc mrSurface.cc mrSurfaceTexture.cc \
 mrXYRectangle.cc mrXZRectangle.cc mrYZRectangle.cc myrand.cc)
 include ../../Makefile.spec2000
+
+# Yes, we know this is an old crufty C++ benchmark.  Don't tell us about it 
GCC!
+CXXFLAGS += -fno-exceptions -Wno-deprecated -Wno-non-template-friend 
+
 LDFLAGS = -lstdc++ -lm
 LIBS= -lstdc++ -lm
 

Modified: test-suite/trunk/Makefile.programs
URL: 
http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=45980&r1=45979&r2=45980&view=diff

==
--- test-suite/trunk/Makefile.programs (original)
+++ test-suite/trunk/Makefile.programs Mon Jan 14 16:33:19 2008
@@ -348,7 +348,7 @@
 
 $(PROGRAMS_TO_TEST:%=Output/%.cbe): \
 Output/%.cbe: Output/%.cbe.c
-   -$(CC) $< -o $@ $(LDFLAGS) $(CFLAGS) -fno-strict-aliasing -fno-inline 
$(TARGET_FLAGS) $(LIBS)
+   -$(CC) $< -o $@ $(LDFLAGS) $(CFLAGS) $(OPTFLAGS) -fno-strict-aliasing 
-fno-inline $(TARGET_FLAGS) $(LIBS)
 
 #
 # Compile a linked program to machine code with LLC.

Modified: test-suite/trunk/Makefile.rules
URL: 
http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.rules?rev=45980&r1=45979&r2=45980&view=diff

==
--- test-suite/trunk/Makefile.rules (original)
+++ test-suite/trunk/Makefile.rules Mon Jan 14 16:33:19 2008
@@ -322,8 +322,19 @@
 CPPFLAGS += -D_GNU_SOURCE
 # Pull in limit macros from stdint.h, even in C++:
 CPPFLAGS += -D__STDC_LIMIT_MACROS
+CPPFLAGS += -DNDEBUG
+
+# Default optimization level:
+OPTFLAGS := -O3
+
+# If LTO is on, compile each .c .cpp file with -O0 and optimize with
+# opt and llvm-ld.
+ifdef DISABLE_LTO
+LOPTFLAGS := $(OPTFLAGS)
+else
+LOPTFLAGS := -O0
+endif
 
-CompileOptimizeOpts := -O3 -DNDEBUG -finline-functions
 
 ifeq ($(OS),Darwin)
 ifndef TARGET_FLAGS
@@ -358,18 +369,18 @@
 #
 # Compile commands with libtool.
 #
-Compile  := $(LIBTOOL) --tag=CXX --mode=compile $(CXX) -c $(CPPFLAGS) 
$(CXXFLAGS)
-CompileC  := $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS)
+Compile  := $(LIBTOOL) --tag=CXX --mode=compile $(CXX) -c $(CPPFLAGS) 
$(CXXFLAGS) $(OPTFLAGS)
+CompileC  := $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) 
$(OPTFLAGS)
 
 # Compile a cpp file, don't link...
 CompileG := $(Compile) -g  -D_DEBUG
-CompileO := $(Compile) $(CompileOptimizeOpts) -felide-constructors 
-fomit-frame-pointer
-CompileP := $(Compile) $(CompileOptimizeOpts) -felide-constructors $(PROFILE)
+CompileO := $(Compile) $(OPTFLAGS) -felide-constructors -fomit-frame-pointer
+CompileP := $(Compile) $(OPTFLAGS) -felide-constructors $(PROFILE)
 
 # Compile a c file, don't link...
 CompileCG := $(CompileC) -g  -D_DEBUG
-CompileCO := $(CompileC) $(CompileOptimizeOpts) -fomit-frame-pointer
-CompileCP := $(CompileC) $(CompileOptimizeOpts) $(PROFILE)
+CompileCO := $(CompileC) $(OPTFLAGS) -fomit-frame-pointer
+CompileCP := $(CompileC) $(OPTFLAGS) $(PROFILE)
 
 ###
 # Link Time Options

Modified: test-suite/trunk/Makefile.tests
URL: 
http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.tests?rev=45980&r1=45979&r2=45980&view=diff

==
--- test-suite/trunk/Makefile.tests (original)
+++ test-suite/trunk/Makefile.tests Mon Jan 14 16:33:19 2008
@@ -34,23 +34,6 @@
 .PRECIOUS: Output/%.llvm.bc
 .PRECIOUS: Output/%.llvm
 
-ifndef CFLAGS
-CFLAGS = -O3
-endif
-ifndef CXXFLAGS
-CXXFLAGS = -O3
-endif
-
-# If

[llvm-commits] [llvm-gcc-4.0] r45981 - /llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp

2008-01-14 Thread Chris Lattner
Author: lattner
Date: Mon Jan 14 16:34:07 2008
New Revision: 45981

URL: http://llvm.org/viewvc/llvm-project?rev=45981&view=rev
Log:
Support a global that turns into a function.  This is the llvm-gcc 4.0 version 
of the 4.2 fix for PR1869

Modified:
llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp

Modified: llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp?rev=45981&r1=45980&r2=45981&view=diff

==
--- llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Mon Jan 14 16:34:07 2008
@@ -1032,7 +1032,26 @@
   FnEntry->setVisibility(GlobalValue::ProtectedVisibility);
   }
 
-  assert(FnEntry->getName() == Name &&"Preexisting fn with the same 
name!");
+  // If FnEntry got renamed, then there is already an object with this name
+  // in the symbol table.  If this happens, the old one must be a forward
+  // decl, just replace it with a cast of the new one.
+  if (FnEntry->getName() != Name) {
+GlobalVariable *G = TheModule->getGlobalVariable(Name, true);
+assert(G && G->isDeclaration() && "A global turned into a function?");
+
+// Replace any uses of "G" with uses of FnEntry.
+Value *GInNewType = ConstantExpr::getBitCast(FnEntry, G->getType());
+G->replaceAllUsesWith(GInNewType);
+
+// Update the decl that points to G.
+changeLLVMValue(G, GInNewType);
+
+// Now we can give GV the proper name.
+FnEntry->takeName(G);
+
+// G is now dead, nuke it.
+G->eraseFromParent();
+  }
 }
 SET_DECL_LLVM(decl, FnEntry);
   } else {


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


Re: [llvm-commits] [llvm-gcc-4.2] r45978 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

2008-01-14 Thread Chris Lattner
On Jan 14, 2008, at 2:18 PM, Bill Wendling wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=45978&view=rev
> Log:
> GCC emits .reference and .lazy_reference directives directly to  
> the .s file. We
> rather create the reference as data and then point that to what we  
> then hope
> is an external symbol. However, this symbol doesn't have to exist in  
> some cases.
> And, even without the .reference and .lazy_reference directives, we  
> shouldn't
> be emitting data refering to this symbol.

More to the point, this improves compatibility with the leopard  
dynamic linker and xcode 3.0 linker.

I'll apply this to llvm-gcc 4.0 Bill, but please add the LLVM LOCAL  
markers to the new #ifdefs, thanks!

-Chris

>
>
> Modified:
>llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
>
> Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=45978&r1=45977&r2=45978&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ==
> --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
> +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Jan 14 16:18:42 2008
> @@ -18255,19 +18255,15 @@
>   tree decl;
>   tree exp;
>
> -  /* LLVM LOCAL begin */
> -#ifdef ENABLE_LLVM
> -#undef ASM_DECLARE_UNRESOLVED_REFERENCE
> -#endif
> -  /* LLVM LOCAL end */
> -
>   sprintf (string, "%sobjc_class_name_%s",
>  (flag_next_runtime ? "." : "__"), name);
>
> #ifdef ASM_DECLARE_UNRESOLVED_REFERENCE
>   if (flag_next_runtime)
> {
> +#ifndef ENABLE_LLVM
>   ASM_DECLARE_UNRESOLVED_REFERENCE (asm_out_file, string);
> +#endif
>   return;
> }
> #endif
>
>
> ___
> 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] [llvm-gcc-4.0] r45982 - /llvm-gcc-4.0/trunk/gcc/objc/objc-act.c

2008-01-14 Thread Chris Lattner
Author: lattner
Date: Mon Jan 14 17:00:10 2008
New Revision: 45982

URL: http://llvm.org/viewvc/llvm-project?rev=45982&view=rev
Log:
improve compatibility with the leopard dyld and xcode 3 linker.

Modified:
llvm-gcc-4.0/trunk/gcc/objc/objc-act.c

Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=45982&r1=45981&r2=45982&view=diff

==
--- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Mon Jan 14 17:00:10 2008
@@ -18358,12 +18358,6 @@
   char *string = (char *) alloca (strlen (name) + 30);
   tree decl;
   tree exp;
-
-  /* APPLE LOCAL begin LLVM */
-#ifdef ENABLE_LLVM
-#undef ASM_DECLARE_UNRESOLVED_REFERENCE
-#endif
-  /* APPLE LOCAL end LLVM */
   
   sprintf (string, "%sobjc_class_name_%s",
   (flag_next_runtime ? "." : "__"), name);
@@ -18371,7 +18365,11 @@
 #ifdef ASM_DECLARE_UNRESOLVED_REFERENCE
   if (flag_next_runtime)
 {
+  /* APPLE LOCAL begin LLVM */
+#ifdef ENABLE_LLVM
   ASM_DECLARE_UNRESOLVED_REFERENCE (asm_out_file, string);
+#endif
+  /* APPLE LOCAL end LLVM */
   return;
 }
 #endif


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


[llvm-commits] [llvm-gcc-4.0] r45983 - /llvm-gcc-4.0/trunk/gcc/fold-const.c

2008-01-14 Thread Chris Lattner
Author: lattner
Date: Mon Jan 14 17:12:30 2008
New Revision: 45983

URL: http://llvm.org/viewvc/llvm-project?rev=45983&view=rev
Log:
Fix PR1904, which involves merging the (GPL2) patch for PR28045 
into llvm-gcc 4.0.  llvm-gcc 4.2 already has this fix.

Modified:
llvm-gcc-4.0/trunk/gcc/fold-const.c

Modified: llvm-gcc-4.0/trunk/gcc/fold-const.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/fold-const.c?rev=45983&r1=45982&r2=45983&view=diff

==
--- llvm-gcc-4.0/trunk/gcc/fold-const.c (original)
+++ llvm-gcc-4.0/trunk/gcc/fold-const.c Mon Jan 14 17:12:30 2008
@@ -2377,6 +2377,11 @@
   if (TYPE_UNSIGNED (TREE_TYPE (arg0)) != TYPE_UNSIGNED (TREE_TYPE (arg1)))
 return 0;
 
+  /* If both types don't have the same precision, then it is not safe
+   to strip NOPs.  */
+  if (TYPE_PRECISION (TREE_TYPE (arg0)) != TYPE_PRECISION (TREE_TYPE (arg1)))
+return 0;
+  
   STRIP_NOPS (arg0);
   STRIP_NOPS (arg1);
 


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


[llvm-commits] [llvm-gcc-4.2] r45985 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

2008-01-14 Thread Bill Wendling
Author: void
Date: Mon Jan 14 17:20:29 2008
New Revision: 45985

URL: http://llvm.org/viewvc/llvm-project?rev=45985&view=rev
Log:
Forgot LLVM LOCAL tags.

Modified:
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=45985&r1=45984&r2=45985&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Jan 14 17:20:29 2008
@@ -18261,9 +18261,11 @@
 #ifdef ASM_DECLARE_UNRESOLVED_REFERENCE
   if (flag_next_runtime)
 {
+  /* LLVM LOCAL begin - radar 5681912 */
 #ifndef ENABLE_LLVM
   ASM_DECLARE_UNRESOLVED_REFERENCE (asm_out_file, string);
 #endif
+  /* LLVM LOCAL end - radar 5681912 */
   return;
 }
 #endif


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


Re: [llvm-commits] [llvm-gcc-4.2] r45978 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c

2008-01-14 Thread Bill Wendling
On Jan 14, 2008 2:59 PM, Chris Lattner <[EMAIL PROTECTED]> wrote:
> On Jan 14, 2008, at 2:18 PM, Bill Wendling wrote:
> > URL: http://llvm.org/viewvc/llvm-project?rev=45978&view=rev
> > Log:
> > GCC emits .reference and .lazy_reference directives directly to
> > the .s file. We
> > rather create the reference as data and then point that to what we
> > then hope
> > is an external symbol. However, this symbol doesn't have to exist in
> > some cases.
> > And, even without the .reference and .lazy_reference directives, we
> > shouldn't
> > be emitting data refering to this symbol.
>
> More to the point, this improves compatibility with the leopard
> dynamic linker and xcode 3.0 linker.
>
> I'll apply this to llvm-gcc 4.0 Bill, but please add the LLVM LOCAL
> markers to the new #ifdefs, thanks!
>
Oops! Done.

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


[llvm-commits] [llvm-gcc-4.0] r45987 - in /llvm-gcc-4.0/trunk/gcc: config/i386/llvm-i386-target.h llvm-abi.h llvm-convert.cpp llvm-types.cpp

2008-01-14 Thread Evan Cheng
Author: evancheng
Date: Mon Jan 14 17:28:30 2008
New Revision: 45987

URL: http://llvm.org/viewvc/llvm-project?rev=45987&view=rev
Log:
Merge -r45906:45908 llvm-gcc-4.2/trunk

Modified:
llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386-target.h
llvm-gcc-4.0/trunk/gcc/llvm-abi.h
llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
llvm-gcc-4.0/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386-target.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386-target.h?rev=45987&r1=45986&r2=45987&view=diff

==
--- llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386-target.h (original)
+++ llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386-target.h Mon Jan 14 17:28:30 
2008
@@ -60,5 +60,8 @@
 }   \
   }
 
+#define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X)  \
+  (!TARGET_64BIT)
+
 /* APPLE LOCAL end LLVM (ENTIRE FILE!)  */
 

Modified: llvm-gcc-4.0/trunk/gcc/llvm-abi.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-abi.h?rev=45987&r1=45986&r2=45987&view=diff

==
--- llvm-gcc-4.0/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-abi.h Mon Jan 14 17:28:30 2008
@@ -32,6 +32,7 @@
 #include "llvm-internal.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
+#include "llvm/ParameterAttributes.h"
 #include "llvm/Target/TargetData.h"
 
 namespace llvm {
@@ -126,7 +127,15 @@
 // would often be 64-bits).
 #ifndef LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS
 #define LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(X) \
-   !isSingleElementStructOrArray(type)
+   !isSingleElementStructOrArray(X)
+#endif
+
+// LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR - Return true if this aggregate
+// value should be passed by reference by passing its address with the byval
+// attribute bit set. The default is false.
+#ifndef LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X)
+#define LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(X) \
+false
 #endif
 
 /// DefaultABI - This class implements the default LLVM ABI where structures 
are
@@ -192,13 +201,17 @@
   /// argument and invokes methods on the client that indicate how its pieces
   /// should be handled.  This handles things like decimating structures into
   /// their fields.
-  void HandleArgument(tree type) {
+  void HandleArgument(tree type, uint16_t *Attributes = NULL) {
 const Type *Ty = ConvertType(type);
 
 if (isPassedByInvisibleReference(type)) { // variable size -> by-ref.
   C.HandleScalarArgument(PointerType::getUnqual(Ty), type);
 } else if (Ty->isFirstClassType()) {
   C.HandleScalarArgument(Ty, type);
+} else if (LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(type)) {
+  C.HandleByValArgument(Ty, type);
+  if (Attributes)
+*Attributes |= ParamAttr::ByVal;
 } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
   PassInIntegerRegisters(type, Ty);
 } else if (TREE_CODE(type) == RECORD_TYPE) {

Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=45987&r1=45986&r2=45987&view=diff

==
--- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Mon Jan 14 17:28:30 2008
@@ -467,6 +467,11 @@
   ++AI;
 }
 
+void HandleByValArgument(const llvm::Type *LLVMTy, tree type) {
+  // Should not get here.
+  abort();
+}
+
 void EnterField(unsigned FieldNo, const llvm::Type *StructTy) {
   NameStack.push_back(NameStack.back()+"."+utostr(FieldNo));
   
@@ -637,9 +642,12 @@
 const char *Name = "unnamed_arg";
 if (DECL_NAME(Args)) Name = IDENTIFIER_POINTER(DECL_NAME(Args));
 
-if (isPassedByInvisibleReference(TREE_TYPE(Args))) {
-  // If the value is passed by 'invisible reference', the l-value for the
-  // argument IS the argument itself.
+const Type *ArgTy = ConvertType(TREE_TYPE(Args));
+if (isPassedByInvisibleReference(TREE_TYPE(Args)) ||
+(!ArgTy->isFirstClassType() &&
+ LLVM_SHOULD_PASS_AGGREGATE_USING_BYVAL_ATTR(TREE_TYPE(Args {
+  // If the value is passed by 'invisible reference' or 'byval reference',
+  // the l-value for the argument IS the argument itself.
   SET_DECL_LLVM(Args, AI);
   AI->setName(Name);
   ++AI;
@@ -647,7 +655,6 @@
   // Otherwise, we create an alloca to hold the argument value and provide
   // an l-value.  On entry to the function, we copy formal argument values
   // into the alloca.
-  const Type *ArgTy = ConvertType(TREE_TYPE(Args));
   Value *Tmp = CreateTemporary(ArgTy);
   Tmp->setName(std::string(Name)+"_addr");
   SET_DECL_LLVM(Args, Tmp);
@@ -2841,6 +284

[llvm-commits] [llvm-gcc-4.2] r45988 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp

2008-01-14 Thread Evan Cheng
Author: evancheng
Date: Mon Jan 14 17:30:29 2008
New Revision: 45988

URL: http://llvm.org/viewvc/llvm-project?rev=45988&view=rev
Log:
Add missing LLVM LOCAL marker.

Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=45988&r1=45987&r2=45988&view=diff

==
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Mon Jan 14 17:30:29 2008
@@ -659,3 +659,5 @@
 
   return false;
 }
+
+/* LLVM LOCAL end (ENTIRE FILE!)  */


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


[llvm-commits] [llvm] r45996 - /llvm/trunk/lib/Target/X86/X86CallingConv.td

2008-01-14 Thread Evan Cheng
Author: evancheng
Date: Mon Jan 14 21:15:41 2008
New Revision: 45996

URL: http://llvm.org/viewvc/llvm-project?rev=45996&view=rev
Log:
Both x86-32 and x86-64 handle byval parameter attributes.

Modified:
llvm/trunk/lib/Target/X86/X86CallingConv.td

Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=45996&r1=45995&r2=45996&view=diff

==
--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)
+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Mon Jan 14 21:15:41 2008
@@ -96,11 +96,12 @@
 
//===--===//
 
 def CC_X86_64_C : CallingConv<[
+  // Handles byval parameters.
+  CCIfStruct>,
+
   // Promote i8/i16 arguments to i32.
   CCIfType<[i8, i16], CCPromoteToType>,
   
-  CCIfStruct>,
-
   // The first 6 integer arguments are passed in integer registers.
   CCIfType<[i32], CCAssignToReg<[EDI, ESI, EDX, ECX, R8D, R9D]>>,
   CCIfType<[i64], CCAssignToReg<[RDI, RSI, RDX, RCX, R8 , R9 ]>>,
@@ -134,11 +135,12 @@
 // Tail call convention (fast): One register is reserved for target address,
 // namely R9
 def CC_X86_64_TailCall : CallingConv<[
+  // Handles byval parameters.
+  CCIfStruct>,
+
   // Promote i8/i16 arguments to i32.
   CCIfType<[i8, i16], CCPromoteToType>,
   
-  CCIfStruct>,
-
   // The first 6 integer arguments are passed in integer registers.
   CCIfType<[i32], CCAssignToReg<[EDI, ESI, EDX, ECX, R8D]>>,
   CCIfType<[i64], CCAssignToReg<[RDI, RSI, RDX, RCX, R8]>>,
@@ -174,6 +176,9 @@
 /// values are spilled on the stack, and the first 4 vector values go in XMM
 /// regs.
 def CC_X86_32_Common : CallingConv<[
+  // Handles byval parameters.
+  CCIfStruct>,
+
   // Integer/Float values get stored in stack slots that are 4 bytes in
   // size and 4-byte aligned.
   CCIfType<[i32, f32], CCAssignToStack<4, 4>>,


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


[llvm-commits] [llvm] r45995 - /llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp

2008-01-14 Thread Evan Cheng
Author: evancheng
Date: Mon Jan 14 21:14:05 2008
New Revision: 45995

URL: http://llvm.org/viewvc/llvm-project?rev=45995&view=rev
Log:
ByVal stack slot alignment should be at least as large as pointer ABI alignment.

Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp?rev=45995&r1=45994&r2=45995&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp Mon Jan 14 
21:14:05 2008
@@ -15,6 +15,7 @@
 #include "llvm/CodeGen/CallingConvLower.h"
 #include "llvm/CodeGen/SelectionDAGNodes.h"
 #include "llvm/Target/MRegisterInfo.h"
+#include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetMachine.h"
 using namespace llvm;
 
@@ -31,11 +32,12 @@
 void CCState::HandleStruct(unsigned ValNo, MVT::ValueType ValVT,
MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,
unsigned ArgFlags) {
+  unsigned MinAlign = TM.getTargetData()->getPointerABIAlignment();
   unsigned Align  = 1 << ((ArgFlags & ISD::ParamFlags::ByValAlign) >>
   ISD::ParamFlags::ByValAlignOffs);
   unsigned Size   = (ArgFlags & ISD::ParamFlags::ByValSize) >>
   ISD::ParamFlags::ByValSizeOffs;
-  unsigned Offset = AllocateStack(Size, Align);
+  unsigned Offset = AllocateStack(Size, std::max(MinAlign, Align));
 
   addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
 }


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


[llvm-commits] [llvm] r45994 - /llvm/trunk/utils/TableGen/CallingConvEmitter.cpp

2008-01-14 Thread Evan Cheng
Author: evancheng
Date: Mon Jan 14 21:10:35 2008
New Revision: 45994

URL: http://llvm.org/viewvc/llvm-project?rev=45994&view=rev
Log:
Revert my last commit. Not needed.

Modified:
llvm/trunk/utils/TableGen/CallingConvEmitter.cpp

Modified: llvm/trunk/utils/TableGen/CallingConvEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CallingConvEmitter.cpp?rev=45994&r1=45993&r2=45994&view=diff

==
--- llvm/trunk/utils/TableGen/CallingConvEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/CallingConvEmitter.cpp Mon Jan 14 21:10:35 2008
@@ -115,32 +115,19 @@
   int Size = Action->getValueAsInt("Size");
   int Align = Action->getValueAsInt("Align");
 
-  O << IndentStr << "unsigned Size = ";
+  O << IndentStr << "unsigned Offset" << ++Counter
+<< " = State.AllocateStack(";
   if (Size)
-O << Size;
+O << Size << ", ";
   else
-O << "State.getTarget().getTargetData()"
-  "->getABITypeSize(MVT::getTypeForValueType(LocVT))";
-  O << ";\n"
-<< IndentStr << "unsigned Align = ";
+O << "\n" << IndentStr << "  State.getTarget().getTargetData()"
+  "->getABITypeSize(MVT::getTypeForValueType(LocVT)), ";
   if (Align)
 O << Align;
   else
-O << "State.getTarget().getTargetData()"
+O << "\n" << IndentStr << "  State.getTarget().getTargetData()"
   "->getABITypeAlignment(MVT::getTypeForValueType(LocVT))";
-  O << ";\n";
-  O << IndentStr << "if (ArgFlags & ISD::ParamFlags::ByVal) {\n";
-  O << IndentStr << "  " <<
-"Size = (ArgFlags & ISD::ParamFlags::ByValSize) >> "
-"ISD::ParamFlags::ByValSizeOffs;\n";
-  O << IndentStr << "  " <<
-"unsigned ParamAlign = 1 << ((ArgFlags & ISD::ParamFlags::ByValAlign) "
-">> ISD::ParamFlags::ByValAlignOffs);\n";
-  O << IndentStr << "  Align = std::max(Align, ParamAlign);\n"
-<< IndentStr << "}\n";
-  O << IndentStr << "unsigned Offset" << ++Counter
-<< " = State.AllocateStack(Size, Align);\n";
-  O << IndentStr
+  O << ");\n" << IndentStr
 << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
 << Counter << ", LocVT, LocInfo));\n";
   O << IndentStr << "return false;\n";


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


[llvm-commits] [llvm] r45997 - in /llvm/trunk: lib/Target/TargetCallingConv.td lib/Target/X86/X86CallingConv.td utils/TableGen/CallingConvEmitter.cpp

2008-01-14 Thread Evan Cheng
Author: evancheng
Date: Mon Jan 14 21:34:58 2008
New Revision: 45997

URL: http://llvm.org/viewvc/llvm-project?rev=45997&view=rev
Log:
Rename CCIfStruct to CCIfByVal and CCStructAssign to CCPassByVal. Remove unused 
parameters of CCStructAssign and add size and alignment requirement info.

Modified:
llvm/trunk/lib/Target/TargetCallingConv.td
llvm/trunk/lib/Target/X86/X86CallingConv.td
llvm/trunk/utils/TableGen/CallingConvEmitter.cpp

Modified: llvm/trunk/lib/Target/TargetCallingConv.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetCallingConv.td?rev=45997&r1=45996&r2=45997&view=diff

==
--- llvm/trunk/lib/Target/TargetCallingConv.td (original)
+++ llvm/trunk/lib/Target/TargetCallingConv.td Mon Jan 14 21:34:58 2008
@@ -32,9 +32,9 @@
   string Predicate = predicate;
 }
 
-/// CCIfStruct - If the current argument is a struct, apply
+/// CCIfByVal - If the current argument has ByVal parameter attribute, apply
 /// Action A.
-class CCIfStruct : CCIf<"ArgFlags & ISD::ParamFlags::ByVal", A> {
+class CCIfByVal : CCIf<"ArgFlags & ISD::ParamFlags::ByVal", A> {
 }
 
 /// CCIfCC - Match of the current calling convention is 'CC'.
@@ -68,11 +68,12 @@
   int Align = align;
 }
 
-/// CCStructAssign - This action always matches: it will use the C ABI and
-/// the register availability to decided whether to assign to a set of
-/// registers or to a stack slot.
-class CCStructAssign regList> : CCAction {
-  list RegList = regList;
+/// CCPassByVal - This action always matches: it assigns the value to a stack
+/// slot to implement ByVal aggregate parameter passing. Size and alignment
+/// specify the minimum size and alignment for the stack slot.
+class CCPassByVal : CCAction {
+  int Size = size;
+  int Align = align;
 }
 
 /// CCPromoteToType - If applied, this promotes the specified current value to

Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=45997&r1=45996&r2=45997&view=diff

==
--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)
+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Mon Jan 14 21:34:58 2008
@@ -97,7 +97,7 @@
 
 def CC_X86_64_C : CallingConv<[
   // Handles byval parameters.
-  CCIfStruct>,
+  CCIfByVal>,
 
   // Promote i8/i16 arguments to i32.
   CCIfType<[i8, i16], CCPromoteToType>,
@@ -136,7 +136,7 @@
 // namely R9
 def CC_X86_64_TailCall : CallingConv<[
   // Handles byval parameters.
-  CCIfStruct>,
+  CCIfByVal>,
 
   // Promote i8/i16 arguments to i32.
   CCIfType<[i8, i16], CCPromoteToType>,
@@ -177,7 +177,7 @@
 /// regs.
 def CC_X86_32_Common : CallingConv<[
   // Handles byval parameters.
-  CCIfStruct>,
+  CCIfByVal>,
 
   // Integer/Float values get stored in stack slots that are 4 bytes in
   // size and 4-byte aligned.

Modified: llvm/trunk/utils/TableGen/CallingConvEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CallingConvEmitter.cpp?rev=45997&r1=45996&r2=45997&view=diff

==
--- llvm/trunk/utils/TableGen/CallingConvEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/CallingConvEmitter.cpp Mon Jan 14 21:34:58 2008
@@ -140,9 +140,12 @@
 << IndentStr << IndentStr << "LocInfo = CCValAssign::ZExt;\n"
 << IndentStr << "else\n"
 << IndentStr << IndentStr << "LocInfo = CCValAssign::AExt;\n";
-} else if (Action->isSubClassOf("CCStructAssign")) {
-  O << IndentStr <<
-  "State.HandleStruct(ValNo, ValVT, LocVT, LocInfo, ArgFlags);\n";
+} else if (Action->isSubClassOf("CCPassByVal")) {
+  int Size = Action->getValueAsInt("Size");
+  int Align = Action->getValueAsInt("Align");
+  O << IndentStr
+<< "State.HandleByVal(ValNo, ValVT, LocVT, LocInfo, "
+<< Size << ", " << Align << ", ArgFlags);\n";
   O << IndentStr << "return false;\n";
 } else {
   Action->dump();


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


[llvm-commits] [llvm] r45998 - /llvm/trunk/docs/LangRef.html

2008-01-14 Thread Chris Lattner
Author: lattner
Date: Mon Jan 14 22:34:22 2008
New Revision: 45998

URL: http://llvm.org/viewvc/llvm-project?rev=45998&view=rev
Log:
clarify that byval is valid for any pointer argument.

Modified:
llvm/trunk/docs/LangRef.html

Modified: llvm/trunk/docs/LangRef.html
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=45998&r1=45997&r2=45998&view=diff

==
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Mon Jan 14 22:34:22 2008
@@ -810,11 +810,12 @@
 target-specific
 
 byval
-This indicates that the pointer parameter is really an aggregate that
-was passed by value to the function.  The attribute implies that a hidden
-copy of the struct is made between the caller and the callee, so the
-callee is unable to modify the struct in the callee.  This attribute is 
only
-valid on llvm pointer arguments.
+This indicates that the pointer parameter should really be passed by
+value to the function.  The attribute implies that a hidden copy of the
+pointee is made between the caller and the callee, so the callee is unable
+to modify the value in the callee.  This attribute is only valid on llvm
+pointer arguments.  It is generally used to pass structs and arrays by
+value, but is also valid on scalars (even though this is silly).
 
 sret
 This indicates that the parameter specifies the address of a structure


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


Re: [llvm-commits] Patch for compiling with Mingw/Cygwin

2008-01-14 Thread Alain Frisch
Chris Lattner wrote:
> Okay, this looks really good.  One final question before I commit: why 
> does tblgen want a windows path instead of a unix path?  Can that be 
> fixed in tblgen?  Doesn't this affect llvm-as and all other tools?

When we compile with Mingw/Cygwin, we want to produce plain Win32 
programs and libraries that don't depend on the cygwin DLL to resolve 
filenames, so it is normal that tools such as llvm-as don't accept unix 
paths. This is exactly the same as for the normal Mingw case. The 
difference with Mingw here is that the build system (make), being a 
Cygwin program, works with unix paths, so some translation is needed.

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


[llvm-commits] [llvm] r46001 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h include/llvm/Intrinsics.td lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp li

2008-01-14 Thread Anton Korobeynikov
Author: asl
Date: Tue Jan 15 01:02:33 2008
New Revision: 46001

URL: http://llvm.org/viewvc/llvm-project?rev=46001&view=rev
Log:
For PR1839: add initial support for __builtin_trap. llvm-gcc part is missed
as well as PPC codegen

Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/trunk/include/llvm/Intrinsics.td
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.h
llvm/trunk/lib/Target/X86/X86InstrInfo.td

Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=46001&r1=46000&r2=46001&view=diff

==
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Tue Jan 15 01:02:33 2008
@@ -563,6 +563,9 @@
 // chain as output.
 TRAMPOLINE,
 
+// TRAP - Trapping instruction
+TRAP,
+
 // BUILTIN_OP_END - This must be the last enum value in this list.
 BUILTIN_OP_END
   };

Modified: llvm/trunk/include/llvm/Intrinsics.td
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=46001&r1=46000&r2=46001&view=diff

==
--- llvm/trunk/include/llvm/Intrinsics.td (original)
+++ llvm/trunk/include/llvm/Intrinsics.td Tue Jan 15 01:02:33 2008
@@ -266,6 +266,8 @@
 //
 def int_flt_rounds : Intrinsic<[llvm_i32_ty]>,
  GCCBuiltin<"__builtin_flt_rounds">;
+def int_trap : Intrinsic<[llvm_void_ty]>,
+   GCCBuiltin<"__builtin_trap">;
 
 
//===--===//
 // Target-specific intrinsics

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=46001&r1=46000&r2=46001&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Jan 15 01:02:33 2008
@@ -3734,6 +3734,25 @@
   break;
 }
   }
+   case ISD::TRAP: {
+MVT::ValueType VT = Node->getValueType(0);
+switch (TLI.getOperationAction(Node->getOpcode(), VT)) {
+default: assert(0 && "This action not supported for this op yet!");
+case TargetLowering::Custom:
+  Result = TLI.LowerOperation(Op, DAG);
+  if (Result.Val) break;
+  // Fall Thru
+case TargetLowering::Legal:
+  // If this operation is not supported, lower it to 'abort()' call
+  SDOperand Chain = LegalizeOp(Node->getOperand(0));
+  TargetLowering::ArgListTy Args;
+  std::pair CallResult =
+TLI.LowerCallTo(Chain, Type::VoidTy, false, false, CallingConv::C, 
false,
+DAG.getExternalSymbol("abort", MVT::Other), Args, DAG);
+  Result = CallResult.second;
+  break;
+}
+  }
   }
   
   assert(Result.getValueType() == Op.getValueType() &&

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=46001&r1=46000&r2=46001&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Jan 15 01:02:33 
2008
@@ -3770,7 +3770,8 @@
   case ISD::BUILD_PAIR: return "build_pair";
   case ISD::STACKSAVE:  return "stacksave";
   case ISD::STACKRESTORE:   return "stackrestore";
-
+  case ISD::TRAP:   return "trap";
+
   // Block memory operations.
   case ISD::MEMSET:  return "memset";
   case ISD::MEMCPY:  return "memcpy";

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=46001&r1=46000&r2=46001&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Jan 15 
01:02:33 2008
@@ -2932,6 +2932,11 @@
 setValue(&I, DAG.getNode(ISD::FLT_ROUNDS, MVT::i32));
 return 0;
   }
+
+  case Intrinsic::trap: {
+DAG.setRoot(DAG.getNode(ISD::TRAP, MVT::Other, getRoot()));
+return 0;
+  }
   }
 }
 

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=46001&r1=46000&r2=46001&view=diff

==

[llvm-commits] [llvm] r46003 - /llvm/trunk/include/llvm/CodeGen/CallingConvLower.h

2008-01-14 Thread Evan Cheng
Author: evancheng
Date: Tue Jan 15 01:49:54 2008
New Revision: 46003

URL: http://llvm.org/viewvc/llvm-project?rev=46003&view=rev
Log:
Oops. Forgot to commit this.

Modified:
llvm/trunk/include/llvm/CodeGen/CallingConvLower.h

Modified: llvm/trunk/include/llvm/CodeGen/CallingConvLower.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/CallingConvLower.h?rev=46003&r1=46002&r2=46003&view=diff

==
--- llvm/trunk/include/llvm/CodeGen/CallingConvLower.h (original)
+++ llvm/trunk/include/llvm/CodeGen/CallingConvLower.h Tue Jan 15 01:49:54 2008
@@ -191,9 +191,13 @@
 return Result;
   }
 
-  void HandleStruct(unsigned ValNo, MVT::ValueType ValVT,
-MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,
-unsigned ArgFlags);
+  // HandleByVal - Allocate a stack slot large enough to pass an argument by
+  // value. The size and alignment information of the argument is encoded in 
its
+  // parameter attribute.
+  void HandleByVal(unsigned ValNo, MVT::ValueType ValVT,
+   MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,
+   int MinSize, int MinAlign, unsigned ArgFlags);
+
 private:
   /// MarkAllocated - Mark a register and all of its aliases as allocated.
   void MarkAllocated(unsigned Reg);


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


[llvm-commits] [llvm] r46002 - /llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp

2008-01-14 Thread Evan Cheng
Author: evancheng
Date: Tue Jan 15 01:49:36 2008
New Revision: 46002

URL: http://llvm.org/viewvc/llvm-project?rev=46002&view=rev
Log:
Oops. Forgot to commit this.

Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp?rev=46002&r1=46001&r2=46002&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp Tue Jan 15 
01:49:36 2008
@@ -29,15 +29,22 @@
   UsedRegs.resize(MRI.getNumRegs());
 }
 
-void CCState::HandleStruct(unsigned ValNo, MVT::ValueType ValVT,
-   MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,
-   unsigned ArgFlags) {
-  unsigned MinAlign = TM.getTargetData()->getPointerABIAlignment();
+// HandleByVal - Allocate a stack slot large enough to pass an argument by
+// value. The size and alignment information of the argument is encoded in its
+// parameter attribute.
+void CCState::HandleByVal(unsigned ValNo, MVT::ValueType ValVT,
+  MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,
+  int MinSize, int MinAlign,
+  unsigned ArgFlags) {
   unsigned Align  = 1 << ((ArgFlags & ISD::ParamFlags::ByValAlign) >>
   ISD::ParamFlags::ByValAlignOffs);
   unsigned Size   = (ArgFlags & ISD::ParamFlags::ByValSize) >>
   ISD::ParamFlags::ByValSizeOffs;
-  unsigned Offset = AllocateStack(Size, std::max(MinAlign, Align));
+  if (MinSize > (int)Size)
+Size = MinSize;
+  if (MinAlign > (int)Align)
+Align = MinAlign;
+  unsigned Offset = AllocateStack(Size, Align);
 
   addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
 }


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