From nicholas at mxc.ca Mon Jul 21 00:07:51 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 21 Jul 2008 05:07:51 -0000 Subject: [llvm-commits] [test-suite] r53829 - /test-suite/trunk/MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp Message-ID: <200807210507.m6L57pRZ017908@zion.cs.uiuc.edu> Author: nicholas Date: Mon Jul 21 00:07:50 2008 New Revision: 53829 URL: http://llvm.org/viewvc/llvm-project?rev=53829&view=rev Log: Fix build with GCC 4.3. Modified: test-suite/trunk/MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp Modified: test-suite/trunk/MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp?rev=53829&r1=53828&r2=53829&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp (original) +++ test-suite/trunk/MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp Mon Jul 21 00:07:50 2008 @@ -6,6 +6,7 @@ #include #include #include +#include namespace Smarts { template From nicholas at mxc.ca Mon Jul 21 01:00:58 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 21 Jul 2008 06:00:58 -0000 Subject: [llvm-commits] [test-suite] r53838 - in /test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city: direction.cpp direction.h intersection.cpp intersection.h roadlet.cpp roadlet.h vehicle.h Message-ID: <200807210600.m6L60wa7019590@zion.cs.uiuc.edu> Author: nicholas Date: Mon Jul 21 01:00:57 2008 New Revision: 53838 URL: http://llvm.org/viewvc/llvm-project?rev=53838&view=rev Log: Add missing include. Const correct this code. "foo" is const-qualified. Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/direction.cpp test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/direction.h test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/intersection.cpp test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/intersection.h test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.cpp test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/direction.cpp URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Prolangs-C%2B%2B/city/direction.cpp?rev=53838&r1=53837&r2=53838&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/direction.cpp (original) +++ test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/direction.cpp Mon Jul 21 01:00:57 2008 @@ -2,10 +2,10 @@ #include "direction.h" -char *direction::as_string() +const char *direction::as_string() { - char *dirs[] = { "N", "NE", "E", "SE", "S", "SW", "W", "NW", - "No direction"}; + const char *dirs[] = { "N", "NE", "E", "SE", "S", "SW", "W", "NW", + "No direction"}; return(dirs[dir]); } int operator== (direction d1, direction d2) Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/direction.h URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Prolangs-C%2B%2B/city/direction.h?rev=53838&r1=53837&r2=53838&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/direction.h (original) +++ test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/direction.h Mon Jul 21 01:00:57 2008 @@ -15,7 +15,7 @@ direction(int i) {dir = i % 9;}; int as_int() {return (dir);}; - char *as_string(); + const char *as_string(); direction right_front() {return(direction((dir + 1) % 8));}; direction right() {return(direction((dir + 2) % 8));}; direction right_back() {return(direction((dir + 3) % 8));}; Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/intersection.cpp URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Prolangs-C%2B%2B/city/intersection.cpp?rev=53838&r1=53837&r2=53838&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/intersection.cpp (original) +++ test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/intersection.cpp Mon Jul 21 01:00:57 2008 @@ -2,7 +2,7 @@ #include "intersection.h" #include - +#include void intersection_4x4::connectNin (roadlet *leftlane, roadlet *rightlane) { @@ -50,7 +50,7 @@ } -intersection_4x4::intersection_4x4(char *name) +intersection_4x4::intersection_4x4(const char *name) { char *buff; Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/intersection.h URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Prolangs-C%2B%2B/city/intersection.h?rev=53838&r1=53837&r2=53838&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/intersection.h (original) +++ test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/intersection.h Mon Jul 21 01:00:57 2008 @@ -36,7 +36,7 @@ roadlet *roadlets[4][4]; public: - intersection_4x4(char *name); + intersection_4x4(const char *name); void connectSin(roadlet*, roadlet*) ; void connectNout(roadlet*, roadlet*); void connectNin(roadlet*, roadlet*); Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.cpp URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Prolangs-C%2B%2B/city/roadlet.cpp?rev=53838&r1=53837&r2=53838&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.cpp (original) +++ test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.cpp Mon Jul 21 01:00:57 2008 @@ -3,7 +3,7 @@ #include #include "roadlet.h" -void roadlet::init(char *n) +void roadlet::init(const char *n) { occupant = 0; neighbors[0] = neighbors[1] = neighbors[2] = neighbors[3] = 0; Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Prolangs-C%2B%2B/city/roadlet.h?rev=53838&r1=53837&r2=53838&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h (original) +++ test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/roadlet.h Mon Jul 21 01:00:57 2008 @@ -15,10 +15,10 @@ class roadlet { private: - void init(char *n); + void init(const char *n); protected: - char *name; + const char *name; vehicle *occupant; roadlet *neighbors[8]; move_function the_moves[8]; @@ -27,7 +27,7 @@ roadlet() { init("unnamed"); }; - roadlet(char *n) { + roadlet(const char *n) { init(n); }; int occupied() { return(occupiedby() != NULL);}; @@ -52,7 +52,7 @@ light *l; public: - intersection_roadlet(char *name, light *alight) : roadlet(name) {l = alight;} ; + intersection_roadlet(const char *name, light *alight) : roadlet(name) {l = alight;} ; light *get_light() { return(l);}; }; Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Prolangs-C%2B%2B/city/vehicle.h?rev=53838&r1=53837&r2=53838&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h (original) +++ test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/city/vehicle.h Mon Jul 21 01:00:57 2008 @@ -10,10 +10,10 @@ private: enum { DEFAULT_SPEED = 100 }; roadlet *location; - char *name; + const char *name; int speed; int move_points; // move units accumulated towards moving - void init(roadlet *l, char *n, int s) + void init(roadlet *l, const char *n, int s) {plan=-1,location=l, name=n, speed=s, move_points=0, dir = N;}; protected: @@ -23,7 +23,7 @@ public: vehicle() {init(NULL, NULL, DEFAULT_SPEED);}; - vehicle(char *n) {init(NULL, n, DEFAULT_SPEED);}; + vehicle(const char *n) {init(NULL, n, DEFAULT_SPEED);}; vehicle(roadlet *r, char *n) {init(r, n, DEFAULT_SPEED);}; vehicle(roadlet *r, char *n, int s) {init(r, n, s);}; // others include: r, s, rs, sr, .... @@ -42,7 +42,7 @@ { public: car() : vehicle() { }; - car(char *n) : vehicle(n) { }; + car(const char *n) : vehicle(n) { }; friend ostream& operator<< (ostream&, car); }; From nicholas at mxc.ca Mon Jul 21 01:02:06 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 21 Jul 2008 06:02:06 -0000 Subject: [llvm-commits] [test-suite] r53839 - /test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/employ/employee.h Message-ID: <200807210602.m6L626A1019633@zion.cs.uiuc.edu> Author: nicholas Date: Mon Jul 21 01:02:06 2008 New Revision: 53839 URL: http://llvm.org/viewvc/llvm-project?rev=53839&view=rev Log: Add needed for strcpy under gcc 4.3. Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/employ/employee.h Modified: test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/employ/employee.h URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/Prolangs-C%2B%2B/employ/employee.h?rev=53839&r1=53838&r2=53839&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/employ/employee.h (original) +++ test-suite/trunk/MultiSource/Benchmarks/Prolangs-C++/employ/employee.h Mon Jul 21 01:02:06 2008 @@ -36,6 +36,7 @@ #ifndef _EMPLOYEE_H #define _EMPLOYEE_H +#include #include #include using namespace std; From nicholas at mxc.ca Mon Jul 21 01:03:44 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 21 Jul 2008 06:03:44 -0000 Subject: [llvm-commits] [test-suite] r53840 - /test-suite/trunk/SingleSource/Benchmarks/Shootout-C++/lists1.cpp Message-ID: <200807210603.m6L63i6H019683@zion.cs.uiuc.edu> Author: nicholas Date: Mon Jul 21 01:03:44 2008 New Revision: 53840 URL: http://llvm.org/viewvc/llvm-project?rev=53840&view=rev Log: Add header for std::find. Modified: test-suite/trunk/SingleSource/Benchmarks/Shootout-C++/lists1.cpp Modified: test-suite/trunk/SingleSource/Benchmarks/Shootout-C++/lists1.cpp URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Shootout-C%2B%2B/lists1.cpp?rev=53840&r1=53839&r2=53840&view=diff ============================================================================== --- test-suite/trunk/SingleSource/Benchmarks/Shootout-C++/lists1.cpp (original) +++ test-suite/trunk/SingleSource/Benchmarks/Shootout-C++/lists1.cpp Mon Jul 21 01:03:44 2008 @@ -2,6 +2,7 @@ // $Id$ // http://www.bagley.org/~doug/shootout/ +#include #include #include #include From evan.cheng at apple.com Mon Jul 21 01:34:18 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Jul 2008 06:34:18 -0000 Subject: [llvm-commits] [llvm] r53844 - /llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Message-ID: <200807210634.m6L6YIZT020542@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jul 21 01:34:17 2008 New Revision: 53844 URL: http://llvm.org/viewvc/llvm-project?rev=53844&view=rev Log: Use movaps instead of movups to spill 16-byte vector values when default alignment is >= 16. This fixes some massive performance regressions. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=53844&r1=53843&r2=53844&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Jul 21 01:34:17 2008 @@ -1739,7 +1739,9 @@ unsigned SrcReg, bool isKill, int FrameIdx, const TargetRegisterClass *RC) const { const MachineFunction &MF = *MBB.getParent(); - unsigned Opc = getStoreRegOpcode(RC, RI.needsStackRealignment(MF)); + bool isAligned = (RI.getStackAlignment() >= 16) || + RI.needsStackRealignment(MF); + unsigned Opc = getStoreRegOpcode(RC, isAligned); addFrameReference(BuildMI(MBB, MI, get(Opc)), FrameIdx) .addReg(SrcReg, false, false, isKill); } @@ -1749,7 +1751,9 @@ SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { - unsigned Opc = getStoreRegOpcode(RC, RI.needsStackRealignment(MF)); + bool isAligned = (RI.getStackAlignment() >= 16) || + RI.needsStackRealignment(MF); + unsigned Opc = getStoreRegOpcode(RC, isAligned); MachineInstrBuilder MIB = BuildMI(MF, get(Opc)); for (unsigned i = 0, e = Addr.size(); i != e; ++i) MIB = X86InstrAddOperand(MIB, Addr[i]); @@ -1800,7 +1804,9 @@ unsigned DestReg, int FrameIdx, const TargetRegisterClass *RC) const{ const MachineFunction &MF = *MBB.getParent(); - unsigned Opc = getLoadRegOpcode(RC, RI.needsStackRealignment(MF)); + bool isAligned = (RI.getStackAlignment() >= 16) || + RI.needsStackRealignment(MF); + unsigned Opc = getLoadRegOpcode(RC, isAligned); addFrameReference(BuildMI(MBB, MI, get(Opc), DestReg), FrameIdx); } @@ -1808,7 +1814,9 @@ SmallVectorImpl &Addr, const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { - unsigned Opc = getLoadRegOpcode(RC, RI.needsStackRealignment(MF)); + bool isAligned = (RI.getStackAlignment() >= 16) || + RI.needsStackRealignment(MF); + unsigned Opc = getLoadRegOpcode(RC, isAligned); MachineInstrBuilder MIB = BuildMI(MF, get(Opc), DestReg); for (unsigned i = 0, e = Addr.size(); i != e; ++i) MIB = X86InstrAddOperand(MIB, Addr[i]); @@ -2275,7 +2283,9 @@ const MachineFunction &MF = DAG.getMachineFunction(); if (FoldedLoad) { MVT VT = *RC->vt_begin(); - Load = DAG.getTargetNode(getLoadRegOpcode(RC, RI.needsStackRealignment(MF)), + bool isAligned = (RI.getStackAlignment() >= 16) || + RI.needsStackRealignment(MF); + Load = DAG.getTargetNode(getLoadRegOpcode(RC, isAligned), VT, MVT::Other, &AddrOps[0], AddrOps.size()); NewNodes.push_back(Load); @@ -2306,10 +2316,10 @@ AddrOps.pop_back(); AddrOps.push_back(SDOperand(NewNode, 0)); AddrOps.push_back(Chain); - SDNode *Store = - DAG.getTargetNode(getStoreRegOpcode(DstRC, - RI.needsStackRealignment(MF)), - MVT::Other, &AddrOps[0], AddrOps.size()); + bool isAligned = (RI.getStackAlignment() >= 16) || + RI.needsStackRealignment(MF); + SDNode *Store = DAG.getTargetNode(getStoreRegOpcode(DstRC, isAligned), + MVT::Other, &AddrOps[0], AddrOps.size()); NewNodes.push_back(Store); } From tonic at nondot.org Mon Jul 21 02:03:33 2008 From: tonic at nondot.org (Tanya Lattner) Date: Mon, 21 Jul 2008 02:03:33 -0500 Subject: [llvm-commits] CVS: llvm-www/devmtg/register.php Message-ID: <200807210703.m6L73XuT021537@zion.cs.uiuc.edu> Changes in directory llvm-www/devmtg: register.php updated: 1.4 -> 1.5 --- Log message: Registration is closed. --- Diffs of the changes: (+2 -1) register.php | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm-www/devmtg/register.php diff -u llvm-www/devmtg/register.php:1.4 llvm-www/devmtg/register.php:1.5 --- llvm-www/devmtg/register.php:1.4 Sun May 25 02:28:33 2008 +++ llvm-www/devmtg/register.php Mon Jul 21 02:01:32 2008 @@ -194,8 +194,9 @@ ?>
LLVM Developers' Meeting - Registration
- +

Registration is now closed.

Changes in directory llvm-www/devmtg: index.php updated: 1.16 -> 1.17 --- Log message: Registration is closed. --- Diffs of the changes: (+1 -1) index.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/devmtg/index.php diff -u llvm-www/devmtg/index.php:1.16 llvm-www/devmtg/index.php:1.17 --- llvm-www/devmtg/index.php:1.16 Fri Jul 18 16:02:08 2008 +++ llvm-www/devmtg/index.php Mon Jul 21 02:02:48 2008 @@ -60,7 +60,7 @@
Registration
-

Register NOW! (Registration deadline is July 20, 2008)

+

Registration is closed!! (Registration deadline is July 20, 2008)

Attendance is free and open to everyone, but we ask that everyone planning on attending to register so that we get a rough From nicholas at mxc.ca Mon Jul 21 02:10:53 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 21 Jul 2008 07:10:53 -0000 Subject: [llvm-commits] [test-suite] r53847 - /test-suite/trunk/RunSafely.sh Message-ID: <200807210710.m6L7ArN6021784@zion.cs.uiuc.edu> Author: nicholas Date: Mon Jul 21 02:10:53 2008 New Revision: 53847 URL: http://llvm.org/viewvc/llvm-project?rev=53847&view=rev Log: Raise the virtual memory limit by 50MB to 250MB. This allows Obsequi to pass on my Linux box. (225MB is not enough for JIT, 200MB fails both JIT and LLC). Modified: test-suite/trunk/RunSafely.sh Modified: test-suite/trunk/RunSafely.sh URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/RunSafely.sh?rev=53847&r1=53846&r2=53847&view=diff ============================================================================== --- test-suite/trunk/RunSafely.sh (original) +++ test-suite/trunk/RunSafely.sh Mon Jul 21 02:10:53 2008 @@ -82,8 +82,8 @@ # of files being output by the tests. 10 MB should be enough for anybody. ;) ULIMITCMD="$ULIMITCMD ulimit -f 10485760;" - # virtual memory: 200 MB should be enough for anybody. ;) - ULIMITCMD="$ULIMITCMD ulimit -v 200000;" + # virtual memory: 250 MB should be enough for anybody. ;) + ULIMITCMD="$ULIMITCMD ulimit -v 250000;" esac rm -f core core.* From baldrick at free.fr Mon Jul 21 02:13:12 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Jul 2008 09:13:12 +0200 Subject: [llvm-commits] [llvm] r53816 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp In-Reply-To: <200807210403.m6L4318d015924@zion.cs.uiuc.edu> References: <200807210403.m6L4318d015924@zion.cs.uiuc.edu> Message-ID: <200807210913.12624.baldrick@free.fr> > Revert r53812 -- premature. LegalizeTypes isn't actually on yet! It was turned on for a while, but I turned it off again because it broke darwin bootstrap (I don't know if it still is). Ciao, Duncan. From baldrick at free.fr Mon Jul 21 05:20:32 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 21 Jul 2008 10:20:32 -0000 Subject: [llvm-commits] [llvm] r53850 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp Message-ID: <200807211020.m6LAKXq7006765@zion.cs.uiuc.edu> Author: baldrick Date: Mon Jul 21 05:20:31 2008 New Revision: 53850 URL: http://llvm.org/viewvc/llvm-project?rev=53850&view=rev Log: Add VerifyNode, a place to put sanity checks on generic SDNode's (nodes with their own constructors should do sanity checking in the constructor). Add sanity checks for BUILD_VECTOR and fix all the places that were producing bogus BUILD_VECTORs, as found by "make check". My favorite is the BUILD_VECTOR with only two operands that was being used to build a vector with four elements! Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=53850&r1=53849&r2=53850&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Jul 21 05:20:31 2008 @@ -64,6 +64,9 @@ /// SelectionDAG. BumpPtrAllocator Allocator; + /// VerifyNode - Sanity check the given node. Aborts if it is invalid. + void VerifyNode(SDNode *N); + public: SelectionDAG(TargetLowering &tli, MachineFunction &mf, FunctionLoweringInfo &fli, MachineModuleInfo *mmi, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=53850&r1=53849&r2=53850&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Jul 21 05:20:31 2008 @@ -5011,7 +5011,8 @@ } else { unsigned NewIdx = cast(ShufMask.getOperand(i))->getValue() - NumElts; - MappedOps.push_back(DAG.getConstant(NewIdx, MVT::i32)); + MappedOps.push_back(DAG.getConstant(NewIdx, + ShufMask.getOperand(i).getValueType())); } } ShufMask = DAG.getNode(ISD::BUILD_VECTOR, ShufMask.getValueType(), Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=53850&r1=53849&r2=53850&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Jul 21 05:20:31 2008 @@ -186,7 +186,7 @@ /// scalar (e.g. f32) value. SDOperand ScalarizeVectorOp(SDOperand O); - /// isShuffleLegal - Return true if a vector shuffle is legal with the + /// isShuffleLegal - Return non-null if a vector shuffle is legal with the /// specified mask and type. Targets can specify exactly which masks they /// support and the code generator is tasked with not creating illegal masks. /// @@ -241,6 +241,7 @@ // If this is promoted to a different type, convert the shuffle mask and // ask if it is legal in the promoted type! MVT NVT = TLI.getTypeToPromoteTo(ISD::VECTOR_SHUFFLE, VT); + MVT EltVT = NVT.getVectorElementType(); // If we changed # elements, change the shuffle mask. unsigned NumEltsGrowth = @@ -253,10 +254,10 @@ SDOperand InOp = Mask.getOperand(i); for (unsigned j = 0; j != NumEltsGrowth; ++j) { if (InOp.getOpcode() == ISD::UNDEF) - Ops.push_back(DAG.getNode(ISD::UNDEF, MVT::i32)); + Ops.push_back(DAG.getNode(ISD::UNDEF, EltVT)); else { unsigned InEltNo = cast(InOp)->getValue(); - Ops.push_back(DAG.getConstant(InEltNo*NumEltsGrowth+j, MVT::i32)); + Ops.push_back(DAG.getConstant(InEltNo*NumEltsGrowth+j, EltVT)); } } } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=53850&r1=53849&r2=53850&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jul 21 05:20:31 2008 @@ -740,6 +740,25 @@ return CSEMap.FindNodeOrInsertPos(ID, InsertPos); } +/// VerifyNode - Sanity check the given node. Aborts if it is invalid. +void SelectionDAG::VerifyNode(SDNode *N) { + switch (N->getOpcode()) { + default: + break; + case ISD::BUILD_VECTOR: { + assert(N->getNumValues() == 1 && "Too many results for BUILD_VECTOR!"); + assert(N->getValueType(0).isVector() && "Wrong BUILD_VECTOR return type!"); + assert(N->getNumOperands() == N->getValueType(0).getVectorNumElements() && + "Wrong number of BUILD_VECTOR operands!"); + MVT EltVT = N->getValueType(0).getVectorElementType(); + for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I) + assert(I->getSDOperand().getValueType() == EltVT && + "Wrong BUILD_VECTOR operand type!"); + break; + } + } +} + /// getMVTAlignment - Compute the default alignment value for the /// given type. /// @@ -1965,6 +1984,9 @@ CSEMap.InsertNode(N, IP); AllNodes.push_back(N); +#ifndef NDEBUG + VerifyNode(N); +#endif return SDOperand(N, 0); } @@ -2161,12 +2183,14 @@ N = getAllocator().Allocate(); new (N) UnarySDNode(Opcode, VTs, Operand); } + AllNodes.push_back(N); +#ifndef NDEBUG + VerifyNode(N); +#endif return SDOperand(N, 0); } - - SDOperand SelectionDAG::getNode(unsigned Opcode, MVT VT, SDOperand N1, SDOperand N2) { ConstantSDNode *N1C = dyn_cast(N1.Val); @@ -2515,6 +2539,9 @@ } AllNodes.push_back(N); +#ifndef NDEBUG + VerifyNode(N); +#endif return SDOperand(N, 0); } @@ -2580,6 +2607,9 @@ new (N) TernarySDNode(Opcode, VTs, N1, N2, N3); } AllNodes.push_back(N); +#ifndef NDEBUG + VerifyNode(N); +#endif return SDOperand(N, 0); } @@ -3394,6 +3424,9 @@ new (N) SDNode(Opcode, VTs, Ops, NumOps); } AllNodes.push_back(N); +#ifndef NDEBUG + VerifyNode(N); +#endif return SDOperand(N, 0); } @@ -3478,6 +3511,9 @@ } } AllNodes.push_back(N); +#ifndef NDEBUG + VerifyNode(N); +#endif return SDOperand(N, 0); } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=53850&r1=53849&r2=53850&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Jul 21 05:20:31 2008 @@ -3281,10 +3281,10 @@ // Force LHS/RHS to be the right type. LHS = DAG.getNode(ISD::BIT_CONVERT, MVT::v16i8, LHS); RHS = DAG.getNode(ISD::BIT_CONVERT, MVT::v16i8, RHS); - + SDOperand Ops[16]; for (unsigned i = 0; i != 16; ++i) - Ops[i] = DAG.getConstant(i+Amt, MVT::i32); + Ops[i] = DAG.getConstant(i+Amt, MVT::i8); SDOperand T = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v16i8, LHS, RHS, DAG.getNode(ISD::BUILD_VECTOR, MVT::v16i8, Ops,16)); return DAG.getNode(ISD::BIT_CONVERT, VT, T); @@ -3529,7 +3529,7 @@ } SDOperand Ops[16]; for (unsigned i = 0; i != 16; ++i) - Ops[i] = DAG.getConstant(ShufIdxs[i], MVT::i32); + Ops[i] = DAG.getConstant(ShufIdxs[i], MVT::i8); return DAG.getNode(ISD::VECTOR_SHUFFLE, OpLHS.getValueType(), OpLHS, OpRHS, DAG.getNode(ISD::BUILD_VECTOR, MVT::v16i8, Ops, 16)); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=53850&r1=53849&r2=53850&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jul 21 05:20:31 2008 @@ -3569,6 +3569,7 @@ unsigned NumElems = PermMask.getNumOperands(); unsigned NewWidth = (NumElems == 4) ? 2 : 4; MVT MaskVT = MVT::getIntVectorWithNumElements(NewWidth); + MVT MaskEltVT = MaskVT.getVectorElementType(); MVT NewVT = MaskVT; switch (VT.getSimpleVT()) { default: assert(false && "Unexpected!"); @@ -3599,9 +3600,9 @@ return SDOperand(); } if (StartIdx == ~0U) - MaskVec.push_back(DAG.getNode(ISD::UNDEF, MVT::i32)); + MaskVec.push_back(DAG.getNode(ISD::UNDEF, MaskEltVT)); else - MaskVec.push_back(DAG.getConstant(StartIdx / Scale, MVT::i32)); + MaskVec.push_back(DAG.getConstant(StartIdx / Scale, MaskEltVT)); } V1 = DAG.getNode(ISD::BIT_CONVERT, NewVT, V1); @@ -4054,7 +4055,7 @@ // UNPCKHPD the element to the lowest double word, then movsd. // Note if the lower 64 bits of the result of the UNPCKHPD is then stored // to a f64mem, the whole operation is folded into a single MOVHPDmr. - MVT MaskVT = MVT::getIntVectorWithNumElements(4); + MVT MaskVT = MVT::getIntVectorWithNumElements(2); SmallVector IdxVec; IdxVec.push_back(DAG.getConstant(1, MaskVT.getVectorElementType())); IdxVec. From kremenek at apple.com Mon Jul 21 12:28:16 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 21 Jul 2008 17:28:16 -0000 Subject: [llvm-commits] [llvm] r53853 - /llvm/tags/checker/checker-65/ Message-ID: <200807211728.m6LHSGdH020994@zion.cs.uiuc.edu> Author: kremenek Date: Mon Jul 21 12:28:16 2008 New Revision: 53853 URL: http://llvm.org/viewvc/llvm-project?rev=53853&view=rev Log: Tagging checker-65. Added: llvm/tags/checker/checker-65/ - copied from r53852, llvm/trunk/ From asl at math.spbu.ru Mon Jul 21 13:25:17 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 21 Jul 2008 18:25:17 -0000 Subject: [llvm-commits] [llvm] r53857 - /llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Message-ID: <200807211825.m6LIPHpb022944@zion.cs.uiuc.edu> Author: asl Date: Mon Jul 21 13:25:17 2008 New Revision: 53857 URL: http://llvm.org/viewvc/llvm-project?rev=53857&view=rev Log: Don't use larger alignment. Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=53857&r1=53856&r2=53857&view=diff ============================================================================== --- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Jul 21 13:25:17 2008 @@ -118,7 +118,7 @@ if (Size <= 16) { // We also need alignment here const TargetData *TD = ETM->getTargetData(); - unsigned Align = TD->getPreferredAlignment(GV); + unsigned Align = TD->getPrefTypeAlignment(Type); if (Align < Size) Align = Size; From asl at math.spbu.ru Mon Jul 21 13:29:23 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 21 Jul 2008 18:29:23 -0000 Subject: [llvm-commits] [llvm] r53859 - /llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Message-ID: <200807211829.m6LITNu8023172@zion.cs.uiuc.edu> Author: asl Date: Mon Jul 21 13:29:23 2008 New Revision: 53859 URL: http://llvm.org/viewvc/llvm-project?rev=53859&view=rev Log: Use better variable names Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=53859&r1=53858&r2=53859&view=diff ============================================================================== --- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Jul 21 13:29:23 2008 @@ -112,13 +112,13 @@ const TargetData *TD = ETM->getTargetData(); Constant *C = cast(GV)->getInitializer(); const ConstantArray *CVA = cast(C); - const Type *Type = CVA->getType()->getElementType(); + const Type *Ty = CVA->getType()->getElementType(); - unsigned Size = TD->getABITypeSize(Type); + unsigned Size = TD->getABITypeSize(Ty); if (Size <= 16) { // We also need alignment here const TargetData *TD = ETM->getTargetData(); - unsigned Align = TD->getPrefTypeAlignment(Type); + unsigned Align = TD->getPrefTypeAlignment(Ty); if (Align < Size) Align = Size; From isanbard at gmail.com Mon Jul 21 13:33:09 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Jul 2008 18:33:09 -0000 Subject: [llvm-commits] [llvm] r53860 - /llvm/trunk/utils/buildit/build_llvm Message-ID: <200807211833.m6LIX9nZ023291@zion.cs.uiuc.edu> Author: void Date: Mon Jul 21 13:33:09 2008 New Revision: 53860 URL: http://llvm.org/viewvc/llvm-project?rev=53860&view=rev Log: Temporary hack to build with GCC 4.0 instead of 4.2. Modified: llvm/trunk/utils/buildit/build_llvm Modified: llvm/trunk/utils/buildit/build_llvm URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/buildit/build_llvm?rev=53860&r1=53859&r2=53860&view=diff ============================================================================== --- llvm/trunk/utils/buildit/build_llvm (original) +++ llvm/trunk/utils/buildit/build_llvm Mon Jul 21 13:33:09 2008 @@ -138,7 +138,8 @@ make $JOBS_FLAG $OPTIMIZE_OPTS UNIVERSAL=1 UNIVERSAL_ARCH="$TARGETS" \ LLVM_SUBMIT_VERSION=$LLVM_SUBMIT_VERSION \ LLVM_SUBMIT_SUBVERSION=$LLVM_SUBMIT_SUBVERSION \ - CXXFLAGS="-DLLVM_VERSION_INFO='\" Apple Build #$LLVM_VERSION\"'" + CXXFLAGS="-DLLVM_VERSION_INFO='\" Apple Build #$LLVM_VERSION\"'" \ + CC=/usr/bin/gcc-4.0 CXX=/usr/bin/g++-4.0 if ! test $? == 0 ; then echo "error: LLVM 'make' failed!" From isanbard at gmail.com Mon Jul 21 13:33:35 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Jul 2008 18:33:35 -0000 Subject: [llvm-commits] [llvm] r53861 - /llvm/tags/Apple/llvmCore-2057/ Message-ID: <200807211833.m6LIXZcb023313@zion.cs.uiuc.edu> Author: void Date: Mon Jul 21 13:33:34 2008 New Revision: 53861 URL: http://llvm.org/viewvc/llvm-project?rev=53861&view=rev Log: Creating llvmCore-2057 branch Added: llvm/tags/Apple/llvmCore-2057/ - copied from r53860, llvm/trunk/ From isanbard at gmail.com Mon Jul 21 13:33:41 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 21 Jul 2008 18:33:41 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53862 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2057/ Message-ID: <200807211833.m6LIXfbs023326@zion.cs.uiuc.edu> Author: void Date: Mon Jul 21 13:33:41 2008 New Revision: 53862 URL: http://llvm.org/viewvc/llvm-project?rev=53862&view=rev Log: Creating llvmgcc42-2057 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2057/ - copied from r53861, llvm-gcc-4.2/trunk/ From dpatel at apple.com Mon Jul 21 13:35:40 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 21 Jul 2008 11:35:40 -0700 Subject: [llvm-commits] [llvm] r53810 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp lib/Support/APInt.cpp test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll test/Analysis/ScalarEvolution/2008-07-19-InfiniteLoop.ll test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll In-Reply-To: <200807201555.m6KFtFoR025101@zion.cs.uiuc.edu> References: <200807201555.m6KFtFoR025101@zion.cs.uiuc.edu> Message-ID: <76CA4247-D449-4810-A111-64B70583C687@apple.com> On Jul 20, 2008, at 8:55 AM, Wojciech Matyjewicz wrote: > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) > +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun Jul 20 10:55:14 > 2008 > @@ -78,6 +78,8 @@ > #include "llvm/Support/MathExtras.h" > #include "llvm/Support/Streams.h" > #include "llvm/ADT/Statistic.h" > +//TMP: ?? > > +#include "llvm/Support/Debug.h" > #include > #include > #include From gohman at apple.com Mon Jul 21 13:47:29 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Jul 2008 18:47:29 -0000 Subject: [llvm-commits] [llvm] r53868 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp Message-ID: <200807211847.m6LIlUoi023862@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 13:47:29 2008 New Revision: 53868 URL: http://llvm.org/viewvc/llvm-project?rev=53868&view=rev Log: Now that the MachineInstr leaks are fixed, enable leak checking in the MachineInstr clone code. Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=53868&r1=53867&r2=53868&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Mon Jul 21 13:47:29 2008 @@ -328,6 +328,8 @@ // Set parent to null. Parent = 0; + + LeakDetector::addGarbageObject(this); } MachineInstr::~MachineInstr() { From bruno.cardoso at gmail.com Mon Jul 21 13:52:34 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 21 Jul 2008 18:52:34 -0000 Subject: [llvm-commits] [llvm] r53869 - in /llvm/trunk/lib/Target/Mips: MipsAsmPrinter.cpp MipsISelLowering.cpp MipsISelLowering.h MipsInstrInfo.td MipsSubtarget.cpp MipsSubtarget.h MipsTargetAsmInfo.cpp Message-ID: <200807211852.m6LIqYR5024100@zion.cs.uiuc.edu> Author: bruno Date: Mon Jul 21 13:52:34 2008 New Revision: 53869 URL: http://llvm.org/viewvc/llvm-project?rev=53869&view=rev Log: Added initial support for small sections on Mips. Added gp_rel relocations to support addressing small section contents. Added command line to specify small section threshold in bytes. Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.h llvm/trunk/lib/Target/Mips/MipsInstrInfo.td llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp llvm/trunk/lib/Target/Mips/MipsSubtarget.h llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=53869&r1=53868&r2=53869&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Mon Jul 21 13:52:34 2008 @@ -360,7 +360,11 @@ closeP = true; } else if ((MI->getOpcode() == Mips::ADDiu) && !MO.isRegister() && !MO.isImmediate()) { - O << "%lo("; + const MachineOperand &firstMO = MI->getOperand(opNum-1); + if (firstMO.getReg() == Mips::GP) + O << "%gp_rel("; + else + O << "%lo("; closeP = true; } else if ((isPIC) && (MI->getOpcode() == Mips::LW) && (!MO.isRegister()) && (!MO.isImmediate())) { @@ -490,14 +494,13 @@ Constant *C = GVar->getInitializer(); const Type *CTy = C->getType(); unsigned Size = TD->getABITypeSize(CTy); + const ConstantArray *CVA = dyn_cast(C); bool printSizeAndType = true; // A data structure or array is aligned in memory to the largest // alignment boundary required by any data type inside it (this matches // the Preferred Type Alignment). For integral types, the alignment is // the type size. - //unsigned Align = TD->getPreferredAlignmentLog(I); - //unsigned Align = TD->getPrefTypeAlignment(C->getType()); unsigned Align; if (CTy->getTypeID() == Type::IntegerTyID || CTy->getTypeID() == Type::VoidTyID) { @@ -546,6 +549,8 @@ O << TAI->getGlobalDirective() << name << '\n'; // Fall Through case GlobalValue::InternalLinkage: + if (CVA && CVA->isCString()) + printSizeAndType = false; break; case GlobalValue::GhostLinkage: cerr << "Should not have any unmaterialized functions!\n"; Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=53869&r1=53868&r2=53869&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Mon Jul 21 13:52:34 2008 @@ -20,6 +20,7 @@ #include "MipsSubtarget.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" +#include "llvm/GlobalVariable.h" #include "llvm/Intrinsics.h" #include "llvm/CallingConv.h" #include "llvm/CodeGen/CallingConvLower.h" @@ -43,6 +44,7 @@ case MipsISD::JmpLink : return "MipsISD::JmpLink"; case MipsISD::Hi : return "MipsISD::Hi"; case MipsISD::Lo : return "MipsISD::Lo"; + case MipsISD::GPRel : return "MipsISD::GPRel"; case MipsISD::Ret : return "MipsISD::Ret"; case MipsISD::SelectCC : return "MipsISD::SelectCC"; case MipsISD::FPBrcond : return "MipsISD::FPBrcond"; @@ -89,8 +91,6 @@ setOperationAction(ISD::SELECT_CC, MVT::f32, Custom); // Operations not directly supported by Mips. - setConvertAction(MVT::f64, MVT::f32, Expand); - setOperationAction(ISD::BR_JT, MVT::Other, Expand); setOperationAction(ISD::BR_CC, MVT::Other, Expand); setOperationAction(ISD::SELECT_CC, MVT::Other, Expand); @@ -234,34 +234,71 @@ return VReg; } +// Discover if this global address can be placed into small data/bss section. +// This should happen for globals with size less than small section size +// threshold in no abicall environments. Data in this section must be addressed +// using gp_rel operator. +bool MipsTargetLowering::IsGlobalInSmallSection(GlobalValue *GV) +{ + const TargetData *TD = getTargetData(); + const Value *V = dyn_cast(GV); + const GlobalVariable *GVA = dyn_cast(V); + + //const PointerType *PTy = GV->getType(); + const Type *Ty = GV->getType()->getElementType(); + unsigned Size = TD->getABITypeSize(Ty); + + // if this is a internal constant string, there is a special + // section for it, but not in small data/bss. + if (GVA->hasInitializer() && GV->hasInternalLinkage()) { + Constant *C = GVA->getInitializer(); + const ConstantArray *CVA = dyn_cast(C); + if (CVA && CVA->isCString()) + return false; + } + + if (Size > 0 && (Size <= Subtarget->getSSectionThreshold())) + return true; + + return false; +} + //===----------------------------------------------------------------------===// // Misc Lower Operation implementation //===----------------------------------------------------------------------===// SDOperand MipsTargetLowering:: LowerGlobalAddress(SDOperand Op, SelectionDAG &DAG) { - SDOperand ResNode; GlobalValue *GV = cast(Op)->getGlobal(); SDOperand GA = DAG.getTargetGlobalAddress(GV, MVT::i32); - bool isPIC = (getTargetMachine().getRelocationModel() == Reloc::PIC_); - SDOperand HiPart; - if (!isPIC) { + if (!Subtarget->hasABICall()) { + if (isa(GV)) return GA; const MVT *VTs = DAG.getNodeValueTypes(MVT::i32); SDOperand Ops[] = { GA }; - HiPart = DAG.getNode(MipsISD::Hi, VTs, 1, Ops, 1); - } else // Emit Load from Global Pointer - HiPart = DAG.getLoad(MVT::i32, DAG.getEntryNode(), GA, NULL, 0); - - // On functions and global targets not internal linked only - // a load from got/GP is necessary for PIC to work. - if ((isPIC) && ((!GV->hasInternalLinkage()) || (isa(GV)))) - return HiPart; - SDOperand Lo = DAG.getNode(MipsISD::Lo, MVT::i32, GA); - ResNode = DAG.getNode(ISD::ADD, MVT::i32, HiPart, Lo); + if (IsGlobalInSmallSection(GV)) { // %gp_rel relocation + SDOperand GPRelNode = DAG.getNode(MipsISD::GPRel, VTs, 1, Ops, 1); + SDOperand GOT = DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, MVT::i32); + return DAG.getNode(ISD::ADD, MVT::i32, GOT, GPRelNode); + } + // %hi/%lo relocation + SDOperand HiPart = DAG.getNode(MipsISD::Hi, VTs, 1, Ops, 1); + SDOperand Lo = DAG.getNode(MipsISD::Lo, MVT::i32, GA); + return DAG.getNode(ISD::ADD, MVT::i32, HiPart, Lo); + + } else { // Abicall relocations, TODO: make this cleaner. + SDOperand ResNode = DAG.getLoad(MVT::i32, DAG.getEntryNode(), GA, NULL, 0); + // On functions and global targets not internal linked only + // a load from got/GP is necessary for PIC to work. + if (!GV->hasInternalLinkage() || isa(GV)) + return ResNode; + SDOperand Lo = DAG.getNode(MipsISD::Lo, MVT::i32, GA); + return DAG.getNode(ISD::ADD, MVT::i32, ResNode, Lo); + } - return ResNode; + assert(0 && "Dont know how to handle GlobalAddress"); + return SDOperand(0,0); } SDOperand MipsTargetLowering:: @@ -596,9 +633,8 @@ unsigned StackReg = MF.getTarget().getRegisterInfo()->getFrameRegister(MF); - // GP holds the GOT address on PIC calls. - if (getTargetMachine().getRelocationModel() == Reloc::PIC_) - AddLiveIn(MF, Mips::GP, Mips::CPURegsRegisterClass); + // GP must be live into PIC and non-PIC call target. + AddLiveIn(MF, Mips::GP, Mips::CPURegsRegisterClass); // Assign locations to all of the incoming arguments. SmallVector ArgLocs; Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=53869&r1=53868&r2=53869&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.h (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.h Mon Jul 21 13:52:34 2008 @@ -37,6 +37,9 @@ // No relation with Mips Lo register Lo, + // Handle gp_rel (small data/bss sections) relocation. + GPRel, + // Select CC Pseudo Instruction SelectCC, @@ -83,7 +86,7 @@ SDOperand LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG, unsigned CC); SDNode *LowerCallResult(SDOperand Chain, SDOperand InFlag, SDNode*TheCall, unsigned CallingConv, SelectionDAG &DAG); - SDOperand getReturnAddressFrameIndex(SelectionDAG &DAG); + bool IsGlobalInSmallSection(GlobalValue *GV); // Lower Operand specifics SDOperand LowerRET(SDOperand Op, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td?rev=53869&r1=53868&r2=53869&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.td (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Mon Jul 21 13:52:34 2008 @@ -31,9 +31,9 @@ // Hi and Lo nodes are used to handle global addresses. Used on // MipsISelLowering to lower stuff like GlobalAddress, ExternalSymbol // static model. (nothing to do with Mips Registers Hi and Lo) -//def MipsHi : SDNode<"MipsISD::Hi", SDTIntUnaryOp, [SDNPOutFlag]>; -def MipsHi : SDNode<"MipsISD::Hi", SDTIntUnaryOp>; -def MipsLo : SDNode<"MipsISD::Lo", SDTIntUnaryOp>; +def MipsHi : SDNode<"MipsISD::Hi", SDTIntUnaryOp>; +def MipsLo : SDNode<"MipsISD::Lo", SDTIntUnaryOp>; +def MipsGPRel : SDNode<"MipsISD::GPRel", SDTIntUnaryOp>; // Return def MipsRet : SDNode<"MipsISD::Ret", SDT_MipsRet, [SDNPHasChain, @@ -555,13 +555,15 @@ // GlobalAddress, Constant Pool, ExternalSymbol, and JumpTable def : Pat<(MipsHi tglobaladdr:$in), (LUi tglobaladdr:$in)>; -def : Pat<(MipsLo tglobaladdr:$in), (ADDiu ZERO, tglobaladdr:$in)>; +//def : Pat<(MipsLo tglobaladdr:$in), (ADDiu ZERO, tglobaladdr:$in)>; def : Pat<(add CPURegs:$hi, (MipsLo tglobaladdr:$lo)), (ADDiu CPURegs:$hi, tglobaladdr:$lo)>; def : Pat<(MipsHi tjumptable:$in), (LUi tjumptable:$in)>; -def : Pat<(MipsLo tjumptable:$in), (ADDiu ZERO, tjumptable:$in)>; +//def : Pat<(MipsLo tjumptable:$in), (ADDiu ZERO, tjumptable:$in)>; def : Pat<(add CPURegs:$hi, (MipsLo tjumptable:$lo)), (ADDiu CPURegs:$hi, tjumptable:$lo)>; +def : Pat<(add CPURegs:$gp, (MipsGPRel tglobaladdr:$in)), + (ADDiu CPURegs:$gp, tglobaladdr:$in)>; // Mips does not have "not", so we expand our way def : Pat<(not CPURegs:$in), Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp?rev=53869&r1=53868&r2=53869&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp Mon Jul 21 13:52:34 2008 @@ -22,6 +22,9 @@ cl::desc("Disable code for SVR4-style dynamic objects")); cl::opt AbsoluteCall("enable-mips-absolute-call", cl::Hidden, cl::desc("Enable absolute call within abicall")); +cl::opt SSThreshold("mips-ssection-threshold", cl::Hidden, + cl::desc("Small data and bss section threshold size (default=8)"), + cl::init(8)); MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const Module &M, const std::string &FS, bool little) : @@ -35,6 +38,9 @@ ParseSubtargetFeatures(FS, CPU); const std::string& TT = M.getTargetTriple(); + // Small section size threshold + SSectionThreshold = SSThreshold; + // Is the target system Linux ? if (TT.find("linux") == std::string::npos) IsLinux = false; Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.h?rev=53869&r1=53868&r2=53869&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsSubtarget.h (original) +++ llvm/trunk/lib/Target/Mips/MipsSubtarget.h Mon Jul 21 13:52:34 2008 @@ -71,6 +71,10 @@ // isLinux - Target system is Linux. Is false we consider ELFOS for now. bool IsLinux; + // Put global and static items less than or equal to SSectionThreshold + // bytes into the small data or bss section. The default is 8. + unsigned SSectionThreshold; + InstrItineraryData InstrItins; public: @@ -102,6 +106,7 @@ bool hasABICall() const { return HasABICall; }; bool hasAbsoluteCall() const { return HasAbsoluteCall; }; bool isLinux() const { return IsLinux; }; + unsigned getSSectionThreshold() const { return SSectionThreshold; } }; } // End llvm namespace Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp?rev=53869&r1=53868&r2=53869&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Mon Jul 21 13:52:34 2008 @@ -31,6 +31,7 @@ ZeroDirective = "\t.space\t"; BSSSection = "\t.section\t.bss"; LCOMMDirective = "\t.lcomm\t"; + CStringSection = ".rodata.str"; if (!TM.getSubtarget().hasABICall()) JumpTableDirective = "\t.word\t"; From wmatyjewicz at fastmail.fm Mon Jul 21 14:29:22 2008 From: wmatyjewicz at fastmail.fm (Wojciech Matyjewicz) Date: Mon, 21 Jul 2008 21:29:22 +0200 Subject: [llvm-commits] [llvm] r53810 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp lib/Support/APInt.cpp test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll test/Analysis/ScalarEvolution/2008-07-19-InfiniteLoop.ll test/Analysis/ScalarEvolution/2008-07-19-WrappingIV.ll In-Reply-To: <76CA4247-D449-4810-A111-64B70583C687@apple.com> References: <200807201555.m6KFtFoR025101@zion.cs.uiuc.edu> <76CA4247-D449-4810-A111-64B70583C687@apple.com> Message-ID: <4884E392.3040902@fastmail.fm> > On Jul 20, 2008, at 8:55 AM, Wojciech Matyjewicz wrote: >> ====================================================================== >> --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) >> +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun Jul 20 10:55:14 >> 2008 >> @@ -78,6 +78,8 @@ >> #include "llvm/Support/MathExtras.h" >> #include "llvm/Support/Streams.h" >> #include "llvm/ADT/Statistic.h" >> +//TMP: > > ?? > >> +#include "llvm/Support/Debug.h" Sorry for that. I've already removed these two lines in r53811. Wojtek From gohman at apple.com Mon Jul 21 14:48:16 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Jul 2008 19:48:16 -0000 Subject: [llvm-commits] [llvm] r53870 - /llvm/trunk/lib/CodeGen/MachineFunction.cpp Message-ID: <200807211948.m6LJmHHL025813@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 14:48:15 2008 New Revision: 53870 URL: http://llvm.org/viewvc/llvm-project?rev=53870&view=rev Log: Fix uses of underscore-capital names. Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=53870&r1=53869&r2=53870&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Mon Jul 21 14:48:15 2008 @@ -47,8 +47,8 @@ std::ostream *OS; const std::string Banner; - Printer (std::ostream *_OS, const std::string &_Banner) - : MachineFunctionPass((intptr_t)&ID), OS (_OS), Banner (_Banner) { } + Printer (std::ostream *os, const std::string &banner) + : MachineFunctionPass((intptr_t)&ID), OS(os), Banner(banner) {} const char *getPassName() const { return "MachineFunction Printer"; } From gohman at apple.com Mon Jul 21 14:57:57 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Jul 2008 19:57:57 -0000 Subject: [llvm-commits] [llvm] r53871 - /llvm/trunk/include/llvm/Support/GraphWriter.h Message-ID: <200807211957.m6LJvwH4026141@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 14:57:57 2008 New Revision: 53871 URL: http://llvm.org/viewvc/llvm-project?rev=53871&view=rev Log: Make the GraphWriter be more consistent about the string used for the graph "title" and the graph "label", as there are differences in interpretation of these strings between viewers. Modified: llvm/trunk/include/llvm/Support/GraphWriter.h Modified: llvm/trunk/include/llvm/Support/GraphWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=53871&r1=53870&r2=53871&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/GraphWriter.h (original) +++ llvm/trunk/include/llvm/Support/GraphWriter.h Mon Jul 21 14:57:57 2008 @@ -85,7 +85,7 @@ std::string GraphName = DOTTraits::getGraphName(G); if (!Name.empty()) - O << "digraph " << Name << " {\n"; + O << "digraph \"" << DOT::EscapeString(Name) << "\" {\n"; else if (!GraphName.empty()) O << "digraph \"" << DOT::EscapeString(GraphName) << "\" {\n"; else @@ -94,7 +94,9 @@ if (DOTTraits::renderGraphFromBottomUp()) O << "\trankdir=\"BT\";\n"; - if (!GraphName.empty()) + if (!Name.empty()) + O << "\tlabel=\"" << DOT::EscapeString(Name) << "\";\n"; + else if (!GraphName.empty()) O << "\tlabel=\"" << DOT::EscapeString(GraphName) << "\";\n"; O << DOTTraits::getGraphProperties(G); O << "\n"; @@ -234,12 +236,13 @@ template std::ostream &WriteGraph(std::ostream &O, const GraphType &G, - const std::string &Name = "") { + const std::string &Name = "", + const std::string &Title = "") { // Start the graph emission process... GraphWriter W(O, G); // Output the header for the graph... - W.writeHeader(Name); + W.writeHeader(Title); // Emit all of the nodes in the graph... W.writeNodes(); @@ -273,24 +276,10 @@ std::ofstream O(Filename.c_str()); if (O.good()) { - // Start the graph emission process... - GraphWriter W(O, G); - - // Output the header for the graph... - W.writeHeader(Title); - - // Emit all of the nodes in the graph... - W.writeNodes(); - - // Output any customizations on the graph - DOTGraphTraits::addCustomGraphFeatures(G, W); - - // Output the end of the graph - W.writeFooter(); + WriteGraph(O, G, Name, Title); cerr << " done. \n"; O.close(); - } else { cerr << "error opening file for writing!\n"; Filename.clear(); From gohman at apple.com Mon Jul 21 15:00:08 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Jul 2008 20:00:08 -0000 Subject: [llvm-commits] [llvm] r53872 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/CodeGen/SelectionDAGISel.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200807212000.m6LK08bv026254@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 15:00:07 2008 New Revision: 53872 URL: http://llvm.org/viewvc/llvm-project?rev=53872&view=rev Log: Add titles to the various SelectionDAG viewGraph calls that include useful information like the name of the block being viewed and the current phase of compilation. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=53872&r1=53871&r2=53872&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Jul 21 15:00:07 2008 @@ -84,7 +84,8 @@ /// viewGraph - Pop up a GraphViz/gv window with the DAG rendered using 'dot'. /// - void viewGraph(); + void viewGraph(const std::string &Title); + void viewGraph() { return viewGraph(""); } #ifndef NDEBUG std::map NodeGraphAttrs; Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h?rev=53872&r1=53871&r2=53872&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h Mon Jul 21 15:00:07 2008 @@ -59,7 +59,7 @@ virtual void EmitFunctionEntryCode(Function &Fn, MachineFunction &MF) {} virtual void InstructionSelect(SelectionDAG &SD) = 0; - virtual void InstructionSelectPostProcessing(SelectionDAG &DAG) {} + virtual void InstructionSelectPostProcessing() {} virtual void SelectRootInit() { DAGSize = CurDAG->AssignTopologicalOrder(TopOrder); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=53872&r1=53871&r2=53872&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Jul 21 15:00:07 2008 @@ -37,20 +37,6 @@ STATISTIC(PostIndexedNodes, "Number of post-indexed nodes created"); namespace { -#ifndef NDEBUG - static cl::opt - ViewDAGCombine1("view-dag-combine1-dags", cl::Hidden, - cl::desc("Pop up a window to show dags before the first " - "dag combine pass")); - static cl::opt - ViewDAGCombine2("view-dag-combine2-dags", cl::Hidden, - cl::desc("Pop up a window to show dags before the second " - "dag combine pass")); -#else - static const bool ViewDAGCombine1 = false; - static const bool ViewDAGCombine2 = false; -#endif - static cl::opt CombinerAA("combiner-alias-analysis", cl::Hidden, cl::desc("Turn on alias analysis during testing")); @@ -5662,10 +5648,6 @@ // SelectionDAG::Combine - This is the entry point for the file. // void SelectionDAG::Combine(bool RunningAfterLegalize, AliasAnalysis &AA) { - if (!RunningAfterLegalize && ViewDAGCombine1) - viewGraph(); - if (RunningAfterLegalize && ViewDAGCombine2) - viewGraph(); /// run - This is the main entry point to this class. /// DAGCombiner(*this, AA).Run(RunningAfterLegalize); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=53872&r1=53871&r2=53872&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Jul 21 15:00:07 2008 @@ -35,14 +35,6 @@ #include using namespace llvm; -#ifndef NDEBUG -static cl::opt -ViewLegalizeDAGs("view-legalize-dags", cl::Hidden, - cl::desc("Pop up a window to show dags before legalize")); -#else -static const bool ViewLegalizeDAGs = 0; -#endif - //===----------------------------------------------------------------------===// /// SelectionDAGLegalize - This takes an arbitrary SelectionDAG as input and /// hacks on it until the target machine can handle it. This involves @@ -7039,8 +7031,6 @@ // SelectionDAG::Legalize - This is the entry point for the file. // void SelectionDAG::Legalize() { - if (ViewLegalizeDAGs) viewGraph(); - /// run - This is the main entry point to this class. /// SelectionDAGLegalize(*this).LegalizeDAG(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=53872&r1=53871&r2=53872&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Mon Jul 21 15:00:07 2008 @@ -19,15 +19,6 @@ #include "llvm/Target/TargetData.h" using namespace llvm; -#ifndef NDEBUG -static cl::opt -ViewLegalizeTypesDAGs("view-legalize-types-dags", cl::Hidden, - cl::desc("Pop up a window to show dags before legalize types")); -#else -static const bool ViewLegalizeTypesDAGs = 0; -#endif - - /// run - This is the main entry point for the type legalizer. This does a /// top-down traversal of the dag, legalizing types as it goes. void DAGTypeLegalizer::run() { @@ -673,7 +664,5 @@ /// Note that this is an involved process that may invalidate pointers into /// the graph. void SelectionDAG::LegalizeTypes() { - if (ViewLegalizeTypesDAGs) viewGraph(); - DAGTypeLegalizer(*this).run(); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=53872&r1=53871&r2=53872&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Jul 21 15:00:07 2008 @@ -57,6 +57,20 @@ #ifndef NDEBUG static cl::opt +ViewDAGCombine1("view-dag-combine1-dags", cl::Hidden, + cl::desc("Pop up a window to show dags before the first " + "dag combine pass")); +static cl::opt +ViewLegalizeTypesDAGs("view-legalize-types-dags", cl::Hidden, + cl::desc("Pop up a window to show dags before legalize types")); +static cl::opt +ViewLegalizeDAGs("view-legalize-dags", cl::Hidden, + cl::desc("Pop up a window to show dags before legalize")); +static cl::opt +ViewDAGCombine2("view-dag-combine2-dags", cl::Hidden, + cl::desc("Pop up a window to show dags before the second " + "dag combine pass")); +static cl::opt ViewISelDAGs("view-isel-dags", cl::Hidden, cl::desc("Pop up a window to show isel dags as they are selected")); static cl::opt @@ -66,7 +80,11 @@ ViewSUnitDAGs("view-sunit-dags", cl::Hidden, cl::desc("Pop up a window to show SUnit dags after they are processed")); #else -static const bool ViewISelDAGs = 0, ViewSchedDAGs = 0, ViewSUnitDAGs = 0; +static const bool ViewDAGCombine1 = false, + ViewLegalizeTypesDAGs = false, ViewLegalizeDAGs = false, + ViewDAGCombine2 = false, + ViewISelDAGs = false, ViewSchedDAGs = false, + ViewSUnitDAGs = false; #endif //===---------------------------------------------------------------------===// @@ -5282,9 +5300,19 @@ } void SelectionDAGISel::CodeGenAndEmitDAG(SelectionDAG &DAG) { - DOUT << "Lowered selection DAG:\n"; + std::string GroupName; + if (TimePassesIsEnabled) + GroupName = "Instruction Selection and Scheduling"; + std::string BlockName; + if (ViewDAGCombine1 || ViewLegalizeTypesDAGs || ViewLegalizeDAGs || + ViewDAGCombine2 || ViewISelDAGs || ViewSchedDAGs || ViewSUnitDAGs) + BlockName = DAG.getMachineFunction().getFunction()->getName() + ':' + + BB->getBasicBlock()->getName(); + + DOUT << "Initial selection DAG:\n"; DEBUG(DAG.dump()); - std::string GroupName = "Instruction Selection and Scheduling"; + + if (ViewDAGCombine1) DAG.viewGraph("dag-combine1 input for " + BlockName); // Run the DAG combiner in pre-legalize mode. if (TimePassesIsEnabled) { @@ -5300,10 +5328,24 @@ // Second step, hack on the DAG until it only uses operations and types that // the target supports. if (EnableLegalizeTypes) {// Enable this some day. - DAG.LegalizeTypes(); + if (ViewLegalizeTypesDAGs) DAG.viewGraph("legalize-types input for " + + BlockName); + + if (TimePassesIsEnabled) { + NamedRegionTimer T("Type Legalization", GroupName); + DAG.LegalizeTypes(); + } else { + DAG.LegalizeTypes(); + } + + DOUT << "Type-legalized selection DAG:\n"; + DEBUG(DAG.dump()); + // TODO: enable a dag combine pass here. } + if (ViewLegalizeDAGs) DAG.viewGraph("legalize input for " + BlockName); + if (TimePassesIsEnabled) { NamedRegionTimer T("DAG Legalization", GroupName); DAG.Legalize(); @@ -5314,6 +5356,8 @@ DOUT << "Legalized selection DAG:\n"; DEBUG(DAG.dump()); + if (ViewDAGCombine2) DAG.viewGraph("dag-combine2 input for " + BlockName); + // Run the DAG combiner in post-legalize mode. if (TimePassesIsEnabled) { NamedRegionTimer T("DAG Combining 2", GroupName); @@ -5325,7 +5369,7 @@ DOUT << "Optimized legalized selection DAG:\n"; DEBUG(DAG.dump()); - if (ViewISelDAGs) DAG.viewGraph(); + if (ViewISelDAGs) DAG.viewGraph("isel input for " + BlockName); if (!FastISel && EnableValueProp) ComputeLiveOutVRegInfo(DAG); @@ -5339,6 +5383,11 @@ InstructionSelect(DAG); } + DOUT << "Selected selection DAG:\n"; + DEBUG(DAG.dump()); + + if (ViewSchedDAGs) DAG.viewGraph("scheduler input for " + BlockName); + // Schedule machine code. ScheduleDAG *Scheduler; if (TimePassesIsEnabled) { @@ -5348,6 +5397,8 @@ Scheduler = Schedule(DAG); } + if (ViewSUnitDAGs) Scheduler->viewGraph(); + // Emit machine code to BB. This can change 'BB' to the last block being // inserted into. if (TimePassesIsEnabled) { @@ -5368,9 +5419,9 @@ // Perform target specific isel post processing. if (TimePassesIsEnabled) { NamedRegionTimer T("Instruction Selection Post Processing", GroupName); - InstructionSelectPostProcessing(DAG); + InstructionSelectPostProcessing(); } else { - InstructionSelectPostProcessing(DAG); + InstructionSelectPostProcessing(); } DOUT << "Selected machine code:\n"; @@ -5619,8 +5670,6 @@ /// target node in the graph. /// ScheduleDAG *SelectionDAGISel::Schedule(SelectionDAG &DAG) { - if (ViewSchedDAGs) DAG.viewGraph(); - RegisterScheduler::FunctionPassCtor Ctor = RegisterScheduler::getDefault(); if (!Ctor) { @@ -5631,7 +5680,6 @@ ScheduleDAG *Scheduler = Ctor(this, &DAG, BB, FastISel); Scheduler->Run(); - if (ViewSUnitDAGs) Scheduler->viewGraph(); return Scheduler; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=53872&r1=53871&r2=53872&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Mon Jul 21 15:00:07 2008 @@ -215,10 +215,11 @@ /// viewGraph - Pop up a ghostview window with the reachable parts of the DAG /// rendered using 'dot'. /// -void SelectionDAG::viewGraph() { +void SelectionDAG::viewGraph(const std::string &Title) { // This code is only for debugging! #ifndef NDEBUG - ViewGraph(this, "dag." + getMachineFunction().getFunction()->getName()); + ViewGraph(this, "dag." + getMachineFunction().getFunction()->getName(), + Title); #else cerr << "SelectionDAG::viewGraph is only available in debug builds on " << "systems with Graphviz or gv!\n"; @@ -348,7 +349,9 @@ void ScheduleDAG::viewGraph() { // This code is only for debugging! #ifndef NDEBUG - ViewGraph(this, "dag." + DAG.getMachineFunction().getFunction()->getName()); + ViewGraph(this, "dag." + MF->getFunction()->getName(), + "Scheduling-Units Graph for " + MF->getFunction()->getName() + ':' + + BB->getBasicBlock()->getName()); #else cerr << "ScheduleDAG::viewGraph is only available in debug builds on " << "systems with Graphviz or gv!\n"; Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=53872&r1=53871&r2=53872&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Jul 21 15:00:07 2008 @@ -133,7 +133,7 @@ /// InstructionSelectPostProcessing - Post processing of selected and /// scheduled basic blocks. - virtual void InstructionSelectPostProcessing(SelectionDAG &DAG); + virtual void InstructionSelectPostProcessing(); virtual void EmitFunctionEntryCode(Function &Fn, MachineFunction &MF); @@ -580,7 +580,7 @@ DAG.RemoveDeadNodes(); } -void X86DAGToDAGISel::InstructionSelectPostProcessing(SelectionDAG &DAG) { +void X86DAGToDAGISel::InstructionSelectPostProcessing() { // If we are emitting FP stack code, scan the basic block to determine if this // block defines any FP values. If so, put an FP_REG_KILL instruction before // the terminator of the block. From evan.cheng at apple.com Mon Jul 21 15:02:45 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 21 Jul 2008 20:02:45 -0000 Subject: [llvm-commits] [llvm] r53873 - /llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Message-ID: <200807212002.m6LK2kwO026374@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jul 21 15:02:45 2008 New Revision: 53873 URL: http://llvm.org/viewvc/llvm-project?rev=53873&view=rev Log: Eliminate a compilation warning. Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=53873&r1=53872&r2=53873&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Mon Jul 21 15:02:45 2008 @@ -300,11 +300,13 @@ }; } +#ifndef NDEBUG static bool TableIsSorted(const TableEntry *Table, unsigned NumEntries) { for (unsigned i = 0; i != NumEntries-1; ++i) if (!(Table[i] < Table[i+1])) return false; return true; } +#endif static int Lookup(const TableEntry *Table, unsigned N, unsigned Opcode) { const TableEntry *I = std::lower_bound(Table, Table+N, Opcode); @@ -662,8 +664,10 @@ /// void FPS::handleOneArgFPRW(MachineBasicBlock::iterator &I) { MachineInstr *MI = I; +#ifndef NDEBUG unsigned NumOps = MI->getDesc().getNumOperands(); assert(NumOps >= 2 && "FPRW instructions must have 2 ops!!"); +#endif // Is this the last use of the source register? unsigned Reg = getFPReg(MI->getOperand(1)); From asl at math.spbu.ru Mon Jul 21 15:28:48 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 22 Jul 2008 00:28:48 +0400 Subject: [llvm-commits] [llvm] r53869 - in /llvm/trunk/lib/Target/Mips: MipsAsmPrinter.cpp MipsISelLowering.cpp MipsISelLowering.h MipsInstrInfo.td MipsSubtarget.cpp MipsSubtarget.h MipsTargetAsmInfo.cpp In-Reply-To: <200807211852.m6LIqYR5024100@zion.cs.uiuc.edu> References: <200807211852.m6LIqYR5024100@zion.cs.uiuc.edu> Message-ID: <1216672128.14525.72.camel@localhost> Hi, Bruno > + const TargetData *TD = getTargetData(); > + const Value *V = dyn_cast(GV); You don't need dyn_cast here at all, since GlobalValue is Value. > + const GlobalVariable *GVA = dyn_cast(V); And this one seems to be unsafe, GVA will be null, if somebody called this function with Function*. Why don't use cast then? -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From gohman at apple.com Mon Jul 21 16:04:08 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Jul 2008 21:04:08 -0000 Subject: [llvm-commits] [llvm] r53874 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200807212104.m6LL482N028389@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 16:04:07 2008 New Revision: 53874 URL: http://llvm.org/viewvc/llvm-project?rev=53874&view=rev Log: After early-lowering the FORMAL_ARGUMENTS node, delete it. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=53874&r1=53873&r2=53874&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Jul 21 16:04:07 2008 @@ -4686,6 +4686,13 @@ (Result->getNumValues()+1 == TmpRes.Val->getNumValues() && TmpRes.getValue(Result->getNumValues()).getValueType() == MVT::Flag)) && "Lowering produced unexpected number of results!"); + + // The FORMAL_ARGUMENTS node itself is likely no longer needed. + if (Result != TmpRes.Val && Result->use_empty()) { + HandleSDNode Dummy(DAG.getRoot()); + DAG.RemoveDeadNode(Result); + } + Result = TmpRes.Val; unsigned NumArgRegs = Result->getNumValues() - 1; From gohman at apple.com Mon Jul 21 16:06:56 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Jul 2008 21:06:56 -0000 Subject: [llvm-commits] [llvm] r53875 - in /llvm/trunk: include/llvm/Support/DOTGraphTraits.h include/llvm/Support/GraphWriter.h lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200807212106.m6LL6ucO028477@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 16:06:55 2008 New Revision: 53875 URL: http://llvm.org/viewvc/llvm-project?rev=53875&view=rev Log: Enhance the GraphWriter support for edge destinations, and teach the SelectionDAG graph writer to make use of them. Now, nodes with multiple values are displayed as such, with incoming edges pointing to the specific value they use. Modified: llvm/trunk/include/llvm/Support/DOTGraphTraits.h llvm/trunk/include/llvm/Support/GraphWriter.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Modified: llvm/trunk/include/llvm/Support/DOTGraphTraits.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DOTGraphTraits.h?rev=53875&r1=53874&r2=53875&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/DOTGraphTraits.h (original) +++ llvm/trunk/include/llvm/Support/DOTGraphTraits.h Mon Jul 21 16:06:55 2008 @@ -100,6 +100,24 @@ return I; } + /// hasEdgeDestLabels - If this function returns true, the graph is able + /// to provide labels for edge destinations. + static bool hasEdgeDestLabels() { + return false; + } + + /// numEdgeDestLabels - If hasEdgeDestLabels, this function returns the + /// number of incoming edge labels the given node has. + static unsigned numEdgeDestLabels(const void *Node) { + return 0; + } + + /// getEdgeDestLabel - If hasEdgeDestLabels, this function returns the + /// incoming edge label with the given index in the given node. + static std::string getEdgeDestLabel(const void *Node, unsigned i) { + return ""; + } + /// addCustomGraphFeatures - If a graph is made up of more than just /// straight-forward nodes and edges, this is the place to put all of the /// custom stuff necessary. The GraphWriter object, instantiated with your Modified: llvm/trunk/include/llvm/Support/GraphWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=53875&r1=53874&r2=53875&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/GraphWriter.h (original) +++ llvm/trunk/include/llvm/Support/GraphWriter.h Mon Jul 21 16:06:55 2008 @@ -146,11 +146,11 @@ for (unsigned i = 0; EI != EE && i != 64; ++EI, ++i) { if (i) O << "|"; - O << "" << DOTTraits::getEdgeSourceLabel(Node, EI); + O << "" << DOTTraits::getEdgeSourceLabel(Node, EI); } if (EI != EE) - O << "|truncated..."; + O << "|truncated..."; O << "}"; if (DOTTraits::renderGraphFromBottomUp()) O << "|"; } @@ -163,6 +163,20 @@ O << "|" << (void*)Node; } + if (DOTTraits::hasEdgeDestLabels()) { + O << "|{"; + + unsigned i = 0, e = DOTTraits::numEdgeDestLabels(Node); + for (; i != e && i != 64; ++i) { + if (i) O << "|"; + O << "" << DOTTraits::getEdgeDestLabel(Node, i); + } + + if (i != e) + O << "|truncated..."; + O << "}"; + } + O << "}\"];\n"; // Finish printing the "node" line // Output all of the edges now @@ -223,10 +237,10 @@ O << "\tNode" << SrcNodeID; if (SrcNodePort >= 0) - O << ":g" << SrcNodePort; + O << ":s" << SrcNodePort; O << " -> Node" << reinterpret_cast(DestNodeID); if (DestNodePort >= 0) - O << ":g" << DestNodePort; + O << ":d" << DestNodePort; if (!Attrs.empty()) O << "[" << Attrs << "]"; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=53875&r1=53874&r2=53875&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Mon Jul 21 16:06:55 2008 @@ -32,6 +32,37 @@ namespace llvm { template<> struct DOTGraphTraits : public DefaultDOTGraphTraits { + static bool hasEdgeDestLabels() { + return true; + } + + static unsigned numEdgeDestLabels(const void *Node) { + return ((const SDNode *) Node)->getNumValues(); + } + + static std::string getEdgeDestLabel(const void *Node, unsigned i) { + return ((const SDNode *) Node)->getValueType(i).getMVTString(); + } + + /// edgeTargetsEdgeSource - This method returns true if this outgoing edge + /// should actually target another edge source, not a node. If this method is + /// implemented, getEdgeTarget should be implemented. + template + static bool edgeTargetsEdgeSource(const void *Node, EdgeIter I) { + return true; + } + + /// getEdgeTarget - If edgeTargetsEdgeSource returns true, this method is + /// called to determine which outgoing edge of Node is the target of this + /// edge. + template + static EdgeIter getEdgeTarget(const void *Node, EdgeIter I) { + SDNode *TargetNode = *I; + SDNodeIterator NI = SDNodeIterator::begin(TargetNode); + std::advance(NI, I.getNode()->getOperand(I.getOperand()).ResNo); + return NI; + } + static std::string getGraphName(const SelectionDAG *G) { return G->getMachineFunction().getFunction()->getName(); } @@ -88,12 +119,6 @@ const SelectionDAG *G) { std::string Op = Node->getOperationName(G); - for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i) - if (Node->getValueType(i) == MVT::Other) - Op += ":ch"; - else - Op = Op + ":" + Node->getValueType(i).getMVTString(); - if (const ConstantSDNode *CSDN = dyn_cast(Node)) { Op += ": " + utostr(CSDN->getValue()); } else if (const ConstantFPSDNode *CSDN = dyn_cast(Node)) { From clattner at apple.com Mon Jul 21 16:35:12 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 21 Jul 2008 14:35:12 -0700 Subject: [llvm-commits] [llvm] r53875 - in /llvm/trunk: include/llvm/Support/DOTGraphTraits.h include/llvm/Support/GraphWriter.h lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp In-Reply-To: <200807212106.m6LL6ucO028477@zion.cs.uiuc.edu> References: <200807212106.m6LL6ucO028477@zion.cs.uiuc.edu> Message-ID: <5C66C3DE-EAAA-4563-8985-133437C17BB0@apple.com> On Jul 21, 2008, at 2:06 PM, Dan Gohman wrote: > Author: djg > Date: Mon Jul 21 16:06:55 2008 > New Revision: 53875 > > URL: http://llvm.org/viewvc/llvm-project?rev=53875&view=rev > Log: > Enhance the GraphWriter support for edge destinations, and teach the > SelectionDAG graph writer to make use of them. Now, nodes with > multiple > values are displayed as such, with incoming edges pointing to the > specific value they use. Whoa, totally awesome! -Chris From gohman at apple.com Mon Jul 21 16:45:02 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Jul 2008 21:45:02 -0000 Subject: [llvm-commits] [llvm] r53879 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/pr2570.ll Message-ID: <200807212145.m6LLj2lR029771@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 16:45:02 2008 New Revision: 53879 URL: http://llvm.org/viewvc/llvm-project?rev=53879&view=rev Log: Fix a bug in LSR's dead-PHI cleanup. If a PHI has a def-use chain that leads into a cycle involving a different PHI, LSR got stuck running around that cycle looking for the original PHI. To avoid this, keep track of visited PHIs and stop searching if we see one more than once. This fixes PR2570. Added: llvm/trunk/test/Transforms/LoopStrengthReduce/pr2570.ll Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=53879&r1=53878&r2=53879&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Jul 21 16:45:02 2008 @@ -1823,6 +1823,7 @@ // FIXME: this needs to eliminate an induction variable even if it's being // compared against some value to decide loop termination. if (PN->hasOneUse()) { + SmallPtrSet PHIs; for (Instruction *J = dyn_cast(*PN->use_begin()); J && J->hasOneUse() && !J->mayWriteToMemory(); J = dyn_cast(*J->use_begin())) { @@ -1835,6 +1836,10 @@ Changed = true; break; } + // If we find a PHI more than once, we're on a cycle that + // won't prove fruitful. + if (isa(J) && !PHIs.insert(cast(J))) + break; } } } Added: llvm/trunk/test/Transforms/LoopStrengthReduce/pr2570.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/pr2570.ll?rev=53879&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopStrengthReduce/pr2570.ll (added) +++ llvm/trunk/test/Transforms/LoopStrengthReduce/pr2570.ll Mon Jul 21 16:45:02 2008 @@ -0,0 +1,285 @@ +; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep {phi\\>} | count 14 +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" +target triple = "i386-pc-linux-gnu" + at g_14 = internal global i32 1 ; [#uses=1] + at g_39 = internal global i16 -5 ; [#uses=2] + at g_43 = internal global i32 -6 ; [#uses=3] + at g_33 = internal global i32 -1269044541 ; [#uses=1] + at g_137 = internal global i32 8 ; [#uses=1] + at g_82 = internal global i32 -5 ; [#uses=3] + at g_91 = internal global i32 1 ; [#uses=1] + at g_197 = internal global i32 1 ; [#uses=4] + at g_207 = internal global i32 1 ; [#uses=2] + at g_222 = internal global i16 4165 ; [#uses=1] + at g_247 = internal global i8 -21 ; [#uses=2] + at g_260 = internal global i32 1 ; [#uses=2] + at g_221 = internal global i16 -17503 ; [#uses=3] + at g_267 = internal global i16 1 ; [#uses=1] + at llvm.used = appending global [1 x i8*] [ i8* bitcast (i32 (i32, i32, i16, i32, i8, i32)* @func_44 to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] + +define i32 @func_44(i32 %p_45, i32 %p_46, i16 zeroext %p_48, i32 %p_49, i8 zeroext %p_50, i32 %p_52) nounwind { +entry: + tail call i32 @func_116( i8 zeroext 2 ) nounwind ; :0 [#uses=0] + tail call i32 @func_63( i16 signext 2 ) nounwind ; :1 [#uses=1] + load i16* @g_39, align 2 ; :2 [#uses=1] + tail call i32 @func_63( i16 signext %2 ) nounwind ; :3 [#uses=1] + trunc i32 %3 to i16 ; :4 [#uses=1] + and i16 %4, 1 ; :5 [#uses=1] + trunc i32 %p_52 to i8 ; :6 [#uses=1] + trunc i32 %1 to i16 ; :7 [#uses=1] + tail call i32 @func_74( i16 zeroext %5, i8 zeroext %6, i16 zeroext %7, i16 zeroext 0 ) nounwind ; :8 [#uses=0] + tail call i32 @func_124( i32 544824386 ) nounwind ; :9 [#uses=0] + zext i8 %p_50 to i32 ; :10 [#uses=1] + load i32* @g_43, align 4 ; :11 [#uses=1] + icmp sle i32 %10, %11 ; :12 [#uses=1] + zext i1 %12 to i32 ; :13 [#uses=2] + load i8* @g_247, align 1 ; :14 [#uses=1] + trunc i32 %p_45 to i16 ; :15 [#uses=1] + zext i8 %14 to i16 ; :16 [#uses=1] + tail call i32 @func_74( i16 zeroext %15, i8 zeroext 0, i16 zeroext %16, i16 zeroext 23618 ) nounwind ; :17 [#uses=4] + icmp slt i32 %17, 0 ; :18 [#uses=1] + br i1 %18, label %bb162, label %bb152 + +bb152: ; preds = %entry + lshr i32 2147483647, %13 ; :19 [#uses=1] + icmp slt i32 %19, %17 ; :20 [#uses=1] + select i1 %20, i32 0, i32 %13 ; :21 [#uses=1] + %.348 = shl i32 %17, %21 ; [#uses=1] + br label %bb162 + +bb162: ; preds = %bb152, %entry + %.0346 = phi i32 [ %.348, %bb152 ], [ %17, %entry ] ; [#uses=1] + tail call i32 @func_124( i32 1 ) nounwind ; :22 [#uses=1] + mul i32 %22, %.0346 ; :23 [#uses=1] + icmp slt i32 %p_45, 0 ; :24 [#uses=1] + icmp ugt i32 %p_45, 31 ; :25 [#uses=1] + %or.cond = or i1 %24, %25 ; [#uses=1] + br i1 %or.cond, label %bb172, label %bb168 + +bb168: ; preds = %bb162 + lshr i32 2147483647, %p_45 ; :26 [#uses=1] + shl i32 1392859848, %p_45 ; :27 [#uses=1] + icmp slt i32 %26, 1392859848 ; :28 [#uses=1] + %.op355 = add i32 %27, 38978 ; [#uses=1] + %phitmp = select i1 %28, i32 1392898826, i32 %.op355 ; [#uses=1] + br label %bb172 + +bb172: ; preds = %bb168, %bb162 + %.0343 = phi i32 [ %phitmp, %bb168 ], [ 1392898826, %bb162 ] ; [#uses=2] + tail call i32 @func_84( i32 1, i16 zeroext 0, i16 zeroext 8 ) nounwind ; :29 [#uses=0] + icmp eq i32 %.0343, 0 ; :30 [#uses=1] + %.0341 = select i1 %30, i32 1, i32 %.0343 ; [#uses=1] + urem i32 %23, %.0341 ; :31 [#uses=1] + load i32* @g_137, align 4 ; :32 [#uses=4] + icmp slt i32 %32, 0 ; :33 [#uses=1] + br i1 %33, label %bb202, label %bb198 + +bb198: ; preds = %bb172 + %not. = icmp slt i32 %32, 1073741824 ; [#uses=1] + zext i1 %not. to i32 ; :34 [#uses=1] + %.351 = shl i32 %32, %34 ; [#uses=1] + br label %bb202 + +bb202: ; preds = %bb198, %bb172 + %.0335 = phi i32 [ %.351, %bb198 ], [ %32, %bb172 ] ; [#uses=1] + icmp ne i32 %31, %.0335 ; :35 [#uses=1] + zext i1 %35 to i32 ; :36 [#uses=1] + tail call i32 @func_128( i32 %36 ) nounwind ; :37 [#uses=0] + icmp eq i32 %p_45, 293685862 ; :38 [#uses=1] + br i1 %38, label %bb205, label %bb311 + +bb205: ; preds = %bb202 + icmp sgt i32 %p_46, 214 ; :39 [#uses=1] + zext i1 %39 to i32 ; :40 [#uses=2] + tail call i32 @func_128( i32 %40 ) nounwind ; :41 [#uses=0] + icmp sgt i32 %p_46, 65532 ; :42 [#uses=1] + zext i1 %42 to i16 ; :43 [#uses=1] + tail call i32 @func_74( i16 zeroext 23618, i8 zeroext -29, i16 zeroext %43, i16 zeroext 1 ) nounwind ; :44 [#uses=2] + tail call i32 @func_103( i16 zeroext -869 ) nounwind ; :45 [#uses=0] + udiv i32 %44, 34162 ; :46 [#uses=1] + icmp ult i32 %44, 34162 ; :47 [#uses=1] + %.0331 = select i1 %47, i32 1, i32 %46 ; [#uses=1] + urem i32 293685862, %.0331 ; :48 [#uses=1] + tail call i32 @func_112( i32 %p_52, i16 zeroext 1 ) nounwind ; :49 [#uses=0] + icmp eq i32 %p_52, 0 ; :50 [#uses=2] + br i1 %50, label %bb222, label %bb215 + +bb215: ; preds = %bb205 + zext i16 %p_48 to i32 ; :51 [#uses=1] + icmp eq i16 %p_48, 0 ; :52 [#uses=1] + %.0329 = select i1 %52, i32 1, i32 %51 ; [#uses=1] + udiv i32 -1, %.0329 ; :53 [#uses=1] + icmp eq i32 %53, 0 ; :54 [#uses=1] + br i1 %54, label %bb222, label %bb223 + +bb222: ; preds = %bb215, %bb205 + br label %bb223 + +bb223: ; preds = %bb222, %bb215 + %iftmp.437.0 = phi i32 [ 0, %bb222 ], [ 1, %bb215 ] ; [#uses=1] + load i32* @g_91, align 4 ; :55 [#uses=3] + tail call i32 @func_103( i16 zeroext 4 ) nounwind ; :56 [#uses=0] + tail call i32 @func_112( i32 0, i16 zeroext -31374 ) nounwind ; :57 [#uses=0] + load i32* @g_197, align 4 ; :58 [#uses=1] + tail call i32 @func_124( i32 28156 ) nounwind ; :59 [#uses=1] + load i32* @g_260, align 4 ; :60 [#uses=1] + load i32* @g_43, align 4 ; :61 [#uses=1] + xor i32 %61, %60 ; :62 [#uses=1] + mul i32 %62, %59 ; :63 [#uses=1] + trunc i32 %63 to i8 ; :64 [#uses=1] + trunc i32 %58 to i16 ; :65 [#uses=1] + tail call i32 @func_74( i16 zeroext 0, i8 zeroext %64, i16 zeroext %65, i16 zeroext 0 ) nounwind ; :66 [#uses=2] + icmp slt i32 %66, 0 ; :67 [#uses=1] + icmp slt i32 %55, 0 ; :68 [#uses=1] + icmp ugt i32 %55, 31 ; :69 [#uses=1] + or i1 %68, %69 ; :70 [#uses=1] + %or.cond352 = or i1 %70, %67 ; [#uses=1] + select i1 %or.cond352, i32 0, i32 %55 ; :71 [#uses=1] + %.353 = ashr i32 %66, %71 ; [#uses=2] + load i16* @g_221, align 2 ; :72 [#uses=1] + zext i16 %72 to i32 ; :73 [#uses=1] + icmp ugt i32 %.353, 31 ; :74 [#uses=1] + select i1 %74, i32 0, i32 %.353 ; :75 [#uses=1] + %.0323 = lshr i32 %73, %75 ; [#uses=1] + add i32 %.0323, %iftmp.437.0 ; :76 [#uses=1] + and i32 %48, 255 ; :77 [#uses=2] + add i32 %77, 2042556439 ; :78 [#uses=1] + load i32* @g_207, align 4 ; :79 [#uses=2] + icmp ugt i32 %79, 31 ; :80 [#uses=1] + select i1 %80, i32 0, i32 %79 ; :81 [#uses=1] + %.0320 = lshr i32 %77, %81 ; [#uses=1] + icmp ne i32 %78, %.0320 ; :82 [#uses=1] + zext i1 %82 to i8 ; :83 [#uses=1] + tail call i32 @func_25( i8 zeroext %83 ) nounwind ; :84 [#uses=1] + xor i32 %84, 1 ; :85 [#uses=1] + load i32* @g_197, align 4 ; :86 [#uses=1] + add i32 %86, 1 ; :87 [#uses=1] + add i32 %87, %85 ; :88 [#uses=1] + icmp ugt i32 %76, %88 ; :89 [#uses=1] + br i1 %89, label %bb241, label %bb311 + +bb241: ; preds = %bb223 + store i16 -9, i16* @g_221, align 2 + udiv i32 %p_52, 1538244727 ; :90 [#uses=1] + load i32* @g_207, align 4 ; :91 [#uses=1] + sub i32 %91, %90 ; :92 [#uses=1] + load i32* @g_14, align 4 ; :93 [#uses=1] + trunc i32 %93 to i16 ; :94 [#uses=1] + trunc i32 %p_46 to i16 ; :95 [#uses=2] + sub i16 %94, %95 ; :96 [#uses=1] + load i32* @g_197, align 4 ; :97 [#uses=1] + trunc i32 %97 to i16 ; :98 [#uses=1] + tail call i32 @func_55( i32 -346178830, i16 zeroext %98, i16 zeroext %95 ) nounwind ; :99 [#uses=0] + zext i16 %p_48 to i32 ; :100 [#uses=1] + load i8* @g_247, align 1 ; :101 [#uses=1] + zext i8 %101 to i32 ; :102 [#uses=1] + sub i32 %100, %102 ; :103 [#uses=1] + tail call i32 @func_55( i32 %103, i16 zeroext -2972, i16 zeroext %96 ) nounwind ; :104 [#uses=0] + xor i32 %92, 2968 ; :105 [#uses=1] + load i32* @g_197, align 4 ; :106 [#uses=1] + icmp ugt i32 %105, %106 ; :107 [#uses=1] + zext i1 %107 to i32 ; :108 [#uses=1] + store i32 %108, i32* @g_33, align 4 + br label %bb248 + +bb248: ; preds = %bb284, %bb241 + %p_49_addr.1.reg2mem.0 = phi i32 [ 0, %bb241 ], [ %134, %bb284 ] ; [#uses=2] + %p_48_addr.2.reg2mem.0 = phi i16 [ %p_48, %bb241 ], [ %p_48_addr.1, %bb284 ] ; [#uses=1] + %p_46_addr.1.reg2mem.0 = phi i32 [ %p_46, %bb241 ], [ %133, %bb284 ] ; [#uses=1] + %p_45_addr.1.reg2mem.0 = phi i32 [ %p_45, %bb241 ], [ %p_45_addr.0, %bb284 ] ; [#uses=2] + tail call i32 @func_63( i16 signext 1 ) nounwind ; :109 [#uses=1] + icmp eq i32 %109, 0 ; :110 [#uses=1] + br i1 %110, label %bb272.thread, label %bb255.thread + +bb272.thread: ; preds = %bb248 + store i32 1, i32* @g_82 + load i16* @g_267, align 2 ; :111 [#uses=1] + icmp eq i16 %111, 0 ; :112 [#uses=1] + br i1 %112, label %bb311.loopexit.split, label %bb268 + +bb255.thread: ; preds = %bb248 + load i32* @g_260, align 4 ; :113 [#uses=1] + sub i32 %113, %p_52 ; :114 [#uses=1] + and i32 %114, -20753 ; :115 [#uses=1] + icmp ne i32 %115, 0 ; :116 [#uses=1] + zext i1 %116 to i16 ; :117 [#uses=1] + store i16 %117, i16* @g_221, align 2 + br label %bb284 + +bb268: ; preds = %bb268, %bb272.thread + %indvar = phi i32 [ 0, %bb272.thread ], [ %g_82.tmp.0, %bb268 ] ; [#uses=2] + %p_46_addr.0.reg2mem.0 = phi i32 [ %p_46_addr.1.reg2mem.0, %bb272.thread ], [ %119, %bb268 ] ; [#uses=1] + %g_82.tmp.0 = add i32 %indvar, 1 ; [#uses=2] + trunc i32 %p_46_addr.0.reg2mem.0 to i16 ; :118 [#uses=1] + and i32 %g_82.tmp.0, 28156 ; :119 [#uses=1] + add i32 %indvar, 2 ; :120 [#uses=4] + icmp sgt i32 %120, -1 ; :121 [#uses=1] + br i1 %121, label %bb268, label %bb274.split + +bb274.split: ; preds = %bb268 + store i32 %120, i32* @g_82 + br i1 %50, label %bb279, label %bb276 + +bb276: ; preds = %bb274.split + store i16 0, i16* @g_222, align 2 + br label %bb284 + +bb279: ; preds = %bb274.split + icmp eq i32 %120, 0 ; :122 [#uses=1] + %.0317 = select i1 %122, i32 1, i32 %120 ; [#uses=1] + udiv i32 -8, %.0317 ; :123 [#uses=1] + trunc i32 %123 to i16 ; :124 [#uses=1] + br label %bb284 + +bb284: ; preds = %bb279, %bb276, %bb255.thread + %p_49_addr.0 = phi i32 [ %p_49_addr.1.reg2mem.0, %bb279 ], [ %p_49_addr.1.reg2mem.0, %bb276 ], [ 0, %bb255.thread ] ; [#uses=1] + %p_48_addr.1 = phi i16 [ %124, %bb279 ], [ %118, %bb276 ], [ %p_48_addr.2.reg2mem.0, %bb255.thread ] ; [#uses=1] + %p_45_addr.0 = phi i32 [ %p_45_addr.1.reg2mem.0, %bb279 ], [ %p_45_addr.1.reg2mem.0, %bb276 ], [ 8, %bb255.thread ] ; [#uses=3] + load i32* @g_43, align 4 ; :125 [#uses=1] + trunc i32 %125 to i8 ; :126 [#uses=1] + tail call i32 @func_116( i8 zeroext %126 ) nounwind ; :127 [#uses=0] + lshr i32 65255, %p_45_addr.0 ; :128 [#uses=1] + icmp ugt i32 %p_45_addr.0, 31 ; :129 [#uses=1] + %.op = lshr i32 %128, 31 ; [#uses=1] + %.op.op = xor i32 %.op, 1 ; [#uses=1] + %.354..lobit.not = select i1 %129, i32 1, i32 %.op.op ; [#uses=1] + load i16* @g_39, align 2 ; :130 [#uses=1] + zext i16 %130 to i32 ; :131 [#uses=1] + icmp slt i32 %.354..lobit.not, %131 ; :132 [#uses=1] + zext i1 %132 to i32 ; :133 [#uses=1] + add i32 %p_49_addr.0, 1 ; :134 [#uses=2] + icmp sgt i32 %134, -1 ; :135 [#uses=1] + br i1 %135, label %bb248, label %bb307 + +bb307: ; preds = %bb284 + tail call i32 @func_103( i16 zeroext 0 ) nounwind ; :136 [#uses=0] + ret i32 %40 + +bb311.loopexit.split: ; preds = %bb272.thread + store i32 1, i32* @g_82 + ret i32 1 + +bb311: ; preds = %bb223, %bb202 + %.0 = phi i32 [ 1, %bb202 ], [ 0, %bb223 ] ; [#uses=1] + ret i32 %.0 +} + +declare i32 @func_25(i8 zeroext ) nounwind + +declare i32 @func_55(i32, i16 zeroext , i16 zeroext ) nounwind + +declare i32 @func_63(i16 signext ) nounwind + +declare i32 @func_74(i16 zeroext , i8 zeroext , i16 zeroext , i16 zeroext ) nounwind + +declare i32 @func_84(i32, i16 zeroext , i16 zeroext ) nounwind + +declare i32 @func_103(i16 zeroext ) nounwind + +declare i32 @func_124(i32) nounwind + +declare i32 @func_128(i32) nounwind + +declare i32 @func_116(i8 zeroext ) nounwind + +declare i32 @func_112(i32, i16 zeroext ) nounwind From gohman at apple.com Mon Jul 21 16:50:25 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Jul 2008 21:50:25 -0000 Subject: [llvm-commits] [llvm] r53880 - /llvm/trunk/test/Transforms/LoopStrengthReduce/pr2570.ll Message-ID: <200807212150.m6LLoPec029968@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 16:50:25 2008 New Revision: 53880 URL: http://llvm.org/viewvc/llvm-project?rev=53880&view=rev Log: Add the PR number to the test. Modified: llvm/trunk/test/Transforms/LoopStrengthReduce/pr2570.ll Modified: llvm/trunk/test/Transforms/LoopStrengthReduce/pr2570.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/pr2570.ll?rev=53880&r1=53879&r2=53880&view=diff ============================================================================== --- llvm/trunk/test/Transforms/LoopStrengthReduce/pr2570.ll (original) +++ llvm/trunk/test/Transforms/LoopStrengthReduce/pr2570.ll Mon Jul 21 16:50:25 2008 @@ -1,4 +1,6 @@ ; RUN: llvm-as < %s | opt -loop-reduce | llvm-dis | grep {phi\\>} | count 14 +; PR2570 + target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" target triple = "i386-pc-linux-gnu" @g_14 = internal global i32 1 ; [#uses=1] From gohman at apple.com Mon Jul 21 17:38:59 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Jul 2008 22:38:59 -0000 Subject: [llvm-commits] [llvm] r53884 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200807212238.m6LMcxlo032045@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 17:38:59 2008 New Revision: 53884 URL: http://llvm.org/viewvc/llvm-project?rev=53884&view=rev Log: Fix grammaros in comments. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=53884&r1=53883&r2=53884&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jul 21 17:38:59 2008 @@ -3638,7 +3638,7 @@ if (SDNode *Existing = FindModifiedNodeSlot(N, Op, InsertPos)) return SDOperand(Existing, InN.ResNo); - // Nope it doesn't. Remove the node from it's current place in the maps. + // Nope it doesn't. Remove the node from its current place in the maps. if (InsertPos) RemoveNodeFromCSEMaps(N); @@ -3667,7 +3667,7 @@ if (SDNode *Existing = FindModifiedNodeSlot(N, Op1, Op2, InsertPos)) return SDOperand(Existing, InN.ResNo); - // Nope it doesn't. Remove the node from it's current place in the maps. + // Nope it doesn't. Remove the node from its current place in the maps. if (InsertPos) RemoveNodeFromCSEMaps(N); From bruno.cardoso at gmail.com Mon Jul 21 17:56:20 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 21 Jul 2008 19:56:20 -0300 Subject: [llvm-commits] [llvm] r53869 - in /llvm/trunk/lib/Target/Mips: MipsAsmPrinter.cpp MipsISelLowering.cpp MipsISelLowering.h MipsInstrInfo.td MipsSubtarget.cpp MipsSubtarget.h MipsTargetAsmInfo.cpp In-Reply-To: <1216672128.14525.72.camel@localhost> References: <200807211852.m6LIqYR5024100@zion.cs.uiuc.edu> <1216672128.14525.72.camel@localhost> Message-ID: <275e64e40807211556i219bf00er8bee3bbe41c05aa@mail.gmail.com> On Mon, Jul 21, 2008 at 5:28 PM, Anton Korobeynikov wrote: > Hi, Bruno > >> + const TargetData *TD = getTargetData(); >> + const Value *V = dyn_cast(GV); > You don't need dyn_cast here at all, since GlobalValue is Value. oops >> + const GlobalVariable *GVA = dyn_cast(V); > And this one seems to be unsafe, GVA will be null, if somebody called > this function with Function*. Why don't use cast then? I'm checking for functions in the function which calls this one. Anyway, your approach is safer, I'll fix it :) Thanks -- Bruno Cardoso Lopes http://www.brunocardoso.cc "When faced with untenable alternatives, you should consider your imperative." From dpatel at apple.com Mon Jul 21 18:04:39 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 21 Jul 2008 23:04:39 -0000 Subject: [llvm-commits] [llvm] r53886 - in /llvm/trunk/tools/lto-bugpoint: LTOBugPoint.cpp LTOBugPoint.h Makefile lto-bugpoint.cpp Message-ID: <200807212304.m6LN4dnF000442@zion.cs.uiuc.edu> Author: dpatel Date: Mon Jul 21 18:04:39 2008 New Revision: 53886 URL: http://llvm.org/viewvc/llvm-project?rev=53886&view=rev Log: Provide llvm bitcode file to native object file interface. Modified: llvm/trunk/tools/lto-bugpoint/LTOBugPoint.cpp llvm/trunk/tools/lto-bugpoint/LTOBugPoint.h llvm/trunk/tools/lto-bugpoint/Makefile llvm/trunk/tools/lto-bugpoint/lto-bugpoint.cpp Modified: llvm/trunk/tools/lto-bugpoint/LTOBugPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto-bugpoint/LTOBugPoint.cpp?rev=53886&r1=53885&r2=53886&view=diff ============================================================================== --- llvm/trunk/tools/lto-bugpoint/LTOBugPoint.cpp (original) +++ llvm/trunk/tools/lto-bugpoint/LTOBugPoint.cpp Mon Jul 21 18:04:39 2008 @@ -13,10 +13,26 @@ //===----------------------------------------------------------------------===// #include "LTOBugPoint.h" +#include "llvm/PassManager.h" +#include "llvm/Module.h" +#include "llvm/ModuleProvider.h" +#include "llvm/CodeGen/FileWriters.h" +#include "llvm/Target/SubtargetFeature.h" +#include "llvm/Target/TargetOptions.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetAsmInfo.h" +#include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Support/SystemUtils.h" +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Bitcode/ReaderWriter.h" #include "llvm/System/Path.h" +#include "llvm/Config/config.h" +#include #include +using namespace llvm; +using namespace Reloc; /// LTOBugPoint -- Constructor. Popuate list of linker options and /// list of linker input files. LTOBugPoint::LTOBugPoint(std::istream &args, std::istream &ins) { @@ -35,23 +51,184 @@ /// findTroubleMakers - Find minimum set of input files that causes error /// identified by the script. bool -LTOBugPoint::findTroubleMakers(llvm::SmallVector &TroubleMakers, +LTOBugPoint::findTroubleMakers(SmallVector &TroubleMakers, std::string &Script) { // First, build native object files set. bool bitcodeFileSeen = false; - for(llvm::SmallVector::iterator I = LinkerInputFiles.begin(), - E = LinkerInputFiles.end(); I != E; ++I) { - std::string &path = *I; - if (llvm::sys::Path(path.c_str()).isBitcodeFile()) + unsigned Size = LinkerInputFiles.size(); + for (unsigned I = 0; I < Size; ++I) { + std::string &FileName = LinkerInputFiles[I]; + sys::Path InputFile(FileName.c_str()); + if (InputFile.isDynamicLibrary() || InputFile.isArchive()) { + ErrMsg = "Unable to handle input file "; + ErrMsg += FileName; + return false; + } + else if (InputFile.isBitcodeFile()) { bitcodeFileSeen = true; + if (getNativeObjectFile(FileName) == false) + return false; + } + else + NativeInputFiles.push_back(FileName); } if (!bitcodeFileSeen) { - std::cerr << "lto-bugpoint: Error: Unable to help!"; - std::cerr << " Need at least one input file that contains llvm bitcode\n"; + ErrMsg = "Unable to help!"; + ErrMsg += " Need at least one input file that contains llvm bitcode"; return false; } return true; } + +/// getFeatureString - Return a string listing the features associated with the +/// target triple. +/// +/// FIXME: This is an inelegant way of specifying the features of a +/// subtarget. It would be better if we could encode this information into the +/// IR. +std::string LTOBugPoint::getFeatureString(const char *TargetTriple) { + SubtargetFeatures Features; + + if (strncmp(TargetTriple, "powerpc-apple-", 14) == 0) { + Features.AddFeature("altivec", true); + } else if (strncmp(TargetTriple, "powerpc64-apple-", 16) == 0) { + Features.AddFeature("64bit", true); + Features.AddFeature("altivec", true); + } + + return Features.getString(); +} + +/// assembleBitcode - Generate assembly code from the module. Return false +/// in case of an error. +bool LTOBugPoint::assembleBitcode(llvm::Module *M, const char *AsmFileName) { + std::string TargetTriple = M->getTargetTriple(); + std::string FeatureStr = + getFeatureString(TargetTriple.c_str()); + + const TargetMachineRegistry::entry* Registry = + TargetMachineRegistry::getClosestStaticTargetForModule( + *M, ErrMsg); + if ( Registry == NULL ) + return false; + + TargetMachine *Target = Registry->CtorFn(*M, FeatureStr.c_str()); + + // If target supports exception handling then enable it now. + if (Target->getTargetAsmInfo()->doesSupportExceptionHandling()) + ExceptionHandling = true; + + // FIXME + Target->setRelocationModel(Reloc::PIC_); + + FunctionPassManager* CGPasses = + new FunctionPassManager(new ExistingModuleProvider(M)); + + CGPasses->add(new TargetData(*Target->getTargetData())); + MachineCodeEmitter* mce = NULL; + + std::ofstream *Out = new std::ofstream(AsmFileName, std::ios::out); + + switch (Target->addPassesToEmitFile(*CGPasses, *Out, + TargetMachine::AssemblyFile, true)) { + case FileModel::MachOFile: + mce = AddMachOWriter(*CGPasses, *Out, *Target); + break; + case FileModel::ElfFile: + mce = AddELFWriter(*CGPasses, *Out, *Target); + break; + case FileModel::AsmFile: + break; + case FileModel::Error: + case FileModel::None: + ErrMsg = "target file type not supported"; + return false; + } + + if (Target->addPassesToEmitFileFinish(*CGPasses, mce, true)) { + ErrMsg = "target does not support generation of this file type"; + return false; + } + + CGPasses->doInitialization(); + for (Module::iterator + it = M->begin(), e = M->end(); it != e; ++it) + if (!it->isDeclaration()) + CGPasses->run(*it); + CGPasses->doFinalization(); + delete Out; + return true; +} + +/// getNativeObjectFile - Generate native object file based from llvm +/// bitcode file. Return false in case of an error. +bool LTOBugPoint::getNativeObjectFile(std::string &FileName) { + + std::auto_ptr M; + MemoryBuffer *Buffer + = MemoryBuffer::getFile(FileName.c_str(), &ErrMsg); + if (!Buffer) { + ErrMsg = "Unable to read "; + ErrMsg += FileName; + return false; + } + M.reset(ParseBitcodeFile(Buffer, &ErrMsg)); + std::string TargetTriple = M->getTargetTriple(); + + sys::Path AsmFile(sys::Path::GetTemporaryDirectory()); + if(AsmFile.createTemporaryFileOnDisk(false, &ErrMsg)) + return false; + + if (assembleBitcode(M.get(), AsmFile.c_str()) == false) + return false; + + sys::Path NativeFile(sys::Path::GetTemporaryDirectory()); + if(NativeFile.createTemporaryFileOnDisk(false, &ErrMsg)) + return false; + + // find compiler driver + const sys::Path gcc = sys::Program::FindProgramByName("gcc"); + if ( gcc.isEmpty() ) { + ErrMsg = "can't locate gcc"; + return false; + } + + // build argument list + std::vector args; + args.push_back(gcc.c_str()); + if ( TargetTriple.find("darwin") != TargetTriple.size() ) { + if (strncmp(TargetTriple.c_str(), "i686-apple-", 11) == 0) { + args.push_back("-arch"); + args.push_back("i386"); + } + else if (strncmp(TargetTriple.c_str(), "x86_64-apple-", 13) == 0) { + args.push_back("-arch"); + args.push_back("x86_64"); + } + else if (strncmp(TargetTriple.c_str(), "powerpc-apple-", 14) == 0) { + args.push_back("-arch"); + args.push_back("ppc"); + } + else if (strncmp(TargetTriple.c_str(), "powerpc64-apple-", 16) == 0) { + args.push_back("-arch"); + args.push_back("ppc64"); + } + } + args.push_back("-c"); + args.push_back("-x"); + args.push_back("assembler"); + args.push_back("-o"); + args.push_back(NativeFile.c_str()); + args.push_back(AsmFile.c_str()); + args.push_back(0); + + // invoke assembler + if (sys::Program::ExecuteAndWait(gcc, &args[0], 0, 0, 0, 0, &ErrMsg)) { + ErrMsg = "error in assembly"; + return false; + } + return true; +} Modified: llvm/trunk/tools/lto-bugpoint/LTOBugPoint.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto-bugpoint/LTOBugPoint.h?rev=53886&r1=53885&r2=53886&view=diff ============================================================================== --- llvm/trunk/tools/lto-bugpoint/LTOBugPoint.h (original) +++ llvm/trunk/tools/lto-bugpoint/LTOBugPoint.h Mon Jul 21 18:04:39 2008 @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "llvm/ADT/SmallVector.h" +#include "llvm/Module.h" #include #include @@ -25,6 +26,13 @@ /// identified by the script. bool findTroubleMakers(llvm::SmallVector &TroubleMakers, std::string &Script); + + /// getNativeObjectFile - Generate native object file based from llvm + /// bitcode file. Return false in case of an error. + bool getNativeObjectFile(std::string &FileName); + + std::string &getErrMsg() { return ErrMsg; } + private: /// LinkerInputFiles - This is a list of linker input files. Once populated /// this list is not modified. @@ -39,4 +47,11 @@ /// at index 4 in NativeInputFiles is corresponding native object file. llvm::SmallVector NativeInputFiles; + std::string getFeatureString(const char *TargetTriple); + std::string ErrMsg; + +private: + /// assembleBitcode - Generate assembly code from the module. Return false + /// in case of an error. + bool assembleBitcode(llvm::Module *M, const char *AsmFileName); }; Modified: llvm/trunk/tools/lto-bugpoint/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto-bugpoint/Makefile?rev=53886&r1=53885&r2=53886&view=diff ============================================================================== --- llvm/trunk/tools/lto-bugpoint/Makefile (original) +++ llvm/trunk/tools/lto-bugpoint/Makefile Mon Jul 21 18:04:39 2008 @@ -10,7 +10,12 @@ TOOLNAME = lto-bugpoint -LINK_COMPONENTS := system +# Include this here so we can get the configuration of the targets +# that have been configured for construction. We have to do this +# early so we can set up LINK_COMPONENTS before including Makefile.rules +include $(LEVEL)/Makefile.config + +LINK_COMPONENTS := $(TARGETS_TO_BUILD) bitreader REQUIRES_EH := 1 Modified: llvm/trunk/tools/lto-bugpoint/lto-bugpoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto-bugpoint/lto-bugpoint.cpp?rev=53886&r1=53885&r2=53886&view=diff ============================================================================== --- llvm/trunk/tools/lto-bugpoint/lto-bugpoint.cpp (original) +++ llvm/trunk/tools/lto-bugpoint/lto-bugpoint.cpp Mon Jul 21 18:04:39 2008 @@ -51,8 +51,10 @@ LTOBugPoint bugFinder(*LinkerArgsFile, *LinkerInputsFile); llvm::SmallVector TroubleMakers; - if (!bugFinder.findTroubleMakers(TroubleMakers, ValidationScript)) + if (!bugFinder.findTroubleMakers(TroubleMakers, ValidationScript)) { + std::cerr << "lto-bugpoint:" << bugFinder.getErrMsg() << "\n"; return 1; + } return 0; } catch (const std::string& msg) { From gohman at apple.com Mon Jul 21 18:30:30 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 21 Jul 2008 23:30:30 -0000 Subject: [llvm-commits] [llvm] r53887 - in /llvm/trunk: include/llvm/Bitcode/LLVMBitCodes.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/Constants.cpp Message-ID: <200807212330.m6LNUVxU001349@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 18:30:30 2008 New Revision: 53887 URL: http://llvm.org/viewvc/llvm-project?rev=53887&view=rev Log: InsertValue and ExtractValue constant expressions are always folded. Remove code that handled the case where they aren't folded, and remove bitcode reader/writer support for them. Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=53887&r1=53886&r2=53887&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original) +++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Mon Jul 21 18:30:30 2008 @@ -125,9 +125,7 @@ CST_CODE_CE_INSERTELT = 15, // CE_INSERTELT: [opval, opval, opval] CST_CODE_CE_SHUFFLEVEC = 16, // CE_SHUFFLEVEC: [opval, opval, opval] CST_CODE_CE_CMP = 17, // CE_CMP: [opty, opval, opval, pred] - CST_CODE_INLINEASM = 18, // INLINEASM: [sideeffect,asmstr,conststr] - CST_CODE_CE_EXTRACTVAL = 19, // CE_EXTRACTVAL: [n x operands] - CST_CODE_CE_INSERTVAL = 20 // CE_INSERTVAL: [n x operands] + CST_CODE_INLINEASM = 18 // INLINEASM: [sideeffect,asmstr,conststr] }; /// CastOpcodes - These are values used in the bitcode files to encode which Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=53887&r1=53886&r2=53887&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Jul 21 18:30:30 2008 @@ -770,47 +770,6 @@ V = ConstantExpr::getGetElementPtr(Elts[0], &Elts[1], Elts.size()-1); break; } - case bitc::CST_CODE_CE_EXTRACTVAL: { - // CE_EXTRACTVAL: [opty, opval, n x indices] - const Type *AggTy = getTypeByID(Record[0]); - if (!AggTy || !AggTy->isAggregateType()) - return Error("Invalid CE_EXTRACTVAL record"); - Constant *Agg = ValueList.getConstantFwdRef(Record[1], AggTy); - SmallVector Indices; - for (unsigned i = 2, e = Record.size(); i != e; ++i) { - uint64_t Index = Record[i]; - if ((unsigned)Index != Index) - return Error("Invalid CE_EXTRACTVAL record"); - Indices.push_back((unsigned)Index); - } - if (!ExtractValueInst::getIndexedType(AggTy, - Indices.begin(), Indices.end())) - return Error("Invalid CE_EXTRACTVAL record"); - V = ConstantExpr::getExtractValue(Agg, &Indices[0], Indices.size()); - break; - } - case bitc::CST_CODE_CE_INSERTVAL: { - // CE_INSERTVAL: [opty, opval, opty, opval, n x indices] - const Type *AggTy = getTypeByID(Record[0]); - if (!AggTy || !AggTy->isAggregateType()) - return Error("Invalid CE_INSERTVAL record"); - Constant *Agg = ValueList.getConstantFwdRef(Record[1], AggTy); - const Type *ValTy = getTypeByID(Record[2]); - Constant *Val = ValueList.getConstantFwdRef(Record[3], ValTy); - SmallVector Indices; - for (unsigned i = 4, e = Record.size(); i != e; ++i) { - uint64_t Index = Record[i]; - if ((unsigned)Index != Index) - return Error("Invalid CE_INSERTVAL record"); - Indices.push_back((unsigned)Index); - } - if (ExtractValueInst::getIndexedType(AggTy, - Indices.begin(), - Indices.end()) != ValTy) - return Error("Invalid CE_INSERTVAL record"); - V = ConstantExpr::getInsertValue(Agg, Val, &Indices[0], Indices.size()); - break; - } case bitc::CST_CODE_CE_SELECT: // CE_SELECT: [opval#, opval#, opval#] if (Record.size() < 3) return Error("Invalid CE_SELECT record"); V = ConstantExpr::getSelect(ValueList.getConstantFwdRef(Record[0], Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=53887&r1=53886&r2=53887&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Mon Jul 21 18:30:30 2008 @@ -611,26 +611,6 @@ Record.push_back(VE.getValueID(C->getOperand(i))); } break; - case Instruction::ExtractValue: { - Code = bitc::CST_CODE_CE_EXTRACTVAL; - Record.push_back(VE.getTypeID(C->getOperand(0)->getType())); - Record.push_back(VE.getValueID(C->getOperand(0))); - const SmallVector &Indices = CE->getIndices(); - for (unsigned i = 0, e = Indices.size(); i != e; ++i) - Record.push_back(Indices[i]); - break; - } - case Instruction::InsertValue: { - Code = bitc::CST_CODE_CE_INSERTVAL; - Record.push_back(VE.getTypeID(C->getOperand(0)->getType())); - Record.push_back(VE.getValueID(C->getOperand(0))); - Record.push_back(VE.getTypeID(C->getOperand(1)->getType())); - Record.push_back(VE.getValueID(C->getOperand(1))); - const SmallVector &Indices = CE->getIndices(); - for (unsigned i = 0, e = Indices.size(); i != e; ++i) - Record.push_back(Indices[i]); - break; - } case Instruction::Select: Code = bitc::CST_CODE_CE_SELECT; Record.push_back(VE.getValueID(C->getOperand(0))); Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=53887&r1=53886&r2=53887&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Mon Jul 21 18:30:30 2008 @@ -857,19 +857,6 @@ Op1 = (OpNo == 1) ? Op : getOperand(1); Op2 = (OpNo == 2) ? Op : getOperand(2); return ConstantExpr::getShuffleVector(Op0, Op1, Op2); - case Instruction::InsertValue: { - const SmallVector &Indices = getIndices(); - Op0 = (OpNo == 0) ? Op : getOperand(0); - Op1 = (OpNo == 1) ? Op : getOperand(1); - return ConstantExpr::getInsertValue(Op0, Op1, - &Indices[0], Indices.size()); - } - case Instruction::ExtractValue: { - assert(OpNo == 0 && "ExtractaValue has only one operand!"); - const SmallVector &Indices = getIndices(); - return - ConstantExpr::getExtractValue(Op, &Indices[0], Indices.size()); - } case Instruction::GetElementPtr: { SmallVector Ops; Ops.resize(getNumOperands()-1); @@ -925,16 +912,6 @@ return ConstantExpr::getExtractElement(Ops[0], Ops[1]); case Instruction::ShuffleVector: return ConstantExpr::getShuffleVector(Ops[0], Ops[1], Ops[2]); - case Instruction::InsertValue: { - const SmallVector &Indices = getIndices(); - return ConstantExpr::getInsertValue(Ops[0], Ops[1], - &Indices[0], Indices.size()); - } - case Instruction::ExtractValue: { - const SmallVector &Indices = getIndices(); - return ConstantExpr::getExtractValue(Ops[0], - &Indices[0], Indices.size()); - } case Instruction::GetElementPtr: return ConstantExpr::getGetElementPtr(Ops[0], &Ops[1], Ops.size()-1); case Instruction::ICmp: @@ -2365,15 +2342,9 @@ "insertvalue type invalid!"); assert(Agg->getType()->isFirstClassType() && "Non-first-class type for constant InsertValue expression"); - if (Constant *FC = ConstantFoldInsertValueInstruction(Agg, Val, Idxs, NumIdx)) - return FC; // Fold a few common cases... - // Look up the constant in the table first to ensure uniqueness - std::vector ArgVec; - ArgVec.push_back(Agg); - ArgVec.push_back(Val); - SmallVector Indices(Idxs, Idxs + NumIdx); - const ExprMapKeyType Key(Instruction::InsertValue, ArgVec, 0, Indices); - return ExprConstants->getOrCreate(ReqTy, Key); + Constant *FC = ConstantFoldInsertValueInstruction(Agg, Val, Idxs, NumIdx); + assert(FC && "InsertValue constant expr couldn't be folded!"); + return FC; } Constant *ConstantExpr::getInsertValue(Constant *Agg, Constant *Val, @@ -2395,14 +2366,9 @@ "extractvalue indices invalid!"); assert(Agg->getType()->isFirstClassType() && "Non-first-class type for constant extractvalue expression"); - if (Constant *FC = ConstantFoldExtractValueInstruction(Agg, Idxs, NumIdx)) - return FC; // Fold a few common cases... - // Look up the constant in the table first to ensure uniqueness - std::vector ArgVec; - ArgVec.push_back(Agg); - SmallVector Indices(Idxs, Idxs + NumIdx); - const ExprMapKeyType Key(Instruction::ExtractValue, ArgVec, 0, Indices); - return ExprConstants->getOrCreate(ReqTy, Key); + Constant *FC = ConstantFoldExtractValueInstruction(Agg, Idxs, NumIdx); + assert(FC && "ExtractValue constant expr couldn't be folded!"); + return FC; } Constant *ConstantExpr::getExtractValue(Constant *Agg, From bruno.cardoso at gmail.com Mon Jul 21 18:47:36 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Mon, 21 Jul 2008 20:47:36 -0300 Subject: [llvm-commits] small bss and data support for elf asm In-Reply-To: <275e64e40807211637s787fd00eu11ec2c8fa91b1c71@mail.gmail.com> References: <275e64e40807211637s787fd00eu11ec2c8fa91b1c71@mail.gmail.com> Message-ID: <275e64e40807211647i38c92b3ew4dcc30a64de4a456@mail.gmail.com> Basic support for Small bss and data. The rest is implemented with target specific logic and will be commited as soon as it's ok to commit this patch. -- Bruno Cardoso Lopes http://www.brunocardoso.cc "When faced with untenable alternatives, you should consider your imperative." -------------- next part -------------- A non-text attachment was scrubbed... Name: smallsections.patch Type: application/octet-stream Size: 2453 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080721/6c29f1fb/attachment.obj From isanbard at gmail.com Mon Jul 21 19:28:48 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Jul 2008 00:28:48 -0000 Subject: [llvm-commits] [llvm] r53889 - /llvm/trunk/lib/CodeGen/DwarfWriter.cpp Message-ID: <200807220028.m6M0Sm3D003917@zion.cs.uiuc.edu> Author: void Date: Mon Jul 21 19:28:47 2008 New Revision: 53889 URL: http://llvm.org/viewvc/llvm-project?rev=53889&view=rev Log: Trivial check-in to test buildbot. No functionality change. Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=53889&r1=53888&r2=53889&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Mon Jul 21 19:28:47 2008 @@ -3847,11 +3847,12 @@ IndentCount += 2; for (unsigned i = 0, N = Data.size(); i < N; ++i) { O << Indent; - if (!isBlock) { + + if (!isBlock) O << AttributeString(Data[i].getAttribute()); - } else { + else O << "Blk[" << i << "]"; - } + O << " " << FormEncodingString(Data[i].getForm()) << " "; From gohman at apple.com Mon Jul 21 19:36:51 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 22 Jul 2008 00:36:51 -0000 Subject: [llvm-commits] [llvm] r53890 - /llvm/trunk/lib/VMCore/AutoUpgrade.cpp Message-ID: <200807220036.m6M0aqYE004452@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 19:36:48 2008 New Revision: 53890 URL: http://llvm.org/viewvc/llvm-project?rev=53890&view=rev Log: Fix multiple-return-value-to-first-class-aggregates autoupgrade to correctly handle the case where multiple-return-value constructs were used to return one or zero values. Modified: llvm/trunk/lib/VMCore/AutoUpgrade.cpp Modified: llvm/trunk/lib/VMCore/AutoUpgrade.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AutoUpgrade.cpp?rev=53890&r1=53889&r2=53890&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AutoUpgrade.cpp (original) +++ llvm/trunk/lib/VMCore/AutoUpgrade.cpp Mon Jul 21 19:36:48 2008 @@ -420,12 +420,15 @@ /// function to use aggregate return values built with insertvalue /// instructions. void llvm::UpgradeMultipleReturnValues(Function *CurrentFunction) { + const Type *ReturnType = CurrentFunction->getReturnType(); for (Function::iterator I = CurrentFunction->begin(), E = CurrentFunction->end(); I != E; ++I) { BasicBlock *BB = I; if (ReturnInst *RI = dyn_cast(BB->getTerminator())) { unsigned NumVals = RI->getNumOperands(); - if (NumVals > 1) { + if (NumVals > 1 || + (isa(ReturnType) && + (NumVals == 0 || RI->getOperand(0)->getType() != ReturnType))) { std::vector Types(NumVals); for (unsigned i = 0; i != NumVals; ++i) Types[i] = RI->getOperand(i)->getType(); From kremenek at apple.com Mon Jul 21 19:47:11 2008 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 22 Jul 2008 00:47:11 -0000 Subject: [llvm-commits] [llvm] r53892 - /llvm/tags/checker/checker-66/ Message-ID: <200807220047.m6M0lBh4005105@zion.cs.uiuc.edu> Author: kremenek Date: Mon Jul 21 19:47:11 2008 New Revision: 53892 URL: http://llvm.org/viewvc/llvm-project?rev=53892&view=rev Log: Tagging checker-66. Added: llvm/tags/checker/checker-66/ - copied from r53891, llvm/trunk/ From gohman at apple.com Mon Jul 21 19:52:07 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 22 Jul 2008 00:52:07 -0000 Subject: [llvm-commits] [llvm] r53894 - /llvm/trunk/lib/Target/TargetMachineRegistry.cpp Message-ID: <200807220052.m6M0q8B4005323@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 19:52:04 2008 New Revision: 53894 URL: http://llvm.org/viewvc/llvm-project?rev=53894&view=rev Log: Fix a typo in a comment. Modified: llvm/trunk/lib/Target/TargetMachineRegistry.cpp Modified: llvm/trunk/lib/Target/TargetMachineRegistry.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachineRegistry.cpp?rev=53894&r1=53893&r2=53894&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetMachineRegistry.cpp (original) +++ llvm/trunk/lib/Target/TargetMachineRegistry.cpp Mon Jul 21 19:52:04 2008 @@ -42,7 +42,7 @@ } else if (UsableTargets.size() == 1) return UsableTargets.back().second; - // Otherwise, take the best target, but make sure we don't have to equally + // Otherwise, take the best target, but make sure we don't have two equally // good best targets. std::sort(UsableTargets.begin(), UsableTargets.end()); if (UsableTargets.back().first ==UsableTargets[UsableTargets.size()-2].first){ From gohman at apple.com Mon Jul 21 19:52:54 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 22 Jul 2008 00:52:54 -0000 Subject: [llvm-commits] [llvm] r53895 - /llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Message-ID: <200807220052.m6M0qsq4005354@zion.cs.uiuc.edu> Author: djg Date: Mon Jul 21 19:52:54 2008 New Revision: 53895 URL: http://llvm.org/viewvc/llvm-project?rev=53895&view=rev Log: Correct the name of MachineMemOperand's include guard. Modified: llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Modified: llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h?rev=53895&r1=53894&r2=53895&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineMemOperand.h Mon Jul 21 19:52:54 2008 @@ -13,8 +13,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_CODEGEN_MEMOPERAND_H -#define LLVM_CODEGEN_MEMOPERAND_H +#ifndef LLVM_CODEGEN_MACHINEMEMOPERAND_H +#define LLVM_CODEGEN_MACHINEMEMOPERAND_H namespace llvm { From isanbard at gmail.com Mon Jul 21 19:53:37 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Jul 2008 00:53:37 -0000 Subject: [llvm-commits] [llvm] r53896 - /llvm/trunk/lib/CodeGen/DwarfWriter.cpp Message-ID: <200807220053.m6M0rbVr005389@zion.cs.uiuc.edu> Author: void Date: Mon Jul 21 19:53:37 2008 New Revision: 53896 URL: http://llvm.org/viewvc/llvm-project?rev=53896&view=rev Log: Another buildbot test commit. Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=53896&r1=53895&r2=53896&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Mon Jul 21 19:53:37 2008 @@ -3923,8 +3923,7 @@ DD->EndFunction(); DE->EndFunction(); - if (MachineModuleInfo *MMI = DD->getMMI() ? DD->getMMI() : DE->getMMI()) { + if (MachineModuleInfo *MMI = DD->getMMI() ? DD->getMMI() : DE->getMMI()) // Clear function debug information. MMI->EndFunction(); - } } From isanbard at gmail.com Mon Jul 21 20:10:25 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Jul 2008 01:10:25 -0000 Subject: [llvm-commits] [llvm] r53898 - /llvm/trunk/docs/GettingStarted.html Message-ID: <200807220110.m6M1APR3005926@zion.cs.uiuc.edu> Author: void Date: Mon Jul 21 20:10:25 2008 New Revision: 53898 URL: http://llvm.org/viewvc/llvm-project?rev=53898&view=rev Log: Fix grammar. Modified: llvm/trunk/docs/GettingStarted.html Modified: llvm/trunk/docs/GettingStarted.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GettingStarted.html?rev=53898&r1=53897&r2=53898&view=diff ============================================================================== --- llvm/trunk/docs/GettingStarted.html (original) +++ llvm/trunk/docs/GettingStarted.html Mon Jul 21 20:10:25 2008 @@ -1616,7 +1616,7 @@

-

This document is just an introduction to how to use LLVM to do +

This document is just an introduction on how to use LLVM to do some simple things... there are many more interesting and complicated things that you can do that aren't documented here (but we'll gladly accept a patch if you want to write something up!). For more information about LLVM, check From isanbard at gmail.com Mon Jul 21 20:37:48 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Jul 2008 01:37:48 -0000 Subject: [llvm-commits] [llvm] r53900 - /llvm/trunk/docs/HowToReleaseLLVM.html Message-ID: <200807220137.m6M1bm38007048@zion.cs.uiuc.edu> Author: void Date: Mon Jul 21 20:37:48 2008 New Revision: 53900 URL: http://llvm.org/viewvc/llvm-project?rev=53900&view=rev Log: Remove references to llvm-gcc-4.0 Modified: llvm/trunk/docs/HowToReleaseLLVM.html Modified: llvm/trunk/docs/HowToReleaseLLVM.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/HowToReleaseLLVM.html?rev=53900&r1=53899&r2=53900&view=diff ============================================================================== --- llvm/trunk/docs/HowToReleaseLLVM.html (original) +++ llvm/trunk/docs/HowToReleaseLLVM.html Mon Jul 21 20:37:48 2008 @@ -105,19 +105,16 @@

Request all developers to refrain from committing. Offenders get commit rights taken away (temporarily).

  • -

    Create the release branch for llvm, llvm-gcc4.0, - llvm-gcc4.2, and the test-suite. The - branch name will be release_XX, where XX is the major and - minor release numbers. These branches can be created without checking out - anything from subversion. +

    Create the release branch for llvm, llvm-gcc4.2, and + the test-suite. The branch name will be release_XX, + where XX is the major and minor release numbers. These branches can + be created without checking out anything from subversion.

     svn copy https://llvm.org/svn/llvm-project/llvm/trunk \
              https://llvm.org/svn/llvm-project/llvm/branches/release_XX
    -svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.0/trunk \
    -         https://llvm.org/svn/llvm-project/llvm-gcc-4.0/branches/release_XX
     svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk \
              https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX
     svn copy https://llvm.org/svn/llvm-project/test-suite/trunk \
    @@ -136,7 +133,6 @@
     
     svn co https://llvm.org/svn/llvm-project/llvm/branches/release_XX
    -svn co https://llvm.org/svn/llvm-project/llvm-gcc-4.0/branches/release_XX
     svn co https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX
     svn co https://llvm.org/svn/llvm-project/test-suite/branches/release_XX
     
    @@ -172,12 +168,10 @@
     svn export https://llvm.org/svn/llvm-project/llvm/branches/release_XX llvm-X.X
    -svn export https://llvm.org/svn/llvm-project/llvm-gcc-4.0/branches/release_XX llvm-gcc4.0-X.X.source
     svn export https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX llvm-gcc4.2-X.X.source
     svn export https://llvm.org/svn/llvm-project/test-suite/branches/release_XX llvm-test-X.X
     tar -cvf - llvm-X.X          | gzip > llvm-X.X.tar.gz
     tar -cvf - llvm-test-X.X     | gzip > llvm-test-X.X.tar.gz
    -tar -cvf - llvm-gcc4.0-X.X.source | gzip > llvm-gcc-4.0-X.X.source.tar.gz
     tar -cvf - llvm-gcc4.2-X.X.source | gzip > llvm-gcc-4.2-X.X.source.tar.gz
     
    @@ -316,8 +310,6 @@
     svn copy https://llvm.org/svn/llvm-project/llvm/branches/release_XX \
              https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_XX
    -svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.0/branches/release_XX \
    -         https://llvm.org/svn/llvm-project/llvm-gcc-4.0/tags/RELEASE_XX
     svn copy https://llvm.org/svn/llvm-project/llvm-gcc-4.2/branches/release_XX \
              https://llvm.org/svn/llvm-project/llvm-gcc-4.2/tags/RELEASE_XX
     svn copy https://llvm.org/svn/llvm-project/test-suite/branches/release_XX \
    
    
    
    
    From isanbard at gmail.com  Tue Jul 22 01:46:19 2008
    From: isanbard at gmail.com (Bill Wendling)
    Date: Tue, 22 Jul 2008 06:46:19 -0000
    Subject: [llvm-commits] [llvm] r53901 - /llvm/trunk/docs/Lexicon.html
    Message-ID: <200807220646.m6M6kKp5016477@zion.cs.uiuc.edu>
    
    Author: void
    Date: Tue Jul 22 01:46:17 2008
    New Revision: 53901
    
    URL: http://llvm.org/viewvc/llvm-project?rev=53901&view=rev
    Log:
    Use — because.
    
    Modified:
        llvm/trunk/docs/Lexicon.html
    
    Modified: llvm/trunk/docs/Lexicon.html
    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Lexicon.html?rev=53901&r1=53900&r2=53901&view=diff
    
    ==============================================================================
    --- llvm/trunk/docs/Lexicon.html (original)
    +++ llvm/trunk/docs/Lexicon.html Tue Jul 22 01:46:17 2008
    @@ -91,7 +91,7 @@
     
    BURS
    -
    Bottom Up Rewriting System - A method of instruction selection for +
    Bottom Up Rewriting System—A method of instruction selection for code generation. An example is the BURG tool.
    From isanbard at gmail.com Tue Jul 22 02:14:12 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Jul 2008 07:14:12 -0000 Subject: [llvm-commits] [llvm] r53902 - /llvm/trunk/include/llvm/Instructions.h Message-ID: <200807220714.m6M7ECtx017256@zion.cs.uiuc.edu> Author: void Date: Tue Jul 22 02:14:12 2008 New Revision: 53902 URL: http://llvm.org/viewvc/llvm-project?rev=53902&view=rev Log: Removing tabs. Modified: llvm/trunk/include/llvm/Instructions.h Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=53902&r1=53901&r2=53902&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Tue Jul 22 02:14:12 2008 @@ -1638,8 +1638,8 @@ const std::string &Name, Instruction *InsertBefore) : UnaryInstruction(checkType(getIndexedType(Agg->getType(), - IdxBegin, IdxEnd)), - ExtractValue, Agg, InsertBefore) { + IdxBegin, IdxEnd)), + ExtractValue, Agg, InsertBefore) { init(IdxBegin, IdxEnd, Name, typename std::iterator_traits::iterator_category()); } @@ -1650,8 +1650,8 @@ const std::string &Name, BasicBlock *InsertAtEnd) : UnaryInstruction(checkType(getIndexedType(Agg->getType(), - IdxBegin, IdxEnd)), - ExtractValue, Agg, InsertAtEnd) { + IdxBegin, IdxEnd)), + ExtractValue, Agg, InsertAtEnd) { init(IdxBegin, IdxEnd, Name, typename std::iterator_traits::iterator_category()); } From asl at math.spbu.ru Tue Jul 22 02:51:15 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 22 Jul 2008 11:51:15 +0400 Subject: [llvm-commits] small bss and data support for elf asm In-Reply-To: <275e64e40807211647i38c92b3ew4dcc30a64de4a456@mail.gmail.com> References: <275e64e40807211637s787fd00eu11ec2c8fa91b1c71@mail.gmail.com> <275e64e40807211647i38c92b3ew4dcc30a64de4a456@mail.gmail.com> Message-ID: <1216713075.14525.80.camel@localhost> Hi, Bruno > + SmallData, ///< Small data section > + SmallBSS, ///< Small bss section What's about SmallROData? > + const char *SmallDataSection; // Defaults to NULL You don't need these ones currently. Underscored versions were added to do transparent migration from old printing mechanism to new. Later const char* versions will be dropped. As no code uses small sections currently, you don't need const char versions at all. > + const Section *SmallDataSection_; > + > + /// SmallBSSSection - This is the directive that is emitted to > switch to a > + /// small bss section. > + /// > + const char *SmallBSSSection; // Defaults to NULL Same here. In general - you're going in right direction, please fix and commit! -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From isanbard at gmail.com Tue Jul 22 03:50:45 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Jul 2008 08:50:45 -0000 Subject: [llvm-commits] [llvm] r53903 - /llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td Message-ID: <200807220850.m6M8ojCl031032@zion.cs.uiuc.edu> Author: void Date: Tue Jul 22 03:50:44 2008 New Revision: 53903 URL: http://llvm.org/viewvc/llvm-project?rev=53903&view=rev Log: More tab removals. Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td?rev=53903&r1=53902&r2=53903&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td (original) +++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td Tue Jul 22 03:50:44 2008 @@ -3130,12 +3130,12 @@ Pat<(select (inttype (cond rclass:$rA, rclass:$rB)), rclass:$rTrue, rclass:$rFalse), (selinstr rclass:$rTrue, rclass:$rFalse, - (cmpare rclass:$rA, rclass:$rB))>; + (cmpare rclass:$rA, rclass:$rB))>; class SELECTNegCondImm: Pat<(select (inttype (cond rclass:$rA, immpred:$imm)), - rclass:$rTrue, rclass:$rFalse), + rclass:$rTrue, rclass:$rFalse), (selinstr rclass:$rTrue, rclass:$rFalse, (cmpare rclass:$rA, immpred:$imm))>; @@ -3174,7 +3174,7 @@ SPUInstr selinstr, SPUInstr binop, SPUInstr cmpOp1, SPUInstr cmpOp2>: Pat<(select (inttype (cond rclass:$rA, (inttype immpred:$imm))), - rclass:$rTrue, rclass:$rFalse), + rclass:$rTrue, rclass:$rFalse), (selinstr rclass:$rFalse, rclass:$rTrue, (binop (cmpOp1 rclass:$rA, (inttype immpred:$imm)), (cmpOp2 rclass:$rA, (inttype immpred:$imm))))>; From isanbard at gmail.com Tue Jul 22 03:54:38 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Jul 2008 08:54:38 -0000 Subject: [llvm-commits] [llvm] r53904 - /llvm/trunk/lib/Target/MSIL/README.TXT Message-ID: <200807220854.m6M8scFQ031199@zion.cs.uiuc.edu> Author: void Date: Tue Jul 22 03:54:38 2008 New Revision: 53904 URL: http://llvm.org/viewvc/llvm-project?rev=53904&view=rev Log: Remove another tab. Modified: llvm/trunk/lib/Target/MSIL/README.TXT Modified: llvm/trunk/lib/Target/MSIL/README.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/README.TXT?rev=53904&r1=53903&r2=53904&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSIL/README.TXT (original) +++ llvm/trunk/lib/Target/MSIL/README.TXT Tue Jul 22 03:54:38 2008 @@ -20,7 +20,7 @@ dynamic library where function located. .method static hidebysig pinvokeimpl("msvcrt.dll" cdecl) - void free(void*) preservesig {} + void free(void*) preservesig {} From isanbard at gmail.com Tue Jul 22 04:08:07 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 22 Jul 2008 09:08:07 -0000 Subject: [llvm-commits] [llvm] r53905 - /llvm/trunk/tools/lto-bugpoint/LTOBugPoint.cpp Message-ID: <200807220908.m6M987Ba032079@zion.cs.uiuc.edu> Author: void Date: Tue Jul 22 04:08:05 2008 New Revision: 53905 URL: http://llvm.org/viewvc/llvm-project?rev=53905&view=rev Log: Remove more tabs. Modified: llvm/trunk/tools/lto-bugpoint/LTOBugPoint.cpp Modified: llvm/trunk/tools/lto-bugpoint/LTOBugPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto-bugpoint/LTOBugPoint.cpp?rev=53905&r1=53904&r2=53905&view=diff ============================================================================== --- llvm/trunk/tools/lto-bugpoint/LTOBugPoint.cpp (original) +++ llvm/trunk/tools/lto-bugpoint/LTOBugPoint.cpp Tue Jul 22 04:08:05 2008 @@ -52,7 +52,7 @@ /// identified by the script. bool LTOBugPoint::findTroubleMakers(SmallVector &TroubleMakers, - std::string &Script) { + std::string &Script) { // First, build native object files set. bool bitcodeFileSeen = false; @@ -68,7 +68,7 @@ else if (InputFile.isBitcodeFile()) { bitcodeFileSeen = true; if (getNativeObjectFile(FileName) == false) - return false; + return false; } else NativeInputFiles.push_back(FileName); @@ -133,7 +133,7 @@ std::ofstream *Out = new std::ofstream(AsmFileName, std::ios::out); switch (Target->addPassesToEmitFile(*CGPasses, *Out, - TargetMachine::AssemblyFile, true)) { + TargetMachine::AssemblyFile, true)) { case FileModel::MachOFile: mce = AddMachOWriter(*CGPasses, *Out, *Target); break; @@ -155,7 +155,7 @@ CGPasses->doInitialization(); for (Module::iterator - it = M->begin(), e = M->end(); it != e; ++it) + it = M->begin(), e = M->end(); it != e; ++it) if (!it->isDeclaration()) CGPasses->run(*it); CGPasses->doFinalization(); From bruno.cardoso at gmail.com Tue Jul 22 10:26:56 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Tue, 22 Jul 2008 15:26:56 -0000 Subject: [llvm-commits] [llvm] r53907 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/TargetAsmInfo.cpp Message-ID: <200807221526.m6MFQvFE013186@zion.cs.uiuc.edu> Author: bruno Date: Tue Jul 22 10:26:53 2008 New Revision: 53907 URL: http://llvm.org/viewvc/llvm-project?rev=53907&view=rev Log: Basic support for small sections Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/Target/TargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=53907&r1=53906&r2=53907&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Tue Jul 22 10:26:53 2008 @@ -39,6 +39,9 @@ ROData, ///< Readonly data section RODataMergeStr, ///< Readonly data section (mergeable strings) RODataMergeConst, ///< Readonly data section (mergeable constants) + SmallData, ///< Small data section + SmallBSS, ///< Small bss section + SmallROData, ///< Small readonly section ThreadData, ///< Initialized TLS data objects ThreadBSS ///< Uninitialized TLS data objects }; @@ -119,6 +122,21 @@ const char *ReadOnlySection; // Defaults to NULL const Section *ReadOnlySection_; + /// SmallDataSection - This is the directive that is emitted to switch to a + /// small data section. + /// + const Section *SmallDataSection; // Defaults to NULL + + /// SmallBSSSection - This is the directive that is emitted to switch to a + /// small bss section. + /// + const Section *SmallBSSSection; // Defaults to NULL + + /// SmallRODataSection - This is the directive that is emitted to switch to + /// a small read-only data section. + /// + const Section *SmallRODataSection; // Defaults to NULL + /// TLSDataSection - Section directive for Thread Local data. /// const char *TLSDataSection;// Defaults to ".section .tdata,"awT", at progbits". @@ -549,6 +567,15 @@ const Section *getReadOnlySection_() const { return ReadOnlySection_; } + const Section *getSmallDataSection() const { + return SmallDataSection; + } + const Section *getSmallBSSSection() const { + return SmallBSSSection; + } + const Section *getSmallRODataSection() const { + return SmallRODataSection; + } const char *getTLSDataSection() const { return TLSDataSection; } Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=53907&r1=53906&r2=53907&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Tue Jul 22 10:26:53 2008 @@ -34,6 +34,9 @@ BSSSection_(0), ReadOnlySection(0), ReadOnlySection_(0), + SmallDataSection(0), + SmallBSSSection(0), + SmallRODataSection(0), TLSDataSection("\t.section .tdata,\"awT\", at progbits"), TLSDataSection_(0), TLSBSSSection("\t.section .tbss,\"awT\", at nobits"), From bruno.cardoso at gmail.com Tue Jul 22 10:28:52 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Tue, 22 Jul 2008 12:28:52 -0300 Subject: [llvm-commits] small bss and data support for elf asm In-Reply-To: <1216713075.14525.80.camel@localhost> References: <275e64e40807211637s787fd00eu11ec2c8fa91b1c71@mail.gmail.com> <275e64e40807211647i38c92b3ew4dcc30a64de4a456@mail.gmail.com> <1216713075.14525.80.camel@localhost> Message-ID: <275e64e40807220828w49f61c97q27f0147e08043de1@mail.gmail.com> On Tue, Jul 22, 2008 at 4:51 AM, Anton Korobeynikov wrote: > Hi, Bruno > >> + SmallData, ///< Small data section >> + SmallBSS, ///< Small bss section > What's about SmallROData? > >> + const char *SmallDataSection; // Defaults to NULL > You don't need these ones currently. Underscored versions were added to > do transparent migration from old printing mechanism to new. Later const > char* versions will be dropped. > > As no code uses small sections currently, you don't need const char > versions at all. > >> + const Section *SmallDataSection_; >> + >> + /// SmallBSSSection - This is the directive that is emitted to >> switch to a >> + /// small bss section. >> + /// >> + const char *SmallBSSSection; // Defaults to NULL > Same here. > > In general - you're going in right direction, please fix and commit! done. -- Bruno Cardoso Lopes http://www.brunocardoso.cc "When faced with untenable alternatives, you should consider your imperative." From bruno.cardoso at gmail.com Tue Jul 22 10:34:39 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Tue, 22 Jul 2008 15:34:39 -0000 Subject: [llvm-commits] [llvm] r53908 - in /llvm/trunk/lib/Target/Mips: MipsISelLowering.cpp MipsTargetAsmInfo.cpp MipsTargetAsmInfo.h Message-ID: <200807221534.m6MFYhGE013507@zion.cs.uiuc.edu> Author: bruno Date: Tue Jul 22 10:34:27 2008 New Revision: 53908 URL: http://llvm.org/viewvc/llvm-project?rev=53908&view=rev Log: Added small section asm emition logic for mips. Fixed small bug. Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=53908&r1=53907&r2=53908&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Tue Jul 22 10:34:27 2008 @@ -241,10 +241,11 @@ bool MipsTargetLowering::IsGlobalInSmallSection(GlobalValue *GV) { const TargetData *TD = getTargetData(); - const Value *V = dyn_cast(GV); - const GlobalVariable *GVA = dyn_cast(V); + const GlobalVariable *GVA = dyn_cast(GV); + + if (!GVA) + return false; - //const PointerType *PTy = GV->getType(); const Type *Ty = GV->getType()->getElementType(); unsigned Size = TD->getABITypeSize(Ty); Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp?rev=53908&r1=53907&r2=53908&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Tue Jul 22 10:34:27 2008 @@ -19,6 +19,8 @@ MipsTargetAsmInfo::MipsTargetAsmInfo(const MipsTargetMachine &TM): ELFTargetAsmInfo(TM) { + MipsTM = &TM; + AlignmentIsInBytes = false; COMMDirectiveTakesAlignment = true; Data16bitsDirective = "\t.half\t"; @@ -37,5 +39,66 @@ JumpTableDirective = "\t.word\t"; else JumpTableDirective = "\t.gpword\t"; + + SmallDataSection = getNamedSection("\t.sdata", SectionFlags::Writeable); + SmallBSSSection = getNamedSection("\t.sbss", + SectionFlags::Writeable | SectionFlags::BSS); +} + +static bool isSuitableForBSS(const GlobalVariable *GV) { + if (!GV->hasInitializer()) + return true; + + // Leave constant zeros in readonly constant sections, so they can be shared + Constant *C = GV->getInitializer(); + return (C->isNullValue() && !GV->isConstant() && !NoZerosInBSS); +} + +SectionKind::Kind +MipsTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const { + const TargetData *TD = ETM->getTargetData(); + const GlobalVariable *GVA = dyn_cast(GV); + + if (!GVA) + return ELFTargetAsmInfo::SectionKindForGlobal(GV); + + // if this is a internal constant string, there is a special + // section for it, but not in small data/bss. + if (GVA->hasInitializer() && GV->hasInternalLinkage()) { + Constant *C = GVA->getInitializer(); + const ConstantArray *CVA = dyn_cast(C); + if (CVA && CVA->isCString()) + return ELFTargetAsmInfo::SectionKindForGlobal(GV); + } + + const Type *Ty = GV->getType()->getElementType(); + unsigned Size = TD->getABITypeSize(Ty); + unsigned Threshold = + MipsTM->getSubtarget().getSSectionThreshold(); + + if (Size > 0 && Size <= Threshold) { + if (isSuitableForBSS(GVA)) + return SectionKind::SmallBSS; + else + return SectionKind::SmallData; + } + + return ELFTargetAsmInfo::SectionKindForGlobal(GV); +} + +const Section* +MipsTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { + SectionKind::Kind K = SectionKindForGlobal(GV); + const GlobalVariable *GVA = dyn_cast(GV); + + if (GVA && (!GVA->isWeakForLinker())) + switch (K) { + case SectionKind::SmallData: + return getSmallDataSection(); + case SectionKind::SmallBSS: + return getSmallBSSSection(); + default: break; + } + return ELFTargetAsmInfo::SelectSectionForGlobal(GV); } Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h?rev=53908&r1=53907&r2=53908&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.h Tue Jul 22 10:34:27 2008 @@ -16,6 +16,9 @@ #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Target/ELFTargetAsmInfo.h" +#include "llvm/DerivedTypes.h" +#include "llvm/GlobalVariable.h" +#include "llvm/Target/TargetOptions.h" namespace llvm { @@ -24,6 +27,17 @@ struct MipsTargetAsmInfo : public ELFTargetAsmInfo { explicit MipsTargetAsmInfo(const MipsTargetMachine &TM); + + /// SectionKindForGlobal - This hook allows the target to select proper + /// section kind used for global emission. + virtual SectionKind::Kind + SectionKindForGlobal(const GlobalValue *GV) const; + + virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const; + + private: + const MipsTargetMachine *MipsTM; + }; } // namespace llvm From asl at math.spbu.ru Tue Jul 22 11:22:48 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 22 Jul 2008 16:22:48 -0000 Subject: [llvm-commits] [llvm] r53911 - /llvm/trunk/lib/Target/X86/X86InstrInfo.td Message-ID: <200807221622.m6MGMm67015996@zion.cs.uiuc.edu> Author: asl Date: Tue Jul 22 11:22:48 2008 New Revision: 53911 URL: http://llvm.org/viewvc/llvm-project?rev=53911&view=rev Log: Fix encoding of atomic compare and swap for i64 Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=53911&r1=53910&r2=53911&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Jul 22 11:22:48 2008 @@ -2594,7 +2594,7 @@ [(X86cas addr:$ptr, GR32:$swap, 4)]>, TB, LOCK; } let Defs = [EAX, EBX, ECX, EDX, EFLAGS], Uses = [EAX, EBX, ECX, EDX] in { -def LCMPXCHG8B : I<0xC7, MRMDestMem, (outs), (ins i32mem:$ptr), +def LCMPXCHG8B : I<0xC7, MRM1m, (outs), (ins i32mem:$ptr), "lock cmpxchg8b\t$ptr", [(X86cas8 addr:$ptr)]>, TB, LOCK; } From bruno.cardoso at gmail.com Tue Jul 22 11:24:21 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Tue, 22 Jul 2008 16:24:21 -0000 Subject: [llvm-commits] [llvm] r53912 - /llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Message-ID: <200807221624.m6MGOLrk016155@zion.cs.uiuc.edu> Author: bruno Date: Tue Jul 22 11:24:21 2008 New Revision: 53912 URL: http://llvm.org/viewvc/llvm-project?rev=53912&view=rev Log: simplified small section logic Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp?rev=53912&r1=53911&r2=53912&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetAsmInfo.cpp Tue Jul 22 11:24:21 2008 @@ -45,45 +45,29 @@ SectionFlags::Writeable | SectionFlags::BSS); } -static bool isSuitableForBSS(const GlobalVariable *GV) { - if (!GV->hasInitializer()) - return true; - - // Leave constant zeros in readonly constant sections, so they can be shared - Constant *C = GV->getInitializer(); - return (C->isNullValue() && !GV->isConstant() && !NoZerosInBSS); -} - SectionKind::Kind MipsTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const { - const TargetData *TD = ETM->getTargetData(); - const GlobalVariable *GVA = dyn_cast(GV); + SectionKind::Kind K = ELFTargetAsmInfo::SectionKindForGlobal(GV); - if (!GVA) - return ELFTargetAsmInfo::SectionKindForGlobal(GV); - - // if this is a internal constant string, there is a special - // section for it, but not in small data/bss. - if (GVA->hasInitializer() && GV->hasInternalLinkage()) { - Constant *C = GVA->getInitializer(); - const ConstantArray *CVA = dyn_cast(C); - if (CVA && CVA->isCString()) - return ELFTargetAsmInfo::SectionKindForGlobal(GV); - } - - const Type *Ty = GV->getType()->getElementType(); - unsigned Size = TD->getABITypeSize(Ty); - unsigned Threshold = - MipsTM->getSubtarget().getSSectionThreshold(); - - if (Size > 0 && Size <= Threshold) { - if (isSuitableForBSS(GVA)) - return SectionKind::SmallBSS; - else - return SectionKind::SmallData; + if (K != SectionKind::Data && K != SectionKind::BSS && + K != SectionKind::RODataMergeConst) + return K; + + if (isa(GV)) { + const TargetData *TD = ETM->getTargetData(); + unsigned Size = TD->getABITypeSize(GV->getType()->getElementType()); + unsigned Threshold = + MipsTM->getSubtarget().getSSectionThreshold(); + + if (Size > 0 && Size <= Threshold) { + if (K == SectionKind::BSS) + return SectionKind::SmallBSS; + else + return SectionKind::SmallData; + } } - return ELFTargetAsmInfo::SectionKindForGlobal(GV); + return K; } const Section* From kremenek at apple.com Tue Jul 22 11:56:46 2008 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 22 Jul 2008 16:56:46 -0000 Subject: [llvm-commits] [llvm] r53915 - /llvm/tags/checker/checker-66/ Message-ID: <200807221656.m6MGukIJ018075@zion.cs.uiuc.edu> Author: kremenek Date: Tue Jul 22 11:56:45 2008 New Revision: 53915 URL: http://llvm.org/viewvc/llvm-project?rev=53915&view=rev Log: Removing checker-66. Removed: llvm/tags/checker/checker-66/ From kremenek at apple.com Tue Jul 22 11:58:20 2008 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 22 Jul 2008 16:58:20 -0000 Subject: [llvm-commits] [llvm] r53917 - /llvm/tags/checker/checker-66/ Message-ID: <200807221658.m6MGwKeo018149@zion.cs.uiuc.edu> Author: kremenek Date: Tue Jul 22 11:58:20 2008 New Revision: 53917 URL: http://llvm.org/viewvc/llvm-project?rev=53917&view=rev Log: Tagging checker-66. Added: llvm/tags/checker/checker-66/ - copied from r53916, llvm/trunk/ From asl at math.spbu.ru Tue Jul 22 12:09:41 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 22 Jul 2008 17:09:41 -0000 Subject: [llvm-commits] [llvm] r53919 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/ELFTargetAsmInfo.cpp Message-ID: <200807221709.m6MH9fWu018555@zion.cs.uiuc.edu> Author: asl Date: Tue Jul 22 12:09:41 2008 New Revision: 53919 URL: http://llvm.org/viewvc/llvm-project?rev=53919&view=rev Log: Tie small stuff to non-small by default on ELF platforms Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=53919&r1=53918&r2=53919&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Tue Jul 22 12:09:41 2008 @@ -40,8 +40,8 @@ RODataMergeStr, ///< Readonly data section (mergeable strings) RODataMergeConst, ///< Readonly data section (mergeable constants) SmallData, ///< Small data section - SmallBSS, ///< Small bss section - SmallROData, ///< Small readonly section + SmallBSS, ///< Small bss section + SmallROData, ///< Small readonly section ThreadData, ///< Initialized TLS data objects ThreadBSS ///< Uninitialized TLS data objects }; @@ -58,6 +58,7 @@ const unsigned TLS = 1 << 5; ///< Section contains thread-local data const unsigned Debug = 1 << 6; ///< Section contains debug data const unsigned Linkonce = 1 << 7; ///< Section is linkonce + const unsigned Small = 1 << 8; ///< Section is small const unsigned TypeFlags = 0xFF; // Some gap for future flags const unsigned Named = 1 << 23; ///< Section is named Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=53919&r1=53918&r2=53919&view=diff ============================================================================== --- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Tue Jul 22 12:09:41 2008 @@ -63,11 +63,14 @@ } else { switch (Kind) { case SectionKind::Data: + case SectionKind::SmallData: return getDataSection_(); case SectionKind::BSS: + case SectionKind::SmallBSS: // ELF targets usually have BSS sections return getBSSSection_(); case SectionKind::ROData: + case SectionKind::SmallROData: return getReadOnlySection_(); case SectionKind::RODataMergeStr: return MergeableStringSection(GVar); @@ -147,6 +150,8 @@ Flags += 'S'; if (flags & SectionFlags::TLS) Flags += 'T'; + if (flags & SectionFlags::Small) + Flags += 's'; Flags += "\""; From asl at math.spbu.ru Tue Jul 22 12:10:00 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 22 Jul 2008 17:10:00 -0000 Subject: [llvm-commits] [llvm] r53920 - /llvm/trunk/lib/Target/TargetAsmInfo.cpp Message-ID: <200807221710.m6MHA0Rf018575@zion.cs.uiuc.edu> Author: asl Date: Tue Jul 22 12:09:59 2008 New Revision: 53920 URL: http://llvm.org/viewvc/llvm-project?rev=53920&view=rev Log: Provide default implementation of different small-sections related stuff Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=53920&r1=53919&r2=53920&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Tue Jul 22 12:09:59 2008 @@ -231,6 +231,13 @@ case SectionKind::RODataMergeConst: // No additional flags here break; + case SectionKind::SmallData: + case SectionKind::SmallBSS: + Flags |= SectionFlags::Writeable; + // FALLS THROUGH + case SectionKind::SmallROData: + Flags |= SectionFlags::Small; + break; default: assert(0 && "Unexpected section kind!"); } @@ -245,7 +252,9 @@ // Some lame default implementation based on some magic section names. if (strncmp(Name, ".gnu.linkonce.b.", 16) == 0 || - strncmp(Name, ".llvm.linkonce.b.", 17) == 0) + strncmp(Name, ".llvm.linkonce.b.", 17) == 0 || + strncmp(Name, ".gnu.linkonce.sb.", 17) == 0 || + strncmp(Name, ".llvm.linkonce.sb.", 18) == 0) Flags |= SectionFlags::BSS; else if (strcmp(Name, ".tdata") == 0 || strncmp(Name, ".tdata.", 7) == 0 || @@ -297,12 +306,15 @@ } else { if (Kind == SectionKind::Text) return getTextSection_(); - else if (Kind == SectionKind::BSS && getBSSSection_()) + else if ((Kind == SectionKind::BSS || + Kind == SectionKind::SmallBSS) && + getBSSSection_()) return getBSSSection_(); else if (getReadOnlySection_() && (Kind == SectionKind::ROData || Kind == SectionKind::RODataMergeConst || - Kind == SectionKind::RODataMergeStr)) + Kind == SectionKind::RODataMergeStr || + Kind == SectionKind::SmallROData)) return getReadOnlySection_(); } @@ -317,12 +329,18 @@ return ".gnu.linkonce.t." + GV->getName(); case SectionKind::Data: return ".gnu.linkonce.d." + GV->getName(); + case SectionKind::SmallData: + return ".gnu.linkonce.s." + GV->getName(); case SectionKind::BSS: return ".gnu.linkonce.b." + GV->getName(); + case SectionKind::SmallBSS: + return ".gnu.linkonce.sb." + GV->getName(); case SectionKind::ROData: case SectionKind::RODataMergeConst: case SectionKind::RODataMergeStr: return ".gnu.linkonce.r." + GV->getName(); + case SectionKind::SmallROData: + return ".gnu.linkonce.s2." + GV->getName(); case SectionKind::ThreadData: return ".gnu.linkonce.td." + GV->getName(); case SectionKind::ThreadBSS: From gohman at apple.com Tue Jul 22 12:53:07 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 22 Jul 2008 17:53:07 -0000 Subject: [llvm-commits] [llvm] r53923 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200807221753.m6MHr8LD019935@zion.cs.uiuc.edu> Author: djg Date: Tue Jul 22 12:52:59 2008 New Revision: 53923 URL: http://llvm.org/viewvc/llvm-project?rev=53923&view=rev Log: Make the GraphRoot edge look like a chain edge, which is more accurate, and use the right result number, in the off chance that the graph root has multiple result values. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=53923&r1=53922&r2=53923&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Tue Jul 22 12:52:59 2008 @@ -110,7 +110,8 @@ GraphWriter &GW) { GW.emitSimpleNode(0, "plaintext=circle", "GraphRoot"); if (G->getRoot().Val) - GW.emitEdge(0, -1, G->getRoot().Val, -1, ""); + GW.emitEdge(0, -1, G->getRoot().Val, G->getRoot().ResNo, + "color=blue,style=dashed"); } }; } From dpatel at apple.com Tue Jul 22 13:00:36 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 22 Jul 2008 18:00:36 -0000 Subject: [llvm-commits] [llvm] r53924 - /llvm/trunk/lib/System/Path.cpp Message-ID: <200807221800.m6MI0a69020174@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 22 13:00:36 2008 New Revision: 53924 URL: http://llvm.org/viewvc/llvm-project?rev=53924&view=rev Log: Handle bitcode wrappers. Modified: llvm/trunk/lib/System/Path.cpp Modified: llvm/trunk/lib/System/Path.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Path.cpp?rev=53924&r1=53923&r2=53924&view=diff ============================================================================== --- llvm/trunk/lib/System/Path.cpp (original) +++ llvm/trunk/lib/System/Path.cpp Tue Jul 22 13:00:36 2008 @@ -194,7 +194,10 @@ std::string actualMagic; if (!getMagicNumber(actualMagic, 4)) return false; - return actualMagic == "BC\xC0\xDE"; + LLVMFileType FT = + IdentifyFileType(actualMagic.c_str(), + static_cast(actualMagic.length())); + return FT == Bitcode_FileType; } bool Path::hasMagicNumber(const std::string &Magic) const { From gohman at apple.com Tue Jul 22 13:04:23 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 22 Jul 2008 18:04:23 -0000 Subject: [llvm-commits] [llvm] r53925 - /llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Message-ID: <200807221804.m6MI4Ntc020299@zion.cs.uiuc.edu> Author: djg Date: Tue Jul 22 13:04:23 2008 New Revision: 53925 URL: http://llvm.org/viewvc/llvm-project?rev=53925&view=rev Log: Assert that the DAG root value is a chain value. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=53925&r1=53924&r2=53925&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Tue Jul 22 13:04:23 2008 @@ -19,6 +19,7 @@ #include "llvm/ADT/StringMap.h" #include "llvm/CodeGen/SelectionDAGNodes.h" +#include #include #include #include @@ -127,7 +128,11 @@ /// setRoot - Set the current root tag of the SelectionDAG. /// - const SDOperand &setRoot(SDOperand N) { return Root = N; } + const SDOperand &setRoot(SDOperand N) { + assert((!N.Val || N.getValueType() == MVT::Other) && + "DAG root value is not a chain!"); + return Root = N; + } /// Combine - This iterates over the nodes in the SelectionDAG, folding /// certain types of nodes together, or eliminating superfluous nodes. When From gohman at apple.com Tue Jul 22 13:25:26 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 22 Jul 2008 18:25:26 -0000 Subject: [llvm-commits] [llvm] r53926 - /llvm/trunk/include/llvm/Support/IRBuilder.h Message-ID: <200807221825.m6MIPQfo021023@zion.cs.uiuc.edu> Author: djg Date: Tue Jul 22 13:25:25 2008 New Revision: 53926 URL: http://llvm.org/viewvc/llvm-project?rev=53926&view=rev Log: IRBuilder support for insertvalue and extractvalue. Modified: llvm/trunk/include/llvm/Support/IRBuilder.h Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=53926&r1=53925&r2=53926&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Tue Jul 22 13:25:25 2008 @@ -105,11 +105,6 @@ return Insert(ReturnInst::Create(retVals, N)); } - GetResultInst *CreateGetResult(Value *V, unsigned Index, - const char *Name = "") { - return Insert(new GetResultInst(V, Index), Name); - } - /// CreateBr - Create an unconditional 'br label X' instruction. BranchInst *CreateBr(BasicBlock *Dest) { return Insert(BranchInst::Create(Dest)); @@ -572,6 +567,37 @@ return ConstantExpr::getShuffleVector(V1C, V2C, MC); return Insert(new ShuffleVectorInst(V1, V2, Mask), Name); } + + GetResultInst *CreateGetResult(Value *V, unsigned Index, + const char *Name = "") { + return Insert(new GetResultInst(V, Index), Name); + } + + ExtractValueInst *CreateExtractValue(Value *Agg, unsigned Idx, + const char *Name = "") { + return Insert(ExtractValueInst::Create(Agg, Idx), Name); + } + + template + ExtractValueInst *CreateExtractValue(Value *Agg, + InputIterator IdxBegin, + InputIterator IdxEnd, + const char *Name = "") { + return Insert(ExtractValueInst::Create(Agg, IdxBegin, IdxEnd), Name); + } + + InsertValueInst *CreateInsertValue(Value *Agg, Value *Val, unsigned Idx, + const char *Name = "") { + return Insert(InsertValueInst::Create(Agg, Val, Idx), Name); + } + + template + InsertValueInst *CreateInsertValue(Value *Agg, Value *Val, + InputIterator IdxBegin, + InputIterator IdxEnd, + const char *Name = "") { + return Insert(InsertValueInst::Create(Agg, Val, IdxBegin, IdxEnd), Name); + } }; } From evan.cheng at apple.com Tue Jul 22 13:39:19 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 22 Jul 2008 18:39:19 -0000 Subject: [llvm-commits] [llvm] r53927 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/mmx-s2v.ll Message-ID: <200807221839.m6MIdKZB021497@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 22 13:39:19 2008 New Revision: 53927 URL: http://llvm.org/viewvc/llvm-project?rev=53927&view=rev Log: Fix PR2574: implement v2f32 scalar_to_vector. Added: llvm/trunk/test/CodeGen/X86/mmx-s2v.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=53927&r1=53926&r2=53927&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jul 22 13:39:19 2008 @@ -601,6 +601,7 @@ setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v2i32, Custom); setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v1i64, Custom); + setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v2f32, Custom); setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v8i8, Custom); setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v4i16, Custom); setOperationAction(ISD::SCALAR_TO_VECTOR, MVT::v1i64, Custom); @@ -4135,6 +4136,12 @@ SDOperand X86TargetLowering::LowerSCALAR_TO_VECTOR(SDOperand Op, SelectionDAG &DAG) { + if (Op.getValueType() == MVT::v2f32) + return DAG.getNode(ISD::BIT_CONVERT, MVT::v2f32, + DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v2i32, + DAG.getNode(ISD::BIT_CONVERT, MVT::i32, + Op.getOperand(0)))); + SDOperand AnyExt = DAG.getNode(ISD::ANY_EXTEND, MVT::i32, Op.getOperand(0)); MVT VT = MVT::v2i32; switch (Op.getValueType().getSimpleVT()) { Added: llvm/trunk/test/CodeGen/X86/mmx-s2v.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/mmx-s2v.ll?rev=53927&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/mmx-s2v.ll (added) +++ llvm/trunk/test/CodeGen/X86/mmx-s2v.ll Tue Jul 22 13:39:19 2008 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+mmx +; PR2574 + +define void @entry(i32 %m_task_id, i32 %start_x, i32 %end_x) {;