From jay.foad at gmail.com Mon Jun 8 07:15:33 2009 From: jay.foad at gmail.com (Jay Foad) Date: Mon, 8 Jun 2009 13:15:33 +0100 Subject: [llvm-commits] [PATCH] simplify OnlyCalledDirectly() In-Reply-To: <4A273FC6.4090907@mxc.ca> References: <4A273FC6.4090907@mxc.ca> Message-ID: 2009/6/4 Nick Lewycky : > I'd rather it were a method on Function, I keep wanting to check this > and forgetting the efficient method of doing it (most recently in > CXAGuardElim). Like this? It passes "make check". Thanks, Jay. -------------- next part -------------- A non-text attachment was scrubbed... Name: patch.ocd2 Type: application/octet-stream Size: 5054 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090608/38ef8b26/attachment.obj From jay.foad at gmail.com Mon Jun 8 10:05:57 2009 From: jay.foad at gmail.com (Jay Foad) Date: Mon, 8 Jun 2009 16:05:57 +0100 Subject: [llvm-commits] [PATCH] SafeToDestroyConstant Message-ID: GlobalDCE.cpp's SafeToDestroyConstant() isn't used anywhere. Meanwhile GlobalOpt.cpp has a very similar function called ConstantIsDead(). This patch removes the unused function but renames ConstantIsDead to SafeToDestroyConstant, because I think that makes the connection with Constant::destroyConstant() clearer. Thoughts? Should SafeToDestroyConstant() really be a method on Constant? Incidentally I noticed that you can't call destroyConstant() on e.g. a ConstantInt. It seems like you're only supposed to call it on a constant that uses other constants (i.e. when getNumOperands() != 0). Is that true? If so it could probably be documented better. Thanks, Jay. -------------- next part -------------- A non-text attachment was scrubbed... Name: patch.stdc Type: application/octet-stream Size: 3244 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090608/10feaabe/attachment.obj From asl at math.spbu.ru Mon Jun 8 11:59:02 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 08 Jun 2009 16:59:02 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r73073 - in /llvm-gcc-4.2/trunk/gcc/config/arm: arm-cores.def arm-tune.md arm.c arm.h Message-ID: <200906081659.n58Gx2Ag022839@zion.cs.uiuc.edu> Author: asl Date: Mon Jun 8 11:58:58 2009 New Revision: 73073 URL: http://llvm.org/viewvc/llvm-project?rev=73073&view=rev Log: Add helpers to propagate ARMv6t2, ARMv7 stuff to llvm backends. Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm-cores.def llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md llvm-gcc-4.2/trunk/gcc/config/arm/arm.c llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm-cores.def URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm-cores.def?rev=73073&r1=73072&r2=73073&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm-cores.def (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm-cores.def Mon Jun 8 11:58:58 2009 @@ -115,3 +115,9 @@ ARM_CORE("arm1176jzf-s", arm1176jzfs, 6ZK, FL_LDSCHED | FL_VFPV2, 9e) ARM_CORE("mpcorenovfp", mpcorenovfp, 6K, FL_LDSCHED, 9e) ARM_CORE("mpcore", mpcore, 6K, FL_LDSCHED | FL_VFPV2, 9e) +/* LLVM LOCAL begin */ +ARM_CORE("arm1156t2-s", arm1156t2s, 6T2, FL_LDSCHED, 9e) +ARM_CORE("arm1156t2f-s", arm1156t2fs, 6T2, FL_LDSCHED | FL_VFPV2, 9e) +ARM_CORE("cortex-a8", cortexa8, 7A, FL_LDSCHED, 9e) +ARM_CORE("cortex-a9", cortexa9, 7A, FL_LDSCHED, 9e) +/* LLVM LOCAL end */ Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md?rev=73073&r1=73072&r2=73073&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md Mon Jun 8 11:58:58 2009 @@ -1,5 +1,5 @@ ;; -*- buffer-read-only: t -*- ;; Generated automatically by gentune.sh from arm-cores.def (define_attr "tune" - "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore" + "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,arm1156t2fs,cortexa8,cortexa9" (const (symbol_ref "arm_tune"))) Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=73073&r1=73072&r2=73073&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Mon Jun 8 11:58:58 2009 @@ -538,6 +538,9 @@ #define FL_WBUF (1 << 14) /* Schedule for write buffer ops. Note: ARM6 & 7 derivatives only. */ #define FL_ARCH6K (1 << 15) /* Architecture rel 6 K extensions. */ +/* LLVM LOCAL begin */ +#define FL_THUMB2 (1 << 16) /* Thumb-2. */ +/* LLVM LOCAL end */ #define FL_IWMMXT (1 << 29) /* XScale v2 or "Intel Wireless MMX technology". */ @@ -556,6 +559,10 @@ #define FL_FOR_ARCH6K (FL_FOR_ARCH6 | FL_ARCH6K) #define FL_FOR_ARCH6Z FL_FOR_ARCH6 #define FL_FOR_ARCH6ZK FL_FOR_ARCH6K +/* LLVM LOCAL begin */ +#define FL_FOR_ARCH6T2 (FL_FOR_ARCH6 | FL_THUMB2) +#define FL_FOR_ARCH7A (FL_FOR_ARCH6T2) +/* LLVM LOCAL end */ /* The bits in this mask specify which instructions we are allowed to generate. */ @@ -621,6 +628,11 @@ interworking clean. */ int arm_cpp_interwork = 0; +/* LLVM LOCAL begin */ +/* Nonzero if chip supports Thumb 2. */ +int arm_arch_thumb2; +/* LLVM LOCAL end */ + /* In case of a PRE_INC, POST_INC, PRE_DEC, POST_DEC memory reference, we must report the mode of the memory reference from PRINT_OPERAND to PRINT_OPERAND_ADDRESS. */ @@ -717,6 +729,10 @@ /* APPLE LOCAL end ARM custom architectures */ {"armv6z", arm1176jzs, "6Z", FL_CO_PROC | FL_FOR_ARCH6Z, NULL}, {"armv6zk", arm1176jzs, "6ZK", FL_CO_PROC | FL_FOR_ARCH6ZK, NULL}, +/* LLVM LOCAL begin */ + {"armv6t2", arm1156t2s, "6T2", FL_CO_PROC | FL_FOR_ARCH6T2, NULL}, + {"armv7-a", cortexa8, "7A", FL_CO_PROC | FL_FOR_ARCH7A, NULL}, +/* LLVM LOCAL end */ {"ep9312", ep9312, "4T", FL_LDSCHED | FL_CIRRUS | FL_FOR_ARCH4, NULL}, {"iwmmxt", iwmmxt, "5TE", FL_LDSCHED | FL_STRONG | FL_FOR_ARCH5TE | FL_XSCALE | FL_IWMMXT , NULL}, {NULL, arm_none, NULL, 0 , NULL} @@ -1369,6 +1385,9 @@ arm_arch5e = (insn_flags & FL_ARCH5E) != 0; arm_arch6 = (insn_flags & FL_ARCH6) != 0; arm_arch6k = (insn_flags & FL_ARCH6K) != 0; + /* LLVM LOCAL begin */ + arm_arch_thumb2 = (insn_flags & FL_THUMB2) != 0; + /* LLVM LOCAL end */ arm_arch_xscale = (insn_flags & FL_XSCALE) != 0; arm_arch_cirrus = (insn_flags & FL_CIRRUS) != 0; Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.h?rev=73073&r1=73072&r2=73073&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Mon Jun 8 11:58:58 2009 @@ -54,6 +54,10 @@ builtin_define ("__APCS_32__"); \ if (TARGET_THUMB) \ builtin_define ("__thumb__"); \ + /* LLVM LOCAL begin */ \ + if (TARGET_THUMB2) \ + builtin_define ("__thumb2__"); \ + /* LLVM LOCAL end */ \ \ if (TARGET_BIG_END) \ { \ @@ -210,6 +214,15 @@ #define TARGET_HARD_TP (target_thread_pointer == TP_CP15) #define TARGET_SOFT_TP (target_thread_pointer == TP_SOFT) +/* LLVM LOCAL begin */ +/* Only 16-bit thumb code. */ +#define TARGET_THUMB1 (TARGET_THUMB && !arm_arch_thumb2) +/* Arm or Thumb-2 32-bit code. */ +#define TARGET_32BIT (TARGET_ARM || arm_arch_thumb2) +/* 32-bit Thumb-2 code. */ +#define TARGET_THUMB2 (TARGET_THUMB && arm_arch_thumb2) +/* LLVM LOCAL end */ + /* APPLE LOCAL begin ARM compact switch tables */ /* Use compact switch tables with libgcc handlers. */ #define TARGET_COMPACT_SWITCH_TABLES \ @@ -372,6 +385,11 @@ interworking clean. */ extern int arm_cpp_interwork; +/* LLVM LOCAL begin */ +/* Nonzero if chip supports Thumb 2. */ +extern int arm_arch_thumb2; +/* LLVM LOCAL end */ + #ifndef TARGET_DEFAULT #define TARGET_DEFAULT (MASK_APCS_FRAME) #endif @@ -2976,7 +2994,11 @@ case arm1176jzfs: F.setCPU("arm1176jzf-s"); break;\ case mpcorenovfp: F.setCPU("mpcorenovfp"); break;\ case mpcore: F.setCPU("mpcore"); break;\ - default: \ + case arm1156t2s: F.setCPU("arm1156t2-s"); break; \ + case arm1156t2fs: F.setCPU("arm1156t2f-s"); break; \ + case cortexa8: F.setCPU("cortex-a8"); break; \ + case cortexa9: F.setCPU("cortex-a9"); break; \ + default: \ F.setCPU("arm7tdmi"); \ break; \ } \ @@ -2986,18 +3008,20 @@ * armv6-apple-darwin, thumbv5-apple-darwin. FIXME: Replace thumb triplets * with function notes. */ -#define LLVM_OVERRIDE_TARGET_ARCH() \ - (TARGET_THUMB \ - ? (arm_arch6 \ - ? "thumbv6" : (arm_arch5e \ - ? "thumbv5e" : (arm_arch5 \ - ? "thumbv5" : (arm_arch4t \ - ? "thumbv4t" : "")))) \ - : (arm_arch6 \ - ? "armv6" : (arm_arch5e \ - ? "armv5e" : (arm_arch5 \ - ? "armv5" : (arm_arch4t \ - ? "armv4t" : ""))))) +#define LLVM_OVERRIDE_TARGET_ARCH() \ + (TARGET_THUMB \ + ? (arm_arch_thumb2 \ + ? "thumbv6t2" : \ + (arm_arch6 \ + ? "thumbv6" : (arm_arch5e \ + ? "thumbv5e" : (arm_arch5 \ + ? "thumbv5" : (arm_arch4t \ + ? "thumbv4t" : ""))))) \ + : (arm_arch6 \ + ? "armv6" : (arm_arch5e \ + ? "armv5e" : (arm_arch5 \ + ? "armv5" : (arm_arch4t \ + ? "armv4t" : ""))))) #define LLVM_SET_MACHINE_OPTIONS(argvec) \ if (TARGET_SOFT_FLOAT) \ From greened at obbligato.org Mon Jun 8 12:00:34 2009 From: greened at obbligato.org (David Greene) Date: Mon, 08 Jun 2009 17:00:34 -0000 Subject: [llvm-commits] [llvm] r73074 - in /llvm/trunk: docs/TableGenFundamentals.html test/TableGen/regmatch.td utils/TableGen/Record.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.cpp Message-ID: <200906081700.n58H0Zvi022899@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 8 12:00:34 2009 New Revision: 73074 URL: http://llvm.org/viewvc/llvm-project?rev=73074&view=rev Log: Add a !regmatch operator to do pattern matching in TableGen. Added: llvm/trunk/test/TableGen/regmatch.td Modified: llvm/trunk/docs/TableGenFundamentals.html llvm/trunk/utils/TableGen/Record.cpp llvm/trunk/utils/TableGen/Record.h llvm/trunk/utils/TableGen/TGLexer.cpp llvm/trunk/utils/TableGen/TGLexer.h llvm/trunk/utils/TableGen/TGParser.cpp Modified: llvm/trunk/docs/TableGenFundamentals.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGenFundamentals.html?rev=73074&r1=73073&r2=73074&view=diff ============================================================================== --- llvm/trunk/docs/TableGenFundamentals.html (original) +++ llvm/trunk/docs/TableGenFundamentals.html Mon Jun 8 12:00:34 2009 @@ -414,6 +414,9 @@
!subst(a, b, c)
If 'a' and 'b' are of string type or are symbol references, substitute 'b' for 'a' in 'c.' This operation is analogous to $(subst) in GNU make.
+
!regmatch(a, b)
+
An integer {0,1} indicating whether string 'b' matched regular expression +'a.'
!foreach(a, b, c)
For each member 'b' of dag or list 'a' apply operator 'c.' 'b' is a dummy variable that should be declared as a member variable of an instantiated Added: llvm/trunk/test/TableGen/regmatch.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/regmatch.td?rev=73074&view=auto ============================================================================== --- llvm/trunk/test/TableGen/regmatch.td (added) +++ llvm/trunk/test/TableGen/regmatch.td Mon Jun 8 12:00:34 2009 @@ -0,0 +1,11 @@ +// RUN: tblgen %s | grep {Match1 = 1} | count 1 +// RUN: tblgen %s | grep {Match2 = 1} | count 1 + +class Foo { + string Value = v; + int Match1 = !regmatch(".*ps$", v); + int Match2 = !regmatch(".*pd$", v); +} + +def Bar : Foo<"addps">; +def Baz : Foo<"addpd">; Modified: llvm/trunk/utils/TableGen/Record.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=73074&r1=73073&r2=73074&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.cpp (original) +++ llvm/trunk/utils/TableGen/Record.cpp Mon Jun 8 12:00:34 2009 @@ -16,6 +16,8 @@ #include "llvm/Support/Streams.h" #include "llvm/ADT/StringExtras.h" #include +#include +#include using namespace llvm; @@ -671,6 +673,36 @@ } break; } + case REGMATCH: { + StringInit *LHSs = dynamic_cast(LHS); + StringInit *RHSs = dynamic_cast(RHS); + if (LHSs && RHSs) { + regex_t compiled; + int err = regcomp (&compiled, LHSs->getValue().c_str(), REG_EXTENDED); + if (err != 0) { + size_t length = regerror (err, &compiled, NULL, 0); + char *buffer = new char[length]; + (void) regerror (err, &compiled, buffer, length); + std::string errmsg = buffer; + delete[] buffer; + regfree(&compiled); + throw errmsg; + } + int result = regexec(&compiled, RHSs->getValue().c_str(), 0, NULL, 0); + if (result == REG_ESPACE) { + size_t length = regerror (err, &compiled, NULL, 0); + char *buffer = new char[length]; + (void) regerror (err, &compiled, buffer, length); + std::string errmsg = buffer; + delete[] buffer; + regfree(&compiled); + throw errmsg; + } + regfree(&compiled); + return new IntInit(result == 0); + } + break; + } case SHL: case SRA: case SRL: { @@ -710,6 +742,7 @@ case SRA: Result = "!sra"; break; case SRL: Result = "!srl"; break; case STRCONCAT: Result = "!strconcat"; break; + case REGMATCH: Result = "!regmatch"; break; case NAMECONCAT: Result = "!nameconcat<" + getType()->getAsString() + ">"; break; } Modified: llvm/trunk/utils/TableGen/Record.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=73074&r1=73073&r2=73074&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.h (original) +++ llvm/trunk/utils/TableGen/Record.h Mon Jun 8 12:00:34 2009 @@ -802,7 +802,7 @@ /// class BinOpInit : public OpInit { public: - enum BinaryOp { SHL, SRA, SRL, STRCONCAT, CONCAT, NAMECONCAT }; + enum BinaryOp { SHL, SRA, SRL, STRCONCAT, CONCAT, NAMECONCAT, REGMATCH }; private: BinaryOp Opc; Init *LHS, *RHS; Modified: llvm/trunk/utils/TableGen/TGLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.cpp?rev=73074&r1=73073&r2=73074&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGLexer.cpp (original) +++ llvm/trunk/utils/TableGen/TGLexer.cpp Mon Jun 8 12:00:34 2009 @@ -447,6 +447,7 @@ if (Len == 3 && !memcmp(Start, "shl", 3)) return tgtok::XSHL; if (Len == 9 && !memcmp(Start, "strconcat", 9)) return tgtok::XStrConcat; if (Len == 10 && !memcmp(Start, "nameconcat", 10)) return tgtok::XNameConcat; + if (Len == 8 && !memcmp(Start, "regmatch", 8)) return tgtok::XRegMatch; if (Len == 5 && !memcmp(Start, "subst", 5)) return tgtok::XSubst; if (Len == 7 && !memcmp(Start, "foreach", 7)) return tgtok::XForEach; if (Len == 4 && !memcmp(Start, "cast", 4)) return tgtok::XCast; Modified: llvm/trunk/utils/TableGen/TGLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.h?rev=73074&r1=73073&r2=73074&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGLexer.h (original) +++ llvm/trunk/utils/TableGen/TGLexer.h Mon Jun 8 12:00:34 2009 @@ -46,7 +46,7 @@ // !keywords. XConcat, XSRA, XSRL, XSHL, XStrConcat, XNameConcat, XCast, XSubst, - XForEach, XCar, XCdr, XNull, XIf, + XForEach, XCar, XCdr, XNull, XIf, XRegMatch, // Integer value. IntVal, Modified: llvm/trunk/utils/TableGen/TGParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=73074&r1=73073&r2=73074&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGParser.cpp (original) +++ llvm/trunk/utils/TableGen/TGParser.cpp Mon Jun 8 12:00:34 2009 @@ -791,6 +791,7 @@ case tgtok::XSRL: case tgtok::XSHL: case tgtok::XStrConcat: + case tgtok::XRegMatch: case tgtok::XNameConcat: { // Value ::= !binop '(' Value ',' Value ')' BinOpInit::BinaryOp Code; RecTy *Type = 0; @@ -823,6 +824,11 @@ Code = BinOpInit::STRCONCAT; Type = new StringRecTy(); break; + case tgtok::XRegMatch: + Lex.Lex(); // eat the operation + Code = BinOpInit::REGMATCH; + Type = new IntRecTy(); + break; case tgtok::XNameConcat: Lex.Lex(); // eat the operation Code = BinOpInit::NAMECONCAT; @@ -1174,6 +1180,7 @@ case tgtok::XSRL: case tgtok::XSHL: case tgtok::XStrConcat: + case tgtok::XRegMatch: case tgtok::XNameConcat: // Value ::= !binop '(' Value ',' Value ')' case tgtok::XIf: case tgtok::XForEach: From dpatel at apple.com Mon Jun 8 12:06:55 2009 From: dpatel at apple.com (Devang Patel) Date: Mon, 8 Jun 2009 10:06:55 -0700 Subject: [llvm-commits] [llvm] r72894 - in /llvm/trunk: include/llvm/Attributes.h include/llvm/Target/TargetOptions.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Target/PowerPC/PPCRegisterInfo.cpp lib/Target/TargetMachine.cpp lib/Target/X86/X86RegisterInfo.cpp lib/VMCore/Attributes.cpp test/CodeGen/X86/red-zone2.ll tools/llc/llc.cpp In-Reply-To: <4A2C015B.2010408@mxc.ca> References: <200906042205.n54M5Ytf029806@zion.cs.uiuc.edu> <4A2C015B.2010408@mxc.ca> Message-ID: <4E911180-C009-4BFA-BD92-0E2069344B06@apple.com> On Jun 7, 2009, at 11:05 AM, Nick Lewycky wrote: > This attribute needs an entry in LangRef. Please add one. Yes. I am going to add one or two additional attributes. I'll document all of them together. > > > Also, I'm now getting "noredzone" notes on all my functions all the > time when building x86-32 Linux. I suppose that's technically true > but do we really need this everywhere? llvm-gcc sets this when -mno-red-zone is set by GCC's target machinery. > > > Why disable the redzone anyways? Isn't it an ABI feature? GCC man page says, -mno-red-zone Do not use a so called red zone for x86-64 code. The red zone is mandated by the x86-64 ABI, it is a 128-byte area beyond the location of the stack pointer that will not be modified by signal or interrupt handlers and therefore can be used for temporary data without adjusting the stack pointer. The flag -mno-red-zone disables this red zone. > > > Nick - Devang From edwintorok at gmail.com Mon Jun 8 12:19:49 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Mon, 08 Jun 2009 20:19:49 +0300 Subject: [llvm-commits] [llvm] r73074 - in /llvm/trunk: docs/TableGenFundamentals.html test/TableGen/regmatch.td utils/TableGen/Record.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.cpp In-Reply-To: <200906081700.n58H0Zvi022899@zion.cs.uiuc.edu> References: <200906081700.n58H0Zvi022899@zion.cs.uiuc.edu> Message-ID: <4A2D4835.3060102@gmail.com> On 2009-06-08 20:00, David Greene wrote: > Author: greened > Date: Mon Jun 8 12:00:34 2009 > New Revision: 73074 > > URL: http://llvm.org/viewvc/llvm-project?rev=73074&view=rev > Log: > > Add a !regmatch operator to do pattern matching in TableGen. > > } > + case REGMATCH: { > + StringInit *LHSs = dynamic_cast(LHS); > + StringInit *RHSs = dynamic_cast(RHS); > + if (LHSs && RHSs) { > + regex_t compiled; > + int err = regcomp (&compiled, LHSs->getValue().c_str(), REG_EXTENDED); > Hi David, If you are not using the nmatch/pmatch features of regexec(), you can pass REG_NOSUB here. In some situations it can result in a more efficient regular expression. If REGMATCH is used often you could also compile the regular expression just once (store it in a map?) and run it multiple times. Best regards, --Edwin From isanbard at gmail.com Mon Jun 8 13:11:08 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 8 Jun 2009 11:11:08 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r73073 - in /llvm-gcc-4.2/trunk/gcc/config/arm: arm-cores.def arm-tune.md arm.c arm.h In-Reply-To: <200906081659.n58Gx2Ag022839@zion.cs.uiuc.edu> References: <200906081659.n58Gx2Ag022839@zion.cs.uiuc.edu> Message-ID: <16e5fdf90906081111h2c81c3f3s2df050f3c3432162@mail.gmail.com> Hi Anton, > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md (original) > +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md Mon Jun ?8 11:58:58 2009 > @@ -1,5 +1,5 @@ > ?;; -*- buffer-read-only: t -*- > ?;; Generated automatically by gentune.sh from arm-cores.def ??? Why is this a checked-in file? :-) > ?(define_attr "tune" > - ? ? ? "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore" > + ? ? ? "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,arm1156t2fs,cortexa8,cortexa9" > ? ? ? ?(const (symbol_ref "arm_tune"))) Also, this needs LOCAL markers. -bw From isanbard at gmail.com Mon Jun 8 13:18:28 2009 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 08 Jun 2009 18:18:28 -0000 Subject: [llvm-commits] [llvm] r73075 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200906081818.n58IISDL025340@zion.cs.uiuc.edu> Author: void Date: Mon Jun 8 13:18:28 2009 New Revision: 73075 URL: http://llvm.org/viewvc/llvm-project?rev=73075&view=rev Log: Revert r72898. It does not solve the problem I want it to solve. Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=73075&r1=73074&r2=73075&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Mon Jun 8 13:18:28 2009 @@ -822,6 +822,13 @@ NumBytes = StackSize - X86FI->getCalleeSavedFrameSize(); } + unsigned ReadyLabelId = 0; + if (needsFrameMoves) { + // Mark effective beginning of when frame pointer is ready. + ReadyLabelId = MMI->NextLabelID(); + BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addImm(ReadyLabelId); + } + // Skip the callee-saved push instructions. while (MBBI != MBB.end() && (MBBI->getOpcode() == X86::PUSH32r || @@ -831,20 +838,20 @@ if (MBBI != MBB.end()) DL = MBBI->getDebugLoc(); - if (NumBytes) { // Adjust stack pointer: ESP -= numbytes. + if (NumBytes) { // adjust stack pointer: ESP -= numbytes if (NumBytes >= 4096 && Subtarget->isTargetCygMing()) { - // Check, whether EAX is livein for this function. + // Check, whether EAX is livein for this function bool isEAXAlive = false; for (MachineRegisterInfo::livein_iterator II = MF.getRegInfo().livein_begin(), EE = MF.getRegInfo().livein_end(); (II != EE) && !isEAXAlive; ++II) { unsigned Reg = II->first; isEAXAlive = (Reg == X86::EAX || Reg == X86::AX || - Reg == X86::AH || Reg == X86::AL); + Reg == X86::AH || Reg == X86::AL); } - // Function prologue calls _alloca to probe the stack when allocating more - // than 4k bytes in one go. Touching the stack at 4K increments is + // Function prologue calls _alloca to probe the stack when allocating + // more than 4k bytes in one go. Touching the stack at 4K increments is // necessary to ensure that the guard pages used by the OS virtual memory // manager are allocated in correct sequence. if (!isEAXAlive) { @@ -856,14 +863,12 @@ // Save EAX BuildMI(MBB, MBBI, DL, TII.get(X86::PUSH32r)) .addReg(X86::EAX, RegState::Kill); - // Allocate NumBytes-4 bytes on stack. We'll also use 4 already // allocated bytes for EAX. - BuildMI(MBB, MBBI, DL, TII.get(X86::MOV32ri), X86::EAX) - .addImm(NumBytes-4); + BuildMI(MBB, MBBI, DL, + TII.get(X86::MOV32ri), X86::EAX).addImm(NumBytes-4); BuildMI(MBB, MBBI, DL, TII.get(X86::CALLpcrel32)) .addExternalSymbol("_alloca"); - // Restore EAX MachineInstr *MI = addRegOffset(BuildMI(MF, DL, TII.get(X86::MOV32rm), X86::EAX), @@ -875,7 +880,6 @@ // merge the two. This can be the case when tail call elimination is // enabled and the callee has more arguments then the caller. NumBytes -= mergeSPUpdates(MBB, MBBI, StackPtr, true); - // If there is an ADD32ri or SUB32ri of ESP immediately after this // instruction, merge the two instructions. mergeSPUpdatesDown(MBB, MBBI, StackPtr, &NumBytes); @@ -885,13 +889,8 @@ } } - if (needsFrameMoves) { - // Mark effective beginning of when frame pointer is ready. - unsigned ReadyLabelId = 0; - ReadyLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addImm(ReadyLabelId); + if (needsFrameMoves) emitFrameMoves(MF, FrameLabelId, ReadyLabelId); - } } void X86RegisterInfo::emitEpilogue(MachineFunction &MF, From gohman at apple.com Mon Jun 8 13:25:17 2009 From: gohman at apple.com (Dan Gohman) Date: Mon, 8 Jun 2009 11:25:17 -0700 Subject: [llvm-commits] [llvm] r72894 - in /llvm/trunk: include/llvm/Attributes.h include/llvm/Target/TargetOptions.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Target/PowerPC/PPCRegisterInfo.cpp lib/Target/TargetMachine.cpp lib/Target/X86/X86RegisterInfo.cpp lib/VMCore/Attributes.cpp test/CodeGen/X86/red-zone2.ll tools/llc/llc.cpp In-Reply-To: <4E911180-C009-4BFA-BD92-0E2069344B06@apple.com> References: <200906042205.n54M5Ytf029806@zion.cs.uiuc.edu> <4A2C015B.2010408@mxc.ca> <4E911180-C009-4BFA-BD92-0E2069344B06@apple.com> Message-ID: On Jun 8, 2009, at 10:06 AM, Devang Patel wrote: >> >> Also, I'm now getting "noredzone" notes on all my functions all the >> >> time when building x86-32 Linux. I suppose that's technically true >> >> but do we really need this everywhere? >> > > llvm-gcc sets this when -mno-red-zone is set by GCC's target > machinery. x86-32 never has a redzone, so it shouldn't require noredzone notes everywhere. I realize that the currrent code is just using the values of flags inside GCC, but having meaningless function notes everywhere is undesirable. Can you find some way to suppress noredzone notes on targets which never have red zones? > > >> >> >> >> >> Why disable the redzone anyways? Isn't it an ABI feature? It is, but some environments, such OS kernels, have deviations from the standard ABI. Dan From anton at korobeynikov.info Mon Jun 8 13:30:08 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Mon, 8 Jun 2009 22:30:08 +0400 Subject: [llvm-commits] [llvm-gcc-4.2] r73073 - in /llvm-gcc-4.2/trunk/gcc/config/arm: arm-cores.def arm-tune.md arm.c arm.h In-Reply-To: <16e5fdf90906081111h2c81c3f3s2df050f3c3432162@mail.gmail.com> References: <200906081659.n58Gx2Ag022839@zion.cs.uiuc.edu> <16e5fdf90906081111h2c81c3f3s2df050f3c3432162@mail.gmail.com> Message-ID: Hello, Bill > ??? Why is this a checked-in file? :-) That's question not for me, but to authors of gcc's arm backend. In order to generate list of processors for tune option you need to run some awk script which will generate you an .md file. Same as configures though. > Also, this needs LOCAL markers. Ok. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From greened at obbligato.org Mon Jun 8 14:16:56 2009 From: greened at obbligato.org (David Greene) Date: Mon, 08 Jun 2009 19:16:56 -0000 Subject: [llvm-commits] [llvm] r73076 - /llvm/trunk/utils/TableGen/Record.cpp Message-ID: <200906081916.n58JGvCX027166@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 8 14:16:56 2009 New Revision: 73076 URL: http://llvm.org/viewvc/llvm-project?rev=73076&view=rev Log: Make !if short-circuit when possible. Modified: llvm/trunk/utils/TableGen/Record.cpp Modified: llvm/trunk/utils/TableGen/Record.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=73076&r1=73075&r2=73076&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.cpp (original) +++ llvm/trunk/utils/TableGen/Record.cpp Mon Jun 8 14:16:56 2009 @@ -965,9 +965,25 @@ Init *TernOpInit::resolveReferences(Record &R, const RecordVal *RV) { Init *lhs = LHS->resolveReferences(R, RV); + + if (Opc == IF && lhs != LHS) { + IntInit *Value = dynamic_cast(lhs); + if (Value != 0) { + // Short-circuit + if (Value->getValue()) { + Init *mhs = MHS->resolveReferences(R, RV); + return (new TernOpInit(getOpcode(), lhs, mhs, RHS, getType()))->Fold(&R, 0); + } + else { + Init *rhs = RHS->resolveReferences(R, RV); + return (new TernOpInit(getOpcode(), lhs, MHS, rhs, getType()))->Fold(&R, 0); + } + } + } + Init *mhs = MHS->resolveReferences(R, RV); Init *rhs = RHS->resolveReferences(R, RV); - + if (LHS != lhs || MHS != mhs || RHS != rhs) return (new TernOpInit(getOpcode(), lhs, mhs, rhs, getType()))->Fold(&R, 0); return Fold(&R, 0); From criswell at cs.uiuc.edu Mon Jun 8 14:51:12 2009 From: criswell at cs.uiuc.edu (John Criswell) Date: Mon, 8 Jun 2009 14:51:12 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/2009-08-12-UsenixSecurity-SafeSVAOS.html 2009-08-12-UsenixSecurity-SafeSVAOS.pdf Message-ID: <200906081951.n58JpCb0026245@maute.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2009-08-12-UsenixSecurity-SafeSVAOS.html added (r1.1) 2009-08-12-UsenixSecurity-SafeSVAOS.pdf added (r1.1) --- Log message: Added the Usenix Security paper. --- Diffs of the changes: (+85 -0) 2009-08-12-UsenixSecurity-SafeSVAOS.html | 85 +++++++++++++++++++++++++++++++ 2009-08-12-UsenixSecurity-SafeSVAOS.pdf | 0 2 files changed, 85 insertions(+) Index: llvm-www/pubs/2009-08-12-UsenixSecurity-SafeSVAOS.html diff -c /dev/null llvm-www/pubs/2009-08-12-UsenixSecurity-SafeSVAOS.html:1.1 *** /dev/null Mon Jun 8 14:47:44 2009 --- llvm-www/pubs/2009-08-12-UsenixSecurity-SafeSVAOS.html Mon Jun 8 14:47:29 2009 *************** *** 0 **** --- 1,85 ---- + + + + + + Memory Safety for Low-Level Software/Hardware Interactions + + + +
+ Memory Safety for Low-Level Software/Hardware Interactions +
+
+ John Criswell, + Nicolas Geoffray, and + Vikram Adve +
+ +

Abstract:

+
+ Systems that enforce memory safety for + today's operating system kernels and other system software + do not account for the + behavior of low-level software/hardware interactions such as + memory-mapped I/O, + MMU configuration, and context switching. Bugs in + such low-level interactions can lead to violations of the memory + safety guarantees provided by a safe execution environment and + can lead to exploitable vulnerabilities in system software. + In this work, we present a set of program analysis and run-time instrumentation + techniques that ensure that errors in these low-level operations + do not violate the assumptions made by a safety checking system. + Our design introduces a small set of abstractions and interfaces for + manipulating processor state, kernel stacks, memory mapped I/O + objects, MMU mappings, and self modifying code to achieve this goal, + without moving resource allocation and management decisions out of + the kernel. + We have added these techniques to a compiler-based virtual machine + called Secure Virtual Architecture (SVA), to which the standard Linux + kernel has been ported previously. Our design changes to SVA required + only an additional 100 lines of code to be changed in this kernel. Our + experimental results show that our techniques prevent reported + memory safety violations due to low-level Linux operations and that + these violations are not prevented by SVA + without our techniques. Moreover, the new techniques in this paper + introduce very little overhead over and above the existing + overheads of SVA. Taken together, these results indicate that it is + clearly worthwhile to add these techniques to an existing memory + safety system. +
+ +

Availability:

+ This paper will be published in the Proceedings of the + + Eighteenth USENIX Security Symposium. + +

Download:

+

Paper:

+ + +

BibTeX Entry:

+
+ @inproceedings{SVAOS:UsenixSec09,
+  author = {John Criswell, Nicolas Geoffray, and Vikram Adve},
+  title = {Memory Safety for Low-Level Software/Hardware Interactions},
+  booktitle = {Proceedings of the Eighteenth Usenix Security Symposium},
+  month = {August},
+  year = {2009},
+  location = {Montreal, Canada},
+ }
+ 
+ + +
+ Valid CSS! + Valid HTML 4.01! + + + Index: llvm-www/pubs/2009-08-12-UsenixSecurity-SafeSVAOS.pdf From criswell at cs.uiuc.edu Mon Jun 8 14:53:56 2009 From: criswell at cs.uiuc.edu (John Criswell) Date: Mon, 8 Jun 2009 14:53:56 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/pubs.js Message-ID: <200906081953.n58Jruur026315@maute.cs.uiuc.edu> Changes in directory llvm-www/pubs: pubs.js updated: 1.14 -> 1.15 --- Log message: Added our Usenix Security paper. --- Diffs of the changes: (+8 -0) pubs.js | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm-www/pubs/pubs.js diff -u llvm-www/pubs/pubs.js:1.14 llvm-www/pubs/pubs.js:1.15 --- llvm-www/pubs/pubs.js:1.14 Mon May 25 20:08:17 2009 +++ llvm-www/pubs/pubs.js Mon Jun 8 14:50:37 2009 @@ -1,6 +1,14 @@ // The array should be sorted reverse-chronologically, and will be displayed on // the page in the order listed. var PUBS = [ + {url: '2009-08-12-UsenixSecurity-SafeSVAOS.html', + title: 'Memory Safety for Low-Level Software/Hardware Interactions', + author: 'John Criswell, Nicolas Geoffray, and Vikram Adve', + published: "Proceedings of the Eighteenth Usenix Security Symposium", + location: "Montreal, Canada", + month: 8, + year: 2009}, + {url: '2009-05-21-Thesis-Barrett-3c.html', title: '3c: A JIT Compiler with LLVM', author: 'Edd Barrett', From greened at obbligato.org Mon Jun 8 15:23:20 2009 From: greened at obbligato.org (David Greene) Date: Mon, 08 Jun 2009 20:23:20 -0000 Subject: [llvm-commits] [llvm] r73078 - in /llvm/trunk: include/llvm/Target/TargetSelectionDAG.td test/TableGen/Slice.td utils/TableGen/CodeGenDAGPatterns.cpp utils/TableGen/Record.cpp utils/TableGen/Record.h utils/TableGen/TGParser.cpp utils/TableGen/TGParser.h Message-ID: <200906082023.n58KNKvx029197@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 8 15:23:18 2009 New Revision: 73078 URL: http://llvm.org/viewvc/llvm-project?rev=73078&view=rev Log: Make IntInits and ListInits typed. This helps deduce types of !if and other operators. For the rare cases where a list type cannot be deduced, provide a [] syntax, where is the list element type. Added: llvm/trunk/test/TableGen/Slice.td Modified: llvm/trunk/include/llvm/Target/TargetSelectionDAG.td llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp llvm/trunk/utils/TableGen/Record.cpp llvm/trunk/utils/TableGen/Record.h llvm/trunk/utils/TableGen/TGParser.cpp llvm/trunk/utils/TableGen/TGParser.h Modified: llvm/trunk/include/llvm/Target/TargetSelectionDAG.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetSelectionDAG.td?rev=73078&r1=73077&r2=73078&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetSelectionDAG.td (original) +++ llvm/trunk/include/llvm/Target/TargetSelectionDAG.td Mon Jun 8 15:23:18 2009 @@ -228,6 +228,7 @@ SDTypeProfile TypeProfile = typeprof; } +// Special TableGen-recognized dag nodes def set; def implicit; def parallel; Added: llvm/trunk/test/TableGen/Slice.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/Slice.td?rev=73078&view=auto ============================================================================== --- llvm/trunk/test/TableGen/Slice.td (added) +++ llvm/trunk/test/TableGen/Slice.td Mon Jun 8 15:23:18 2009 @@ -0,0 +1,87 @@ +// RUN: tblgen %s | grep {[(set VR128:$dst, (int_x86_sse2_add_pd VR128:$src1, VR128:$src2))]} | count 1 +// RUN: tblgen %s | grep {[(set VR128:$dst, (int_x86_sse2_add_ps VR128:$src1, VR128:$src2))]} | count 2 + +class ValueType { + int Size = size; + int Value = value; +} + +def f32 : ValueType<32, 1>; // 2 x i64 vector value + +class Intrinsic { + string Name = name; +} + +class Inst opcode, dag oopnds, dag iopnds, string asmstr, + list pattern> { + bits<8> Opcode = opcode; + dag OutOperands = oopnds; + dag InOperands = iopnds; + string AssemblyString = asmstr; + list Pattern = pattern; +} + +def ops; +def outs; +def ins; + +def set; + +// Define registers +class Register { + string Name = n; +} + +class RegisterClass regTypes, list regList> { + list RegTypes = regTypes; + list MemberList = regList; +} + +def XMM0: Register<"xmm0">; +def XMM1: Register<"xmm1">; +def XMM2: Register<"xmm2">; +def XMM3: Register<"xmm3">; +def XMM4: Register<"xmm4">; +def XMM5: Register<"xmm5">; +def XMM6: Register<"xmm6">; +def XMM7: Register<"xmm7">; +def XMM8: Register<"xmm8">; +def XMM9: Register<"xmm9">; +def XMM10: Register<"xmm10">; +def XMM11: Register<"xmm11">; +def XMM12: Register<"xmm12">; +def XMM13: Register<"xmm13">; +def XMM14: Register<"xmm14">; +def XMM15: Register<"xmm15">; + +def FR32 : RegisterClass<[f32], + [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, + XMM8, XMM9, XMM10, XMM11, + XMM12, XMM13, XMM14, XMM15]>; + +class SDNode {} +def not : SDNode; + +multiclass scalar opcode, string asmstr = "", list> patterns = []> { + def SSrr : Inst,patterns[0])>; + def SSrm : Inst,!if(!null(!cdr(patterns)),patterns[0],patterns[1]))>; +} + +multiclass vscalar opcode, string asmstr = "", list> patterns = []> { + def V#NAME#SSrr : Inst,patterns[0])>; + def V#NAME#SSrm : Inst,!if(!null(!cdr(patterns)),patterns[0],patterns[1]))>; +} + +multiclass myscalar opcode, string asmstr = "", list> patterns = []> : + scalar, + vscalar; + +defm NOT : myscalar<0x10, "not", [[], [(set FR32:$dst, (f32 (not FR32:$src)))]]>; Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=73078&r1=73077&r2=73078&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Mon Jun 8 15:23:18 2009 @@ -2007,9 +2007,28 @@ Pattern = new TreePattern(Patterns[i], Tree, true, *this); else { std::vector Values; - for (unsigned j = 0, ee = Tree->getNumArgs(); j != ee; ++j) + RecTy *ListTy = 0; + for (unsigned j = 0, ee = Tree->getNumArgs(); j != ee; ++j) { Values.push_back(Tree->getArg(j)); - ListInit *LI = new ListInit(Values); + TypedInit *TArg = dynamic_cast(Tree->getArg(j)); + if (TArg == 0) { + cerr << "In dag: " << Tree->getAsString(); + cerr << " -- Untyped argument in pattern\n"; + assert(0 && "Untyped argument in pattern"); + } + if (ListTy != 0) { + ListTy = resolveTypes(ListTy, TArg->getType()); + if (ListTy == 0) { + cerr << "In dag: " << Tree->getAsString(); + cerr << " -- Incompatible types in pattern arguments\n"; + assert(0 && "Incompatible types in pattern arguments"); + } + } + else { + ListTy - TArg->getType(); + } + } + ListInit *LI = new ListInit(Values, new ListRecTy(ListTy)); Pattern = new TreePattern(Patterns[i], LI, true, *this); } Modified: llvm/trunk/utils/TableGen/Record.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=73078&r1=73077&r2=73078&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.cpp (original) +++ llvm/trunk/utils/TableGen/Record.cpp Mon Jun 8 15:23:18 2009 @@ -191,7 +191,12 @@ else return 0; - return new ListInit(Elements); + ListRecTy *LType = dynamic_cast(LI->getType()); + if (LType == 0) { + return 0; + } + + return new ListInit(Elements, new ListRecTy(Ty)); } Init *ListRecTy::convertValue(TypedInit *TI) { @@ -272,6 +277,57 @@ } +/// resolveTypes - Find a common type that T1 and T2 convert to. +/// Return 0 if no such type exists. +/// +RecTy *llvm::resolveTypes(RecTy *T1, RecTy *T2) { + if (!T1->typeIsConvertibleTo(T2)) { + if (!T2->typeIsConvertibleTo(T1)) { + // If one is a Record type, check superclasses + RecordRecTy *RecTy1 = dynamic_cast(T1); + if (RecTy1) { + // See if T2 inherits from a type T1 also inherits from + const std::vector &T1SuperClasses = RecTy1->getRecord()->getSuperClasses(); + for(std::vector::const_iterator i = T1SuperClasses.begin(), + iend = T1SuperClasses.end(); + i != iend; + ++i) { + RecordRecTy *SuperRecTy1 = new RecordRecTy(*i); + RecTy *NewType1 = resolveTypes(SuperRecTy1, T2); + if (NewType1 != 0) { + if (NewType1 != SuperRecTy1) { + delete SuperRecTy1; + } + return NewType1; + } + } + } + RecordRecTy *RecTy2 = dynamic_cast(T2); + if (RecTy2) { + // See if T1 inherits from a type T2 also inherits from + const std::vector &T2SuperClasses = RecTy2->getRecord()->getSuperClasses(); + for(std::vector::const_iterator i = T2SuperClasses.begin(), + iend = T2SuperClasses.end(); + i != iend; + ++i) { + RecordRecTy *SuperRecTy2 = new RecordRecTy(*i); + RecTy *NewType2 = resolveTypes(T1, SuperRecTy2); + if (NewType2 != 0) { + if (NewType2 != SuperRecTy2) { + delete SuperRecTy2; + } + return NewType2; + } + } + } + return 0; + } + return T2; + } + return T1; +} + + //===----------------------------------------------------------------------===// // Initializer implementations //===----------------------------------------------------------------------===// @@ -400,7 +456,7 @@ return 0; Vals.push_back(getElement(Elements[i])); } - return new ListInit(Vals); + return new ListInit(Vals, getType()); } Record *ListInit::getElementAsRecord(unsigned i) const { @@ -428,10 +484,20 @@ } if (Changed) - return new ListInit(Resolved); + return new ListInit(Resolved, getType()); return this; } +Init *ListInit::resolveListElementReference(Record &R, const RecordVal *IRV, + unsigned Elt) { + if (Elt >= getSize()) + return 0; // Out of range reference. + Init *E = getElement(Elt); + if (!dynamic_cast(E)) // If the element is set + return E; // Replace the VarListElementInit with it. + return 0; +} + std::string ListInit::getAsString() const { std::string Result = "["; for (unsigned i = 0, e = Values.size(); i != e; ++i) { @@ -540,7 +606,7 @@ assert(0 && "Empty list in cdr"); return 0; } - ListInit *Result = new ListInit(LHSl->begin()+1, LHSl->end()); + ListInit *Result = new ListInit(LHSl->begin()+1, LHSl->end(), LHSl->getType()); return Result; } break; @@ -555,6 +621,16 @@ return new IntInit(0); } } + StringInit *LHSs = dynamic_cast(LHS); + if (LHSs) { + if (LHSs->getValue().empty()) { + return new IntInit(1); + } + else { + return new IntInit(0); + } + } + break; } } @@ -667,8 +743,8 @@ if (Record *D = Records.getDef(Name)) return new DefInit(D); - cerr << "Variable not defined: '" + Name + "'\n"; - assert(0 && "Variable not found"); + cerr << "Variable not defined in !nameconcat: '" + Name + "'\n"; + assert(0 && "Variable not found in !nameconcat"); return 0; } break; @@ -881,7 +957,7 @@ delete NewOp; } } - return new ListInit(NewList); + return new ListInit(NewList, MHSl->getType()); } } return 0; @@ -1027,7 +1103,7 @@ ListInits.reserve(Elements.size()); for (unsigned i = 0, e = Elements.size(); i != e; ++i) ListInits.push_back(new VarListElementInit(this, Elements[i])); - return new ListInit(ListInits); + return new ListInit(ListInits, T); } Modified: llvm/trunk/utils/TableGen/Record.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=73078&r1=73077&r2=73078&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.h (original) +++ llvm/trunk/utils/TableGen/Record.h Mon Jun 8 15:23:18 2009 @@ -442,7 +442,10 @@ virtual bool baseClassOf(const RecordRecTy *RHS) const; }; - +/// resolveTypes - Find a common type that T1 and T2 convert to. +/// Return 0 if no such type exists. +/// +RecTy *resolveTypes(RecTy *T1, RecTy *T2); //===----------------------------------------------------------------------===// // Initializer Classes @@ -618,10 +621,10 @@ /// IntInit - 7 - Represent an initalization by a literal integer value. /// -class IntInit : public Init { +class IntInit : public TypedInit { int64_t Value; public: - explicit IntInit(int64_t V) : Value(V) {} + explicit IntInit(int64_t V) : TypedInit(new IntRecTy), Value(V) {} int64_t getValue() const { return Value; } @@ -631,6 +634,25 @@ virtual Init *convertInitializerBitRange(const std::vector &Bits); virtual std::string getAsString() const; + + /// resolveBitReference - This method is used to implement + /// VarBitInit::resolveReferences. If the bit is able to be resolved, we + /// simply return the resolved value, otherwise we return null. + /// + virtual Init *resolveBitReference(Record &R, const RecordVal *RV, + unsigned Bit) { + assert(0 && "Illegal bit reference off int"); + return 0; + } + + /// resolveListElementReference - This method is used to implement + /// VarListElementInit::resolveReferences. If the list element is resolvable + /// now, we return the resolved value, otherwise we return null. + virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, + unsigned Elt) { + assert(0 && "Illegal element reference off int"); + return 0; + } }; @@ -688,17 +710,18 @@ /// ListInit - [AL, AH, CL] - Represent a list of defs /// -class ListInit : public Init { +class ListInit : public TypedInit { std::vector Values; public: typedef std::vector::iterator iterator; typedef std::vector::const_iterator const_iterator; - explicit ListInit(std::vector &Vs) { + explicit ListInit(std::vector &Vs, RecTy *EltTy) + : TypedInit(new ListRecTy(EltTy)) { Values.swap(Vs); } - explicit ListInit(iterator Start, iterator End) - : Values(Start, End) {} + explicit ListInit(iterator Start, iterator End, RecTy *EltTy) + : TypedInit(new ListRecTy(EltTy)), Values(Start, End) {} unsigned getSize() const { return Values.size(); } Init *getElement(unsigned i) const { @@ -730,6 +753,22 @@ inline size_t size () const { return Values.size(); } inline bool empty() const { return Values.empty(); } + + /// resolveBitReference - This method is used to implement + /// VarBitInit::resolveReferences. If the bit is able to be resolved, we + /// simply return the resolved value, otherwise we return null. + /// + virtual Init *resolveBitReference(Record &R, const RecordVal *RV, + unsigned Bit) { + assert(0 && "Illegal bit reference off list"); + return 0; + } + + /// resolveListElementReference - This method is used to implement + /// VarListElementInit::resolveReferences. If the list element is resolvable + /// now, we return the resolved value, otherwise we return null. + virtual Init *resolveListElementReference(Record &R, const RecordVal *RV, + unsigned Elt); }; Modified: llvm/trunk/utils/TableGen/TGParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=73078&r1=73077&r2=73078&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGParser.cpp (original) +++ llvm/trunk/utils/TableGen/TGParser.cpp Mon Jun 8 15:23:18 2009 @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include +#include #include "TGParser.h" #include "Record.h" @@ -396,7 +397,7 @@ return Result; } - Result.TemplateArgs = ParseValueList(CurRec); + Result.TemplateArgs = ParseValueList(CurRec, Result.Rec); if (Result.TemplateArgs.empty()) { Result.Rec = 0; // Error parsing value list. return Result; @@ -438,7 +439,7 @@ return Result; } - Result.TemplateArgs = ParseValueList(&CurMC->Rec); + Result.TemplateArgs = ParseValueList(&CurMC->Rec, &Result.MC->Rec); if (Result.TemplateArgs.empty()) { Result.MC = 0; // Error parsing value list. return Result; @@ -728,21 +729,28 @@ || Code == UnOpInit::CDR || Code == UnOpInit::LNULL) { ListInit *LHSl = dynamic_cast(LHS); + StringInit *LHSs = dynamic_cast(LHS); TypedInit *LHSt = dynamic_cast(LHS); - if (LHSl == 0 && LHSt == 0) { - TokError("expected list type argument in unary operator"); + if (LHSl == 0 && LHSs == 0 && LHSt == 0) { + TokError("expected list or string type argument in unary operator"); return 0; } if (LHSt) { ListRecTy *LType = dynamic_cast(LHSt->getType()); - if (LType == 0) { - TokError("expected list type argumnet in unary operator"); + StringRecTy *SType = dynamic_cast(LHSt->getType()); + if (LType == 0 && SType == 0) { + TokError("expected list or string type argumnet in unary operator"); return 0; } } if (Code == UnOpInit::CAR || Code == UnOpInit::CDR) { + if (LHSl == 0 && LHSt == 0) { + TokError("expected list type argumnet in unary operator"); + return 0; + } + if (LHSl && LHSl->getSize() == 0) { TokError("empty list argument in unary operator"); return 0; @@ -1017,7 +1025,7 @@ /// SimpleValue ::= SRLTOK '(' Value ',' Value ')' /// SimpleValue ::= STRCONCATTOK '(' Value ',' Value ')' /// -Init *TGParser::ParseSimpleValue(Record *CurRec) { +Init *TGParser::ParseSimpleValue(Record *CurRec, RecTy *ItemType) { Init *R = 0; switch (Lex.getCode()) { default: TokError("Unknown token when parsing a value"); break; @@ -1049,15 +1057,7 @@ TokError("expected non-empty value list"); return 0; } - std::vector ValueList = ParseValueList(CurRec); - if (ValueList.empty()) return 0; - - if (Lex.getCode() != tgtok::greater) { - TokError("expected '>' at end of value list"); - return 0; - } - Lex.Lex(); // eat the '>' - + // This is a CLASS expression. This is supposed to synthesize // a new anonymous definition, deriving from CLASS with no // body. @@ -1066,6 +1066,15 @@ Error(NameLoc, "Expected a class name, got '" + Name + "'"); return 0; } + + std::vector ValueList = ParseValueList(CurRec, Class); + if (ValueList.empty()) return 0; + + if (Lex.getCode() != tgtok::greater) { + TokError("expected '>' at end of value list"); + return 0; + } + Lex.Lex(); // eat the '>' // Create the new record, set it as CurRec temporarily. static unsigned AnonCounter = 0; @@ -1114,8 +1123,22 @@ Lex.Lex(); // eat the '[' std::vector Vals; + RecTy *DeducedEltTy = 0; + ListRecTy *GivenListTy = 0; + + if (ItemType != 0) { + ListRecTy *ListType = dynamic_cast(ItemType); + if (ListType == 0) { + std::stringstream s; + s << "Type mismatch for list, expected list type, got " + << ItemType->getAsString(); + TokError(s.str()); + } + GivenListTy = ListType; + } + if (Lex.getCode() != tgtok::r_square) { - Vals = ParseValueList(CurRec); + Vals = ParseValueList(CurRec, 0, GivenListTy ? GivenListTy->getElementType() : 0); if (Vals.empty()) return 0; } if (Lex.getCode() != tgtok::r_square) { @@ -1123,7 +1146,77 @@ return 0; } Lex.Lex(); // eat the ']' - return new ListInit(Vals); + + RecTy *GivenEltTy = 0; + if (Lex.getCode() == tgtok::less) { + // Optional list element type + Lex.Lex(); // eat the '<' + + GivenEltTy = ParseType(); + if (GivenEltTy == 0) { + // Couldn't parse element type + return 0; + } + + if (Lex.getCode() != tgtok::greater) { + TokError("expected '>' at end of list element type"); + return 0; + } + Lex.Lex(); // eat the '>' + } + + // Check elements + RecTy *EltTy = 0; + for (std::vector::iterator i = Vals.begin(), ie = Vals.end(); + i != ie; + ++i) { + TypedInit *TArg = dynamic_cast(*i); + if (TArg == 0) { + TokError("Untyped list element"); + return 0; + } + if (EltTy != 0) { + EltTy = resolveTypes(EltTy, TArg->getType()); + if (EltTy == 0) { + TokError("Incompatible types in list elements"); + return 0; + } + } + else { + EltTy = TArg->getType(); + } + } + + if (GivenEltTy != 0) { + if (EltTy != 0) { + // Verify consistency + if (!EltTy->typeIsConvertibleTo(GivenEltTy)) { + TokError("Incompatible types in list elements"); + return 0; + } + } + EltTy = GivenEltTy; + } + + if (EltTy == 0) { + if (ItemType == 0) { + TokError("No type for list"); + return 0; + } + DeducedEltTy = GivenListTy->getElementType(); + } + else { + // Make sure the deduced type is compatible with the given type + if (GivenListTy) { + if (!EltTy->typeIsConvertibleTo(GivenListTy->getElementType())) { + TokError("Element type mismatch for list"); + return 0; + } + } + DeducedEltTy = EltTy; + } + + return new ListInit(Vals, DeducedEltTy); } case tgtok::l_paren: { // Value ::= '(' IDValue DagArgList ')' Lex.Lex(); // eat the '(' @@ -1200,8 +1293,8 @@ /// ValueSuffix ::= '[' BitList ']' /// ValueSuffix ::= '.' ID /// -Init *TGParser::ParseValue(Record *CurRec) { - Init *Result = ParseSimpleValue(CurRec); +Init *TGParser::ParseValue(Record *CurRec, RecTy *ItemType) { + Init *Result = ParseSimpleValue(CurRec, ItemType); if (Result == 0) return 0; // Parse the suffixes now if present. @@ -1306,15 +1399,31 @@ /// /// ValueList ::= Value (',' Value) /// -std::vector TGParser::ParseValueList(Record *CurRec) { +std::vector TGParser::ParseValueList(Record *CurRec, Record *ArgsRec, RecTy *EltTy) { std::vector Result; - Result.push_back(ParseValue(CurRec)); + RecTy *ItemType = EltTy; + int ArgN = 0; + if (ArgsRec != 0 && EltTy == 0) { + const std::vector &TArgs = ArgsRec->getTemplateArgs(); + const RecordVal *RV = ArgsRec->getValue(TArgs[ArgN]); + assert(RV && "Template argument record not found??"); + ItemType = RV->getType(); + ++ArgN; + } + Result.push_back(ParseValue(CurRec, ItemType)); if (Result.back() == 0) return std::vector(); while (Lex.getCode() == tgtok::comma) { Lex.Lex(); // Eat the comma - Result.push_back(ParseValue(CurRec)); + if (ArgsRec != 0 && EltTy == 0) { + const std::vector &TArgs = ArgsRec->getTemplateArgs(); + const RecordVal *RV = ArgsRec->getValue(TArgs[ArgN]); + assert(RV && "Template argument record not found??"); + ItemType = RV->getType(); + ++ArgN; + } + Result.push_back(ParseValue(CurRec, ItemType)); if (Result.back() == 0) return std::vector(); } @@ -1369,7 +1478,7 @@ if (Lex.getCode() == tgtok::equal) { Lex.Lex(); TGLoc ValLoc = Lex.getLoc(); - Init *Val = ParseValue(CurRec); + Init *Val = ParseValue(CurRec, Type); if (Val == 0 || SetValue(CurRec, ValLoc, DeclName, std::vector(), Val)) return ""; @@ -1447,7 +1556,13 @@ return TokError("expected '=' in let expression"); Lex.Lex(); // eat the '='. - Init *Val = ParseValue(CurRec); + RecordVal *Field = CurRec->getValue(FieldName); + if (Field == 0) + return TokError("Value '" + FieldName + "' unknown!"); + + RecTy *Type = Field->getType(); + + Init *Val = ParseValue(CurRec, Type); if (Val == 0) return true; if (Lex.getCode() != tgtok::semi) Modified: llvm/trunk/utils/TableGen/TGParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.h?rev=73078&r1=73077&r2=73078&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGParser.h (original) +++ llvm/trunk/utils/TableGen/TGParser.h Mon Jun 8 15:23:18 2009 @@ -93,9 +93,9 @@ Init *ParseIDValue(Record *CurRec); Init *ParseIDValue(Record *CurRec, const std::string &Name, TGLoc NameLoc); - Init *ParseSimpleValue(Record *CurRec); - Init *ParseValue(Record *CurRec); - std::vector ParseValueList(Record *CurRec); + Init *ParseSimpleValue(Record *CurRec, RecTy *ItemType = 0); + Init *ParseValue(Record *CurRec, RecTy *ItemType = 0); + std::vector ParseValueList(Record *CurRec, Record *ArgsRec = 0, RecTy *EltTy = 0); std::vector > ParseDagArgList(Record *); bool ParseOptionalRangeList(std::vector &Ranges); bool ParseOptionalBitList(std::vector &Ranges); From asl at math.spbu.ru Mon Jun 8 15:29:06 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 08 Jun 2009 20:29:06 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r73079 - /llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md Message-ID: <200906082029.n58KT7U0029379@zion.cs.uiuc.edu> Author: asl Date: Mon Jun 8 15:29:06 2009 New Revision: 73079 URL: http://llvm.org/viewvc/llvm-project?rev=73079&view=rev Log: Add LLVM LOCAL marker Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md?rev=73079&r1=73078&r2=73079&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm-tune.md Mon Jun 8 15:29:06 2009 @@ -1,3 +1,4 @@ +/* LLVM LOCAL (entire file!) */ ;; -*- buffer-read-only: t -*- ;; Generated automatically by gentune.sh from arm-cores.def (define_attr "tune" From asl at math.spbu.ru Mon Jun 8 15:31:02 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 08 Jun 2009 20:31:02 -0000 Subject: [llvm-commits] [llvm] r73080 - /llvm/trunk/lib/Target/ARM/ARMSubtarget.h Message-ID: <200906082031.n58KV2E8029497@zion.cs.uiuc.edu> Author: asl Date: Mon Jun 8 15:31:02 2009 New Revision: 73080 URL: http://llvm.org/viewvc/llvm-project?rev=73080&view=rev Log: Add helper for checking of Thumb1 mode Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=73080&r1=73079&r2=73080&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original) +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Mon Jun 8 15:31:02 2009 @@ -105,6 +105,7 @@ bool isAAPCS_ABI() const { return TargetABI == ARM_ABI_AAPCS; } bool isThumb() const { return IsThumb; } + bool isThumb1() const { return IsThumb && (ThumbMode == Thumb1); } bool isThumb2() const { return IsThumb && (ThumbMode >= Thumb2); } bool useThumbBacktraces() const { return UseThumbBacktraces; } From stefanus.dutoit at rapidmind.com Mon Jun 8 16:18:31 2009 From: stefanus.dutoit at rapidmind.com (Stefanus Du Toit) Date: Mon, 08 Jun 2009 21:18:31 -0000 Subject: [llvm-commits] [llvm] r73084 - /llvm/trunk/CMakeLists.txt Message-ID: <200906082118.n58LIVYo031531@zion.cs.uiuc.edu> Author: sdt Date: Mon Jun 8 16:18:31 2009 New Revision: 73084 URL: http://llvm.org/viewvc/llvm-project?rev=73084&view=rev Log: Allow setting the C runtime to be used with MSVC from cmake. Patch by Tareq Siraj. Modified: llvm/trunk/CMakeLists.txt Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=73084&r1=73083&r2=73084&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Mon Jun 8 16:18:31 2009 @@ -186,11 +186,26 @@ endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 ) if( MSVC ) + # List of valid CRTs for MSVC + set(MSVC_CRT + MD + MDd) + + set(LLVM_USE_CRT "" CACHE STRING "Specify VC++ CRT to use for debug/release configurations.") add_llvm_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS ) add_llvm_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS ) add_llvm_definitions( -D_SCL_SECURE_NO_DEPRECATE ) add_llvm_definitions( -wd4146 -wd4503 -wd4996 -wd4800 -wd4244 -wd4624 ) add_llvm_definitions( -wd4355 -wd4715 -wd4180 -wd4345 -wd4224 ) + + if (NOT ${LLVM_USE_CRT} STREQUAL "") + list(FIND MSVC_CRT ${LLVM_USE_CRT} idx) + if (idx LESS 0) + message(FATAL_ERROR "Invalid value for LLVM_USE_CRT: ${LLVM_USE_CRT}. Valid options are one of: ${MSVC_CRT}") + endif (idx LESS 0) + add_llvm_definitions("/${LLVM_USE_CRT}") + message(STATUS "Using VC++ CRT: ${LLVM_USE_CRT}") + endif (NOT ${LLVM_USE_CRT} STREQUAL "") endif( MSVC ) include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR}) From asl at math.spbu.ru Mon Jun 8 16:20:36 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 08 Jun 2009 21:20:36 -0000 Subject: [llvm-commits] [llvm] r73085 - in /llvm/trunk/lib/Target/ARM: ARM.td ARMSubtarget.h Message-ID: <200906082120.n58LKadu031627@zion.cs.uiuc.edu> Author: asl Date: Mon Jun 8 16:20:36 2009 New Revision: 73085 URL: http://llvm.org/viewvc/llvm-project?rev=73085&view=rev Log: Separate V6 from V6T2 since the latter has some extra nice instructions Modified: llvm/trunk/lib/Target/ARM/ARM.td llvm/trunk/lib/Target/ARM/ARMSubtarget.h Modified: llvm/trunk/lib/Target/ARM/ARM.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARM.td?rev=73085&r1=73084&r2=73085&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARM.td (original) +++ llvm/trunk/lib/Target/ARM/ARM.td Mon Jun 8 16:20:36 2009 @@ -28,6 +28,8 @@ "ARM v5TE, v5TEj, v5TExp">; def ArchV6 : SubtargetFeature<"v6", "ARMArchVersion", "V6", "ARM v6">; +def ArchV6T2 : SubtargetFeature<"v6t2", "ARMArchVersion", "V6T2", + "ARM v6t2">; def ArchV7A : SubtargetFeature<"v7a", "ARMArchVersion", "V7A", "ARM v7A">; def FeatureVFP2 : SubtargetFeature<"vfp2", "ARMFPUType", "VFPv2", @@ -92,9 +94,11 @@ def : Proc<"mpcorenovfp", [ArchV6]>; def : Proc<"mpcore", [ArchV6, FeatureVFP2]>; -def : Proc<"arm1156t2-s", [ArchV6, FeatureThumb2]>; -def : Proc<"arm1156t2f-s", [ArchV6, FeatureThumb2, FeatureVFP2]>; +// V6T2 Processors. +def : Proc<"arm1156t2-s", [ArchV6T2, FeatureThumb2]>; +def : Proc<"arm1156t2f-s", [ArchV6T2, FeatureThumb2, FeatureVFP2]>; +// V7 Processors. def : Proc<"cortex-a8", [ArchV7A, FeatureThumb2, FeatureNEON]>; def : Proc<"cortex-a9", [ArchV7A, FeatureThumb2, FeatureNEON]>; Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=73085&r1=73084&r2=73085&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original) +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Mon Jun 8 16:20:36 2009 @@ -23,7 +23,7 @@ class ARMSubtarget : public TargetSubtarget { protected: enum ARMArchEnum { - V4T, V5T, V5TE, V6, V7A + V4T, V5T, V5TE, V6, V6T2, V7A }; enum ARMFPEnum { @@ -92,6 +92,7 @@ bool hasV5TOps() const { return ARMArchVersion >= V5T; } bool hasV5TEOps() const { return ARMArchVersion >= V5TE; } bool hasV6Ops() const { return ARMArchVersion >= V6; } + bool hasV6T2Ops() const { return ARMArchVersion >= V6T2; } bool hasV7Ops() const { return ARMArchVersion >= V7A; } bool hasVFP2() const { return ARMFPUType >= VFPv2; } From dalej at apple.com Mon Jun 8 17:17:27 2009 From: dalej at apple.com (Dale Johannesen) Date: Mon, 08 Jun 2009 22:17:27 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r73088 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h Message-ID: <200906082217.n58MHR80001480@zion.cs.uiuc.edu> Author: johannes Date: Mon Jun 8 17:17:26 2009 New Revision: 73088 URL: http://llvm.org/viewvc/llvm-project?rev=73088&view=rev Log: Weak imports on Darwin do not apply to data definitions. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=73088&r1=73087&r2=73088&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Mon Jun 8 17:17:26 2009 @@ -662,18 +662,19 @@ /* As in the warning above, alias definitions aren't supported on Mach-O. */ #define TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS -/* weak_import, a Darwin special, does not make function definitions weak. */ +/* weak_import, a Darwin special, does not make definitions weak. */ #define TARGET_ADJUST_LLVM_LINKAGE(FN, DECL) \ do { \ if ((DECL) && \ - TREE_CODE (DECL) == FUNCTION_DECL && \ - !DECL_EXTERNAL (DECL) && \ + (TREE_CODE (DECL) != FUNCTION_DECL || !DECL_EXTERNAL (DECL)) && \ TREE_PUBLIC (DECL) && \ DECL_WEAK (DECL) && \ ! lookup_attribute ("weak", DECL_ATTRIBUTES (DECL)) && \ lookup_attribute ("weak_import", DECL_ATTRIBUTES (DECL)) && \ (FN)->hasWeakLinkage()) { \ - (FN)->setLinkage(Function::ExternalLinkage); \ + (FN)->setLinkage(TREE_CODE(DECL)==FUNCTION_DECL ? \ + Function::ExternalLinkage : \ + GlobalValue::ExternalLinkage); \ } \ } while (0) From daniel at zuster.org Mon Jun 8 17:17:53 2009 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 08 Jun 2009 22:17:53 -0000 Subject: [llvm-commits] [llvm] r73089 - /llvm/trunk/docs/LangRef.html Message-ID: <200906082217.n58MHsil001522@zion.cs.uiuc.edu> Author: ddunbar Date: Mon Jun 8 17:17:53 2009 New Revision: 73089 URL: http://llvm.org/viewvc/llvm-project?rev=73089&view=rev Log: Document the stack alignment part of target data description. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=73089&r1=73088&r2=73089&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Mon Jun 8 17:17:53 2009 @@ -1177,6 +1177,9 @@
asize:abi:pref
This specifies the alignment for an aggregate type of a given bit size.
+
ssize:abi:pref
+
This specifies the alignment for a stack object of a given bit + size.

When constructing the data layout for a given target, LLVM starts with a default set of specifications which are then (possibly) overriden by the @@ -1196,6 +1199,7 @@

  • v64:64:64 - 64-bit vector is 64-bit aligned
  • v128:128:128 - 128-bit vector is 128-bit aligned
  • a0:0:1 - aggregates are 8-bit aligned
  • +
  • s0:64:64 - stack objects are 64-bit aligned
  • When LLVM is determining the alignment for a given type, it uses the following rules:

    From greened at obbligato.org Mon Jun 8 17:20:58 2009 From: greened at obbligato.org (David Greene) Date: Mon, 08 Jun 2009 22:20:58 -0000 Subject: [llvm-commits] [llvm] r73090 - /llvm/trunk/test/TableGen/Slice.td Message-ID: <200906082220.n58MKxSS001670@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 8 17:20:58 2009 New Revision: 73090 URL: http://llvm.org/viewvc/llvm-project?rev=73090&view=rev Log: Fix DejaGNU run line to escape special characters. Modified: llvm/trunk/test/TableGen/Slice.td Modified: llvm/trunk/test/TableGen/Slice.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/Slice.td?rev=73090&r1=73089&r2=73090&view=diff ============================================================================== --- llvm/trunk/test/TableGen/Slice.td (original) +++ llvm/trunk/test/TableGen/Slice.td Mon Jun 8 17:20:58 2009 @@ -1,5 +1,5 @@ -// RUN: tblgen %s | grep {[(set VR128:$dst, (int_x86_sse2_add_pd VR128:$src1, VR128:$src2))]} | count 1 -// RUN: tblgen %s | grep {[(set VR128:$dst, (int_x86_sse2_add_ps VR128:$src1, VR128:$src2))]} | count 2 +// RUN: tblgen %s | grep {\\\[(set} | count 2 +// RUN: tblgen %s | grep {\\\[\\\]} | count 2 class ValueType { int Size = size; From greened at obbligato.org Mon Jun 8 17:34:57 2009 From: greened at obbligato.org (David Greene) Date: Mon, 08 Jun 2009 22:34:57 -0000 Subject: [llvm-commits] [llvm] r73091 - /llvm/trunk/test/TableGen/if.td Message-ID: <200906082234.n58MYvZU002169@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 8 17:34:57 2009 New Revision: 73091 URL: http://llvm.org/viewvc/llvm-project?rev=73091&view=rev Log: Add a more robust !if test. Modified: llvm/trunk/test/TableGen/if.td Modified: llvm/trunk/test/TableGen/if.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/if.td?rev=73091&r1=73090&r2=73091&view=diff ============================================================================== --- llvm/trunk/test/TableGen/if.td (original) +++ llvm/trunk/test/TableGen/if.td Mon Jun 8 17:34:57 2009 @@ -1,5 +1,5 @@ -// RUN: tblgen %s | grep {1, 2, 3} | count 4 -// RUN: tblgen %s | grep {4, 5, 6} | count 2 +// RUN: tblgen %s | grep {\\\[1, 2, 3\\\]} | count 4 +// RUN: tblgen %s | grep {\\\[4, 5, 6\\\]} | count 2 class A> vals> { list first = vals[0]; From greened at obbligato.org Mon Jun 8 17:38:08 2009 From: greened at obbligato.org (David Greene) Date: Mon, 08 Jun 2009 22:38:08 -0000 Subject: [llvm-commits] [llvm] r73092 - /llvm/trunk/docs/TableGenFundamentals.html Message-ID: <200906082238.n58Mc8TB002309@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 8 17:38:07 2009 New Revision: 73092 URL: http://llvm.org/viewvc/llvm-project?rev=73092&view=rev Log: Update documentation. Modified: llvm/trunk/docs/TableGenFundamentals.html Modified: llvm/trunk/docs/TableGenFundamentals.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGenFundamentals.html?rev=73092&r1=73091&r2=73092&view=diff ============================================================================== --- llvm/trunk/docs/TableGenFundamentals.html (original) +++ llvm/trunk/docs/TableGenFundamentals.html Mon Jun 8 17:38:07 2009 @@ -371,8 +371,11 @@
    string value
    [{ ... }]
    code fragment
    -
    [ X, Y, Z ]
    -
    list value.
    +
    [ X, Y, Z ]
    +
    list value. is the type of the list +element and is usually optional. In rare cases, +TableGen is unable to deduce the element type in +which case the user must specify it explicitly.
    { a, b, c }
    initializer for a "bits<3>" value
    value
    From asl at math.spbu.ru Mon Jun 8 17:53:57 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 08 Jun 2009 22:53:57 -0000 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegisterInfo.td lib/Target/ARM/ARMSubtarget.cpp lib/Target/TargetMachine.cpp lib/Target/X86/X86Subtarget.cpp Message-ID: <200906082253.n58Mrvgx002792@zion.cs.uiuc.edu> Author: asl Date: Mon Jun 8 17:53:56 2009 New Revision: 73095 URL: http://llvm.org/viewvc/llvm-project?rev=73095&view=rev Log: The attached patches implement most of the ARM AAPCS-VFP hard float ABI. The missing piece is support for putting "homogeneous aggregates" into registers. Patch by Sandeep Patel! Modified: llvm/trunk/include/llvm/Target/TargetMachine.h llvm/trunk/include/llvm/Target/TargetOptions.h llvm/trunk/lib/Target/ARM/ARMCallingConv.td llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp llvm/trunk/lib/Target/TargetMachine.cpp llvm/trunk/lib/Target/X86/X86Subtarget.cpp Modified: llvm/trunk/include/llvm/Target/TargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=73095&r1=73094&r2=73095&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetMachine.h (original) +++ llvm/trunk/include/llvm/Target/TargetMachine.h Mon Jun 8 17:53:56 2009 @@ -78,6 +78,14 @@ }; } +namespace FloatABI { + enum ABIType { + Default, + Soft, + Hard + }; +} + //===----------------------------------------------------------------------===// /// /// TargetMachine - Primary interface to the complete machine description for @@ -88,7 +96,7 @@ TargetMachine(const TargetMachine &); // DO NOT IMPLEMENT void operator=(const TargetMachine &); // DO NOT IMPLEMENT protected: // Can only create subclasses. - TargetMachine() : AsmInfo(0) { } + TargetMachine(); /// getSubtargetImpl - virtual method implemented by subclasses that returns /// a reference to that target's TargetSubtarget-derived member variable. Modified: llvm/trunk/include/llvm/Target/TargetOptions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=73095&r1=73094&r2=73095&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetOptions.h (original) +++ llvm/trunk/include/llvm/Target/TargetOptions.h Mon Jun 8 17:53:56 2009 @@ -73,6 +73,14 @@ /// target FP instructions. extern bool UseSoftFloat; + /// FloatABIType - This setting is set by -float-abi=xxx option is specfied + /// on the command line. This setting may either be Default, Soft, or Hard. + /// Default selects the target's default behavior. Soft selects the ABI for + /// UseSoftFloat, but does not inidcate that FP hardware may not be used. + /// Such a combination is unfortunately popular (e.g. arm-apple-darwin). + /// Hard presumes that the normal FP ABI is used. + extern FloatABI::ABIType FloatABIType; + /// NoZerosInBSS - By default some codegens place zero-initialized data to /// .bss section. This flag disables such behaviour (necessary, e.g. for /// crt*.o compiling). Modified: llvm/trunk/lib/Target/ARM/ARMCallingConv.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCallingConv.td?rev=73095&r1=73094&r2=73095&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCallingConv.td (original) +++ llvm/trunk/lib/Target/ARM/ARMCallingConv.td Mon Jun 8 17:53:56 2009 @@ -17,6 +17,11 @@ class CCIfAlign: CCIf; +/// CCIfFloatABI - Match of the float ABI and the arg. ABIType may be "Hard" or +/// "Soft". +class CCIfFloatABI: + CCIf; + //===----------------------------------------------------------------------===// // ARM APCS Calling Convention //===----------------------------------------------------------------------===// @@ -43,9 +48,10 @@ ]>; //===----------------------------------------------------------------------===// -// ARM AAPCS (EABI) Calling Convention +// ARM AAPCS (EABI) Calling Convention, common parts //===----------------------------------------------------------------------===// -def CC_ARM_AAPCS : CallingConv<[ + +def CC_ARM_AAPCS_Common : CallingConv<[ CCIfType<[i8, i16], CCPromoteToType>, @@ -53,23 +59,51 @@ // i64 is 8-aligned i32 here, so we may need to eat R1 as a pad register // (and the same is true for f64 if VFP is not enabled) CCIfType<[i32], CCIfAlign<"8", CCAssignToRegWithShadow<[R0, R2], [R0, R1]>>>, - CCIfType<[f64], CCCustom<"CC_ARM_AAPCS_Custom_f64">>, - - CCIfType<[f32], CCBitConvertToType>, CCIfType<[i32], CCIf<"State.getNextStackOffset() == 0 &&" "ArgFlags.getOrigAlign() != 8", CCAssignToReg<[R0, R1, R2, R3]>>>, - CCIfType<[i32], CCAssignToStack<4, 4>>, + CCIfType<[i32, f32], CCAssignToStack<4, 4>>, CCIfType<[f64], CCAssignToStack<8, 8>> ]>; -def RetCC_ARM_AAPCS : CallingConv<[ +def RetCC_ARM_AAPCS_Common : CallingConv<[ + CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>> + CCIfType<[i64], CCAssignToRegWithShadow<[R0, R2], [R1, R3]>> +]>; + +//===----------------------------------------------------------------------===// +// ARM AAPCS (EABI) Calling Convention +//===----------------------------------------------------------------------===// + +def CC_ARM_AAPCS : CallingConv<[ + CCIfType<[f64], CCCustom<"CC_ARM_AAPCS_Custom_f64">>, CCIfType<[f32], CCBitConvertToType>, + CCDelegateTo +]>; + +def RetCC_ARM_AAPCS : CallingConv<[ CCIfType<[f64], CCCustom<"RetCC_ARM_AAPCS_Custom_f64">>, + CCIfType<[f32], CCBitConvertToType>, + CCDelegateTo +]>; - CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>>, - CCIfType<[i64], CCAssignToRegWithShadow<[R0, R2], [R1, R3]>> +//===----------------------------------------------------------------------===// +// ARM AAPCS-VFP (EABI) Calling Convention +//===----------------------------------------------------------------------===// + +def CC_ARM_AAPCS_VFP : CallingConv<[ + CCIfType<[f64], CCAssignToReg<[D0, D1, D2, D3, D4, D5, D6, D7]>>, + CCIfType<[f32], CCAssignToReg<[S0, S1, S2, S3, S4, S5, S6, S7, S8, + S9, S10, S11, S12, S13, S14, S15]>>, + CCDelegateTo +]>; + +def RetCC_ARM_AAPCS_VFP : CallingConv<[ + CCIfType<[f64], CCAssignToReg<[D0, D1, D2, D3, D4, D5, D6, D7]>>, + CCIfType<[f32], CCAssignToReg<[S0, S1, S2, S3, S4, S5, S6, S7, S8, + S9, S10, S11, S12, S13, S14, S15]>>, + CCDelegateTo ]>; //===----------------------------------------------------------------------===// @@ -77,11 +111,19 @@ //===----------------------------------------------------------------------===// def CC_ARM : CallingConv<[ + CCIfSubtarget<"isAAPCS_ABI()", + CCIfSubtarget<"hasVFP2()", + CCIfFloatABI<"Hard", + CCDelegateTo>>>, CCIfSubtarget<"isAAPCS_ABI()", CCDelegateTo>, CCDelegateTo ]>; def RetCC_ARM : CallingConv<[ + CCIfSubtarget<"isAAPCS_ABI()", + CCIfSubtarget<"hasVFP2()", + CCIfFloatABI<"Hard", + CCDelegateTo>>>, CCIfSubtarget<"isAAPCS_ABI()", CCDelegateTo>, CCDelegateTo ]>; Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=73095&r1=73094&r2=73095&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Jun 8 17:53:56 2009 @@ -549,6 +549,10 @@ switch (N->getOpcode()) { default: break; case ISD::Constant: { + // ARMv6T2 and later should materialize imms via MOV / MOVT pair. + if (Subtarget->hasV6T2Ops()) + break; + unsigned Val = cast(N)->getZExtValue(); bool UseCP = true; if (Subtarget->isThumb()) @@ -559,6 +563,7 @@ UseCP = (ARM_AM::getSOImmVal(Val) == -1 && // MOV ARM_AM::getSOImmVal(~Val) == -1 && // MVN !ARM_AM::isSOImmTwoPartVal(Val)); // two instrs. + if (UseCP) { SDValue CPIdx = CurDAG->getTargetConstantPool(ConstantInt::get(Type::Int32Ty, Val), @@ -570,7 +575,7 @@ CPIdx, CurDAG->getEntryNode()); else { SDValue Ops[] = { - CPIdx, + CPIdx, CurDAG->getRegister(0, MVT::i32), CurDAG->getTargetConstant(0, MVT::i32), getAL(CurDAG), @@ -583,7 +588,7 @@ ReplaceUses(Op, SDValue(ResNode, 0)); return NULL; } - + // Other cases are autogenerated. break; } Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=73095&r1=73094&r2=73095&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Jun 8 17:53:56 2009 @@ -1101,7 +1101,12 @@ else RC = ARM::GPRRegisterClass; - if (RegVT == MVT::f64) { + if (FloatABIType == FloatABI::Hard) { + if (RegVT == MVT::f32) + RC = ARM::SPRRegisterClass; + else if (RegVT == MVT::f64) + RC = ARM::DPRRegisterClass; + } else if (RegVT == MVT::f64) { // f64 is passed in pairs of GPRs and must be combined. RegVT = MVT::i32; } else if (!((RegVT == MVT::i32) || (RegVT == MVT::f32))) Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td?rev=73095&r1=73094&r2=73095&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td Mon Jun 8 17:53:56 2009 @@ -219,3 +219,18 @@ // Condition code registers. def CCR : RegisterClass<"ARM", [i32], 32, [CPSR]>; + +//===----------------------------------------------------------------------===// +// Subregister Set Definitions... now that we have all of the pieces, define the +// sub registers for each register. +// + +def : SubRegSet<1, [D0, D1, D2, D3, D4, D5, D6, D7, + D8, D9, D10, D11, D12, D13, D14, D15], + [S0, S2, S4, S6, S8, S10, S12, S14, + S16, S18, S20, S22, S24, S26, S28, S30]>; + +def : SubRegSet<2, [D0, D1, D2, D3, D4, D5, D6, D7, + D8, D9, D10, D11, D12, D13, D14, D15], + [S1, S3, S5, S7, S9, S11, S13, S15, + S17, S19, S21, S23, S25, S27, S29, S31]>; Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=73095&r1=73094&r2=73095&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Mon Jun 8 17:53:56 2009 @@ -14,6 +14,8 @@ #include "ARMSubtarget.h" #include "ARMGenSubtarget.inc" #include "llvm/Module.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetOptions.h" using namespace llvm; ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, @@ -28,6 +30,10 @@ , CPUString("generic") , TargetType(isELF) // Default to ELF unless otherwise specified. , TargetABI(ARM_ABI_APCS) { + // default to soft float ABI + if (FloatABIType == FloatABI::Default) + FloatABIType = FloatABI::Soft; + // Determine default and user specified characteristics // Parse features string. Modified: llvm/trunk/lib/Target/TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=73095&r1=73094&r2=73095&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/TargetMachine.cpp Mon Jun 8 17:53:56 2009 @@ -30,6 +30,7 @@ bool FiniteOnlyFPMathOption; bool HonorSignDependentRoundingFPMathOption; bool UseSoftFloat; + FloatABI::ABIType FloatABIType; bool NoImplicitFloat; bool NoZerosInBSS; bool ExceptionHandling; @@ -84,6 +85,19 @@ cl::desc("Generate software floating point library calls"), cl::location(UseSoftFloat), cl::init(false)); +static cl::opt +FloatABIForCalls("float-abi", + cl::desc("Choose float ABI type"), + cl::location(FloatABIType), + cl::init(FloatABI::Default), + cl::values( + clEnumValN(FloatABI::Default, "default", + "Target default float ABI type"), + clEnumValN(FloatABI::Soft, "soft", + "Soft float ABI (implied by -soft-float)"), + clEnumValN(FloatABI::Hard, "hard", + "Hard float ABI (uses FP registers)"), + clEnumValEnd)); static cl::opt DontPlaceZerosInBSS("nozero-initialized-in-bss", cl::desc("Don't place zero-initialized symbols into bss section"), @@ -162,6 +176,14 @@ // TargetMachine Class // +TargetMachine::TargetMachine() + : AsmInfo(0) { + // Typically it will be subtargets that will adjust FloatABIType from Default + // to Soft or Hard. + if (UseSoftFloat) + FloatABIType = FloatABI::Soft; +} + TargetMachine::~TargetMachine() { delete AsmInfo; } Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=73095&r1=73094&r2=73095&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Mon Jun 8 17:53:56 2009 @@ -350,6 +350,10 @@ , MaxInlineSizeThreshold(128) , Is64Bit(is64Bit) , TargetType(isELF) { // Default to ELF unless otherwise specified. + + // default to hard float ABI + if (FloatABIType == FloatABI::Default) + FloatABIType = FloatABI::Hard; // Determine default and user specified characteristics if (!FS.empty()) { From asl at math.spbu.ru Mon Jun 8 17:54:15 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 08 Jun 2009 22:54:15 -0000 Subject: [llvm-commits] [llvm] r73096 - /llvm/trunk/test/CodeGen/ARM/arguments_f64_backfill.ll Message-ID: <200906082254.n58MsFfF002816@zion.cs.uiuc.edu> Author: asl Date: Mon Jun 8 17:54:15 2009 New Revision: 73096 URL: http://llvm.org/viewvc/llvm-project?rev=73096&view=rev Log: Add testcase for register scanveger assertion fix in r72755 (double def due to livevars) Added: llvm/trunk/test/CodeGen/ARM/arguments_f64_backfill.ll Added: llvm/trunk/test/CodeGen/ARM/arguments_f64_backfill.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/arguments_f64_backfill.ll?rev=73096&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/arguments_f64_backfill.ll (added) +++ llvm/trunk/test/CodeGen/ARM/arguments_f64_backfill.ll Mon Jun 8 17:54:15 2009 @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | llc -mtriple=arm-linux-gnueabi -mattr=+vfp2 -float-abi=hard | grep {fcpys s0, s1} + +define float @f(float %z, double %a, float %b) { + %tmp = call float @g(float %b) + ret float %tmp +} + +declare float @g(float) From asl at math.spbu.ru Mon Jun 8 17:57:18 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 08 Jun 2009 22:57:18 -0000 Subject: [llvm-commits] [llvm] r73097 - /llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Message-ID: <200906082257.n58MvLRx002905@zion.cs.uiuc.edu> Author: asl Date: Mon Jun 8 17:57:18 2009 New Revision: 73097 URL: http://llvm.org/viewvc/llvm-project?rev=73097&view=rev Log: Revert hunk commited by accident Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=73097&r1=73096&r2=73097&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Jun 8 17:57:18 2009 @@ -549,10 +549,6 @@ switch (N->getOpcode()) { default: break; case ISD::Constant: { - // ARMv6T2 and later should materialize imms via MOV / MOVT pair. - if (Subtarget->hasV6T2Ops()) - break; - unsigned Val = cast(N)->getZExtValue(); bool UseCP = true; if (Subtarget->isThumb()) @@ -563,7 +559,6 @@ UseCP = (ARM_AM::getSOImmVal(Val) == -1 && // MOV ARM_AM::getSOImmVal(~Val) == -1 && // MVN !ARM_AM::isSOImmTwoPartVal(Val)); // two instrs. - if (UseCP) { SDValue CPIdx = CurDAG->getTargetConstantPool(ConstantInt::get(Type::Int32Ty, Val), @@ -575,7 +570,7 @@ CPIdx, CurDAG->getEntryNode()); else { SDValue Ops[] = { - CPIdx, + CPIdx, CurDAG->getRegister(0, MVT::i32), CurDAG->getTargetConstant(0, MVT::i32), getAL(CurDAG), @@ -588,7 +583,7 @@ ReplaceUses(Op, SDValue(ResNode, 0)); return NULL; } - + // Other cases are autogenerated. break; } From asl at math.spbu.ru Mon Jun 8 17:59:50 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 08 Jun 2009 22:59:50 -0000 Subject: [llvm-commits] [llvm] r73098 - /llvm/trunk/lib/Target/ARM/ARMCallingConv.td Message-ID: <200906082259.n58MxoB6002976@zion.cs.uiuc.edu> Author: asl Date: Mon Jun 8 17:59:50 2009 New Revision: 73098 URL: http://llvm.org/viewvc/llvm-project?rev=73098&view=rev Log: Typo Modified: llvm/trunk/lib/Target/ARM/ARMCallingConv.td Modified: llvm/trunk/lib/Target/ARM/ARMCallingConv.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCallingConv.td?rev=73098&r1=73097&r2=73098&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCallingConv.td (original) +++ llvm/trunk/lib/Target/ARM/ARMCallingConv.td Mon Jun 8 17:59:50 2009 @@ -68,7 +68,7 @@ ]>; def RetCC_ARM_AAPCS_Common : CallingConv<[ - CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>> + CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>>, CCIfType<[i64], CCAssignToRegWithShadow<[R0, R2], [R1, R3]>> ]>; From greened at obbligato.org Mon Jun 8 18:05:37 2009 From: greened at obbligato.org (David Greene) Date: Mon, 08 Jun 2009 23:05:37 -0000 Subject: [llvm-commits] [llvm] r73099 - in /llvm/trunk: docs/TableGenFundamentals.html test/TableGen/patsubst.td utils/TableGen/CodeGenDAGPatterns.cpp utils/TableGen/Record.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.cpp Message-ID: <200906082305.n58N5bn5003199@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 8 18:05:37 2009 New Revision: 73099 URL: http://llvm.org/viewvc/llvm-project?rev=73099&view=rev Log: Add a !patsubst operator. Use on string types. Added: llvm/trunk/test/TableGen/patsubst.td Modified: llvm/trunk/docs/TableGenFundamentals.html llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp llvm/trunk/utils/TableGen/Record.cpp llvm/trunk/utils/TableGen/Record.h llvm/trunk/utils/TableGen/TGLexer.cpp llvm/trunk/utils/TableGen/TGLexer.h llvm/trunk/utils/TableGen/TGParser.cpp Modified: llvm/trunk/docs/TableGenFundamentals.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGenFundamentals.html?rev=73099&r1=73098&r2=73099&view=diff ============================================================================== --- llvm/trunk/docs/TableGenFundamentals.html (original) +++ llvm/trunk/docs/TableGenFundamentals.html Mon Jun 8 18:05:37 2009 @@ -417,6 +417,10 @@
    !subst(a, b, c)
    If 'a' and 'b' are of string type or are symbol references, substitute 'b' for 'a' in 'c.' This operation is analogous to $(subst) in GNU make.
    +
    !patsubst(a, b, c)
    +
    patch regular expression 'a' against string 'c' and substitute string 'b' on +a match. 'b' may contain placeholders of the form $<digit>, where +<digit> is a number 1-9.
    !regmatch(a, b)
    An integer {0,1} indicating whether string 'b' matched regular expression 'a.'
    Added: llvm/trunk/test/TableGen/patsubst.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/patsubst.td?rev=73099&view=auto ============================================================================== --- llvm/trunk/test/TableGen/patsubst.td (added) +++ llvm/trunk/test/TableGen/patsubst.td Mon Jun 8 18:05:37 2009 @@ -0,0 +1,15 @@ +// RUN: tblgen %s | grep {Match1 = "v4f32"} | count 1 +// RUN: tblgen %s | grep {Match2 = "v2f64"} | count 1 +// RUN: tblgen %s | grep {Match3 = "v4f32 add"} | count 1 +// RUN: tblgen %s | grep {Match4 = "v2f64 add"} | count 1 + +class Foo { + string Value = v; + string Match1 = !patsubst(".*ps$", "v4f32", v); + string Match2 = !patsubst(".*pd$", "v2f64", v); + string Match3 = !patsubst("(.*)ps$", "v4f32 $1", v); + string Match4 = !patsubst("(.*)pd$", "v2f64 $1", v); +} + +def Bar : Foo<"addps">; +def Baz : Foo<"addpd">; Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=73099&r1=73098&r2=73099&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Mon Jun 8 18:05:37 2009 @@ -2025,7 +2025,7 @@ } } else { - ListTy - TArg->getType(); + ListTy = TArg->getType(); } } ListInit *LI = new ListInit(Values, new ListRecTy(ListTy)); Modified: llvm/trunk/utils/TableGen/Record.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=73099&r1=73098&r2=73099&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.cpp (original) +++ llvm/trunk/utils/TableGen/Record.cpp Mon Jun 8 18:05:37 2009 @@ -18,6 +18,7 @@ #include #include #include +#include using namespace llvm; @@ -1034,6 +1035,69 @@ } break; } + + case PATSUBST: { + StringInit *LHSs = dynamic_cast(LHS); + StringInit *MHSs = dynamic_cast(MHS); + StringInit *RHSs = dynamic_cast(RHS); + + if (LHSs && MHSs && RHSs) { + regex_t compiled; + int err = regcomp (&compiled, LHSs->getValue().c_str(), REG_EXTENDED); + if (err != 0) { + size_t length = regerror (err, &compiled, NULL, 0); + char *buffer = new char[length]; + (void) regerror (err, &compiled, buffer, length); + std::string errmsg = buffer; + delete[] buffer; + regfree(&compiled); + throw errmsg; + } + regmatch_t matches[10]; + int result = regexec(&compiled, RHSs->getValue().c_str(), 10, matches, 0); + if (result == REG_ESPACE) { + size_t length = regerror (err, &compiled, NULL, 0); + char *buffer = new char[length]; + (void) regerror (err, &compiled, buffer, length); + std::string errmsg = buffer; + delete[] buffer; + regfree(&compiled); + throw errmsg; + } + regfree(&compiled); + if (result == 0) { + // Parse the substitution string looking for $1, $2, etc. and + // substitute strings. If there are no $1, etc. just replace + // the whole string. + std::string replacement = MHSs->getValue(); + size_t pos = replacement.find("$"); + while (pos != std::string::npos && pos+1 < replacement.size()) { + if (std::isdigit(replacement[pos+1])) { + std::string sidx(&replacement[pos+1], 1); + std::istringstream str(sidx); + int idx; + if (str >> idx) { + replacement.replace(pos, 2, RHSs->getValue(), matches[idx].rm_so, + matches[idx].rm_eo - matches[idx].rm_so); + } + else { + throw "unexpected failure in patsubst index calculation"; + } + } + else if (replacement[pos+1] == '$') { + replacement.replace(pos, 2, "$"); + } + pos = replacement.find("$", pos+1); + } + return new StringInit(replacement); + } + else { + // No match, just pass the string through + return RHSs; + } + } + break; + } } return this; @@ -1069,6 +1133,7 @@ std::string Result; switch (Opc) { case SUBST: Result = "!subst"; break; + case PATSUBST: Result = "!patsubst"; break; case FOREACH: Result = "!foreach"; break; case IF: Result = "!if"; break; } Modified: llvm/trunk/utils/TableGen/Record.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=73099&r1=73098&r2=73099&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.h (original) +++ llvm/trunk/utils/TableGen/Record.h Mon Jun 8 18:05:37 2009 @@ -885,7 +885,7 @@ /// class TernOpInit : public OpInit { public: - enum TernaryOp { SUBST, FOREACH, IF }; + enum TernaryOp { SUBST, FOREACH, IF, PATSUBST }; private: TernaryOp Opc; Init *LHS, *MHS, *RHS; Modified: llvm/trunk/utils/TableGen/TGLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.cpp?rev=73099&r1=73098&r2=73099&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGLexer.cpp (original) +++ llvm/trunk/utils/TableGen/TGLexer.cpp Mon Jun 8 18:05:37 2009 @@ -449,6 +449,7 @@ if (Len == 10 && !memcmp(Start, "nameconcat", 10)) return tgtok::XNameConcat; if (Len == 8 && !memcmp(Start, "regmatch", 8)) return tgtok::XRegMatch; if (Len == 5 && !memcmp(Start, "subst", 5)) return tgtok::XSubst; + if (Len == 8 && !memcmp(Start, "patsubst", 8)) return tgtok::XPatSubst; if (Len == 7 && !memcmp(Start, "foreach", 7)) return tgtok::XForEach; if (Len == 4 && !memcmp(Start, "cast", 4)) return tgtok::XCast; if (Len == 3 && !memcmp(Start, "car", 3)) return tgtok::XCar; Modified: llvm/trunk/utils/TableGen/TGLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.h?rev=73099&r1=73098&r2=73099&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGLexer.h (original) +++ llvm/trunk/utils/TableGen/TGLexer.h Mon Jun 8 18:05:37 2009 @@ -46,7 +46,7 @@ // !keywords. XConcat, XSRA, XSRL, XSHL, XStrConcat, XNameConcat, XCast, XSubst, - XForEach, XCar, XCdr, XNull, XIf, XRegMatch, + XForEach, XCar, XCdr, XNull, XIf, XRegMatch, XPatSubst, // Integer value. IntVal, Modified: llvm/trunk/utils/TableGen/TGParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=73099&r1=73098&r2=73099&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGParser.cpp (original) +++ llvm/trunk/utils/TableGen/TGParser.cpp Mon Jun 8 18:05:37 2009 @@ -878,6 +878,7 @@ case tgtok::XIf: case tgtok::XForEach: + case tgtok::XPatSubst: case tgtok::XSubst: { // Value ::= !ternop '(' Value ',' Value ',' Value ')' TernOpInit::TernaryOp Code; RecTy *Type = 0; @@ -896,6 +897,9 @@ case tgtok::XSubst: Code = TernOpInit::SUBST; break; + case tgtok::XPatSubst: + Code = TernOpInit::PATSUBST; + break; } if (Lex.getCode() != tgtok::l_paren) { TokError("expected '(' after ternary operator"); @@ -969,6 +973,10 @@ Type = RHSt->getType(); break; } + case tgtok::XPatSubst: { + Type = new StringRecTy; + break; + } } return (new TernOpInit(Code, LHS, MHS, RHS, Type))->Fold(CurRec, CurMultiClass); } @@ -1277,6 +1285,7 @@ case tgtok::XNameConcat: // Value ::= !binop '(' Value ',' Value ')' case tgtok::XIf: case tgtok::XForEach: + case tgtok::XPatSubst: case tgtok::XSubst: { // Value ::= !ternop '(' Value ',' Value ',' Value ')' return ParseOperation(CurRec); break; From asl at math.spbu.ru Mon Jun 8 18:15:18 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 08 Jun 2009 23:15:18 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r73100 - in /llvm-gcc-4.2/trunk/gcc/config/arm: arm.c arm.h Message-ID: <200906082315.n58NFITp003989@zion.cs.uiuc.edu> Author: asl Date: Mon Jun 8 18:15:18 2009 New Revision: 73100 URL: http://llvm.org/viewvc/llvm-project?rev=73100&view=rev Log: Propagate hard float ABI cmdline options to LLVM backend. Patch by Sandeep Patel! Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=73100&r1=73099&r2=73100&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Mon Jun 8 18:15:18 2009 @@ -1503,8 +1503,12 @@ else arm_float_abi = TARGET_DEFAULT_FLOAT_ABI; +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM if (arm_float_abi == ARM_FLOAT_ABI_HARD && TARGET_VFP) sorry ("-mfloat-abi=hard and VFP"); +#endif +/* LLVM LOCAL end */ /* FPA and iWMMXt are incompatible because the insn encodings overlap. VFP and iWMMXt can theoretically coexist, but it's unlikely such silicon Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.h?rev=73100&r1=73099&r2=73100&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/arm/arm.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.h Mon Jun 8 18:15:18 2009 @@ -3025,7 +3025,9 @@ #define LLVM_SET_MACHINE_OPTIONS(argvec) \ if (TARGET_SOFT_FLOAT) \ - argvec.push_back("-soft-float"); + argvec.push_back("-soft-float"); \ + if (TARGET_HARD_FLOAT_ABI) \ + argvec.push_back("-float-abi=hard"); /* Doing struct copy by partial-word loads and stores is not a good idea on ARM. */ #define TARGET_LLVM_MIN_BYTES_COPY_BY_MEMCPY 4 From greened at obbligato.org Mon Jun 8 18:53:19 2009 From: greened at obbligato.org (David Greene) Date: Mon, 08 Jun 2009 23:53:19 -0000 Subject: [llvm-commits] [llvm] r73102 - /llvm/trunk/include/llvm/Target/TargetLowering.h Message-ID: <200906082353.n58NrJp5005285@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 8 18:53:19 2009 New Revision: 73102 URL: http://llvm.org/viewvc/llvm-project?rev=73102&view=rev Log: Change IndexedModeAction representation. This changes the IndexedModeAction representation to remove the limitation on the number of value types in MVT. This limitation prevents us from specifying AVX types. Prior to this change IndexedModActions was represented as follows... uint64_t IndexedModeActions[2][ISD::LAST_INDEXED_MODE]; the first dimension was used to represent loads, then stores. This imposed a limitation of 32 on the number of value types that could be handled with this method. The value type was used to shift the two bits into and out of the approprate bits in the uint64_t. With this change the array is now represented as ... uint8_t IndexedModeActions[MVT::LAST_VALUETYPE][2][ISD::LAST_INDEXED_MODE]; Takes more space but removes the limitation on MVT::LAST_VALUETYPE. The first dimension is now the value_type for the reference. The second dimension is the load [0] vs. store[1]. The third dimension represents the various modes for load store. Accesses are now direct, no shifting or masking. There are other limitations that need to be removed, so that MVT::LAST_VALUETYPE can be greater than 32. This is merely the first step towards that goal. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=73102&r1=73101&r2=73102&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Jun 8 18:53:19 2009 @@ -350,7 +350,7 @@ LegalizeAction getOperationAction(unsigned Op, MVT VT) const { if (VT.isExtended()) return Expand; assert(Op < array_lengthof(OpActions) && - (unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*4 && + (unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*8 && "Table isn't big enough!"); return (LegalizeAction)((OpActions[Op] >> (2*VT.getSimpleVT())) & 3); } @@ -417,11 +417,10 @@ /// for it. LegalizeAction getIndexedLoadAction(unsigned IdxMode, MVT VT) const { - assert(IdxMode < array_lengthof(IndexedModeActions[0]) && - (unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[0][0])*4 && + assert( IdxMode < array_lengthof(IndexedModeActions[0][0]) && + ((unsigned)VT.getSimpleVT()) < MVT::LAST_VALUETYPE && "Table isn't big enough!"); - return (LegalizeAction)((IndexedModeActions[0][IdxMode] >> - (2*VT.getSimpleVT())) & 3); + return (LegalizeAction)((IndexedModeActions[(unsigned)VT.getSimpleVT()][0][IdxMode])); } /// isIndexedLoadLegal - Return true if the specified indexed load is legal @@ -438,11 +437,10 @@ /// for it. LegalizeAction getIndexedStoreAction(unsigned IdxMode, MVT VT) const { - assert(IdxMode < array_lengthof(IndexedModeActions[1]) && - (unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[1][0])*4 && + assert(IdxMode < array_lengthof(IndexedModeActions[0][1]) && + (unsigned)VT.getSimpleVT() < MVT::LAST_VALUETYPE && "Table isn't big enough!"); - return (LegalizeAction)((IndexedModeActions[1][IdxMode] >> - (2*VT.getSimpleVT())) & 3); + return (LegalizeAction)((IndexedModeActions[(unsigned)VT.getSimpleVT()][1][IdxMode])); } /// isIndexedStoreLegal - Return true if the specified indexed load is legal @@ -942,7 +940,7 @@ /// with the specified type and indicate what to do about it. void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action) { - assert((unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*4 && + assert((unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*8 && Op < array_lengthof(OpActions) && "Table isn't big enough!"); OpActions[Op] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); OpActions[Op] |= (uint64_t)Action << VT.getSimpleVT()*2; @@ -978,11 +976,10 @@ /// TargetLowering.cpp void setIndexedLoadAction(unsigned IdxMode, MVT VT, LegalizeAction Action) { - assert((unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[0])*4 && - IdxMode < array_lengthof(IndexedModeActions[0]) && + assert((unsigned)VT.getSimpleVT() < MVT::LAST_VALUETYPE && + IdxMode < array_lengthof(IndexedModeActions[0][0]) && "Table isn't big enough!"); - IndexedModeActions[0][IdxMode] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); - IndexedModeActions[0][IdxMode] |= (uint64_t)Action << VT.getSimpleVT()*2; + IndexedModeActions[(unsigned)VT.getSimpleVT()][0][IdxMode] = (uint8_t)Action; } /// setIndexedStoreAction - Indicate that the specified indexed store does or @@ -991,11 +988,10 @@ /// TargetLowering.cpp void setIndexedStoreAction(unsigned IdxMode, MVT VT, LegalizeAction Action) { - assert((unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[1][0])*4 && - IdxMode < array_lengthof(IndexedModeActions[1]) && + assert((unsigned)VT.getSimpleVT() < MVT::LAST_VALUETYPE && + IdxMode < array_lengthof(IndexedModeActions[0][1] ) && "Table isn't big enough!"); - IndexedModeActions[1][IdxMode] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); - IndexedModeActions[1][IdxMode] |= (uint64_t)Action << VT.getSimpleVT()*2; + IndexedModeActions[(unsigned)VT.getSimpleVT()][1][IdxMode] = (uint8_t)Action; } /// setConvertAction - Indicate that the specified conversion does or does @@ -1581,10 +1577,13 @@ /// indicates how instruction selection should deal with the store. uint64_t TruncStoreActions[MVT::LAST_VALUETYPE]; - /// IndexedModeActions - For each indexed mode and each value type, keep a - /// pair of LegalizeAction that indicates how instruction selection should - /// deal with the load / store. - uint64_t IndexedModeActions[2][ISD::LAST_INDEXED_MODE]; + /// IndexedModeActions - For each indexed mode and each value type, + /// keep a pair of LegalizeAction that indicates how instruction + /// selection should deal with the load / store. The first + /// dimension is the value_type for the reference. The second + /// dimension is the load [0] vs. store[1]. The third dimension + /// represents the various modes for load store. + uint8_t IndexedModeActions[MVT::LAST_VALUETYPE][2][ISD::LAST_INDEXED_MODE]; /// ConvertActions - For each conversion from source type to destination type, /// keep a LegalizeAction that indicates how instruction selection should From greened at obbligato.org Mon Jun 8 18:54:42 2009 From: greened at obbligato.org (David Greene) Date: Mon, 08 Jun 2009 23:54:42 -0000 Subject: [llvm-commits] [llvm] r73103 - /llvm/trunk/include/llvm/Target/TargetLowering.h Message-ID: <200906082354.n58Nsgla005336@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 8 18:54:42 2009 New Revision: 73103 URL: http://llvm.org/viewvc/llvm-project?rev=73103&view=rev Log: Oops, didn't mean to commit 73102 yet. Revert it. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=73103&r1=73102&r2=73103&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Jun 8 18:54:42 2009 @@ -350,7 +350,7 @@ LegalizeAction getOperationAction(unsigned Op, MVT VT) const { if (VT.isExtended()) return Expand; assert(Op < array_lengthof(OpActions) && - (unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*8 && + (unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*4 && "Table isn't big enough!"); return (LegalizeAction)((OpActions[Op] >> (2*VT.getSimpleVT())) & 3); } @@ -417,10 +417,11 @@ /// for it. LegalizeAction getIndexedLoadAction(unsigned IdxMode, MVT VT) const { - assert( IdxMode < array_lengthof(IndexedModeActions[0][0]) && - ((unsigned)VT.getSimpleVT()) < MVT::LAST_VALUETYPE && + assert(IdxMode < array_lengthof(IndexedModeActions[0]) && + (unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[0][0])*4 && "Table isn't big enough!"); - return (LegalizeAction)((IndexedModeActions[(unsigned)VT.getSimpleVT()][0][IdxMode])); + return (LegalizeAction)((IndexedModeActions[0][IdxMode] >> + (2*VT.getSimpleVT())) & 3); } /// isIndexedLoadLegal - Return true if the specified indexed load is legal @@ -437,10 +438,11 @@ /// for it. LegalizeAction getIndexedStoreAction(unsigned IdxMode, MVT VT) const { - assert(IdxMode < array_lengthof(IndexedModeActions[0][1]) && - (unsigned)VT.getSimpleVT() < MVT::LAST_VALUETYPE && + assert(IdxMode < array_lengthof(IndexedModeActions[1]) && + (unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[1][0])*4 && "Table isn't big enough!"); - return (LegalizeAction)((IndexedModeActions[(unsigned)VT.getSimpleVT()][1][IdxMode])); + return (LegalizeAction)((IndexedModeActions[1][IdxMode] >> + (2*VT.getSimpleVT())) & 3); } /// isIndexedStoreLegal - Return true if the specified indexed load is legal @@ -940,7 +942,7 @@ /// with the specified type and indicate what to do about it. void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action) { - assert((unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*8 && + assert((unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*4 && Op < array_lengthof(OpActions) && "Table isn't big enough!"); OpActions[Op] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); OpActions[Op] |= (uint64_t)Action << VT.getSimpleVT()*2; @@ -976,10 +978,11 @@ /// TargetLowering.cpp void setIndexedLoadAction(unsigned IdxMode, MVT VT, LegalizeAction Action) { - assert((unsigned)VT.getSimpleVT() < MVT::LAST_VALUETYPE && - IdxMode < array_lengthof(IndexedModeActions[0][0]) && + assert((unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[0])*4 && + IdxMode < array_lengthof(IndexedModeActions[0]) && "Table isn't big enough!"); - IndexedModeActions[(unsigned)VT.getSimpleVT()][0][IdxMode] = (uint8_t)Action; + IndexedModeActions[0][IdxMode] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); + IndexedModeActions[0][IdxMode] |= (uint64_t)Action << VT.getSimpleVT()*2; } /// setIndexedStoreAction - Indicate that the specified indexed store does or @@ -988,10 +991,11 @@ /// TargetLowering.cpp void setIndexedStoreAction(unsigned IdxMode, MVT VT, LegalizeAction Action) { - assert((unsigned)VT.getSimpleVT() < MVT::LAST_VALUETYPE && - IdxMode < array_lengthof(IndexedModeActions[0][1] ) && + assert((unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[1][0])*4 && + IdxMode < array_lengthof(IndexedModeActions[1]) && "Table isn't big enough!"); - IndexedModeActions[(unsigned)VT.getSimpleVT()][1][IdxMode] = (uint8_t)Action; + IndexedModeActions[1][IdxMode] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); + IndexedModeActions[1][IdxMode] |= (uint64_t)Action << VT.getSimpleVT()*2; } /// setConvertAction - Indicate that the specified conversion does or does @@ -1577,13 +1581,10 @@ /// indicates how instruction selection should deal with the store. uint64_t TruncStoreActions[MVT::LAST_VALUETYPE]; - /// IndexedModeActions - For each indexed mode and each value type, - /// keep a pair of LegalizeAction that indicates how instruction - /// selection should deal with the load / store. The first - /// dimension is the value_type for the reference. The second - /// dimension is the load [0] vs. store[1]. The third dimension - /// represents the various modes for load store. - uint8_t IndexedModeActions[MVT::LAST_VALUETYPE][2][ISD::LAST_INDEXED_MODE]; + /// IndexedModeActions - For each indexed mode and each value type, keep a + /// pair of LegalizeAction that indicates how instruction selection should + /// deal with the load / store. + uint64_t IndexedModeActions[2][ISD::LAST_INDEXED_MODE]; /// ConvertActions - For each conversion from source type to destination type, /// keep a LegalizeAction that indicates how instruction selection should From greened at obbligato.org Mon Jun 8 19:19:10 2009 From: greened at obbligato.org (David Greene) Date: Tue, 09 Jun 2009 00:19:10 -0000 Subject: [llvm-commits] [llvm] r73104 - /llvm/trunk/include/llvm/Target/TargetLowering.h Message-ID: <200906090019.n590JAXR006283@zion.cs.uiuc.edu> Author: greened Date: Mon Jun 8 19:19:10 2009 New Revision: 73104 URL: http://llvm.org/viewvc/llvm-project?rev=73104&view=rev Log: Change IndexedModeAction representation. This changes the IndexedModeAction representation to remove the limitation on the number of value types in MVT. This limitation prevents us from specifying AVX types. Prior to this change IndexedModActions was represented as follows... uint64_t IndexedModeActions[2][ISD::LAST_INDEXED_MODE]; the first dimension was used to represent loads, then stores. This imposed a limitation of 32 on the number of value types that could be handled with this method. The value type was used to shift the two bits into and out of the approprate bits in the uint64_t. With this change the array is now represented as ... uint8_t IndexedModeActions[MVT::LAST_VALUETYPE][2][ISD::LAST_INDEXED_MODE]; Takes more space but removes the limitation on MVT::LAST_VALUETYPE. The first dimension is now the value_type for the reference. The second dimension is the load [0] vs. store[1]. The third dimension represents the various modes for load store. Accesses are now direct, no shifting or masking. There are other limitations that need to be removed, so that MVT::LAST_VALUETYPE can be greater than 32. This is merely the first step towards that goal. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=73104&r1=73103&r2=73104&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Jun 8 19:19:10 2009 @@ -350,7 +350,7 @@ LegalizeAction getOperationAction(unsigned Op, MVT VT) const { if (VT.isExtended()) return Expand; assert(Op < array_lengthof(OpActions) && - (unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*4 && + (unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*8 && "Table isn't big enough!"); return (LegalizeAction)((OpActions[Op] >> (2*VT.getSimpleVT())) & 3); } @@ -417,11 +417,10 @@ /// for it. LegalizeAction getIndexedLoadAction(unsigned IdxMode, MVT VT) const { - assert(IdxMode < array_lengthof(IndexedModeActions[0]) && - (unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[0][0])*4 && + assert( IdxMode < array_lengthof(IndexedModeActions[0][0]) && + ((unsigned)VT.getSimpleVT()) < MVT::LAST_VALUETYPE && "Table isn't big enough!"); - return (LegalizeAction)((IndexedModeActions[0][IdxMode] >> - (2*VT.getSimpleVT())) & 3); + return (LegalizeAction)((IndexedModeActions[(unsigned)VT.getSimpleVT()][0][IdxMode])); } /// isIndexedLoadLegal - Return true if the specified indexed load is legal @@ -438,11 +437,10 @@ /// for it. LegalizeAction getIndexedStoreAction(unsigned IdxMode, MVT VT) const { - assert(IdxMode < array_lengthof(IndexedModeActions[1]) && - (unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[1][0])*4 && + assert(IdxMode < array_lengthof(IndexedModeActions[0][1]) && + (unsigned)VT.getSimpleVT() < MVT::LAST_VALUETYPE && "Table isn't big enough!"); - return (LegalizeAction)((IndexedModeActions[1][IdxMode] >> - (2*VT.getSimpleVT())) & 3); + return (LegalizeAction)((IndexedModeActions[(unsigned)VT.getSimpleVT()][1][IdxMode])); } /// isIndexedStoreLegal - Return true if the specified indexed load is legal @@ -942,7 +940,7 @@ /// with the specified type and indicate what to do about it. void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action) { - assert((unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*4 && + assert((unsigned)VT.getSimpleVT() < sizeof(OpActions[0])*8 && Op < array_lengthof(OpActions) && "Table isn't big enough!"); OpActions[Op] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); OpActions[Op] |= (uint64_t)Action << VT.getSimpleVT()*2; @@ -978,11 +976,10 @@ /// TargetLowering.cpp void setIndexedLoadAction(unsigned IdxMode, MVT VT, LegalizeAction Action) { - assert((unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[0])*4 && - IdxMode < array_lengthof(IndexedModeActions[0]) && + assert((unsigned)VT.getSimpleVT() < MVT::LAST_VALUETYPE && + IdxMode < array_lengthof(IndexedModeActions[0][0]) && "Table isn't big enough!"); - IndexedModeActions[0][IdxMode] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); - IndexedModeActions[0][IdxMode] |= (uint64_t)Action << VT.getSimpleVT()*2; + IndexedModeActions[(unsigned)VT.getSimpleVT()][0][IdxMode] = (uint8_t)Action; } /// setIndexedStoreAction - Indicate that the specified indexed store does or @@ -991,11 +988,10 @@ /// TargetLowering.cpp void setIndexedStoreAction(unsigned IdxMode, MVT VT, LegalizeAction Action) { - assert((unsigned)VT.getSimpleVT() < sizeof(IndexedModeActions[1][0])*4 && - IdxMode < array_lengthof(IndexedModeActions[1]) && + assert((unsigned)VT.getSimpleVT() < MVT::LAST_VALUETYPE && + IdxMode < array_lengthof(IndexedModeActions[0][1] ) && "Table isn't big enough!"); - IndexedModeActions[1][IdxMode] &= ~(uint64_t(3UL) << VT.getSimpleVT()*2); - IndexedModeActions[1][IdxMode] |= (uint64_t)Action << VT.getSimpleVT()*2; + IndexedModeActions[(unsigned)VT.getSimpleVT()][1][IdxMode] = (uint8_t)Action; } /// setConvertAction - Indicate that the specified conversion does or does @@ -1581,10 +1577,13 @@ /// indicates how instruction selection should deal with the store. uint64_t TruncStoreActions[MVT::LAST_VALUETYPE]; - /// IndexedModeActions - For each indexed mode and each value type, keep a - /// pair of LegalizeAction that indicates how instruction selection should - /// deal with the load / store. - uint64_t IndexedModeActions[2][ISD::LAST_INDEXED_MODE]; + /// IndexedModeActions - For each indexed mode and each value type, + /// keep a pair of LegalizeAction that indicates how instruction + /// selection should deal with the load / store. The first + /// dimension is now the value_type for the reference. The second + /// dimension is the load [0] vs. store[1]. The third dimension + /// represents the various modes for load store. + uint8_t IndexedModeActions[MVT::LAST_VALUETYPE][2][ISD::LAST_INDEXED_MODE]; /// ConvertActions - For each conversion from source type to destination type, /// keep a LegalizeAction that indicates how instruction selection should From baldrick at free.fr Tue Jun 9 02:17:18 2009 From: baldrick at free.fr (Duncan Sands) Date: Tue, 09 Jun 2009 09:17:18 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r73088 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h In-Reply-To: <200906082217.n58MHR80001480@zion.cs.uiuc.edu> References: <200906082217.n58MHR80001480@zion.cs.uiuc.edu> Message-ID: <4A2E0C7E.5020903@free.fr> > Weak imports on Darwin do not apply to data definitions. Testcase? Ciao, Duncan. From howard0su at gmail.com Tue Jun 9 04:27:10 2009 From: howard0su at gmail.com (Howard Su) Date: Tue, 9 Jun 2009 17:27:10 +0800 Subject: [llvm-commits] [llvm] r73074 - in /llvm/trunk: docs/TableGenFundamentals.html test/TableGen/regmatch.td utils/TableGen/Record.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.cpp In-Reply-To: <200906081700.n58H0Zvi022899@zion.cs.uiuc.edu> References: <200906081700.n58H0Zvi022899@zion.cs.uiuc.edu> Message-ID: This change break the MSVC build since no regex by default in Windows MSVC platform. On Tue, Jun 9, 2009 at 1:00 AM, David Greene wrote: > Author: greened > Date: Mon Jun 8 12:00:34 2009 > New Revision: 73074 > > URL: http://llvm.org/viewvc/llvm-project?rev=73074&view=rev > Log: > > Add a !regmatch operator to do pattern matching in TableGen. > > Added: > llvm/trunk/test/TableGen/regmatch.td > Modified: > llvm/trunk/docs/TableGenFundamentals.html > llvm/trunk/utils/TableGen/Record.cpp > llvm/trunk/utils/TableGen/Record.h > llvm/trunk/utils/TableGen/TGLexer.cpp > llvm/trunk/utils/TableGen/TGLexer.h > llvm/trunk/utils/TableGen/TGParser.cpp > > Modified: llvm/trunk/docs/TableGenFundamentals.html > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGenFundamentals.html?rev=73074&r1=73073&r2=73074&view=diff > > -- -Howard -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090609/16bb92bd/attachment.html From edwintorok at gmail.com Tue Jun 9 04:35:33 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Tue, 09 Jun 2009 12:35:33 +0300 Subject: [llvm-commits] [llvm] r73074 - in /llvm/trunk: docs/TableGenFundamentals.html test/TableGen/regmatch.td utils/TableGen/Record.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.cpp In-Reply-To: References: <200906081700.n58H0Zvi022899@zion.cs.uiuc.edu> Message-ID: <4A2E2CE5.7070407@gmail.com> On 2009-06-09 12:27, Howard Su wrote: > This change break the MSVC build since no regex by default in Windows > MSVC platform. Perhaps we should add a regex implementation to lib/System? The regcomp()/regexec() used in *BSD is a good, and portable implementation: http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/regex/ The only changes needed to make it work on non-BSD systems is to replace memcpy with memmove (memory overlaps), and define DUP_MAX if its not already defined, and to add strlcpy.c to lib/System too. Thoughts? Best regards, --Edwin From mikael.lepisto at tut.fi Tue Jun 9 07:56:05 2009 From: mikael.lepisto at tut.fi (=?ISO-8859-1?Q?Mikael_Lepist=F6?=) Date: Tue, 09 Jun 2009 15:56:05 +0300 Subject: [llvm-commits] [PATCH] KNRPromotion fix when FLOAT_TYPE_SIZE is not smaller than DOUBLE_TYPE_SIZE Message-ID: <4A2E5BE5.1050704@tut.fi> Hi, I found out that void function(value) float value; {} generated following bitcode define void @function(double %value1) In IRC channel this was though to be correct for platforms where DOUBLE_TYPE_SIZE is bigger than float size e.g. x86. However in our tce-llvm-gcc cross-compiler DOUBLE_TYPE_SIZE is set to be 32 bits as FLOAT_TYPE_SIZE. So in this case correct bitcode should have been define void @function(float %value1) So here's patch attached for fixing the problem. Mikael Lepist? -------------- next part -------------- A non-text attachment was scrubbed... Name: KNRPromotion_when_double_is_same_size_with_float.patch Type: text/x-diff Size: 606 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090609/505f0cbc/attachment.bin From greened at obbligato.org Tue Jun 9 08:58:19 2009 From: greened at obbligato.org (David Greene) Date: Tue, 09 Jun 2009 08:58:19 -0500 Subject: [llvm-commits] [llvm] r73074 - in /llvm/trunk: docs/TableGenFundamentals.html test/TableGen/regmatch.td utils/TableGen/Record.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.cpp In-Reply-To: <4A2E2CE5.7070407@gmail.com> References: <200906081700.n58H0Zvi022899@zion.cs.uiuc.edu> <4A2E2CE5.7070407@gmail.com> Message-ID: <4A2E6A7B.3010100@obbligato.org> T?r?k Edwin wrote: > On 2009-06-09 12:27, Howard Su wrote: >> This change break the MSVC build since no regex by default in Windows >> MSVC platform. %^$# non-POSIX compliance! > Perhaps we should add a regex implementation to lib/System? > > The regcomp()/regexec() used in *BSD is a good, and portable implementation: > http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/regex/ > > The only changes needed to make it work on non-BSD systems is to replace > memcpy with memmove (memory overlaps), > and define DUP_MAX if its not already defined, and to add strlcpy.c to > lib/System too. > > Thoughts? Another alternative is to use TR1 regular expressions. How's MSVC with TR1? My inclination is to prefer standards to custom code that we have to maintain but maybe TR1 is too new. -Dave From stefanus.dutoit at rapidmind.com Tue Jun 9 09:12:42 2009 From: stefanus.dutoit at rapidmind.com (Stefanus Du Toit) Date: Tue, 9 Jun 2009 10:12:42 -0400 Subject: [llvm-commits] [llvm] r73074 - in /llvm/trunk: docs/TableGenFundamentals.html test/TableGen/regmatch.td utils/TableGen/Record.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.cpp In-Reply-To: <4A2E6A7B.3010100@obbligato.org> References: <200906081700.n58H0Zvi022899@zion.cs.uiuc.edu> <4A2E2CE5.7070407@gmail.com> <4A2E6A7B.3010100@obbligato.org> Message-ID: <8F2E1E39-7E3A-4D30-9F63-80E8B7A8BF51@rapidmind.com> On 9-Jun-09, at 9:58 AM, David Greene wrote: > Another alternative is to use TR1 regular expressions. > How's MSVC with TR1? AFAIK support is included in the VC9 (Visual Studio 2008) SP1 (and prior to that in a "feature pack") but is not available in VC8 (Visual Studio 2005) at all. > My inclination is to prefer standards to custom code that we have to > maintain but maybe TR1 is too new. There are at least some (including us) users of VC8 with LLVM so TR1 is likely not an option for us, sadly. -- Stefanus Du Toit RapidMind Inc. phone: +1 519 885 5455 x116 -- fax: +1 519 885 1463 From anton at korobeynikov.info Tue Jun 9 09:24:17 2009 From: anton at korobeynikov.info (Anton Korobeynikov) Date: Tue, 9 Jun 2009 18:24:17 +0400 Subject: [llvm-commits] [llvm] r73074 - in /llvm/trunk: docs/TableGenFundamentals.html test/TableGen/regmatch.td utils/TableGen/Record.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.cpp In-Reply-To: <4A2E6A7B.3010100@obbligato.org> References: <200906081700.n58H0Zvi022899@zion.cs.uiuc.edu> <4A2E2CE5.7070407@gmail.com> <4A2E6A7B.3010100@obbligato.org> Message-ID: Hi, David > Another alternative is to use TR1 regular expressions. > How's MSVC with TR1? > > My inclination is to prefer standards to custom code that we have to > maintain but maybe TR1 is too new. Please remove the code until the problem with regexps will be resolved. Also don't also forget that mingw32's default gcc is 3.4.5 which does not have any tr1 stuff. We really would like to keep compatibility with gcc 3.4 series. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University From sanjiv.gupta at microchip.com Tue Jun 9 10:31:19 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Tue, 09 Jun 2009 15:31:19 -0000 Subject: [llvm-commits] [llvm] r73135 - in /llvm/trunk/lib/Target/PIC16: PIC16AsmPrinter.cpp PIC16AsmPrinter.h PIC16TargetAsmInfo.h Message-ID: <200906091531.n59FVJEH014068@zion.cs.uiuc.edu> Author: sgupta Date: Tue Jun 9 10:31:19 2009 New Revision: 73135 URL: http://llvm.org/viewvc/llvm-project?rev=73135&view=rev Log: PIC16 emits auto variables as globals. When optimizer removes a function entierly by estimating its side effects on globals, those globals(autos) without a function were not being printed by the Asm printer. Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=73135&r1=73134&r2=73135&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Tue Jun 9 10:31:19 2009 @@ -280,6 +280,7 @@ bool PIC16AsmPrinter::doFinalization(Module &M) { printLibcallDecls(); + EmitRemainingAutos(); DbgInfo.EmitVarDebugInfo(M); DbgInfo.EmitEOF(); O << "\n\t" << "END\n"; @@ -383,6 +384,8 @@ for (unsigned i = 0; i < AutosSections.size(); i++) { O << "\n"; if (AutosSections[i]->S_->getName() == SectionName) { + // Set the printing status to true + AutosSections[i]->setPrintedStatus(true); SwitchToSection(AutosSections[i]->S_); std::vector Items = AutosSections[i]->Items; for (unsigned j = 0; j < Items.size(); j++) { @@ -398,3 +401,34 @@ } } +// Print autos that were not printed during the code printing of functions. +// As the functions might themselves would have got deleted by the optimizer. +void PIC16AsmPrinter::EmitRemainingAutos() +{ + const TargetData *TD = TM.getTargetData(); + + // Now print Autos section for this function. + std::vector AutosSections = PTAI->AutosSections; + for (unsigned i = 0; i < AutosSections.size(); i++) { + + // if the section is already printed then don't print again + if (AutosSections[i]->isPrinted()) + continue; + + // Set status as printed + AutosSections[i]->setPrintedStatus(true); + + O << "\n"; + SwitchToSection(AutosSections[i]->S_); + std::vector Items = AutosSections[i]->Items; + for (unsigned j = 0; j < Items.size(); j++) { + std::string VarName = Mang->getValueName(Items[j]); + Constant *C = Items[j]->getInitializer(); + const Type *Ty = C->getType(); + unsigned Size = TD->getTypeAllocSize(Ty); + // Emit memory reserve directive. + O << VarName << " RES " << Size << "\n"; + } + } +} + Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h?rev=73135&r1=73134&r2=73135&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.h Tue Jun 9 10:31:19 2009 @@ -52,6 +52,7 @@ void EmitIData (Module &M); void EmitUData (Module &M); void EmitAutos (std::string FunctName); + void EmitRemainingAutos (); void EmitRomData (Module &M); void EmitFunctionFrame(MachineFunction &MF); void printLibcallDecls(void); Modified: llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h?rev=73135&r1=73134&r2=73135&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16TargetAsmInfo.h Tue Jun 9 10:31:19 2009 @@ -33,9 +33,13 @@ struct PIC16Section { const Section *S_; // Connection to actual Section. unsigned Size; // Total size of the objects contained. + bool SectionPrinted; std::vector Items; - PIC16Section (const Section *s) { S_ = s; Size = 0; } + PIC16Section (const Section *s) { S_ = s; Size = 0; + SectionPrinted = false;} + bool isPrinted() { return SectionPrinted ; } + void setPrintedStatus(bool status) { SectionPrinted = status ;} }; struct PIC16TargetAsmInfo : public TargetAsmInfo { From gohman at apple.com Tue Jun 9 12:18:40 2009 From: gohman at apple.com (Dan Gohman) Date: Tue, 09 Jun 2009 17:18:40 -0000 Subject: [llvm-commits] [llvm] r73137 - /llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Message-ID: <200906091718.n59HIeUp017461@zion.cs.uiuc.edu> Author: djg Date: Tue Jun 9 12:18:38 2009 New Revision: 73137 URL: http://llvm.org/viewvc/llvm-project?rev=73137&view=rev Log: Use expandCodeFor instead of expand when the result will be immediately casted. At present, this is just a minor code simplification. In the future, the expansion code may be able to make better choices if it knows what the desired result type will be. Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=73137&r1=73136&r2=73137&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Tue Jun 9 12:18:38 2009 @@ -319,8 +319,7 @@ if (!AnyNonZeroIndices) { V = InsertNoopCastOfTo(V, Type::Int8Ty->getPointerTo(PTy->getAddressSpace())); - Value *Idx = expand(SE.getAddExpr(Ops)); - Idx = InsertNoopCastOfTo(Idx, Ty); + Value *Idx = expandCodeFor(SE.getAddExpr(Ops), Ty); // Fold a GEP with constant operands. if (Constant *CLHS = dyn_cast(V)) @@ -374,8 +373,7 @@ // Emit a bunch of add instructions for (int i = S->getNumOperands()-2; i >= 0; --i) { - Value *W = expand(S->getOperand(i)); - W = InsertNoopCastOfTo(W, Ty); + Value *W = expandCodeFor(S->getOperand(i), Ty); V = InsertBinop(Instruction::Add, V, W, InsertPt); } return V; @@ -389,13 +387,11 @@ FirstOp = 1; int i = S->getNumOperands()-2; - Value *V = expand(S->getOperand(i+1)); - V = InsertNoopCastOfTo(V, Ty); + Value *V = expandCodeFor(S->getOperand(i+1), Ty); // Emit a bunch of multiply instructions for (; i >= FirstOp; --i) { - Value *W = expand(S->getOperand(i)); - W = InsertNoopCastOfTo(W, Ty); + Value *W = expandCodeFor(S->getOperand(i), Ty); V = InsertBinop(Instruction::Mul, V, W, InsertPt); } @@ -408,8 +404,7 @@ Value *SCEVExpander::visitUDivExpr(const SCEVUDivExpr *S) { const Type *Ty = SE.getEffectiveSCEVType(S->getType()); - Value *LHS = expand(S->getLHS()); - LHS = InsertNoopCastOfTo(LHS, Ty); + Value *LHS = expandCodeFor(S->getLHS(), Ty); if (const SCEVConstant *SC = dyn_cast(S->getRHS())) { const APInt &RHS = SC->getValue()->getValue(); if (RHS.isPowerOf2()) @@ -418,8 +413,7 @@ InsertPt); } - Value *RHS = expand(S->getRHS()); - RHS = InsertNoopCastOfTo(RHS, Ty); + Value *RHS = expandCodeFor(S->getRHS(), Ty); return InsertBinop(Instruction::UDiv, LHS, RHS, InsertPt); } @@ -513,10 +507,9 @@ // If this is a simple linear addrec, emit it now as a special case. if (S->isAffine()) { // {0,+,F} --> i*F - Value *F = expand(S->getOperand(1)); - F = InsertNoopCastOfTo(F, Ty); + Value *F = expandCodeFor(S->getOperand(1), Ty); - // IF the step is by one, just return the inserted IV. + // If the step is by one, just return the inserted IV. if (ConstantInt *CI = dyn_cast(F)) if (CI->getValue() == 1) return I; @@ -563,8 +556,8 @@ Value *SCEVExpander::visitTruncateExpr(const SCEVTruncateExpr *S) { const Type *Ty = SE.getEffectiveSCEVType(S->getType()); - Value *V = expand(S->getOperand()); - V = InsertNoopCastOfTo(V, SE.getEffectiveSCEVType(V->getType())); + Value *V = expandCodeFor(S->getOperand(), + SE.getEffectiveSCEVType(S->getOperand()->getType())); Instruction *I = new TruncInst(V, Ty, "tmp.", InsertPt); InsertedValues.insert(I); return I; @@ -572,8 +565,8 @@ Value *SCEVExpander::visitZeroExtendExpr(const SCEVZeroExtendExpr *S) { const Type *Ty = SE.getEffectiveSCEVType(S->getType()); - Value *V = expand(S->getOperand()); - V = InsertNoopCastOfTo(V, SE.getEffectiveSCEVType(V->getType())); + Value *V = expandCodeFor(S->getOperand(), + SE.getEffectiveSCEVType(S->getOperand()->getType())); Instruction *I = new ZExtInst(V, Ty, "tmp.", InsertPt); InsertedValues.insert(I); return I; @@ -581,8 +574,8 @@ Value *SCEVExpander::visitSignExtendExpr(const SCEVSignExtendExpr *S) { const Type *Ty = SE.getEffectiveSCEVType(S->getType()); - Value *V = expand(S->getOperand()); - V = InsertNoopCastOfTo(V, SE.getEffectiveSCEVType(V->getType())); + Value *V = expandCodeFor(S->getOperand(), + SE.getEffectiveSCEVType(S->getOperand()->getType())); Instruction *I = new SExtInst(V, Ty, "tmp.", InsertPt); InsertedValues.insert(I); return I; @@ -590,11 +583,9 @@ Value *SCEVExpander::visitSMaxExpr(const SCEVSMaxExpr *S) { const Type *Ty = SE.getEffectiveSCEVType(S->getType()); - Value *LHS = expand(S->getOperand(0)); - LHS = InsertNoopCastOfTo(LHS, Ty); + Value *LHS = expandCodeFor(S->getOperand(0), Ty); for (unsigned i = 1; i < S->getNumOperands(); ++i) { - Value *RHS = expand(S->getOperand(i)); - RHS = InsertNoopCastOfTo(RHS, Ty); + Value *RHS = expandCodeFor(S->getOperand(i), Ty); Instruction *ICmp = new ICmpInst(ICmpInst::ICMP_SGT, LHS, RHS, "tmp", InsertPt); InsertedValues.insert(ICmp); @@ -607,11 +598,9 @@ Value *SCEVExpander::visitUMaxExpr(const SCEVUMaxExpr *S) { const Type *Ty = SE.getEffectiveSCEVType(S->getType()); - Value *LHS = expand(S->getOperand(0)); - LHS = InsertNoopCastOfTo(LHS, Ty); + Value *LHS = expandCodeFor(S->getOperand(0), Ty); for (unsigned i = 1; i < S->getNumOperands(); ++i) { - Value *RHS = expand(S->getOperand(i)); - RHS = InsertNoopCastOfTo(RHS, Ty); + Value *RHS = expandCodeFor(S->getOperand(i), Ty); Instruction *ICmp = new ICmpInst(ICmpInst::ICMP_UGT, LHS, RHS, "tmp", InsertPt); InsertedValues.insert(ICmp); From dalej at apple.com Tue Jun 9 13:29:02 2009 From: dalej at apple.com (Dale Johannesen) Date: Tue, 9 Jun 2009 11:29:02 -0700 Subject: [llvm-commits] [PATCH] KNRPromotion fix when FLOAT_TYPE_SIZE is not smaller than DOUBLE_TYPE_SIZE In-Reply-To: <4A2E5BE5.1050704@tut.fi> References: <4A2E5BE5.1050704@tut.fi> Message-ID: On Jun 9, 2009, at 5:56 AMPDT, Mikael Lepist? wrote: > Hi, > > I found out that > > void function(value) > float value; {} > > generated following bitcode > > define void @function(double %value1) > > In IRC channel this was though to be correct for platforms where > DOUBLE_TYPE_SIZE is bigger than float size e.g. x86. However in our > tce-llvm-gcc cross-compiler DOUBLE_TYPE_SIZE is set to be 32 bits as > FLOAT_TYPE_SIZE. So in this case correct bitcode should have been > > define void @function(float %value1) > > So here's patch attached for fixing the problem. LLVM IR defines "float" and "double" to be 32 and 64 bits respectively. So I think a patch that checks for those magic numbers would be better. > Mikael Lepist? -------------- next part -------------- A non-text attachment was scrubbed... Name: KNRPromotion_when_double_is_same_size_with_float.patch Type: text/x-diff Size: 606 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090609/c1c0c7dc/attachment.bin -------------- next part -------------- > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From greened at obbligato.org Tue Jun 9 13:31:20 2009 From: greened at obbligato.org (David Greene) Date: Tue, 09 Jun 2009 18:31:20 -0000 Subject: [llvm-commits] [llvm] r73138 - in /llvm/trunk: docs/TableGenFundamentals.html test/TableGen/patsubst.td test/TableGen/regmatch.td utils/TableGen/CodeGenDAGPatterns.cpp utils/TableGen/Record.cpp utils/TableGen/Record.h utils/TableGen/TGLexer.cpp utils/TableGen/TGLexer.h utils/TableGen/TGParser.cpp Message-ID: <200906091831.n59IVKNS019696@zion.cs.uiuc.edu> Author: greened Date: Tue Jun 9 13:31:17 2009 New Revision: 73138 URL: http://llvm.org/viewvc/llvm-project?rev=73138&view=rev Log: Revert 73074 and 73099 because Windows doesn't have POSIX regular expressions. We will add an OpenBSD implementation and re-apply ASAP. Modified: llvm/trunk/docs/TableGenFundamentals.html llvm/trunk/test/TableGen/patsubst.td llvm/trunk/test/TableGen/regmatch.td llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp llvm/trunk/utils/TableGen/Record.cpp llvm/trunk/utils/TableGen/Record.h llvm/trunk/utils/TableGen/TGLexer.cpp llvm/trunk/utils/TableGen/TGLexer.h llvm/trunk/utils/TableGen/TGParser.cpp Modified: llvm/trunk/docs/TableGenFundamentals.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGenFundamentals.html?rev=73138&r1=73137&r2=73138&view=diff ============================================================================== --- llvm/trunk/docs/TableGenFundamentals.html (original) +++ llvm/trunk/docs/TableGenFundamentals.html Tue Jun 9 13:31:17 2009 @@ -417,13 +417,6 @@
    !subst(a, b, c)
    If 'a' and 'b' are of string type or are symbol references, substitute 'b' for 'a' in 'c.' This operation is analogous to $(subst) in GNU make.
    -
    !patsubst(a, b, c)
    -
    patch regular expression 'a' against string 'c' and substitute string 'b' on -a match. 'b' may contain placeholders of the form $<digit>, where -<digit> is a number 1-9.
    -
    !regmatch(a, b)
    -
    An integer {0,1} indicating whether string 'b' matched regular expression -'a.'
    !foreach(a, b, c)
    For each member 'b' of dag or list 'a' apply operator 'c.' 'b' is a dummy variable that should be declared as a member variable of an instantiated Modified: llvm/trunk/test/TableGen/patsubst.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/patsubst.td?rev=73138&r1=73137&r2=73138&view=diff ============================================================================== --- llvm/trunk/test/TableGen/patsubst.td (original) +++ llvm/trunk/test/TableGen/patsubst.td Tue Jun 9 13:31:17 2009 @@ -1,15 +0,0 @@ -// RUN: tblgen %s | grep {Match1 = "v4f32"} | count 1 -// RUN: tblgen %s | grep {Match2 = "v2f64"} | count 1 -// RUN: tblgen %s | grep {Match3 = "v4f32 add"} | count 1 -// RUN: tblgen %s | grep {Match4 = "v2f64 add"} | count 1 - -class Foo { - string Value = v; - string Match1 = !patsubst(".*ps$", "v4f32", v); - string Match2 = !patsubst(".*pd$", "v2f64", v); - string Match3 = !patsubst("(.*)ps$", "v4f32 $1", v); - string Match4 = !patsubst("(.*)pd$", "v2f64 $1", v); -} - -def Bar : Foo<"addps">; -def Baz : Foo<"addpd">; Modified: llvm/trunk/test/TableGen/regmatch.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/regmatch.td?rev=73138&r1=73137&r2=73138&view=diff ============================================================================== --- llvm/trunk/test/TableGen/regmatch.td (original) +++ llvm/trunk/test/TableGen/regmatch.td Tue Jun 9 13:31:17 2009 @@ -1,11 +0,0 @@ -// RUN: tblgen %s | grep {Match1 = 1} | count 1 -// RUN: tblgen %s | grep {Match2 = 1} | count 1 - -class Foo { - string Value = v; - int Match1 = !regmatch(".*ps$", v); - int Match2 = !regmatch(".*pd$", v); -} - -def Bar : Foo<"addps">; -def Baz : Foo<"addpd">; Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=73138&r1=73137&r2=73138&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Tue Jun 9 13:31:17 2009 @@ -2025,7 +2025,7 @@ } } else { - ListTy = TArg->getType(); + ListTy - TArg->getType(); } } ListInit *LI = new ListInit(Values, new ListRecTy(ListTy)); Modified: llvm/trunk/utils/TableGen/Record.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=73138&r1=73137&r2=73138&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.cpp (original) +++ llvm/trunk/utils/TableGen/Record.cpp Tue Jun 9 13:31:17 2009 @@ -16,9 +16,6 @@ #include "llvm/Support/Streams.h" #include "llvm/ADT/StringExtras.h" #include -#include -#include -#include using namespace llvm; @@ -750,36 +747,6 @@ } break; } - case REGMATCH: { - StringInit *LHSs = dynamic_cast(LHS); - StringInit *RHSs = dynamic_cast(RHS); - if (LHSs && RHSs) { - regex_t compiled; - int err = regcomp (&compiled, LHSs->getValue().c_str(), REG_EXTENDED); - if (err != 0) { - size_t length = regerror (err, &compiled, NULL, 0); - char *buffer = new char[length]; - (void) regerror (err, &compiled, buffer, length); - std::string errmsg = buffer; - delete[] buffer; - regfree(&compiled); - throw errmsg; - } - int result = regexec(&compiled, RHSs->getValue().c_str(), 0, NULL, 0); - if (result == REG_ESPACE) { - size_t length = regerror (err, &compiled, NULL, 0); - char *buffer = new char[length]; - (void) regerror (err, &compiled, buffer, length); - std::string errmsg = buffer; - delete[] buffer; - regfree(&compiled); - throw errmsg; - } - regfree(&compiled); - return new IntInit(result == 0); - } - break; - } case SHL: case SRA: case SRL: { @@ -819,7 +786,6 @@ case SRA: Result = "!sra"; break; case SRL: Result = "!srl"; break; case STRCONCAT: Result = "!strconcat"; break; - case REGMATCH: Result = "!regmatch"; break; case NAMECONCAT: Result = "!nameconcat<" + getType()->getAsString() + ">"; break; } @@ -1035,69 +1001,6 @@ } break; } - - case PATSUBST: { - StringInit *LHSs = dynamic_cast(LHS); - StringInit *MHSs = dynamic_cast(MHS); - StringInit *RHSs = dynamic_cast(RHS); - - if (LHSs && MHSs && RHSs) { - regex_t compiled; - int err = regcomp (&compiled, LHSs->getValue().c_str(), REG_EXTENDED); - if (err != 0) { - size_t length = regerror (err, &compiled, NULL, 0); - char *buffer = new char[length]; - (void) regerror (err, &compiled, buffer, length); - std::string errmsg = buffer; - delete[] buffer; - regfree(&compiled); - throw errmsg; - } - regmatch_t matches[10]; - int result = regexec(&compiled, RHSs->getValue().c_str(), 10, matches, 0); - if (result == REG_ESPACE) { - size_t length = regerror (err, &compiled, NULL, 0); - char *buffer = new char[length]; - (void) regerror (err, &compiled, buffer, length); - std::string errmsg = buffer; - delete[] buffer; - regfree(&compiled); - throw errmsg; - } - regfree(&compiled); - if (result == 0) { - // Parse the substitution string looking for $1, $2, etc. and - // substitute strings. If there are no $1, etc. just replace - // the whole string. - std::string replacement = MHSs->getValue(); - size_t pos = replacement.find("$"); - while (pos != std::string::npos && pos+1 < replacement.size()) { - if (std::isdigit(replacement[pos+1])) { - std::string sidx(&replacement[pos+1], 1); - std::istringstream str(sidx); - int idx; - if (str >> idx) { - replacement.replace(pos, 2, RHSs->getValue(), matches[idx].rm_so, - matches[idx].rm_eo - matches[idx].rm_so); - } - else { - throw "unexpected failure in patsubst index calculation"; - } - } - else if (replacement[pos+1] == '$') { - replacement.replace(pos, 2, "$"); - } - pos = replacement.find("$", pos+1); - } - return new StringInit(replacement); - } - else { - // No match, just pass the string through - return RHSs; - } - } - break; - } } return this; @@ -1133,7 +1036,6 @@ std::string Result; switch (Opc) { case SUBST: Result = "!subst"; break; - case PATSUBST: Result = "!patsubst"; break; case FOREACH: Result = "!foreach"; break; case IF: Result = "!if"; break; } Modified: llvm/trunk/utils/TableGen/Record.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=73138&r1=73137&r2=73138&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/Record.h (original) +++ llvm/trunk/utils/TableGen/Record.h Tue Jun 9 13:31:17 2009 @@ -841,7 +841,7 @@ /// class BinOpInit : public OpInit { public: - enum BinaryOp { SHL, SRA, SRL, STRCONCAT, CONCAT, NAMECONCAT, REGMATCH }; + enum BinaryOp { SHL, SRA, SRL, STRCONCAT, CONCAT, NAMECONCAT }; private: BinaryOp Opc; Init *LHS, *RHS; @@ -885,7 +885,7 @@ /// class TernOpInit : public OpInit { public: - enum TernaryOp { SUBST, FOREACH, IF, PATSUBST }; + enum TernaryOp { SUBST, FOREACH, IF }; private: TernaryOp Opc; Init *LHS, *MHS, *RHS; Modified: llvm/trunk/utils/TableGen/TGLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.cpp?rev=73138&r1=73137&r2=73138&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGLexer.cpp (original) +++ llvm/trunk/utils/TableGen/TGLexer.cpp Tue Jun 9 13:31:17 2009 @@ -447,9 +447,7 @@ if (Len == 3 && !memcmp(Start, "shl", 3)) return tgtok::XSHL; if (Len == 9 && !memcmp(Start, "strconcat", 9)) return tgtok::XStrConcat; if (Len == 10 && !memcmp(Start, "nameconcat", 10)) return tgtok::XNameConcat; - if (Len == 8 && !memcmp(Start, "regmatch", 8)) return tgtok::XRegMatch; if (Len == 5 && !memcmp(Start, "subst", 5)) return tgtok::XSubst; - if (Len == 8 && !memcmp(Start, "patsubst", 8)) return tgtok::XPatSubst; if (Len == 7 && !memcmp(Start, "foreach", 7)) return tgtok::XForEach; if (Len == 4 && !memcmp(Start, "cast", 4)) return tgtok::XCast; if (Len == 3 && !memcmp(Start, "car", 3)) return tgtok::XCar; Modified: llvm/trunk/utils/TableGen/TGLexer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGLexer.h?rev=73138&r1=73137&r2=73138&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGLexer.h (original) +++ llvm/trunk/utils/TableGen/TGLexer.h Tue Jun 9 13:31:17 2009 @@ -46,7 +46,7 @@ // !keywords. XConcat, XSRA, XSRL, XSHL, XStrConcat, XNameConcat, XCast, XSubst, - XForEach, XCar, XCdr, XNull, XIf, XRegMatch, XPatSubst, + XForEach, XCar, XCdr, XNull, XIf, // Integer value. IntVal, Modified: llvm/trunk/utils/TableGen/TGParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=73138&r1=73137&r2=73138&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGParser.cpp (original) +++ llvm/trunk/utils/TableGen/TGParser.cpp Tue Jun 9 13:31:17 2009 @@ -799,7 +799,6 @@ case tgtok::XSRL: case tgtok::XSHL: case tgtok::XStrConcat: - case tgtok::XRegMatch: case tgtok::XNameConcat: { // Value ::= !binop '(' Value ',' Value ')' BinOpInit::BinaryOp Code; RecTy *Type = 0; @@ -832,11 +831,6 @@ Code = BinOpInit::STRCONCAT; Type = new StringRecTy(); break; - case tgtok::XRegMatch: - Lex.Lex(); // eat the operation - Code = BinOpInit::REGMATCH; - Type = new IntRecTy(); - break; case tgtok::XNameConcat: Lex.Lex(); // eat the operation Code = BinOpInit::NAMECONCAT; @@ -878,7 +872,6 @@ case tgtok::XIf: case tgtok::XForEach: - case tgtok::XPatSubst: case tgtok::XSubst: { // Value ::= !ternop '(' Value ',' Value ',' Value ')' TernOpInit::TernaryOp Code; RecTy *Type = 0; @@ -897,9 +890,6 @@ case tgtok::XSubst: Code = TernOpInit::SUBST; break; - case tgtok::XPatSubst: - Code = TernOpInit::PATSUBST; - break; } if (Lex.getCode() != tgtok::l_paren) { TokError("expected '(' after ternary operator"); @@ -973,10 +963,6 @@ Type = RHSt->getType(); break; } - case tgtok::XPatSubst: { - Type = new StringRecTy; - break; - } } return (new TernOpInit(Code, LHS, MHS, RHS, Type))->Fold(CurRec, CurMultiClass); } @@ -1281,11 +1267,9 @@ case tgtok::XSRL: case tgtok::XSHL: case tgtok::XStrConcat: - case tgtok::XRegMatch: case tgtok::XNameConcat: // Value ::= !binop '(' Value ',' Value ')' case tgtok::XIf: case tgtok::XForEach: - case tgtok::XPatSubst: case tgtok::XSubst: { // Value ::= !ternop '(' Value ',' Value ',' Value ')' return ParseOperation(CurRec); break; From isanbard at gmail.com Tue Jun 9 13:49:42 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 09 Jun 2009 18:49:42 -0000 Subject: [llvm-commits] [llvm] r73139 - /llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Message-ID: <200906091849.n59Ingcc020199@zion.cs.uiuc.edu> Author: void Date: Tue Jun 9 13:49:42 2009 New Revision: 73139 URL: http://llvm.org/viewvc/llvm-project?rev=73139&view=rev Log: I'm going to assume that this was meant to be an assignment instead of a computation that isn't used. Please correct this if it's wrong! Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=73139&r1=73138&r2=73139&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Tue Jun 9 13:49:42 2009 @@ -2025,7 +2025,7 @@ } } else { - ListTy - TArg->getType(); + ListTy = TArg->getType(); } } ListInit *LI = new ListInit(Values, new ListRecTy(ListTy)); From isanbard at gmail.com Tue Jun 9 13:53:46 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 9 Jun 2009 11:53:46 -0700 Subject: [llvm-commits] [PATCH] SafeToDestroyConstant In-Reply-To: References: Message-ID: On Jun 8, 2009, at 8:05 AM, Jay Foad wrote: > GlobalDCE.cpp's SafeToDestroyConstant() isn't used anywhere. Meanwhile > GlobalOpt.cpp has a very similar function called ConstantIsDead(). > > This patch removes the unused function but renames ConstantIsDead to > SafeToDestroyConstant, because I think that makes the connection with > Constant::destroyConstant() clearer. Thoughts? Should > SafeToDestroyConstant() really be a method on Constant? > Dunno if anyone has commented on this. The patch looks okay to me. Go ahead and apply. Thanks! -bw From isanbard at gmail.com Tue Jun 9 13:55:39 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 09 Jun 2009 18:55:39 -0000 Subject: [llvm-commits] [llvm] r73140 - /llvm/trunk/test/TableGen/patsubst.td Message-ID: <200906091855.n59ItdH8020353@zion.cs.uiuc.edu> Author: void Date: Tue Jun 9 13:55:39 2009 New Revision: 73140 URL: http://llvm.org/viewvc/llvm-project?rev=73140&view=rev Log: Remove empty file. Removed: llvm/trunk/test/TableGen/patsubst.td Removed: llvm/trunk/test/TableGen/patsubst.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/patsubst.td?rev=73139&view=auto ============================================================================== (empty) From resistor at mac.com Tue Jun 9 14:30:46 2009 From: resistor at mac.com (Owen Anderson) Date: Tue, 09 Jun 2009 19:30:46 -0000 Subject: [llvm-commits] [llvm] r73141 - in /llvm/trunk: include/llvm/CodeGen/LazyLiveness.h lib/CodeGen/LazyLiveness.cpp Message-ID: <200906091930.n59JUk2F021305@zion.cs.uiuc.edu> Author: resistor Date: Tue Jun 9 14:30:45 2009 New Revision: 73141 URL: http://llvm.org/viewvc/llvm-project?rev=73141&view=rev Log: Add the beginnings of an implementatation of lazy liveness analysis, based on "Fast Liveness Checking for SSA-form Programs" by Boissinot, et al. This is still very early, hasn't been tested, and is not yet well documented. More to come soon. Added: llvm/trunk/include/llvm/CodeGen/LazyLiveness.h llvm/trunk/lib/CodeGen/LazyLiveness.cpp Added: llvm/trunk/include/llvm/CodeGen/LazyLiveness.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LazyLiveness.h?rev=73141&view=auto ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LazyLiveness.h (added) +++ llvm/trunk/include/llvm/CodeGen/LazyLiveness.h Tue Jun 9 14:30:45 2009 @@ -0,0 +1,62 @@ +//===- LazyLiveness.h - Lazy, CFG-invariant liveness information ----------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This pass implements a lazy liveness analysis as per "Fast Liveness Checking +// for SSA-form Programs," by Boissinot, et al. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CODEGEN_LAZYLIVENESS_H +#define LLVM_CODEGEN_LAZYLIVENESS_H + +#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineDominators.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DenseSet.h" +#include "llvm/ADT/SparseBitVector.h" +#include + +namespace llvm { + +class MachineRegisterInfo; + +class LazyLiveness : public MachineFunctionPass { +public: + static char ID; // Pass identification, replacement for typeid + LazyLiveness() : MachineFunctionPass(&ID) { } + + void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addRequired(); + } + + bool runOnMachineFunction(MachineFunction &mf); + + bool vregLiveIntoMBB(unsigned vreg, MachineBasicBlock* MBB); + +private: + void computeBackedgeChain(MachineFunction& mf, MachineBasicBlock* MBB); + + typedef std::pair edge_t; + + MachineRegisterInfo* MRI; + + DenseMap preorder; + std::vector rev_preorder; + DenseMap > rv; + DenseMap > tv; + DenseSet backedges; + SparseBitVector<128> backedge_source; + SparseBitVector<128> backedge_target; + SparseBitVector<128> calculated; +}; + +} + +#endif \ No newline at end of file Added: llvm/trunk/lib/CodeGen/LazyLiveness.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LazyLiveness.cpp?rev=73141&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/LazyLiveness.cpp (added) +++ llvm/trunk/lib/CodeGen/LazyLiveness.cpp Tue Jun 9 14:30:45 2009 @@ -0,0 +1,153 @@ +//===- LazyLiveness.cpp - Lazy, CFG-invariant liveness information --------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This pass implements a lazy liveness analysis as per "Fast Liveness Checking +// for SSA-form Programs," by Boissinot, et al. +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "lazyliveness" +#include "llvm/CodeGen/LazyLiveness.h" +#include "llvm/CodeGen/MachineDominators.h" +#include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/CodeGen/Passes.h" +#include "llvm/ADT/DepthFirstIterator.h" +#include "llvm/ADT/PostOrderIterator.h" +using namespace llvm; + +char LazyLiveness::ID = 0; + +void LazyLiveness::computeBackedgeChain(MachineFunction& mf, + MachineBasicBlock* MBB) { + SparseBitVector<128> tmp = rv[MBB]; + tmp.set(preorder[MBB]); + tmp &= backedge_source; + calculated.set(preorder[MBB]); + + for (SparseBitVector<128>::iterator I = tmp.begin(); I != tmp.end(); ++I) { + MachineBasicBlock* SrcMBB = rev_preorder[*I]; + + for (MachineBasicBlock::succ_iterator SI = SrcMBB->succ_begin(); + SI != SrcMBB->succ_end(); ++SI) { + MachineBasicBlock* TgtMBB = *SI; + + if (backedges.count(std::make_pair(SrcMBB, TgtMBB)) && + !rv[MBB].test(preorder[TgtMBB])) { + if (!calculated.test(preorder[TgtMBB])) + computeBackedgeChain(mf, TgtMBB); + + tv[MBB].set(preorder[TgtMBB]); + tv[MBB] |= tv[TgtMBB]; + } + } + + tv[MBB].reset(preorder[MBB]); + } +} + +bool LazyLiveness::runOnMachineFunction(MachineFunction &mf) { + rv.clear(); + tv.clear(); + backedges.clear(); + backedge_source.clear(); + backedge_target.clear(); + calculated.clear(); + preorder.clear(); + + MRI = &mf.getRegInfo(); + + // Step 0: Compute preorder numbering for all MBBs. + unsigned num = 0; + for (df_iterator DI = df_begin(&*mf.begin()); + DI != df_end(&*mf.end()); ++DI) { + preorder[*DI] = num++; + rev_preorder.push_back(*DI); + } + + // Step 1: Compute the transitive closure of the CFG, ignoring backedges. + for (po_iterator POI = po_begin(&*mf.begin()); + POI != po_end(&*mf.begin()); ++POI) { + MachineBasicBlock* MBB = *POI; + SparseBitVector<128>& entry = rv[MBB]; + entry.set(preorder[MBB]); + + for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(); + SI != MBB->succ_end(); ++SI) { + DenseMap >::iterator SII = + rv.find(*SI); + + // Because we're iterating in postorder, any successor that does not yet + // have an rv entry must be on a backedge. + if (SII != rv.end()) { + entry |= SII->second; + } else { + backedges.insert(std::make_pair(MBB, *SI)); + backedge_source.set(preorder[MBB]); + backedge_target.set(preorder[*SI]); + } + } + } + + for (SparseBitVector<128>::iterator I = backedge_source.begin(); + I != backedge_source.end(); ++I) + computeBackedgeChain(mf, rev_preorder[*I]); + + for (po_iterator POI = po_begin(&*mf.begin()), + POE = po_end(&*mf.begin()); POI != POE; ++POI) + if (!backedge_target.test(preorder[*POI])) + for (MachineBasicBlock::succ_iterator SI = (*POI)->succ_begin(); + SI != (*POI)->succ_end(); ++SI) + if (!backedges.count(std::make_pair(*POI, *SI)) && tv.count(*SI)) + tv[*POI]= tv[*SI]; + + for (po_iterator POI = po_begin(&*mf.begin()), + POE = po_end(&*mf.begin()); POI != POE; ++POI) + tv[*POI].set(preorder[*POI]); + + return false; +} + +bool LazyLiveness::vregLiveIntoMBB(unsigned vreg, MachineBasicBlock* MBB) { + MachineDominatorTree& MDT = getAnalysis(); + + MachineBasicBlock* DefMBB = MRI->def_begin(vreg)->getParent(); + unsigned def = preorder[DefMBB]; + unsigned max_dom = 0; + for (df_iterator DI = df_begin(MDT[DefMBB]); + DI != df_end(MDT[DefMBB]); ++DI) + if (preorder[DI->getBlock()] > max_dom) { + max_dom = preorder[(*DI)->getBlock()]; + } + + if (preorder[MBB] <= def || max_dom < preorder[MBB]) + return false; + + SparseBitVector<128>::iterator I = tv[MBB].begin(); + while (I != tv[MBB].end() && *I <= def) ++I; + while (I != tv[MBB].end() && *I < max_dom) { + for (MachineRegisterInfo::use_iterator UI = MRI->use_begin(vreg); + UI != MachineRegisterInfo::use_end(); ++UI) { + MachineBasicBlock* UseMBB = UI->getParent(); + if (rv[rev_preorder[*I]].test(preorder[UseMBB])) + return true; + + unsigned t_dom = 0; + for (df_iterator DI = + df_begin(MDT[rev_preorder[*I]]); + DI != df_end(MDT[rev_preorder[*I]]); ++DI) + if (preorder[DI->getBlock()] > t_dom) { + max_dom = preorder[(*DI)->getBlock()]; + } + I = tv[MBB].begin(); + while (I != tv[MBB].end() && *I < t_dom) ++I; + } + } + + return false; +} \ No newline at end of file From isanbard at gmail.com Tue Jun 9 15:09:03 2009 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 09 Jun 2009 20:09:03 -0000 Subject: [llvm-commits] [llvm] r73143 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200906092009.n59K95pP022250@zion.cs.uiuc.edu> Author: void Date: Tue Jun 9 15:08:51 2009 New Revision: 73143 URL: http://llvm.org/viewvc/llvm-project?rev=73143&view=rev Log: Simplified logic of this if-then statement to reduce nesting. No functionality change. Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=73143&r1=73142&r2=73143&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Tue Jun 9 15:08:51 2009 @@ -838,55 +838,57 @@ if (MBBI != MBB.end()) DL = MBBI->getDebugLoc(); - if (NumBytes) { // adjust stack pointer: ESP -= numbytes - if (NumBytes >= 4096 && Subtarget->isTargetCygMing()) { - // Check, whether EAX is livein for this function - bool isEAXAlive = false; - for (MachineRegisterInfo::livein_iterator + // Adjust stack pointer: ESP -= numbytes. + if (NumBytes >= 4096 && Subtarget->isTargetCygMing()) { + // Check, whether EAX is livein for this function. + bool isEAXAlive = false; + for (MachineRegisterInfo::livein_iterator II = MF.getRegInfo().livein_begin(), EE = MF.getRegInfo().livein_end(); (II != EE) && !isEAXAlive; ++II) { - unsigned Reg = II->first; - isEAXAlive = (Reg == X86::EAX || Reg == X86::AX || - Reg == X86::AH || Reg == X86::AL); - } + unsigned Reg = II->first; + isEAXAlive = (Reg == X86::EAX || Reg == X86::AX || + Reg == X86::AH || Reg == X86::AL); + } - // Function prologue calls _alloca to probe the stack when allocating - // more than 4k bytes in one go. Touching the stack at 4K increments is - // necessary to ensure that the guard pages used by the OS virtual memory - // manager are allocated in correct sequence. - if (!isEAXAlive) { - BuildMI(MBB, MBBI, DL, TII.get(X86::MOV32ri), X86::EAX) - .addImm(NumBytes); - BuildMI(MBB, MBBI, DL, TII.get(X86::CALLpcrel32)) - .addExternalSymbol("_alloca"); - } else { - // Save EAX - BuildMI(MBB, MBBI, DL, TII.get(X86::PUSH32r)) - .addReg(X86::EAX, RegState::Kill); - // Allocate NumBytes-4 bytes on stack. We'll also use 4 already - // allocated bytes for EAX. - BuildMI(MBB, MBBI, DL, - TII.get(X86::MOV32ri), X86::EAX).addImm(NumBytes-4); - BuildMI(MBB, MBBI, DL, TII.get(X86::CALLpcrel32)) - .addExternalSymbol("_alloca"); - // Restore EAX - MachineInstr *MI = addRegOffset(BuildMI(MF, DL, TII.get(X86::MOV32rm), - X86::EAX), - StackPtr, false, NumBytes-4); - MBB.insert(MBBI, MI); - } + // Function prologue calls _alloca to probe the stack when allocating more + // than 4k bytes in one go. Touching the stack at 4K increments is necessary + // to ensure that the guard pages used by the OS virtual memory manager are + // allocated in correct sequence. + if (!isEAXAlive) { + BuildMI(MBB, MBBI, DL, TII.get(X86::MOV32ri), X86::EAX) + .addImm(NumBytes); + BuildMI(MBB, MBBI, DL, TII.get(X86::CALLpcrel32)) + .addExternalSymbol("_alloca"); } else { - // If there is an SUB32ri of ESP immediately before this instruction, - // merge the two. This can be the case when tail call elimination is - // enabled and the callee has more arguments then the caller. - NumBytes -= mergeSPUpdates(MBB, MBBI, StackPtr, true); - // If there is an ADD32ri or SUB32ri of ESP immediately after this - // instruction, merge the two instructions. - mergeSPUpdatesDown(MBB, MBBI, StackPtr, &NumBytes); - - if (NumBytes) - emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit, TII); + // Save EAX + BuildMI(MBB, MBBI, DL, TII.get(X86::PUSH32r)) + .addReg(X86::EAX, RegState::Kill); + + // Allocate NumBytes-4 bytes on stack. We'll also use 4 already + // allocated bytes for EAX. + BuildMI(MBB, MBBI, DL, TII.get(X86::MOV32ri), X86::EAX) + .addImm(NumBytes - 4); + BuildMI(MBB, MBBI, DL, TII.get(X86::CALLpcrel32)) + .addExternalSymbol("_alloca"); + + // Restore EAX + MachineInstr *MI = addRegOffset(BuildMI(MF, DL, TII.get(X86::MOV32rm), + X86::EAX), + StackPtr, false, NumBytes - 4); + MBB.insert(MBBI, MI); } + } else if (NumBytes) { + // If there is an SUB32ri of ESP immediately before this instruction, merge + // the two. This can be the case when tail call elimination is enabled and + // the callee has more arguments then the caller. + NumBytes -= mergeSPUpdates(MBB, MBBI, StackPtr, true); + + // If there is an ADD32ri or SUB32ri of ESP immediately after this + // instruction, merge the two instructions. + mergeSPUpdatesDown(MBB, MBBI, StackPtr, &NumBytes); + + if (NumBytes) + emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit, TII); } if (needsFrameMoves) From rafael.espindola at gmail.com Tue Jun 9 16:14:25 2009 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 09 Jun 2009 21:14:25 -0000 Subject: [llvm-commits] [llvm] r73145 - /llvm/trunk/tools/lto/LTOCodeGenerator.cpp Message-ID: <200906092114.n59LEPwY024525@zion.cs.uiuc.edu> Author: rafael Date: Tue Jun 9 16:14:25 2009 New Revision: 73145 URL: http://llvm.org/viewvc/llvm-project?rev=73145&view=rev Log: Bug fix: string::find returns string::npos if the substring is not found. Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=73145&r1=73144&r2=73145&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Tue Jun 9 16:14:25 2009 @@ -248,7 +248,7 @@ std::vector args; std::string targetTriple = _linker.getModule()->getTargetTriple(); args.push_back(tool.c_str()); - if ( targetTriple.find("darwin") != targetTriple.size() ) { + if ( targetTriple.find("darwin") != std::string::npos ) { // darwin specific command line options if (strncmp(targetTriple.c_str(), "i386-apple-", 11) == 0) { args.push_back("-arch"); From rafael.espindola at gmail.com Tue Jun 9 16:22:03 2009 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 09 Jun 2009 21:22:03 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r73146 - /llvm-gcc-4.2/trunk/gcc/gcc.c Message-ID: <200906092122.n59LM37N024763@zion.cs.uiuc.edu> Author: rafael Date: Tue Jun 9 16:22:03 2009 New Revision: 73146 URL: http://llvm.org/viewvc/llvm-project?rev=73146&view=rev Log: Pass as instead of gcc to the gold plugin. Modified: llvm-gcc-4.2/trunk/gcc/gcc.c Modified: llvm-gcc-4.2/trunk/gcc/gcc.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/gcc.c?rev=73146&r1=73145&r2=73146&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/gcc.c (original) +++ llvm-gcc-4.2/trunk/gcc/gcc.c Tue Jun 9 16:22:03 2009 @@ -720,7 +720,7 @@ %(linker) \ %{use-gold-plugin: \ -plugin %(gold_plugin_file) \ - -plugin-opt=gcc=%(gold_plugin_gcc) \ + -plugin-opt=as=%(gold_plugin_as) \ } \ %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} % Author: ddunbar Date: Tue Jun 9 16:24:39 2009 New Revision: 73148 URL: http://llvm.org/viewvc/llvm-project?rev=73148&view=rev Log: Remove empty test (my DejaGNU doesn't like this) Removed: llvm/trunk/test/TableGen/regmatch.td Removed: llvm/trunk/test/TableGen/regmatch.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/regmatch.td?rev=73147&view=auto ============================================================================== (empty) From jay.foad at gmail.com Tue Jun 9 16:37:12 2009 From: jay.foad at gmail.com (Jay Foad) Date: Tue, 09 Jun 2009 21:37:12 -0000 Subject: [llvm-commits] [llvm] r73149 - in /llvm/trunk/lib/Transforms/IPO: GlobalDCE.cpp GlobalOpt.cpp Message-ID: <200906092137.n59LbCTD025234@zion.cs.uiuc.edu> Author: foad Date: Tue Jun 9 16:37:11 2009 New Revision: 73149 URL: http://llvm.org/viewvc/llvm-project?rev=73149&view=rev Log: Remove an unused function SafeToDestroyConstant(). Rename an almost identical function ConstantIsDead() to SafeToDestroyConstant(), to emphasise the connection with Constant::destroyConstant(). Modified: llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp?rev=73149&r1=73148&r2=73149&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalDCE.cpp Tue Jun 9 16:37:11 2009 @@ -47,7 +47,6 @@ void GlobalIsNeeded(GlobalValue *GV); void MarkUsedGlobalsAsNeeded(Constant *C); - bool SafeToDestroyConstant(Constant* C); bool RemoveUnusedGlobalValue(GlobalValue &GV); }; } @@ -211,17 +210,3 @@ GV.removeDeadConstantUsers(); return GV.use_empty(); } - -// SafeToDestroyConstant - It is safe to destroy a constant iff it is only used -// by constants itself. Note that constants cannot be cyclic, so this test is -// pretty easy to implement recursively. -// -bool GlobalDCE::SafeToDestroyConstant(Constant *C) { - for (Value::use_iterator I = C->use_begin(), E = C->use_end(); I != E; ++I) - if (Constant *User = dyn_cast(*I)) { - if (!SafeToDestroyConstant(User)) return false; - } else { - return false; - } - return true; -} Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=73149&r1=73148&r2=73149&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Tue Jun 9 16:37:11 2009 @@ -136,16 +136,16 @@ } -/// ConstantIsDead - Return true if the specified constant is (transitively) -/// dead. The constant may be used by other constants (e.g. constant arrays and -/// constant exprs) as long as they are dead, but it cannot be used by anything -/// else. -static bool ConstantIsDead(Constant *C) { +// SafeToDestroyConstant - It is safe to destroy a constant iff it is only used +// by constants itself. Note that constants cannot be cyclic, so this test is +// pretty easy to implement recursively. +// +static bool SafeToDestroyConstant(Constant *C) { if (isa(C)) return false; for (Value::use_iterator UI = C->use_begin(), E = C->use_end(); UI != E; ++UI) if (Constant *CU = dyn_cast(*UI)) { - if (!ConstantIsDead(CU)) return false; + if (!SafeToDestroyConstant(CU)) return false; } else return false; return true; @@ -233,7 +233,7 @@ } else if (Constant *C = dyn_cast(*UI)) { GS.HasNonInstructionUser = true; // We might have a dead and dangling constant hanging off of here. - if (!ConstantIsDead(C)) + if (!SafeToDestroyConstant(C)) return true; } else { GS.HasNonInstructionUser = true; @@ -338,7 +338,7 @@ } else if (Constant *C = dyn_cast(U)) { // If we have a chain of dead constantexprs or other things dangling from // us, and if they are all dead, nuke them without remorse. - if (ConstantIsDead(C)) { + if (SafeToDestroyConstant(C)) { C->destroyConstant(); // This could have invalidated UI, start over from scratch. CleanupConstantGlobalUsers(V, Init); @@ -354,7 +354,7 @@ static bool isSafeSROAElementUse(Value *V) { // We might have a dead and dangling constant hanging off of here. if (Constant *C = dyn_cast(V)) - return ConstantIsDead(C); + return SafeToDestroyConstant(C); Instruction *I = dyn_cast(V); if (!I) return false; From brukman+llvm at gmail.com Tue Jun 9 16:48:57 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Tue, 09 Jun 2009 21:48:57 -0000 Subject: [llvm-commits] [llvm] r73150 - /llvm/trunk/unittests/ADT/TripleTest.cpp Message-ID: <200906092148.n59LmvfH025552@zion.cs.uiuc.edu> Author: brukman Date: Tue Jun 9 16:48:57 2009 New Revision: 73150 URL: http://llvm.org/viewvc/llvm-project?rev=73150&view=rev Log: Reversed order of args in EXPECT_EQ() macros to be in the correct order: EXPECT_EQ(expected, actual) . This will make error messages understandable as it uses terms such as "expected" and "actual" based on the order of arguments. Modified: llvm/trunk/unittests/ADT/TripleTest.cpp Modified: llvm/trunk/unittests/ADT/TripleTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/TripleTest.cpp?rev=73150&r1=73149&r2=73150&view=diff ============================================================================== --- llvm/trunk/unittests/ADT/TripleTest.cpp (original) +++ llvm/trunk/unittests/ADT/TripleTest.cpp Tue Jun 9 16:48:57 2009 @@ -18,120 +18,120 @@ Triple T; T = Triple(""); - EXPECT_EQ(T.getArchName(), ""); - EXPECT_EQ(T.getVendorName(), ""); - EXPECT_EQ(T.getOSName(), ""); - EXPECT_EQ(T.getEnvironmentName(), ""); + EXPECT_EQ("", T.getArchName()); + EXPECT_EQ("", T.getVendorName()); + EXPECT_EQ("", T.getOSName()); + EXPECT_EQ("", T.getEnvironmentName()); T = Triple("-"); - EXPECT_EQ(T.getArchName(), ""); - EXPECT_EQ(T.getVendorName(), ""); - EXPECT_EQ(T.getOSName(), ""); - EXPECT_EQ(T.getEnvironmentName(), ""); + EXPECT_EQ("", T.getArchName()); + EXPECT_EQ("", T.getVendorName()); + EXPECT_EQ("", T.getOSName()); + EXPECT_EQ("", T.getEnvironmentName()); T = Triple("--"); - EXPECT_EQ(T.getArchName(), ""); - EXPECT_EQ(T.getVendorName(), ""); - EXPECT_EQ(T.getOSName(), ""); - EXPECT_EQ(T.getEnvironmentName(), ""); + EXPECT_EQ("", T.getArchName()); + EXPECT_EQ("", T.getVendorName()); + EXPECT_EQ("", T.getOSName()); + EXPECT_EQ("", T.getEnvironmentName()); T = Triple("---"); - EXPECT_EQ(T.getArchName(), ""); - EXPECT_EQ(T.getVendorName(), ""); - EXPECT_EQ(T.getOSName(), ""); - EXPECT_EQ(T.getEnvironmentName(), ""); + EXPECT_EQ("", T.getArchName()); + EXPECT_EQ("", T.getVendorName()); + EXPECT_EQ("", T.getOSName()); + EXPECT_EQ("", T.getEnvironmentName()); T = Triple("----"); - EXPECT_EQ(T.getArchName(), ""); - EXPECT_EQ(T.getVendorName(), ""); - EXPECT_EQ(T.getOSName(), ""); - EXPECT_EQ(T.getEnvironmentName(), "-"); + EXPECT_EQ("", T.getArchName()); + EXPECT_EQ("", T.getVendorName()); + EXPECT_EQ("", T.getOSName()); + EXPECT_EQ("-", T.getEnvironmentName()); T = Triple("a"); - EXPECT_EQ(T.getArchName(), "a"); - EXPECT_EQ(T.getVendorName(), ""); - EXPECT_EQ(T.getOSName(), ""); - EXPECT_EQ(T.getEnvironmentName(), ""); + EXPECT_EQ("a", T.getArchName()); + EXPECT_EQ("", T.getVendorName()); + EXPECT_EQ("", T.getOSName()); + EXPECT_EQ("", T.getEnvironmentName()); T = Triple("a-b"); - EXPECT_EQ(T.getArchName(), "a"); - EXPECT_EQ(T.getVendorName(), "b"); - EXPECT_EQ(T.getOSName(), ""); - EXPECT_EQ(T.getEnvironmentName(), ""); + EXPECT_EQ("a", T.getArchName()); + EXPECT_EQ("b", T.getVendorName()); + EXPECT_EQ("", T.getOSName()); + EXPECT_EQ("", T.getEnvironmentName()); T = Triple("a-b-c"); - EXPECT_EQ(T.getArchName(), "a"); - EXPECT_EQ(T.getVendorName(), "b"); - EXPECT_EQ(T.getOSName(), "c"); - EXPECT_EQ(T.getEnvironmentName(), ""); + EXPECT_EQ("a", T.getArchName()); + EXPECT_EQ("b", T.getVendorName()); + EXPECT_EQ("c", T.getOSName()); + EXPECT_EQ("", T.getEnvironmentName()); T = Triple("a-b-c-d"); - EXPECT_EQ(T.getArchName(), "a"); - EXPECT_EQ(T.getVendorName(), "b"); - EXPECT_EQ(T.getOSName(), "c"); - EXPECT_EQ(T.getEnvironmentName(), "d"); + EXPECT_EQ("a", T.getArchName()); + EXPECT_EQ("b", T.getVendorName()); + EXPECT_EQ("c", T.getOSName()); + EXPECT_EQ("d", T.getEnvironmentName()); } TEST(TripleTest, ParsedIDs) { Triple T; T = Triple("i386-apple-darwin"); - EXPECT_EQ(T.getArch(), Triple::x86); - EXPECT_EQ(T.getVendor(), Triple::Apple); - EXPECT_EQ(T.getOS(), Triple::Darwin); + EXPECT_EQ(Triple::x86, T.getArch()); + EXPECT_EQ(Triple::Apple, T.getVendor()); + EXPECT_EQ(Triple::Darwin, T.getOS()); T = Triple("x86_64-pc-linux-gnu"); - EXPECT_EQ(T.getArch(), Triple::x86_64); - EXPECT_EQ(T.getVendor(), Triple::PC); - EXPECT_EQ(T.getOS(), Triple::Linux); + EXPECT_EQ(Triple::x86_64, T.getArch()); + EXPECT_EQ(Triple::PC, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); T = Triple("powerpc-dunno-notsure"); - EXPECT_EQ(T.getArch(), Triple::ppc); - EXPECT_EQ(T.getVendor(), Triple::UnknownVendor); - EXPECT_EQ(T.getOS(), Triple::UnknownOS); + EXPECT_EQ(Triple::ppc, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::UnknownOS, T.getOS()); T = Triple("huh"); - EXPECT_EQ(T.getArch(), Triple::UnknownArch); + EXPECT_EQ(Triple::UnknownArch, T.getArch()); } TEST(TripleTest, MutateName) { Triple T; - EXPECT_EQ(T.getArch(), Triple::UnknownArch); - EXPECT_EQ(T.getVendor(), Triple::UnknownVendor); - EXPECT_EQ(T.getOS(), Triple::UnknownOS); + EXPECT_EQ(Triple::UnknownArch, T.getArch()); + EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); + EXPECT_EQ(Triple::UnknownOS, T.getOS()); T.setArchName("i386"); - EXPECT_EQ(T.getArch(), Triple::x86); - EXPECT_EQ(T.getTriple(), "i386--"); + EXPECT_EQ(Triple::x86, T.getArch()); + EXPECT_EQ("i386--", T.getTriple()); T.setVendorName("pc"); - EXPECT_EQ(T.getArch(), Triple::x86); - EXPECT_EQ(T.getVendor(), Triple::PC); - EXPECT_EQ(T.getTriple(), "i386-pc-"); + EXPECT_EQ(Triple::x86, T.getArch()); + EXPECT_EQ(Triple::PC, T.getVendor()); + EXPECT_EQ("i386-pc-", T.getTriple()); T.setOSName("linux"); - EXPECT_EQ(T.getArch(), Triple::x86); - EXPECT_EQ(T.getVendor(), Triple::PC); - EXPECT_EQ(T.getOS(), Triple::Linux); - EXPECT_EQ(T.getTriple(), "i386-pc-linux"); + EXPECT_EQ(Triple::x86, T.getArch()); + EXPECT_EQ(Triple::PC, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ("i386-pc-linux", T.getTriple()); T.setEnvironmentName("gnu"); - EXPECT_EQ(T.getArch(), Triple::x86); - EXPECT_EQ(T.getVendor(), Triple::PC); - EXPECT_EQ(T.getOS(), Triple::Linux); - EXPECT_EQ(T.getTriple(), "i386-pc-linux-gnu"); + EXPECT_EQ(Triple::x86, T.getArch()); + EXPECT_EQ(Triple::PC, T.getVendor()); + EXPECT_EQ(Triple::Linux, T.getOS()); + EXPECT_EQ("i386-pc-linux-gnu", T.getTriple()); T.setOSName("freebsd"); - EXPECT_EQ(T.getArch(), Triple::x86); - EXPECT_EQ(T.getVendor(), Triple::PC); - EXPECT_EQ(T.getOS(), Triple::FreeBSD); - EXPECT_EQ(T.getTriple(), "i386-pc-freebsd-gnu"); + EXPECT_EQ(Triple::x86, T.getArch()); + EXPECT_EQ(Triple::PC, T.getVendor()); + EXPECT_EQ(Triple::FreeBSD, T.getOS()); + EXPECT_EQ("i386-pc-freebsd-gnu", T.getTriple()); T.setOSAndEnvironmentName("darwin"); - EXPECT_EQ(T.getArch(), Triple::x86); - EXPECT_EQ(T.getVendor(), Triple::PC); - EXPECT_EQ(T.getOS(), Triple::Darwin); - EXPECT_EQ(T.getTriple(), "i386-pc-darwin"); + EXPECT_EQ(Triple::x86, T.getArch()); + EXPECT_EQ(Triple::PC, T.getVendor()); + EXPECT_EQ(Triple::Darwin, T.getOS()); + EXPECT_EQ("i386-pc-darwin", T.getTriple()); } } From asl at math.spbu.ru Tue Jun 9 18:00:39 2009 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 09 Jun 2009 23:00:39 -0000 Subject: [llvm-commits] [llvm] r73152 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200906092300.n59N0ddN027474@zion.cs.uiuc.edu> Author: asl Date: Tue Jun 9 18:00:39 2009 New Revision: 73152 URL: http://llvm.org/viewvc/llvm-project?rev=73152&view=rev Log: Silence a warning 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=73152&r1=73151&r2=73152&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jun 9 18:00:39 2009 @@ -7696,7 +7696,7 @@ SelectionDAG &DAG, MachineFrameInfo *MFI, const TargetLowering &TLI) { LDBase = NULL; - LastLoadedElt = -1; + LastLoadedElt = -1U; for (unsigned i = 0; i < NumElems; ++i) { if (N->getMaskElt(i) < 0) { if (!LDBase) From sanjiv.gupta at microchip.com Tue Jun 9 22:42:14 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Wed, 10 Jun 2009 03:42:14 -0000 Subject: [llvm-commits] [llvm] r73156 - in /llvm/trunk: include/llvm/CodeGen/LazyLiveness.h lib/CodeGen/LazyLiveness.cpp Message-ID: <200906100342.n5A3gGMX002378@zion.cs.uiuc.edu> Author: sgupta Date: Tue Jun 9 22:42:13 2009 New Revision: 73156 URL: http://llvm.org/viewvc/llvm-project?rev=73156&view=rev Log: Remove warnings: no newline at end of file. Modified: llvm/trunk/include/llvm/CodeGen/LazyLiveness.h llvm/trunk/lib/CodeGen/LazyLiveness.cpp Modified: llvm/trunk/include/llvm/CodeGen/LazyLiveness.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LazyLiveness.h?rev=73156&r1=73155&r2=73156&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LazyLiveness.h (original) +++ llvm/trunk/include/llvm/CodeGen/LazyLiveness.h Tue Jun 9 22:42:13 2009 @@ -59,4 +59,5 @@ } -#endif \ No newline at end of file +#endif + Modified: llvm/trunk/lib/CodeGen/LazyLiveness.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LazyLiveness.cpp?rev=73156&r1=73155&r2=73156&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LazyLiveness.cpp (original) +++ llvm/trunk/lib/CodeGen/LazyLiveness.cpp Tue Jun 9 22:42:13 2009 @@ -150,4 +150,5 @@ } return false; -} \ No newline at end of file +} + From nicholas at mxc.ca Tue Jun 9 23:54:15 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 09 Jun 2009 21:54:15 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r73146 - /llvm-gcc-4.2/trunk/gcc/gcc.c In-Reply-To: <200906092122.n59LM37N024763@zion.cs.uiuc.edu> References: <200906092122.n59LM37N024763@zion.cs.uiuc.edu> Message-ID: <4A2F3C77.2080500@mxc.ca> Rafael Espindola wrote: > Author: rafael > Date: Tue Jun 9 16:22:03 2009 > New Revision: 73146 > > URL: http://llvm.org/viewvc/llvm-project?rev=73146&view=rev > Log: > Pass as instead of gcc to the gold plugin. I think this broke something: $ llvm-gcc -use-gold-plugin -flto -O2 hello.c -o hello Segmentation fault $ llvm-gcc -use-gold-plugin -flto -O2 hello.c -o hello -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../src/configure --disable-threads --enable-llvm=/home/nicholas/llvm-commit --enable-checking --enable-debug --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --enable-languages=c,c++ --prefix=/home/nicholas/llvm-gcc/install Thread model: single gcc version 4.2.1 (Based on Apple Inc. build 5646) (LLVM build) /home/nicholas/llvm-gcc/install/libexec/gcc/i686-pc-linux-gnu/4.2.1/cc1 -quiet -v -iprefix /usr/local/bin/../lib/gcc/i686-pc-linux-gnu/4.2.1/ hello.c -emit-llvm-bc -o /tmp/ccWWY8dY.o -quiet -dumpbase hello.c -mtune=generic -auxbase hello -O2 -version -flto ignoring nonexistent directory "/usr/local/bin/../lib/gcc/i686-pc-linux-gnu/4.2.1/include" ignoring nonexistent directory "/usr/local/bin/../lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/include" ignoring nonexistent directory "/home/nicholas/llvm-gcc/install/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /home/nicholas/llvm-gcc/install/include /home/nicholas/llvm-gcc/install/lib/gcc/i686-pc-linux-gnu/4.2.1/include /usr/include End of search list. GNU C version 4.2.1 (Based on Apple Inc. build 5646) (LLVM build) (i686-pc-linux-gnu) compiled by GNU C version 4.2.1 (Based on Apple Inc. build 5646) (LLVM build). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=8192 Compiler executable checksum: 65429ccbcc1d011be8dcb16583873f76 Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xf7bf96d0 (LWP 19937)] 0x0804be6c in do_spec_1 () at gcc.c:4946 4946 const char *p = spec; (gdb) bt #0 0x0804be6c in do_spec_1 () at gcc.c:4946 #1 0x0804d947 in do_spec_1 () at gcc.c:5917 #2 0x0804e307 in handle_braces () at gcc.c:6252 #3 0x0804dbc3 in do_spec_1 () at gcc.c:5429 #4 0x0804e307 in handle_braces () at gcc.c:6252 #5 0x0804dbc3 in do_spec_1 () at gcc.c:5429 #6 0x0804e307 in handle_braces () at gcc.c:6252 #7 0x0804dbc3 in do_spec_1 () at gcc.c:5429 #8 0x0804e307 in handle_braces () at gcc.c:6252 #9 0x0804dbc3 in do_spec_1 () at gcc.c:5429 #10 0x0804e307 in handle_braces () at gcc.c:6252 #11 0x0804dbc3 in do_spec_1 () at gcc.c:5429 #12 0x0804e307 in handle_braces () at gcc.c:6252 #13 0x0804dbc3 in do_spec_1 () at gcc.c:5429 #14 0x0804e307 in handle_braces () at gcc.c:6252 #15 0x0804dbc3 in do_spec_1 () at gcc.c:5429 #16 0x0804e49f in do_spec_2 () at gcc.c:4775 #17 0x0804e941 in do_spec () at gcc.c:4659 #18 0x080552a7 in main () at gcc.c:7200 Nick > Modified: > llvm-gcc-4.2/trunk/gcc/gcc.c > > Modified: llvm-gcc-4.2/trunk/gcc/gcc.c > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/gcc.c?rev=73146&r1=73145&r2=73146&view=diff > > ============================================================================== > --- llvm-gcc-4.2/trunk/gcc/gcc.c (original) > +++ llvm-gcc-4.2/trunk/gcc/gcc.c Tue Jun 9 16:22:03 2009 > @@ -720,7 +720,7 @@ > %(linker) \ > %{use-gold-plugin: \ > -plugin %(gold_plugin_file) \ > - -plugin-opt=gcc=%(gold_plugin_gcc) \ > + -plugin-opt=as=%(gold_plugin_as) \ > } \ > %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} % %{m} %{N} %{n} %{r}\ > @@ -777,7 +777,7 @@ > /* LLVM LOCAL begin */ > #ifdef ENABLE_LLVM > static const char *gold_plugin_file_spec = ""; > -static const char *gold_plugin_gcc_spec = ""; > +static const char *gold_plugin_as_spec = ""; > #endif > /* LLVM LOCAL end */ > static const char *link_command_spec = LINK_COMMAND_SPEC; > @@ -1661,7 +1661,7 @@ > /* LLVM LOCAL begin */ > #ifdef ENABLE_LLVM > INIT_STATIC_SPEC ("gold_plugin_file", &gold_plugin_file_spec), > - INIT_STATIC_SPEC ("gold_plugin_gcc", &gold_plugin_gcc_spec), > + INIT_STATIC_SPEC ("gold_plugin_as", &gold_plugin_as_spec), > INIT_STATIC_SPEC ("llvm_options", &llvm_options), > #endif > /* LLVM LOCAL end */ > @@ -7189,7 +7189,7 @@ > if (!gold_plugin_file_spec) > fatal ("-use-gold-plugin, but libLLVMgold.so not found."); > } > - gold_plugin_gcc_spec = argv[0]; > + gold_plugin_as_spec = find_a_file (&exec_prefixes, "as", X_OK, false); > #endif > /* LLVM LOCAL end */ > /* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From eocallaghan at auroraux.org Tue Jun 9 18:56:10 2009 From: eocallaghan at auroraux.org (Edward O'Callaghan) Date: Wed, 10 Jun 2009 00:56:10 +0100 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl Message-ID: <521640720906091656v35bd4b6bt9b2b103b939ea628@mail.gmail.com> Good day, Just a few improvements to our Nightly scripts so that they: * Clean up before each build when not doing a purge of the old checkin. * Add -disable-pic option for building (needs more testing) * Add clang nightly checkin and testing support. Just my two cent, let me know what you think.. -bash-3.2$ diff -u NewNightlyTest.pl_old NewNightlyTest.pl --- NewNightlyTest.pl_old Fri Jun 5 00:19:52 2009 +++ NewNightlyTest.pl Fri Jun 5 13:52:52 2009 -12,6 +12,7 @@ # to llvm.org where it is placed into the nightlytestresults database. # # Modified heavily by Patrick Jenkins, July 2006 +# Advanced by Edward O'Callaghan, Jun 2009 # # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] # where -26,10 +27,12 @@ # -nodejagnu Do not run feature or regression tests # -parallel Run parallel jobs with GNU Make (see -parallel-jobs). # -parallel-jobs The number of parallel Make jobs to use (default is two). +# -with-clang Checkout Clang source into tools/clang. # -release Build an LLVM Release version # -release-asserts Build an LLVM ReleaseAsserts version # -enable-llcbeta Enable testing of beta features in llc. # -enable-lli Enable testing of lli (interpreter) features, default is off +# -disable-pic Disable building with Position Independent Code. # -disable-llc Disable LLC tests in the nightly tester. # -disable-jit Disable JIT tests in the nightly tester. # -disable-cbe Disable C backend tests in the nightly tester. -98,7 +101,7 @@ ############################################################## my $HOME = $ENV{'HOME'}; my $SVNURL = $ENV{"SVNURL"}; -$SVNURL = 'https://llvm.org/svn/llvm-project' unless $SVNURL; +$SVNURL = 'http://llvm.org/svn/llvm-project' unless $SVNURL; my $CVSRootDir = $ENV{'CVSROOT'}; $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; my $BuildDir = $ENV{'BUILDDIR'}; -145,6 +148,7 @@ if (/^-norunningtests$/) { next; } # Backward compatibility, ignored. if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; next;} if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS -l3.0"; next; } + if (/^-with-clang$/) { $WITHCLANG = 1; next; } if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;} if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". -152,6 +156,7 @@ "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release-asserts"; next;} if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } + if (/^-disable-pic$/) { $CONFIGUREARGS .= " --enable-pic=no"; next; } if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; $CONFIGUREARGS .= " --enable-lli"; next; } if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; -534,13 +539,20 @@ if (!$NOCHECKOUT) { if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; } if ($USESVN) { - my $SVNCMD = "$NICE svn co $SVNURL"; - if ($VERBOSE) { - print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL"; + if ($VERBOSE) { + print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . + "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; + } + system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; - } - system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . - "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; + if ($WITHCLANG) { + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL/cfe/trunk"; + if ($VERBOSE) { + print "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog 2>&1\n"; + } + system "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog 2>&1\n"; + } } else { my $CVSOPT = ""; $CVSOPT = "-z3" # Use compression if going over ssh. -611,7 +623,7 @@ if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } if ($USESVN) { - @SVNHistory = split / $BuildLog 2>&1"; if ( $VERBOSE ) { print "BUILD STAGE:\n"; + print "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1\n"; print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; } # Build the entire tree, capturing the output into $BuildLog + system "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1"; system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; } Cheers, Edward. -- -- Edward O'Callaghan http://www.auroraux.org/ eocallaghan at auroraux dot org From nicholas at mxc.ca Wed Jun 10 00:24:53 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 09 Jun 2009 22:24:53 -0700 Subject: [llvm-commits] [llvm] r72894 - in /llvm/trunk: include/llvm/Attributes.h include/llvm/Target/TargetOptions.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Target/PowerPC/PPCRegisterInfo.cpp lib/Target/TargetMachine.cpp lib/Target/X86/X86RegisterInfo.cpp lib/VMCore/Attributes.cpp test/CodeGen/X86/red-zone2.ll tools/llc/llc.cpp In-Reply-To: <4E911180-C009-4BFA-BD92-0E2069344B06@apple.com> References: <200906042205.n54M5Ytf029806@zion.cs.uiuc.edu> <4A2C015B.2010408@mxc.ca> <4E911180-C009-4BFA-BD92-0E2069344B06@apple.com> Message-ID: <4A2F43A5.4000306@mxc.ca> Okay, that all sounds reasonable. It'd be nice if llvm-gcc didn't add then 'noredzone' attribute when I didn't explicitly ask for noredzone. That would reduce bitcode size and memory usage by a tiny amount. You *really should* commit a change to LangRef in the same commit as a change to the language, even if that means you have to do more work overall to update the text for each stage. Nick Devang Patel wrote: > > On Jun 7, 2009, at 11:05 AM, Nick Lewycky wrote: > >> This attribute needs an entry in LangRef. Please add one. > > Yes. I am going to add one or two additional attributes. I'll document > all of them together. >> >> >> Also, I'm now getting "noredzone" notes on all my functions all the >> time when building x86-32 Linux. I suppose that's technically true but >> do we really need this everywhere? > > llvm-gcc sets this when -mno-red-zone is set by GCC's target machinery. > >> >> >> Why disable the redzone anyways? Isn't it an ABI feature? > > GCC man page says, > > -mno-red-zone > Do not use a so called red zone for x86-64 code. The red > zone is > mandated by the x86-64 ABI, it is a 128-byte area beyond the > location of the stack pointer that will not be modified by > signal > or interrupt handlers and therefore can be used for temporary > data > without adjusting the stack pointer. The flag -mno-red-zone > disables this red zone. > > >> >> >> Nick > - > Devang > From nicholas at mxc.ca Wed Jun 10 00:26:12 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Tue, 09 Jun 2009 22:26:12 -0700 Subject: [llvm-commits] [PATCH] simplify OnlyCalledDirectly() In-Reply-To: References: <4A273FC6.4090907@mxc.ca> Message-ID: <4A2F43F4.2030700@mxc.ca> Jay Foad wrote: > 2009/6/4 Nick Lewycky : >> I'd rather it were a method on Function, I keep wanting to check this >> and forgetting the efficient method of doing it (most recently in >> CXAGuardElim). > > Like this? It passes "make check". Just like that. You may want to consider renaming it "hasAddressTaken" which I know is used elsewhere, but I don't have much of an opinion either way. You decide. And please commit it. Thanks! Nick From baldrick at free.fr Wed Jun 10 01:49:40 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 10 Jun 2009 08:49:40 +0200 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <521640720906091656v35bd4b6bt9b2b103b939ea628@mail.gmail.com> References: <521640720906091656v35bd4b6bt9b2b103b939ea628@mail.gmail.com> Message-ID: <4A2F5784.2020006@free.fr> > Just a few improvements to our Nightly scripts so that they: > > * Clean up before each build when not doing a purge of the old checkin. > * Add -disable-pic option for building (needs more testing) > * Add clang nightly checkin and testing support. > > Just my two cent, let me know what you think.. Looks good to me. Ciao, Duncan. From jay.foad at gmail.com Wed Jun 10 03:41:13 2009 From: jay.foad at gmail.com (Jay Foad) Date: Wed, 10 Jun 2009 08:41:13 -0000 Subject: [llvm-commits] [llvm] r73164 - in /llvm/trunk: include/llvm/Function.h lib/Transforms/IPO/ArgumentPromotion.cpp lib/Transforms/IPO/DeadArgumentElimination.cpp lib/Transforms/IPO/GlobalOpt.cpp lib/VMCore/Function.cpp Message-ID: <200906100841.n5A8fEFo021879@zion.cs.uiuc.edu> Author: foad Date: Wed Jun 10 03:41:11 2009 New Revision: 73164 URL: http://llvm.org/viewvc/llvm-project?rev=73164&view=rev Log: Implement and use new method Function::hasAddressTaken(). Modified: llvm/trunk/include/llvm/Function.h llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/VMCore/Function.cpp Modified: llvm/trunk/include/llvm/Function.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=73164&r1=73163&r2=73164&view=diff ============================================================================== --- llvm/trunk/include/llvm/Function.h (original) +++ llvm/trunk/include/llvm/Function.h Wed Jun 10 03:41:11 2009 @@ -395,6 +395,10 @@ /// including any contained basic blocks. /// void dropAllReferences(); + + /// hasAddressTaken - returns true if there are any uses of this function + /// other than direct calls or invokes to it. + bool hasAddressTaken() const; }; inline ValueSymbolTable * Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=73164&r1=73163&r2=73164&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Wed Jun 10 03:41:11 2009 @@ -127,17 +127,8 @@ // Second check: make sure that all callers are direct callers. We can't // transform functions that have indirect callers. - for (Value::use_iterator UI = F->use_begin(), E = F->use_end(); - UI != E; ++UI) { - CallSite CS = CallSite::get(*UI); - if (!CS.getInstruction()) // "Taking the address" of the function - return false; - - // Ensure that this call site is CALLING the function, not passing it as - // an argument. - if (!CS.isCallee(UI)) - return false; - } + if (F->hasAddressTaken()) + return false; // Check to see which arguments are promotable. If an argument is promotable, // add it to ArgsToPromote. Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=73164&r1=73163&r2=73164&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Wed Jun 10 03:41:11 2009 @@ -175,15 +175,8 @@ if (Fn.isDeclaration() || !Fn.hasLocalLinkage()) return false; // Ensure that the function is only directly called. - for (Value::use_iterator I = Fn.use_begin(), E = Fn.use_end(); I != E; ++I) { - // If this use is anything other than a call site, give up. - CallSite CS = CallSite::get(*I); - Instruction *TheCall = CS.getInstruction(); - if (!TheCall) return false; // Not a direct call site? - - // The addr of this function is passed to the call. - if (!CS.isCallee(I)) return false; - } + if (Fn.hasAddressTaken()) + return false; // Okay, we know we can transform this function if safe. Scan its body // looking for calls to llvm.vastart. Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=73164&r1=73163&r2=73164&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Wed Jun 10 03:41:11 2009 @@ -1769,22 +1769,6 @@ return false; } -/// OnlyCalledDirectly - Return true if the specified function is only called -/// directly. In other words, its address is never taken. -static bool OnlyCalledDirectly(Function *F) { - for (Value::use_iterator UI = F->use_begin(), E = F->use_end(); UI != E;++UI){ - Instruction *User = dyn_cast(*UI); - if (!User) return false; - if (!isa(User) && !isa(User)) return false; - - // See if the function address is passed as an argument. - for (User::op_iterator i = User->op_begin() + 1, e = User->op_end(); - i != e; ++i) - if (*i == F) return false; - } - return true; -} - /// ChangeCalleesToFastCall - Walk all of the direct calls of the specified /// function, changing them to FastCC. static void ChangeCalleesToFastCall(Function *F) { @@ -1830,7 +1814,7 @@ ++NumFnDeleted; } else if (F->hasLocalLinkage()) { if (F->getCallingConv() == CallingConv::C && !F->isVarArg() && - OnlyCalledDirectly(F)) { + !F->hasAddressTaken()) { // If this function has C calling conventions, is not a varargs // function, and is only called directly, promote it to use the Fast // calling convention. @@ -1841,7 +1825,7 @@ } if (F->getAttributes().hasAttrSomewhere(Attribute::Nest) && - OnlyCalledDirectly(F)) { + !F->hasAddressTaken()) { // The function is not used by a trampoline intrinsic, so it is safe // to remove the 'nest' attribute. RemoveNestAttribute(F); Modified: llvm/trunk/lib/VMCore/Function.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=73164&r1=73163&r2=73164&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Function.cpp (original) +++ llvm/trunk/lib/VMCore/Function.cpp Wed Jun 10 03:41:11 2009 @@ -364,4 +364,15 @@ #include "llvm/Intrinsics.gen" #undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN + /// hasAddressTaken - returns true if there are any uses of this function + /// other than direct calls or invokes to it. +bool Function::hasAddressTaken() const { + for (Value::use_const_iterator I = use_begin(), E = use_end(); I != E; ++I) { + if (I.getOperandNo() != 0 || + (!isa(*I) && !isa(*I))) + return true; + } + return false; +} + // vim: sw=2 ai From lattner at apple.com Wed Jun 10 11:54:49 2009 From: lattner at apple.com (Tanya Lattner) Date: Wed, 10 Jun 2009 09:54:49 -0700 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <521640720906091656v35bd4b6bt9b2b103b939ea628@mail.gmail.com> References: <521640720906091656v35bd4b6bt9b2b103b939ea628@mail.gmail.com> Message-ID: On Jun 9, 2009, at 4:56 PM, Edward O'Callaghan wrote: > Good day, > > Just a few improvements to our Nightly scripts so that they: > > * Clean up before each build when not doing a purge of the old > checkin. > * Add -disable-pic option for building (needs more testing) > * Add clang nightly checkin and testing support. > > Just my two cent, let me know what you think.. > > -bash-3.2$ diff -u NewNightlyTest.pl_old NewNightlyTest.pl > --- NewNightlyTest.pl_old Fri Jun 5 00:19:52 2009 > +++ NewNightlyTest.pl Fri Jun 5 13:52:52 2009 > -12,6 +12,7 @@ > # to llvm.org where it is placed into the > nightlytestresults database. > # > > # Modified heavily by Patrick Jenkins, July 2006 > +# Advanced by Edward O'Callaghan, Jun 2009 > # Please remove both lines here and add yourself to the CREDITS.txt. We no longer put credits in individual files (somehow this did not get removed during the switch). Thanks, Tanya > > # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] > # where > -26,10 +27,12 @@ > # -nodejagnu Do not run feature or regression tests > # -parallel Run parallel jobs with GNU Make (see -parallel- > jobs). > # -parallel-jobs The number of parallel Make jobs to use (default > is two). > +# -with-clang Checkout Clang source into tools/clang. > # -release Build an LLVM Release version > # -release-asserts Build an LLVM ReleaseAsserts version > # -enable-llcbeta Enable testing of beta features in llc. > # -enable-lli Enable testing of lli (interpreter) features, > default is off > +# -disable-pic Disable building with Position > Independent Code. > # -disable-llc Disable LLC tests in the nightly tester. > # -disable-jit Disable JIT tests in the nightly tester. > # -disable-cbe Disable C backend tests in the nightly tester. > -98,7 +101,7 @@ > ############################################################## > my $HOME = $ENV{'HOME'}; > my $SVNURL = $ENV{"SVNURL"}; > -$SVNURL = 'https://llvm.org/svn/llvm-project' unless $SVNURL; > +$SVNURL = 'http://llvm.org/svn/llvm-project' unless $SVNURL; > my $CVSRootDir = $ENV{'CVSROOT'}; > $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; > my $BuildDir = $ENV{'BUILDDIR'}; > -145,6 +148,7 @@ > if (/^-norunningtests$/) { next; } # Backward compatibility, > ignored. > if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; next;} > if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS > -l3.0"; next; } > + if (/^-with-clang$/) { $WITHCLANG = 1; next; } > if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS > ENABLE_OPTIMIZED=1 ". > "OPTIMIZE_OPTION=-O2"; > $BUILDTYPE="release"; next;} > if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS > ENABLE_OPTIMIZED=1 ". > -152,6 +156,7 @@ > "OPTIMIZE_OPTION=-O2"; > $BUILDTYPE="release-asserts"; next;} > if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; > next; } > + if (/^-disable-pic$/) { $CONFIGUREARGS .= " --enable-pic=no"; > next; } > if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; > $CONFIGUREARGS .= " --enable-lli"; > next; } > if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; > -534,13 +539,20 @@ > if (!$NOCHECKOUT) { > if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; } > if ($USESVN) { > - my $SVNCMD = "$NICE svn co $SVNURL"; > - if ($VERBOSE) { > - print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; > " . > + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL"; > + if ($VERBOSE) { > + print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/ > projects ; " . > + "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; > + } > + system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; > " . > "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; > - } > - system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . > - "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; > + if ($WITHCLANG) { > + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL/cfe/ > trunk"; > + if ($VERBOSE) { > + print "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog > 2>&1\n"; > + } > + system "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog > 2>&1\n"; > + } > } else { > my $CVSOPT = ""; > $CVSOPT = "-z3" # Use compression if going over ssh. > -611,7 +623,7 @@ > if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } > > if ($USESVN) { > - @SVNHistory = split / r{$DATE}:HEAD`; > + @SVNHistory = split / --verbose -r{$DATE}:HEAD`; > # Skip very first entry because it is the XML header cruft > shift @SVNHistory; > my $Now = time(); > -717,9 +729,11 @@ > "> $BuildLog 2>&1"; > if ( $VERBOSE ) { > print "BUILD STAGE:\n"; > + print "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1\n"; > print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; > } > # Build the entire tree, capturing the output into $BuildLog > + system "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1"; > system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; > } > > Cheers, > Edward. > > -- > -- > Edward O'Callaghan > http://www.auroraux.org/ > eocallaghan at auroraux dot org > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090610/727f126f/attachment.html From eocallaghan at auroraux.org Wed Jun 10 13:30:16 2009 From: eocallaghan at auroraux.org (Edward O'Callaghan) Date: Wed, 10 Jun 2009 19:30:16 +0100 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: References: <521640720906091656v35bd4b6bt9b2b103b939ea628@mail.gmail.com> Message-ID: <521640720906101130t5599eef7lf275ff32d4db9256@mail.gmail.com> Hi Tanya, Hope this is correct; $ diff -u CREDITS.TXT ../CREDITS.TXT --- CREDITS.TXT Wed Jun 10 19:15:08 2009 +++ ../CREDITS.TXT Wed Jun 10 19:22:26 2009 @@ -8,6 +8,12 @@ (W), PGP key ID and fingerprint (P), description (D), and snail-mail address (S). +N: Edward O'Callaghan +E: eocallaghan at auroraux.org +W: http://www.auroraux.org +D: Add Clang support with various other improvements to utils/NewNightlyTest.pl +D: Fix and maintain Solaris & AuroraUX support for llvm, various build warnings & error clean ups. + N: Vikram Adve E: vadve at cs.uiuc.edu W: http://www.cs.uiuc.edu/~vadve/ --- and --- $ diff -u NewNightlyTest.pl_old NewNightlyTest.pl --- NewNightlyTest.pl_old Fri Jun 5 00:19:52 2009 +++ NewNightlyTest.pl Wed Jun 10 19:25:29 2009 @@ -11,8 +11,6 @@ # regressions and performance changes. Submits this information # to llvm.org where it is placed into the nightlytestresults database. # -# Modified heavily by Patrick Jenkins, July 2006 -# # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] # where # OPTIONS may include one or more of the following: @@ -26,10 +24,12 @@ # -nodejagnu Do not run feature or regression tests # -parallel Run parallel jobs with GNU Make (see -parallel-jobs). # -parallel-jobs The number of parallel Make jobs to use (default is two). +# -with-clang Checkout Clang source into tools/clang. # -release Build an LLVM Release version # -release-asserts Build an LLVM ReleaseAsserts version # -enable-llcbeta Enable testing of beta features in llc. # -enable-lli Enable testing of lli (interpreter) features, default is off +# -disable-pic Disable building with Position Independent Code. # -disable-llc Disable LLC tests in the nightly tester. # -disable-jit Disable JIT tests in the nightly tester. # -disable-cbe Disable C backend tests in the nightly tester. @@ -98,7 +98,7 @@ ############################################################## my $HOME = $ENV{'HOME'}; my $SVNURL = $ENV{"SVNURL"}; -$SVNURL = 'https://llvm.org/svn/llvm-project' unless $SVNURL; +$SVNURL = 'http://llvm.org/svn/llvm-project' unless $SVNURL; my $CVSRootDir = $ENV{'CVSROOT'}; $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; my $BuildDir = $ENV{'BUILDDIR'}; @@ -145,6 +145,7 @@ if (/^-norunningtests$/) { next; } # Backward compatibility, ignored. if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; next;} if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS -l3.0"; next; } + if (/^-with-clang$/) { $WITHCLANG = 1; next; } if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;} if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". @@ -152,6 +153,7 @@ "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release-asserts"; next;} if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } + if (/^-disable-pic$/) { $CONFIGUREARGS .= " --enable-pic=no"; next; } if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; $CONFIGUREARGS .= " --enable-lli"; next; } if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; @@ -534,13 +536,20 @@ if (!$NOCHECKOUT) { if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; } if ($USESVN) { - my $SVNCMD = "$NICE svn co $SVNURL"; - if ($VERBOSE) { - print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL"; + if ($VERBOSE) { + print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . + "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; + } + system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; - } - system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . - "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; + if ($WITHCLANG) { + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL/cfe/trunk"; + if ($VERBOSE) { + print "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog 2>&1\n"; + } + system "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog 2>&1\n"; + } } else { my $CVSOPT = ""; $CVSOPT = "-z3" # Use compression if going over ssh. @@ -611,7 +620,7 @@ if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } if ($USESVN) { - @SVNHistory = split / $BuildLog 2>&1"; if ( $VERBOSE ) { print "BUILD STAGE:\n"; + print "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1\n"; print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; } # Build the entire tree, capturing the output into $BuildLog + system "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1"; system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; } -- Patrick Jenkins already seems to have a credit in that file. In regards to AuroraUX/Solaris fixes I been in touch with Duncan and the IRC for them put backs which have normally been a single line or so. Cheers, Edward O'Callaghan. 2009/6/10 Tanya Lattner : > > On Jun 9, 2009, at 4:56 PM, Edward O'Callaghan wrote: > > Good day, > > Just a few improvements to our Nightly scripts so that they: > > * Clean up before each build when not doing a purge of the old checkin. > * Add -disable-pic option for building (needs more testing) > * Add clang nightly checkin and testing support. > > Just my two cent, let me know what you think.. > > -bash-3.2$ diff -u NewNightlyTest.pl_old NewNightlyTest.pl > --- NewNightlyTest.pl_old ??????Fri Jun ?5 00:19:52 2009 > +++ NewNightlyTest.pl ??Fri Jun ?5 13:52:52 2009 > -12,6 +12,7 @@ > # ??????????to llvm.org where it is placed into the > nightlytestresults database. > # > > # Modified heavily by Patrick Jenkins, July 2006 > +# Advanced by Edward O'Callaghan, Jun 2009 > # > > Please remove both lines here and add yourself to the CREDITS.txt. We no > longer put credits in individual files (somehow this did not get removed > during the switch). > Thanks, > Tanya > > > # Syntax: ??NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] > # ??where > -26,10 +27,12 @@ > # ?-nodejagnu ??????Do not run feature or regression tests > # ?-parallel ???????Run parallel jobs with GNU Make (see -parallel-jobs). > # ?-parallel-jobs ??The number of parallel Make jobs to use (default is > two). > +# ?-with-clang ?????Checkout Clang source into tools/clang. > # ?-release ????????Build an LLVM Release version > # ?-release-asserts Build an LLVM ReleaseAsserts version > # ?-enable-llcbeta ?Enable testing of beta features in llc. > # ?-enable-lli ?????Enable testing of lli (interpreter) features, > default is off > +# ?-disable-pic ???????????Disable building with Position Independent Code. > # ?-disable-llc ????Disable LLC tests in the nightly tester. > # ?-disable-jit ????Disable JIT tests in the nightly tester. > # ?-disable-cbe ????Disable C backend tests in the nightly tester. > -98,7 +101,7 @@ > ############################################################## > my $HOME ??????= $ENV{'HOME'}; > my $SVNURL ????= $ENV{"SVNURL"}; > -$SVNURL ???????= 'https://llvm.org/svn/llvm-project' unless $SVNURL; > +$SVNURL ???????= 'http://llvm.org/svn/llvm-project' unless $SVNURL; > my $CVSRootDir = $ENV{'CVSROOT'}; > $CVSRootDir ???= "/home/vadve/shared/PublicCVS" unless $CVSRootDir; > my $BuildDir ??= $ENV{'BUILDDIR'}; > -145,6 +148,7 @@ > ??if (/^-norunningtests$/) { next; } # Backward compatibility, ignored. > ??if (/^-parallel-jobs$/) ?{ $PARALLELJOBS = "$ARGV[0]"; shift; next;} > ??if (/^-parallel$/) ??????{ $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS > -l3.0"; next; } > + ?if (/^-with-clang$/) ????{ $WITHCLANG = 1; next; } > ??if (/^-release$/) ???????{ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". > ?????????????????????????????"OPTIMIZE_OPTION=-O2"; > $BUILDTYPE="release"; next;} > ??if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". > -152,6 +156,7 @@ > ?????????????????????????????"OPTIMIZE_OPTION=-O2"; > ?????????????????????????????$BUILDTYPE="release-asserts"; next;} > ??if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } > + ?if (/^-disable-pic$/) ???{ $CONFIGUREARGS .= " --enable-pic=no"; next; } > ??if (/^-enable-lli$/) ????{ $PROGTESTOPTS .= " ENABLE_LLI=1"; > ?????????????????????????????$CONFIGUREARGS .= " --enable-lli"; next; } > ??if (/^-disable-llc$/) ???{ $PROGTESTOPTS .= " DISABLE_LLC=1"; > -534,13 +539,20 @@ > if (!$NOCHECKOUT) { > ??if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; } > ??if ($USESVN) { > - ???my $SVNCMD = "$NICE svn co $SVNURL"; > - ???if ($VERBOSE) { > - ?????print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . > + ?????my $SVNCMD = "$NICE svn co --non-interactive $SVNURL"; > + ?????if ($VERBOSE) { > + ???????print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . > + ?????????????"$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; > + ?????} > + ?????system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . > ????????????"$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; > - ???} > - ???system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . > - ?????????"$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; > + ??????if ($WITHCLANG) { > + ????????my $SVNCMD = "$NICE svn co --non-interactive $SVNURL/cfe/trunk"; > + ????????if ($VERBOSE) { > + ?????????print "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog > 2>&1\n"; > + ??????} > + ??????system "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog 2>&1\n"; > + ??????} > ??} else { > ????my $CVSOPT = ""; > ????$CVSOPT = "-z3" # Use compression if going over ssh. > -611,7 +623,7 @@ > ??if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } > > ??if ($USESVN) { > - ???@SVNHistory = split / -r{$DATE}:HEAD`; > + ???@SVNHistory = split / --verbose -r{$DATE}:HEAD`; > ????# Skip very first entry because it is the XML header cruft > ????shift @SVNHistory; > ????my $Now = time(); > -717,9 +729,11 @@ > ?????????"> $BuildLog 2>&1"; > ??if ( $VERBOSE ) { > ????print "BUILD STAGE:\n"; > + ???print "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1\n"; > ????print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; > ??} > ??# Build the entire tree, capturing the output into $BuildLog > + ?system "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1"; > ??system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; > } > > Cheers, > Edward. > > -- > -- > Edward O'Callaghan > http://www.auroraux.org/ > eocallaghan at auroraux dot org > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > -- -- Edward O'Callaghan http://www.auroraux.org/ eocallaghan at auroraux dot org From lattner at apple.com Wed Jun 10 13:33:44 2009 From: lattner at apple.com (Tanya Lattner) Date: Wed, 10 Jun 2009 11:33:44 -0700 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <521640720906101130t5599eef7lf275ff32d4db9256@mail.gmail.com> References: <521640720906091656v35bd4b6bt9b2b103b939ea628@mail.gmail.com> <521640720906101130t5599eef7lf275ff32d4db9256@mail.gmail.com> Message-ID: <6DB3658D-A586-46FB-B46C-91F79A75C176@apple.com> Looks great. Thanks! -Tanya On Jun 10, 2009, at 11:30 AM, Edward O'Callaghan wrote: > Hi Tanya, > > Hope this is correct; > > $ diff -u CREDITS.TXT ../CREDITS.TXT > --- CREDITS.TXT Wed Jun 10 19:15:08 2009 > +++ ../CREDITS.TXT Wed Jun 10 19:22:26 2009 > @@ -8,6 +8,12 @@ > (W), PGP key ID and fingerprint (P), description (D), and snail-mail > address > (S). > > +N: Edward O'Callaghan > +E: eocallaghan at auroraux.org > +W: http://www.auroraux.org > +D: Add Clang support with various other improvements to utils/ > NewNightlyTest.pl > +D: Fix and maintain Solaris & AuroraUX support for llvm, various > build warnings & error clean ups. > + > N: Vikram Adve > E: vadve at cs.uiuc.edu > W: http://www.cs.uiuc.edu/~vadve/ > > --- > and > --- > > $ diff -u NewNightlyTest.pl_old NewNightlyTest.pl > --- NewNightlyTest.pl_old Fri Jun 5 00:19:52 2009 > +++ NewNightlyTest.pl Wed Jun 10 19:25:29 2009 > @@ -11,8 +11,6 @@ > # regressions and performance changes. Submits this > information > # to llvm.org where it is placed into the > nightlytestresults database. > # > -# Modified heavily by Patrick Jenkins, July 2006 > -# > # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] > # where > # OPTIONS may include one or more of the following: > @@ -26,10 +24,12 @@ > # -nodejagnu Do not run feature or regression tests > # -parallel Run parallel jobs with GNU Make (see -parallel- > jobs). > # -parallel-jobs The number of parallel Make jobs to use (default > is two). > +# -with-clang Checkout Clang source into tools/clang. > # -release Build an LLVM Release version > # -release-asserts Build an LLVM ReleaseAsserts version > # -enable-llcbeta Enable testing of beta features in llc. > # -enable-lli Enable testing of lli (interpreter) features, > default is off > +# -disable-pic Disable building with Position > Independent Code. > # -disable-llc Disable LLC tests in the nightly tester. > # -disable-jit Disable JIT tests in the nightly tester. > # -disable-cbe Disable C backend tests in the nightly tester. > @@ -98,7 +98,7 @@ > ############################################################## > my $HOME = $ENV{'HOME'}; > my $SVNURL = $ENV{"SVNURL"}; > -$SVNURL = 'https://llvm.org/svn/llvm-project' unless $SVNURL; > +$SVNURL = 'http://llvm.org/svn/llvm-project' unless $SVNURL; > my $CVSRootDir = $ENV{'CVSROOT'}; > $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; > my $BuildDir = $ENV{'BUILDDIR'}; > @@ -145,6 +145,7 @@ > if (/^-norunningtests$/) { next; } # Backward compatibility, > ignored. > if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; next;} > if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS > -l3.0"; next; } > + if (/^-with-clang$/) { $WITHCLANG = 1; next; } > if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS > ENABLE_OPTIMIZED=1 ". > "OPTIMIZE_OPTION=-O2"; > $BUILDTYPE="release"; next;} > if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS > ENABLE_OPTIMIZED=1 ". > @@ -152,6 +153,7 @@ > "OPTIMIZE_OPTION=-O2"; > $BUILDTYPE="release-asserts"; next;} > if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; > next; } > + if (/^-disable-pic$/) { $CONFIGUREARGS .= " --enable-pic=no"; > next; } > if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; > $CONFIGUREARGS .= " --enable-lli"; > next; } > if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; > @@ -534,13 +536,20 @@ > if (!$NOCHECKOUT) { > if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; } > if ($USESVN) { > - my $SVNCMD = "$NICE svn co $SVNURL"; > - if ($VERBOSE) { > - print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; > " . > + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL"; > + if ($VERBOSE) { > + print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/ > projects ; " . > + "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; > + } > + system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; > " . > "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; > - } > - system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . > - "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; > + if ($WITHCLANG) { > + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL/cfe/ > trunk"; > + if ($VERBOSE) { > + print "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog > 2>&1\n"; > + } > + system "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog > 2>&1\n"; > + } > } else { > my $CVSOPT = ""; > $CVSOPT = "-z3" # Use compression if going over ssh. > @@ -611,7 +620,7 @@ > if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } > > if ($USESVN) { > - @SVNHistory = split / r{$DATE}:HEAD`; > + @SVNHistory = split / --verbose -r{$DATE}:HEAD`; > # Skip very first entry because it is the XML header cruft > shift @SVNHistory; > my $Now = time(); > @@ -717,9 +726,11 @@ > "> $BuildLog 2>&1"; > if ( $VERBOSE ) { > print "BUILD STAGE:\n"; > + print "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1\n"; > print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; > } > # Build the entire tree, capturing the output into $BuildLog > + system "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1"; > system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; > } > > -- > Patrick Jenkins already seems to have a credit in that file. > In regards to AuroraUX/Solaris fixes I been in touch with Duncan and > the IRC for them put backs which have normally been a single line or > so. > > Cheers, > Edward O'Callaghan. > > 2009/6/10 Tanya Lattner : >> >> On Jun 9, 2009, at 4:56 PM, Edward O'Callaghan wrote: >> >> Good day, >> >> Just a few improvements to our Nightly scripts so that they: >> >> * Clean up before each build when not doing a purge of the old >> checkin. >> * Add -disable-pic option for building (needs more testing) >> * Add clang nightly checkin and testing support. >> >> Just my two cent, let me know what you think.. >> >> -bash-3.2$ diff -u NewNightlyTest.pl_old NewNightlyTest.pl >> --- NewNightlyTest.pl_old Fri Jun 5 00:19:52 2009 >> +++ NewNightlyTest.pl Fri Jun 5 13:52:52 2009 >> -12,6 +12,7 @@ >> # to llvm.org where it is placed into the >> nightlytestresults database. >> # >> >> # Modified heavily by Patrick Jenkins, July 2006 >> +# Advanced by Edward O'Callaghan, Jun 2009 >> # >> >> Please remove both lines here and add yourself to the CREDITS.txt. >> We no >> longer put credits in individual files (somehow this did not get >> removed >> during the switch). >> Thanks, >> Tanya >> >> >> # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] >> # where >> -26,10 +27,12 @@ >> # -nodejagnu Do not run feature or regression tests >> # -parallel Run parallel jobs with GNU Make (see -parallel- >> jobs). >> # -parallel-jobs The number of parallel Make jobs to use >> (default is >> two). >> +# -with-clang Checkout Clang source into tools/clang. >> # -release Build an LLVM Release version >> # -release-asserts Build an LLVM ReleaseAsserts version >> # -enable-llcbeta Enable testing of beta features in llc. >> # -enable-lli Enable testing of lli (interpreter) features, >> default is off >> +# -disable-pic Disable building with Position >> Independent Code. >> # -disable-llc Disable LLC tests in the nightly tester. >> # -disable-jit Disable JIT tests in the nightly tester. >> # -disable-cbe Disable C backend tests in the nightly tester. >> -98,7 +101,7 @@ >> ############################################################## >> my $HOME = $ENV{'HOME'}; >> my $SVNURL = $ENV{"SVNURL"}; >> -$SVNURL = 'https://llvm.org/svn/llvm-project' unless $SVNURL; >> +$SVNURL = 'http://llvm.org/svn/llvm-project' unless $SVNURL; >> my $CVSRootDir = $ENV{'CVSROOT'}; >> $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; >> my $BuildDir = $ENV{'BUILDDIR'}; >> -145,6 +148,7 @@ >> if (/^-norunningtests$/) { next; } # Backward compatibility, >> ignored. >> if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; >> next;} >> if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS >> -l3.0"; next; } >> + if (/^-with-clang$/) { $WITHCLANG = 1; next; } >> if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS >> ENABLE_OPTIMIZED=1 ". >> "OPTIMIZE_OPTION=-O2"; >> $BUILDTYPE="release"; next;} >> if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS >> ENABLE_OPTIMIZED=1 ". >> -152,6 +156,7 @@ >> "OPTIMIZE_OPTION=-O2"; >> $BUILDTYPE="release-asserts"; next;} >> if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; >> next; } >> + if (/^-disable-pic$/) { $CONFIGUREARGS .= " --enable-pic=no"; >> next; } >> if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; >> $CONFIGUREARGS .= " --enable-lli"; >> next; } >> if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; >> -534,13 +539,20 @@ >> if (!$NOCHECKOUT) { >> if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; } >> if ($USESVN) { >> - my $SVNCMD = "$NICE svn co $SVNURL"; >> - if ($VERBOSE) { >> - print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; >> " . >> + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL"; >> + if ($VERBOSE) { >> + print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/ >> projects ; " . >> + "$SVNCMD/test-suite/trunk llvm-test ) > $COLog >> 2>&1\n"; >> + } >> + system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/ >> projects ; " . >> "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; >> - } >> - system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; >> " . >> - "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; >> + if ($WITHCLANG) { >> + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL/cfe/ >> trunk"; >> + if ($VERBOSE) { >> + print "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog >> 2>&1\n"; >> + } >> + system "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog >> 2>&1\n"; >> + } >> } else { >> my $CVSOPT = ""; >> $CVSOPT = "-z3" # Use compression if going over ssh. >> -611,7 +623,7 @@ >> if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } >> >> if ($USESVN) { >> - @SVNHistory = split /> -r{$DATE}:HEAD`; >> + @SVNHistory = split /> xml >> --verbose -r{$DATE}:HEAD`; >> # Skip very first entry because it is the XML header cruft >> shift @SVNHistory; >> my $Now = time(); >> -717,9 +729,11 @@ >> "> $BuildLog 2>&1"; >> if ( $VERBOSE ) { >> print "BUILD STAGE:\n"; >> + print "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1\n"; >> print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; >> } >> # Build the entire tree, capturing the output into $BuildLog >> + system "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1"; >> system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; >> } >> >> Cheers, >> Edward. >> >> -- >> -- >> Edward O'Callaghan >> http://www.auroraux.org/ >> eocallaghan at auroraux dot org >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> > > > > -- > -- > Edward O'Callaghan > http://www.auroraux.org/ > eocallaghan at auroraux dot org > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090610/3df3ffab/attachment.html From baldrick at free.fr Wed Jun 10 14:02:32 2009 From: baldrick at free.fr (Duncan Sands) Date: Wed, 10 Jun 2009 21:02:32 +0200 Subject: [llvm-commits] [PATCH] KNRPromotion fix when FLOAT_TYPE_SIZE is not smaller than DOUBLE_TYPE_SIZE In-Reply-To: <4A2E5BE5.1050704@tut.fi> References: <4A2E5BE5.1050704@tut.fi> Message-ID: <4A300348.7030209@free.fr> Hi Mikael, > I found out that > > void function(value) > float value; {} > > generated following bitcode > > define void @function(double %value1) > > In IRC channel this was though to be correct for platforms where > DOUBLE_TYPE_SIZE is bigger than float size e.g. x86. However in our > tce-llvm-gcc cross-compiler DOUBLE_TYPE_SIZE is set to be 32 bits as > FLOAT_TYPE_SIZE. So in this case correct bitcode should have been > > define void @function(float %value1) > > So here's patch attached for fixing the problem. I think something like this would be better: if (type == float_type_node) LLVMTy = ConvertType(double_type_node); That's because float_type_node and double_type_node correspond to the C float/double types, while LLVM's FloatTy and DoubleTy need not: they correspond to a particular size. You might need to look at the main type variant though. Ciao, Duncan. From aaronngray.lists at googlemail.com Wed Jun 10 17:36:32 2009 From: aaronngray.lists at googlemail.com (Aaron Gray) Date: Wed, 10 Jun 2009 23:36:32 +0100 Subject: [llvm-commits] Changing MCE and JCE to modern '_t' style types Message-ID: Here's a patch for the MachineCodeEmitter and JITCodeEmitter classes, changing older types to '_t' types. I have used [u]int64_t types for emitULEB128Bytes() and emitSLEB128Bytes() methods used for DWARF style EH in JIT. We could use a [u]int128_t instead if we defined them properly in include/llvm/Support/DataTypes.h.in, but 64 bits should be large enough for the forseeable future :) The patch has been tested with 'make check' on Linux. Aaron -------------- next part -------------- A non-text attachment was scrubbed... Name: MCE_JCE_t.patch Type: application/octet-stream Size: 3396 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090610/9fdd91a9/attachment.obj From ofv at wanadoo.es Wed Jun 10 17:53:59 2009 From: ofv at wanadoo.es (Oscar Fuentes) Date: Wed, 10 Jun 2009 22:53:59 -0000 Subject: [llvm-commits] [llvm] r73174 - /llvm/trunk/lib/CodeGen/CMakeLists.txt Message-ID: <200906102253.n5AMrxHg017611@zion.cs.uiuc.edu> Author: ofv Date: Wed Jun 10 17:53:59 2009 New Revision: 73174 URL: http://llvm.org/viewvc/llvm-project?rev=73174&view=rev Log: CMake: Updated list of files on lib/CodeGen/CMakeLists.txt. Modified: llvm/trunk/lib/CodeGen/CMakeLists.txt Modified: llvm/trunk/lib/CodeGen/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CMakeLists.txt?rev=73174&r1=73173&r2=73174&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CMakeLists.txt (original) +++ llvm/trunk/lib/CodeGen/CMakeLists.txt Wed Jun 10 17:53:59 2009 @@ -12,6 +12,7 @@ IntrinsicLowering.cpp LLVMTargetMachine.cpp LatencyPriorityQueue.cpp + LazyLiveness.cpp LiveInterval.cpp LiveIntervalAnalysis.cpp LiveStackAnalysis.cpp From eocallaghan at auroraux.org Wed Jun 10 19:23:21 2009 From: eocallaghan at auroraux.org (Edward O'Callaghan) Date: Thu, 11 Jun 2009 01:23:21 +0100 Subject: [llvm-commits] [PATCH] utils/GenLibDeps.pl Message-ID: <521640720906101723l65dbd483wd08815f497ea5483@mail.gmail.com> Hi, Another small one from me. * This patch is intended to provide support for exporting a "NM" environment variable for a new `nm` PATH for whatever reason, such as I needed to export a GNU version while on Solaris until I did the second part of this patch which I need a second view on just in case. * Fix the SUS usage of `nm` on Unix platforms such as Solaris or AuroraUX; -u is undefined symbols, and says "those external to each object file" so using -g would seem redundant, The error message was as follows: "/usr/xpg4/bin/nm: -e or -g set, -u ignored". $ diff -u utils/GenLibDeps.pl ../GenLibDeps.pl --- utils/GenLibDeps.pl Wed Jun 10 19:15:17 2009 +++ ../GenLibDeps.pl Thu Jun 11 01:14:59 2009 @@ -38,6 +38,10 @@ die "Can't find 'dot'" if (! -x "$DotPath"); } +if (defined($ENV{NM})) { + chomp($nmPath=$ENV{NM}); +} + if (!defined($nmPath) || $nmPath eq "") { chomp($nmPath=`which nm`); die "Can't find 'nm'" if (! -x "$nmPath"); @@ -96,7 +100,7 @@ print "
    $lib
      \n"; } open UNDEFS, - "$nmPath -g -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort | uniq |"; + "$nmPath -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort | uniq |"; my %DepLibs; while () { chomp; @@ -116,7 +120,7 @@ close UNDEFS or die "nm failed"; unless(keys %DepLibs) { # above failed - open UNDEFS, "$nmPath -g -u $Directory/$lib |"; + open UNDEFS, "$nmPath -u $Directory/$lib |"; while () { # to bypass non-working sed if (' ' eq substr($_,0,2) and index($_,'U ')) { Cheers, Edward. -- -- Edward O'Callaghan http://www.auroraux.org/ eocallaghan at auroraux dot org From ofv at wanadoo.es Wed Jun 10 23:16:11 2009 From: ofv at wanadoo.es (Oscar Fuentes) Date: Thu, 11 Jun 2009 04:16:11 -0000 Subject: [llvm-commits] [llvm] r73180 - in /llvm/trunk: CMakeLists.txt cmake/modules/CrossCompileLLVM.cmake cmake/modules/TableGen.cmake Message-ID: <200906110416.n5B4GB3t027446@zion.cs.uiuc.edu> Author: ofv Date: Wed Jun 10 23:16:10 2009 New Revision: 73180 URL: http://llvm.org/viewvc/llvm-project?rev=73180&view=rev Log: CMake: Fixed parallel build problem related to native tblgen when cross-compiling. Modified: llvm/trunk/CMakeLists.txt llvm/trunk/cmake/modules/CrossCompileLLVM.cmake llvm/trunk/cmake/modules/TableGen.cmake Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=73180&r1=73179&r2=73180&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Wed Jun 10 23:16:10 2009 @@ -222,6 +222,8 @@ set(LLVM_TABLEGEN "tblgen" CACHE STRING "Native TableGen executable. Saves building one when cross-compiling.") +# Effective tblgen executable to be used: +set(LLVM_TABLEGEN_EXE ${LLVM_TABLEGEN}) add_subdirectory(utils/TableGen) Modified: llvm/trunk/cmake/modules/CrossCompileLLVM.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CrossCompileLLVM.cmake?rev=73180&r1=73179&r2=73180&view=diff ============================================================================== --- llvm/trunk/cmake/modules/CrossCompileLLVM.cmake (original) +++ llvm/trunk/cmake/modules/CrossCompileLLVM.cmake Wed Jun 10 23:16:10 2009 @@ -1,7 +1,7 @@ if( ${LLVM_TABLEGEN} STREQUAL "tblgen" ) set(CX_NATIVE_TG_DIR "${CMAKE_BINARY_DIR}/native") - set(LLVM_TABLEGEN "${CX_NATIVE_TG_DIR}/bin/tblgen") + set(LLVM_TABLEGEN_EXE "${CX_NATIVE_TG_DIR}/bin/tblgen") add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR} COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR} @@ -13,12 +13,12 @@ DEPENDS ${CX_NATIVE_TG_DIR} COMMENT "Configuring native TableGen...") - add_custom_command(OUTPUT ${LLVM_TABLEGEN} + add_custom_command(OUTPUT ${LLVM_TABLEGEN_EXE} COMMAND ${CMAKE_BUILD_TOOL} DEPENDS ${CX_NATIVE_TG_DIR}/CMakeCache.txt WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}/utils/TableGen COMMENT "Building native TableGen...") - add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN}) + add_custom_target(NativeTableGen DEPENDS ${LLVM_TABLEGEN_EXE}) add_dependencies(tblgen NativeTableGen) Modified: llvm/trunk/cmake/modules/TableGen.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=73180&r1=73179&r2=73180&view=diff ============================================================================== --- llvm/trunk/cmake/modules/TableGen.cmake (original) +++ llvm/trunk/cmake/modules/TableGen.cmake Wed Jun 10 23:16:10 2009 @@ -6,11 +6,11 @@ file(GLOB all_tds "*.td") add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp - COMMAND ${LLVM_TABLEGEN} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${LLVM_TABLEGEN_EXE} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${LLVM_MAIN_SRC_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS} -o ${CMAKE_CURRENT_BINARY_DIR}/${ofn}.tmp - DEPENDS ${LLVM_TABLEGEN} ${all_tds} + DEPENDS tblgen ${all_tds} COMMENT "Building ${ofn}.tmp..." ) add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn} From evan.cheng at apple.com Wed Jun 10 23:43:22 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 10 Jun 2009 21:43:22 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegisterInfo.td lib/Target/ARM/ARMSubtarget.cpp lib/Target/TargetMachine.cpp lib/Target/X86/X86Subtarget.cpp In-Reply-To: <200906082253.n58Mrvgx002792@zion.cs.uiuc.edu> References: <200906082253.n58Mrvgx002792@zion.cs.uiuc.edu> Message-ID: On Jun 8, 2009, at 3:53 PM, Anton Korobeynikov wrote: > Author: asl > Date: Mon Jun 8 17:53:56 2009 > New Revision: 73095 > > URL: http://llvm.org/viewvc/llvm-project?rev=73095&view=rev > Log: > The attached patches implement most of the ARM AAPCS-VFP hard float > ABI. The missing piece is support for putting "homogeneous aggregates" > into registers. > > Patch by Sandeep Patel! > > Modified: > llvm/trunk/include/llvm/Target/TargetMachine.h > llvm/trunk/include/llvm/Target/TargetOptions.h > llvm/trunk/lib/Target/ARM/ARMCallingConv.td > llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp > llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp > llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td > llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp > llvm/trunk/lib/Target/TargetMachine.cpp > llvm/trunk/lib/Target/X86/X86Subtarget.cpp > > Modified: llvm/trunk/include/llvm/Target/TargetMachine.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=73095&r1=73094&r2=73095&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Target/TargetMachine.h (original) > +++ llvm/trunk/include/llvm/Target/TargetMachine.h Mon Jun 8 > 17:53:56 2009 > @@ -78,6 +78,14 @@ > }; > } > > > +namespace FloatABI { > + enum ABIType { > + Default, > + Soft, > + Hard > + }; > +} Some comments? > > + > // > = > = > = > ----------------------------------------------------------------------= > ==// > /// > /// TargetMachine - Primary interface to the complete machine > description for > @@ -88,7 +96,7 @@ > TargetMachine(const TargetMachine &); // DO NOT IMPLEMENT > void operator=(const TargetMachine &); // DO NOT IMPLEMENT > protected: // Can only create subclasses. > - TargetMachine() : AsmInfo(0) { } > + TargetMachine(); > > /// getSubtargetImpl - virtual method implemented by subclasses > that returns > /// a reference to that target's TargetSubtarget-derived member > variable. > > Modified: llvm/trunk/include/llvm/Target/TargetOptions.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=73095&r1=73094&r2=73095&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Target/TargetOptions.h (original) > +++ llvm/trunk/include/llvm/Target/TargetOptions.h Mon Jun 8 > 17:53:56 2009 > @@ -73,6 +73,14 @@ > /// target FP instructions. > extern bool UseSoftFloat; > > + /// FloatABIType - This setting is set by -float-abi=xxx option > is specfied > + /// on the command line. This setting may either be Default, > Soft, or Hard. > + /// Default selects the target's default behavior. Soft selects > the ABI for > + /// UseSoftFloat, but does not inidcate that FP hardware may not > be used. > + /// Such a combination is unfortunately popular (e.g. arm-apple- > darwin). > + /// Hard presumes that the normal FP ABI is used. > + extern FloatABI::ABIType FloatABIType; Can we add a module note for this? Evan > > + > /// NoZerosInBSS - By default some codegens place zero-initialized > data to > /// .bss section. This flag disables such behaviour (necessary, > e.g. for > /// crt*.o compiling). > > Modified: llvm/trunk/lib/Target/ARM/ARMCallingConv.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCallingConv.td?rev=73095&r1=73094&r2=73095&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMCallingConv.td (original) > +++ llvm/trunk/lib/Target/ARM/ARMCallingConv.td Mon Jun 8 17:53:56 > 2009 > @@ -17,6 +17,11 @@ > class CCIfAlign: > CCIf; > > +/// CCIfFloatABI - Match of the float ABI and the arg. ABIType may > be "Hard" or > +/// "Soft". > +class CCIfFloatABI: > + CCIf ABIType), A>; > + > // > = > = > = > ----------------------------------------------------------------------= > ==// > // ARM APCS Calling Convention > // > = > = > = > ----------------------------------------------------------------------= > ==// > @@ -43,9 +48,10 @@ > ]>; > > // > = > = > = > ----------------------------------------------------------------------= > ==// > -// ARM AAPCS (EABI) Calling Convention > +// ARM AAPCS (EABI) Calling Convention, common parts > // > = > = > = > ----------------------------------------------------------------------= > ==// > -def CC_ARM_AAPCS : CallingConv<[ > + > +def CC_ARM_AAPCS_Common : CallingConv<[ > > CCIfType<[i8, i16], CCPromoteToType>, > > @@ -53,23 +59,51 @@ > // i64 is 8-aligned i32 here, so we may need to eat R1 as a pad > register > // (and the same is true for f64 if VFP is not enabled) > CCIfType<[i32], CCIfAlign<"8", CCAssignToRegWithShadow<[R0, R2], > [R0, R1]>>>, > - CCIfType<[f64], CCCustom<"CC_ARM_AAPCS_Custom_f64">>, > - > - CCIfType<[f32], CCBitConvertToType>, > CCIfType<[i32], CCIf<"State.getNextStackOffset() == 0 &&" > "ArgFlags.getOrigAlign() != 8", > CCAssignToReg<[R0, R1, R2, R3]>>>, > > - CCIfType<[i32], CCAssignToStack<4, 4>>, > + CCIfType<[i32, f32], CCAssignToStack<4, 4>>, > CCIfType<[f64], CCAssignToStack<8, 8>> > ]>; > > -def RetCC_ARM_AAPCS : CallingConv<[ > +def RetCC_ARM_AAPCS_Common : CallingConv<[ > + CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>> > + CCIfType<[i64], CCAssignToRegWithShadow<[R0, R2], [R1, R3]>> > +]>; > + > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// ARM AAPCS (EABI) Calling Convention > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +def CC_ARM_AAPCS : CallingConv<[ > + CCIfType<[f64], CCCustom<"CC_ARM_AAPCS_Custom_f64">>, > CCIfType<[f32], CCBitConvertToType>, > + CCDelegateTo > +]>; > + > +def RetCC_ARM_AAPCS : CallingConv<[ > CCIfType<[f64], CCCustom<"RetCC_ARM_AAPCS_Custom_f64">>, > + CCIfType<[f32], CCBitConvertToType>, > + CCDelegateTo > +]>; > > - CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>>, > - CCIfType<[i64], CCAssignToRegWithShadow<[R0, R2], [R1, R3]>> > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// ARM AAPCS-VFP (EABI) Calling Convention > +// > = > = > = > ----------------------------------------------------------------------= > ==// > + > +def CC_ARM_AAPCS_VFP : CallingConv<[ > + CCIfType<[f64], CCAssignToReg<[D0, D1, D2, D3, D4, D5, D6, D7]>>, > + CCIfType<[f32], CCAssignToReg<[S0, S1, S2, S3, S4, S5, S6, S7, S8, > + S9, S10, S11, S12, S13, S14, S15]>>, > + CCDelegateTo > +]>; > + > +def RetCC_ARM_AAPCS_VFP : CallingConv<[ > + CCIfType<[f64], CCAssignToReg<[D0, D1, D2, D3, D4, D5, D6, D7]>>, > + CCIfType<[f32], CCAssignToReg<[S0, S1, S2, S3, S4, S5, S6, S7, S8, > + S9, S10, S11, S12, S13, S14, S15]>>, > + CCDelegateTo > ]>; > > // > = > = > = > ----------------------------------------------------------------------= > ==// > @@ -77,11 +111,19 @@ > // > = > = > = > ----------------------------------------------------------------------= > ==// > > def CC_ARM : CallingConv<[ > + CCIfSubtarget<"isAAPCS_ABI()", > + CCIfSubtarget<"hasVFP2()", > + CCIfFloatABI<"Hard", > + > CCDelegateTo>>>, > CCIfSubtarget<"isAAPCS_ABI()", CCDelegateTo>, > CCDelegateTo > ]>; > > def RetCC_ARM : CallingConv<[ > + CCIfSubtarget<"isAAPCS_ABI()", > + CCIfSubtarget<"hasVFP2()", > + CCIfFloatABI<"Hard", > + > CCDelegateTo>>>, > CCIfSubtarget<"isAAPCS_ABI()", CCDelegateTo>, > CCDelegateTo > ]>; > > Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=73095&r1=73094&r2=73095&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Jun 8 > 17:53:56 2009 > @@ -549,6 +549,10 @@ > switch (N->getOpcode()) { > default: break; > case ISD::Constant: { > + // ARMv6T2 and later should materialize imms via MOV / MOVT pair. > + if (Subtarget->hasV6T2Ops()) > + break; > + > unsigned Val = cast(N)->getZExtValue(); > bool UseCP = true; > if (Subtarget->isThumb()) > @@ -559,6 +563,7 @@ > UseCP = (ARM_AM::getSOImmVal(Val) == -1 && // MOV > ARM_AM::getSOImmVal(~Val) == -1 && // MVN > !ARM_AM::isSOImmTwoPartVal(Val)); // two instrs. > + > if (UseCP) { > SDValue CPIdx = > CurDAG- > >getTargetConstantPool(ConstantInt::get(Type::Int32Ty, Val), > @@ -570,7 +575,7 @@ > CPIdx, CurDAG- > >getEntryNode()); > else { > SDValue Ops[] = { > - CPIdx, > + CPIdx, > CurDAG->getRegister(0, MVT::i32), > CurDAG->getTargetConstant(0, MVT::i32), > getAL(CurDAG), > @@ -583,7 +588,7 @@ > ReplaceUses(Op, SDValue(ResNode, 0)); > return NULL; > } > - > + > // Other cases are autogenerated. > break; > } > > Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=73095&r1=73094&r2=73095&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Jun 8 > 17:53:56 2009 > @@ -1101,7 +1101,12 @@ > else > RC = ARM::GPRRegisterClass; > > - if (RegVT == MVT::f64) { > + if (FloatABIType == FloatABI::Hard) { > + if (RegVT == MVT::f32) > + RC = ARM::SPRRegisterClass; > + else if (RegVT == MVT::f64) > + RC = ARM::DPRRegisterClass; > + } else if (RegVT == MVT::f64) { > // f64 is passed in pairs of GPRs and must be combined. > RegVT = MVT::i32; > } else if (!((RegVT == MVT::i32) || (RegVT == MVT::f32))) > > Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td?rev=73095&r1=73094&r2=73095&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td (original) > +++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td Mon Jun 8 17:53:56 > 2009 > @@ -219,3 +219,18 @@ > > // Condition code registers. > def CCR : RegisterClass<"ARM", [i32], 32, [CPSR]>; > + > +// > = > = > = > ----------------------------------------------------------------------= > ==// > +// Subregister Set Definitions... now that we have all of the > pieces, define the > +// sub registers for each register. > +// > + > +def : SubRegSet<1, [D0, D1, D2, D3, D4, D5, D6, D7, > + D8, D9, D10, D11, D12, D13, D14, D15], > + [S0, S2, S4, S6, S8, S10, S12, S14, > + S16, S18, S20, S22, S24, S26, S28, S30]>; > + > +def : SubRegSet<2, [D0, D1, D2, D3, D4, D5, D6, D7, > + D8, D9, D10, D11, D12, D13, D14, D15], > + [S1, S3, S5, S7, S9, S11, S13, S15, > + S17, S19, S21, S23, S25, S27, S29, S31]>; > > Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=73095&r1=73094&r2=73095&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Mon Jun 8 17:53:56 > 2009 > @@ -14,6 +14,8 @@ > #include "ARMSubtarget.h" > #include "ARMGenSubtarget.inc" > #include "llvm/Module.h" > +#include "llvm/Target/TargetMachine.h" > +#include "llvm/Target/TargetOptions.h" > using namespace llvm; > > ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, > @@ -28,6 +30,10 @@ > , CPUString("generic") > , TargetType(isELF) // Default to ELF unless otherwise specified. > , TargetABI(ARM_ABI_APCS) { > + // default to soft float ABI > + if (FloatABIType == FloatABI::Default) > + FloatABIType = FloatABI::Soft; > + > // Determine default and user specified characteristics > > // Parse features string. > > Modified: llvm/trunk/lib/Target/TargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=73095&r1=73094&r2=73095&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/TargetMachine.cpp (original) > +++ llvm/trunk/lib/Target/TargetMachine.cpp Mon Jun 8 17:53:56 2009 > @@ -30,6 +30,7 @@ > bool FiniteOnlyFPMathOption; > bool HonorSignDependentRoundingFPMathOption; > bool UseSoftFloat; > + FloatABI::ABIType FloatABIType; > bool NoImplicitFloat; > bool NoZerosInBSS; > bool ExceptionHandling; > @@ -84,6 +85,19 @@ > cl::desc("Generate software floating point library calls"), > cl::location(UseSoftFloat), > cl::init(false)); > +static cl::opt > +FloatABIForCalls("float-abi", > + cl::desc("Choose float ABI type"), > + cl::location(FloatABIType), > + cl::init(FloatABI::Default), > + cl::values( > + clEnumValN(FloatABI::Default, "default", > + "Target default float ABI type"), > + clEnumValN(FloatABI::Soft, "soft", > + "Soft float ABI (implied by -soft-float)"), > + clEnumValN(FloatABI::Hard, "hard", > + "Hard float ABI (uses FP registers)"), > + clEnumValEnd)); > static cl::opt > DontPlaceZerosInBSS("nozero-initialized-in-bss", > cl::desc("Don't place zero-initialized symbols into bss section"), > @@ -162,6 +176,14 @@ > // TargetMachine Class > // > > +TargetMachine::TargetMachine() > + : AsmInfo(0) { > + // Typically it will be subtargets that will adjust FloatABIType > from Default > + // to Soft or Hard. > + if (UseSoftFloat) > + FloatABIType = FloatABI::Soft; > +} > + > TargetMachine::~TargetMachine() { > delete AsmInfo; > } > > Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=73095&r1=73094&r2=73095&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Mon Jun 8 17:53:56 > 2009 > @@ -350,6 +350,10 @@ > , MaxInlineSizeThreshold(128) > , Is64Bit(is64Bit) > , TargetType(isELF) { // Default to ELF unless otherwise specified. > + > + // default to hard float ABI > + if (FloatABIType == FloatABI::Default) > + FloatABIType = FloatABI::Hard; > > // Determine default and user specified characteristics > if (!FS.empty()) { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From ofv at wanadoo.es Wed Jun 10 23:45:09 2009 From: ofv at wanadoo.es (Oscar Fuentes) Date: Thu, 11 Jun 2009 04:45:09 -0000 Subject: [llvm-commits] [llvm] r73181 - /llvm/trunk/docs/CMake.html Message-ID: <200906110445.n5B4j9Jn028571@zion.cs.uiuc.edu> Author: ofv Date: Wed Jun 10 23:45:08 2009 New Revision: 73181 URL: http://llvm.org/viewvc/llvm-project?rev=73181&view=rev Log: CMake: Documented how to cross-compile with CMake. Modified: llvm/trunk/docs/CMake.html Modified: llvm/trunk/docs/CMake.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CMake.html?rev=73181&r1=73180&r2=73181&view=diff ============================================================================== --- llvm/trunk/docs/CMake.html (original) +++ llvm/trunk/docs/CMake.html Wed Jun 10 23:45:08 2009 @@ -296,7 +296,13 @@
      -

      TODO

      +

      See this + wiki page for generic instructions on how to cross-compile + with CMake. It goes into detailed explanations and may seem + daunting, but it is not. On the wiki page there are several + examples including toolchain files. Go directly to + this + section for a quick solution.

      From isanbard at gmail.com Thu Jun 11 01:35:28 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Jun 2009 06:35:28 -0000 Subject: [llvm-commits] [llvm] r73182 - /llvm/tags/Apple/llvmCore-2111/ Message-ID: <200906110635.n5B6ZS2Q032081@zion.cs.uiuc.edu> Author: void Date: Thu Jun 11 01:35:27 2009 New Revision: 73182 URL: http://llvm.org/viewvc/llvm-project?rev=73182&view=rev Log: Creating llvmCore-2111 branch Added: llvm/tags/Apple/llvmCore-2111/ - copied from r73181, llvm/trunk/ From isanbard at gmail.com Thu Jun 11 01:35:36 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Jun 2009 06:35:36 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r73183 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2111/ Message-ID: <200906110635.n5B6ZaB1032098@zion.cs.uiuc.edu> Author: void Date: Thu Jun 11 01:35:36 2009 New Revision: 73183 URL: http://llvm.org/viewvc/llvm-project?rev=73183&view=rev Log: Creating llvmgcc42-2111 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2111/ - copied from r73182, llvm-gcc-4.2/trunk/ From sanjiv.gupta at microchip.com Thu Jun 11 01:49:56 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Thu, 11 Jun 2009 06:49:56 -0000 Subject: [llvm-commits] [llvm] r73184 - /llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Message-ID: <200906110649.n5B6nuXk032494@zion.cs.uiuc.edu> Author: sgupta Date: Thu Jun 11 01:49:55 2009 New Revision: 73184 URL: http://llvm.org/viewvc/llvm-project?rev=73184&view=rev Log: Fixed source comments. No functionality change. Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=73184&r1=73183&r2=73184&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Thu Jun 11 01:49:55 2009 @@ -33,8 +33,9 @@ return true; } -/// runOnMachineFunction - This uses the printInstruction() -/// method to print assembly for each instruction. +/// runOnMachineFunction - This emits the frame section, autos section and +/// assembly for each instruction. Also takes care of function begin debug +/// directive and file begin debug directive (if required) for the function. /// bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) { this->MF = &MF; @@ -47,20 +48,25 @@ const Function *F = MF.getFunction(); CurrentFnName = Mang->getValueName(F); + // Emit .file directive. DbgInfo.EmitFileDirective(F); - // Emit the function variables. + + // Emit the function frame (args and temps). EmitFunctionFrame(MF); - // Emit function begin debug directives + // Emit function begin debug directive. DbgInfo.EmitFunctBeginDI(F); + // Emit the autos section of function. EmitAutos(CurrentFnName); + + // Now emit the instructions of function in its code section. const char *codeSection = PAN::getCodeSectionName(CurrentFnName).c_str(); const Section *fCodeSection = TAI->getNamedSection(codeSection, SectionFlags::Code); - O << "\n"; // Start the Code Section. + O << "\n"; SwitchToSection (fCodeSection); // Emit the frame address of the function at the beginning of code. @@ -77,14 +83,17 @@ // Print out code for the function. for (MachineFunction::const_iterator I = MF.begin(), E = MF.end(); I != E; ++I) { + // Print a label for the basic block. if (I != MF.begin()) { printBasicBlockLabel(I, true); O << '\n'; } + // Print a basic block. for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); II != E; ++II) { + // Emit the line directive if source line changed. const DebugLoc DL = II->getDebugLoc(); if (!DL.isUnknown()) { @@ -102,6 +111,7 @@ // Emit function end debug directives. DbgInfo.EmitFunctEndDI(F, CurLine); + return false; // we didn't modify anything. } From sanjiv.gupta at microchip.com Thu Jun 11 01:55:48 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Thu, 11 Jun 2009 06:55:48 -0000 Subject: [llvm-commits] [llvm] r73185 - /llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Message-ID: <200906110655.n5B6tmGu032688@zion.cs.uiuc.edu> Author: sgupta Date: Thu Jun 11 01:55:48 2009 New Revision: 73185 URL: http://llvm.org/viewvc/llvm-project?rev=73185&view=rev Log: More formatting. Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=73185&r1=73184&r2=73185&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Thu Jun 11 01:55:48 2009 @@ -168,11 +168,16 @@ } } +/// printCCOperand - Print the cond code operand. +/// void PIC16AsmPrinter::printCCOperand(const MachineInstr *MI, int opNum) { int CC = (int)MI->getOperand(opNum).getImm(); O << PIC16CondCodeToString((PIC16CC::CondCodes)CC); } +/// printLibcallDecls - print the extern declarations for compiler +/// intrinsics. +/// void PIC16AsmPrinter::printLibcallDecls(void) { // If no libcalls used, return. if (LibcallDecls.empty()) return; @@ -190,6 +195,10 @@ O << TAI->getCommentString() << "External decls for libcalls - END." <<"\n"; } +/// doInitialization - Perfrom Module level initializations here. +/// One task that we do here is to sectionize all global variables. +/// The MemSelOptimizer pass depends on the sectionizing. +/// bool PIC16AsmPrinter::doInitialization (Module &M) { bool Result = AsmPrinter::doInitialization(M); @@ -215,9 +224,10 @@ return Result; } -// Emit extern decls for functions imported from other modules, and emit -// global declarations for function defined in this module and which are -// available to other modules. +/// Emit extern decls for functions imported from other modules, and emit +/// global declarations for function defined in this module and which are +/// available to other modules. +/// void PIC16AsmPrinter::EmitFunctionDecls (Module &M) { // Emit declarations for external functions. O << TAI->getCommentString() << "Function Declarations - BEGIN." <<"\n"; From mikael.lepisto at tut.fi Thu Jun 11 02:02:55 2009 From: mikael.lepisto at tut.fi (=?ISO-8859-1?Q?Mikael_Lepist=F6?=) Date: Thu, 11 Jun 2009 10:02:55 +0300 Subject: [llvm-commits] [PATCH] KNRPromotion fix when FLOAT_TYPE_SIZE is not smaller than DOUBLE_TYPE_SIZE In-Reply-To: <4A300348.7030209@free.fr> References: <4A2E5BE5.1050704@tut.fi> <4A300348.7030209@free.fr> Message-ID: <4A30AC1F.4070407@tut.fi> Duncan Sands wrote: > Hi Mikael, > > >> I found out that >> >> void function(value) >> float value; {} >> >> generated following bitcode >> >> define void @function(double %value1) >> >> In IRC channel this was though to be correct for platforms where >> DOUBLE_TYPE_SIZE is bigger than float size e.g. x86. However in our >> tce-llvm-gcc cross-compiler DOUBLE_TYPE_SIZE is set to be 32 bits as >> FLOAT_TYPE_SIZE. So in this case correct bitcode should have been >> >> define void @function(float %value1) >> >> So here's patch attached for fixing the problem. >> > > I think something like this would be better: > > if (type == float_type_node) > LLVMTy = ConvertType(double_type_node); > > > That's because float_type_node and double_type_node correspond > to the C float/double types, while LLVM's FloatTy and DoubleTy > need not: they correspond to a particular size. You might need > to look at the main type variant though. > > Ciao, > > Duncan. > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > Thanks for the comments. Here is updated patch. Mikael Lepist? -------------- next part -------------- A non-text attachment was scrubbed... Name: KNRPromotion_when_double_is_same_size_with_float-rc1.patch Type: text/x-diff Size: 654 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090611/3debd3d3/attachment.bin From deeppatel1987 at gmail.com Thu Jun 11 02:10:30 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Thu, 11 Jun 2009 00:10:30 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegist Message-ID: <305d6f60906110010l37762b0br64c9d75b7f149915@mail.gmail.com> On Wed, Jun 10, 2009 at 9:43 PM, Evan Cheng wrote: > > On Jun 8, 2009, at 3:53 PM, Anton Korobeynikov wrote: > >> Author: asl >> Date: Mon Jun ?8 17:53:56 2009 >> New Revision: 73095 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=73095&view=rev >> Log: >> The attached patches implement most of the ARM AAPCS-VFP hard float >> ABI. The missing piece is support for putting "homogeneous aggregates" >> into registers. >> >> Patch by Sandeep Patel! >> >> Modified: >> ? ?llvm/trunk/include/llvm/Target/TargetMachine.h >> ? ?llvm/trunk/include/llvm/Target/TargetOptions.h >> ? ?llvm/trunk/lib/Target/ARM/ARMCallingConv.td >> ? ?llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp >> ? ?llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >> ? ?llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td >> ? ?llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp >> ? ?llvm/trunk/lib/Target/TargetMachine.cpp >> ? ?llvm/trunk/lib/Target/X86/X86Subtarget.cpp >> >> Modified: llvm/trunk/include/llvm/Target/TargetMachine.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=73095&r1=73094&r2=73095&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/include/llvm/Target/TargetMachine.h (original) >> +++ llvm/trunk/include/llvm/Target/TargetMachine.h Mon Jun ?8 >> 17:53:56 2009 >> @@ -78,6 +78,14 @@ >> ? }; >> } > >> >> >> +namespace FloatABI { >> + ?enum ABIType { >> + ? ?Default, >> + ? ?Soft, >> + ? ?Hard >> + ?}; >> +} > > Some comments? Will do. >> >> + >> // >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> /// >> /// TargetMachine - Primary interface to the complete machine >> description for >> @@ -88,7 +96,7 @@ >> ? TargetMachine(const TargetMachine &); ? // DO NOT IMPLEMENT >> ? void operator=(const TargetMachine &); ?// DO NOT IMPLEMENT >> protected: // Can only create subclasses. >> - ?TargetMachine() : AsmInfo(0) { } >> + ?TargetMachine(); >> >> ? /// getSubtargetImpl - virtual method implemented by subclasses >> that returns >> ? /// a reference to that target's TargetSubtarget-derived member >> variable. >> >> Modified: llvm/trunk/include/llvm/Target/TargetOptions.h >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=73095&r1=73094&r2=73095&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/include/llvm/Target/TargetOptions.h (original) >> +++ llvm/trunk/include/llvm/Target/TargetOptions.h Mon Jun ?8 >> 17:53:56 2009 >> @@ -73,6 +73,14 @@ >> ? /// target FP instructions. >> ? extern bool UseSoftFloat; >> >> + ?/// FloatABIType - This setting is set by -float-abi=xxx option >> is specfied >> + ?/// on the command line. This setting may either be Default, >> Soft, or Hard. >> + ?/// Default selects the target's default behavior. Soft selects >> the ABI for >> + ?/// UseSoftFloat, but does not inidcate that FP hardware may not >> be used. >> + ?/// Such a combination is unfortunately popular (e.g. arm-apple- >> darwin). >> + ?/// Hard presumes that the normal FP ABI is used. >> + ?extern FloatABI::ABIType FloatABIType; > > Can we add a module note for this? Just checking my understanding: you want to extend the IR in llvm::bitc::ModuleCodes with something new for this? I had presumed that passing the default float ABI on the command line was the way to go. We'll also have to eventually support a recently added GCC function attribute __attribute__((pcs("aapcs-vfp"))) that sets the CC for a given function to something other than the default. (And we get to wonder what it means to set the CC to atpcs when you're compiling for the ARM ISA and vice versa.) deep > Evan > >> >> + >> ? /// NoZerosInBSS - By default some codegens place zero-initialized >> data to >> ? /// .bss section. This flag disables such behaviour (necessary, >> e.g. for >> ? /// crt*.o compiling). >> >> Modified: llvm/trunk/lib/Target/ARM/ARMCallingConv.td >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCallingConv.td?rev=73095&r1=73094&r2=73095&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/ARM/ARMCallingConv.td (original) >> +++ llvm/trunk/lib/Target/ARM/ARMCallingConv.td Mon Jun ?8 17:53:56 >> 2009 >> @@ -17,6 +17,11 @@ >> class CCIfAlign: >> ? CCIf; >> >> +/// CCIfFloatABI - Match of the float ABI and the arg. ABIType may >> be "Hard" or >> +/// ? ? ? ? ? ? ? ?"Soft". >> +class CCIfFloatABI: >> + ?CCIf> ABIType), A>; >> + >> // >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> // ARM APCS Calling Convention >> // >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> @@ -43,9 +48,10 @@ >> ]>; >> >> // >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> -// ARM AAPCS (EABI) Calling Convention >> +// ARM AAPCS (EABI) Calling Convention, common parts >> // >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> -def CC_ARM_AAPCS : CallingConv<[ >> + >> +def CC_ARM_AAPCS_Common : CallingConv<[ >> >> ? CCIfType<[i8, i16], CCPromoteToType>, >> >> @@ -53,23 +59,51 @@ >> ? // i64 is 8-aligned i32 here, so we may need to eat R1 as a pad >> register >> ? // (and the same is true for f64 if VFP is not enabled) >> ? CCIfType<[i32], CCIfAlign<"8", CCAssignToRegWithShadow<[R0, R2], >> [R0, R1]>>>, >> - ?CCIfType<[f64], CCCustom<"CC_ARM_AAPCS_Custom_f64">>, >> - >> - ?CCIfType<[f32], CCBitConvertToType>, >> ? CCIfType<[i32], CCIf<"State.getNextStackOffset() == 0 &&" >> ? ? ? ? ? ? ? ? ? ? ? ?"ArgFlags.getOrigAlign() != 8", >> ? ? ? ? ? ? ? ? ? ? ? ?CCAssignToReg<[R0, R1, R2, R3]>>>, >> >> - ?CCIfType<[i32], CCAssignToStack<4, 4>>, >> + ?CCIfType<[i32, f32], CCAssignToStack<4, 4>>, >> ? CCIfType<[f64], CCAssignToStack<8, 8>> >> ]>; >> >> -def RetCC_ARM_AAPCS : CallingConv<[ >> +def RetCC_ARM_AAPCS_Common : CallingConv<[ >> + ?CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>> >> + ?CCIfType<[i64], CCAssignToRegWithShadow<[R0, R2], [R1, R3]>> >> +]>; >> + >> +// >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> +// ARM AAPCS (EABI) Calling Convention >> +// >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> + >> +def CC_ARM_AAPCS : CallingConv<[ >> + ?CCIfType<[f64], CCCustom<"CC_ARM_AAPCS_Custom_f64">>, >> ? CCIfType<[f32], CCBitConvertToType>, >> + ?CCDelegateTo >> +]>; >> + >> +def RetCC_ARM_AAPCS : CallingConv<[ >> ? CCIfType<[f64], CCCustom<"RetCC_ARM_AAPCS_Custom_f64">>, >> + ?CCIfType<[f32], CCBitConvertToType>, >> + ?CCDelegateTo >> +]>; >> >> - ?CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>>, >> - ?CCIfType<[i64], CCAssignToRegWithShadow<[R0, R2], [R1, R3]>> >> +// >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> +// ARM AAPCS-VFP (EABI) Calling Convention >> +// >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> + >> +def CC_ARM_AAPCS_VFP : CallingConv<[ >> + ?CCIfType<[f64], CCAssignToReg<[D0, D1, D2, D3, D4, D5, D6, D7]>>, >> + ?CCIfType<[f32], CCAssignToReg<[S0, S1, S2, S3, S4, S5, S6, S7, S8, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? S9, S10, S11, S12, S13, S14, S15]>>, >> + ?CCDelegateTo >> +]>; >> + >> +def RetCC_ARM_AAPCS_VFP : CallingConv<[ >> + ?CCIfType<[f64], CCAssignToReg<[D0, D1, D2, D3, D4, D5, D6, D7]>>, >> + ?CCIfType<[f32], CCAssignToReg<[S0, S1, S2, S3, S4, S5, S6, S7, S8, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? S9, S10, S11, S12, S13, S14, S15]>>, >> + ?CCDelegateTo >> ]>; >> >> // >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> @@ -77,11 +111,19 @@ >> // >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> >> def CC_ARM : CallingConv<[ >> + ?CCIfSubtarget<"isAAPCS_ABI()", >> + ? ? ? ? ? ? ? ?CCIfSubtarget<"hasVFP2()", >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CCIfFloatABI<"Hard", >> + >> CCDelegateTo>>>, >> ? CCIfSubtarget<"isAAPCS_ABI()", CCDelegateTo>, >> ? CCDelegateTo >> ]>; >> >> def RetCC_ARM : CallingConv<[ >> + ?CCIfSubtarget<"isAAPCS_ABI()", >> + ? ? ? ? ? ? ? ?CCIfSubtarget<"hasVFP2()", >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?CCIfFloatABI<"Hard", >> + >> CCDelegateTo>>>, >> ? CCIfSubtarget<"isAAPCS_ABI()", CCDelegateTo>, >> ? CCDelegateTo >> ]>; >> >> Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=73095&r1=73094&r2=73095&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) >> +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Jun ?8 >> 17:53:56 2009 >> @@ -549,6 +549,10 @@ >> ? switch (N->getOpcode()) { >> ? default: break; >> ? case ISD::Constant: { >> + ? ?// ARMv6T2 and later should materialize imms via MOV / MOVT pair. >> + ? ?if (Subtarget->hasV6T2Ops()) >> + ? ? ?break; >> + >> ? ? unsigned Val = cast(N)->getZExtValue(); >> ? ? bool UseCP = true; >> ? ? if (Subtarget->isThumb()) >> @@ -559,6 +563,7 @@ >> ? ? ? UseCP = (ARM_AM::getSOImmVal(Val) == -1 && ? ? // MOV >> ? ? ? ? ? ? ? ?ARM_AM::getSOImmVal(~Val) == -1 && ? ?// MVN >> ? ? ? ? ? ? ? ?!ARM_AM::isSOImmTwoPartVal(Val)); ? ? // two instrs. >> + >> ? ? if (UseCP) { >> ? ? ? SDValue CPIdx = >> ? ? ? ? CurDAG- >> >getTargetConstantPool(ConstantInt::get(Type::Int32Ty, Val), >> @@ -570,7 +575,7 @@ >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CPIdx, CurDAG- >> >getEntryNode()); >> ? ? ? else { >> ? ? ? ? SDValue Ops[] = { >> - ? ? ? ? ?CPIdx, >> + ? ? ? ? ?CPIdx, >> ? ? ? ? ? CurDAG->getRegister(0, MVT::i32), >> ? ? ? ? ? CurDAG->getTargetConstant(0, MVT::i32), >> ? ? ? ? ? getAL(CurDAG), >> @@ -583,7 +588,7 @@ >> ? ? ? ReplaceUses(Op, SDValue(ResNode, 0)); >> ? ? ? return NULL; >> ? ? } >> - >> + >> ? ? // Other cases are autogenerated. >> ? ? break; >> ? } >> >> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=73095&r1=73094&r2=73095&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) >> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Jun ?8 >> 17:53:56 2009 >> @@ -1101,7 +1101,12 @@ >> ? ? ? else >> ? ? ? ? RC = ARM::GPRRegisterClass; >> >> - ? ? ?if (RegVT == MVT::f64) { >> + ? ? ?if (FloatABIType == FloatABI::Hard) { >> + ? ? ? ?if (RegVT == MVT::f32) >> + ? ? ? ? ?RC = ARM::SPRRegisterClass; >> + ? ? ? ?else if (RegVT == MVT::f64) >> + ? ? ? ? ?RC = ARM::DPRRegisterClass; >> + ? ? ?} else if (RegVT == MVT::f64) { >> ? ? ? ? // f64 is passed in pairs of GPRs and must be combined. >> ? ? ? ? RegVT = MVT::i32; >> ? ? ? } else if (!((RegVT == MVT::i32) || (RegVT == MVT::f32))) >> >> Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td?rev=73095&r1=73094&r2=73095&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td (original) >> +++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td Mon Jun ?8 17:53:56 >> 2009 >> @@ -219,3 +219,18 @@ >> >> // Condition code registers. >> def CCR : RegisterClass<"ARM", [i32], 32, [CPSR]>; >> + >> +// >> = >> = >> = >> ----------------------------------------------------------------------= >> ==// >> +// Subregister Set Definitions... now that we have all of the >> pieces, define the >> +// sub registers for each register. >> +// >> + >> +def : SubRegSet<1, [D0, D1, D2, D3, D4, D5, D6, D7, >> + ? ? ? ? ? ? ? ? ? ?D8, D9, D10, D11, D12, D13, D14, D15], >> + ? ? ? ? ? ? ? ? ? [S0, S2, S4, S6, S8, S10, S12, S14, >> + ? ? ? ? ? ? ? ? ? ?S16, S18, S20, S22, S24, S26, S28, S30]>; >> + >> +def : SubRegSet<2, [D0, D1, D2, D3, D4, D5, D6, D7, >> + ? ? ? ? ? ? ? ? ? ?D8, D9, D10, D11, D12, D13, D14, D15], >> + ? ? ? ? ? ? ? ? ? [S1, S3, S5, S7, S9, S11, S13, S15, >> + ? ? ? ? ? ? ? ? ? ?S17, S19, S21, S23, S25, S27, S29, S31]>; >> >> Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=73095&r1=73094&r2=73095&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp (original) >> +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Mon Jun ?8 17:53:56 >> 2009 >> @@ -14,6 +14,8 @@ >> #include "ARMSubtarget.h" >> #include "ARMGenSubtarget.inc" >> #include "llvm/Module.h" >> +#include "llvm/Target/TargetMachine.h" >> +#include "llvm/Target/TargetOptions.h" >> using namespace llvm; >> >> ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, >> @@ -28,6 +30,10 @@ >> ? , CPUString("generic") >> ? , TargetType(isELF) // Default to ELF unless otherwise specified. >> ? , TargetABI(ARM_ABI_APCS) { >> + ?// default to soft float ABI >> + ?if (FloatABIType == FloatABI::Default) >> + ? ?FloatABIType = FloatABI::Soft; >> + >> ? // Determine default and user specified characteristics >> >> ? // Parse features string. >> >> Modified: llvm/trunk/lib/Target/TargetMachine.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=73095&r1=73094&r2=73095&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/TargetMachine.cpp (original) >> +++ llvm/trunk/lib/Target/TargetMachine.cpp Mon Jun ?8 17:53:56 2009 >> @@ -30,6 +30,7 @@ >> ? bool FiniteOnlyFPMathOption; >> ? bool HonorSignDependentRoundingFPMathOption; >> ? bool UseSoftFloat; >> + ?FloatABI::ABIType FloatABIType; >> ? bool NoImplicitFloat; >> ? bool NoZerosInBSS; >> ? bool ExceptionHandling; >> @@ -84,6 +85,19 @@ >> ? cl::desc("Generate software floating point library calls"), >> ? cl::location(UseSoftFloat), >> ? cl::init(false)); >> +static cl::opt >> +FloatABIForCalls("float-abi", >> + ?cl::desc("Choose float ABI type"), >> + ?cl::location(FloatABIType), >> + ?cl::init(FloatABI::Default), >> + ?cl::values( >> + ? ?clEnumValN(FloatABI::Default, "default", >> + ? ? ? ? ? ? ? "Target default float ABI type"), >> + ? ?clEnumValN(FloatABI::Soft, "soft", >> + ? ? ? ? ? ? ? "Soft float ABI (implied by -soft-float)"), >> + ? ?clEnumValN(FloatABI::Hard, "hard", >> + ? ? ? ? ? ? ? "Hard float ABI (uses FP registers)"), >> + ? ?clEnumValEnd)); >> static cl::opt >> DontPlaceZerosInBSS("nozero-initialized-in-bss", >> ? cl::desc("Don't place zero-initialized symbols into bss section"), >> @@ -162,6 +176,14 @@ >> // TargetMachine Class >> // >> >> +TargetMachine::TargetMachine() >> + ?: AsmInfo(0) { >> + ?// Typically it will be subtargets that will adjust FloatABIType >> from Default >> + ?// to Soft or Hard. >> + ?if (UseSoftFloat) >> + ? ?FloatABIType = FloatABI::Soft; >> +} >> + >> TargetMachine::~TargetMachine() { >> ? delete AsmInfo; >> } >> >> Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=73095&r1=73094&r2=73095&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ====================================================================== >> --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Mon Jun ?8 17:53:56 >> 2009 >> @@ -350,6 +350,10 @@ >> ? , MaxInlineSizeThreshold(128) >> ? , Is64Bit(is64Bit) >> ? , TargetType(isELF) { // Default to ELF unless otherwise specified. >> + >> + ?// default to hard float ABI >> + ?if (FloatABIType == FloatABI::Default) >> + ? ?FloatABIType = FloatABI::Hard; >> >> ? // Determine default and user specified characteristics >> ? if (!FS.empty()) { >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From baldrick at free.fr Thu Jun 11 03:09:54 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 11 Jun 2009 08:09:54 -0000 Subject: [llvm-commits] [llvm] r73187 - /llvm/trunk/lib/Archive/ArchiveWriter.cpp Message-ID: <200906110809.n5B89ujH013918@zion.cs.uiuc.edu> Author: baldrick Date: Thu Jun 11 03:09:49 2009 New Revision: 73187 URL: http://llvm.org/viewvc/llvm-project?rev=73187&view=rev Log: Avoid leaking memory in an error path. Noticed by cppcheck. Modified: llvm/trunk/lib/Archive/ArchiveWriter.cpp Modified: llvm/trunk/lib/Archive/ArchiveWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveWriter.cpp?rev=73187&r1=73186&r2=73187&view=diff ============================================================================== --- llvm/trunk/lib/Archive/ArchiveWriter.cpp (original) +++ llvm/trunk/lib/Archive/ArchiveWriter.cpp Thu Jun 11 03:09:49 2009 @@ -167,10 +167,11 @@ mbr->data = 0; mbr->path = filePath; const sys::FileStatus *FSInfo = mbr->path.getFileStatus(false, ErrMsg); - if (FSInfo) - mbr->info = *FSInfo; - else + if (!FSInfo) { + delete mbr; return true; + } + mbr->info = *FSInfo; unsigned flags = 0; bool hasSlash = filePath.toString().find('/') != std::string::npos; From baldrick at free.fr Thu Jun 11 03:11:03 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 11 Jun 2009 08:11:03 -0000 Subject: [llvm-commits] [llvm] r73188 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Verifier.cpp Message-ID: <200906110811.n5B8B4qh013964@zion.cs.uiuc.edu> Author: baldrick Date: Thu Jun 11 03:11:03 2009 New Revision: 73188 URL: http://llvm.org/viewvc/llvm-project?rev=73188&view=rev Log: Cosmetic changes to parameter attribute verification. Modified: llvm/trunk/include/llvm/Attributes.h llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/include/llvm/Attributes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=73188&r1=73187&r2=73188&view=diff ============================================================================== --- llvm/trunk/include/llvm/Attributes.h (original) +++ llvm/trunk/include/llvm/Attributes.h Thu Jun 11 03:11:03 2009 @@ -61,7 +61,8 @@ /// @brief Attributes that only apply to function parameters. const Attributes ParameterOnly = ByVal | Nest | StructRet | NoCapture; -/// @brief Attributes that only apply to function. +/// @brief Attributes that may be applied to the function itself. These cannot +/// be used on return values or function parameters. const Attributes FunctionOnly = NoReturn | NoUnwind | ReadNone | ReadOnly | NoInline | AlwaysInline | OptimizeForSize | StackProtect | StackProtectReq | NoRedZone | NoImplicitFloat; @@ -186,7 +187,7 @@ /// getFnAttributes - The function attributes are returned. Attributes getFnAttributes() const { - return getAttributes(~0); + return getAttributes(~0U); } /// paramHasAttr - Return true if the specified parameter index has the Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=73188&r1=73187&r2=73188&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Thu Jun 11 03:11:03 2009 @@ -276,8 +276,8 @@ int VT, unsigned ArgNo, std::string &Suffix); void VerifyIntrinsicPrototype(Intrinsic::ID ID, Function *F, unsigned RetNum, unsigned ParamNum, ...); - void VerifyAttrs(Attributes Attrs, const Type *Ty, - bool isReturnValue, const Value *V); + void VerifyParameterAttrs(Attributes Attrs, const Type *Ty, + bool isReturnValue, const Value *V); void VerifyFunctionAttrs(const FunctionType *FT, const AttrListPtr &Attrs, const Value *V); @@ -437,22 +437,23 @@ void Verifier::verifyTypeSymbolTable(TypeSymbolTable &ST) { } -// VerifyAttrs - Check the given parameter attributes for an argument or return +// VerifyParameterAttrs - Check the given attributes for an argument or return // value of the specified type. The value V is printed in error messages. -void Verifier::VerifyAttrs(Attributes Attrs, const Type *Ty, - bool isReturnValue, const Value *V) { +void Verifier::VerifyParameterAttrs(Attributes Attrs, const Type *Ty, + bool isReturnValue, const Value *V) { if (Attrs == Attribute::None) return; + Attributes FnCheckAttr = Attrs & Attribute::FunctionOnly; + Assert1(!FnCheckAttr, "Attribute " + Attribute::getAsString(FnCheckAttr) + + " only applies to the function!", V); + if (isReturnValue) { Attributes RetI = Attrs & Attribute::ParameterOnly; Assert1(!RetI, "Attribute " + Attribute::getAsString(RetI) + " does not apply to return values!", V); } - Attributes FnCheckAttr = Attrs & Attribute::FunctionOnly; - Assert1(!FnCheckAttr, "Attribute " + Attribute::getAsString(FnCheckAttr) + - " only applies to functions!", V); - + for (unsigned i = 0; i < array_lengthof(Attribute::MutuallyIncompatible); ++i) { Attributes MutI = Attrs & Attribute::MutuallyIncompatible[i]; @@ -495,9 +496,9 @@ else if (Attr.Index-1 < FT->getNumParams()) Ty = FT->getParamType(Attr.Index-1); else - break; // VarArgs attributes, don't verify. - - VerifyAttrs(Attr.Attrs, Ty, Attr.Index == 0, V); + break; // VarArgs attributes, verified elsewhere. + + VerifyParameterAttrs(Attr.Attrs, Ty, Attr.Index == 0, V); if (Attr.Attrs & Attribute::Nest) { Assert1(!SawNest, "More than one parameter has attribute nest!", V); @@ -509,10 +510,10 @@ } Attributes FAttrs = Attrs.getFnAttributes(); - Assert1(!(FAttrs & (~Attribute::FunctionOnly)), - "Attribute " + Attribute::getAsString(FAttrs) + - " does not apply to function!", V); - + Attributes NotFn = FAttrs & (~Attribute::FunctionOnly); + Assert1(!NotFn, "Attribute " + Attribute::getAsString(NotFn) + + " does not apply to the function!", V); + for (unsigned i = 0; i < array_lengthof(Attribute::MutuallyIncompatible); ++i) { Attributes MutI = FAttrs & Attribute::MutuallyIncompatible[i]; @@ -1025,7 +1026,7 @@ for (unsigned Idx = 1 + FTy->getNumParams(); Idx <= CS.arg_size(); ++Idx) { Attributes Attr = Attrs.getParamAttributes(Idx); - VerifyAttrs(Attr, CS.getArgument(Idx-1)->getType(), false, I); + VerifyParameterAttrs(Attr, CS.getArgument(Idx-1)->getType(), false, I); Attributes VArgI = Attr & Attribute::VarArgsIncompatible; Assert1(!VArgI, "Attribute " + Attribute::getAsString(VArgI) + From sanjiv.gupta at microchip.com Thu Jun 11 11:50:48 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Thu, 11 Jun 2009 16:50:48 -0000 Subject: [llvm-commits] [llvm] r73194 - /llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Message-ID: <200906111650.n5BGomJN029230@zion.cs.uiuc.edu> Author: sgupta Date: Thu Jun 11 11:50:48 2009 New Revision: 73194 URL: http://llvm.org/viewvc/llvm-project?rev=73194&view=rev Log: Generate libcalls for floating point arithmetic and casting operations. Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=73194&r1=73193&r2=73194&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Thu Jun 11 11:50:48 2009 @@ -56,6 +56,17 @@ case RTLIB::SREM_I32: Basename = "srem.i32"; break; case RTLIB::UREM_I16: Basename = "urem.i16"; break; case RTLIB::UREM_I32: Basename = "urem.i32"; break; + + case RTLIB::FPTOSINT_F32_I32: + Basename = "f32_to_si32"; break; + case RTLIB::SINTTOFP_I32_F32: + Basename = "si32_to_f32"; break; + + case RTLIB::ADD_F32: Basename = "add.f32"; break; + case RTLIB::SUB_F32: Basename = "sub.f32"; break; + case RTLIB::MUL_F32: Basename = "mul.f32"; break; + case RTLIB::DIV_F32: Basename = "div.f32"; break; + } std::string prefix = PAN::getTagName(PAN::PREFIX_SYMBOL); @@ -113,7 +124,17 @@ // Unsigned remainder lib call names setLibcallName(RTLIB::UREM_I16, getIntrinsicName(RTLIB::UREM_I16)); setLibcallName(RTLIB::UREM_I32, getIntrinsicName(RTLIB::UREM_I32)); - + + // Floating point operations + setLibcallName(RTLIB::FPTOSINT_F32_I32, + getIntrinsicName(RTLIB::FPTOSINT_F32_I32)); + setLibcallName(RTLIB::SINTTOFP_I32_F32, + getIntrinsicName(RTLIB::SINTTOFP_I32_F32)); + setLibcallName(RTLIB::ADD_F32, getIntrinsicName(RTLIB::ADD_F32)); + setLibcallName(RTLIB::SUB_F32, getIntrinsicName(RTLIB::SUB_F32)); + setLibcallName(RTLIB::MUL_F32, getIntrinsicName(RTLIB::MUL_F32)); + setLibcallName(RTLIB::DIV_F32, getIntrinsicName(RTLIB::DIV_F32)); + setOperationAction(ISD::GlobalAddress, MVT::i16, Custom); setOperationAction(ISD::ExternalSymbol, MVT::i16, Custom); From evan.cheng at apple.com Thu Jun 11 12:38:50 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 11 Jun 2009 10:38:50 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegist In-Reply-To: <305d6f60906110010l37762b0br64c9d75b7f149915@mail.gmail.com> References: <305d6f60906110010l37762b0br64c9d75b7f149915@mail.gmail.com> Message-ID: On Jun 11, 2009, at 12:10 AM, Sandeep Patel wrote: > On Wed, Jun 10, 2009 at 9:43 PM, Evan Cheng > wrote: >> >> On Jun 8, 2009, at 3:53 PM, Anton Korobeynikov wrote: >> >>> Author: asl >>> Date: Mon Jun 8 17:53:56 2009 >>> New Revision: 73095 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=73095&view=rev >>> Log: >>> The attached patches implement most of the ARM AAPCS-VFP hard float >>> ABI. The missing piece is support for putting "homogeneous >>> aggregates" >>> into registers. >>> >>> Patch by Sandeep Patel! >>> >>> Modified: >>> llvm/trunk/include/llvm/Target/TargetMachine.h >>> llvm/trunk/include/llvm/Target/TargetOptions.h >>> llvm/trunk/lib/Target/ARM/ARMCallingConv.td >>> llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp >>> llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >>> llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td >>> llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp >>> llvm/trunk/lib/Target/TargetMachine.cpp >>> llvm/trunk/lib/Target/X86/X86Subtarget.cpp >>> >>> Modified: llvm/trunk/include/llvm/Target/TargetMachine.h >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=73095&r1=73094&r2=73095&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/include/llvm/Target/TargetMachine.h (original) >>> +++ llvm/trunk/include/llvm/Target/TargetMachine.h Mon Jun 8 >>> 17:53:56 2009 >>> @@ -78,6 +78,14 @@ >>> }; >>> } >> >>> >>> >>> +namespace FloatABI { >>> + enum ABIType { >>> + Default, >>> + Soft, >>> + Hard >>> + }; >>> +} >> >> Some comments? > > Will do. > >>> >>> + >>> // >>> = >>> = >>> = >>> ----------------------------------------------------------------------= >>> ==// >>> /// >>> /// TargetMachine - Primary interface to the complete machine >>> description for >>> @@ -88,7 +96,7 @@ >>> TargetMachine(const TargetMachine &); // DO NOT IMPLEMENT >>> void operator=(const TargetMachine &); // DO NOT IMPLEMENT >>> protected: // Can only create subclasses. >>> - TargetMachine() : AsmInfo(0) { } >>> + TargetMachine(); >>> >>> /// getSubtargetImpl - virtual method implemented by subclasses >>> that returns >>> /// a reference to that target's TargetSubtarget-derived member >>> variable. >>> >>> Modified: llvm/trunk/include/llvm/Target/TargetOptions.h >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=73095&r1=73094&r2=73095&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/include/llvm/Target/TargetOptions.h (original) >>> +++ llvm/trunk/include/llvm/Target/TargetOptions.h Mon Jun 8 >>> 17:53:56 2009 >>> @@ -73,6 +73,14 @@ >>> /// target FP instructions. >>> extern bool UseSoftFloat; >>> >>> + /// FloatABIType - This setting is set by -float-abi=xxx option >>> is specfied >>> + /// on the command line. This setting may either be Default, >>> Soft, or Hard. >>> + /// Default selects the target's default behavior. Soft selects >>> the ABI for >>> + /// UseSoftFloat, but does not inidcate that FP hardware may not >>> be used. >>> + /// Such a combination is unfortunately popular (e.g. arm-apple- >>> darwin). >>> + /// Hard presumes that the normal FP ABI is used. >>> + extern FloatABI::ABIType FloatABIType; >> >> Can we add a module note for this? > > Just checking my understanding: you want to extend the IR in > llvm::bitc::ModuleCodes with something new for this? Sorry, I meant adding a note in llvm bitcode. It will be similar to the function notes in llvm/Attributes.h. Some of these which impact all the functions in the modules should be module notes rather than function notes. Devang, have you introduced them yet? Evan > > > I had presumed that passing the default float ABI on the command line > was the way to go. We'll also have to eventually support a recently > added GCC function attribute __attribute__((pcs("aapcs-vfp"))) that > sets the CC for a given function to something other than the default. > (And we get to wonder what it means to set the CC to atpcs when you're > compiling for the ARM ISA and vice versa.) > > deep > >> Evan >> >>> >>> + >>> /// NoZerosInBSS - By default some codegens place zero-initialized >>> data to >>> /// .bss section. This flag disables such behaviour (necessary, >>> e.g. for >>> /// crt*.o compiling). >>> >>> Modified: llvm/trunk/lib/Target/ARM/ARMCallingConv.td >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCallingConv.td?rev=73095&r1=73094&r2=73095&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/ARM/ARMCallingConv.td (original) >>> +++ llvm/trunk/lib/Target/ARM/ARMCallingConv.td Mon Jun 8 17:53:56 >>> 2009 >>> @@ -17,6 +17,11 @@ >>> class CCIfAlign: >>> CCIf; >>> >>> +/// CCIfFloatABI - Match of the float ABI and the arg. ABIType may >>> be "Hard" or >>> +/// "Soft". >>> +class CCIfFloatABI: >>> + CCIf>> ABIType), A>; >>> + >>> // >>> = >>> = >>> = >>> ----------------------------------------------------------------------= >>> ==// >>> // ARM APCS Calling Convention >>> // >>> = >>> = >>> = >>> ----------------------------------------------------------------------= >>> ==// >>> @@ -43,9 +48,10 @@ >>> ]>; >>> >>> // >>> = >>> = >>> = >>> ----------------------------------------------------------------------= >>> ==// >>> -// ARM AAPCS (EABI) Calling Convention >>> +// ARM AAPCS (EABI) Calling Convention, common parts >>> // >>> = >>> = >>> = >>> ----------------------------------------------------------------------= >>> ==// >>> -def CC_ARM_AAPCS : CallingConv<[ >>> + >>> +def CC_ARM_AAPCS_Common : CallingConv<[ >>> >>> CCIfType<[i8, i16], CCPromoteToType>, >>> >>> @@ -53,23 +59,51 @@ >>> // i64 is 8-aligned i32 here, so we may need to eat R1 as a pad >>> register >>> // (and the same is true for f64 if VFP is not enabled) >>> CCIfType<[i32], CCIfAlign<"8", CCAssignToRegWithShadow<[R0, R2], >>> [R0, R1]>>>, >>> - CCIfType<[f64], CCCustom<"CC_ARM_AAPCS_Custom_f64">>, >>> - >>> - CCIfType<[f32], CCBitConvertToType>, >>> CCIfType<[i32], CCIf<"State.getNextStackOffset() == 0 &&" >>> "ArgFlags.getOrigAlign() != 8", >>> CCAssignToReg<[R0, R1, R2, R3]>>>, >>> >>> - CCIfType<[i32], CCAssignToStack<4, 4>>, >>> + CCIfType<[i32, f32], CCAssignToStack<4, 4>>, >>> CCIfType<[f64], CCAssignToStack<8, 8>> >>> ]>; >>> >>> -def RetCC_ARM_AAPCS : CallingConv<[ >>> +def RetCC_ARM_AAPCS_Common : CallingConv<[ >>> + CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>> >>> + CCIfType<[i64], CCAssignToRegWithShadow<[R0, R2], [R1, R3]>> >>> +]>; >>> + >>> +// >>> = >>> = >>> = >>> ----------------------------------------------------------------------= >>> ==// >>> +// ARM AAPCS (EABI) Calling Convention >>> +// >>> = >>> = >>> = >>> ----------------------------------------------------------------------= >>> ==// >>> + >>> +def CC_ARM_AAPCS : CallingConv<[ >>> + CCIfType<[f64], CCCustom<"CC_ARM_AAPCS_Custom_f64">>, >>> CCIfType<[f32], CCBitConvertToType>, >>> + CCDelegateTo >>> +]>; >>> + >>> +def RetCC_ARM_AAPCS : CallingConv<[ >>> CCIfType<[f64], CCCustom<"RetCC_ARM_AAPCS_Custom_f64">>, >>> + CCIfType<[f32], CCBitConvertToType>, >>> + CCDelegateTo >>> +]>; >>> >>> - CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>>, >>> - CCIfType<[i64], CCAssignToRegWithShadow<[R0, R2], [R1, R3]>> >>> +// >>> = >>> = >>> = >>> ----------------------------------------------------------------------= >>> ==// >>> +// ARM AAPCS-VFP (EABI) Calling Convention >>> +// >>> = >>> = >>> = >>> ----------------------------------------------------------------------= >>> ==// >>> + >>> +def CC_ARM_AAPCS_VFP : CallingConv<[ >>> + CCIfType<[f64], CCAssignToReg<[D0, D1, D2, D3, D4, D5, D6, D7]>>, >>> + CCIfType<[f32], CCAssignToReg<[S0, S1, S2, S3, S4, S5, S6, S7, >>> S8, >>> + S9, S10, S11, S12, S13, S14, >>> S15]>>, >>> + CCDelegateTo >>> +]>; >>> + >>> +def RetCC_ARM_AAPCS_VFP : CallingConv<[ >>> + CCIfType<[f64], CCAssignToReg<[D0, D1, D2, D3, D4, D5, D6, D7]>>, >>> + CCIfType<[f32], CCAssignToReg<[S0, S1, S2, S3, S4, S5, S6, S7, >>> S8, >>> + S9, S10, S11, S12, S13, S14, >>> S15]>>, >>> + CCDelegateTo >>> ]>; >>> >>> // >>> = >>> = >>> = >>> ----------------------------------------------------------------------= >>> ==// >>> @@ -77,11 +111,19 @@ >>> // >>> = >>> = >>> = >>> ----------------------------------------------------------------------= >>> ==// >>> >>> def CC_ARM : CallingConv<[ >>> + CCIfSubtarget<"isAAPCS_ABI()", >>> + CCIfSubtarget<"hasVFP2()", >>> + CCIfFloatABI<"Hard", >>> + >>> CCDelegateTo>>>, >>> CCIfSubtarget<"isAAPCS_ABI()", CCDelegateTo>, >>> CCDelegateTo >>> ]>; >>> >>> def RetCC_ARM : CallingConv<[ >>> + CCIfSubtarget<"isAAPCS_ABI()", >>> + CCIfSubtarget<"hasVFP2()", >>> + CCIfFloatABI<"Hard", >>> + >>> CCDelegateTo>>>, >>> CCIfSubtarget<"isAAPCS_ABI()", CCDelegateTo>, >>> CCDelegateTo >>> ]>; >>> >>> Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=73095&r1=73094&r2=73095&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) >>> +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Jun 8 >>> 17:53:56 2009 >>> @@ -549,6 +549,10 @@ >>> switch (N->getOpcode()) { >>> default: break; >>> case ISD::Constant: { >>> + // ARMv6T2 and later should materialize imms via MOV / MOVT >>> pair. >>> + if (Subtarget->hasV6T2Ops()) >>> + break; >>> + >>> unsigned Val = cast(N)->getZExtValue(); >>> bool UseCP = true; >>> if (Subtarget->isThumb()) >>> @@ -559,6 +563,7 @@ >>> UseCP = (ARM_AM::getSOImmVal(Val) == -1 && // MOV >>> ARM_AM::getSOImmVal(~Val) == -1 && // MVN >>> !ARM_AM::isSOImmTwoPartVal(Val)); // two instrs. >>> + >>> if (UseCP) { >>> SDValue CPIdx = >>> CurDAG- >>>> getTargetConstantPool(ConstantInt::get(Type::Int32Ty, Val), >>> @@ -570,7 +575,7 @@ >>> CPIdx, CurDAG- >>>> getEntryNode()); >>> else { >>> SDValue Ops[] = { >>> - CPIdx, >>> + CPIdx, >>> CurDAG->getRegister(0, MVT::i32), >>> CurDAG->getTargetConstant(0, MVT::i32), >>> getAL(CurDAG), >>> @@ -583,7 +588,7 @@ >>> ReplaceUses(Op, SDValue(ResNode, 0)); >>> return NULL; >>> } >>> - >>> + >>> // Other cases are autogenerated. >>> break; >>> } >>> >>> Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=73095&r1=73094&r2=73095&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) >>> +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Jun 8 >>> 17:53:56 2009 >>> @@ -1101,7 +1101,12 @@ >>> else >>> RC = ARM::GPRRegisterClass; >>> >>> - if (RegVT == MVT::f64) { >>> + if (FloatABIType == FloatABI::Hard) { >>> + if (RegVT == MVT::f32) >>> + RC = ARM::SPRRegisterClass; >>> + else if (RegVT == MVT::f64) >>> + RC = ARM::DPRRegisterClass; >>> + } else if (RegVT == MVT::f64) { >>> // f64 is passed in pairs of GPRs and must be combined. >>> RegVT = MVT::i32; >>> } else if (!((RegVT == MVT::i32) || (RegVT == MVT::f32))) >>> >>> Modified: llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td?rev=73095&r1=73094&r2=73095&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td (original) >>> +++ llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td Mon Jun 8 17:53:56 >>> 2009 >>> @@ -219,3 +219,18 @@ >>> >>> // Condition code registers. >>> def CCR : RegisterClass<"ARM", [i32], 32, [CPSR]>; >>> + >>> +// >>> = >>> = >>> = >>> ----------------------------------------------------------------------= >>> ==// >>> +// Subregister Set Definitions... now that we have all of the >>> pieces, define the >>> +// sub registers for each register. >>> +// >>> + >>> +def : SubRegSet<1, [D0, D1, D2, D3, D4, D5, D6, D7, >>> + D8, D9, D10, D11, D12, D13, D14, D15], >>> + [S0, S2, S4, S6, S8, S10, S12, S14, >>> + S16, S18, S20, S22, S24, S26, S28, S30]>; >>> + >>> +def : SubRegSet<2, [D0, D1, D2, D3, D4, D5, D6, D7, >>> + D8, D9, D10, D11, D12, D13, D14, D15], >>> + [S1, S3, S5, S7, S9, S11, S13, S15, >>> + S17, S19, S21, S23, S25, S27, S29, S31]>; >>> >>> Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=73095&r1=73094&r2=73095&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp (original) >>> +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Mon Jun 8 17:53:56 >>> 2009 >>> @@ -14,6 +14,8 @@ >>> #include "ARMSubtarget.h" >>> #include "ARMGenSubtarget.inc" >>> #include "llvm/Module.h" >>> +#include "llvm/Target/TargetMachine.h" >>> +#include "llvm/Target/TargetOptions.h" >>> using namespace llvm; >>> >>> ARMSubtarget::ARMSubtarget(const Module &M, const std::string &FS, >>> @@ -28,6 +30,10 @@ >>> , CPUString("generic") >>> , TargetType(isELF) // Default to ELF unless otherwise specified. >>> , TargetABI(ARM_ABI_APCS) { >>> + // default to soft float ABI >>> + if (FloatABIType == FloatABI::Default) >>> + FloatABIType = FloatABI::Soft; >>> + >>> // Determine default and user specified characteristics >>> >>> // Parse features string. >>> >>> Modified: llvm/trunk/lib/Target/TargetMachine.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=73095&r1=73094&r2=73095&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/TargetMachine.cpp (original) >>> +++ llvm/trunk/lib/Target/TargetMachine.cpp Mon Jun 8 17:53:56 2009 >>> @@ -30,6 +30,7 @@ >>> bool FiniteOnlyFPMathOption; >>> bool HonorSignDependentRoundingFPMathOption; >>> bool UseSoftFloat; >>> + FloatABI::ABIType FloatABIType; >>> bool NoImplicitFloat; >>> bool NoZerosInBSS; >>> bool ExceptionHandling; >>> @@ -84,6 +85,19 @@ >>> cl::desc("Generate software floating point library calls"), >>> cl::location(UseSoftFloat), >>> cl::init(false)); >>> +static cl::opt >>> +FloatABIForCalls("float-abi", >>> + cl::desc("Choose float ABI type"), >>> + cl::location(FloatABIType), >>> + cl::init(FloatABI::Default), >>> + cl::values( >>> + clEnumValN(FloatABI::Default, "default", >>> + "Target default float ABI type"), >>> + clEnumValN(FloatABI::Soft, "soft", >>> + "Soft float ABI (implied by -soft-float)"), >>> + clEnumValN(FloatABI::Hard, "hard", >>> + "Hard float ABI (uses FP registers)"), >>> + clEnumValEnd)); >>> static cl::opt >>> DontPlaceZerosInBSS("nozero-initialized-in-bss", >>> cl::desc("Don't place zero-initialized symbols into bss section"), >>> @@ -162,6 +176,14 @@ >>> // TargetMachine Class >>> // >>> >>> +TargetMachine::TargetMachine() >>> + : AsmInfo(0) { >>> + // Typically it will be subtargets that will adjust FloatABIType >>> from Default >>> + // to Soft or Hard. >>> + if (UseSoftFloat) >>> + FloatABIType = FloatABI::Soft; >>> +} >>> + >>> TargetMachine::~TargetMachine() { >>> delete AsmInfo; >>> } >>> >>> Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=73095&r1=73094&r2=73095&view=diff >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) >>> +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Mon Jun 8 17:53:56 >>> 2009 >>> @@ -350,6 +350,10 @@ >>> , MaxInlineSizeThreshold(128) >>> , Is64Bit(is64Bit) >>> , TargetType(isELF) { // Default to ELF unless otherwise >>> specified. >>> + >>> + // default to hard float ABI >>> + if (FloatABIType == FloatABI::Default) >>> + FloatABIType = FloatABI::Hard; >>> >>> // Determine default and user specified characteristics >>> if (!FS.empty()) { >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Thu Jun 11 12:54:56 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Jun 2009 17:54:56 -0000 Subject: [llvm-commits] [llvm] r73195 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll Message-ID: <200906111754.n5BHsvoo031066@zion.cs.uiuc.edu> Author: lattner Date: Thu Jun 11 12:54:56 2009 New Revision: 73195 URL: http://llvm.org/viewvc/llvm-project?rev=73195&view=rev Log: Fix 4366: store to null in non-default addr space should not be turned into unreachable. Added: llvm/trunk/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=73195&r1=73194&r2=73195&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Jun 11 12:54:56 2009 @@ -11824,7 +11824,8 @@ if (SI.isVolatile()) return 0; // Don't hack volatile stores. // store X, null -> turns into 'unreachable' in SimplifyCFG - if (isa(Ptr)) { + if (isa(Ptr) && + cast(Ptr->getType())->getAddressSpace() == 0) { if (!isa(Val)) { SI.setOperand(0, UndefValue::get(Val->getType())); if (Instruction *U = dyn_cast(Val)) Added: llvm/trunk/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll?rev=73195&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll Thu Jun 11 12:54:56 2009 @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep store +; PR4366 + +define void @a() { + store i32 0, i32 addrspace(1)* null + ret void +} From clattner at apple.com Thu Jun 11 13:06:28 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 11 Jun 2009 11:06:28 -0700 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <521640720906101130t5599eef7lf275ff32d4db9256@mail.gmail.com> References: <521640720906091656v35bd4b6bt9b2b103b939ea628@mail.gmail.com> <521640720906101130t5599eef7lf275ff32d4db9256@mail.gmail.com> Message-ID: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> On Jun 10, 2009, at 11:30 AM, Edward O'Callaghan wrote: > Hi Tanya, > > Hope this is correct; Hi Edward, Please add your entry in CREDITS in alphabetical order. Also, please attach patches as attachments which makes them easier to apply. Thanks! -Chris > > > $ diff -u CREDITS.TXT ../CREDITS.TXT > --- CREDITS.TXT Wed Jun 10 19:15:08 2009 > +++ ../CREDITS.TXT Wed Jun 10 19:22:26 2009 > @@ -8,6 +8,12 @@ > (W), PGP key ID and fingerprint (P), description (D), and snail-mail > address > (S). > > +N: Edward O'Callaghan > +E: eocallaghan at auroraux.org > +W: http://www.auroraux.org > +D: Add Clang support with various other improvements to utils/ > NewNightlyTest.pl > +D: Fix and maintain Solaris & AuroraUX support for llvm, various > build warnings & error clean ups. > + > N: Vikram Adve > E: vadve at cs.uiuc.edu > W: http://www.cs.uiuc.edu/~vadve/ > > --- > and > --- > > $ diff -u NewNightlyTest.pl_old NewNightlyTest.pl > --- NewNightlyTest.pl_old Fri Jun 5 00:19:52 2009 > +++ NewNightlyTest.pl Wed Jun 10 19:25:29 2009 > @@ -11,8 +11,6 @@ > # regressions and performance changes. Submits this > information > # to llvm.org where it is placed into the > nightlytestresults database. > # > -# Modified heavily by Patrick Jenkins, July 2006 > -# > # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] > # where > # OPTIONS may include one or more of the following: > @@ -26,10 +24,12 @@ > # -nodejagnu Do not run feature or regression tests > # -parallel Run parallel jobs with GNU Make (see -parallel- > jobs). > # -parallel-jobs The number of parallel Make jobs to use (default > is two). > +# -with-clang Checkout Clang source into tools/clang. > # -release Build an LLVM Release version > # -release-asserts Build an LLVM ReleaseAsserts version > # -enable-llcbeta Enable testing of beta features in llc. > # -enable-lli Enable testing of lli (interpreter) features, > default is off > +# -disable-pic Disable building with Position > Independent Code. > # -disable-llc Disable LLC tests in the nightly tester. > # -disable-jit Disable JIT tests in the nightly tester. > # -disable-cbe Disable C backend tests in the nightly tester. > @@ -98,7 +98,7 @@ > ############################################################## > my $HOME = $ENV{'HOME'}; > my $SVNURL = $ENV{"SVNURL"}; > -$SVNURL = 'https://llvm.org/svn/llvm-project' unless $SVNURL; > +$SVNURL = 'http://llvm.org/svn/llvm-project' unless $SVNURL; > my $CVSRootDir = $ENV{'CVSROOT'}; > $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; > my $BuildDir = $ENV{'BUILDDIR'}; > @@ -145,6 +145,7 @@ > if (/^-norunningtests$/) { next; } # Backward compatibility, > ignored. > if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; next;} > if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS > -l3.0"; next; } > + if (/^-with-clang$/) { $WITHCLANG = 1; next; } > if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS > ENABLE_OPTIMIZED=1 ". > "OPTIMIZE_OPTION=-O2"; > $BUILDTYPE="release"; next;} > if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS > ENABLE_OPTIMIZED=1 ". > @@ -152,6 +153,7 @@ > "OPTIMIZE_OPTION=-O2"; > $BUILDTYPE="release-asserts"; next;} > if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; > next; } > + if (/^-disable-pic$/) { $CONFIGUREARGS .= " --enable-pic=no"; > next; } > if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; > $CONFIGUREARGS .= " --enable-lli"; > next; } > if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; > @@ -534,13 +536,20 @@ > if (!$NOCHECKOUT) { > if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; } > if ($USESVN) { > - my $SVNCMD = "$NICE svn co $SVNURL"; > - if ($VERBOSE) { > - print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; > " . > + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL"; > + if ($VERBOSE) { > + print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/ > projects ; " . > + "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; > + } > + system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; > " . > "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; > - } > - system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . > - "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; > + if ($WITHCLANG) { > + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL/cfe/ > trunk"; > + if ($VERBOSE) { > + print "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog > 2>&1\n"; > + } > + system "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog > 2>&1\n"; > + } > } else { > my $CVSOPT = ""; > $CVSOPT = "-z3" # Use compression if going over ssh. > @@ -611,7 +620,7 @@ > if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } > > if ($USESVN) { > - @SVNHistory = split / r{$DATE}:HEAD`; > + @SVNHistory = split / --verbose -r{$DATE}:HEAD`; > # Skip very first entry because it is the XML header cruft > shift @SVNHistory; > my $Now = time(); > @@ -717,9 +726,11 @@ > "> $BuildLog 2>&1"; > if ( $VERBOSE ) { > print "BUILD STAGE:\n"; > + print "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1\n"; > print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; > } > # Build the entire tree, capturing the output into $BuildLog > + system "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1"; > system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; > } > > -- > Patrick Jenkins already seems to have a credit in that file. > In regards to AuroraUX/Solaris fixes I been in touch with Duncan and > the IRC for them put backs which have normally been a single line or > so. > > Cheers, > Edward O'Callaghan. > > 2009/6/10 Tanya Lattner : >> >> On Jun 9, 2009, at 4:56 PM, Edward O'Callaghan wrote: >> >> Good day, >> >> Just a few improvements to our Nightly scripts so that they: >> >> * Clean up before each build when not doing a purge of the old >> checkin. >> * Add -disable-pic option for building (needs more testing) >> * Add clang nightly checkin and testing support. >> >> Just my two cent, let me know what you think.. >> >> -bash-3.2$ diff -u NewNightlyTest.pl_old NewNightlyTest.pl >> --- NewNightlyTest.pl_old Fri Jun 5 00:19:52 2009 >> +++ NewNightlyTest.pl Fri Jun 5 13:52:52 2009 >> -12,6 +12,7 @@ >> # to llvm.org where it is placed into the >> nightlytestresults database. >> # >> >> # Modified heavily by Patrick Jenkins, July 2006 >> +# Advanced by Edward O'Callaghan, Jun 2009 >> # >> >> Please remove both lines here and add yourself to the CREDITS.txt. >> We no >> longer put credits in individual files (somehow this did not get >> removed >> during the switch). >> Thanks, >> Tanya >> >> >> # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] >> # where >> -26,10 +27,12 @@ >> # -nodejagnu Do not run feature or regression tests >> # -parallel Run parallel jobs with GNU Make (see -parallel- >> jobs). >> # -parallel-jobs The number of parallel Make jobs to use >> (default is >> two). >> +# -with-clang Checkout Clang source into tools/clang. >> # -release Build an LLVM Release version >> # -release-asserts Build an LLVM ReleaseAsserts version >> # -enable-llcbeta Enable testing of beta features in llc. >> # -enable-lli Enable testing of lli (interpreter) features, >> default is off >> +# -disable-pic Disable building with Position >> Independent Code. >> # -disable-llc Disable LLC tests in the nightly tester. >> # -disable-jit Disable JIT tests in the nightly tester. >> # -disable-cbe Disable C backend tests in the nightly tester. >> -98,7 +101,7 @@ >> ############################################################## >> my $HOME = $ENV{'HOME'}; >> my $SVNURL = $ENV{"SVNURL"}; >> -$SVNURL = 'https://llvm.org/svn/llvm-project' unless $SVNURL; >> +$SVNURL = 'http://llvm.org/svn/llvm-project' unless $SVNURL; >> my $CVSRootDir = $ENV{'CVSROOT'}; >> $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; >> my $BuildDir = $ENV{'BUILDDIR'}; >> -145,6 +148,7 @@ >> if (/^-norunningtests$/) { next; } # Backward compatibility, >> ignored. >> if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; >> next;} >> if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS >> -l3.0"; next; } >> + if (/^-with-clang$/) { $WITHCLANG = 1; next; } >> if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS >> ENABLE_OPTIMIZED=1 ". >> "OPTIMIZE_OPTION=-O2"; >> $BUILDTYPE="release"; next;} >> if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS >> ENABLE_OPTIMIZED=1 ". >> -152,6 +156,7 @@ >> "OPTIMIZE_OPTION=-O2"; >> $BUILDTYPE="release-asserts"; next;} >> if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; >> next; } >> + if (/^-disable-pic$/) { $CONFIGUREARGS .= " --enable-pic=no"; >> next; } >> if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; >> $CONFIGUREARGS .= " --enable-lli"; >> next; } >> if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; >> -534,13 +539,20 @@ >> if (!$NOCHECKOUT) { >> if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; } >> if ($USESVN) { >> - my $SVNCMD = "$NICE svn co $SVNURL"; >> - if ($VERBOSE) { >> - print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; >> " . >> + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL"; >> + if ($VERBOSE) { >> + print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/ >> projects ; " . >> + "$SVNCMD/test-suite/trunk llvm-test ) > $COLog >> 2>&1\n"; >> + } >> + system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/ >> projects ; " . >> "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; >> - } >> - system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; >> " . >> - "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; >> + if ($WITHCLANG) { >> + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL/cfe/ >> trunk"; >> + if ($VERBOSE) { >> + print "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog >> 2>&1\n"; >> + } >> + system "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog >> 2>&1\n"; >> + } >> } else { >> my $CVSOPT = ""; >> $CVSOPT = "-z3" # Use compression if going over ssh. >> -611,7 +623,7 @@ >> if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } >> >> if ($USESVN) { >> - @SVNHistory = split /> -r{$DATE}:HEAD`; >> + @SVNHistory = split /> xml >> --verbose -r{$DATE}:HEAD`; >> # Skip very first entry because it is the XML header cruft >> shift @SVNHistory; >> my $Now = time(); >> -717,9 +729,11 @@ >> "> $BuildLog 2>&1"; >> if ( $VERBOSE ) { >> print "BUILD STAGE:\n"; >> + print "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1\n"; >> print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; >> } >> # Build the entire tree, capturing the output into $BuildLog >> + system "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1"; >> system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; >> } >> >> Cheers, >> Edward. >> >> -- >> -- >> Edward O'Callaghan >> http://www.auroraux.org/ >> eocallaghan at auroraux dot org >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> > > > > -- > -- > Edward O'Callaghan > http://www.auroraux.org/ > eocallaghan at auroraux dot org > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Thu Jun 11 13:17:56 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 11 Jun 2009 11:17:56 -0700 Subject: [llvm-commits] Changing MCE and JCE to modern '_t' style types In-Reply-To: References: Message-ID: <72268CC5-B6C1-4318-9DA5-F2B1CE39D516@apple.com> Looks good. Thanks. Evan On Jun 10, 2009, at 3:36 PM, Aaron Gray wrote: > Here's a patch for the MachineCodeEmitter and JITCodeEmitter > classes, changing older types to '_t' types. > > I have used [u]int64_t types for emitULEB128Bytes() and > emitSLEB128Bytes() methods used for DWARF style EH in JIT. > > We could use a [u]int128_t instead if we defined them properly in > include/llvm/Support/DataTypes.h.in, but 64 bits should be large > enough for the forseeable future :) > > The patch has been tested with 'make check' on Linux. > > Aaron > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Thu Jun 11 13:21:06 2009 From: sabre at nondot.org (Chris Lattner) Date: Thu, 11 Jun 2009 18:21:06 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r73199 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200906111821.n5BIL6g1032024@zion.cs.uiuc.edu> Author: lattner Date: Thu Jun 11 13:21:05 2009 New Revision: 73199 URL: http://llvm.org/viewvc/llvm-project?rev=73199&view=rev Log: Fix a promotion problem on targets where C double is f32. Patch by Mikael Lepist?! Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=73199&r1=73198&r2=73199&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Thu Jun 11 13:21:05 2009 @@ -984,8 +984,8 @@ void HandleScalarArgument(const llvm::Type *LLVMTy, tree type, unsigned RealSize = 0) { if (KNRPromotion) { - if (LLVMTy == Type::FloatTy) - LLVMTy = Type::DoubleTy; + if (type == float_type_node) + LLVMTy = ConvertType(double_type_node); else if (LLVMTy == Type::Int16Ty || LLVMTy == Type::Int8Ty || LLVMTy == Type::Int1Ty) LLVMTy = Type::Int32Ty; From clattner at apple.com Thu Jun 11 13:21:45 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 11 Jun 2009 11:21:45 -0700 Subject: [llvm-commits] [PATCH] KNRPromotion fix when FLOAT_TYPE_SIZE is not smaller than DOUBLE_TYPE_SIZE In-Reply-To: <4A30AC1F.4070407@tut.fi> References: <4A2E5BE5.1050704@tut.fi> <4A300348.7030209@free.fr> <4A30AC1F.4070407@tut.fi> Message-ID: On Jun 11, 2009, at 12:02 AM, Mikael Lepist? wrote: >> That's because float_type_node and double_type_node correspond >> to the C float/double types, while LLVM's FloatTy and DoubleTy >> need not: they correspond to a particular size. You might need >> to look at the main type variant though. >> > Thanks for the comments. Here is updated patch. > > Mikael Lepist? Looks great, applied: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090608/078568.html Thanks, -Chris From clattner at apple.com Thu Jun 11 13:29:32 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 11 Jun 2009 11:29:32 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegisterInfo.td lib/Target/ARM/ARMSubtarget.cpp lib/Target/TargetMachine.cpp lib/Target/X86/X86Subtarget.cpp In-Reply-To: <200906082253.n58Mrvgx002792@zion.cs.uiuc.edu> References: <200906082253.n58Mrvgx002792@zion.cs.uiuc.edu> Message-ID: On Jun 8, 2009, at 3:53 PM, Anton Korobeynikov wrote: > Author: asl > Date: Mon Jun 8 17:53:56 2009 > New Revision: 73095 > > URL: http://llvm.org/viewvc/llvm-project?rev=73095&view=rev > Log: > The attached patches implement most of the ARM AAPCS-VFP hard float > ABI. The missing piece is support for putting "homogeneous aggregates" > into registers. Philosophical question here: shouldn't ABI changes like this be part of the target triple? llvm-gcc already munges a "GNU" target triple into an llvm target triple. Wouldn't it be appropriate to do something like that for this? Do we really support multiple different (and selectable) ABIs on the same triple? -Chris From clattner at apple.com Thu Jun 11 13:32:50 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 11 Jun 2009 11:32:50 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegist In-Reply-To: References: <305d6f60906110010l37762b0br64c9d75b7f149915@mail.gmail.com> Message-ID: On Jun 11, 2009, at 10:38 AM, Evan Cheng wrote: >>>> + /// UseSoftFloat, but does not inidcate that FP hardware may not >>>> be used. >>>> + /// Such a combination is unfortunately popular (e.g. arm-apple- >>>> darwin). >>>> + /// Hard presumes that the normal FP ABI is used. >>>> + extern FloatABI::ABIType FloatABIType; >>> >>> Can we add a module note for this? >> >> Just checking my understanding: you want to extend the IR in >> llvm::bitc::ModuleCodes with something new for this? > > Sorry, I meant adding a note in llvm bitcode. It will be similar to > the function notes in llvm/Attributes.h. Some of these which impact > all the functions in the modules should be module notes rather than > function notes. Devang, have you introduced them yet? Why not put this into the target triple? Major ABI issues like this seem like they belong in the triple. -Chris From clattner at apple.com Thu Jun 11 13:34:14 2009 From: clattner at apple.com (Chris Lattner) Date: Thu, 11 Jun 2009 11:34:14 -0700 Subject: [llvm-commits] [llvm] r73080 - /llvm/trunk/lib/Target/ARM/ARMSubtarget.h In-Reply-To: <200906082031.n58KV2E8029497@zion.cs.uiuc.edu> References: <200906082031.n58KV2E8029497@zion.cs.uiuc.edu> Message-ID: On Jun 8, 2009, at 1:31 PM, Anton Korobeynikov wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=73080&view=rev > Log: > Add helper for checking of Thumb1 mode How about "isThumb1Only()" and "hasThumb2()". If there is every a thumb3, the isThumb2() predicate will return true for it, which seems inconsistent. -Chris > > > Modified: > llvm/trunk/lib/Target/ARM/ARMSubtarget.h > > Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.h?rev=73080&r1=73079&r2=73080&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMSubtarget.h (original) > +++ llvm/trunk/lib/Target/ARM/ARMSubtarget.h Mon Jun 8 15:31:02 2009 > @@ -105,6 +105,7 @@ > bool isAAPCS_ABI() const { return TargetABI == ARM_ABI_AAPCS; } > > bool isThumb() const { return IsThumb; } > + bool isThumb1() const { return IsThumb && (ThumbMode == Thumb1); } > bool isThumb2() const { return IsThumb && (ThumbMode >= Thumb2); } > > bool useThumbBacktraces() const { return UseThumbBacktraces; } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Thu Jun 11 13:52:14 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 11 Jun 2009 11:52:14 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegist In-Reply-To: References: <305d6f60906110010l37762b0br64c9d75b7f149915@mail.gmail.com> Message-ID: <41FF1606-AC7C-496F-BDFA-9A9BBFE9606B@apple.com> On Jun 11, 2009, at 11:32 AM, Chris Lattner wrote: > > On Jun 11, 2009, at 10:38 AM, Evan Cheng wrote: > >>>>> + /// UseSoftFloat, but does not inidcate that FP hardware may >>>>> not >>>>> be used. >>>>> + /// Such a combination is unfortunately popular (e.g. arm- >>>>> apple- >>>>> darwin). >>>>> + /// Hard presumes that the normal FP ABI is used. >>>>> + extern FloatABI::ABIType FloatABIType; >>>> >>>> Can we add a module note for this? >>> >>> Just checking my understanding: you want to extend the IR in >>> llvm::bitc::ModuleCodes with something new for this? >> >> Sorry, I meant adding a note in llvm bitcode. It will be similar to >> the function notes in llvm/Attributes.h. Some of these which impact >> all the functions in the modules should be module notes rather than >> function notes. Devang, have you introduced them yet? > > Why not put this into the target triple? Major ABI issues like this > seem like they belong in the triple. It's not always clear what information we want to encode in triplet. In this case, it seems reasonable to encode float abi in the triplet. But how do we want encode this? Do we want to use it to toggle fp abi for any target, e.g. arm-apple-darwin-apcs? Evan > > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From eocallaghan at auroraux.org Thu Jun 11 13:56:35 2009 From: eocallaghan at auroraux.org (Edward O'Callaghan) Date: Thu, 11 Jun 2009 19:56:35 +0100 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: References: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> Message-ID: <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> Hi Chris, Sorry but, you may not have noticed that the CREDITS file is *not* in alphabetical order. If you wish to sort it then OK, but I don't have that kind of time sorry. The other patch is attached as a file as requested. Best Regards, Edward. 2009/6/11 Chris Lattner : > > > Begin forwarded message: > >> From: Chris Lattner >> Date: June 11, 2009 11:06:28 AM PDT >> To: Commit Messages and Patches for LLVM >> Subject: Re: [llvm-commits] Various improvements to NewNightlyTest.pl >> Reply-To: Commit Messages and Patches for LLVM >> >> >> On Jun 10, 2009, at 11:30 AM, Edward O'Callaghan wrote: >> >>> Hi Tanya, >>> >>> Hope this is correct; >> >> Hi Edward, >> >> Please add your entry in CREDITS in alphabetical order. ?Also, please >> attach patches as attachments which makes them easier to apply. ?Thanks! >> >> -Chris >>> >>> >>> $ diff -u CREDITS.TXT ../CREDITS.TXT >>> --- CREDITS.TXT Wed Jun 10 19:15:08 2009 >>> +++ ../CREDITS.TXT ? ? ?Wed Jun 10 19:22:26 2009 >>> @@ -8,6 +8,12 @@ >>> (W), PGP key ID and fingerprint (P), description (D), and snail-mail >>> address >>> (S). >>> >>> +N: Edward O'Callaghan >>> +E: eocallaghan at auroraux.org >>> +W: http://www.auroraux.org >>> +D: Add Clang support with various other improvements to utils/ >>> NewNightlyTest.pl >>> +D: Fix and maintain Solaris & AuroraUX support for llvm, various >>> build warnings & error clean ups. >>> + >>> N: Vikram Adve >>> E: vadve at cs.uiuc.edu >>> W: http://www.cs.uiuc.edu/~vadve/ >>> >>> --- >>> and >>> --- >>> >>> $ diff -u NewNightlyTest.pl_old NewNightlyTest.pl >>> --- NewNightlyTest.pl_old ? ? ? Fri Jun ?5 00:19:52 2009 >>> +++ NewNightlyTest.pl ? Wed Jun 10 19:25:29 2009 >>> @@ -11,8 +11,6 @@ >>> # ? ? ? ? ? regressions and performance changes. Submits this >>> information >>> # ? ? ? ? ? to llvm.org where it is placed into the >>> nightlytestresults database. >>> # >>> -# Modified heavily by Patrick Jenkins, July 2006 >>> -# >>> # Syntax: ? NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] >>> # ? where >>> # OPTIONS may include one or more of the following: >>> @@ -26,10 +24,12 @@ >>> # ?-nodejagnu ? ? ? Do not run feature or regression tests >>> # ?-parallel ? ? ? ?Run parallel jobs with GNU Make (see -parallel- >>> jobs). >>> # ?-parallel-jobs ? The number of parallel Make jobs to use (default >>> is two). >>> +# ?-with-clang ? ? ?Checkout Clang source into tools/clang. >>> # ?-release ? ? ? ? Build an LLVM Release version >>> # ?-release-asserts Build an LLVM ReleaseAsserts version >>> # ?-enable-llcbeta ?Enable testing of beta features in llc. >>> # ?-enable-lli ? ? ?Enable testing of lli (interpreter) features, >>> default is off >>> +# ?-disable-pic ? ? ? ? ? ?Disable building with Position >>> Independent Code. >>> # ?-disable-llc ? ? Disable LLC tests in the nightly tester. >>> # ?-disable-jit ? ? Disable JIT tests in the nightly tester. >>> # ?-disable-cbe ? ? Disable C backend tests in the nightly tester. >>> @@ -98,7 +98,7 @@ >>> ############################################################## >>> my $HOME ? ? ? = $ENV{'HOME'}; >>> my $SVNURL ? ? = $ENV{"SVNURL"}; >>> -$SVNURL ? ? ? ?= 'https://llvm.org/svn/llvm-project' unless $SVNURL; >>> +$SVNURL ? ? ? ?= 'http://llvm.org/svn/llvm-project' unless $SVNURL; >>> my $CVSRootDir = $ENV{'CVSROOT'}; >>> $CVSRootDir ? ?= "/home/vadve/shared/PublicCVS" unless $CVSRootDir; >>> my $BuildDir ? = $ENV{'BUILDDIR'}; >>> @@ -145,6 +145,7 @@ >>> ?if (/^-norunningtests$/) { next; } # Backward compatibility, >>> ignored. >>> ?if (/^-parallel-jobs$/) ?{ $PARALLELJOBS = "$ARGV[0]"; shift; next;} >>> ?if (/^-parallel$/) ? ? ? { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS >>> -l3.0"; next; } >>> + ?if (/^-with-clang$/) ? ? { $WITHCLANG = 1; next; } >>> ?if (/^-release$/) ? ? ? ?{ $MAKEOPTS = "$MAKEOPTS >>> ENABLE_OPTIMIZED=1 ". >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ?"OPTIMIZE_OPTION=-O2"; >>> $BUILDTYPE="release"; next;} >>> ?if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS >>> ENABLE_OPTIMIZED=1 ". >>> @@ -152,6 +153,7 @@ >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ?"OPTIMIZE_OPTION=-O2"; >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ?$BUILDTYPE="release-asserts"; next;} >>> ?if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; >>> next; } >>> + ?if (/^-disable-pic$/) ? ?{ $CONFIGUREARGS .= " --enable-pic=no"; >>> next; } >>> ?if (/^-enable-lli$/) ? ? { $PROGTESTOPTS .= " ENABLE_LLI=1"; >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ?$CONFIGUREARGS .= " --enable-lli"; >>> next; } >>> ?if (/^-disable-llc$/) ? ?{ $PROGTESTOPTS .= " DISABLE_LLC=1"; >>> @@ -534,13 +536,20 @@ >>> if (!$NOCHECKOUT) { >>> ?if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; } >>> ?if ($USESVN) { >>> - ? ?my $SVNCMD = "$NICE svn co $SVNURL"; >>> - ? ?if ($VERBOSE) { >>> - ? ? ?print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; >>> " . >>> + ? ? ?my $SVNCMD = "$NICE svn co --non-interactive $SVNURL"; >>> + ? ? ?if ($VERBOSE) { >>> + ? ? ? ?print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/ >>> projects ; " . >>> + ? ? ? ? ? ? ?"$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; >>> + ? ? ?} >>> + ? ? ?system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; >>> " . >>> ? ? ? ? ? "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; >>> - ? ?} >>> - ? ?system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . >>> - ? ? ? ? ?"$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; >>> + ? ? ? if ($WITHCLANG) { >>> + ? ? ? ? my $SVNCMD = "$NICE svn co --non-interactive $SVNURL/cfe/ >>> trunk"; >>> + ? ? ? ? if ($VERBOSE) { >>> + ? ? ? ? ?print "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog >>> 2>&1\n"; >>> + ? ? ? } >>> + ? ? ? system "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog >>> 2>&1\n"; >>> + ? ? ? } >>> ?} else { >>> ? my $CVSOPT = ""; >>> ? $CVSOPT = "-z3" # Use compression if going over ssh. >>> @@ -611,7 +620,7 @@ >>> ?if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } >>> >>> ?if ($USESVN) { >>> - ? ?@SVNHistory = split />> r{$DATE}:HEAD`; >>> + ? ?@SVNHistory = split />> --verbose -r{$DATE}:HEAD`; >>> ? # Skip very first entry because it is the XML header cruft >>> ? shift @SVNHistory; >>> ? my $Now = time(); >>> @@ -717,9 +726,11 @@ >>> ? ? ? ?"> $BuildLog 2>&1"; >>> ?if ( $VERBOSE ) { >>> ? print "BUILD STAGE:\n"; >>> + ? ?print "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1\n"; >>> ? print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; >>> ?} >>> ?# Build the entire tree, capturing the output into $BuildLog >>> + ?system "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1"; >>> ?system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; >>> } >>> >>> -- >>> Patrick Jenkins already seems to have a credit in that file. >>> In regards to AuroraUX/Solaris fixes I been in touch with Duncan and >>> the IRC for them put backs which have normally been a single line or >>> so. >>> >>> Cheers, >>> Edward O'Callaghan. >>> >>> 2009/6/10 Tanya Lattner : >>>> >>>> On Jun 9, 2009, at 4:56 PM, Edward O'Callaghan wrote: >>>> >>>> Good day, >>>> >>>> Just a few improvements to our Nightly scripts so that they: >>>> >>>> * Clean up before each build when not doing a purge of the old >>>> checkin. >>>> * Add -disable-pic option for building (needs more testing) >>>> * Add clang nightly checkin and testing support. >>>> >>>> Just my two cent, let me know what you think.. >>>> >>>> -bash-3.2$ diff -u NewNightlyTest.pl_old NewNightlyTest.pl >>>> --- NewNightlyTest.pl_old ? ? ? Fri Jun ?5 00:19:52 2009 >>>> +++ NewNightlyTest.pl ? Fri Jun ?5 13:52:52 2009 >>>> -12,6 +12,7 @@ >>>> # ? ? ? ? ? to llvm.org where it is placed into the >>>> nightlytestresults database. >>>> # >>>> >>>> # Modified heavily by Patrick Jenkins, July 2006 >>>> +# Advanced by Edward O'Callaghan, Jun 2009 >>>> # >>>> >>>> Please remove both lines here and add yourself to the CREDITS.txt. >>>> We no >>>> longer put credits in individual files (somehow this did not get >>>> removed >>>> during the switch). >>>> Thanks, >>>> Tanya >>>> >>>> >>>> # Syntax: ? NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] >>>> # ? where >>>> -26,10 +27,12 @@ >>>> # ?-nodejagnu ? ? ? Do not run feature or regression tests >>>> # ?-parallel ? ? ? ?Run parallel jobs with GNU Make (see -parallel- >>>> jobs). >>>> # ?-parallel-jobs ? The number of parallel Make jobs to use >>>> (default is >>>> two). >>>> +# ?-with-clang ? ? ?Checkout Clang source into tools/clang. >>>> # ?-release ? ? ? ? Build an LLVM Release version >>>> # ?-release-asserts Build an LLVM ReleaseAsserts version >>>> # ?-enable-llcbeta ?Enable testing of beta features in llc. >>>> # ?-enable-lli ? ? ?Enable testing of lli (interpreter) features, >>>> default is off >>>> +# ?-disable-pic ? ? ? ? ? ?Disable building with Position >>>> Independent Code. >>>> # ?-disable-llc ? ? Disable LLC tests in the nightly tester. >>>> # ?-disable-jit ? ? Disable JIT tests in the nightly tester. >>>> # ?-disable-cbe ? ? Disable C backend tests in the nightly tester. >>>> -98,7 +101,7 @@ >>>> ############################################################## >>>> my $HOME ? ? ? = $ENV{'HOME'}; >>>> my $SVNURL ? ? = $ENV{"SVNURL"}; >>>> -$SVNURL ? ? ? ?= 'https://llvm.org/svn/llvm-project' unless $SVNURL; >>>> +$SVNURL ? ? ? ?= 'http://llvm.org/svn/llvm-project' unless $SVNURL; >>>> my $CVSRootDir = $ENV{'CVSROOT'}; >>>> $CVSRootDir ? ?= "/home/vadve/shared/PublicCVS" unless $CVSRootDir; >>>> my $BuildDir ? = $ENV{'BUILDDIR'}; >>>> -145,6 +148,7 @@ >>>> ?if (/^-norunningtests$/) { next; } # Backward compatibility, >>>> ignored. >>>> ?if (/^-parallel-jobs$/) ?{ $PARALLELJOBS = "$ARGV[0]"; shift; >>>> next;} >>>> ?if (/^-parallel$/) ? ? ? { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS >>>> -l3.0"; next; } >>>> + ?if (/^-with-clang$/) ? ? { $WITHCLANG = 1; next; } >>>> ?if (/^-release$/) ? ? ? ?{ $MAKEOPTS = "$MAKEOPTS >>>> ENABLE_OPTIMIZED=1 ". >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ?"OPTIMIZE_OPTION=-O2"; >>>> $BUILDTYPE="release"; next;} >>>> ?if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS >>>> ENABLE_OPTIMIZED=1 ". >>>> -152,6 +156,7 @@ >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ?"OPTIMIZE_OPTION=-O2"; >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ?$BUILDTYPE="release-asserts"; next;} >>>> ?if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; >>>> next; } >>>> + ?if (/^-disable-pic$/) ? ?{ $CONFIGUREARGS .= " --enable-pic=no"; >>>> next; } >>>> ?if (/^-enable-lli$/) ? ? { $PROGTESTOPTS .= " ENABLE_LLI=1"; >>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ?$CONFIGUREARGS .= " --enable-lli"; >>>> next; } >>>> ?if (/^-disable-llc$/) ? ?{ $PROGTESTOPTS .= " DISABLE_LLC=1"; >>>> -534,13 +539,20 @@ >>>> if (!$NOCHECKOUT) { >>>> ?if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; } >>>> ?if ($USESVN) { >>>> - ? ?my $SVNCMD = "$NICE svn co $SVNURL"; >>>> - ? ?if ($VERBOSE) { >>>> - ? ? ?print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; >>>> " . >>>> + ? ? ?my $SVNCMD = "$NICE svn co --non-interactive $SVNURL"; >>>> + ? ? ?if ($VERBOSE) { >>>> + ? ? ? ?print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/ >>>> projects ; " . >>>> + ? ? ? ? ? ? ?"$SVNCMD/test-suite/trunk llvm-test ) > $COLog >>>> 2>&1\n"; >>>> + ? ? ?} >>>> + ? ? ?system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/ >>>> projects ; " . >>>> ? ? ? ? ? "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; >>>> - ? ?} >>>> - ? ?system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; >>>> " . >>>> - ? ? ? ? ?"$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; >>>> + ? ? ? if ($WITHCLANG) { >>>> + ? ? ? ? my $SVNCMD = "$NICE svn co --non-interactive $SVNURL/cfe/ >>>> trunk"; >>>> + ? ? ? ? if ($VERBOSE) { >>>> + ? ? ? ? ?print "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog >>>> 2>&1\n"; >>>> + ? ? ? } >>>> + ? ? ? system "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog >>>> 2>&1\n"; >>>> + ? ? ? } >>>> ?} else { >>>> ? my $CVSOPT = ""; >>>> ? $CVSOPT = "-z3" # Use compression if going over ssh. >>>> -611,7 +623,7 @@ >>>> ?if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } >>>> >>>> ?if ($USESVN) { >>>> - ? ?@SVNHistory = split />>> -r{$DATE}:HEAD`; >>>> + ? ?@SVNHistory = split />>> xml >>>> --verbose -r{$DATE}:HEAD`; >>>> ? # Skip very first entry because it is the XML header cruft >>>> ? shift @SVNHistory; >>>> ? my $Now = time(); >>>> -717,9 +729,11 @@ >>>> ? ? ? ?"> $BuildLog 2>&1"; >>>> ?if ( $VERBOSE ) { >>>> ? print "BUILD STAGE:\n"; >>>> + ? ?print "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1\n"; >>>> ? print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; >>>> ?} >>>> ?# Build the entire tree, capturing the output into $BuildLog >>>> + ?system "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1"; >>>> ?system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; >>>> } >>>> >>>> Cheers, >>>> Edward. >>>> >>>> -- >>>> -- >>>> Edward O'Callaghan >>>> http://www.auroraux.org/ >>>> eocallaghan at auroraux dot org >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> >>>> >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> >>>> >>> >>> >>> >>> -- >>> -- >>> Edward O'Callaghan >>> http://www.auroraux.org/ >>> eocallaghan at auroraux dot org >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > -- -- Edward O'Callaghan http://www.auroraux.org/ eocallaghan at auroraux dot org -------------- next part -------------- A non-text attachment was scrubbed... Name: NewNightlyTest.pl.patch Type: application/octet-stream Size: 4698 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090611/083bf58a/attachment.obj From isanbard at gmail.com Thu Jun 11 14:15:20 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Jun 2009 12:15:20 -0700 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> References: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> Message-ID: <00F2DF2F-C994-4904-86DA-32BDFA8622E7@gmail.com> On Jun 11, 2009, at 11:56 AM, Edward O'Callaghan wrote: > Hi Chris, > > Sorry but, you may not have noticed that the CREDITS file is *not* in > alphabetical order. > If you wish to sort it then OK, but I don't have that kind of time > sorry. > Well, let's try to not make it worse than it is now. :-) -bw From bruno.cardoso at gmail.com Thu Jun 11 14:16:04 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Thu, 11 Jun 2009 19:16:04 -0000 Subject: [llvm-commits] [llvm] r73201 - in /llvm/trunk: include/llvm/Target/TargetELFWriterInfo.h lib/CodeGen/ELF.h lib/CodeGen/ELFCodeEmitter.cpp lib/CodeGen/ELFWriter.cpp lib/CodeGen/ELFWriter.h lib/Target/X86/X86ELFWriterInfo.cpp lib/Target/X86/X86ELFWriterInfo.h lib/Target/X86/X86TargetMachine.cpp Message-ID: <200906111916.n5BJG4DN001215@zion.cs.uiuc.edu> Author: bruno Date: Thu Jun 11 14:16:03 2009 New Revision: 73201 URL: http://llvm.org/viewvc/llvm-project?rev=73201&view=rev Log: Support for ELF Visibility Emission for globals, using the correct data sections Function alignment can be computed for each target using TargetELFWriterInfo Some small fixes Modified: llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h llvm/trunk/lib/CodeGen/ELF.h llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp llvm/trunk/lib/CodeGen/ELFWriter.cpp llvm/trunk/lib/CodeGen/ELFWriter.h llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Modified: llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h?rev=73201&r1=73200&r2=73201&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h Thu Jun 11 14:16:03 2009 @@ -14,6 +14,10 @@ #ifndef LLVM_TARGET_TARGETELFWRITERINFO_H #define LLVM_TARGET_TARGETELFWRITERINFO_H +#include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/Function.h" + namespace llvm { //===--------------------------------------------------------------------===// @@ -21,9 +25,11 @@ //===--------------------------------------------------------------------===// class TargetELFWriterInfo { + protected: // EMachine - This field is the target specific value to emit as the // e_machine member of the ELF header. unsigned short EMachine; + TargetMachine &TM; public: // Machine architectures @@ -44,10 +50,21 @@ EM_X86_64 = 62 // AMD64 }; - explicit TargetELFWriterInfo(MachineType machine) : EMachine(machine) {} + explicit TargetELFWriterInfo(TargetMachine &tm) : TM(tm) {} virtual ~TargetELFWriterInfo() {} unsigned short getEMachine() const { return EMachine; } + + /// getFunctionAlignment - Returns the alignment for function 'F', targets + /// with different alignment constraints should overload this method + virtual unsigned getFunctionAlignment(const Function *F) const { + const TargetData *TD = TM.getTargetData(); + unsigned FnAlign = F->getAlignment(); + unsigned TDAlign = TD->getPointerABIAlignment(); + unsigned Align = std::max(FnAlign, TDAlign); + assert(!(Align & (Align-1)) && "Alignment is not a power of two!"); + return Align; + } }; } // end llvm namespace Modified: llvm/trunk/lib/CodeGen/ELF.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELF.h?rev=73201&r1=73200&r2=73201&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELF.h (original) +++ llvm/trunk/lib/CodeGen/ELF.h Thu Jun 11 14:16:03 2009 @@ -21,12 +21,12 @@ #ifndef CODEGEN_ELF_H #define CODEGEN_ELF_H +#include "llvm/GlobalVariable.h" #include "llvm/CodeGen/MachineRelocation.h" #include "llvm/Support/DataTypes.h" #include namespace llvm { - class GlobalVariable; // Identification Indexes enum { @@ -100,18 +100,20 @@ /// table at the end of the file. struct ELFSection { + // Name of the section + std::string Name; + // ELF specific fields - std::string Name; // Name of the section. - unsigned NameIdx; // Index in .shstrtab of name, once emitted. - unsigned Type; - unsigned Flags; - uint64_t Addr; - unsigned Offset; - unsigned Size; - unsigned Link; - unsigned Info; - unsigned Align; - unsigned EntSize; + unsigned NameIdx; // sh_name - .shstrtab idx of name, once emitted. + unsigned Type; // sh_type - Section contents & semantics + unsigned Flags; // sh_flags - Section flags. + uint64_t Addr; // sh_addr - The mem addr this section is in. + unsigned Offset; // sh_offset - Offset from the file start + unsigned Size; // sh_size - The section size. + unsigned Link; // sh_link - Section header table index link. + unsigned Info; // sh_info - Auxillary information. + unsigned Align; // sh_addralign - Alignment of section. + unsigned EntSize; // sh_entsize - Size of entries in the section e // Section Header Flags enum { @@ -207,9 +209,33 @@ STT_FILE = 4 }; + enum { + STV_DEFAULT = 0, // Visibility is specified by binding type + STV_INTERNAL = 1, // Defined by processor supplements + STV_HIDDEN = 2, // Not visible to other components + STV_PROTECTED = 3 // Visible in other components but not preemptable + }; + ELFSym(const GlobalValue *gv) : GV(gv), NameIdx(0), Value(0), Size(0), Info(0), Other(0), - SectionIdx(ELFSection::SHN_UNDEF) {} + SectionIdx(ELFSection::SHN_UNDEF) { + if (!GV) + return; + + switch (GV->getVisibility()) { + default: + assert(0 && "unknown visibility type"); + case GlobalValue::DefaultVisibility: + Other = STV_DEFAULT; + break; + case GlobalValue::HiddenVisibility: + Other = STV_HIDDEN; + break; + case GlobalValue::ProtectedVisibility: + Other = STV_PROTECTED; + break; + } + } void SetBind(unsigned X) { assert(X == (X & 0xF) && "Bind value out of range!"); @@ -219,6 +245,9 @@ assert(X == (X & 0xF) && "Type value out of range!"); Info = (Info & 0xF0) | X; } + + static unsigned getEntrySize(bool is64Bit) + { return is64Bit ? 24 : 16; } }; } // end namespace llvm Modified: llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp?rev=73201&r1=73200&r2=73201&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp Thu Jun 11 14:16:03 2009 @@ -15,7 +15,6 @@ #include "llvm/Function.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" -#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Debug.h" @@ -28,27 +27,21 @@ /// startFunction - This callback is invoked when a new machine function is /// about to be emitted. void ELFCodeEmitter::startFunction(MachineFunction &MF) { - const TargetData *TD = TM.getTargetData(); - const Function *F = MF.getFunction(); - - // Align the output buffer to the appropriate alignment, power of 2. - unsigned FnAlign = F->getAlignment(); - unsigned TDAlign = TD->getPrefTypeAlignment(F->getType()); - unsigned Align = std::max(FnAlign, TDAlign); - assert(!(Align & (Align-1)) && "Alignment is not a power of two!"); - // Get the ELF Section that this function belongs in. ES = &EW.getTextSection(); + DOUT << "processing function: " << MF.getFunction()->getName() << "\n"; + // FIXME: better memory management, this will be replaced by BinaryObjects ES->SectionData.reserve(4096); BufferBegin = &ES->SectionData[0]; BufferEnd = BufferBegin + ES->SectionData.capacity(); - // Upgrade the section alignment if required. + // Align the output buffer with function alignment, and + // upgrade the section alignment if required + unsigned Align = + TM.getELFWriterInfo()->getFunctionAlignment(MF.getFunction()); if (ES->Align < Align) ES->Align = Align; - - // Round the size up to the correct alignment for starting the new function. ES->Size = (ES->Size + (Align-1)) & (-Align); // Snaity check on allocated space for text section Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=73201&r1=73200&r2=73201&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Thu Jun 11 14:16:03 2009 @@ -26,9 +26,6 @@ // ... // #N. ".shstrtab" entry - String table for the section names. // -// NOTE: This code should eventually be extended to support 64-bit ELF (this -// won't be hard), but we haven't done so yet! -// //===----------------------------------------------------------------------===// #define DEBUG_TYPE "elfwriter" @@ -36,6 +33,7 @@ #include "ELFWriter.h" #include "ELFCodeEmitter.h" #include "ELF.h" +#include "llvm/Constants.h" #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/DerivedTypes.h" @@ -44,10 +42,8 @@ #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/Target/TargetData.h" -#include "llvm/Target/TargetELFWriterInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Mangler.h" -#include "llvm/Support/OutputBuffer.h" #include "llvm/Support/Streams.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Debug.h" @@ -76,6 +72,7 @@ ElfHdr = new ELFHeader(TM.getELFWriterInfo()->getEMachine(), 0, is64Bit, isLittleEndian); + TAI = TM.getTargetAsmInfo(); // Create the machine code emitter object for this target. MCE = new ELFCodeEmitter(*this); @@ -152,6 +149,11 @@ } void ELFWriter::EmitGlobal(GlobalVariable *GV) { + + // XXX: put local symbols *before* global ones! + const Section *S = TAI->SectionForGlobal(GV); + DOUT << "Section " << S->getName() << " for global " << GV->getName() << "\n"; + // If this is an external global, emit it now. TODO: Note that it would be // better to ignore the symbol here and only add it to the symbol table if // referenced. @@ -164,13 +166,13 @@ return; } - unsigned Align = TM.getTargetData()->getPreferredAlignment(GV); - unsigned Size = - TM.getTargetData()->getTypeAllocSize(GV->getType()->getElementType()); - - // If this global has a zero initializer, it is part of the .bss or common - // section. - if (GV->getInitializer()->isNullValue()) { + const TargetData *TD = TM.getTargetData(); + unsigned Align = TD->getPreferredAlignment(GV); + Constant *CV = GV->getInitializer(); + unsigned Size = TD->getTypeAllocSize(CV->getType()); + + // If this global has a zero initializer, go to .bss or common section. + if (CV->isNullValue() || isa(CV)) { // If this global is part of the common block, add it now. Variables are // part of the common block if they are zero initialized and allowed to be // merged with other symbols. @@ -182,14 +184,14 @@ CommonSym.Size = Size; CommonSym.SetBind(ELFSym::STB_GLOBAL); CommonSym.SetType(ELFSym::STT_OBJECT); - // TODO SOMEDAY: add ELF visibility. CommonSym.SectionIdx = ELFSection::SHN_COMMON; SymbolTable.push_back(CommonSym); + getSection(S->getName(), ELFSection::SHT_NOBITS, + ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC, 1); return; } // Otherwise, this symbol is part of the .bss section. Emit it now. - // Handle alignment. Ensure section is aligned at least as much as required // by this symbol. ELFSection &BSSSection = getBSSSection(); @@ -227,11 +229,124 @@ return; } - // FIXME: handle .rodata - //assert(!GV->isConstant() && "unimp"); + /// Emit the Global symbol to the right ELF section + ELFSym GblSym(GV); + GblSym.Size = Size; + GblSym.SetType(ELFSym::STT_OBJECT); + GblSym.SetBind(ELFSym::STB_GLOBAL); + unsigned Flags = S->getFlags(); + unsigned SectType = ELFSection::SHT_PROGBITS; + unsigned SHdrFlags = ELFSection::SHF_ALLOC; + + if (Flags & SectionFlags::Code) + SHdrFlags |= ELFSection::SHF_EXECINSTR; + if (Flags & SectionFlags::Writeable) + SHdrFlags |= ELFSection::SHF_WRITE; + if (Flags & SectionFlags::Mergeable) + SHdrFlags |= ELFSection::SHF_MERGE; + if (Flags & SectionFlags::TLS) + SHdrFlags |= ELFSection::SHF_TLS; + if (Flags & SectionFlags::Strings) + SHdrFlags |= ELFSection::SHF_STRINGS; + + // Remove tab from section name prefix + std::string SectionName(S->getName()); + size_t Pos = SectionName.find("\t"); + if (Pos != std::string::npos) + SectionName.erase(Pos, 1); + + // The section alignment should be bound to the element with + // the largest alignment + ELFSection &ElfS = getSection(SectionName, SectType, SHdrFlags); + GblSym.SectionIdx = ElfS.SectionIdx; + if (Align > ElfS.Align) + ElfS.Align = Align; + + DataBuffer &GblCstBuf = ElfS.SectionData; + OutputBuffer GblCstTab(GblCstBuf, is64Bit, isLittleEndian); + + // S.Value should contain the symbol index inside the section, + // and all symbols should start on their required alignment boundary + GblSym.Value = (GblCstBuf.size() + (Align-1)) & (-Align); + GblCstBuf.insert(GblCstBuf.end(), GblSym.Value-GblCstBuf.size(), 0); + + // Emit the constant symbol to its section + EmitGlobalConstant(CV, GblCstTab); + SymbolTable.push_back(GblSym); +} + +void ELFWriter::EmitGlobalConstantStruct(const ConstantStruct *CVS, + OutputBuffer &GblCstTab) { + + // Print the fields in successive locations. Pad to align if needed! + const TargetData *TD = TM.getTargetData(); + unsigned Size = TD->getTypeAllocSize(CVS->getType()); + const StructLayout *cvsLayout = TD->getStructLayout(CVS->getType()); + uint64_t sizeSoFar = 0; + for (unsigned i = 0, e = CVS->getNumOperands(); i != e; ++i) { + const Constant* field = CVS->getOperand(i); + + // Check if padding is needed and insert one or more 0s. + uint64_t fieldSize = TD->getTypeAllocSize(field->getType()); + uint64_t padSize = ((i == e-1 ? Size : cvsLayout->getElementOffset(i+1)) + - cvsLayout->getElementOffset(i)) - fieldSize; + sizeSoFar += fieldSize + padSize; + + // Now print the actual field value. + EmitGlobalConstant(field, GblCstTab); + + // Insert padding - this may include padding to increase the size of the + // current field up to the ABI size (if the struct is not packed) as well + // as padding to ensure that the next field starts at the right offset. + for (unsigned p=0; p < padSize; p++) + GblCstTab.outbyte(0); + } + assert(sizeSoFar == cvsLayout->getSizeInBytes() && + "Layout of constant struct may be incorrect!"); +} - // FIXME: handle .data - //assert(0 && "unimp"); +void ELFWriter::EmitGlobalConstant(const Constant *CV, OutputBuffer &GblCstTab) { + const TargetData *TD = TM.getTargetData(); + unsigned Size = TD->getTypeAllocSize(CV->getType()); + + if (const ConstantArray *CVA = dyn_cast(CV)) { + if (CVA->isString()) { + std::string GblStr = CVA->getAsString(); + GblCstTab.outstring(GblStr, GblStr.length()); + } else { // Not a string. Print the values in successive locations + for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i) + EmitGlobalConstant(CVA->getOperand(i), GblCstTab); + } + return; + } else if (const ConstantStruct *CVS = dyn_cast(CV)) { + EmitGlobalConstantStruct(CVS, GblCstTab); + return; + } else if (const ConstantFP *CFP = dyn_cast(CV)) { + uint64_t Val = CFP->getValueAPF().bitcastToAPInt().getZExtValue(); + if (CFP->getType() == Type::DoubleTy) + GblCstTab.outxword(Val); + else if (CFP->getType() == Type::FloatTy) + GblCstTab.outword(Val); + else if (CFP->getType() == Type::X86_FP80Ty) { + assert(0 && "X86_FP80Ty global emission not implemented"); + } else if (CFP->getType() == Type::PPC_FP128Ty) + assert(0 && "PPC_FP128Ty global emission not implemented"); + return; + } else if (const ConstantInt *CI = dyn_cast(CV)) { + if (Size == 4) + GblCstTab.outword(CI->getZExtValue()); + else if (Size == 8) + GblCstTab.outxword(CI->getZExtValue()); + else + assert(0 && "LargeInt global emission not implemented"); + return; + } else if (const ConstantVector *CP = dyn_cast(CV)) { + const VectorType *PTy = CP->getType(); + for (unsigned I = 0, E = PTy->getNumElements(); I < E; ++I) + EmitGlobalConstant(CP->getOperand(I), GblCstTab); + return; + } + assert(0 && "unknown global constant"); } @@ -243,12 +358,27 @@ /// doFinalization - Now that the module has been completely processed, emit /// the ELF file to 'O'. bool ELFWriter::doFinalization(Module &M) { - // Okay, the ELF header and .text sections have been completed, build the - // .data, .bss, and "common" sections next. + /// FIXME: This should be removed when moving to BinaryObjects. Since the + /// current ELFCodeEmiter uses CurrBuff, ... it doesn't update S.SectionData + /// vector size for .text sections, so this is a quick dirty fix + ELFSection &TS = getTextSection(); + if (TS.Size) + for (unsigned e=0; egetNonexecutableStackDirective()) + getSection(".note.GNU-stack", ELFSection::SHT_PROGBITS, 0, 1); + // Emit the symbol table now, if non-empty. EmitSymbolTable(); @@ -274,6 +404,51 @@ void ELFWriter::EmitRelocations() { } +/// EmitSymbol - Write symbol 'Sym' to the symbol table 'SymTabOut' +void ELFWriter::EmitSymbol(OutputBuffer &SymTabOut, ELFSym &Sym) { + if (is64Bit) { + SymTabOut.outword(Sym.NameIdx); + SymTabOut.outbyte(Sym.Info); + SymTabOut.outbyte(Sym.Other); + SymTabOut.outhalf(Sym.SectionIdx); + SymTabOut.outaddr64(Sym.Value); + SymTabOut.outxword(Sym.Size); + } else { + SymTabOut.outword(Sym.NameIdx); + SymTabOut.outaddr32(Sym.Value); + SymTabOut.outword(Sym.Size); + SymTabOut.outbyte(Sym.Info); + SymTabOut.outbyte(Sym.Other); + SymTabOut.outhalf(Sym.SectionIdx); + } +} + +/// EmitSectionHeader - Write section 'Section' header in 'TableOut' +/// Section Header Table +void ELFWriter::EmitSectionHeader(OutputBuffer &TableOut, const ELFSection &S) { + TableOut.outword(S.NameIdx); + TableOut.outword(S.Type); + if (is64Bit) { + TableOut.outxword(S.Flags); + TableOut.outaddr(S.Addr); + TableOut.outaddr(S.Offset); + TableOut.outxword(S.Size); + TableOut.outword(S.Link); + TableOut.outword(S.Info); + TableOut.outxword(S.Align); + TableOut.outxword(S.EntSize); + } else { + TableOut.outword(S.Flags); + TableOut.outaddr(S.Addr); + TableOut.outaddr(S.Offset); + TableOut.outword(S.Size); + TableOut.outword(S.Link); + TableOut.outword(S.Info); + TableOut.outword(S.Align); + TableOut.outword(S.EntSize); + } +} + /// EmitSymbolTable - If the current symbol table is non-empty, emit the string /// table for it and then the symbol table itself. void ELFWriter::EmitSymbolTable() { @@ -282,14 +457,13 @@ // FIXME: compact all local symbols to the start of the symtab. unsigned FirstNonLocalSymbol = 1; - ELFSection &StrTab = getSection(".strtab", ELFSection::SHT_STRTAB, 0); - StrTab.Align = 1; - + ELFSection &StrTab = getStringTableSection(); DataBuffer &StrTabBuf = StrTab.SectionData; OutputBuffer StrTabOut(StrTabBuf, is64Bit, isLittleEndian); // Set the zero'th symbol to a null byte, as required. StrTabOut.outbyte(0); + unsigned Index = 1; for (unsigned i = 1, e = SymbolTable.size(); i != e; ++i) { // Use the name mangler to uniquify the LLVM symbol. @@ -315,35 +489,19 @@ // Now that we have emitted the string table and know the offset into the // string table of each symbol, emit the symbol table itself. - ELFSection &SymTab = getSection(".symtab", ELFSection::SHT_SYMTAB, 0); + ELFSection &SymTab = getSymbolTableSection(); SymTab.Align = is64Bit ? 8 : 4; SymTab.Link = StrTab.SectionIdx; // Section Index of .strtab. SymTab.Info = FirstNonLocalSymbol; // First non-STB_LOCAL symbol. - SymTab.EntSize = is64Bit ? 24 : 16; // Size of each symtab entry. + + // Size of each symtab entry. + SymTab.EntSize = ELFSym::getEntrySize(is64Bit); + DataBuffer &SymTabBuf = SymTab.SectionData; OutputBuffer SymTabOut(SymTabBuf, is64Bit, isLittleEndian); - if (!is64Bit) { // 32-bit and 64-bit formats are shuffled a bit. - for (unsigned i = 0, e = SymbolTable.size(); i != e; ++i) { - ELFSym &Sym = SymbolTable[i]; - SymTabOut.outword(Sym.NameIdx); - SymTabOut.outaddr32(Sym.Value); - SymTabOut.outword(Sym.Size); - SymTabOut.outbyte(Sym.Info); - SymTabOut.outbyte(Sym.Other); - SymTabOut.outhalf(Sym.SectionIdx); - } - } else { - for (unsigned i = 0, e = SymbolTable.size(); i != e; ++i) { - ELFSym &Sym = SymbolTable[i]; - SymTabOut.outword(Sym.NameIdx); - SymTabOut.outbyte(Sym.Info); - SymTabOut.outbyte(Sym.Other); - SymTabOut.outhalf(Sym.SectionIdx); - SymTabOut.outaddr64(Sym.Value); - SymTabOut.outxword(Sym.Size); - } - } + for (unsigned i = 0, e = SymbolTable.size(); i != e; ++i) + EmitSymbol(SymTabOut, SymbolTable[i]); SymTab.Size = SymTabBuf.size(); } @@ -393,7 +551,7 @@ // Pass #1: Compute the file offset for each section. size_t FileOff = FileHeader.size(); // File header first. - // Emit all of the section data in order. + // Adjust alignment of all section if needed. for (std::list::iterator I = SectionList.begin(), E = SectionList.end(); I != E; ++I) { @@ -401,6 +559,11 @@ if (!I->SectionIdx) continue; + if (!I->SectionData.size()) { + I->Offset = FileOff; + continue; + } + // Update Section size if (!I->Size) I->Size = I->SectionData.size(); @@ -438,30 +601,24 @@ // Emit all of the section data and build the section table itself. while (!SectionList.empty()) { const ELFSection &S = *SectionList.begin(); + DOUT << "SectionIdx: " << S.SectionIdx << ", Name: " << S.Name + << ", Size: " << S.Size << ", Offset: " << S.Offset + << ", SectionData Size: " << S.SectionData.size() << "\n"; + // Align FileOff to whatever the alignment restrictions of the section are. - if (S.Align) + if (S.Align) { for (size_t NewFileOff = (FileOff+S.Align-1) & ~(S.Align-1); FileOff != NewFileOff; ++FileOff) O << (char)0xAB; - O.write((char*)&S.SectionData[0], S.Size); - - DOUT << "SectionIdx: " << S.SectionIdx << ", Name: " << S.Name - << ", Size: " << S.Size << ", Offset: " << S.Offset << "\n"; - - FileOff += S.Size; + } - TableOut.outword(S.NameIdx); // sh_name - Symbol table name idx - TableOut.outword(S.Type); // sh_type - Section contents & semantics - TableOut.outaddr(S.Flags); // sh_flags - Section flags. - TableOut.outaddr(S.Addr); // sh_addr - The mem addr this section is in. - TableOut.outaddr(S.Offset); // sh_offset - Offset from the file start. - TableOut.outaddr(S.Size); // sh_size - The section size. - TableOut.outword(S.Link); // sh_link - Section header table index link. - TableOut.outword(S.Info); // sh_info - Auxillary information. - TableOut.outaddr(S.Align); // sh_addralign - Alignment of section. - TableOut.outaddr(S.EntSize); // sh_entsize - Size of entries in the section + if (S.SectionData.size()) { + O.write((char*)&S.SectionData[0], S.Size); + FileOff += S.Size; + } + EmitSectionHeader(TableOut, S); SectionList.pop_front(); } Modified: llvm/trunk/lib/CodeGen/ELFWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.h?rev=73201&r1=73200&r2=73201&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.h (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.h Thu Jun 11 14:16:03 2009 @@ -16,15 +16,19 @@ #include "llvm/ADT/SetVector.h" #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/Support/OutputBuffer.h" +#include "llvm/Target/TargetAsmInfo.h" +#include "llvm/Target/TargetELFWriterInfo.h" #include "ELF.h" #include #include namespace llvm { + class ConstantStruct; + class ELFCodeEmitter; class GlobalVariable; class Mangler; class MachineCodeEmitter; - class ELFCodeEmitter; class raw_ostream; /// ELFWriter - This class implements the common target-independent code for @@ -59,6 +63,10 @@ /// code for functions to the .o file. ELFCodeEmitter *MCE; + /// TAI - Target Asm Info, provide information about section names for + /// globals and other target specific stuff. + const TargetAsmInfo *TAI; + //===------------------------------------------------------------------===// // Properties inferred automatically from the target machine. //===------------------------------------------------------------------===// @@ -97,8 +105,8 @@ /// getSection - Return the section with the specified name, creating a new /// section if one does not already exist. - ELFSection &getSection(const std::string &Name, - unsigned Type, unsigned Flags = 0) { + ELFSection &getSection(const std::string &Name, unsigned Type, + unsigned Flags = 0, unsigned Align = 0) { ELFSection *&SN = SectionLookup[Name]; if (SN) return *SN; @@ -108,6 +116,7 @@ SN->Type = Type; SN->Flags = Flags; SN->Link = ELFSection::SHN_UNDEF; + SN->Align = Align; return *SN; } @@ -116,10 +125,19 @@ ELFSection::SHF_EXECINSTR | ELFSection::SHF_ALLOC); } + ELFSection &getSymbolTableSection() { + return getSection(".symtab", ELFSection::SHT_SYMTAB, 0); + } + + ELFSection &getStringTableSection() { + return getSection(".strtab", ELFSection::SHT_STRTAB, 0, 1); + } + ELFSection &getDataSection() { return getSection(".data", ELFSection::SHT_PROGBITS, ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC); } + ELFSection &getBSSSection() { return getSection(".bss", ELFSection::SHT_NOBITS, ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC); @@ -144,9 +162,14 @@ unsigned ELFHdr_e_shnum_Offset; // e_shnum in ELF header. private: void EmitGlobal(GlobalVariable *GV); - void EmitSymbolTable(); + void EmitGlobalConstant(const Constant *C, OutputBuffer &GblCstTab); + void EmitGlobalConstantStruct(const ConstantStruct *CVS, + OutputBuffer &GblCstTab); void EmitRelocations(); + void EmitSectionHeader(OutputBuffer &TableOut, const ELFSection &Section); void EmitSectionTableStringTable(); + void EmitSymbol(OutputBuffer &SymTabOut, ELFSym &Sym); + void EmitSymbolTable(); void OutputSectionsAndSectionTable(); }; } Modified: llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp?rev=73201&r1=73200&r2=73201&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp Thu Jun 11 14:16:03 2009 @@ -12,8 +12,26 @@ //===----------------------------------------------------------------------===// #include "X86ELFWriterInfo.h" +#include "llvm/Target/TargetMachine.h" +#include "llvm/DerivedTypes.h" using namespace llvm; -X86ELFWriterInfo::X86ELFWriterInfo(bool is64Bit) : - TargetELFWriterInfo(is64Bit ? EM_X86_64 : EM_386) {} +X86ELFWriterInfo::X86ELFWriterInfo(TargetMachine &TM) + : TargetELFWriterInfo(TM) { + bool is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64; + EMachine = is64Bit ? EM_X86_64 : EM_386; + } + X86ELFWriterInfo::~X86ELFWriterInfo() {} + +unsigned X86ELFWriterInfo::getFunctionAlignment(const Function *F) const { + unsigned FnAlign = 4; + + if (F->hasFnAttr(Attribute::OptimizeForSize)) + FnAlign = 1; + + if (F->getAlignment()) + FnAlign = Log2_32(F->getAlignment()); + + return (1 << FnAlign); +} Modified: llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h?rev=73201&r1=73200&r2=73201&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h Thu Jun 11 14:16:03 2009 @@ -20,8 +20,10 @@ class X86ELFWriterInfo : public TargetELFWriterInfo { public: - X86ELFWriterInfo(bool is64Bit); + X86ELFWriterInfo(TargetMachine &TM); virtual ~X86ELFWriterInfo(); + + virtual unsigned getFunctionAlignment(const Function *F) const; }; } // end llvm namespace Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.cpp?rev=73201&r1=73200&r2=73201&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetMachine.cpp Thu Jun 11 14:16:03 2009 @@ -133,8 +133,7 @@ DataLayout(Subtarget.getDataLayout()), FrameInfo(TargetFrameInfo::StackGrowsDown, Subtarget.getStackAlignment(), Subtarget.is64Bit() ? -8 : -4), - InstrInfo(*this), JITInfo(*this), TLInfo(*this), - ELFWriterInfo(Subtarget.is64Bit()) { + InstrInfo(*this), JITInfo(*this), TLInfo(*this), ELFWriterInfo(*this) { DefRelocModel = getRelocationModel(); // FIXME: Correctly select PIC model for Win64 stuff if (getRelocationModel() == Reloc::Default) { From eli.friedman at gmail.com Thu Jun 11 14:16:12 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Thu, 11 Jun 2009 12:16:12 -0700 Subject: [llvm-commits] [llvm] r73195 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll In-Reply-To: <200906111754.n5BHsvoo031066@zion.cs.uiuc.edu> References: <200906111754.n5BHsvoo031066@zion.cs.uiuc.edu> Message-ID: On Thu, Jun 11, 2009 at 10:54 AM, Chris Lattner wrote: > --- llvm/trunk/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll (added) > +++ llvm/trunk/test/Transforms/InstCombine/2009-06-11-StoreAddrSpace.ll Thu Jun 11 12:54:56 2009 > @@ -0,0 +1,7 @@ > +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep store > +; PR4366 > + > +define void @a() { > + ?store i32 0, i32 addrspace(1)* null > + ?ret void > +} This testcase passes even without the patch. -Eli From baldrick at free.fr Thu Jun 11 14:18:23 2009 From: baldrick at free.fr (Duncan Sands) Date: Thu, 11 Jun 2009 21:18:23 +0200 Subject: [llvm-commits] [PATCH] KNRPromotion fix when FLOAT_TYPE_SIZE is not smaller than DOUBLE_TYPE_SIZE In-Reply-To: <4A30AC1F.4070407@tut.fi> References: <4A2E5BE5.1050704@tut.fi> <4A300348.7030209@free.fr> <4A30AC1F.4070407@tut.fi> Message-ID: <4A31587F.8080905@free.fr> Hi Mikael, > Thanks for the comments. Here is updated patch. does it handle the case when the argument is const qualified? Ciao, Duncan. From isanbard at gmail.com Thu Jun 11 15:10:09 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Jun 2009 20:10:09 -0000 Subject: [llvm-commits] [llvm] r73202 - /llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Message-ID: <200906112010.n5BKACZS003173@zion.cs.uiuc.edu> Author: void Date: Thu Jun 11 15:10:02 2009 New Revision: 73202 URL: http://llvm.org/viewvc/llvm-project?rev=73202&view=rev Log: Remove unused parameter warnings. Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=73202&r1=73201&r2=73202&view=diff ============================================================================== --- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original) +++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Thu Jun 11 15:10:02 2009 @@ -243,7 +243,7 @@ } // The JIT overrides a version that actually does this. - virtual void runJITOnFunction(Function *F, MachineCodeInfo *MCI = 0) { } + virtual void runJITOnFunction(Function *, MachineCodeInfo * = 0) { } /// getGlobalValueAtAddress - Return the LLVM global value object that starts /// at the specified address. From isanbard at gmail.com Thu Jun 11 15:13:41 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Jun 2009 20:13:41 -0000 Subject: [llvm-commits] [llvm] r73203 - /llvm/trunk/CREDITS.TXT Message-ID: <200906112013.n5BKDiE8003287@zion.cs.uiuc.edu> Author: void Date: Thu Jun 11 15:13:35 2009 New Revision: 73203 URL: http://llvm.org/viewvc/llvm-project?rev=73203&view=rev Log: Alphabetize. Modified: llvm/trunk/CREDITS.TXT Modified: llvm/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=73203&r1=73202&r2=73203&view=diff ============================================================================== --- llvm/trunk/CREDITS.TXT (original) +++ llvm/trunk/CREDITS.TXT Thu Jun 11 15:13:35 2009 @@ -148,10 +148,6 @@ E: patjenk at wam.umd.edu D: Nightly Tester -N: Brad Jones -E: kungfoomaster at nondot.org -D: Support for packed types - N: Dale Johannesen E: dalej at apple.com D: ARM constant islands improvements @@ -160,6 +156,10 @@ D: Use APFloat for floating point constants widely throughout compiler D: Implement X87 long double +N: Brad Jones +E: kungfoomaster at nondot.org +D: Support for packed types + N: Eric Kidd W: http://randomhacks.net/ D: llvm-config script @@ -290,8 +290,4 @@ N: Bill Wendling E: isanbard at gmail.com -D: Machine LICM -D: Darwin exception handling -D: MMX & SSSE3 instructions -D: SPEC2006 support - +D: Bunches of stuff From isanbard at gmail.com Thu Jun 11 15:18:15 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Jun 2009 13:18:15 -0700 Subject: [llvm-commits] [llvm] r73201 - in /llvm/trunk: include/llvm/Target/TargetELFWriterInfo.h lib/CodeGen/ELF.h lib/CodeGen/ELFCodeEmitter.cpp lib/CodeGen/ELFWriter.cpp lib/CodeGen/ELFWriter.h lib/Target/X86/X86ELFWriterInfo.cpp lib/Target/X86/X86ELFWriterInfo.h lib/Target/X86/X86TargetMachine.cpp In-Reply-To: <200906111916.n5BJG4DN001215@zion.cs.uiuc.edu> References: <200906111916.n5BJG4DN001215@zion.cs.uiuc.edu> Message-ID: <692C3C10-7CBE-4DDF-AEE0-2D0529C930EF@gmail.com> On Jun 11, 2009, at 12:16 PM, Bruno Cardoso Lopes wrote: > Author: bruno > Date: Thu Jun 11 14:16:03 2009 > New Revision: 73201 > > URL: http://llvm.org/viewvc/llvm-project?rev=73201&view=rev > Log: > Support for ELF Visibility > Emission for globals, using the correct data sections > Function alignment can be computed for each target using > TargetELFWriterInfo > Some small fixes > > > Modified: > llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h > llvm/trunk/lib/CodeGen/ELF.h > llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp > llvm/trunk/lib/CodeGen/ELFWriter.cpp > llvm/trunk/lib/CodeGen/ELFWriter.h > llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp > llvm/trunk/lib/Target/X86/X86ELFWriterInfo.h > llvm/trunk/lib/Target/X86/X86TargetMachine.cpp > > Modified: llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h?rev=73201&r1=73200&r2=73201&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h (original) > +++ llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h Thu Jun 11 > 14:16:03 2009 > @@ -14,6 +14,10 @@ > #ifndef LLVM_TARGET_TARGETELFWRITERINFO_H > #define LLVM_TARGET_TARGETELFWRITERINFO_H > > +#include "llvm/Target/TargetData.h" > +#include "llvm/Target/TargetMachine.h" > +#include "llvm/Function.h" > + > namespace llvm { > > // > = > = > =-------------------------------------------------------------------- > ===// > @@ -21,9 +25,11 @@ > // > = > = > =-------------------------------------------------------------------- > ===// > > class TargetELFWriterInfo { > + protected: > // EMachine - This field is the target specific value to emit as > the > // e_machine member of the ELF header. > unsigned short EMachine; > + TargetMachine &TM; > public: > > // Machine architectures > @@ -44,10 +50,21 @@ > EM_X86_64 = 62 // AMD64 > }; > > - explicit TargetELFWriterInfo(MachineType machine) : > EMachine(machine) {} > + explicit TargetELFWriterInfo(TargetMachine &tm) : TM(tm) {} > virtual ~TargetELFWriterInfo() {} > > unsigned short getEMachine() const { return EMachine; } > + > + /// getFunctionAlignment - Returns the alignment for function > 'F', targets > + /// with different alignment constraints should overload this > method > + virtual unsigned getFunctionAlignment(const Function *F) const { > + const TargetData *TD = TM.getTargetData(); > + unsigned FnAlign = F->getAlignment(); > + unsigned TDAlign = TD->getPointerABIAlignment(); > + unsigned Align = std::max(FnAlign, TDAlign); > + assert(!(Align & (Align-1)) && "Alignment is not a power of > two!"); > + return Align; > + } > }; > Instead of pulling all of the headers into this header, why not forward declare the classes and then make this method out-of-line? -bw From dalej at apple.com Thu Jun 11 15:47:34 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 11 Jun 2009 20:47:34 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r73205 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200906112047.n5BKlZ7E004305@zion.cs.uiuc.edu> Author: johannes Date: Thu Jun 11 15:47:34 2009 New Revision: 73205 URL: http://llvm.org/viewvc/llvm-project?rev=73205&view=rev Log: Make sure converting a ComponentRef within a Constant returns a result of the right type, as does a convert of a normal ComponentRef. PR 4349. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=73205&r1=73204&r2=73205&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Jun 11 15:47:34 2009 @@ -7529,8 +7529,9 @@ Ptr = TheFolder->CreateAdd(Ptr, Offset); FieldPtr = TheFolder->CreateIntToPtr(Ptr, PointerType::getUnqual(FieldTy)); } - - if (isBitfield(FieldDecl)) + + // Make sure we return a result of the right type. + if (PointerType::getUnqual(FieldTy) != FieldPtr->getType()) FieldPtr = TheFolder->CreateBitCast(FieldPtr, PointerType::getUnqual(FieldTy)); From dalej at apple.com Thu Jun 11 15:48:10 2009 From: dalej at apple.com (Dale Johannesen) Date: Thu, 11 Jun 2009 20:48:10 -0000 Subject: [llvm-commits] [llvm] r73206 - /llvm/trunk/test/FrontendC/pr4349.c Message-ID: <200906112048.n5BKmAVh004341@zion.cs.uiuc.edu> Author: johannes Date: Thu Jun 11 15:48:09 2009 New Revision: 73206 URL: http://llvm.org/viewvc/llvm-project?rev=73206&view=rev Log: Test for rev 73205 (PR 4349) Added: llvm/trunk/test/FrontendC/pr4349.c Added: llvm/trunk/test/FrontendC/pr4349.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/pr4349.c?rev=73206&view=auto ============================================================================== --- llvm/trunk/test/FrontendC/pr4349.c (added) +++ llvm/trunk/test/FrontendC/pr4349.c Thu Jun 11 15:48:09 2009 @@ -0,0 +1,39 @@ +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars2 | grep {\\\[2 x \\\[2 x i8\\\]\\\]} +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars2 | grep {i32 1} | count 1 +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars3 | grep {\\\[2 x i16\\\]} +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars3 | grep {i32 1} | count 1 +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars4 | grep {\\\[2 x \\\[2 x i8\\\]\\\]} | count 1 +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars4 | grep {i32 1, i32 1} | count 1 +// PR 4349 + +union reg +{ + unsigned char b[2][2]; + unsigned short w[2]; + unsigned int d; +}; +struct cpu +{ + union reg pc; +}; +extern struct cpu cpu; +struct svar +{ + void *ptr; +}; +struct svar svars1[] = +{ + { &((cpu.pc).w[0]) } +}; +struct svar svars2[] = +{ + { &((cpu.pc).b[0][1]) } +}; +struct svar svars3[] = +{ + { &((cpu.pc).w[1]) } +}; +struct svar svars4[] = +{ + { &((cpu.pc).b[1][1]) } +}; From bob.wilson at apple.com Thu Jun 11 16:33:44 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Thu, 11 Jun 2009 14:33:44 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegist In-Reply-To: <41FF1606-AC7C-496F-BDFA-9A9BBFE9606B@apple.com> References: <305d6f60906110010l37762b0br64c9d75b7f149915@mail.gmail.com> <41FF1606-AC7C-496F-BDFA-9A9BBFE9606B@apple.com> Message-ID: On Jun 11, 2009, at 11:52 AM, Evan Cheng wrote: > > On Jun 11, 2009, at 11:32 AM, Chris Lattner wrote: >> >> Why not put this into the target triple? Major ABI issues like this >> seem like they belong in the triple. > > It's not always clear what information we want to encode in triplet. > In this case, it seems reasonable to encode float abi in the triplet. > But how do we want encode this? Do we want to use it to toggle fp abi > for any target, e.g. arm-apple-darwin-apcs? Since target triples are a GNU thing, it would be a good idea to be compatible with GCC on this. I know that for the base AAPCS ABI GCC uses an "eabi" suffix on the OS portion of the triple, e.g., arm-linux- gnueabi. When I last worked on GCC, it had no support for the "hardfloat" AAPCS ABI, but I heard that it was added since then. Does anyone know if GCC uses something in the triple ("eabi-hardfloat" suffix??) to indicate this? Since this fp ABI is an extension of AAPCS, it would only make sense to allow toggling something in the target triple for targets that use AAPCS (not Darwin). From bruno.cardoso at gmail.com Thu Jun 11 17:13:00 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Thu, 11 Jun 2009 22:13:00 -0000 Subject: [llvm-commits] [llvm] r73209 - in /llvm/trunk: include/llvm/Target/TargetELFWriterInfo.h lib/Target/CMakeLists.txt lib/Target/TargetELFWriterInfo.cpp lib/Target/X86/X86ELFWriterInfo.cpp Message-ID: <200906112213.n5BMD0sm006772@zion.cs.uiuc.edu> Author: bruno Date: Thu Jun 11 17:13:00 2009 New Revision: 73209 URL: http://llvm.org/viewvc/llvm-project?rev=73209&view=rev Log: Use forward declarations and move TargetELFWriterInfo impl to a new file. Added: llvm/trunk/lib/Target/TargetELFWriterInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h llvm/trunk/lib/Target/CMakeLists.txt llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h?rev=73209&r1=73208&r2=73209&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h Thu Jun 11 17:13:00 2009 @@ -14,11 +14,10 @@ #ifndef LLVM_TARGET_TARGETELFWRITERINFO_H #define LLVM_TARGET_TARGETELFWRITERINFO_H -#include "llvm/Target/TargetData.h" -#include "llvm/Target/TargetMachine.h" -#include "llvm/Function.h" - namespace llvm { + class Function; + class TargetData; + class TargetMachine; //===--------------------------------------------------------------------===// // TargetELFWriterInfo @@ -50,21 +49,14 @@ EM_X86_64 = 62 // AMD64 }; - explicit TargetELFWriterInfo(TargetMachine &tm) : TM(tm) {} - virtual ~TargetELFWriterInfo() {} + explicit TargetELFWriterInfo(TargetMachine &tm); + virtual ~TargetELFWriterInfo(); unsigned short getEMachine() const { return EMachine; } /// getFunctionAlignment - Returns the alignment for function 'F', targets /// with different alignment constraints should overload this method - virtual unsigned getFunctionAlignment(const Function *F) const { - const TargetData *TD = TM.getTargetData(); - unsigned FnAlign = F->getAlignment(); - unsigned TDAlign = TD->getPointerABIAlignment(); - unsigned Align = std::max(FnAlign, TDAlign); - assert(!(Align & (Align-1)) && "Alignment is not a power of two!"); - return Align; - } + virtual unsigned getFunctionAlignment(const Function *F) const; }; } // end llvm namespace Modified: llvm/trunk/lib/Target/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CMakeLists.txt?rev=73209&r1=73208&r2=73209&view=diff ============================================================================== --- llvm/trunk/lib/Target/CMakeLists.txt (original) +++ llvm/trunk/lib/Target/CMakeLists.txt Thu Jun 11 17:13:00 2009 @@ -5,6 +5,7 @@ Target.cpp TargetAsmInfo.cpp TargetData.cpp + TargetELFWriterInfo.cpp TargetFrameInfo.cpp TargetInstrInfo.cpp TargetMachOWriterInfo.cpp @@ -14,4 +15,4 @@ TargetSubtarget.cpp ) -# TODO: Support other targets besides X86. See Makefile. \ No newline at end of file +# TODO: Support other targets besides X86. See Makefile. Added: llvm/trunk/lib/Target/TargetELFWriterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetELFWriterInfo.cpp?rev=73209&view=auto ============================================================================== --- llvm/trunk/lib/Target/TargetELFWriterInfo.cpp (added) +++ llvm/trunk/lib/Target/TargetELFWriterInfo.cpp Thu Jun 11 17:13:00 2009 @@ -0,0 +1,33 @@ +//===-- lib/Target/TargetELFWriterInfo.cpp - ELF Writer Info --0-*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the TargetELFWriterInfo class. +// +//===----------------------------------------------------------------------===// + +#include "llvm/Function.h" +#include "llvm/Target/TargetELFWriterInfo.h" +#include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetMachine.h" +using namespace llvm; + +TargetELFWriterInfo::TargetELFWriterInfo(TargetMachine &tm) : TM(tm) {} + +TargetELFWriterInfo::~TargetELFWriterInfo() {} + +/// getFunctionAlignment - Returns the alignment for function 'F', targets +/// with different alignment constraints should overload this method +unsigned TargetELFWriterInfo::getFunctionAlignment(const Function *F) const { + const TargetData *TD = TM.getTargetData(); + unsigned FnAlign = F->getAlignment(); + unsigned TDAlign = TD->getPointerABIAlignment(); + unsigned Align = std::max(FnAlign, TDAlign); + assert(!(Align & (Align-1)) && "Alignment is not a power of two!"); + return Align; +} Modified: llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp?rev=73209&r1=73208&r2=73209&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ELFWriterInfo.cpp Thu Jun 11 17:13:00 2009 @@ -12,8 +12,9 @@ //===----------------------------------------------------------------------===// #include "X86ELFWriterInfo.h" +#include "llvm/Function.h" +#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/DerivedTypes.h" using namespace llvm; X86ELFWriterInfo::X86ELFWriterInfo(TargetMachine &TM) From bruno.cardoso at gmail.com Thu Jun 11 17:13:28 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Thu, 11 Jun 2009 19:13:28 -0300 Subject: [llvm-commits] [llvm] r73201 - in /llvm/trunk: include/llvm/Target/TargetELFWriterInfo.h lib/CodeGen/ELF.h lib/CodeGen/ELFCodeEmitter.cpp lib/CodeGen/ELFWriter.cpp lib/CodeGen/ELFWriter.h lib/Target/X86/X86ELFWriterInfo.cpp lib/Target/X86/X86ELFW Message-ID: <275e64e40906111513u24be5b9alde35cf1a7087a84e@mail.gmail.com> > Instead of pulling all of the headers into this header, why not > forward declare the classes and then make this method out-of-line? done. Thanks Bill -- Bruno Cardoso Lopes http://www.brunocardoso.cc From eocallaghan at auroraux.org Thu Jun 11 17:59:47 2009 From: eocallaghan at auroraux.org (Edward O'Callaghan) Date: Thu, 11 Jun 2009 23:59:47 +0100 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <00F2DF2F-C994-4904-86DA-32BDFA8622E7@gmail.com> References: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> <00F2DF2F-C994-4904-86DA-32BDFA8622E7@gmail.com> Message-ID: <521640720906111559n682a58a6r7371c85c1485b83@mail.gmail.com> Gezz, Your just making it hard for people to do work on llvm/clang by being so pedantic! I have taken note, so just please integrate the code changes so things may progress on the Solaris port. I hope this is optimal ;( I also added a note about the order in which the second names should be submitted too for others. Thank you, Edward. 2009/6/11 Bill Wendling : > On Jun 11, 2009, at 11:56 AM, Edward O'Callaghan wrote: > >> Hi Chris, >> >> Sorry but, you may not have noticed that the CREDITS file is *not* in >> alphabetical order. >> If you wish to sort it then OK, but I don't have that kind of time >> sorry. >> > Well, let's try to not make it worse than it is now. :-) > > -bw > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- -- Edward O'Callaghan http://www.auroraux.org/ eocallaghan at auroraux dot org -------------- next part -------------- A non-text attachment was scrubbed... Name: CREDITS.TXT.patch Type: application/octet-stream Size: 939 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090611/c4e98fcc/attachment.obj From eli.friedman at gmail.com Thu Jun 11 18:07:04 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Thu, 11 Jun 2009 23:07:04 -0000 Subject: [llvm-commits] [llvm] r73210 - /llvm/trunk/lib/Target/X86/README.txt Message-ID: <200906112307.n5BN74PA008445@zion.cs.uiuc.edu> Author: efriedma Date: Thu Jun 11 18:07:04 2009 New Revision: 73210 URL: http://llvm.org/viewvc/llvm-project?rev=73210&view=rev Log: Misc x86 README updates: remove a couple of already-fixed issues, add a few suggestions from looking at some assembly code. Modified: llvm/trunk/lib/Target/X86/README.txt Modified: llvm/trunk/lib/Target/X86/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=73210&r1=73209&r2=73210&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Thu Jun 11 18:07:04 2009 @@ -482,35 +482,6 @@ //===---------------------------------------------------------------------===// -Currently we don't have elimination of redundant stack manipulations. Consider -the code: - -int %main() { -entry: - call fastcc void %test1( ) - call fastcc void %test2( sbyte* cast (void ()* %test1 to sbyte*) ) - ret int 0 -} - -declare fastcc void %test1() - -declare fastcc void %test2(sbyte*) - - -This currently compiles to: - - subl $16, %esp - call _test5 - addl $12, %esp - subl $16, %esp - movl $_test5, (%esp) - call _test6 - addl $12, %esp - -The add\sub pair is really unneeded here. - -//===---------------------------------------------------------------------===// - Consider the expansion of: define i32 @test3(i32 %X) { @@ -902,34 +873,6 @@ //===---------------------------------------------------------------------===// -We aren't matching RMW instructions aggressively -enough. Here's a reduced testcase (more in PR1160): - -define void @test(i32* %huge_ptr, i32* %target_ptr) { - %A = load i32* %huge_ptr ; [#uses=1] - %B = load i32* %target_ptr ; [#uses=1] - %C = or i32 %A, %B ; [#uses=1] - store i32 %C, i32* %target_ptr - ret void -} - -$ llvm-as < t.ll | llc -march=x86-64 - -_test: - movl (%rdi), %eax - orl (%rsi), %eax - movl %eax, (%rsi) - ret - -That should be something like: - -_test: - movl (%rdi), %eax - orl %eax, (%rsi) - ret - -//===---------------------------------------------------------------------===// - The following code: bb114.preheader: ; preds = %cond_next94 @@ -1897,3 +1840,60 @@ Core 2, and "Generic" //===---------------------------------------------------------------------===// + +Testcase: +int a(int x) { return (x & 127) > 31; } + +Current output: + movl 4(%esp), %eax + andl $127, %eax + cmpl $31, %eax + seta %al + movzbl %al, %eax + ret + +Ideal output: + xorl %eax, %eax + testl $96, 4(%esp) + setne %al + ret + +We could do this transformation in instcombine, but it's only clearly +beneficial on platforms with a test instruction. + +//===---------------------------------------------------------------------===// +Testcase: +int x(int a) { return (a&0xf0)>>4; } + +Current output: + movl 4(%esp), %eax + shrl $4, %eax + andl $15, %eax + ret + +Ideal output: + movzbl 4(%esp), %eax + shrl $4, %eax + ret + +//===---------------------------------------------------------------------===// + +Testcase: +int x(int a) { return (a & 0x80) ? 0x100 : 0; } + +Current output: + testl $128, 4(%esp) + setne %al + movzbl %al, %eax + shll $8, %eax + ret + +Ideal output: + movl 4(%esp), %eax + addl %eax, %eax + andl $256, %eax + ret + +We generally want to fold shifted tests of a single bit into a shift+and on x86. + +//===---------------------------------------------------------------------===// From deeppatel1987 at gmail.com Thu Jun 11 18:42:07 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Thu, 11 Jun 2009 16:42:07 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegist Message-ID: <305d6f60906111642pa9bbe4fh656cb27727c4539f@mail.gmail.com> On Thu, Jun 11, 2009 at 11:29 AM, Chris Lattner wrote: > > On Jun 8, 2009, at 3:53 PM, Anton Korobeynikov wrote: > >> Author: asl >> Date: Mon Jun ?8 17:53:56 2009 >> New Revision: 73095 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=73095&view=rev >> Log: >> The attached patches implement most of the ARM AAPCS-VFP hard float >> ABI. The missing piece is support for putting "homogeneous aggregates" >> into registers. > > Philosophical question here: shouldn't ABI changes like this be part > of the target triple? ?llvm-gcc already munges a "GNU" target triple > into an llvm target triple. ?Wouldn't it be appropriate to do > something like that for this? ?Do we really support multiple different > (and selectable) ABIs on the same triple? Yes. At few reasons come to mind: * Existing code for ARM is generally all soft float and we need to be able to support that code. * We're following existing practice for the ARM EABI. * Units like FPU/NEON are optional when designing an SoC with an ARM. * The FPU/NEON units aren't necessarily enabled even if present. For at least kernel development, there is a need to build code that can do without. deep From nicholas at mxc.ca Thu Jun 11 18:43:03 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 11 Jun 2009 23:43:03 -0000 Subject: [llvm-commits] [llvm] r73211 - /llvm/trunk/test/BugPoint/misopt-basictest.ll Message-ID: <200906112343.n5BNh3tk009422@zion.cs.uiuc.edu> Author: nicholas Date: Thu Jun 11 18:43:02 2009 New Revision: 73211 URL: http://llvm.org/viewvc/llvm-project?rev=73211&view=rev Log: XFAIL this on PPC Linux. This keeps showing up in the buildbot and isn't easy to fix, and I'd like it to stop masking real failures. Modified: llvm/trunk/test/BugPoint/misopt-basictest.ll Modified: llvm/trunk/test/BugPoint/misopt-basictest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/BugPoint/misopt-basictest.ll?rev=73211&r1=73210&r2=73211&view=diff ============================================================================== --- llvm/trunk/test/BugPoint/misopt-basictest.ll (original) +++ llvm/trunk/test/BugPoint/misopt-basictest.ll Thu Jun 11 18:43:02 2009 @@ -1,4 +1,7 @@ ; RUN: bugpoint %s -dce -bugpoint-deletecalls -simplifycfg -silence-passes %bugpoint_topts +; XFAIL: powerpc-*-linux +; END. +; Failure on PPC Linux is due to PR4293. @.LC0 = internal global [13 x i8] c"Hello World\0A\00" ; <[13 x i8]*> [#uses=1] From deeppatel1987 at gmail.com Thu Jun 11 18:47:28 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Thu, 11 Jun 2009 16:47:28 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegist In-Reply-To: References: <305d6f60906110010l37762b0br64c9d75b7f149915@mail.gmail.com> <41FF1606-AC7C-496F-BDFA-9A9BBFE9606B@apple.com> Message-ID: <305d6f60906111647i4068c9aduacdf91defae45d44@mail.gmail.com> On Thu, Jun 11, 2009 at 2:33 PM, Bob Wilson wrote: > > On Jun 11, 2009, at 11:52 AM, Evan Cheng wrote: >> >> On Jun 11, 2009, at 11:32 AM, Chris Lattner wrote: >>> >>> Why not put this into the target triple? ?Major ABI issues like this >>> seem like they belong in the triple. >> >> It's not always clear what information we want to encode in triplet. >> In this case, it seems reasonable to encode float abi in the triplet. >> But how do we want encode this? Do we want to use it to toggle fp abi >> for any target, e.g. arm-apple-darwin-apcs? > > Since target triples are a GNU thing, it would be a good idea to be > compatible with GCC on this. ?I know that for the base AAPCS ABI GCC > uses an "eabi" suffix on the OS portion of the triple, e.g., arm-linux- > gnueabi. > > When I last worked on GCC, it had no support for the "hardfloat" AAPCS > ABI, but I heard that it was added since then. ?Does anyone know if > GCC uses something in the triple ("eabi-hardfloat" suffix??) to > indicate this? > > Since this fp ABI is an extension of AAPCS, it would only make sense > to allow toggling something in the target triple for targets that use > AAPCS (not Darwin). GCC did not change the target triple to indicate use of hard float; it's still arm-linux-gnueabi. GCC even allows a function attribute to change the ABI per function in support of kernel development and other cases where one may need to mix ABIs (e.g. a library that supports legacy soft float applications, etc.). deep From devang.patel at gmail.com Thu Jun 11 19:06:28 2009 From: devang.patel at gmail.com (Devang Patel) Date: Thu, 11 Jun 2009 17:06:28 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegist In-Reply-To: References: <305d6f60906110010l37762b0br64c9d75b7f149915@mail.gmail.com> Message-ID: <352a1fb20906111706ve746f6p7284b2a7a9aba14f@mail.gmail.com> On Thu, Jun 11, 2009 at 10:38 AM, Evan Cheng wrote: > > On Jun 11, 2009, at 12:10 AM, Sandeep Patel wrote: > >> On Wed, Jun 10, 2009 at 9:43 PM, Evan Cheng >> wrote: >>> >>> On Jun 8, 2009, at 3:53 PM, Anton Korobeynikov wrote: >>> >>>> Author: asl >>>> Date: Mon Jun ?8 17:53:56 2009 >>>> New Revision: 73095 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=73095&view=rev >>>> Log: >>>> The attached patches implement most of the ARM AAPCS-VFP hard float >>>> ABI. The missing piece is support for putting "homogeneous >>>> aggregates" >>>> into registers. >>>> >>>> Patch by Sandeep Patel! >>>> >>>> Modified: >>>> ? ?llvm/trunk/include/llvm/Target/TargetMachine.h >>>> ? ?llvm/trunk/include/llvm/Target/TargetOptions.h >>>> ? ?llvm/trunk/lib/Target/ARM/ARMCallingConv.td >>>> ? ?llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp >>>> ? ?llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp >>>> ? ?llvm/trunk/lib/Target/ARM/ARMRegisterInfo.td >>>> ? ?llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp >>>> ? ?llvm/trunk/lib/Target/TargetMachine.cpp >>>> ? ?llvm/trunk/lib/Target/X86/X86Subtarget.cpp >>>> >>>> Modified: llvm/trunk/include/llvm/Target/TargetMachine.h >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=73095&r1=73094&r2=73095&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> ==================================================================== >>>> --- llvm/trunk/include/llvm/Target/TargetMachine.h (original) >>>> +++ llvm/trunk/include/llvm/Target/TargetMachine.h Mon Jun ?8 >>>> 17:53:56 2009 >>>> @@ -78,6 +78,14 @@ >>>> ? }; >>>> } >>> >>>> >>>> >>>> +namespace FloatABI { >>>> + ?enum ABIType { >>>> + ? ?Default, >>>> + ? ?Soft, >>>> + ? ?Hard >>>> + ?}; >>>> +} >>> >>> Some comments? >> >> Will do. >> >>>> >>>> + >>>> // >>>> = >>>> = >>>> = >>>> ----------------------------------------------------------------------= >>>> ==// >>>> /// >>>> /// TargetMachine - Primary interface to the complete machine >>>> description for >>>> @@ -88,7 +96,7 @@ >>>> ? TargetMachine(const TargetMachine &); ? // DO NOT IMPLEMENT >>>> ? void operator=(const TargetMachine &); ?// DO NOT IMPLEMENT >>>> protected: // Can only create subclasses. >>>> - ?TargetMachine() : AsmInfo(0) { } >>>> + ?TargetMachine(); >>>> >>>> ? /// getSubtargetImpl - virtual method implemented by subclasses >>>> that returns >>>> ? /// a reference to that target's TargetSubtarget-derived member >>>> variable. >>>> >>>> Modified: llvm/trunk/include/llvm/Target/TargetOptions.h >>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=73095&r1=73094&r2=73095&view=diff >>>> >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> = >>>> ==================================================================== >>>> --- llvm/trunk/include/llvm/Target/TargetOptions.h (original) >>>> +++ llvm/trunk/include/llvm/Target/TargetOptions.h Mon Jun ?8 >>>> 17:53:56 2009 >>>> @@ -73,6 +73,14 @@ >>>> ? /// target FP instructions. >>>> ? extern bool UseSoftFloat; >>>> >>>> + ?/// FloatABIType - This setting is set by -float-abi=xxx option >>>> is specfied >>>> + ?/// on the command line. This setting may either be Default, >>>> Soft, or Hard. >>>> + ?/// Default selects the target's default behavior. Soft selects >>>> the ABI for >>>> + ?/// UseSoftFloat, but does not inidcate that FP hardware may not >>>> be used. >>>> + ?/// Such a combination is unfortunately popular (e.g. arm-apple- >>>> darwin). >>>> + ?/// Hard presumes that the normal FP ABI is used. >>>> + ?extern FloatABI::ABIType FloatABIType; >>> >>> Can we add a module note for this? >> >> Just checking my understanding: you want to extend the IR in >> llvm::bitc::ModuleCodes with something new for this? > > Sorry, I meant adding a note in llvm bitcode. It will be similar to > the function notes in llvm/Attributes.h. Some of these which impact > all the functions in the modules should be module notes rather than > function notes. Devang, have you introduced them yet? Not yet. We have not run into a case where we absolutely need module level attributes. - Devang From brukman+llvm at gmail.com Thu Jun 11 20:55:57 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Fri, 12 Jun 2009 01:55:57 -0000 Subject: [llvm-commits] [llvm] r73212 - in /llvm/trunk/utils/crosstool: ./ ARM/ ARM/build-install-linux.sh create-snapshots.sh Message-ID: <200906120155.n5C1tv5t013913@zion.cs.uiuc.edu> Author: brukman Date: Thu Jun 11 20:55:57 2009 New Revision: 73212 URL: http://llvm.org/viewvc/llvm-project?rev=73212&view=rev Log: Added two scripts to aid with building Linux/x86 -> Linux/ARM crosstools, using CodeSourcery's provided GCC-based crosstools, from which we use binutils. Added: llvm/trunk/utils/crosstool/ llvm/trunk/utils/crosstool/ARM/ llvm/trunk/utils/crosstool/ARM/build-install-linux.sh (with props) llvm/trunk/utils/crosstool/create-snapshots.sh (with props) Added: llvm/trunk/utils/crosstool/ARM/build-install-linux.sh URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/crosstool/ARM/build-install-linux.sh?rev=73212&view=auto ============================================================================== --- llvm/trunk/utils/crosstool/ARM/build-install-linux.sh (added) +++ llvm/trunk/utils/crosstool/ARM/build-install-linux.sh Thu Jun 11 20:55:57 2009 @@ -0,0 +1,194 @@ +#!/bin/bash +# +# Compiles and installs a Linux/x86_64 -> Linux/ARM crosstool based on LLVM and +# LLVM-GCC-4.2 using SVN snapshots in provided tarballs. + +set -o nounset +set -o errexit + +echo -n "Welcome to LLVM Linux/X86_64 -> Linux/ARM crosstool " +echo "builder/installer; some steps will require sudo privileges." + +readonly INSTALL_ROOT="${INSTALL_ROOT:-/usr/local}" +# Both $USER and root *must* have read/write access to this dir. +readonly SCRATCH_ROOT=$(mktemp -d "${TMPDIR:-/tmp}/llvm-project.XXXXXX") +readonly SRC_ROOT="${SCRATCH_ROOT}/src" +readonly OBJ_ROOT="${SCRATCH_ROOT}/obj" + +readonly CROSS_HOST="x86_64-unknown-linux-gnu" +readonly CROSS_TARGET="arm-none-linux-gnueabi" + +readonly CODE_SOURCERY="${INSTALL_ROOT}/codesourcery" +readonly CODE_SOURCERY_PKG_PATH="${CODE_SOURCERY_PKG_PATH:-${HOME}/codesourcery}" +readonly CODE_SOURCERY_PKG="arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2" +readonly CODE_SOURCERY_ROOT="${CODE_SOURCERY}/arm-2007q3" +readonly CODE_SOURCERY_BIN="${CODE_SOURCERY_ROOT}/bin" +# Make sure ${CROSS_TARGET}-* binutils are in command path +export PATH="${CODE_SOURCERY_BIN}:${PATH}" + +readonly CROSS_TARGET_AS="${CODE_SOURCERY_BIN}/${CROSS_TARGET}-as" +readonly CROSS_TARGET_LD="${CODE_SOURCERY_BIN}/${CROSS_TARGET}-ld" + +readonly SYSROOT="${CODE_SOURCERY_ROOT}/${CROSS_TARGET}/libc" + +readonly LLVM_PROJECT="${INSTALL_ROOT}/llvm-project" +readonly LLVM_INSTALL_ROOT="${LLVM_PROJECT}/${CROSS_HOST}/${CROSS_TARGET}" +readonly LLVM_PKG_PATH="${LLVM_PKG_PATH:-${HOME}/llvm-project/snapshots}" + +# Latest SVN revision known to be working in this configuration. +readonly LLVM_DEFAULT_REV="70786" + +readonly LLVM_PKG="llvm-${LLVM_SVN_REV:-${LLVM_DEFAULT_REV}}.tar.bz2" +readonly LLVM_SRC_DIR="${SRC_ROOT}/llvm" +readonly LLVM_OBJ_DIR="${OBJ_ROOT}/llvm" +readonly LLVM_INSTALL_DIR="${LLVM_INSTALL_ROOT}/llvm" + +readonly LLVMGCC_PKG="llvm-gcc-4.2-${LLVMGCC_SVN_REV:-${LLVM_DEFAULT_REV}}.tar.bz2" +readonly LLVMGCC_SRC_DIR="${SRC_ROOT}/llvm-gcc-4.2" +readonly LLVMGCC_OBJ_DIR="${OBJ_ROOT}/llvm-gcc-4.2" +readonly LLVMGCC_INSTALL_DIR="${LLVM_INSTALL_ROOT}/llvm-gcc-4.2" + +readonly MAKE_OPTS="-j2" + +# Verify we aren't going to install into an existing directory as this might +# create problems as we won't have a clean install. +verifyNotDir() { + if [[ -d $1 ]]; then + echo "Install dir $1 already exists; remove it to continue." + exit + fi +} + +# Params: +# $1: directory to be created +# $2: optional mkdir command prefix, e.g. "sudo" +createDir() { + if [[ ! -e $1 ]]; then + ${2:-} mkdir -p $1 + elif [[ -e $1 && ! -d $1 ]]; then + echo "$1 exists but is not a directory; exiting." + exit 3 + fi +} + +sudoCreateDir() { + createDir $1 sudo + sudo chown ${USER} $1 +} + +# Prints out and runs the command, but without logging -- intended for use with +# lightweight commands that don't have useful output to parse, e.g. mkdir, tar, +# etc. +runCommand() { + local message="$1" + shift + echo "=> $message" + echo "==> Running: $*" + $* +} + +runAndLog() { + local message="$1" + local log_file="$2" + shift 2 + echo "=> $message; log in $log_file" + echo "==> Running: $*" + # Pop-up a terminal with the output of the current command? + # e.g.: xterm -e /bin/bash -c "$* >| tee $log_file" + $* &> $log_file + if [[ $? != 0 ]]; then + echo "Error occurred: see most recent log file for details." + exit + fi +} + +installCodeSourcery() { + # Create CodeSourcery dir, if necessary. + verifyNotDir ${CODE_SOURCERY} + sudoCreateDir ${CODE_SOURCERY} + + # Unpack the tarball. + if [[ ! -d ${CODE_SOURCERY_ROOT} ]]; then + cd ${CODE_SOURCERY} + runCommand "Unpacking CodeSourcery in ${CODE_SOURCERY}" \ + tar jxf ${CODE_SOURCERY_PKG_PATH}/${CODE_SOURCERY_PKG} + else + echo "CodeSourcery install dir already exists." + fi + + # Verify our CodeSourcery toolchain installation. + if [[ ! -d "${SYSROOT}" ]]; then + echo -n "Error: CodeSourcery does not contain libc for ${CROSS_TARGET}: " + echo "${SYSROOT} not found." + exit + fi + + for tool in ${CROSS_TARGET_AS} ${CROSS_TARGET_LD}; do + if [[ ! -e $tool ]]; then + echo "${tool} not found; exiting." + exit + fi + done +} + +installLLVM() { + verifyNotDir ${LLVM_INSTALL_DIR} + sudoCreateDir ${LLVM_INSTALL_DIR} + + # Unpack LLVM tarball; should create the directory "llvm". + cd ${SRC_ROOT} + runCommand "Unpacking LLVM" tar jxf ${LLVM_PKG_PATH}/${LLVM_PKG} + + # Configure, build, and install LLVM. + createDir ${LLVM_OBJ_DIR} + cd ${LLVM_OBJ_DIR} + runAndLog "Configuring LLVM" ${LLVM_OBJ_DIR}/llvm-configure.log \ + ${LLVM_SRC_DIR}/configure \ + --disable-jit \ + --enable-optimized \ + --prefix=${LLVM_INSTALL_DIR} \ + --target=${CROSS_TARGET} \ + --with-llvmgccdir=${LLVMGCC_INSTALL_DIR} + runAndLog "Building LLVM" ${LLVM_OBJ_DIR}/llvm-build.log \ + make ${MAKE_OPTS} + runAndLog "Installing LLVM" ${LLVM_OBJ_DIR}/llvm-install.log \ + make ${MAKE_OPTS} install +} + +installLLVMGCC() { + verifyNotDir ${LLVMGCC_INSTALL_DIR} + sudoCreateDir ${LLVMGCC_INSTALL_DIR} + + # Unpack LLVM-GCC tarball; should create the directory "llvm-gcc-4.2". + cd ${SRC_ROOT} + runCommand "Unpacking LLVM-GCC" tar jxf ${LLVM_PKG_PATH}/${LLVMGCC_PKG} + + # Configure, build, and install LLVM-GCC. + createDir ${LLVMGCC_OBJ_DIR} + cd ${LLVMGCC_OBJ_DIR} + runAndLog "Configuring LLVM-GCC" ${LLVMGCC_OBJ_DIR}/llvmgcc-configure.log \ + ${LLVMGCC_SRC_DIR}/configure \ + --enable-languages=c,c++ \ + --enable-llvm=${LLVM_INSTALL_DIR} \ + --prefix=${LLVMGCC_INSTALL_DIR} \ + --program-prefix=llvm- \ + --target=${CROSS_TARGET} \ + --with-gnu-as=${CROSS_TARGET_AS} \ + --with-gnu-ld=${CROSS_TARGET_LD} \ + --with-sysroot=${SYSROOT} + runAndLog "Building LLVM-GCC" ${LLVMGCC_OBJ_DIR}/llvmgcc-build.log \ + make + runAndLog "Installing LLVM-GCC" ${LLVMGCC_OBJ_DIR}/llvmgcc-install.log \ + make install +} + +echo "Building in ${SCRATCH_ROOT}; installing in ${INSTALL_ROOT}" + +createDir ${SRC_ROOT} +createDir ${OBJ_ROOT} + +installCodeSourcery +installLLVM +installLLVMGCC + +echo "Done." Propchange: llvm/trunk/utils/crosstool/ARM/build-install-linux.sh ------------------------------------------------------------------------------ svn:executable = * Added: llvm/trunk/utils/crosstool/create-snapshots.sh URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/crosstool/create-snapshots.sh?rev=73212&view=auto ============================================================================== --- llvm/trunk/utils/crosstool/create-snapshots.sh (added) +++ llvm/trunk/utils/crosstool/create-snapshots.sh Thu Jun 11 20:55:57 2009 @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Creates LLVM SVN snapshots: llvm-$REV.tar.bz2 and llvm-gcc-4.2-$REV.tar.bz2, +# where $REV is an SVN revision of LLVM. This is used for creating stable +# tarballs which can be used to build known-to-work crosstools. +# +# Syntax: +# $0 [REV] -- grabs the revision $REV from SVN; if not specified, grabs the +# latest SVN revision. + +set -o nounset +set -o errexit + +readonly REV="${1:-HEAD}" + +runOnModule() { + local module=$1 + local log="${module}.log" + echo "Running: svn co -r ${REV} ${module}; log in ${log}" + svn co -r ${REV} http://llvm.org/svn/llvm-project/${module}/trunk ${module} \ + > ${log} 2>&1 + + # Delete all the ".svn" dirs; they take quite a lot of space. + echo "Cleaning up .svn dirs" + find ${module} -type d -name \.svn -print0 | xargs -0 /bin/rm -rf + + # Create "module-revision.tar.bz2" packages from the SVN checkout dirs. + local revision=$(grep "Checked out revision" ${log} | \ + sed 's/[^0-9]\+\([0-9]\+\)[^0-9]\+/\1/') + local tarball="${module}-${revision}.tar.bz2" + echo "Creating tarball: ${tarball}" + tar cjf ${tarball} ${module} + + echo "Cleaning SVN checkout dir ${module}" + rm -rf ${module} ${log} +} + +for module in "llvm" "llvm-gcc-4.2"; do + runOnModule ${module} +done + Propchange: llvm/trunk/utils/crosstool/create-snapshots.sh ------------------------------------------------------------------------------ svn:executable = * From brukman+llvm at gmail.com Thu Jun 11 21:04:47 2009 From: brukman+llvm at gmail.com (Misha Brukman) Date: Fri, 12 Jun 2009 02:04:47 -0000 Subject: [llvm-commits] [llvm] r73213 - /llvm/trunk/utils/crosstool/ARM/build-install-linux.sh Message-ID: <200906120204.n5C24l7o014187@zion.cs.uiuc.edu> Author: brukman Date: Thu Jun 11 21:04:47 2009 New Revision: 73213 URL: http://llvm.org/viewvc/llvm-project?rev=73213&view=rev Log: Update script to tell the user where to get the CodeSourcery crosstool, if it's not found. Modified: llvm/trunk/utils/crosstool/ARM/build-install-linux.sh Modified: llvm/trunk/utils/crosstool/ARM/build-install-linux.sh URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/crosstool/ARM/build-install-linux.sh?rev=73213&r1=73212&r2=73213&view=diff ============================================================================== --- llvm/trunk/utils/crosstool/ARM/build-install-linux.sh (original) +++ llvm/trunk/utils/crosstool/ARM/build-install-linux.sh Thu Jun 11 21:04:47 2009 @@ -20,6 +20,7 @@ readonly CODE_SOURCERY="${INSTALL_ROOT}/codesourcery" readonly CODE_SOURCERY_PKG_PATH="${CODE_SOURCERY_PKG_PATH:-${HOME}/codesourcery}" +readonly CODE_SOURCERY_HTTP="http://www.codesourcery.com/sgpp/lite/arm/portal/package1787/public" readonly CODE_SOURCERY_PKG="arm-2007q3-51-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2" readonly CODE_SOURCERY_ROOT="${CODE_SOURCERY}/arm-2007q3" readonly CODE_SOURCERY_BIN="${CODE_SOURCERY_ROOT}/bin" @@ -110,8 +111,16 @@ # Unpack the tarball. if [[ ! -d ${CODE_SOURCERY_ROOT} ]]; then cd ${CODE_SOURCERY} - runCommand "Unpacking CodeSourcery in ${CODE_SOURCERY}" \ - tar jxf ${CODE_SOURCERY_PKG_PATH}/${CODE_SOURCERY_PKG} + if [[ -e ${CODE_SOURCERY_PKG_PATH}/${CODE_SOURCERY_PKG} ]]; then + runCommand "Unpacking CodeSourcery in ${CODE_SOURCERY}" \ + tar jxf ${CODE_SOURCERY_PKG_PATH}/${CODE_SOURCERY_PKG} + else + echo -n "CodeSourcery tarball not found in " + echo "${CODE_SOURCERY_PKG_PATH}/${CODE_SOURCERY_PKG}" + echo -n "Fix the path or download it from " + echo "${CODE_SOURCERY_HTTP}/${CROSS_TARGET}/${CODE_SOURCERY_PKG}" + exit + fi else echo "CodeSourcery install dir already exists." fi From ofv at wanadoo.es Thu Jun 11 21:49:54 2009 From: ofv at wanadoo.es (Oscar Fuentes) Date: Fri, 12 Jun 2009 02:49:54 -0000 Subject: [llvm-commits] [llvm] r73216 - in /llvm/trunk: CMakeLists.txt cmake/modules/AddLLVM.cmake cmake/modules/AddPartiallyLinkedObject.cmake docs/CMake.html Message-ID: <200906120249.n5C2nsnl015385@zion.cs.uiuc.edu> Author: ofv Date: Thu Jun 11 21:49:53 2009 New Revision: 73216 URL: http://llvm.org/viewvc/llvm-project?rev=73216&view=rev Log: CMake: New variable LLVM_LIBDIR_SUFFIX. Patch by Ingmar Vanhassel! Modified: llvm/trunk/CMakeLists.txt llvm/trunk/cmake/modules/AddLLVM.cmake llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake llvm/trunk/docs/CMake.html Modified: llvm/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=73216&r1=73215&r2=73216&view=diff ============================================================================== --- llvm/trunk/CMakeLists.txt (original) +++ llvm/trunk/CMakeLists.txt Thu Jun 11 21:49:53 2009 @@ -26,6 +26,7 @@ set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin) set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples) +set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" ) set(LLVM_ALL_TARGETS Alpha Modified: llvm/trunk/cmake/modules/AddLLVM.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=73216&r1=73215&r2=73216&view=diff ============================================================================== --- llvm/trunk/cmake/modules/AddLLVM.cmake (original) +++ llvm/trunk/cmake/modules/AddLLVM.cmake Thu Jun 11 21:49:53 2009 @@ -10,8 +10,8 @@ add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) endif( LLVM_COMMON_DEPENDS ) install(TARGETS ${name} - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) + LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} + ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) endmacro(add_llvm_library name) Modified: llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake?rev=73216&r1=73215&r2=73216&view=diff ============================================================================== --- llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake (original) +++ llvm/trunk/cmake/modules/AddPartiallyLinkedObject.cmake Thu Jun 11 21:49:53 2009 @@ -38,5 +38,5 @@ set( llvm_lib_targets ${llvm_lib_targets} ${tnplo} PARENT_SCOPE ) endif( ) install(FILES ${pll} - DESTINATION lib) + DESTINATION lib${LLVM_LIBDIR_SUFFIX}) endmacro(add_partially_linked_object lib) Modified: llvm/trunk/docs/CMake.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CMake.html?rev=73216&r1=73215&r2=73216&view=diff ============================================================================== --- llvm/trunk/docs/CMake.html (original) +++ llvm/trunk/docs/CMake.html Thu Jun 11 21:49:53 2009 @@ -217,6 +217,11 @@
      Path where LLVM will be installed if "make install" is invoked or the "INSTALL" target is built.
      +
      LLVM_LIBDIR_SUFFIX:STRING
      +
      Extra suffix to append to the directory where libraries are to + be installed. On a 64-bit architecture, one could use + -DLLVM_LIBDIR_SUFFIX=64 to install libraries to /usr/lib64.
      +
      CMAKE_C_FLAGS:STRING
      Extra flags to use when compiling C source files.
      From isanbard at gmail.com Thu Jun 11 22:08:33 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Jun 2009 20:08:33 -0700 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <521640720906111559n682a58a6r7371c85c1485b83@mail.gmail.com> References: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> <00F2DF2F-C994-4904-86DA-32BDFA8622E7@gmail.com> <521640720906111559n682a58a6r7371c85c1485b83@mail.gmail.com> Message-ID: <5B222480-ECD7-4943-9E3C-06AFCCD37AC9@gmail.com> Sorry that we have standards. Please feel free to try to get your patches accepted to other open source projects. Perhaps GCC? -bw On Jun 11, 2009, at 3:59 PM, "Edward O'Callaghan" wrote: > Gezz, > > Your just making it hard for people to do work on llvm/clang by being > so pedantic! > I have taken note, so just please integrate the code changes so things > may progress on the Solaris port. > I hope this is optimal ;( I also added a note about the order in which > the second names should be submitted too for others. > > Thank you, > Edward. > > 2009/6/11 Bill Wendling : >> On Jun 11, 2009, at 11:56 AM, Edward O'Callaghan wrote: >> >>> Hi Chris, >>> >>> Sorry but, you may not have noticed that the CREDITS file is *not* >>> in >>> alphabetical order. >>> If you wish to sort it then OK, but I don't have that kind of time >>> sorry. >>> >> Well, let's try to not make it worse than it is now. :-) >> >> -bw >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > > > -- > -- > Edward O'Callaghan > http://www.auroraux.org/ > eocallaghan at auroraux dot org > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From bob.wilson at apple.com Thu Jun 11 23:49:37 2009 From: bob.wilson at apple.com (Bob Wilson) Date: Thu, 11 Jun 2009 21:49:37 -0700 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <5B222480-ECD7-4943-9E3C-06AFCCD37AC9@gmail.com> References: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> <00F2DF2F-C994-4904-86DA-32BDFA8622E7@gmail.com> <521640720906111559n682a58a6r7371c85c1485b83@mail.gmail.com> <5B222480-ECD7-4943-9E3C-06AFCCD37AC9@gmail.com> Message-ID: On Jun 11, 2009, at 8:08 PM, Bill Wendling wrote: > Sorry that we have standards. Please feel free to try to get your > patches accepted to other open source projects. Perhaps GCC? Nope. The GCC folks keep their "MAINTAINERS" file sorted alphabetically, too. ;-) From nicholas at mxc.ca Fri Jun 12 00:18:35 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 12 Jun 2009 05:18:35 -0000 Subject: [llvm-commits] [llvm] r73219 - /llvm/trunk/test/lib/llvm.exp Message-ID: <200906120518.n5C5Iaci019541@zion.cs.uiuc.edu> Author: nicholas Date: Fri Jun 12 00:18:32 2009 New Revision: 73219 URL: http://llvm.org/viewvc/llvm-project?rev=73219&view=rev Log: In an XFAIL line, treat "XFAIL: foo*bar" as a regular expression to be matched against the target triple, instead of equivalent to "XFAIL: *". Modified: llvm/trunk/test/lib/llvm.exp Modified: llvm/trunk/test/lib/llvm.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lib/llvm.exp?rev=73219&r1=73218&r2=73219&view=diff ============================================================================== --- llvm/trunk/test/lib/llvm.exp (original) +++ llvm/trunk/test/lib/llvm.exp Fri Jun 12 00:18:32 2009 @@ -184,7 +184,7 @@ #split up target if more then 1 specified foreach target [split $targets ,] { - if { [regexp {\*} $target match] } { + if { $target == "*" } { if {$targetPASS != 1} { set outcome XFAIL } From nicholas at mxc.ca Fri Jun 12 00:20:13 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 12 Jun 2009 05:20:13 -0000 Subject: [llvm-commits] [llvm] r73220 - in /llvm/trunk: lib/Bitcode/Writer/BitcodeWriter.cpp lib/Bitcode/Writer/ValueEnumerator.cpp lib/Bitcode/Writer/ValueEnumerator.h test/Bitcode/2009-06-11-FirstClassAggregateConstant.ll Message-ID: <200906120520.n5C5KDrX019609@zion.cs.uiuc.edu> Author: nicholas Date: Fri Jun 12 00:20:12 2009 New Revision: 73220 URL: http://llvm.org/viewvc/llvm-project?rev=73220&view=rev Log: Don't remove aggregate-typed module level constants before encoding functions since functions may contain aggregate constants too. Added: llvm/trunk/test/Bitcode/2009-06-11-FirstClassAggregateConstant.ll Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=73220&r1=73219&r2=73220&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Fri Jun 12 00:20:12 2009 @@ -1308,16 +1308,6 @@ // Emit constants. WriteModuleConstants(VE, Stream); - // If we have any aggregate values in the value table, purge them - these can - // only be used to initialize global variables. Doing so makes the value - // namespace smaller for code in functions. - int NumNonAggregates = VE.PurgeAggregateValues(); - if (NumNonAggregates != -1) { - SmallVector Vals; - Vals.push_back(NumNonAggregates); - Stream.EmitRecord(bitc::MODULE_CODE_PURGEVALS, Vals); - } - // Emit function bodies. for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) if (!I->isDeclaration()) Modified: llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp?rev=73220&r1=73219&r2=73220&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp Fri Jun 12 00:20:12 2009 @@ -277,22 +277,6 @@ } -/// PurgeAggregateValues - If there are any aggregate values at the end of the -/// value list, remove them and return the count of the remaining values. If -/// there are none, return -1. -int ValueEnumerator::PurgeAggregateValues() { - // If there are no aggregate values at the end of the list, return -1. - if (Values.empty() || Values.back().first->getType()->isSingleValueType()) - return -1; - - // Otherwise, remove aggregate values... - while (!Values.empty() && !Values.back().first->getType()->isSingleValueType()) - Values.pop_back(); - - // ... and return the new size. - return Values.size(); -} - void ValueEnumerator::incorporateFunction(const Function &F) { NumModuleValues = Values.size(); Modified: llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h?rev=73220&r1=73219&r2=73220&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h (original) +++ llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h Fri Jun 12 00:20:12 2009 @@ -99,11 +99,6 @@ return Attributes; } - /// PurgeAggregateValues - If there are any aggregate values at the end of the - /// value list, remove them and return the count of the remaining values. If - /// there are none, return -1. - int PurgeAggregateValues(); - /// incorporateFunction/purgeFunction - If you'd like to deal with a function, /// use these two methods to get its data into the ValueEnumerator! /// Added: llvm/trunk/test/Bitcode/2009-06-11-FirstClassAggregateConstant.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/2009-06-11-FirstClassAggregateConstant.ll?rev=73220&view=auto ============================================================================== --- llvm/trunk/test/Bitcode/2009-06-11-FirstClassAggregateConstant.ll (added) +++ llvm/trunk/test/Bitcode/2009-06-11-FirstClassAggregateConstant.ll Fri Jun 12 00:20:12 2009 @@ -0,0 +1,12 @@ +; RUN: llvm-as < %s | llvm-dis -disable-output +; PR4373 + + at foo = weak global { i32 } zeroinitializer + at bar = weak global i32 0 + +define void @test() { +entry: + store { i32 } zeroinitializer, { i32 }* @foo + store i32 1, i32* @bar + ret void +} From nicholas at mxc.ca Fri Jun 12 00:39:02 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 12 Jun 2009 05:39:02 -0000 Subject: [llvm-commits] [llvm] r73221 - /llvm/trunk/test/BugPoint/misopt-basictest.ll Message-ID: <200906120539.n5C5d2eS020174@zion.cs.uiuc.edu> Author: nicholas Date: Fri Jun 12 00:39:02 2009 New Revision: 73221 URL: http://llvm.org/viewvc/llvm-project?rev=73221&view=rev Log: Fix regular expression. Modified: llvm/trunk/test/BugPoint/misopt-basictest.ll Modified: llvm/trunk/test/BugPoint/misopt-basictest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/BugPoint/misopt-basictest.ll?rev=73221&r1=73220&r2=73221&view=diff ============================================================================== --- llvm/trunk/test/BugPoint/misopt-basictest.ll (original) +++ llvm/trunk/test/BugPoint/misopt-basictest.ll Fri Jun 12 00:39:02 2009 @@ -1,5 +1,5 @@ ; RUN: bugpoint %s -dce -bugpoint-deletecalls -simplifycfg -silence-passes %bugpoint_topts -; XFAIL: powerpc-*-linux +; XFAIL: powerpc-.*-linux ; END. ; Failure on PPC Linux is due to PR4293. From isanbard at gmail.com Fri Jun 12 01:03:19 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Jun 2009 23:03:19 -0700 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: References: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> <00F2DF2F-C994-4904-86DA-32BDFA8622E7@gmail.com> <521640720906111559n682a58a6r7371c85c1485b83@mail.gmail.com> <5B222480-ECD7-4943-9E3C-06AFCCD37AC9@gmail.com> Message-ID: <7EA9D52E-F93A-4E3E-9C7F-DA741388969C@gmail.com> On Jun 11, 2009, at 9:49 PM, Bob Wilson wrote: > > On Jun 11, 2009, at 8:08 PM, Bill Wendling wrote: > >> Sorry that we have standards. Please feel free to try to get your >> patches accepted to other open source projects. Perhaps GCC? > > Nope. The GCC folks keep their "MAINTAINERS" file sorted > alphabetically, too. ;-) And god forbid you get the spacing wrong in the ChangeLog file entry! -bw From isanbard at gmail.com Fri Jun 12 01:05:04 2009 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 11 Jun 2009 23:05:04 -0700 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <521640720906111559n682a58a6r7371c85c1485b83@mail.gmail.com> References: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> <00F2DF2F-C994-4904-86DA-32BDFA8622E7@gmail.com> <521640720906111559n682a58a6r7371c85c1485b83@mail.gmail.com> Message-ID: You should use "surname" instead of "second names". And now for more being "pedantic". You can't have lines > 80 columns: --- llvm/CREDITS.TXT Thu Jun 11 23:47:24 2009 +++ CREDITS.TXT Thu Jun 11 23:52:13 2009 @@ -3,7 +3,7 @@ LLVM, please submit a patch to this file to add yourself, and it will be done! -The list is sorted by name and formatted to allow easy grepping and +The list is sorted by name (second names are in alphabetical order) and formatted to allow easy grepping and beautification by scripts. The fields are: name (N), email (E), web- address (W), PGP key ID and fingerprint (P), description (D), and snail-mail address (S). -bw On Jun 11, 2009, at 3:59 PM, Edward O'Callaghan wrote: > Gezz, > > Your just making it hard for people to do work on llvm/clang by being > so pedantic! > I have taken note, so just please integrate the code changes so things > may progress on the Solaris port. > I hope this is optimal ;( I also added a note about the order in which > the second names should be submitted too for others. > > Thank you, > Edward. > > 2009/6/11 Bill Wendling : >> On Jun 11, 2009, at 11:56 AM, Edward O'Callaghan wrote: >> >>> Hi Chris, >>> >>> Sorry but, you may not have noticed that the CREDITS file is *not* >>> in >>> alphabetical order. >>> If you wish to sort it then OK, but I don't have that kind of time >>> sorry. >>> >> Well, let's try to not make it worse than it is now. :-) >> >> -bw >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > > > -- > -- > Edward O'Callaghan > http://www.auroraux.org/ > eocallaghan at auroraux dot org > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From nicholas at mxc.ca Fri Jun 12 03:04:54 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 12 Jun 2009 08:04:54 -0000 Subject: [llvm-commits] [llvm] r73222 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Message-ID: <200906120804.n5C84tSO003731@zion.cs.uiuc.edu> Author: nicholas Date: Fri Jun 12 03:04:51 2009 New Revision: 73222 URL: http://llvm.org/viewvc/llvm-project?rev=73222&view=rev Log: Add an "are types equivalent" operation that ignores the types that a pointer points to while analyzing all other fields. Use FoldingSetNodeID to produce a good hash. This dramatically decreases run times. Emit thunks. This means that it can look at all functions regardless of what the linkage is or if the address is taken, but unfortunately some small functions can be even shorter than the thunk because our backend doesn't yet realize it can just turn these into jumps. This means that this pass will pessimize code on average. Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=73222&r1=73221&r2=73222&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Fri Jun 12 03:04:51 2009 @@ -9,10 +9,6 @@ // // This pass looks for equivalent functions that are mergable and folds them. // -// A Function will not be analyzed if: -// * it is overridable at runtime (except for weak linkage), or -// * it is used by anything other than the callee parameter of a call/invoke -// // A hash is computed from the function, based on its type and number of // basic blocks. // @@ -24,8 +20,6 @@ // When a match is found, the functions are folded. We can only fold two // functions when we know that the definition of one of them is not // overridable. -// * fold a function marked internal by replacing all of its users. -// * fold extern or weak functions by replacing them with a global alias // //===----------------------------------------------------------------------===// // @@ -48,6 +42,7 @@ #define DEBUG_TYPE "mergefunc" #include "llvm/Transforms/IPO.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/Statistic.h" #include "llvm/Constants.h" #include "llvm/InlineAsm.h" @@ -62,7 +57,6 @@ using namespace llvm; STATISTIC(NumFunctionsMerged, "Number of functions merged"); -STATISTIC(NumMergeFails, "Number of identical function pairings not merged"); namespace { struct VISIBILITY_HIDDEN MergeFunctions : public ModulePass { @@ -81,16 +75,168 @@ return new MergeFunctions(); } +// ===----------------------------------------------------------------------=== +// Comparison of functions +// ===----------------------------------------------------------------------=== + static unsigned long hash(const Function *F) { - return F->size() ^ reinterpret_cast(F->getType()); - //return F->size() ^ F->arg_size() ^ F->getReturnType(); + const FunctionType *FTy = F->getFunctionType(); + + FoldingSetNodeID ID; + ID.AddInteger(F->size()); + ID.AddInteger(F->getCallingConv()); + ID.AddBoolean(F->hasGC()); + ID.AddBoolean(FTy->isVarArg()); + ID.AddInteger(FTy->getReturnType()->getTypeID()); + for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i) + ID.AddInteger(FTy->getParamType(i)->getTypeID()); + return ID.ComputeHash(); +} + +/// IgnoreBitcasts - given a bitcast, returns the first non-bitcast found by +/// walking the chain of cast operands. Otherwise, returns the argument. +static Value* IgnoreBitcasts(Value *V) { + while (BitCastInst *BC = dyn_cast(V)) + V = BC->getOperand(0); + + return V; +} + +/// isEquivalentType - any two pointers are equivalent. Otherwise, standard +/// type equivalence rules apply. +static bool isEquivalentType(const Type *Ty1, const Type *Ty2) { + if (Ty1 == Ty2) + return true; + if (Ty1->getTypeID() != Ty2->getTypeID()) + return false; + + switch(Ty1->getTypeID()) { + case Type::VoidTyID: + case Type::FloatTyID: + case Type::DoubleTyID: + case Type::X86_FP80TyID: + case Type::FP128TyID: + case Type::PPC_FP128TyID: + case Type::LabelTyID: + case Type::MetadataTyID: + return true; + + case Type::IntegerTyID: + case Type::OpaqueTyID: + // Ty1 == Ty2 would have returned true earlier. + return false; + + default: + assert(0 && "Unknown type!"); + return false; + + case Type::PointerTyID: { + const PointerType *PTy1 = cast(Ty1); + const PointerType *PTy2 = cast(Ty2); + return PTy1->getAddressSpace() == PTy2->getAddressSpace(); + } + + case Type::StructTyID: { + const StructType *STy1 = cast(Ty1); + const StructType *STy2 = cast(Ty2); + if (STy1->getNumElements() != STy2->getNumElements()) + return false; + + if (STy1->isPacked() != STy2->isPacked()) + return false; + + for (unsigned i = 0, e = STy1->getNumElements(); i != e; ++i) { + if (!isEquivalentType(STy1->getElementType(i), STy2->getElementType(i))) + return false; + } + return true; + } + + case Type::FunctionTyID: { + const FunctionType *FTy1 = cast(Ty1); + const FunctionType *FTy2 = cast(Ty2); + if (FTy1->getNumParams() != FTy2->getNumParams() || + FTy1->isVarArg() != FTy2->isVarArg()) + return false; + + if (!isEquivalentType(FTy1->getReturnType(), FTy2->getReturnType())) + return false; + + for (unsigned i = 0, e = FTy1->getNumParams(); i != e; ++i) { + if (!isEquivalentType(FTy1->getParamType(i), FTy2->getParamType(i))) + return false; + } + return true; + } + + case Type::ArrayTyID: + case Type::VectorTyID: { + const SequentialType *STy1 = cast(Ty1); + const SequentialType *STy2 = cast(Ty2); + return isEquivalentType(STy1->getElementType(), STy2->getElementType()); + } + } +} + +/// isEquivalentOperation - determine whether the two operations are the same +/// except that pointer-to-A and pointer-to-B are equivalent. This should be +/// kept in sync with Instruction::isSameOperandAs. +static bool isEquivalentOperation(const Instruction *I1, const Instruction *I2) { + if (I1->getOpcode() != I2->getOpcode() || + I1->getNumOperands() != I2->getNumOperands() || + !isEquivalentType(I1->getType(), I2->getType())) + return false; + + // We have two instructions of identical opcode and #operands. Check to see + // if all operands are the same type + for (unsigned i = 0, e = I1->getNumOperands(); i != e; ++i) + if (!isEquivalentType(I1->getOperand(i)->getType(), + I2->getOperand(i)->getType())) + return false; + + // Check special state that is a part of some instructions. + if (const LoadInst *LI = dyn_cast(I1)) + return LI->isVolatile() == cast(I2)->isVolatile() && + LI->getAlignment() == cast(I2)->getAlignment(); + if (const StoreInst *SI = dyn_cast(I1)) + return SI->isVolatile() == cast(I2)->isVolatile() && + SI->getAlignment() == cast(I2)->getAlignment(); + if (const CmpInst *CI = dyn_cast(I1)) + return CI->getPredicate() == cast(I2)->getPredicate(); + if (const CallInst *CI = dyn_cast(I1)) + return CI->isTailCall() == cast(I2)->isTailCall() && + CI->getCallingConv() == cast(I2)->getCallingConv() && + CI->getAttributes().getRawPointer() == + cast(I2)->getAttributes().getRawPointer(); + if (const InvokeInst *CI = dyn_cast(I1)) + return CI->getCallingConv() == cast(I2)->getCallingConv() && + CI->getAttributes().getRawPointer() == + cast(I2)->getAttributes().getRawPointer(); + if (const InsertValueInst *IVI = dyn_cast(I1)) { + if (IVI->getNumIndices() != cast(I2)->getNumIndices()) + return false; + for (unsigned i = 0, e = IVI->getNumIndices(); i != e; ++i) + if (IVI->idx_begin()[i] != cast(I2)->idx_begin()[i]) + return false; + return true; + } + if (const ExtractValueInst *EVI = dyn_cast(I1)) { + if (EVI->getNumIndices() != cast(I2)->getNumIndices()) + return false; + for (unsigned i = 0, e = EVI->getNumIndices(); i != e; ++i) + if (EVI->idx_begin()[i] != cast(I2)->idx_begin()[i]) + return false; + return true; + } + + return true; } static bool compare(const Value *V, const Value *U) { assert(!isa(V) && !isa(U) && "Must not compare basic blocks."); - assert(V->getType() == U->getType() && + assert(isEquivalentType(V->getType(), U->getType()) && "Two of the same operation have operands of different type."); // TODO: If the constant is an expression of F, we should accept that it's @@ -117,18 +263,24 @@ static bool equals(const BasicBlock *BB1, const BasicBlock *BB2, DenseMap &ValueMap, DenseMap &SpeculationMap) { - // Specutively add it anyways. If it's false, we'll notice a difference later, and - // this won't matter. + // Speculatively add it anyways. If it's false, we'll notice a difference + // later, and this won't matter. ValueMap[BB1] = BB2; BasicBlock::const_iterator FI = BB1->begin(), FE = BB1->end(); BasicBlock::const_iterator GI = BB2->begin(), GE = BB2->end(); do { - if (!FI->isSameOperationAs(const_cast(&*GI))) - return false; + if (isa(FI)) { + ++FI; + continue; + } + if (isa(GI)) { + ++GI; + continue; + } - if (FI->getNumOperands() != GI->getNumOperands()) + if (!isEquivalentOperation(FI, GI)) return false; if (ValueMap[FI] == GI) { @@ -140,8 +292,8 @@ return false; for (unsigned i = 0, e = FI->getNumOperands(); i != e; ++i) { - Value *OpF = FI->getOperand(i); - Value *OpG = GI->getOperand(i); + Value *OpF = IgnoreBitcasts(FI->getOperand(i)); + Value *OpG = IgnoreBitcasts(GI->getOperand(i)); if (ValueMap[OpF] == OpG) continue; @@ -149,10 +301,8 @@ if (ValueMap[OpF] != NULL) return false; - assert(OpF->getType() == OpG->getType() && - "Two of the same operation has operands of different type."); - - if (OpF->getValueID() != OpG->getValueID()) + if (OpF->getValueID() != OpG->getValueID() || + !isEquivalentType(OpF->getType(), OpG->getType())) return false; if (isa(FI)) { @@ -203,14 +353,15 @@ if (F->hasSection() && F->getSection() != G->getSection()) return false; + if (F->isVarArg() != G->isVarArg()) + return false; + // TODO: if it's internal and only used in direct calls, we could handle this // case too. if (F->getCallingConv() != G->getCallingConv()) return false; - // TODO: We want to permit cases where two functions take T* and S* but - // only load or store them into T** and S**. - if (F->getType() != G->getType()) + if (!isEquivalentType(F->getFunctionType(), G->getFunctionType())) return false; DenseMap ValueMap; @@ -237,89 +388,199 @@ return true; } -static bool fold(std::vector &FnVec, unsigned i, unsigned j) { - if (FnVec[i]->mayBeOverridden() && !FnVec[j]->mayBeOverridden()) - std::swap(FnVec[i], FnVec[j]); - - Function *F = FnVec[i]; - Function *G = FnVec[j]; +// ===----------------------------------------------------------------------=== +// Folding of functions +// ===----------------------------------------------------------------------=== + +// Cases: +// * F is external strong, G is external strong: +// turn G into a thunk to F (1) +// * F is external strong, G is external weak: +// turn G into a thunk to F (1) +// * F is external weak, G is external weak: +// unfoldable +// * F is external strong, G is internal: +// address of G taken: +// turn G into a thunk to F (1) +// address of G not taken: +// make G an alias to F (2) +// * F is internal, G is external weak +// address of F is taken: +// turn G into a thunk to F (1) +// address of F is not taken: +// make G an alias of F (2) +// * F is internal, G is internal: +// address of F and G are taken: +// turn G into a thunk to F (1) +// address of G is not taken: +// make G an alias to F (2) +// +// alias requires linkage == (external,local,weak) fallback to creating a thunk +// external means 'externally visible' linkage != (internal,private) +// internal means linkage == (internal,private) +// weak means linkage mayBeOverridable +// being external implies that the address is taken +// +// 1. turn G into a thunk to F +// 2. make G an alias to F + +enum LinkageCategory { + ExternalStrong, + ExternalWeak, + Internal +}; + +static LinkageCategory categorize(const Function *F) { + switch (F->getLinkage()) { + case GlobalValue::InternalLinkage: + case GlobalValue::PrivateLinkage: + return Internal; + + case GlobalValue::WeakAnyLinkage: + case GlobalValue::WeakODRLinkage: + case GlobalValue::ExternalWeakLinkage: + return ExternalWeak; + + case GlobalValue::ExternalLinkage: + case GlobalValue::AvailableExternallyLinkage: + case GlobalValue::LinkOnceAnyLinkage: + case GlobalValue::LinkOnceODRLinkage: + case GlobalValue::AppendingLinkage: + case GlobalValue::DLLImportLinkage: + case GlobalValue::DLLExportLinkage: + case GlobalValue::GhostLinkage: + case GlobalValue::CommonLinkage: + return ExternalStrong; + } - if (!F->mayBeOverridden()) { - if (G->hasLocalLinkage()) { - F->setAlignment(std::max(F->getAlignment(), G->getAlignment())); - G->replaceAllUsesWith(F); - G->eraseFromParent(); - ++NumFunctionsMerged; - return true; - } + assert(0 && "Unknown LinkageType."); + return ExternalWeak; +} - if (G->hasExternalLinkage() || G->hasWeakLinkage()) { - GlobalAlias *GA = new GlobalAlias(G->getType(), G->getLinkage(), "", - F, G->getParent()); - F->setAlignment(std::max(F->getAlignment(), G->getAlignment())); - GA->takeName(G); - GA->setVisibility(G->getVisibility()); - G->replaceAllUsesWith(GA); - G->eraseFromParent(); - ++NumFunctionsMerged; - return true; +static void ThunkGToF(Function *F, Function *G) { + Function *NewG = Function::Create(G->getFunctionType(), G->getLinkage(), + "", G->getParent()); + BasicBlock *BB = BasicBlock::Create("", NewG); + + std::vector Args; + unsigned i = 0; + const FunctionType *FFTy = F->getFunctionType(); + for (Function::arg_iterator AI = NewG->arg_begin(), AE = NewG->arg_end(); + AI != AE; ++AI) { + if (FFTy->getParamType(i) == AI->getType()) + Args.push_back(AI); + else { + Value *BCI = new BitCastInst(AI, FFTy->getParamType(i), "", BB); + Args.push_back(BCI); } + ++i; } - if (F->hasWeakLinkage() && G->hasWeakLinkage()) { - GlobalAlias *GA_F = new GlobalAlias(F->getType(), F->getLinkage(), "", - 0, F->getParent()); - GA_F->takeName(F); - GA_F->setVisibility(F->getVisibility()); - F->setAlignment(std::max(F->getAlignment(), G->getAlignment())); - F->replaceAllUsesWith(GA_F); - F->setName("folded." + GA_F->getName()); - F->setLinkage(GlobalValue::ExternalLinkage); - GA_F->setAliasee(F); - - GlobalAlias *GA_G = new GlobalAlias(G->getType(), G->getLinkage(), "", - F, G->getParent()); - GA_G->takeName(G); - GA_G->setVisibility(G->getVisibility()); - G->replaceAllUsesWith(GA_G); - G->eraseFromParent(); - - ++NumFunctionsMerged; - return true; + CallInst *CI = CallInst::Create(F, Args.begin(), Args.end(), "", BB); + CI->setTailCall(); + if (NewG->getReturnType() == Type::VoidTy) { + ReturnInst::Create(BB); + } else if (CI->getType() != NewG->getReturnType()) { + Value *BCI = new BitCastInst(CI, NewG->getReturnType(), "", BB); + ReturnInst::Create(BCI, BB); + } else { + ReturnInst::Create(CI, BB); } - DOUT << "Failed on " << F->getName() << " and " << G->getName() << "\n"; + NewG->copyAttributesFrom(G); + NewG->takeName(G); + G->replaceAllUsesWith(NewG); + G->eraseFromParent(); - ++NumMergeFails; - return false; + // TODO: look at direct callers to G and make them all direct callers to F + // iff G->hasAddressTaken() is false. } -static bool hasAddressTaken(User *U) { - for (User::use_iterator I = U->use_begin(), E = U->use_end(); I != E; ++I) { - User *Use = *I; - - // 'call (bitcast @F to ...)' happens a lot. - while (isa(Use) && Use->hasOneUse()) { - Use = *Use->use_begin(); - } +static void AliasGToF(Function *F, Function *G) { + if (!G->hasExternalLinkage() && !G->hasLocalLinkage() && !G->hasWeakLinkage()) + return ThunkGToF(F, G); + + GlobalAlias *GA = new GlobalAlias( + G->getType(), G->getLinkage(), "", + ConstantExpr::getBitCast(F, G->getType()), G->getParent()); + F->setAlignment(std::max(F->getAlignment(), G->getAlignment())); + GA->takeName(G); + GA->setVisibility(G->getVisibility()); + G->replaceAllUsesWith(GA); + G->eraseFromParent(); +} - if (isa(Use)) { - if (hasAddressTaken(Use)) - return true; - } +static bool fold(std::vector &FnVec, unsigned i, unsigned j) { + Function *F = FnVec[i]; + Function *G = FnVec[j]; - if (!isa(Use) && !isa(Use)) - return true; + LinkageCategory catF = categorize(F); + LinkageCategory catG = categorize(G); - // Make sure we aren't passing U as a parameter to call instead of the - // callee. - if (CallSite(cast(Use)).hasArgument(U)) - return true; + if (catF == ExternalWeak || (catF == Internal && catG == ExternalStrong)) { + std::swap(FnVec[i], FnVec[j]); + std::swap(F, G); + std::swap(catF, catG); } - return false; + switch (catF) { + case ExternalStrong: + switch (catG) { + case ExternalStrong: + case ExternalWeak: + ThunkGToF(F, G); + break; + case Internal: + if (G->hasAddressTaken()) + ThunkGToF(F, G); + else + AliasGToF(F, G); + break; + } + break; + + case ExternalWeak: + return false; + + case Internal: + switch (catG) { + case ExternalStrong: + assert(0); + // fall-through + case ExternalWeak: + if (F->hasAddressTaken()) + ThunkGToF(F, G); + else + AliasGToF(F, G); + break; + case Internal: { + bool addrTakenF = F->hasAddressTaken(); + bool addrTakenG = G->hasAddressTaken(); + if (!addrTakenF && addrTakenG) { + std::swap(FnVec[i], FnVec[j]); + std::swap(F, G); + std::swap(addrTakenF, addrTakenG); + } + + if (addrTakenF && addrTakenG) { + ThunkGToF(F, G); + } else { + assert(!addrTakenG); + AliasGToF(F, G); + } + } break; + } + break; + } + + ++NumFunctionsMerged; + return true; } +// ===----------------------------------------------------------------------=== +// Pass definition +// ===----------------------------------------------------------------------=== + bool MergeFunctions::runOnModule(Module &M) { bool Changed = false; @@ -329,25 +590,19 @@ if (F->isDeclaration() || F->isIntrinsic()) continue; - if (!F->hasLocalLinkage() && !F->hasExternalLinkage() && - !F->hasWeakLinkage()) - continue; - - if (hasAddressTaken(F)) - continue; - FnMap[hash(F)].push_back(F); } - // TODO: instead of running in a loop, we could also fold functions in callgraph - // order. Constructing the CFG probably isn't cheaper than just running in a loop. + // TODO: instead of running in a loop, we could also fold functions in + // callgraph order. Constructing the CFG probably isn't cheaper than just + // running in a loop, unless it happened to already be available. bool LocalChanged; do { LocalChanged = false; + DOUT << "size: " << FnMap.size() << "\n"; for (std::map >::iterator I = FnMap.begin(), E = FnMap.end(); I != E; ++I) { - DOUT << "size: " << FnMap.size() << "\n"; std::vector &FnVec = I->second; DOUT << "hash (" << I->first << "): " << FnVec.size() << "\n"; From baldrick at free.fr Fri Jun 12 03:12:29 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 12 Jun 2009 10:12:29 +0200 Subject: [llvm-commits] [llvm] r73222 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp In-Reply-To: <200906120804.n5C84tSO003731@zion.cs.uiuc.edu> References: <200906120804.n5C84tSO003731@zion.cs.uiuc.edu> Message-ID: <4A320DED.3060107@free.fr> Hi Nick, > Emit thunks. is this a workaround for not all targets supporting aliases? Ciao, Duncan. From fvbommel at wxs.nl Fri Jun 12 05:51:55 2009 From: fvbommel at wxs.nl (Frits van Bommel) Date: Fri, 12 Jun 2009 12:51:55 +0200 Subject: [llvm-commits] [llvm] r73222 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp In-Reply-To: <200906120804.n5C84tSO003731@zion.cs.uiuc.edu> References: <200906120804.n5C84tSO003731@zion.cs.uiuc.edu> Message-ID: <4A32334B.7020203@wxs.nl> Nick Lewycky wrote: > + // Check special state that is a part of some instructions. > + if (const LoadInst *LI = dyn_cast(I1)) > + return LI->isVolatile() == cast(I2)->isVolatile() && > + LI->getAlignment() == cast(I2)->getAlignment(); > + if (const StoreInst *SI = dyn_cast(I1)) > + return SI->isVolatile() == cast(I2)->isVolatile() && > + SI->getAlignment() == cast(I2)->getAlignment(); > + if (const CmpInst *CI = dyn_cast(I1)) > + return CI->getPredicate() == cast(I2)->getPredicate(); > + if (const CallInst *CI = dyn_cast(I1)) > + return CI->isTailCall() == cast(I2)->isTailCall() && > + CI->getCallingConv() == cast(I2)->getCallingConv() && > + CI->getAttributes().getRawPointer() == > + cast(I2)->getAttributes().getRawPointer(); > + if (const InvokeInst *CI = dyn_cast(I1)) > + return CI->getCallingConv() == cast(I2)->getCallingConv() && > + CI->getAttributes().getRawPointer() == > + cast(I2)->getAttributes().getRawPointer(); > + if (const InsertValueInst *IVI = dyn_cast(I1)) { > + if (IVI->getNumIndices() != cast(I2)->getNumIndices()) > + return false; > + for (unsigned i = 0, e = IVI->getNumIndices(); i != e; ++i) > + if (IVI->idx_begin()[i] != cast(I2)->idx_begin()[i]) > + return false; > + return true; > + } > + if (const ExtractValueInst *EVI = dyn_cast(I1)) { > + if (EVI->getNumIndices() != cast(I2)->getNumIndices()) > + return false; > + for (unsigned i = 0, e = EVI->getNumIndices(); i != e; ++i) > + if (EVI->idx_begin()[i] != cast(I2)->idx_begin()[i]) > + return false; > + return true; > + } > + > + return true; > } Shouldn't this have some special handling of GEPs too? A "gep {i32, i8}* %arg, i32 0, i32 1" is a different operation than "gep {i8, i8}* %arg, i32 0, i32 1" even though the types of the first operands (which are both pointers) are "equivalent". (Merging GEPs should probably require that the type *pointed at* by their first operands are equivalent) From fvbommel at wxs.nl Fri Jun 12 06:03:14 2009 From: fvbommel at wxs.nl (Frits van Bommel) Date: Fri, 12 Jun 2009 13:03:14 +0200 Subject: [llvm-commits] [llvm] r73222 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp In-Reply-To: <4A320DED.3060107@free.fr> References: <200906120804.n5C84tSO003731@zion.cs.uiuc.edu> <4A320DED.3060107@free.fr> Message-ID: <4A3235F2.9050605@wxs.nl> Duncan Sands wrote: > Hi Nick, > >> Emit thunks. > > is this a workaround for not all targets supporting > aliases? It's a workaround to make sure "(void*)&F == (void*)&G" doesn't break; if this wasn't done F and G couldn't be merged because it would change the value of that expression. From eocallaghan at auroraux.org Fri Jun 12 06:54:37 2009 From: eocallaghan at auroraux.org (Edward O'Callaghan) Date: Fri, 12 Jun 2009 12:54:37 +0100 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: References: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> <00F2DF2F-C994-4904-86DA-32BDFA8622E7@gmail.com> <521640720906111559n682a58a6r7371c85c1485b83@mail.gmail.com> Message-ID: <521640720906120454p5a95aa6bn7a09212a0bddb565@mail.gmail.com> Your taking things too the extremes, you can make note to people if its only a line or two, change it yourself while you did the reorder and commit. I would have taken note. I generated the patch correctly now and the other few too. Just get on with it and stop this, its wasting both our time for no reason at all. Thank You, Edward. 2009/6/12 Bill Wendling : > You should use "surname" instead of "second names". And now for more > being "pedantic". You can't have lines > 80 columns: > > --- llvm/CREDITS.TXT ? ?Thu Jun 11 23:47:24 2009 > +++ CREDITS.TXT Thu Jun 11 23:52:13 2009 > @@ -3,7 +3,7 @@ > ?LLVM, please submit a patch to this file to add yourself, and it > will be > ?done! > > -The list is sorted by name and formatted to allow easy grepping and > +The list is sorted by name (second names are in alphabetical order) > and formatted to allow easy grepping and > ?beautification by scripts. ?The fields are: name (N), email (E), web- > address > ?(W), PGP key ID and fingerprint (P), description (D), and snail-mail > address > ?(S). > > > -bw > > On Jun 11, 2009, at 3:59 PM, Edward O'Callaghan wrote: > >> Gezz, >> >> Your just making it hard for people to do work on llvm/clang by being >> so pedantic! >> I have taken note, so just please integrate the code changes so things >> may progress on the Solaris port. >> I hope this is optimal ;( I also added a note about the order in which >> the second names should be submitted too for others. >> >> Thank you, >> Edward. >> >> 2009/6/11 Bill Wendling : >>> On Jun 11, 2009, at 11:56 AM, Edward O'Callaghan wrote: >>> >>>> Hi Chris, >>>> >>>> Sorry but, you may not have noticed that the CREDITS file is *not* >>>> in >>>> alphabetical order. >>>> If you wish to sort it then OK, but I don't have that kind of time >>>> sorry. >>>> >>> Well, let's try to not make it worse than it is now. :-) >>> >>> -bw >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> >> >> >> -- >> -- >> Edward O'Callaghan >> http://www.auroraux.org/ >> eocallaghan at auroraux dot org >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- -- Edward O'Callaghan http://www.auroraux.org/ eocallaghan at auroraux dot org From baldrick at free.fr Fri Jun 12 07:30:00 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 12 Jun 2009 14:30:00 +0200 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <521640720906120454p5a95aa6bn7a09212a0bddb565@mail.gmail.com> References: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> <00F2DF2F-C994-4904-86DA-32BDFA8622E7@gmail.com> <521640720906111559n682a58a6r7371c85c1485b83@mail.gmail.com> <521640720906120454p5a95aa6bn7a09212a0bddb565@mail.gmail.com> Message-ID: <4A324A48.6050509@free.fr> Hi Edward, I think he was trying to be funny. It's often hard to tell how things are meant, so best to chill out and be cool dude! :) Ciao, Duncan. > Your taking things too the extremes, you can make note to people if > its only a line or two, change it yourself while you did the reorder > and commit. > I would have taken note. I generated the patch correctly now and the > other few too. Just get on with it and stop this, its wasting both our > time for no reason at all. > > Thank You, > Edward. > > > 2009/6/12 Bill Wendling : >> You should use "surname" instead of "second names". And now for more >> being "pedantic". You can't have lines > 80 columns: >> >> --- llvm/CREDITS.TXT Thu Jun 11 23:47:24 2009 >> +++ CREDITS.TXT Thu Jun 11 23:52:13 2009 >> @@ -3,7 +3,7 @@ >> LLVM, please submit a patch to this file to add yourself, and it >> will be >> done! >> >> -The list is sorted by name and formatted to allow easy grepping and >> +The list is sorted by name (second names are in alphabetical order) >> and formatted to allow easy grepping and >> beautification by scripts. The fields are: name (N), email (E), web- >> address >> (W), PGP key ID and fingerprint (P), description (D), and snail-mail >> address >> (S). >> >> >> -bw >> >> On Jun 11, 2009, at 3:59 PM, Edward O'Callaghan wrote: >> >>> Gezz, >>> >>> Your just making it hard for people to do work on llvm/clang by being >>> so pedantic! >>> I have taken note, so just please integrate the code changes so things >>> may progress on the Solaris port. >>> I hope this is optimal ;( I also added a note about the order in which >>> the second names should be submitted too for others. >>> >>> Thank you, >>> Edward. >>> >>> 2009/6/11 Bill Wendling : >>>> On Jun 11, 2009, at 11:56 AM, Edward O'Callaghan wrote: >>>> >>>>> Hi Chris, >>>>> >>>>> Sorry but, you may not have noticed that the CREDITS file is *not* >>>>> in >>>>> alphabetical order. >>>>> If you wish to sort it then OK, but I don't have that kind of time >>>>> sorry. >>>>> >>>> Well, let's try to not make it worse than it is now. :-) >>>> >>>> -bw >>>> >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> >>> >>> >>> -- >>> -- >>> Edward O'Callaghan >>> http://www.auroraux.org/ >>> eocallaghan at auroraux dot org >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > > From baldrick at free.fr Fri Jun 12 07:32:01 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 12 Jun 2009 14:32:01 +0200 Subject: [llvm-commits] [llvm] r73222 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp In-Reply-To: <4A3235F2.9050605@wxs.nl> References: <200906120804.n5C84tSO003731@zion.cs.uiuc.edu> <4A320DED.3060107@free.fr> <4A3235F2.9050605@wxs.nl> Message-ID: <4A324AC1.6030102@free.fr> Hi, >>> Emit thunks. >> is this a workaround for not all targets supporting >> aliases? > > It's a workaround to make sure "(void*)&F == (void*)&G" doesn't break; if this > wasn't done F and G couldn't be merged because it would change the value of that > expression. if F and G are now the same, is there something wrong with changing the value of the expression? Also, why not make use of an alias? Ciao, Duncan. From baldrick at free.fr Fri Jun 12 07:52:30 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 12 Jun 2009 12:52:30 -0000 Subject: [llvm-commits] [llvm] r73223 - /llvm/trunk/CREDITS.TXT Message-ID: <200906121252.n5CCqVVq013861@zion.cs.uiuc.edu> Author: baldrick Date: Fri Jun 12 07:52:24 2009 New Revision: 73223 URL: http://llvm.org/viewvc/llvm-project?rev=73223&view=rev Log: Credits for Edward O'Callaghan. Modified: llvm/trunk/CREDITS.TXT Modified: llvm/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=73223&r1=73222&r2=73223&view=diff ============================================================================== --- llvm/trunk/CREDITS.TXT (original) +++ llvm/trunk/CREDITS.TXT Fri Jun 12 07:52:24 2009 @@ -3,10 +3,10 @@ LLVM, please submit a patch to this file to add yourself, and it will be done! -The list is sorted by name and formatted to allow easy grepping and -beautification by scripts. The fields are: name (N), email (E), web-address -(W), PGP key ID and fingerprint (P), description (D), and snail-mail address -(S). +The list is sorted by name (second names are in alphabetical order) and +formatted to allow easy grepping and beautification by scripts. +The fields are: name (N), email (E), web-address (W), PGP key ID and +fingerprint (P), description (D), and snail-mail address (S). N: Vikram Adve E: vadve at cs.uiuc.edu @@ -231,6 +231,13 @@ E: scottm at aero.org D: Added STI Cell SPU backend. +N: Edward O'Callaghan +E: eocallaghan at auroraux.org +W: http://www.auroraux.org +D: Add Clang support with various other improvements to utils/NewNightlyTest.pl +D: Fix and maintain Solaris & AuroraUX support for llvm, various build warnings +D: and error clean ups. + N: Morten Ofstad E: morten at hue.no D: Visual C++ compatibility fixes From baldrick at free.fr Fri Jun 12 08:02:58 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 12 Jun 2009 13:02:58 -0000 Subject: [llvm-commits] [llvm] r73224 - /llvm/trunk/utils/NewNightlyTest.pl Message-ID: <200906121303.n5CD304o014208@zion.cs.uiuc.edu> Author: baldrick Date: Fri Jun 12 08:02:52 2009 New Revision: 73224 URL: http://llvm.org/viewvc/llvm-project?rev=73224&view=rev Log: Add clang support to the nightly test script. Patch by Edward O'Callaghan. Modified: llvm/trunk/utils/NewNightlyTest.pl Modified: llvm/trunk/utils/NewNightlyTest.pl URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/NewNightlyTest.pl?rev=73224&r1=73223&r2=73224&view=diff ============================================================================== --- llvm/trunk/utils/NewNightlyTest.pl (original) +++ llvm/trunk/utils/NewNightlyTest.pl Fri Jun 12 08:02:52 2009 @@ -11,8 +11,6 @@ # regressions and performance changes. Submits this information # to llvm.org where it is placed into the nightlytestresults database. # -# Modified heavily by Patrick Jenkins, July 2006 -# # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] # where # OPTIONS may include one or more of the following: @@ -26,10 +24,12 @@ # -nodejagnu Do not run feature or regression tests # -parallel Run parallel jobs with GNU Make (see -parallel-jobs). # -parallel-jobs The number of parallel Make jobs to use (default is two). +# -with-clang Checkout Clang source into tools/clang. # -release Build an LLVM Release version # -release-asserts Build an LLVM ReleaseAsserts version # -enable-llcbeta Enable testing of beta features in llc. # -enable-lli Enable testing of lli (interpreter) features, default is off +# -disable-pic Disable building with Position Independent Code. # -disable-llc Disable LLC tests in the nightly tester. # -disable-jit Disable JIT tests in the nightly tester. # -disable-cbe Disable C backend tests in the nightly tester. @@ -98,7 +98,7 @@ ############################################################## my $HOME = $ENV{'HOME'}; my $SVNURL = $ENV{"SVNURL"}; -$SVNURL = 'https://llvm.org/svn/llvm-project' unless $SVNURL; +$SVNURL = 'http://llvm.org/svn/llvm-project' unless $SVNURL; my $CVSRootDir = $ENV{'CVSROOT'}; $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; my $BuildDir = $ENV{'BUILDDIR'}; @@ -145,6 +145,7 @@ if (/^-norunningtests$/) { next; } # Backward compatibility, ignored. if (/^-parallel-jobs$/) { $PARALLELJOBS = "$ARGV[0]"; shift; next;} if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j$PARALLELJOBS -l3.0"; next; } + if (/^-with-clang$/) { $WITHCLANG = 1; next; } if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;} if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". @@ -152,6 +153,7 @@ "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release-asserts"; next;} if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } + if (/^-disable-pic$/) { $CONFIGUREARGS .= " --enable-pic=no"; next; } if (/^-enable-lli$/) { $PROGTESTOPTS .= " ENABLE_LLI=1"; $CONFIGUREARGS .= " --enable-lli"; next; } if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; @@ -534,13 +536,20 @@ if (!$NOCHECKOUT) { if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; } if ($USESVN) { - my $SVNCMD = "$NICE svn co $SVNURL"; - if ($VERBOSE) { - print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL"; + if ($VERBOSE) { + print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . + "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; + } + system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; - } - system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . - "$SVNCMD/test-suite/trunk llvm-test ) > $COLog 2>&1\n"; + if ($WITHCLANG) { + my $SVNCMD = "$NICE svn co --non-interactive $SVNURL/cfe/trunk"; + if ($VERBOSE) { + print "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog 2>&1\n"; + } + system "( time -p cd llvm/tools ; $SVNCMD clang ) > $COLog 2>&1\n"; + } } else { my $CVSOPT = ""; $CVSOPT = "-z3" # Use compression if going over ssh. @@ -611,7 +620,7 @@ if ($VERBOSE) { print "CHANGE HISTORY ANALYSIS STAGE\n"; } if ($USESVN) { - @SVNHistory = split / $BuildLog 2>&1"; if ( $VERBOSE ) { print "BUILD STAGE:\n"; + print "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1\n"; print "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1\n"; } # Build the entire tree, capturing the output into $BuildLog + system "(time -p $NICE $MAKECMD clean) >> $BuildLog 2>&1"; system "(time -p $NICE $MAKECMD $MAKEOPTS) >> $BuildLog 2>&1"; } From nicholas at mxc.ca Fri Jun 12 08:24:52 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 12 Jun 2009 13:24:52 -0000 Subject: [llvm-commits] [llvm] r73225 - /llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll Message-ID: <200906121324.n5CDOtM0014959@zion.cs.uiuc.edu> Author: nicholas Date: Fri Jun 12 08:24:41 2009 New Revision: 73225 URL: http://llvm.org/viewvc/llvm-project?rev=73225&view=rev Log: This test is wrong. If you have two weak functions F and G you can't make either one call the other since either one can be replaced at link time, and they need to be independent. Removed: llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll Removed: llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll?rev=73224&view=auto ============================================================================== --- llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll (original) +++ llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll (removed) @@ -1,11 +0,0 @@ -; RUN: llvm-as < %s | opt -mergefunc | llvm-dis | grep {alias weak} | count 2 - -define weak i32 @sum(i32 %x, i32 %y) { - %sum = add i32 %x, %y - ret i32 %sum -} - -define weak i32 @add(i32 %x, i32 %y) { - %sum = add i32 %x, %y - ret i32 %sum -} From nicholas at mxc.ca Fri Jun 12 08:30:44 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 12 Jun 2009 06:30:44 -0700 Subject: [llvm-commits] [llvm] r73222 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp In-Reply-To: <4A324AC1.6030102@free.fr> References: <200906120804.n5C84tSO003731@zion.cs.uiuc.edu> <4A320DED.3060107@free.fr> <4A3235F2.9050605@wxs.nl> <4A324AC1.6030102@free.fr> Message-ID: <4A325884.3040807@mxc.ca> Duncan Sands wrote: > Hi, > >>>> Emit thunks. >>> is this a workaround for not all targets supporting >>> aliases? >> It's a workaround to make sure "(void*)&F == (void*)&G" doesn't break; if this >> wasn't done F and G couldn't be merged because it would change the value of that >> expression. > > if F and G are now the same, is there something wrong with changing the > value of the expression? Also, why not make use of an alias? The effect of calling F is the same as the effect of calling G. The trouble is that someone may be depending on the fact that the two functions have different addresses for correctness. An alias has the address of the aliasee, so a statement of "if (F == G)" which was false before would before true after the transform. Any externally visible function could have its address taken, and any internal function has F->hasAddressTaken() called on it before deciding it's safe to use an alias. Also, there's a lot of linkage types that the verifier won't allow you to put on an alias, so unless it's one of the three whitelisted ones we emit a thunk instead. Nick From baldrick at free.fr Fri Jun 12 09:06:16 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 12 Jun 2009 16:06:16 +0200 Subject: [llvm-commits] [llvm] r73225 - /llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll In-Reply-To: <200906121324.n5CDOtM0014959@zion.cs.uiuc.edu> References: <200906121324.n5CDOtM0014959@zion.cs.uiuc.edu> Message-ID: <4A3260D8.4080800@free.fr> Hi Nick, > This test is wrong. If you have two weak functions F and G you can't make > either one call the other since either one can be replaced at link time, and > they need to be independent. you can always turn them into thunks to a third internal function. But I'm sure you already thought of that :) Ciao, Duncan. From nicolas.geoffray at lip6.fr Fri Jun 12 09:11:12 2009 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Fri, 12 Jun 2009 14:11:12 -0000 Subject: [llvm-commits] [llvm] r73227 - /llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200906121411.n5CEBFTZ016657@zion.cs.uiuc.edu> Author: geoffray Date: Fri Jun 12 09:11:08 2009 New Revision: 73227 URL: http://llvm.org/viewvc/llvm-project?rev=73227&view=rev Log: After obtaining the lock, look if the function has been codegen'd by another thread. Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=73227&r1=73226&r2=73227&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Fri Jun 12 09:11:08 2009 @@ -563,6 +563,11 @@ return Addr; // Check if function already code gen'd MutexGuard locked(lock); + + // Now that this thread owns the lock, check if another thread has already + // code gen'd the function. + if (void *Addr = getPointerToGlobalIfAvailable(F)) + return Addr; // Make sure we read in the function if it exists in this Module. if (F->hasNotBeenReadFromBitcode()) { From baldrick at free.fr Fri Jun 12 09:23:49 2009 From: baldrick at free.fr (Duncan Sands) Date: Fri, 12 Jun 2009 14:23:49 -0000 Subject: [llvm-commits] [llvm] r73228 - /llvm/trunk/utils/GenLibDeps.pl Message-ID: <200906121423.n5CENpjo017202@zion.cs.uiuc.edu> Author: baldrick Date: Fri Jun 12 09:23:42 2009 New Revision: 73228 URL: http://llvm.org/viewvc/llvm-project?rev=73228&view=rev Log: Tweak GenLibDeps.pl so it works on solaris. Patch by Edward O'Callaghan. Modified: llvm/trunk/utils/GenLibDeps.pl Modified: llvm/trunk/utils/GenLibDeps.pl URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/GenLibDeps.pl?rev=73228&r1=73227&r2=73228&view=diff ============================================================================== --- llvm/trunk/utils/GenLibDeps.pl (original) +++ llvm/trunk/utils/GenLibDeps.pl Fri Jun 12 09:23:42 2009 @@ -38,6 +38,10 @@ die "Can't find 'dot'" if (! -x "$DotPath"); } +if (defined($ENV{NM})) { + chomp($nmPath=$ENV{NM}); +} + if (!defined($nmPath) || $nmPath eq "") { chomp($nmPath=`which nm`); die "Can't find 'nm'" if (! -x "$nmPath"); @@ -96,7 +100,7 @@ print "
      $lib
        \n"; } open UNDEFS, - "$nmPath -g -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort | uniq |"; + "$nmPath -u $Directory/$lib | sed -e 's/^[ 0]* U //' | sort | uniq |"; my %DepLibs; while () { chomp; @@ -116,7 +120,7 @@ close UNDEFS or die "nm failed"; unless(keys %DepLibs) { # above failed - open UNDEFS, "$nmPath -g -u $Directory/$lib |"; + open UNDEFS, "$nmPath -u $Directory/$lib |"; while () { # to bypass non-working sed if (' ' eq substr($_,0,2) and index($_,'U ')) { From nicholas at mxc.ca Fri Jun 12 10:35:47 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 12 Jun 2009 08:35:47 -0700 Subject: [llvm-commits] [llvm] r73225 - /llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll In-Reply-To: <4A3260D8.4080800@free.fr> References: <200906121324.n5CDOtM0014959@zion.cs.uiuc.edu> <4A3260D8.4080800@free.fr> Message-ID: <4A3275D3.50107@mxc.ca> Duncan Sands wrote: > Hi Nick, > >> This test is wrong. If you have two weak functions F and G you can't make >> either one call the other since either one can be replaced at link time, and >> they need to be independent. > > you can always turn them into thunks to a third internal function. But > I'm sure you already thought of that :) I'm not very bright sometimes :) Yes, that's exactly what the pass used to do and I removed that in the overhaul by accident. I'll add that back. It may not be profitable but that's a different issue. Nick From nicholas at mxc.ca Fri Jun 12 10:57:11 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 12 Jun 2009 15:57:11 -0000 Subject: [llvm-commits] [llvm] r73230 - in /llvm/trunk: lib/Transforms/IPO/MergeFunctions.cpp test/Transforms/MergeFunc/fold-weak.ll Message-ID: <200906121557.n5CFvFrM020313@zion.cs.uiuc.edu> Author: nicholas Date: Fri Jun 12 10:56:56 2009 New Revision: 73230 URL: http://llvm.org/viewvc/llvm-project?rev=73230&view=rev Log: Given two identical weak functions, produce one internal function and two weak thunks. Added: llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=73230&r1=73229&r2=73230&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Fri Jun 12 10:56:56 2009 @@ -458,8 +458,8 @@ } static void ThunkGToF(Function *F, Function *G) { - Function *NewG = Function::Create(G->getFunctionType(), G->getLinkage(), - "", G->getParent()); + Function *NewG = Function::Create(G->getFunctionType(), G->getLinkage(), "", + G->getParent()); BasicBlock *BB = BasicBlock::Create("", NewG); std::vector Args; @@ -539,8 +539,21 @@ } break; - case ExternalWeak: - return false; + case ExternalWeak: { + assert(catG == ExternalWeak); + + // Make them both thunks to the same internal function. + F->setAlignment(std::max(F->getAlignment(), G->getAlignment())); + Function *H = Function::Create(F->getFunctionType(), F->getLinkage(), "", + F->getParent()); + H->copyAttributesFrom(F); + H->takeName(F); + + ThunkGToF(F, G); + ThunkGToF(F, H); + + F->setLinkage(GlobalValue::InternalLinkage); + } break; case Internal: switch (catG) { Added: llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll?rev=73230&view=auto ============================================================================== --- llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll (added) +++ llvm/trunk/test/Transforms/MergeFunc/fold-weak.ll Fri Jun 12 10:56:56 2009 @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | opt -mergefunc | llvm-dis > %t +; RUN: grep {define weak} %t | count 2 +; RUN: grep {call} %t | count 2 + +define weak i32 @sum(i32 %x, i32 %y) { + %sum = add i32 %x, %y + ret i32 %sum +} + +define weak i32 @add(i32 %x, i32 %y) { + %sum = add i32 %x, %y + ret i32 %sum +} From nicholas at mxc.ca Fri Jun 12 11:04:02 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 12 Jun 2009 16:04:02 -0000 Subject: [llvm-commits] [llvm] r73231 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Message-ID: <200906121604.n5CG42Qm020583@zion.cs.uiuc.edu> Author: nicholas Date: Fri Jun 12 11:04:00 2009 New Revision: 73231 URL: http://llvm.org/viewvc/llvm-project?rev=73231&view=rev Log: Don't forget to match the calling convention when producing a thunk. Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=73231&r1=73230&r2=73231&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Fri Jun 12 11:04:00 2009 @@ -478,6 +478,7 @@ CallInst *CI = CallInst::Create(F, Args.begin(), Args.end(), "", BB); CI->setTailCall(); + CI->setCallingConv(F->getCallingConv()); if (NewG->getReturnType() == Type::VoidTy) { ReturnInst::Create(BB); } else if (CI->getType() != NewG->getReturnType()) { @@ -492,8 +493,7 @@ G->replaceAllUsesWith(NewG); G->eraseFromParent(); - // TODO: look at direct callers to G and make them all direct callers to F - // iff G->hasAddressTaken() is false. + // TODO: look at direct callers to G and make them all direct callers to F. } static void AliasGToF(Function *F, Function *G) { From arnold.schwaighofer at gmail.com Fri Jun 12 11:26:57 2009 From: arnold.schwaighofer at gmail.com (Arnold Schwaighofer) Date: Fri, 12 Jun 2009 16:26:57 -0000 Subject: [llvm-commits] [llvm] r73233 - in /llvm/trunk: lib/Target/X86/X86CallingConv.td lib/Target/X86/X86FastISel.cpp lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2009-06-12-x86_64-tail-call-conv-out-of-sync-bug.ll test/CodeGen/X86/tailcallstack64.ll Message-ID: <200906121626.n5CGQwje021536@zion.cs.uiuc.edu> Author: arnolds Date: Fri Jun 12 11:26:57 2009 New Revision: 73233 URL: http://llvm.org/viewvc/llvm-project?rev=73233&view=rev Log: Fix Bug 4278: X86-64 with -tailcallopt calling convention out of sync with regular cc. The only difference between the tail call cc and the normal cc was that one parameter register - R9 - was reserved for calling functions through a function pointer. After time the tail call cc has gotten out of sync with the regular cc. We can use R11 which is also caller saved but not used as parameter register for potential function pointers and remove the special tail call cc on x86-64. Added: llvm/trunk/test/CodeGen/X86/2009-06-12-x86_64-tail-call-conv-out-of-sync-bug.ll Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td llvm/trunk/lib/Target/X86/X86FastISel.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/test/CodeGen/X86/tailcallstack64.ll Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=73233&r1=73232&r2=73233&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CallingConv.td (original) +++ llvm/trunk/lib/Target/X86/X86CallingConv.td Fri Jun 12 11:26:57 2009 @@ -215,50 +215,6 @@ CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToStack<8, 16>> ]>; -// Tail call convention (fast): One register is reserved for target address, -// namely R9 -def CC_X86_64_TailCall : CallingConv<[ - // Handles byval parameters. - CCIfByVal>, - - // Promote i8/i16 arguments to i32. - CCIfType<[i8, i16], CCPromoteToType>, - - // The 'nest' parameter, if any, is passed in R10. - CCIfNest>, - - // The first 6 integer arguments are passed in integer registers. - CCIfType<[i32], CCAssignToReg<[EDI, ESI, EDX, ECX, R8D]>>, - CCIfType<[i64], CCAssignToReg<[RDI, RSI, RDX, RCX, R8]>>, - - // The first 8 FP/Vector arguments are passed in XMM registers. - CCIfType<[f32, f64, v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], - CCIfSubtarget<"hasSSE1()", - CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>>, - - // The first 8 MMX (except for v1i64) vector arguments are passed in XMM - // registers on Darwin. - CCIfType<[v8i8, v4i16, v2i32, v2f32], - CCIfSubtarget<"isTargetDarwin()", - CCAssignToReg<[XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7]>>>, - - // The first 8 v1i64 vector arguments are passed in GPRs on Darwin. - CCIfType<[v1i64], - CCIfSubtarget<"isTargetDarwin()", - CCAssignToReg<[RDI, RSI, RDX, RCX, R8]>>>, - - // Integer/FP values get stored in stack slots that are 8 bytes in size and - // 8-byte aligned if there are no more registers to hold them. - CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>, - - // Vectors get 16-byte stack slots that are 16-byte aligned. - CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToStack<16, 16>>, - - // __m64 vectors get 8-byte stack slots that are 8-byte aligned. - CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToStack<8, 8>> -]>; - - //===----------------------------------------------------------------------===// // X86 C Calling Convention //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=73233&r1=73232&r2=73233&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Fri Jun 12 11:26:57 2009 @@ -171,8 +171,6 @@ if (Subtarget->is64Bit()) { if (Subtarget->isTargetWin64()) return CC_X86_Win64_C; - else if (CC == CallingConv::Fast && isTaillCall) - return CC_X86_64_TailCall; else return CC_X86_64_C; } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=73233&r1=73232&r2=73233&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Jun 12 11:26:57 2009 @@ -944,7 +944,7 @@ SDValue StackAdjustment = TailCall.getOperand(2); assert(((TargetAddress.getOpcode() == ISD::Register && (cast(TargetAddress)->getReg() == X86::EAX || - cast(TargetAddress)->getReg() == X86::R9)) || + cast(TargetAddress)->getReg() == X86::R11)) || TargetAddress.getOpcode() == ISD::TargetExternalSymbol || TargetAddress.getOpcode() == ISD::TargetGlobalAddress) && "Expecting an global address, external symbol, or register"); @@ -1171,8 +1171,6 @@ if (Subtarget->is64Bit()) { if (Subtarget->isTargetWin64()) return CC_X86_Win64_C; - else if (CC == CallingConv::Fast && PerformTailCallOpt) - return CC_X86_64_TailCall; else return CC_X86_64_C; } @@ -1799,7 +1797,7 @@ } else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) { Callee = DAG.getTargetExternalSymbol(S->getSymbol(), getPointerTy()); } else if (IsTailCall) { - unsigned Opc = Is64Bit ? X86::R9 : X86::EAX; + unsigned Opc = Is64Bit ? X86::R11 : X86::EAX; Chain = DAG.getCopyToReg(Chain, dl, DAG.getRegister(Opc, getPointerTy()), Added: llvm/trunk/test/CodeGen/X86/2009-06-12-x86_64-tail-call-conv-out-of-sync-bug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-06-12-x86_64-tail-call-conv-out-of-sync-bug.ll?rev=73233&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2009-06-12-x86_64-tail-call-conv-out-of-sync-bug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2009-06-12-x86_64-tail-call-conv-out-of-sync-bug.ll Fri Jun 12 11:26:57 2009 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -mattr=+sse2 -mtriple=x86_64-apple-darwin | grep fstpt +; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -mattr=+sse2 -mtriple=x86_64-apple-darwin | grep xmm + +; Check that x86-64 tail calls support x86_fp80 and v2f32 types. (Tail call +; calling convention out of sync with standard c calling convention on x86_64) +; Bug 4278. + +declare fastcc double @tailcallee(x86_fp80, <2 x float>) + +define fastcc double @tailcall() { +entry: + %tmp = fpext float 1.000000e+00 to x86_fp80 + %tmp2 = tail call fastcc double @tailcallee( x86_fp80 %tmp, <2 x float> ) + ret double %tmp2 +} Modified: llvm/trunk/test/CodeGen/X86/tailcallstack64.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tailcallstack64.ll?rev=73233&r1=73232&r2=73233&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/tailcallstack64.ll (original) +++ llvm/trunk/test/CodeGen/X86/tailcallstack64.ll Fri Jun 12 11:26:57 2009 @@ -3,19 +3,19 @@ ; Move param %in1 to temp register (%eax). ; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {movl 40(%rsp), %eax} ; Add %in1 %p1 to another temporary register (%r9d). -; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {movl %edi, %r9d} -; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {addl 32(%rsp), %r9d} +; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {movl %edi, %r10d} +; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {addl 32(%rsp), %r10d} ; Move result of addition to stack. -; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {movl %r9d, 40(%rsp)} +; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {movl %r10d, 40(%rsp)} ; Move param %in2 to stack. ; RUN: llvm-as < %s | llc -tailcallopt -march=x86-64 -x86-asm-syntax=att | grep {movl %eax, 32(%rsp)} -declare fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %a, i32 %b) +declare fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %a, i32 %b) -define fastcc i32 @tailcaller(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %in1, i32 %in2) { +define fastcc i32 @tailcaller(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %in1, i32 %in2) { entry: %tmp = add i32 %in1, %p1 - %retval = tail call fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %in2,i32 %tmp) + %retval = tail call fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %in2,i32 %tmp) ret i32 %retval } From fvbommel at wxs.nl Fri Jun 12 11:37:08 2009 From: fvbommel at wxs.nl (Frits van Bommel) Date: Fri, 12 Jun 2009 18:37:08 +0200 Subject: [llvm-commits] [llvm] r73230 - in /llvm/trunk: lib/Transforms/IPO/MergeFunctions.cpp test/Transforms/MergeFunc/fold-weak.ll In-Reply-To: <200906121557.n5CFvFrM020313@zion.cs.uiuc.edu> References: <200906121557.n5CFvFrM020313@zion.cs.uiuc.edu> Message-ID: <4A328434.8030800@wxs.nl> Nick Lewycky wrote: > Author: nicholas > Date: Fri Jun 12 10:56:56 2009 > New Revision: 73230 > > URL: http://llvm.org/viewvc/llvm-project?rev=73230&view=rev > Log: > Given two identical weak functions, produce one internal function and two weak > thunks. > + case ExternalWeak: { > + assert(catG == ExternalWeak); > + > + // Make them both thunks to the same internal function. > + F->setAlignment(std::max(F->getAlignment(), G->getAlignment())); > + Function *H = Function::Create(F->getFunctionType(), F->getLinkage(), "", > + F->getParent()); > + H->copyAttributesFrom(F); > + H->takeName(F); > + > + ThunkGToF(F, G); > + ThunkGToF(F, H); > + > + F->setLinkage(GlobalValue::InternalLinkage); > + } break; Here you're basically creating a declaration H with an identical signature to F just so ThunkGtoF can suck the life out of it, replace it with a thunk, and delete it, right? So shouldn't you also call F->replaceAllUsesWith(H) before doing that? Otherwise all uses of F would keep using the now-internal version instead of the thunk created for them... From nlewycky at google.com Fri Jun 12 12:09:14 2009 From: nlewycky at google.com (Nick Lewycky) Date: Fri, 12 Jun 2009 10:09:14 -0700 Subject: [llvm-commits] [llvm] r73230 - in /llvm/trunk: lib/Transforms/IPO/MergeFunctions.cpp test/Transforms/MergeFunc/fold-weak.ll In-Reply-To: <4A328434.8030800@wxs.nl> References: <200906121557.n5CFvFrM020313@zion.cs.uiuc.edu> <4A328434.8030800@wxs.nl> Message-ID: 2009/6/12 Frits van Bommel > Nick Lewycky wrote: > > Author: nicholas > > Date: Fri Jun 12 10:56:56 2009 > > New Revision: 73230 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=73230&view=rev > > Log: > > Given two identical weak functions, produce one internal function and two > weak > > thunks. > > > + case ExternalWeak: { > > + assert(catG == ExternalWeak); > > + > > + // Make them both thunks to the same internal function. > > + F->setAlignment(std::max(F->getAlignment(), G->getAlignment())); > > + Function *H = Function::Create(F->getFunctionType(), > F->getLinkage(), "", > > + F->getParent()); > > + H->copyAttributesFrom(F); > > + H->takeName(F); > > + > > + ThunkGToF(F, G); > > + ThunkGToF(F, H); > > + > > + F->setLinkage(GlobalValue::InternalLinkage); > > + } break; > > Here you're basically creating a declaration H with an identical signature > to F > just so ThunkGtoF can suck the life out of it, replace it with a thunk, and > delete it, right? > > So shouldn't you also call F->replaceAllUsesWith(H) before doing that? > Otherwise > all uses of F would keep using the now-internal version instead of the > thunk > created for them... Oops! Yes, you're exactly right. I'll commit the fix momentarily. Thanks for doing review! Nick > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090612/ff385832/attachment.html From nicholas at mxc.ca Fri Jun 12 12:16:59 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 12 Jun 2009 17:16:59 -0000 Subject: [llvm-commits] [llvm] r73235 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Message-ID: <200906121717.n5CHH1kr023230@zion.cs.uiuc.edu> Author: nicholas Date: Fri Jun 12 12:16:48 2009 New Revision: 73235 URL: http://llvm.org/viewvc/llvm-project?rev=73235&view=rev Log: Keep callers of a weak function calling it, instead of the non-weak equivalent. Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=73235&r1=73234&r2=73235&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Fri Jun 12 12:16:48 2009 @@ -548,6 +548,7 @@ F->getParent()); H->copyAttributesFrom(F); H->takeName(F); + F->replaceAllUsesWith(H); ThunkGToF(F, G); ThunkGToF(F, H); From nlewycky at google.com Fri Jun 12 12:17:19 2009 From: nlewycky at google.com (Nick Lewycky) Date: Fri, 12 Jun 2009 10:17:19 -0700 Subject: [llvm-commits] [llvm] r73222 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp In-Reply-To: <4A32334B.7020203@wxs.nl> References: <200906120804.n5C84tSO003731@zion.cs.uiuc.edu> <4A32334B.7020203@wxs.nl> Message-ID: 2009/6/12 Frits van Bommel > Nick Lewycky wrote: > > + // Check special state that is a part of some instructions. > > + if (const LoadInst *LI = dyn_cast(I1)) > > + return LI->isVolatile() == cast(I2)->isVolatile() && > > + LI->getAlignment() == cast(I2)->getAlignment(); > > + if (const StoreInst *SI = dyn_cast(I1)) > > + return SI->isVolatile() == cast(I2)->isVolatile() && > > + SI->getAlignment() == cast(I2)->getAlignment(); > > + if (const CmpInst *CI = dyn_cast(I1)) > > + return CI->getPredicate() == cast(I2)->getPredicate(); > > + if (const CallInst *CI = dyn_cast(I1)) > > + return CI->isTailCall() == cast(I2)->isTailCall() && > > + CI->getCallingConv() == cast(I2)->getCallingConv() > && > > + CI->getAttributes().getRawPointer() == > > + cast(I2)->getAttributes().getRawPointer(); > > + if (const InvokeInst *CI = dyn_cast(I1)) > > + return CI->getCallingConv() == > cast(I2)->getCallingConv() && > > + CI->getAttributes().getRawPointer() == > > + cast(I2)->getAttributes().getRawPointer(); > > + if (const InsertValueInst *IVI = dyn_cast(I1)) { > > + if (IVI->getNumIndices() != > cast(I2)->getNumIndices()) > > + return false; > > + for (unsigned i = 0, e = IVI->getNumIndices(); i != e; ++i) > > + if (IVI->idx_begin()[i] != > cast(I2)->idx_begin()[i]) > > + return false; > > + return true; > > + } > > + if (const ExtractValueInst *EVI = dyn_cast(I1)) { > > + if (EVI->getNumIndices() != > cast(I2)->getNumIndices()) > > + return false; > > + for (unsigned i = 0, e = EVI->getNumIndices(); i != e; ++i) > > + if (EVI->idx_begin()[i] != > cast(I2)->idx_begin()[i]) > > + return false; > > + return true; > > + } > > + > > + return true; > > } > > Shouldn't this have some special handling of GEPs too? A "gep {i32, i8}* > %arg, > i32 0, i32 1" is a different operation than "gep {i8, i8}* %arg, i32 0, i32 > 1" > even though the types of the first operands (which are both pointers) are > "equivalent". > (Merging GEPs should probably require that the type *pointed at* by their > first > operands are equivalent) Yes, you're right. Thanks again for doing review! Comparing the elements that come before the offset being computed is the right fix, but I'd have to think a bit about how to implement that. MergeFunctions is not on by default but if someone is relying on it a really quick fix would be to check for GEP and then compare real Type* of the first operand instead of looking at the equivalence. Nick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090612/0d6b37f4/attachment.html From isanbard at gmail.com Fri Jun 12 13:00:20 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 12 Jun 2009 11:00:20 -0700 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <4A324A48.6050509@free.fr> References: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> <00F2DF2F-C994-4904-86DA-32BDFA8622E7@gmail.com> <521640720906111559n682a58a6r7371c85c1485b83@mail.gmail.com> <521640720906120454p5a95aa6bn7a09212a0bddb565@mail.gmail.com> <4A324A48.6050509@free.fr> Message-ID: <472C1667-F96F-4208-8B6C-C8AAE3FAC35E@gmail.com> Perhaps droll. But in reality, we are very serious about what we accept as patches. We have rules and everyone gets the same treatment with regards to our coding standards (http://llvm.org/docs/CodingStandards.html ). There are no exceptions. And we don't clean up patches for people. That wastes too much of other programmers' time. -bw On Jun 12, 2009, at 5:30 AM, Duncan Sands wrote: > Hi Edward, I think he was trying to be funny. It's often hard to > tell how things are meant, so best to chill out and be cool dude! :) > > Ciao, > > Duncan. > >> Your taking things too the extremes, you can make note to people if >> its only a line or two, change it yourself while you did the reorder >> and commit. >> I would have taken note. I generated the patch correctly now and the >> other few too. Just get on with it and stop this, its wasting both >> our >> time for no reason at all. >> >> Thank You, >> Edward. >> >> >> 2009/6/12 Bill Wendling : >>> You should use "surname" instead of "second names". And now for more >>> being "pedantic". You can't have lines > 80 columns: >>> >>> --- llvm/CREDITS.TXT Thu Jun 11 23:47:24 2009 >>> +++ CREDITS.TXT Thu Jun 11 23:52:13 2009 >>> @@ -3,7 +3,7 @@ >>> LLVM, please submit a patch to this file to add yourself, and it >>> will be >>> done! >>> >>> -The list is sorted by name and formatted to allow easy grepping and >>> +The list is sorted by name (second names are in alphabetical order) >>> and formatted to allow easy grepping and >>> beautification by scripts. The fields are: name (N), email (E), >>> web- >>> address >>> (W), PGP key ID and fingerprint (P), description (D), and snail-mail >>> address >>> (S). >>> >>> >>> -bw >>> >>> On Jun 11, 2009, at 3:59 PM, Edward O'Callaghan wrote: >>> >>>> Gezz, >>>> >>>> Your just making it hard for people to do work on llvm/clang by >>>> being >>>> so pedantic! >>>> I have taken note, so just please integrate the code changes so >>>> things >>>> may progress on the Solaris port. >>>> I hope this is optimal ;( I also added a note about the order in >>>> which >>>> the second names should be submitted too for others. >>>> >>>> Thank you, >>>> Edward. >>>> >>>> 2009/6/11 Bill Wendling : >>>>> On Jun 11, 2009, at 11:56 AM, Edward O'Callaghan wrote: >>>>> >>>>>> Hi Chris, >>>>>> >>>>>> Sorry but, you may not have noticed that the CREDITS file is >>>>>> *not* >>>>>> in >>>>>> alphabetical order. >>>>>> If you wish to sort it then OK, but I don't have that kind of >>>>>> time >>>>>> sorry. >>>>>> >>>>> Well, let's try to not make it worse than it is now. :-) >>>>> >>>>> -bw >>>>> >>>>> _______________________________________________ >>>>> llvm-commits mailing list >>>>> llvm-commits at cs.uiuc.edu >>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>>> >>>> >>>> >>>> -- >>>> -- >>>> Edward O'Callaghan >>>> http://www.auroraux.org/ >>>> eocallaghan at auroraux dot org >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> >> >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Fri Jun 12 13:02:53 2009 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 12 Jun 2009 18:02:53 -0000 Subject: [llvm-commits] [llvm] r73236 - /llvm/trunk/CREDITS.TXT Message-ID: <200906121802.n5CI2uZW024600@zion.cs.uiuc.edu> Author: void Date: Fri Jun 12 13:02:40 2009 New Revision: 73236 URL: http://llvm.org/viewvc/llvm-project?rev=73236&view=rev Log: Waste time fixing something that should have been fixed before. Modified: llvm/trunk/CREDITS.TXT Modified: llvm/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=73236&r1=73235&r2=73236&view=diff ============================================================================== --- llvm/trunk/CREDITS.TXT (original) +++ llvm/trunk/CREDITS.TXT Fri Jun 12 13:02:40 2009 @@ -3,10 +3,10 @@ LLVM, please submit a patch to this file to add yourself, and it will be done! -The list is sorted by name (second names are in alphabetical order) and -formatted to allow easy grepping and beautification by scripts. -The fields are: name (N), email (E), web-address (W), PGP key ID and -fingerprint (P), description (D), and snail-mail address (S). +The list is sorted by surname and formatted to allow easy grepping and +beautification by scripts. The fields are: name (N), email (E), web-address +(W), PGP key ID and fingerprint (P), description (D), and snail-mail address +(S). N: Vikram Adve E: vadve at cs.uiuc.edu From evan.cheng at apple.com Fri Jun 12 13:12:03 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 12 Jun 2009 11:12:03 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegist In-Reply-To: <305d6f60906111647i4068c9aduacdf91defae45d44@mail.gmail.com> References: <305d6f60906110010l37762b0br64c9d75b7f149915@mail.gmail.com> <41FF1606-AC7C-496F-BDFA-9A9BBFE9606B@apple.com> <305d6f60906111647i4068c9aduacdf91defae45d44@mail.gmail.com> Message-ID: <2C75AFA1-F51C-4FF0-ACF1-797CE8F45A03@apple.com> On Jun 11, 2009, at 4:47 PM, Sandeep Patel wrote: > On Thu, Jun 11, 2009 at 2:33 PM, Bob Wilson > wrote: >> >> On Jun 11, 2009, at 11:52 AM, Evan Cheng wrote: >>> >>> On Jun 11, 2009, at 11:32 AM, Chris Lattner wrote: >>>> >>>> Why not put this into the target triple? Major ABI issues like >>>> this >>>> seem like they belong in the triple. >>> >>> It's not always clear what information we want to encode in triplet. >>> In this case, it seems reasonable to encode float abi in the >>> triplet. >>> But how do we want encode this? Do we want to use it to toggle fp >>> abi >>> for any target, e.g. arm-apple-darwin-apcs? >> >> Since target triples are a GNU thing, it would be a good idea to be >> compatible with GCC on this. I know that for the base AAPCS ABI GCC >> uses an "eabi" suffix on the OS portion of the triple, e.g., arm- >> linux- >> gnueabi. >> >> When I last worked on GCC, it had no support for the "hardfloat" >> AAPCS >> ABI, but I heard that it was added since then. Does anyone know if >> GCC uses something in the triple ("eabi-hardfloat" suffix??) to >> indicate this? >> >> Since this fp ABI is an extension of AAPCS, it would only make sense >> to allow toggling something in the target triple for targets that use >> AAPCS (not Darwin). > > GCC did not change the target triple to indicate use of hard float; > it's still arm-linux-gnueabi. GCC even allows a function attribute to > change the ABI per function in support of kernel development and other > cases where one may need to mix ABIs (e.g. a library that supports > legacy soft float applications, etc.). Ok. Then it makes more sense for it to be a function note. We should be able to figure out a way to change calling convention (and other subtarget states). Evan > > > deep > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Fri Jun 12 13:39:06 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 12 Jun 2009 18:39:06 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r73238 - /llvm-gcc-4.2/trunk/gcc/c-decl.c Message-ID: <200906121839.n5CId6WO025733@zion.cs.uiuc.edu> Author: johannes Date: Fri Jun 12 13:39:06 2009 New Revision: 73238 URL: http://llvm.org/viewvc/llvm-project?rev=73238&view=rev Log: Make sure nested constructors get emitted. PR 3518. Modified: llvm-gcc-4.2/trunk/gcc/c-decl.c Modified: llvm-gcc-4.2/trunk/gcc/c-decl.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-decl.c?rev=73238&r1=73237&r2=73238&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-decl.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-decl.c Fri Jun 12 13:39:06 2009 @@ -4341,7 +4341,9 @@ { /* This decl needs a name for the assembler output. */ set_compound_literal_name (decl); +#ifndef ENABLE_LLVM DECL_DEFER_OUTPUT (decl) = 1; +#endif DECL_COMDAT (decl) = 1; DECL_ARTIFICIAL (decl) = 1; DECL_IGNORED_P (decl) = 1; From dalej at apple.com Fri Jun 12 13:41:53 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 12 Jun 2009 18:41:53 -0000 Subject: [llvm-commits] [llvm] r73239 - /llvm/trunk/test/FrontendC/pr3518.c Message-ID: <200906121841.n5CIfr40025836@zion.cs.uiuc.edu> Author: johannes Date: Fri Jun 12 13:41:53 2009 New Revision: 73239 URL: http://llvm.org/viewvc/llvm-project?rev=73239&view=rev Log: Testcase for llvm-gcc patch 73238. Added: llvm/trunk/test/FrontendC/pr3518.c Added: llvm/trunk/test/FrontendC/pr3518.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/pr3518.c?rev=73239&view=auto ============================================================================== --- llvm/trunk/test/FrontendC/pr3518.c (added) +++ llvm/trunk/test/FrontendC/pr3518.c Fri Jun 12 13:41:53 2009 @@ -0,0 +1,24 @@ +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep {= internal global} | count 4 +// PR 3518 +// Some of the objects were coming out as unintialized (external) before 3518 +// was fixed. Internal names are different between llvm-gcc and clang so they +// are not tested. + +extern void abort (void); + +struct A { int i; int j; }; +struct B { struct A *a; struct A *b; }; +struct C { struct B *c; struct A *d; }; +struct C e = { &(struct B) { &(struct A) { 1, 2 }, &(struct A) { 3, 4 } }, &(struct A) { 5, 6 } }; + +int +main (void) +{ + if (e.c->a->i != 1 || e.c->a->j != 2) + abort (); + if (e.c->b->i != 3 || e.c->b->j != 4) + abort (); + if (e.d->i != 5 || e.d->j != 6) + abort (); + return 0; +} From gohman at apple.com Fri Jun 12 14:03:05 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 12 Jun 2009 19:03:05 -0000 Subject: [llvm-commits] [llvm] r73241 - in /llvm/trunk/lib: Transforms/IPO/MergeFunctions.cpp VMCore/Instruction.cpp Message-ID: <200906121903.n5CJ35uX026605@zion.cs.uiuc.edu> Author: djg Date: Fri Jun 12 14:03:05 2009 New Revision: 73241 URL: http://llvm.org/viewvc/llvm-project?rev=73241&view=rev Log: Give Instruction::isSameOperationAs a corresponding comment to note the relationship with MergeFunctions.cpp's isEquivalentOperation, and make a trivial code reordering so that the two functions are easier to compare. Fix the name of Instruction::isSameOperationAs in MergeFunction.cpp's isEquivalentOperation's comment, and fix a nearby 80-column violation. Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp llvm/trunk/lib/VMCore/Instruction.cpp Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=73241&r1=73240&r2=73241&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Fri Jun 12 14:03:05 2009 @@ -180,8 +180,9 @@ /// isEquivalentOperation - determine whether the two operations are the same /// except that pointer-to-A and pointer-to-B are equivalent. This should be -/// kept in sync with Instruction::isSameOperandAs. -static bool isEquivalentOperation(const Instruction *I1, const Instruction *I2) { +/// kept in sync with Instruction::isSameOperationAs. +static bool +isEquivalentOperation(const Instruction *I1, const Instruction *I2) { if (I1->getOpcode() != I2->getOpcode() || I1->getNumOperands() != I2->getNumOperands() || !isEquivalentType(I1->getType(), I2->getType())) Modified: llvm/trunk/lib/VMCore/Instruction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instruction.cpp?rev=73241&r1=73240&r2=73241&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instruction.cpp (original) +++ llvm/trunk/lib/VMCore/Instruction.cpp Fri Jun 12 14:03:05 2009 @@ -218,9 +218,12 @@ } // isSameOperationAs +// This should be kept in sync with isEquivalentOperation in +// lib/Transforms/IPO/MergeFunctions.cpp. bool Instruction::isSameOperationAs(const Instruction *I) const { - if (getOpcode() != I->getOpcode() || getType() != I->getType() || - getNumOperands() != I->getNumOperands()) + if (getOpcode() != I->getOpcode() || + getNumOperands() != I->getNumOperands() || + getType() != I->getType()) return false; // We have two instructions of identical opcode and #operands. Check to see From gohman at apple.com Fri Jun 12 14:23:25 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 12 Jun 2009 19:23:25 -0000 Subject: [llvm-commits] [llvm] r73243 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/fsub-fsub.ll Message-ID: <200906121923.n5CJNQZa027501@zion.cs.uiuc.edu> Author: djg Date: Fri Jun 12 14:23:25 2009 New Revision: 73243 URL: http://llvm.org/viewvc/llvm-project?rev=73243&view=rev Log: Don't do (x - (y - z)) --> (x + (z - y)) on floating-point types, because it may round differently. This fixes PR4374. Added: llvm/trunk/test/Transforms/InstCombine/fsub-fsub.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=73243&r1=73242&r2=73243&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri Jun 12 14:23:25 2009 @@ -2608,21 +2608,6 @@ else if (Op1I->getOperand(1) == Op0) // X-(Y+X) == -Y return BinaryOperator::CreateFNeg(Op1I->getOperand(0), I.getName()); } - - if (Op1I->hasOneUse()) { - // Replace (x - (y - z)) with (x + (z - y)) if the (y - z) subexpression - // is not used by anyone else... - // - if (Op1I->getOpcode() == Instruction::FSub) { - // Swap the two operands of the subexpr... - Value *IIOp0 = Op1I->getOperand(0), *IIOp1 = Op1I->getOperand(1); - Op1I->setOperand(0, IIOp1); - Op1I->setOperand(1, IIOp0); - - // Create the new top level fadd instruction... - return BinaryOperator::CreateFAdd(Op0, Op1); - } - } } return 0; Added: llvm/trunk/test/Transforms/InstCombine/fsub-fsub.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fsub-fsub.ll?rev=73243&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/fsub-fsub.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/fsub-fsub.ll Fri Jun 12 14:23:25 2009 @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep fsub | count 2 +; PR4374 + +define float @func(float %a, float %b) nounwind { + %tmp3 = fsub float %a, %b + %tmp4 = fsub float -0.000000e+00, %tmp3 + ret float %tmp4 +} From dpatel at apple.com Fri Jun 12 14:24:05 2009 From: dpatel at apple.com (Devang Patel) Date: Fri, 12 Jun 2009 19:24:05 -0000 Subject: [llvm-commits] [llvm] r73244 - in /llvm/trunk: lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/DebugInfo/2009-06-12-Inline.ll Message-ID: <200906121924.n5CJO6s5027538@zion.cs.uiuc.edu> Author: dpatel Date: Fri Jun 12 14:24:05 2009 New Revision: 73244 URL: http://llvm.org/viewvc/llvm-project?rev=73244&view=rev Log: Clear AbstractInstanceRootMap at the end of the function. Added: llvm/trunk/test/DebugInfo/2009-06-12-Inline.ll Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=73244&r1=73243&r2=73244&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jun 12 14:24:05 2009 @@ -1581,6 +1581,7 @@ FunctionDbgScope = NULL; LexicalScopeStack.clear(); AbstractInstanceRootList.clear(); + AbstractInstanceRootMap.clear(); } Lines.clear(); Added: llvm/trunk/test/DebugInfo/2009-06-12-Inline.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-06-12-Inline.ll?rev=73244&view=auto ============================================================================== --- llvm/trunk/test/DebugInfo/2009-06-12-Inline.ll (added) +++ llvm/trunk/test/DebugInfo/2009-06-12-Inline.ll Fri Jun 12 14:24:05 2009 @@ -0,0 +1,94 @@ +; RUN: llvm-as < %s | llc -f -o /dev/null + %llvm.dbg.anchor.type = type { i32, i32 } + %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } + %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 } + %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }*, i32 } + %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* } + %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } + %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* } + %struct._objc_cache = type opaque + %struct._objc_category = type { i8*, i8*, %struct._objc_method_list*, %struct._objc_method_list*, %struct._objc_protocol_list*, i32, %struct._prop_list_t* } + %struct._objc_class = type { %struct._objc_class*, %struct._objc_class*, i8*, i32, i32, i32, %struct._objc_ivar_list*, %struct._objc_method_list*, %struct._objc_cache*, %struct._objc_protocol_list*, i8*, %struct._objc_class_extension* } + %struct._objc_class_extension = type { i32, i8*, %struct._prop_list_t* } + %struct._objc_exception_data = type { [18 x i32], [4 x i8*] } + %struct._objc_ivar = type { i8*, i8*, i32 } + %struct._objc_ivar_list = type opaque + %struct._objc_method = type { %struct.objc_selector*, i8*, i8* } + %struct._objc_method_description = type { %struct.objc_selector*, i8* } + %struct._objc_method_description_list = type { i32, [0 x %struct._objc_method_description] } + %struct._objc_method_list = type opaque + %struct._objc_module = type { i32, i32, i8*, %struct._objc_symtab* } + %struct._objc_protocol = type { %struct._objc_protocol_extension*, i8*, %struct._objc_protocol_list*, %struct._objc_method_description_list*, %struct._objc_method_description_list* } + %struct._objc_protocol_extension = type { i32, %struct._objc_method_description_list*, %struct._objc_method_description_list*, %struct._prop_list_t* } + %struct._objc_protocol_list = type { %struct._objc_protocol_list*, i32, [0 x %struct._objc_protocol] } + %struct._objc_super = type <{ %struct.objc_object*, %struct.objc_class* }> + %struct._objc_symtab = type { i32, %struct.objc_selector*, i16, i16, [0 x i8*] } + %struct._prop_list_t = type { i32, i32, [0 x %struct._prop_t] } + %struct._prop_t = type { i8*, i8* } + %struct.objc_class = type opaque + %struct.objc_object = type opaque + %struct.objc_selector = type opaque +@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__OBJC, __image_info,regular" ; <[2 x i32]*> [#uses=1] + at llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] + at .str = internal constant [4 x i8] c"t.m\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] + at .str1 = internal constant [20 x i8] c"/Volumes/work/Radar\00", section "llvm.metadata" ; <[20 x i8]*> [#uses=1] + at .str2 = internal constant [10 x i8] c"clang 1.0\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1] + at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 16, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([20 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([10 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null, i32 1 }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] + at llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] + at .str3 = internal constant [3 x i8] c"f1\00", section "llvm.metadata" ; <[3 x i8]*> [#uses=1] + at llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([3 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([3 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([3 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 3, { }* null, i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] + at .str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] + at llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] + at llvm.dbg.array = internal constant [2 x { }*] [{ }* null, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*)], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1] + at llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array to { }*), i32 0 }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1] + at llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* null, i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1] + at .str5 = internal constant [3 x i8] c"l0\00", section "llvm.metadata" ; <[3 x i8]*> [#uses=1] + at llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459008, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([3 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 5, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] + at .str6 = internal constant [3 x i8] c"f0\00", section "llvm.metadata" ; <[3 x i8]*> [#uses=1] + at llvm.dbg.subprogram7 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([3 x i8]* @.str6, i32 0, i32 0), i8* getelementptr ([3 x i8]* @.str6, i32 0, i32 0), i8* getelementptr ([3 x i8]* @.str6, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* null, i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] + at .str8 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1] + at llvm.dbg.variable9 = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram7 to { }*), i8* getelementptr ([2 x i8]* @.str8, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1] +@"\01L_OBJC_CLASS_NAME_" = internal global [1 x i8] zeroinitializer, section "__TEXT,__cstring,cstring_literals", align 1 ; <[1 x i8]*> [#uses=1] +@"\01L_OBJC_MODULES" = internal global %struct._objc_module { i32 7, i32 16, i8* getelementptr ([1 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), %struct._objc_symtab* null }, section "__OBJC,__module_info,regular,no_dead_strip", align 4 ; <%struct._objc_module*> [#uses=1] + at llvm.used = appending global [3 x i8*] [i8* bitcast ([2 x i32]* @"\01L_OBJC_IMAGE_INFO" to i8*), i8* getelementptr ([1 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), i8* bitcast (%struct._objc_module* @"\01L_OBJC_MODULES" to i8*)], section "llvm.metadata" ; <[3 x i8*]*> [#uses=0] + +define void @f1() nounwind { +entry: + %x.addr.i = alloca i32 ; [#uses=2] + %l0 = alloca void (i32)*, align 4 ; [#uses=2] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) + call void @llvm.dbg.stoppoint(i32 4, i32 3, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram7 to { }*)) + store i32 1, i32* %x.addr.i + %0 = bitcast i32* %x.addr.i to { }* ; <{ }*> [#uses=1] + call void @llvm.dbg.declare({ }* %0, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable9 to { }*)) + call void @llvm.dbg.stoppoint(i32 2, i32 66, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + call void @llvm.dbg.stoppoint(i32 5, i32 3, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram7 to { }*)) + %1 = bitcast void (i32)** %l0 to { }* ; <{ }*> [#uses=1] + call void @llvm.dbg.declare({ }* %1, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*)) + store void (i32)* @f0, void (i32)** %l0 + call void @llvm.dbg.stoppoint(i32 6, i32 1, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) + ret void +} + +declare void @llvm.dbg.func.start({ }*) nounwind readnone + +declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind readnone + +define internal void @f0(i32 %x) nounwind alwaysinline { +entry: + %x.addr = alloca i32 ; [#uses=2] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram7 to { }*)) + store i32 %x, i32* %x.addr + %0 = bitcast i32* %x.addr to { }* ; <{ }*> [#uses=1] + call void @llvm.dbg.declare({ }* %0, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable9 to { }*)) + call void @llvm.dbg.stoppoint(i32 2, i32 66, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram7 to { }*)) + ret void +} + +declare void @llvm.dbg.declare({ }*, { }*) nounwind readnone + +declare void @llvm.dbg.region.end({ }*) nounwind readnone From dpatel at apple.com Fri Jun 12 14:45:19 2009 From: dpatel at apple.com (Devang Patel) Date: Fri, 12 Jun 2009 19:45:19 -0000 Subject: [llvm-commits] [llvm] r73246 - /llvm/trunk/docs/LangRef.html Message-ID: <200906121945.n5CJjJY2028227@zion.cs.uiuc.edu> Author: dpatel Date: Fri Jun 12 14:45:19 2009 New Revision: 73246 URL: http://llvm.org/viewvc/llvm-project?rev=73246&view=rev Log: Document noredzone and noimplicitfloat function attributes. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=73246&r1=73245&r2=73246&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Fri Jun 12 14:45:19 2009 @@ -1091,19 +1091,27 @@ see if it has been overwritten. A heuristic is used to determine if a function needs stack protectors or not. -

        If a function that has an ssp attribute is inlined into a function +

        If a function that has an ssp attribute is inlined into a function that doesn't have an ssp attribute, then the resulting function will -have an ssp attribute.

      +have an ssp attribute.
    sspreq
    This attribute indicates that the function should always emit a stack smashing protector. This overrides the ssp function attribute. -

    If a function that has an sspreq attribute is inlined into a +If a function that has an sspreq attribute is inlined into a function that doesn't have an sspreq attribute or which has an ssp attribute, then the resulting function will have -an sspreq attribute.

    +an sspreq attribute. + +
    noredzone
    +
    This attribute indicates that the code generator should not enforce red zone +mandated by target specific ABI.
    + +
    noimplicitfloat
    +
    This attributes disables implicit floating point instructions.
    + From dpatel at apple.com Fri Jun 12 14:58:04 2009 From: dpatel at apple.com (Devang Patel) Date: Fri, 12 Jun 2009 19:58:04 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r73248 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Message-ID: <200906121958.n5CJw4es028706@zion.cs.uiuc.edu> Author: dpatel Date: Fri Jun 12 14:58:03 2009 New Revision: 73248 URL: http://llvm.org/viewvc/llvm-project?rev=73248&view=rev Log: Red zone setting is meaningful only if TARGET_64BIT is set. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=73248&r1=73247&r2=73248&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Fri Jun 12 14:58:03 2009 @@ -90,7 +90,7 @@ } #define LLVM_SET_RED_ZONE_FLAG(disable_red_zone) \ - if (TARGET_NO_RED_ZONE) \ + if (TARGET_64BIT && TARGET_NO_RED_ZONE) \ disable_red_zone = 1; #ifdef LLVM_ABI_H From devang.patel at gmail.com Fri Jun 12 14:58:59 2009 From: devang.patel at gmail.com (Devang Patel) Date: Fri, 12 Jun 2009 12:58:59 -0700 Subject: [llvm-commits] [llvm] r72894 - in /llvm/trunk: include/llvm/Attributes.h include/llvm/Target/TargetOptions.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Target/PowerPC/PPCRegisterInfo.cpp lib/Target/TargetMach Message-ID: <352a1fb20906121258l1b584e2ah1b7c52ed1c54a9cf@mail.gmail.com> On Mon, Jun 8, 2009 at 11:25 AM, Dan Gohman wrote: > > On Jun 8, 2009, at 10:06 AM, Devang Patel wrote: >>> >>> Also, I'm now getting "noredzone" notes on all my functions all the >>> >>> time when building x86-32 Linux. I suppose that's technically true >>> >>> but do we really need this everywhere? >>> >> >> llvm-gcc sets this when -mno-red-zone is set by GCC's target >> machinery. > > x86-32 never has a redzone, so it shouldn't require > noredzone notes everywhere. ?I realize that the currrent code > is just using the values of flags inside GCC, but having > meaningless function notes everywhere is undesirable. Can > you find some way to suppress noredzone notes on targets > which never have red zones? Done. - Devang From dalej at apple.com Fri Jun 12 15:35:32 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 12 Jun 2009 13:35:32 -0700 Subject: [llvm-commits] [llvm] r73243 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/fsub-fsub.ll In-Reply-To: <200906121923.n5CJNQZa027501@zion.cs.uiuc.edu> References: <200906121923.n5CJNQZa027501@zion.cs.uiuc.edu> Message-ID: <4F807148-4829-4E9D-B16D-18B4153A4D6A@apple.com> On Jun 12, 2009, at 12:23 PMPDT, Dan Gohman wrote: > Author: djg > Date: Fri Jun 12 14:23:25 2009 > New Revision: 73243 > > URL: http://llvm.org/viewvc/llvm-project?rev=73243&view=rev > Log: > Don't do (x - (y - z)) --> (x + (z - y)) on floating-point types, > because > it may round differently. This fixes PR4374. Shouldn't we do this if UnsafeFPMath is on? > > Added: > llvm/trunk/test/Transforms/InstCombine/fsub-fsub.ll > Modified: > llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=73243&r1=73242&r2=73243&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > (original) > +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri > Jun 12 14:23:25 2009 > @@ -2608,21 +2608,6 @@ > else if (Op1I->getOperand(1) == Op0) // X-(Y+X) == -Y > return BinaryOperator::CreateFNeg(Op1I->getOperand(0), > I.getName()); > } > - > - if (Op1I->hasOneUse()) { > - // Replace (x - (y - z)) with (x + (z - y)) if the (y - z) > subexpression > - // is not used by anyone else... > - // > - if (Op1I->getOpcode() == Instruction::FSub) { > - // Swap the two operands of the subexpr... > - Value *IIOp0 = Op1I->getOperand(0), *IIOp1 = Op1I- > >getOperand(1); > - Op1I->setOperand(0, IIOp1); > - Op1I->setOperand(1, IIOp0); > - > - // Create the new top level fadd instruction... > - return BinaryOperator::CreateFAdd(Op0, Op1); > - } > - } > } > > return 0; > > Added: llvm/trunk/test/Transforms/InstCombine/fsub-fsub.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fsub-fsub.ll?rev=73243&view=auto > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/Transforms/InstCombine/fsub-fsub.ll (added) > +++ llvm/trunk/test/Transforms/InstCombine/fsub-fsub.ll Fri Jun 12 > 14:23:25 2009 > @@ -0,0 +1,8 @@ > +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep fsub | > count 2 > +; PR4374 > + > +define float @func(float %a, float %b) nounwind { > + %tmp3 = fsub float %a, %b > + %tmp4 = fsub float -0.000000e+00, %tmp3 > + ret float %tmp4 > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Fri Jun 12 15:46:18 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 12 Jun 2009 20:46:18 -0000 Subject: [llvm-commits] [llvm] r73252 - in /llvm/trunk: lib/Target/ARM/ARMInstrInfo.td lib/Target/ARM/ARMInstrThumb.td lib/Target/ARM/ARMInstrVFP.td test/CodeGen/ARM/lsr-code-insertion.ll Message-ID: <200906122046.n5CKkJxf030377@zion.cs.uiuc.edu> Author: evancheng Date: Fri Jun 12 15:46:18 2009 New Revision: 73252 URL: http://llvm.org/viewvc/llvm-project?rev=73252&view=rev Log: Mark some pattern-less instructions as neverHasSideEffects. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/ARMInstrVFP.td llvm/trunk/test/CodeGen/ARM/lsr-code-insertion.ll Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=73252&r1=73251&r2=73252&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Fri Jun 12 15:46:18 2009 @@ -451,7 +451,7 @@ /// the function. The first operand is the ID# for this instruction, the second /// is the index into the MachineConstantPool that this is, the third is the /// size in bytes of this constant pool entry. -let isNotDuplicable = 1 in +let neverHasSideEffects = 1, isNotDuplicable = 1 in def CONSTPOOL_ENTRY : PseudoInst<(outs), (ins cpinst_operand:$instid, cpinst_operand:$cpidx, i32imm:$size), @@ -771,6 +771,7 @@ // Move Instructions. // +let neverHasSideEffects = 1 in def MOVr : AsI1<0b1101, (outs GPR:$dst), (ins GPR:$src), DPFrm, "mov", " $dst, $src", []>, UnaryDP; def MOVs : AsI1<0b1101, (outs GPR:$dst), (ins so_reg:$src), DPSoRegFrm, @@ -946,6 +947,7 @@ [(set GPR:$dst, (add (mul GPR:$a, GPR:$b), GPR:$c))]>; // Extra precision multiplies with low / high results +let neverHasSideEffects = 1 in { def SMULL : AsMul1I<0b0000110, (outs GPR:$ldst, GPR:$hdst), (ins GPR:$a, GPR:$b), "smull", " $ldst, $hdst, $a, $b", []>; @@ -967,6 +969,7 @@ (ins GPR:$a, GPR:$b), "umaal", " $ldst, $hdst, $a, $b", []>, Requires<[IsARM, HasV6]>; +} // neverHasSideEffects // Most significant word multiply def SMMUL : AMul2I <0b0111010, (outs GPR:$dst), (ins GPR:$a, GPR:$b), Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=73252&r1=73251&r2=73252&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Fri Jun 12 15:46:18 2009 @@ -298,6 +298,7 @@ "add $dst, $lhs, $rhs", [(set tGPR:$dst, (add tGPR:$lhs, tGPR:$rhs))]>; +let neverHasSideEffects = 1 in def tADDhirr : TIt<(outs tGPR:$dst), (ins GPR:$lhs, GPR:$rhs), "add $dst, $rhs @ addhirr", []>; @@ -387,6 +388,7 @@ // Note: MOV(2) of two low regs updates the flags, so we emit this as 'cpy', // which is MOV(3). This also supports high registers. +let neverHasSideEffects = 1 in { def tMOVr : TI<(outs tGPR:$dst), (ins tGPR:$src), "cpy $dst, $src", []>; def tMOVhir2lor : TI<(outs tGPR:$dst), (ins GPR:$src), @@ -395,6 +397,7 @@ "cpy $dst, $src\t@ lor2hir", []>; def tMOVhir2hir : TI<(outs GPR:$dst), (ins GPR:$src), "cpy $dst, $src\t@ hir2hir", []>; +} // neverHasSideEffects def tMUL : TIt<(outs tGPR:$dst), (ins tGPR:$lhs, tGPR:$rhs), "mul $dst, $rhs", Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=73252&r1=73251&r2=73252&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Fri Jun 12 15:46:18 2009 @@ -192,11 +192,13 @@ let Inst{7-4} = 0b1100; } +let neverHasSideEffects = 1 in { def FCPYD : ADuI<0b11101011, 0b0000, 0b0100, (outs DPR:$dst), (ins DPR:$a), "fcpyd", " $dst, $a", []>; def FCPYS : ASuI<0b11101011, 0b0000, 0b0100, (outs SPR:$dst), (ins SPR:$a), "fcpys", " $dst, $a", []>; +} // neverHasSideEffects def FNEGD : ADuI<0b11101011, 0b0001, 0b0100, (outs DPR:$dst), (ins DPR:$a), "fnegd", " $dst, $a", Modified: llvm/trunk/test/CodeGen/ARM/lsr-code-insertion.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/lsr-code-insertion.ll?rev=73252&r1=73251&r2=73252&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/lsr-code-insertion.ll (original) +++ llvm/trunk/test/CodeGen/ARM/lsr-code-insertion.ll Fri Jun 12 15:46:18 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -stats |& grep {40.*Number of machine instrs printed} +; RUN: llvm-as < %s | llc -stats |& grep {39.*Number of machine instrs printed} ; RUN: llvm-as < %s | llc -stats |& grep {.*Number of re-materialization} ; This test really wants to check that the resultant "cond_true" block only ; has a single store in it, and that cond_true55 only has code to materialize From gohman at apple.com Fri Jun 12 15:52:16 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 12 Jun 2009 13:52:16 -0700 Subject: [llvm-commits] [llvm] r73243 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/fsub-fsub.ll In-Reply-To: <4F807148-4829-4E9D-B16D-18B4153A4D6A@apple.com> References: <200906121923.n5CJNQZa027501@zion.cs.uiuc.edu> <4F807148-4829-4E9D-B16D-18B4153A4D6A@apple.com> Message-ID: <0F1EACA0-9447-48F6-B653-F71FD16E904A@apple.com> On Jun 12, 2009, at 1:35 PM, Dale Johannesen wrote: > > On Jun 12, 2009, at 12:23 PMPDT, Dan Gohman wrote: > > >> Author: djg >> >> Date: Fri Jun 12 14:23:25 2009 >> >> New Revision: 73243 >> >> >> >> URL: http://llvm.org/viewvc/llvm-project?rev=73243&view=rev >> >> Log: >> >> Don't do (x - (y - z)) --> (x + (z - y)) on floating-point types, >> >> because >> >> it may round differently. This fixes PR4374. >> > > Shouldn't we do this if UnsafeFPMath is on? InstCombine doesn't currently know about UnsafeFPMath. DAGCombine does know about it, and it already does this transformation. Dan From gohman at apple.com Fri Jun 12 15:52:39 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 12 Jun 2009 13:52:39 -0700 Subject: [llvm-commits] [llvm] r72894 - in /llvm/trunk: include/llvm/Attributes.h include/llvm/Target/TargetOptions.h lib/AsmParser/LLLexer.cpp lib/AsmParser/LLParser.cpp lib/AsmParser/LLToken.h lib/Target/PowerPC/PPCRegisterInfo.cpp lib/Target/TargetMach In-Reply-To: <352a1fb20906121258l1b584e2ah1b7c52ed1c54a9cf@mail.gmail.com> References: <352a1fb20906121258l1b584e2ah1b7c52ed1c54a9cf@mail.gmail.com> Message-ID: On Jun 12, 2009, at 12:58 PM, Devang Patel wrote: > On Mon, Jun 8, 2009 at 11:25 AM, Dan Gohman wrote: > >> >> >> >> x86-32 never has a redzone, so it shouldn't require >> >> noredzone notes everywhere. I realize that the currrent code >> >> is just using the values of flags inside GCC, but having >> >> meaningless function notes everywhere is undesirable. Can >> >> you find some way to suppress noredzone notes on targets >> >> which never have red zones? >> > > Done. Thanks! Dan From eli.friedman at gmail.com Fri Jun 12 15:52:44 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Fri, 12 Jun 2009 13:52:44 -0700 Subject: [llvm-commits] [llvm] r73243 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/fsub-fsub.ll In-Reply-To: <4F807148-4829-4E9D-B16D-18B4153A4D6A@apple.com> References: <200906121923.n5CJNQZa027501@zion.cs.uiuc.edu> <4F807148-4829-4E9D-B16D-18B4153A4D6A@apple.com> Message-ID: On Fri, Jun 12, 2009 at 1:35 PM, Dale Johannesen wrote: > > On Jun 12, 2009, at 12:23 PMPDT, Dan Gohman wrote: > >> Author: djg >> Date: Fri Jun 12 14:23:25 2009 >> New Revision: 73243 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=73243&view=rev >> Log: >> Don't do (x - (y - z)) --> (x + (z - y)) on floating-point types, >> because >> it may round differently. This fixes PR4374. > > Shouldn't we do this if UnsafeFPMath is on? There is no such flag for instcombine. -Eli From sabre at nondot.org Fri Jun 12 16:01:07 2009 From: sabre at nondot.org (Chris Lattner) Date: Fri, 12 Jun 2009 21:01:07 -0000 Subject: [llvm-commits] [llvm] r73253 - /llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp Message-ID: <200906122101.n5CL17WF030992@zion.cs.uiuc.edu> Author: lattner Date: Fri Jun 12 16:01:07 2009 New Revision: 73253 URL: http://llvm.org/viewvc/llvm-project?rev=73253&view=rev Log: second half of fix for PR4366: don't zap store to null of non-default addrspaces. Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp?rev=73253&r1=73252&r2=73253&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp Fri Jun 12 16:01:07 2009 @@ -125,13 +125,17 @@ } } - if (StoreInst *SI = dyn_cast(BBI)) - if (isa(SI->getOperand(1)) || - isa(SI->getOperand(1))) { + if (StoreInst *SI = dyn_cast(BBI)) { + Value *Ptr = SI->getOperand(1); + + if (isa(Ptr) || + (isa(Ptr) && + cast(Ptr->getType())->getAddressSpace() == 0)) { ChangeToUnreachable(SI); Changed = true; break; } + } } // Turn invokes that call 'nounwind' functions into ordinary calls. From dalej at apple.com Fri Jun 12 16:07:44 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 12 Jun 2009 14:07:44 -0700 Subject: [llvm-commits] [llvm] r73243 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/fsub-fsub.ll In-Reply-To: <0F1EACA0-9447-48F6-B653-F71FD16E904A@apple.com> References: <200906121923.n5CJNQZa027501@zion.cs.uiuc.edu> <4F807148-4829-4E9D-B16D-18B4153A4D6A@apple.com> <0F1EACA0-9447-48F6-B653-F71FD16E904A@apple.com> Message-ID: <193F79EA-B207-4590-8D06-0FE106573552@apple.com> On Jun 12, 2009, at 1:52 PMPDT, Dan Gohman wrote: > InstCombine doesn't currently know about UnsafeFPMath. > > DAGCombine does know about it, and it already does this > transformation. OK. Why on earth doesn't InstCombine know about it? That seems really wrong, there's a lot of target-independent optimizations that should be controlled by this. From deeppatel1987 at gmail.com Fri Jun 12 16:15:23 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Fri, 12 Jun 2009 14:15:23 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegist In-Reply-To: <2C75AFA1-F51C-4FF0-ACF1-797CE8F45A03@apple.com> References: <305d6f60906110010l37762b0br64c9d75b7f149915@mail.gmail.com> <41FF1606-AC7C-496F-BDFA-9A9BBFE9606B@apple.com> <305d6f60906111647i4068c9aduacdf91defae45d44@mail.gmail.com> <2C75AFA1-F51C-4FF0-ACF1-797CE8F45A03@apple.com> Message-ID: <305d6f60906121415j270722f1g59709ff4a0793e8f@mail.gmail.com> On Fri, Jun 12, 2009 at 11:12 AM, Evan Cheng wrote: > > On Jun 11, 2009, at 4:47 PM, Sandeep Patel wrote: > >> On Thu, Jun 11, 2009 at 2:33 PM, Bob Wilson >> wrote: >>> >>> On Jun 11, 2009, at 11:52 AM, Evan Cheng wrote: >>>> >>>> On Jun 11, 2009, at 11:32 AM, Chris Lattner wrote: >>>>> >>>>> Why not put this into the target triple? ?Major ABI issues like >>>>> this >>>>> seem like they belong in the triple. >>>> >>>> It's not always clear what information we want to encode in triplet. >>>> In this case, it seems reasonable to encode float abi in the >>>> triplet. >>>> But how do we want encode this? Do we want to use it to toggle fp >>>> abi >>>> for any target, e.g. arm-apple-darwin-apcs? >>> >>> Since target triples are a GNU thing, it would be a good idea to be >>> compatible with GCC on this. ?I know that for the base AAPCS ABI GCC >>> uses an "eabi" suffix on the OS portion of the triple, e.g., arm- >>> linux- >>> gnueabi. >>> >>> When I last worked on GCC, it had no support for the "hardfloat" >>> AAPCS >>> ABI, but I heard that it was added since then. ?Does anyone know if >>> GCC uses something in the triple ("eabi-hardfloat" suffix??) to >>> indicate this? >>> >>> Since this fp ABI is an extension of AAPCS, it would only make sense >>> to allow toggling something in the target triple for targets that use >>> AAPCS (not Darwin). >> >> GCC did not change the target triple to indicate use of hard float; >> it's still arm-linux-gnueabi. GCC even allows a function attribute to >> change the ABI per function in support of kernel development and other >> cases where one may need to mix ABIs (e.g. a library that supports >> legacy soft float applications, etc.). > > Ok. Then it makes more sense for it to be a function note. We should > be able to figure out a way to change calling convention (and other > subtarget states). I previously planned to make this a CC (64, 65, 66,...) on every function, but it seemed silly to not have a default be applied to handle C, fastcall, etc. deep From clattner at apple.com Fri Jun 12 16:32:49 2009 From: clattner at apple.com (Chris Lattner) Date: Fri, 12 Jun 2009 14:32:49 -0700 Subject: [llvm-commits] [llvm] r73243 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/fsub-fsub.ll In-Reply-To: <193F79EA-B207-4590-8D06-0FE106573552@apple.com> References: <200906121923.n5CJNQZa027501@zion.cs.uiuc.edu> <4F807148-4829-4E9D-B16D-18B4153A4D6A@apple.com> <0F1EACA0-9447-48F6-B653-F71FD16E904A@apple.com> <193F79EA-B207-4590-8D06-0FE106573552@apple.com> Message-ID: <803DDAEB-D769-46EB-8D73-22870D56AA1B@apple.com> On Jun 12, 2009, at 2:07 PM, Dale Johannesen wrote: > > On Jun 12, 2009, at 1:52 PMPDT, Dan Gohman wrote: >> InstCombine doesn't currently know about UnsafeFPMath. >> >> DAGCombine does know about it, and it already does this >> transformation. > > OK. Why on earth doesn't InstCombine know about it? That seems > really wrong, there's a lot of target-independent optimizations that > should be controlled by this. The optimizer (unlike codegen) doesn't have "global variables" that affect interpretation of the IR. To do this xform in instcombine we need to enhance the various FP instructions to have flags that indicate (on a per operation basis) whether it is ok to assume "unsafeness", etc. Same thing for rounding modes etc. -Chris From evan.cheng at apple.com Fri Jun 12 16:34:26 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 12 Jun 2009 21:34:26 -0000 Subject: [llvm-commits] [llvm] r73255 - in /llvm/trunk: lib/CodeGen/RegisterScavenging.cpp test/CodeGen/ARM/2009-06-12-RegScavengerAssert.ll Message-ID: <200906122134.n5CLYQAs032110@zion.cs.uiuc.edu> Author: evancheng Date: Fri Jun 12 16:34:26 2009 New Revision: 73255 URL: http://llvm.org/viewvc/llvm-project?rev=73255&view=rev Log: If killed register is defined by implicit_def, do not clear it since it's live range may overlap another def of same register. Added: llvm/trunk/test/CodeGen/ARM/2009-06-12-RegScavengerAssert.ll Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=73255&r1=73254&r2=73255&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original) +++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Fri Jun 12 16:34:26 2009 @@ -214,26 +214,33 @@ } // Process uses first. - BitVector UseRegs(NumPhysRegs); + BitVector KillRegs(NumPhysRegs); for (unsigned i = 0, e = UseMOs.size(); i != e; ++i) { const MachineOperand MO = *UseMOs[i].first; unsigned Reg = MO.getReg(); assert(isUsed(Reg) && "Using an undefined register!"); - if (MO.isKill() && !isReserved(Reg)) { - UseRegs.set(Reg); + // Kill of implicit_def defined registers are ignored. e.g. + // entry: 0x2029ab8, LLVM BB @0x1b06080, ID#0: + // Live Ins: %R0 + // %R0 = IMPLICIT_DEF + // %R0 = IMPLICIT_DEF + // STR %R0, %R0, %reg0, 0, 14, %reg0, Mem:ST(4,4) [0x1b06510 + 0] + // %R1 = LDR %R0, %reg0, 24, 14, %reg0, Mem:LD(4,4) [0x1b065bc + 0] + if (MO.isKill() && !isReserved(Reg) && !isImplicitlyDefined(Reg)) { + KillRegs.set(Reg); // Mark sub-registers as used. for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); unsigned SubReg = *SubRegs; ++SubRegs) - UseRegs.set(SubReg); + KillRegs.set(SubReg); } } // Change states of all registers after all the uses are processed to guard // against multiple uses. - setUnused(UseRegs); + setUnused(KillRegs); // Process early clobber defs then process defs. We can have a early clobber // that is dead, it should not conflict with a def that happens one "slot" Added: llvm/trunk/test/CodeGen/ARM/2009-06-12-RegScavengerAssert.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-06-12-RegScavengerAssert.ll?rev=73255&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2009-06-12-RegScavengerAssert.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2009-06-12-RegScavengerAssert.ll Fri Jun 12 16:34:26 2009 @@ -0,0 +1,77 @@ +; RUN: llvm-as < %s | llc -mtriple=armv6-apple-darwin + + type { i32, i32, %struct.D_Sym**, [3 x %struct.D_Sym*] } ; type %0 + type { i32, %struct.D_Reduction** } ; type %1 + type { i32, %struct.D_RightEpsilonHint* } ; type %2 + type { i32, %struct.D_ErrorRecoveryHint* } ; type %3 + type { i32, i32, %struct.D_Reduction**, [3 x %struct.D_Reduction*] } ; type %4 + %struct.D_ErrorRecoveryHint = type { i16, i16, i8* } + %struct.D_ParseNode = type { i32, %struct.d_loc_t, i8*, i8*, %struct.D_Scope*, void (%struct.D_Parser*, %struct.d_loc_t*, i8**)*, i8*, i8* } + %struct.D_Parser = type { i8*, void (%struct.D_Parser*, %struct.d_loc_t*, i8**)*, %struct.D_Scope*, void (%struct.D_Parser*)*, %struct.D_ParseNode* (%struct.D_Parser*, i32, %struct.D_ParseNode**)*, void (%struct.D_ParseNode*)*, %struct.d_loc_t, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } + %struct.D_ParserTables = type { i32, %struct.D_State*, i16*, i32, i32, %struct.D_Symbol*, void (%struct.D_Parser*, %struct.d_loc_t*, i8**)*, i32, %struct.D_Pass*, i32 } + %struct.D_Pass = type { i8*, i32, i32, i32 } + %struct.D_Reduction = type { i16, i16, i32 (i8*, i8**, i32, i32, %struct.D_Parser*)*, i32 (i8*, i8**, i32, i32, %struct.D_Parser*)*, i16, i16, i32, i32, i32, i32, i32 (i8*, i8**, i32, i32, %struct.D_Parser*)** } + %struct.D_RightEpsilonHint = type { i16, i16, %struct.D_Reduction* } + %struct.D_Scope = type { i8, %struct.D_Sym*, %struct.D_SymHash*, %struct.D_Sym*, %struct.D_Scope*, %struct.D_Scope*, %struct.D_Scope*, %struct.D_Scope*, %struct.D_Scope* } + %struct.D_Shift = type { i16, i8, i8, i32, i32, i32 (i8*, i8**, i32, i32, %struct.D_Parser*)* } + %struct.D_State = type { i8*, i32, %1, %2, %3, %struct.D_Shift**, i32 (i8**, i32*, i32*, i16*, i32*, i8*, i32*)*, i8*, i8, i8, i8, i8*, %struct.D_Shift***, i32 } + %struct.D_Sym = type { i8*, i32, i32, %struct.D_Sym*, %struct.D_Sym*, i32 } + %struct.D_SymHash = type { i32, i32, %0 } + %struct.D_Symbol = type { i32, i8*, i32 } + %struct.PNode = type { i32, i32, i32, i32, %struct.D_Reduction*, %struct.D_Shift*, i32, %struct.VecPNode, i32, i8, i8, %struct.PNode*, %struct.PNode*, %struct.PNode*, %struct.PNode*, i8*, i8*, %struct.D_Scope*, i8*, %struct.D_ParseNode } + %struct.PNodeHash = type { %struct.PNode**, i32, i32, i32, %struct.PNode* } + %struct.Parser = type { %struct.D_Parser, i8*, i8*, %struct.D_ParserTables*, i32, i32, i32, i32, i32, i32, i32, %struct.PNodeHash, %struct.SNodeHash, %struct.Reduction*, %struct.Shift*, %struct.D_Scope*, %struct.SNode*, i32, %struct.Reduction*, %struct.Shift*, i32, %struct.PNode*, %struct.SNode*, %struct.ZNode*, %4, %struct.ShiftResult*, %struct.D_Shift, %struct.Parser*, i8* } + %struct.Reduction = type { %struct.ZNode*, %struct.SNode*, %struct.D_Reduction*, %struct.SNode*, i32, %struct.Reduction* } + %struct.SNode = type { %struct.D_State*, %struct.D_Scope*, i8*, %struct.d_loc_t, i32, %struct.PNode*, %struct.VecZNode, i32, %struct.SNode*, %struct.SNode* } + %struct.SNodeHash = type { %struct.SNode**, i32, i32, i32, %struct.SNode*, %struct.SNode* } + %struct.Shift = type { %struct.SNode*, %struct.Shift* } + %struct.ShiftResult = type { %struct.D_Shift*, %struct.d_loc_t } + %struct.VecPNode = type { i32, i32, %struct.PNode**, [3 x %struct.PNode*] } + %struct.VecSNode = type { i32, i32, %struct.SNode**, [3 x %struct.SNode*] } + %struct.VecZNode = type { i32, i32, %struct.ZNode**, [3 x %struct.ZNode*] } + %struct.ZNode = type { %struct.PNode*, %struct.VecSNode } + %struct.d_loc_t = type { i8*, i8*, i32, i32, i32 } + +declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind + +define fastcc i32 @exhaustive_parse(%struct.Parser* %p, i32 %state) nounwind { +entry: + store i8* undef, i8** undef, align 4 + %0 = getelementptr %struct.Parser* %p, i32 0, i32 0, i32 6 ; <%struct.d_loc_t*> [#uses=1] + %1 = bitcast %struct.d_loc_t* %0 to i8* ; [#uses=1] + call void @llvm.memcpy.i32(i8* undef, i8* %1, i32 20, i32 4) + br label %bb10 + +bb10: ; preds = %bb30, %bb29, %bb26, %entry + br i1 undef, label %bb18, label %bb20 + +bb18: ; preds = %bb10 + br i1 undef, label %bb20, label %bb19 + +bb19: ; preds = %bb18 + br label %bb20 + +bb20: ; preds = %bb19, %bb18, %bb10 + br i1 undef, label %bb21, label %bb22 + +bb21: ; preds = %bb20 + unreachable + +bb22: ; preds = %bb20 + br i1 undef, label %bb24, label %bb26 + +bb24: ; preds = %bb22 + unreachable + +bb26: ; preds = %bb22 + br i1 undef, label %bb10, label %bb29 + +bb29: ; preds = %bb26 + br i1 undef, label %bb10, label %bb30 + +bb30: ; preds = %bb29 + br i1 undef, label %bb31, label %bb10 + +bb31: ; preds = %bb30 + unreachable +} From resistor at mac.com Fri Jun 12 16:41:29 2009 From: resistor at mac.com (Owen Anderson) Date: Fri, 12 Jun 2009 21:41:29 -0000 Subject: [llvm-commits] [llvm] r73256 - /llvm/trunk/lib/CodeGen/LazyLiveness.cpp Message-ID: <200906122141.n5CLfTn0032317@zion.cs.uiuc.edu> Author: resistor Date: Fri Jun 12 16:41:29 2009 New Revision: 73256 URL: http://llvm.org/viewvc/llvm-project?rev=73256&view=rev Log: Now with less iterator invalidation, and other forms of crashing! Modified: llvm/trunk/lib/CodeGen/LazyLiveness.cpp Modified: llvm/trunk/lib/CodeGen/LazyLiveness.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LazyLiveness.cpp?rev=73256&r1=73255&r2=73256&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LazyLiveness.cpp (original) +++ llvm/trunk/lib/CodeGen/LazyLiveness.cpp Fri Jun 12 16:41:29 2009 @@ -22,6 +22,7 @@ using namespace llvm; char LazyLiveness::ID = 0; +static RegisterPass X("lazy-liveness", "Lazy Liveness Analysis"); void LazyLiveness::computeBackedgeChain(MachineFunction& mf, MachineBasicBlock* MBB) { @@ -65,7 +66,7 @@ // Step 0: Compute preorder numbering for all MBBs. unsigned num = 0; for (df_iterator DI = df_begin(&*mf.begin()); - DI != df_end(&*mf.end()); ++DI) { + DI != df_end(&*mf.begin()); ++DI) { preorder[*DI] = num++; rev_preorder.push_back(*DI); } @@ -103,8 +104,10 @@ if (!backedge_target.test(preorder[*POI])) for (MachineBasicBlock::succ_iterator SI = (*POI)->succ_begin(); SI != (*POI)->succ_end(); ++SI) - if (!backedges.count(std::make_pair(*POI, *SI)) && tv.count(*SI)) - tv[*POI]= tv[*SI]; + if (!backedges.count(std::make_pair(*POI, *SI)) && tv.count(*SI)) { + SparseBitVector<128>& PBV = tv[*POI]; + PBV = tv[*SI]; + } for (po_iterator POI = po_begin(&*mf.begin()), POE = po_end(&*mf.begin()); POI != POE; ++POI) From resistor at mac.com Fri Jun 12 16:50:22 2009 From: resistor at mac.com (Owen Anderson) Date: Fri, 12 Jun 2009 21:50:22 -0000 Subject: [llvm-commits] [llvm] r73257 - /llvm/trunk/lib/CodeGen/LazyLiveness.cpp Message-ID: <200906122150.n5CLoNNs032681@zion.cs.uiuc.edu> Author: resistor Date: Fri Jun 12 16:50:22 2009 New Revision: 73257 URL: http://llvm.org/viewvc/llvm-project?rev=73257&view=rev Log: This is supposed to be a preorder numbering of the dominator tree, not the CFG. Modified: llvm/trunk/lib/CodeGen/LazyLiveness.cpp Modified: llvm/trunk/lib/CodeGen/LazyLiveness.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LazyLiveness.cpp?rev=73257&r1=73256&r2=73257&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LazyLiveness.cpp (original) +++ llvm/trunk/lib/CodeGen/LazyLiveness.cpp Fri Jun 12 16:50:22 2009 @@ -62,13 +62,14 @@ preorder.clear(); MRI = &mf.getRegInfo(); + MachineDominatorTree& MDT = getAnalysis(); // Step 0: Compute preorder numbering for all MBBs. unsigned num = 0; - for (df_iterator DI = df_begin(&*mf.begin()); - DI != df_end(&*mf.begin()); ++DI) { - preorder[*DI] = num++; - rev_preorder.push_back(*DI); + for (df_iterator DI = df_begin(MDT.getRootNode()); + DI != df_end(MDT.getRootNode()); ++DI) { + preorder[(*DI)->getBlock()] = num++; + rev_preorder.push_back((*DI)->getBlock()); } // Step 1: Compute the transitive closure of the CFG, ignoring backedges. From resistor at mac.com Fri Jun 12 17:07:19 2009 From: resistor at mac.com (Owen Anderson) Date: Fri, 12 Jun 2009 22:07:19 -0000 Subject: [llvm-commits] [llvm] r73258 - /llvm/trunk/lib/CodeGen/LazyLiveness.cpp Message-ID: <200906122207.n5CM7Jp6000934@zion.cs.uiuc.edu> Author: resistor Date: Fri Jun 12 17:07:19 2009 New Revision: 73258 URL: http://llvm.org/viewvc/llvm-project?rev=73258&view=rev Log: Improve style. Modified: llvm/trunk/lib/CodeGen/LazyLiveness.cpp Modified: llvm/trunk/lib/CodeGen/LazyLiveness.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LazyLiveness.cpp?rev=73258&r1=73257&r2=73258&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LazyLiveness.cpp (original) +++ llvm/trunk/lib/CodeGen/LazyLiveness.cpp Fri Jun 12 17:07:19 2009 @@ -66,21 +66,21 @@ // Step 0: Compute preorder numbering for all MBBs. unsigned num = 0; - for (df_iterator DI = df_begin(MDT.getRootNode()); - DI != df_end(MDT.getRootNode()); ++DI) { + for (df_iterator DI = df_begin(MDT.getRootNode()), + DE = df_end(MDT.getRootNode()); DI != DE; ++DI) { preorder[(*DI)->getBlock()] = num++; rev_preorder.push_back((*DI)->getBlock()); } // Step 1: Compute the transitive closure of the CFG, ignoring backedges. - for (po_iterator POI = po_begin(&*mf.begin()); - POI != po_end(&*mf.begin()); ++POI) { + for (po_iterator POI = po_begin(&*mf.begin()), + POE = po_end(&*mf.begin()); POI != POE; ++POI) { MachineBasicBlock* MBB = *POI; SparseBitVector<128>& entry = rv[MBB]; entry.set(preorder[MBB]); - for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(); - SI != MBB->succ_end(); ++SI) { + for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), + SE = MBB->succ_end(); SI != SE; ++SI) { DenseMap >::iterator SII = rv.find(*SI); @@ -103,8 +103,8 @@ for (po_iterator POI = po_begin(&*mf.begin()), POE = po_end(&*mf.begin()); POI != POE; ++POI) if (!backedge_target.test(preorder[*POI])) - for (MachineBasicBlock::succ_iterator SI = (*POI)->succ_begin(); - SI != (*POI)->succ_end(); ++SI) + for (MachineBasicBlock::succ_iterator SI = (*POI)->succ_begin(), + SE = (*POI)->succ_end(); SI != SE; ++SI) if (!backedges.count(std::make_pair(*POI, *SI)) && tv.count(*SI)) { SparseBitVector<128>& PBV = tv[*POI]; PBV = tv[*SI]; @@ -123,11 +123,12 @@ MachineBasicBlock* DefMBB = MRI->def_begin(vreg)->getParent(); unsigned def = preorder[DefMBB]; unsigned max_dom = 0; - for (df_iterator DI = df_begin(MDT[DefMBB]); - DI != df_end(MDT[DefMBB]); ++DI) + for (df_iterator DI = df_begin(MDT[DefMBB]), + DE = df_end(MDT[DefMBB]); DI != DE; ++DI) { if (preorder[DI->getBlock()] > max_dom) { max_dom = preorder[(*DI)->getBlock()]; } + } if (preorder[MBB] <= def || max_dom < preorder[MBB]) return false; @@ -135,16 +136,16 @@ SparseBitVector<128>::iterator I = tv[MBB].begin(); while (I != tv[MBB].end() && *I <= def) ++I; while (I != tv[MBB].end() && *I < max_dom) { - for (MachineRegisterInfo::use_iterator UI = MRI->use_begin(vreg); - UI != MachineRegisterInfo::use_end(); ++UI) { + for (MachineRegisterInfo::use_iterator UI = MRI->use_begin(vreg), + UE = MachineRegisterInfo::use_end(); UI != UE; ++UI) { MachineBasicBlock* UseMBB = UI->getParent(); if (rv[rev_preorder[*I]].test(preorder[UseMBB])) return true; - + unsigned t_dom = 0; for (df_iterator DI = - df_begin(MDT[rev_preorder[*I]]); - DI != df_end(MDT[rev_preorder[*I]]); ++DI) + df_begin(MDT[rev_preorder[*I]]), DE = df_end(MDT[rev_preorder[*I]]); + DI != DE; ++DI) if (preorder[DI->getBlock()] > t_dom) { max_dom = preorder[(*DI)->getBlock()]; } @@ -155,4 +156,3 @@ return false; } - From gohman at apple.com Fri Jun 12 18:02:03 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 12 Jun 2009 23:02:03 -0000 Subject: [llvm-commits] [llvm] r73265 - /llvm/trunk/test/FrontendC/pr4349.c Message-ID: <200906122302.n5CN23SL002767@zion.cs.uiuc.edu> Author: djg Date: Fri Jun 12 18:02:02 2009 New Revision: 73265 URL: http://llvm.org/viewvc/llvm-project?rev=73265&view=rev Log: Add -m32 to llvm-gcc commands, so that this test behaves as expected on systems which default to a 64-bit target. Modified: llvm/trunk/test/FrontendC/pr4349.c Modified: llvm/trunk/test/FrontendC/pr4349.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/pr4349.c?rev=73265&r1=73264&r2=73265&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/pr4349.c (original) +++ llvm/trunk/test/FrontendC/pr4349.c Fri Jun 12 18:02:02 2009 @@ -1,9 +1,9 @@ // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars2 | grep {\\\[2 x \\\[2 x i8\\\]\\\]} -// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars2 | grep {i32 1} | count 1 +// RUN: %llvmgcc -m32 %s -S -emit-llvm -O0 -o - | grep svars2 | grep {i32 1} | count 1 // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars3 | grep {\\\[2 x i16\\\]} -// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars3 | grep {i32 1} | count 1 +// RUN: %llvmgcc -m32 %s -S -emit-llvm -O0 -o - | grep svars3 | grep {i32 1} | count 1 // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars4 | grep {\\\[2 x \\\[2 x i8\\\]\\\]} | count 1 -// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars4 | grep {i32 1, i32 1} | count 1 +// RUN: %llvmgcc -m32 %s -S -emit-llvm -O0 -o - | grep svars4 | grep {i32 1, i32 1} | count 1 // PR 4349 union reg From eli.friedman at gmail.com Fri Jun 12 18:13:46 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Fri, 12 Jun 2009 16:13:46 -0700 Subject: [llvm-commits] [llvm] r73265 - /llvm/trunk/test/FrontendC/pr4349.c In-Reply-To: <200906122302.n5CN23SL002767@zion.cs.uiuc.edu> References: <200906122302.n5CN23SL002767@zion.cs.uiuc.edu> Message-ID: On Fri, Jun 12, 2009 at 4:02 PM, Dan Gohman wrote: > Author: djg > Date: Fri Jun 12 18:02:02 2009 > New Revision: 73265 > > URL: http://llvm.org/viewvc/llvm-project?rev=73265&view=rev > Log: > Add -m32 to llvm-gcc commands, so that this test behaves as expected > on systems which default to a 64-bit target. -m32 doesn't work on all targets (for example, I think Itanium is such an architecture). Would it be possible to make the grep expressions a bit more general instead of passing in -m32? -Eli From clattner at apple.com Fri Jun 12 18:19:52 2009 From: clattner at apple.com (Chris Lattner) Date: Fri, 12 Jun 2009 16:19:52 -0700 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <472C1667-F96F-4208-8B6C-C8AAE3FAC35E@gmail.com> References: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> <00F2DF2F-C994-4904-86DA-32BDFA8622E7@gmail.com> <521640720906111559n682a58a6r7371c85c1485b83@mail.gmail.com> <521640720906120454p5a95aa6bn7a09212a0bddb565@mail.gmail.com> <4A324A48.6050509@free.fr> <472C1667-F96F-4208-8B6C-C8AAE3FAC35E@gmail.com> Message-ID: On Jun 12, 2009, at 11:00 AM, Bill Wendling wrote: > Perhaps droll. But in reality, we are very serious about what we > accept as patches. We have rules and everyone gets the same treatment > with regards to our coding standards (http://llvm.org/docs/CodingStandards.html > ). There are no exceptions. And we don't clean up patches for people. > That wastes too much of other programmers' time. That may be so, but we also often encourage new contributors by helping smooth the edges of their first patches when applying them. -Chris > > > -bw > > On Jun 12, 2009, at 5:30 AM, Duncan Sands wrote: > >> Hi Edward, I think he was trying to be funny. It's often hard to >> tell how things are meant, so best to chill out and be cool dude! :) >> >> Ciao, >> >> Duncan. >> >>> Your taking things too the extremes, you can make note to people if >>> its only a line or two, change it yourself while you did the reorder >>> and commit. >>> I would have taken note. I generated the patch correctly now and the >>> other few too. Just get on with it and stop this, its wasting both >>> our >>> time for no reason at all. >>> >>> Thank You, >>> Edward. >>> >>> >>> 2009/6/12 Bill Wendling : >>>> You should use "surname" instead of "second names". And now for >>>> more >>>> being "pedantic". You can't have lines > 80 columns: >>>> >>>> --- llvm/CREDITS.TXT Thu Jun 11 23:47:24 2009 >>>> +++ CREDITS.TXT Thu Jun 11 23:52:13 2009 >>>> @@ -3,7 +3,7 @@ >>>> LLVM, please submit a patch to this file to add yourself, and it >>>> will be >>>> done! >>>> >>>> -The list is sorted by name and formatted to allow easy grepping >>>> and >>>> +The list is sorted by name (second names are in alphabetical >>>> order) >>>> and formatted to allow easy grepping and >>>> beautification by scripts. The fields are: name (N), email (E), >>>> web- >>>> address >>>> (W), PGP key ID and fingerprint (P), description (D), and snail- >>>> mail >>>> address >>>> (S). >>>> >>>> >>>> -bw >>>> >>>> On Jun 11, 2009, at 3:59 PM, Edward O'Callaghan wrote: >>>> >>>>> Gezz, >>>>> >>>>> Your just making it hard for people to do work on llvm/clang by >>>>> being >>>>> so pedantic! >>>>> I have taken note, so just please integrate the code changes so >>>>> things >>>>> may progress on the Solaris port. >>>>> I hope this is optimal ;( I also added a note about the order in >>>>> which >>>>> the second names should be submitted too for others. >>>>> >>>>> Thank you, >>>>> Edward. >>>>> >>>>> 2009/6/11 Bill Wendling : >>>>>> On Jun 11, 2009, at 11:56 AM, Edward O'Callaghan wrote: >>>>>> >>>>>>> Hi Chris, >>>>>>> >>>>>>> Sorry but, you may not have noticed that the CREDITS file is >>>>>>> *not* >>>>>>> in >>>>>>> alphabetical order. >>>>>>> If you wish to sort it then OK, but I don't have that kind of >>>>>>> time >>>>>>> sorry. >>>>>>> >>>>>> Well, let's try to not make it worse than it is now. :-) >>>>>> >>>>>> -bw >>>>>> >>>>>> _______________________________________________ >>>>>> llvm-commits mailing list >>>>>> llvm-commits at cs.uiuc.edu >>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>>>> >>>>> >>>>> >>>>> -- >>>>> -- >>>>> Edward O'Callaghan >>>>> http://www.auroraux.org/ >>>>> eocallaghan at auroraux dot org >>>>> _______________________________________________ >>>>> llvm-commits mailing list >>>>> llvm-commits at cs.uiuc.edu >>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> >>> >>> >>> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Fri Jun 12 18:21:21 2009 From: clattner at apple.com (Chris Lattner) Date: Fri, 12 Jun 2009 16:21:21 -0700 Subject: [llvm-commits] Various improvements to NewNightlyTest.pl In-Reply-To: <5B222480-ECD7-4943-9E3C-06AFCCD37AC9@gmail.com> References: <13C59C61-E907-48E9-A0CD-BE4C451EB832@apple.com> <521640720906111156g1dcf79a1m13ff35948e44d18c@mail.gmail.com> <00F2DF2F-C994-4904-86DA-32BDFA8622E7@gmail.com> <521640720906111559n682a58a6r7371c85c1485b83@mail.gmail.com> <5B222480-ECD7-4943-9E3C-06AFCCD37AC9@gmail.com> Message-ID: <98210E15-6A28-4EFB-BBD7-1031999D5787@apple.com> On Jun 11, 2009, at 8:08 PM, Bill Wendling wrote: > Sorry that we have standards. Please feel free to try to get your > patches accepted to other open source projects. Perhaps GCC? Hey Guys, We're all friends here, calm down :) -Chris > > > -bw > > On Jun 11, 2009, at 3:59 PM, "Edward O'Callaghan" > wrote: > >> Gezz, >> >> Your just making it hard for people to do work on llvm/clang by being >> so pedantic! >> I have taken note, so just please integrate the code changes so >> things >> may progress on the Solaris port. >> I hope this is optimal ;( I also added a note about the order in >> which >> the second names should be submitted too for others. >> >> Thank you, >> Edward. >> >> 2009/6/11 Bill Wendling : >>> On Jun 11, 2009, at 11:56 AM, Edward O'Callaghan wrote: >>> >>>> Hi Chris, >>>> >>>> Sorry but, you may not have noticed that the CREDITS file is *not* >>>> in >>>> alphabetical order. >>>> If you wish to sort it then OK, but I don't have that kind of time >>>> sorry. >>>> >>> Well, let's try to not make it worse than it is now. :-) >>> >>> -bw >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> >> >> >> -- >> -- >> Edward O'Callaghan >> http://www.auroraux.org/ >> eocallaghan at auroraux dot org >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Fri Jun 12 18:22:10 2009 From: dalej at apple.com (Dale Johannesen) Date: Fri, 12 Jun 2009 16:22:10 -0700 Subject: [llvm-commits] [llvm] r73265 - /llvm/trunk/test/FrontendC/pr4349.c In-Reply-To: References: <200906122302.n5CN23SL002767@zion.cs.uiuc.edu> Message-ID: On Jun 12, 2009, at 4:13 PMPDT, Eli Friedman wrote: > On Fri, Jun 12, 2009 at 4:02 PM, Dan Gohman wrote: >> Author: djg >> Date: Fri Jun 12 18:02:02 2009 >> New Revision: 73265 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=73265&view=rev >> Log: >> Add -m32 to llvm-gcc commands, so that this test behaves as expected >> on systems which default to a 64-bit target. > > -m32 doesn't work on all targets (for example, I think Itanium is such > an architecture). Would it be possible to make the grep expressions a > bit more general instead of passing in -m32? For this test, probably, but there are several other tests that use - m32, and they don't seem to be causing problems. From gohman at apple.com Fri Jun 12 18:31:14 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 12 Jun 2009 23:31:14 -0000 Subject: [llvm-commits] [llvm] r73270 - /llvm/trunk/test/FrontendC/pr4349.c Message-ID: <200906122331.n5CNVEbM003848@zion.cs.uiuc.edu> Author: djg Date: Fri Jun 12 18:31:14 2009 New Revision: 73270 URL: http://llvm.org/viewvc/llvm-project?rev=73270&view=rev Log: Adjust this test's regex strings so that they work regardless of the target's pointer size. This avoids the need for -m32 on the llvm-gcc command-line, which some targets may not support. Modified: llvm/trunk/test/FrontendC/pr4349.c Modified: llvm/trunk/test/FrontendC/pr4349.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/pr4349.c?rev=73270&r1=73269&r2=73270&view=diff ============================================================================== --- llvm/trunk/test/FrontendC/pr4349.c (original) +++ llvm/trunk/test/FrontendC/pr4349.c Fri Jun 12 18:31:14 2009 @@ -1,9 +1,9 @@ // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars2 | grep {\\\[2 x \\\[2 x i8\\\]\\\]} -// RUN: %llvmgcc -m32 %s -S -emit-llvm -O0 -o - | grep svars2 | grep {i32 1} | count 1 +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars2 | grep {, i\[\[:digit:\]\]\\+ 1)} | count 1 // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars3 | grep {\\\[2 x i16\\\]} -// RUN: %llvmgcc -m32 %s -S -emit-llvm -O0 -o - | grep svars3 | grep {i32 1} | count 1 +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars3 | grep {, i\[\[:digit:\]\]\\+ 1)} | count 1 // RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars4 | grep {\\\[2 x \\\[2 x i8\\\]\\\]} | count 1 -// RUN: %llvmgcc -m32 %s -S -emit-llvm -O0 -o - | grep svars4 | grep {i32 1, i32 1} | count 1 +// RUN: %llvmgcc %s -S -emit-llvm -O0 -o - | grep svars4 | grep {, i\[\[:digit:\]\]\\+ 1, i\[\[:digit:\]\]\\+ 1)} | count 1 // PR 4349 union reg From gohman at apple.com Fri Jun 12 18:32:28 2009 From: gohman at apple.com (Dan Gohman) Date: Fri, 12 Jun 2009 16:32:28 -0700 Subject: [llvm-commits] [llvm] r73265 - /llvm/trunk/test/FrontendC/pr4349.c In-Reply-To: References: <200906122302.n5CN23SL002767@zion.cs.uiuc.edu> Message-ID: On Jun 12, 2009, at 4:13 PM, Eli Friedman wrote: > On Fri, Jun 12, 2009 at 4:02 PM, Dan Gohman wrote: > >> Author: djg >> >> Date: Fri Jun 12 18:02:02 2009 >> >> New Revision: 73265 >> >> >> >> URL: http://llvm.org/viewvc/llvm-project?rev=73265&view=rev >> >> Log: >> >> Add -m32 to llvm-gcc commands, so that this test behaves as expected >> >> on systems which default to a 64-bit target. >> > > -m32 doesn't work on all targets (for example, I think Itanium is such > an architecture). Would it be possible to make the grep expressions a > bit more general instead of passing in -m32? Ok, I fixed this test. Dan From clattner at apple.com Fri Jun 12 18:36:07 2009 From: clattner at apple.com (Chris Lattner) Date: Fri, 12 Jun 2009 16:36:07 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegist In-Reply-To: <2C75AFA1-F51C-4FF0-ACF1-797CE8F45A03@apple.com> References: <305d6f60906110010l37762b0br64c9d75b7f149915@mail.gmail.com> <41FF1606-AC7C-496F-BDFA-9A9BBFE9606B@apple.com> <305d6f60906111647i4068c9aduacdf91defae45d44@mail.gmail.com> <2C75AFA1-F51C-4FF0-ACF1-797CE8F45A03@apple.com> Message-ID: On Jun 12, 2009, at 11:12 AM, Evan Cheng wrote: >> GCC did not change the target triple to indicate use of hard float; >> it's still arm-linux-gnueabi. GCC even allows a function attribute to >> change the ABI per function in support of kernel development and >> other >> cases where one may need to mix ABIs (e.g. a library that supports >> legacy soft float applications, etc.). > > Ok. Then it makes more sense for it to be a function note. We should > be able to figure out a way to change calling convention (and other > subtarget states). I agree: if one program can make use of multiple ABIs at the same time, it should not be in the triple. > I previously planned to make this a CC (64, 65, 66,...) on every > function, but it seemed silly to not have a default be applied to > handle C, fastcall, etc. What do you mean? -Chris From clattner at apple.com Fri Jun 12 18:44:54 2009 From: clattner at apple.com (Chris Lattner) Date: Fri, 12 Jun 2009 16:44:54 -0700 Subject: [llvm-commits] [llvm] r73009 - in /llvm/trunk: lib/Target/PowerPC/PPCInstrAltivec.td test/CodeGen/PowerPC/vec_shift.ll In-Reply-To: <200906070107.n5717uPV029219@zion.cs.uiuc.edu> References: <200906070107.n5717uPV029219@zion.cs.uiuc.edu> Message-ID: <13DDE42D-E3E4-4B46-8304-21140383B859@apple.com> On Jun 6, 2009, at 6:07 PM, Eli Friedman wrote: > Author: efriedma > Date: Sat Jun 6 20:07:55 2009 > New Revision: 73009 > > URL: http://llvm.org/viewvc/llvm-project?rev=73009&view=rev > Log: > PR3628: Add patterns to match SHL/SRL/SRA to the corresponding Altivec > instructions. Nice. Are there altivec intrinsics for these? Can we zap the intrinsics and have llvm-gcc lower to the LLVM IR node? -Chris From bruno.cardoso at gmail.com Fri Jun 12 18:51:56 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Fri, 12 Jun 2009 23:51:56 -0000 Subject: [llvm-commits] [llvm] r73271 - in /llvm/trunk/include/llvm/CodeGen: JITCodeEmitter.h MachineCodeEmitter.h Message-ID: <200906122351.n5CNpuML004446@zion.cs.uiuc.edu> Author: bruno Date: Fri Jun 12 18:51:56 2009 New Revision: 73271 URL: http://llvm.org/viewvc/llvm-project?rev=73271&view=rev Log: Type change cleanup on JCE and MCE. Patch by Aaron Gray Modified: llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h Modified: llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h?rev=73271&r1=73270&r2=73271&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h (original) +++ llvm/trunk/include/llvm/CodeGen/JITCodeEmitter.h Fri Jun 12 18:51:56 2009 @@ -97,7 +97,7 @@ /// emitWordLE - This callback is invoked when a 32-bit word needs to be /// written to the output stream in little-endian format. /// - void emitWordLE(unsigned W) { + void emitWordLE(uint32_t W) { if (4 <= BufferEnd-CurBufferPtr) { *CurBufferPtr++ = (uint8_t)(W >> 0); *CurBufferPtr++ = (uint8_t)(W >> 8); @@ -111,7 +111,7 @@ /// emitWordBE - This callback is invoked when a 32-bit word needs to be /// written to the output stream in big-endian format. /// - void emitWordBE(unsigned W) { + void emitWordBE(uint32_t W) { if (4 <= BufferEnd-CurBufferPtr) { *CurBufferPtr++ = (uint8_t)(W >> 24); *CurBufferPtr++ = (uint8_t)(W >> 16); @@ -176,7 +176,7 @@ /// emitULEB128Bytes - This callback is invoked when a ULEB128 needs to be /// written to the output stream. - void emitULEB128Bytes(unsigned Value) { + void emitULEB128Bytes(uint64_t Value) { do { uint8_t Byte = Value & 0x7f; Value >>= 7; @@ -187,7 +187,7 @@ /// emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be /// written to the output stream. - void emitSLEB128Bytes(int32_t Value) { + void emitSLEB128Bytes(int64_t Value) { int32_t Sign = Value >> (8 * sizeof(Value) - 1); bool IsMore; @@ -212,7 +212,7 @@ } /// emitInt32 - Emit a int32 directive. - void emitInt32(int32_t Value) { + void emitInt32(uint32_t Value) { if (4 <= BufferEnd-CurBufferPtr) { *((uint32_t*)CurBufferPtr) = Value; CurBufferPtr += 4; Modified: llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h?rev=73271&r1=73270&r2=73271&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineCodeEmitter.h Fri Jun 12 18:51:56 2009 @@ -104,7 +104,7 @@ /// emitWordLE - This callback is invoked when a 32-bit word needs to be /// written to the output stream in little-endian format. /// - void emitWordLE(unsigned W) { + void emitWordLE(uint32_t W) { if (4 <= BufferEnd-CurBufferPtr) { *CurBufferPtr++ = (uint8_t)(W >> 0); *CurBufferPtr++ = (uint8_t)(W >> 8); @@ -118,7 +118,7 @@ /// emitWordBE - This callback is invoked when a 32-bit word needs to be /// written to the output stream in big-endian format. /// - void emitWordBE(unsigned W) { + void emitWordBE(uint32_t W) { if (4 <= BufferEnd-CurBufferPtr) { *CurBufferPtr++ = (uint8_t)(W >> 24); *CurBufferPtr++ = (uint8_t)(W >> 16); @@ -183,7 +183,7 @@ /// emitULEB128Bytes - This callback is invoked when a ULEB128 needs to be /// written to the output stream. - void emitULEB128Bytes(unsigned Value) { + void emitULEB128Bytes(uint64_t Value) { do { uint8_t Byte = Value & 0x7f; Value >>= 7; @@ -194,8 +194,8 @@ /// emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be /// written to the output stream. - void emitSLEB128Bytes(int32_t Value) { - int32_t Sign = Value >> (8 * sizeof(Value) - 1); + void emitSLEB128Bytes(uint64_t Value) { + uint64_t Sign = Value >> (8 * sizeof(Value) - 1); bool IsMore; do { From deeppatel1987 at gmail.com Fri Jun 12 18:52:14 2009 From: deeppatel1987 at gmail.com (Sandeep Patel) Date: Fri, 12 Jun 2009 16:52:14 -0700 Subject: [llvm-commits] [llvm] r73095 - in /llvm/trunk: include/llvm/Target/TargetMachine.h include/llvm/Target/TargetOptions.h lib/Target/ARM/ARMCallingConv.td lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMRegist In-Reply-To: References: <305d6f60906110010l37762b0br64c9d75b7f149915@mail.gmail.com> <41FF1606-AC7C-496F-BDFA-9A9BBFE9606B@apple.com> <305d6f60906111647i4068c9aduacdf91defae45d44@mail.gmail.com> <2C75AFA1-F51C-4FF0-ACF1-797CE8F45A03@apple.com> Message-ID: <305d6f60906121652v5ee48dfbn105ebd00821f1d2d@mail.gmail.com> On Fri, Jun 12, 2009 at 4:36 PM, Chris Lattner wrote: > > On Jun 12, 2009, at 11:12 AM, Evan Cheng wrote: >>> GCC did not change the target triple to indicate use of hard float; >>> it's still arm-linux-gnueabi. GCC even allows a function attribute to >>> change the ABI per function in support of kernel development and >>> other >>> cases where one may need to mix ABIs (e.g. a library that supports >>> legacy soft float applications, etc.). >> >> Ok. Then it makes more sense for it to be a function note. We should >> be able to figure out a way to change calling convention (and other >> subtarget states). > > I agree: if one program can make use of multiple ABIs at the same > time, it should not be in the triple. > >> I previously planned to make this a CC (64, 65, 66,...) on every >> function, but it seemed silly to not have a default be applied to >> handle C, fastcall, etc. > > What do you mean? I originally considered having the front-end tag every function with the exact CC that applied to it. No function would be C or fastcall. They'll all be tagged with a target-unique CC (CallingConv::ARM_APCS = 64, CallingConv::ARM_AAPCS = 65, CallingConv::ARM_AAPCS_VFP = 66, etc.). deep From bruno.cardoso at gmail.com Fri Jun 12 18:52:56 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Fri, 12 Jun 2009 20:52:56 -0300 Subject: [llvm-commits] Changing MCE and JCE to modern '_t' style types In-Reply-To: <72268CC5-B6C1-4318-9DA5-F2B1CE39D516@apple.com> References: <72268CC5-B6C1-4318-9DA5-F2B1CE39D516@apple.com> Message-ID: <275e64e40906121652g5367e1dw6cef47db269c3c01@mail.gmail.com> On Thu, Jun 11, 2009 at 3:17 PM, Evan Cheng wrote: > Looks good. Thanks. commited! > Evan > > On Jun 10, 2009, at 3:36 PM, Aaron Gray wrote: > >> Here's a patch for the MachineCodeEmitter and JITCodeEmitter >> classes, changing older types to '_t' types. >> >> I have used [u]int64_t types for emitULEB128Bytes() and >> emitSLEB128Bytes() methods used for DWARF style EH in JIT. >> >> We could use a [u]int128_t instead if we defined them properly in >> include/llvm/Support/DataTypes.h.in, but 64 bits should be large >> enough for the forseeable future :) >> >> The patch has been tested with 'make check' on Linux. >> >> Aaron >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -- Bruno Cardoso Lopes http://www.brunocardoso.cc From eli.friedman at gmail.com Fri Jun 12 18:58:48 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Fri, 12 Jun 2009 16:58:48 -0700 Subject: [llvm-commits] [llvm] r73009 - in /llvm/trunk: lib/Target/PowerPC/PPCInstrAltivec.td test/CodeGen/PowerPC/vec_shift.ll In-Reply-To: <13DDE42D-E3E4-4B46-8304-21140383B859@apple.com> References: <200906070107.n5717uPV029219@zion.cs.uiuc.edu> <13DDE42D-E3E4-4B46-8304-21140383B859@apple.com> Message-ID: On Fri, Jun 12, 2009 at 4:44 PM, Chris Lattner wrote: > > On Jun 6, 2009, at 6:07 PM, Eli Friedman wrote: > >> Author: efriedma >> Date: Sat Jun ?6 20:07:55 2009 >> New Revision: 73009 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=73009&view=rev >> Log: >> PR3628: Add patterns to match SHL/SRL/SRA to the corresponding Altivec >> instructions. > > Nice. ?Are there altivec intrinsics for these? ?Can we zap the > intrinsics and have llvm-gcc lower to the LLVM IR node? The intrinsics are int_ppc_altivec_vslb/h/w, int_ppc_altivec_vsrb/h/w, and int_ppc_altivec_vsrab/h/w. We could zap the intrinsics; I don't really want to write the patch, though, because I couldn't test it properly. -Eli From nicholas at mxc.ca Fri Jun 12 19:52:27 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Fri, 12 Jun 2009 17:52:27 -0700 Subject: [llvm-commits] [llvm] r73241 - in /llvm/trunk/lib: Transforms/IPO/MergeFunctions.cpp VMCore/Instruction.cpp In-Reply-To: <200906121903.n5CJ35uX026605@zion.cs.uiuc.edu> References: <200906121903.n5CJ35uX026605@zion.cs.uiuc.edu> Message-ID: <4A32F84B.9070102@mxc.ca> Dan Gohman wrote: > Author: djg > Date: Fri Jun 12 14:03:05 2009 > New Revision: 73241 > > URL: http://llvm.org/viewvc/llvm-project?rev=73241&view=rev > Log: > Give Instruction::isSameOperationAs a corresponding comment to note > the relationship with MergeFunctions.cpp's isEquivalentOperation, > and make a trivial code reordering so that the two functions are > easier to compare. > > Fix the name of Instruction::isSameOperationAs in MergeFunction.cpp's > isEquivalentOperation's comment, and fix a nearby 80-column violation. Thanks Dan! Nick > Modified: > llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp > llvm/trunk/lib/VMCore/Instruction.cpp > > Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=73241&r1=73240&r2=73241&view=diff > > ============================================================================== > --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) > +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Fri Jun 12 14:03:05 2009 > @@ -180,8 +180,9 @@ > > /// isEquivalentOperation - determine whether the two operations are the same > /// except that pointer-to-A and pointer-to-B are equivalent. This should be > -/// kept in sync with Instruction::isSameOperandAs. > -static bool isEquivalentOperation(const Instruction *I1, const Instruction *I2) { > +/// kept in sync with Instruction::isSameOperationAs. > +static bool > +isEquivalentOperation(const Instruction *I1, const Instruction *I2) { > if (I1->getOpcode() != I2->getOpcode() || > I1->getNumOperands() != I2->getNumOperands() || > !isEquivalentType(I1->getType(), I2->getType())) > > Modified: llvm/trunk/lib/VMCore/Instruction.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instruction.cpp?rev=73241&r1=73240&r2=73241&view=diff > > ============================================================================== > --- llvm/trunk/lib/VMCore/Instruction.cpp (original) > +++ llvm/trunk/lib/VMCore/Instruction.cpp Fri Jun 12 14:03:05 2009 > @@ -218,9 +218,12 @@ > } > > // isSameOperationAs > +// This should be kept in sync with isEquivalentOperation in > +// lib/Transforms/IPO/MergeFunctions.cpp. > bool Instruction::isSameOperationAs(const Instruction *I) const { > - if (getOpcode() != I->getOpcode() || getType() != I->getType() || > - getNumOperands() != I->getNumOperands()) > + if (getOpcode() != I->getOpcode() || > + getNumOperands() != I->getNumOperands() || > + getType() != I->getType()) > return false; > > // We have two instructions of identical opcode and #operands. Check to see > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From dpatel at apple.com Fri Jun 12 21:16:21 2009 From: dpatel at apple.com (Devang Patel) Date: Sat, 13 Jun 2009 02:16:21 -0000 Subject: [llvm-commits] [llvm] r73282 - in /llvm/trunk: lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/DebugInfo/2009-06-12-InlineFuncStart.ll Message-ID: <200906130216.n5D2GLUc009407@zion.cs.uiuc.edu> Author: dpatel Date: Fri Jun 12 21:16:18 2009 New Revision: 73282 URL: http://llvm.org/viewvc/llvm-project?rev=73282&view=rev Log: llvm.dbg.region.end() intrinsic is not required to be in _last_ basic block in a function. If that happens then any basic block that follows (lexically) the block with regin.end will not have scope info available. LexicalScopeStack relies on processing basic block in CFG order, but this processing order is not guaranteed. Things get complicated when the optimizer gets a chance to optimizer IR with dbg intrinsics. Apply defensive patch to preserve at least one lexical scope till the end of function. Added: llvm/trunk/test/DebugInfo/2009-06-12-InlineFuncStart.ll Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=73282&r1=73281&r2=73282&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jun 12 21:16:18 2009 @@ -1670,7 +1670,11 @@ DbgScope *Scope = getOrCreateScope(V); unsigned ID = MMI->NextLabelID(); Scope->setEndLabelID(ID); - if (LexicalScopeStack.size() != 0) + // FIXME : region.end() may not be in the last basic block. + // For now, do not pop last lexical scope because next basic + // block may start new inlined function's body. + unsigned LSSize = LexicalScopeStack.size(); + if (LSSize != 0 && LSSize != 1) LexicalScopeStack.pop_back(); if (TimePassesIsEnabled) Added: llvm/trunk/test/DebugInfo/2009-06-12-InlineFuncStart.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-06-12-InlineFuncStart.ll?rev=73282&view=auto ============================================================================== --- llvm/trunk/test/DebugInfo/2009-06-12-InlineFuncStart.ll (added) +++ llvm/trunk/test/DebugInfo/2009-06-12-InlineFuncStart.ll Fri Jun 12 21:16:18 2009 @@ -0,0 +1,75 @@ +; RUN: llvm-as < %s | llc +; RUN: llvm-as < %s | llc -O0 + %llvm.dbg.anchor.type = type { i32, i32 } + %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 } + %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* } + %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 } + at llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 393262, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] + at llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] + at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 393233, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([52 x i8]* @.str2, i32 0, i32 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] + at llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 393216, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] + at .str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] + at .str1 = internal constant [5 x i8] c"/tmp\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] + at .str2 = internal constant [52 x i8] c"4.2.1 (Based on Apple Inc. build 5627) (LLVM build)\00", section "llvm.metadata" ; <[52 x i8]*> [#uses=1] + at .str3 = internal constant [4 x i8] c"foo\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] + at llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 393252, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] + at .str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] + at llvm.dbg.subprogram5 = internal constant %llvm.dbg.subprogram.type { i32 393262, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str6, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str6, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1] + at .str6 = internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1] + +define i32 @foo() nounwind alwaysinline { +entry: + %retval = alloca i32 ; [#uses=2] + %0 = alloca i32 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) + call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + store i32 42, i32* %0, align 4 + %1 = load i32* %0, align 4 ; [#uses=1] + store i32 %1, i32* %retval, align 4 + br label %return + +return: ; preds = %entry + %retval1 = load i32* %retval ; [#uses=1] + call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) + ret i32 %retval1 +} + +declare void @llvm.dbg.func.start({ }*) nounwind + +declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind + +declare void @llvm.dbg.region.end({ }*) nounwind + +define i32 @main() nounwind { +entry: + %retval.i = alloca i32 ; [#uses=2] + %0 = alloca i32 ; [#uses=2] + %retval = alloca i32 ; [#uses=2] + %1 = alloca i32 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram5 to { }*)) + br label %bb1 + +return: ; preds = %entry + %retval1 = load i32* %retval ; [#uses=1] + call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram5 to { }*)) + ret i32 %retval1 + +bb1: + call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) + call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) nounwind + call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) nounwind + store i32 42, i32* %0, align 4 + %2 = load i32* %0, align 4 ; [#uses=1] + store i32 %2, i32* %retval.i, align 4 + %retval1.i = load i32* %retval.i ; [#uses=1] + call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) nounwind + call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*)) nounwind + store i32 %retval1.i, i32* %1, align 4 + %3 = load i32* %1, align 4 ; [#uses=1] + store i32 %3, i32* %retval, align 4 + br label %return +} From evan.cheng at apple.com Sat Jun 13 04:13:10 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 13 Jun 2009 09:13:10 -0000 Subject: [llvm-commits] [llvm] r73291 - in /llvm/trunk: lib/CodeGen/LLVMTargetMachine.cpp lib/Target/ARM/ARM.h lib/Target/ARM/ARMLoadStoreOptimizer.cpp lib/Target/ARM/ARMTargetMachine.cpp lib/Target/ARM/ARMTargetMachine.h test/CodeGen/ARM/stm.ll Message-ID: <200906130913.n5D9DCG1032742@zion.cs.uiuc.edu> Author: evancheng Date: Sat Jun 13 04:12:55 2009 New Revision: 73291 URL: http://llvm.org/viewvc/llvm-project?rev=73291&view=rev Log: Add a ARM specific pre-allocation pass that re-schedule loads / stores from consecutive addresses togther. This makes it easier for the post-allocation pass to form ldm / stm. This is step 1. We are still missing a lot of ldm / stm opportunities because of register allocation are not done in the desired order. More enhancements coming. Added: llvm/trunk/test/CodeGen/ARM/stm.ll Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp llvm/trunk/lib/Target/ARM/ARM.h llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp llvm/trunk/lib/Target/ARM/ARMTargetMachine.h Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=73291&r1=73290&r2=73291&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Sat Jun 13 04:12:55 2009 @@ -240,7 +240,7 @@ if (OptLevel != CodeGenOpt::None) { PM.add(createMachineLICMPass()); PM.add(createMachineSinkingPass()); - printAndVerify(PM, /* allowDoubleDefs= */ true); + printAndVerify(PM, /* allowDoubleDefs= */ false); } // Run pre-ra passes. Modified: llvm/trunk/lib/Target/ARM/ARM.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARM.h?rev=73291&r1=73290&r2=73291&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARM.h (original) +++ llvm/trunk/lib/Target/ARM/ARM.h Sat Jun 13 04:12:55 2009 @@ -98,12 +98,12 @@ FunctionPass *createARMCodeEmitterPass(ARMTargetMachine &TM, MachineCodeEmitter &MCE); -FunctionPass *createARMCodeEmitterPass( ARMTargetMachine &TM, - MachineCodeEmitter &MCE); -FunctionPass *createARMJITCodeEmitterPass( ARMTargetMachine &TM, - JITCodeEmitter &JCE); +FunctionPass *createARMCodeEmitterPass(ARMTargetMachine &TM, + MachineCodeEmitter &MCE); +FunctionPass *createARMJITCodeEmitterPass(ARMTargetMachine &TM, + JITCodeEmitter &JCE); -FunctionPass *createARMLoadStoreOptimizationPass(); +FunctionPass *createARMLoadStoreOptimizationPass(bool PreAlloc = false); FunctionPass *createARMConstantIslandPass(); } // end namespace llvm; Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=73291&r1=73290&r2=73291&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Sat Jun 13 04:12:55 2009 @@ -17,24 +17,31 @@ #include "ARMAddressingModes.h" #include "ARMMachineFunctionInfo.h" #include "ARMRegisterInfo.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/Statistic.h" #include "llvm/CodeGen/MachineBasicBlock.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/RegisterScavenging.h" -#include "llvm/Support/Compiler.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Support/Compiler.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/Statistic.h" using namespace llvm; STATISTIC(NumLDMGened , "Number of ldm instructions generated"); STATISTIC(NumSTMGened , "Number of stm instructions generated"); STATISTIC(NumFLDMGened, "Number of fldm instructions generated"); STATISTIC(NumFSTMGened, "Number of fstm instructions generated"); +STATISTIC(NumLdStMoved, "Number of load / store instructions moved"); + +/// ARMAllocLoadStoreOpt - Post- register allocation pass the combine +/// load / store instructions to form ldm / stm instructions. namespace { struct VISIBILITY_HIDDEN ARMLoadStoreOpt : public MachineFunctionPass { @@ -81,12 +88,6 @@ char ARMLoadStoreOpt::ID = 0; } -/// createARMLoadStoreOptimizationPass - returns an instance of the load / store -/// optimization pass. -FunctionPass *llvm::createARMLoadStoreOptimizationPass() { - return new ARMLoadStoreOpt(); -} - static int getLoadStoreMultipleOpcode(int Opcode) { switch (Opcode) { case ARM::LDR: @@ -582,6 +583,23 @@ RS->forward(prior(Loc)); } +static int getMemoryOpOffset(const MachineInstr *MI) { + int Opcode = MI->getOpcode(); + bool isAM2 = Opcode == ARM::LDR || Opcode == ARM::STR; + unsigned NumOperands = MI->getDesc().getNumOperands(); + unsigned OffField = MI->getOperand(NumOperands-3).getImm(); + int Offset = isAM2 + ? ARM_AM::getAM2Offset(OffField) : ARM_AM::getAM5Offset(OffField) * 4; + if (isAM2) { + if (ARM_AM::getAM2Op(OffField) == ARM_AM::sub) + Offset = -Offset; + } else { + if (ARM_AM::getAM5Op(OffField) == ARM_AM::sub) + Offset = -Offset; + } + return Offset; +} + /// LoadStoreMultipleOpti - An optimization pass to turn multiple LDR / STR /// ops of the same base and incrementing offset into LDM / STM ops. bool ARMLoadStoreOpt::LoadStoreMultipleOpti(MachineBasicBlock &MBB) { @@ -606,22 +624,11 @@ bool isMemOp = isMemoryOp(MBBI); if (isMemOp) { int Opcode = MBBI->getOpcode(); - bool isAM2 = Opcode == ARM::LDR || Opcode == ARM::STR; unsigned Size = getLSMultipleTransferSize(MBBI); unsigned Base = MBBI->getOperand(1).getReg(); unsigned PredReg = 0; ARMCC::CondCodes Pred = getInstrPredicate(MBBI, PredReg); - unsigned NumOperands = MBBI->getDesc().getNumOperands(); - unsigned OffField = MBBI->getOperand(NumOperands-3).getImm(); - int Offset = isAM2 - ? ARM_AM::getAM2Offset(OffField) : ARM_AM::getAM5Offset(OffField) * 4; - if (isAM2) { - if (ARM_AM::getAM2Op(OffField) == ARM_AM::sub) - Offset = -Offset; - } else { - if (ARM_AM::getAM5Op(OffField) == ARM_AM::sub) - Offset = -Offset; - } + int Offset = getMemoryOpOffset(MBBI); // Watch out for: // r4 := ldr [r5] // r5 := ldr [r5, #4] @@ -744,6 +751,17 @@ return NumMerges > 0; } +namespace { + struct OffsetCompare { + bool operator()(const MachineInstr *LHS, const MachineInstr *RHS) const { + int LOffset = getMemoryOpOffset(LHS); + int ROffset = getMemoryOpOffset(RHS); + assert(LHS == RHS || LOffset != ROffset); + return LOffset > ROffset; + } + }; +} + /// MergeReturnIntoLDM - If this is a exit BB, try merging the return op /// (bx lr) into the preceeding stack restore so it directly restore the value /// of LR into pc. @@ -788,3 +806,277 @@ delete RS; return Modified; } + + +/// ARMPreAllocLoadStoreOpt - Pre- register allocation pass that move +/// load / stores from consecutive locations close to make it more +/// likely they will be combined later. + +namespace { + struct VISIBILITY_HIDDEN ARMPreAllocLoadStoreOpt : public MachineFunctionPass{ + static char ID; + ARMPreAllocLoadStoreOpt() : MachineFunctionPass(&ID) {} + + const TargetInstrInfo *TII; + const TargetRegisterInfo *TRI; + MachineRegisterInfo *MRI; + + virtual bool runOnMachineFunction(MachineFunction &Fn); + + virtual const char *getPassName() const { + return "ARM pre- register allocation load / store optimization pass"; + } + + private: + bool RescheduleOps(MachineBasicBlock *MBB, + SmallVector &Ops, + unsigned Base, bool isLd, + DenseMap &MI2LocMap); + bool RescheduleLoadStoreInstrs(MachineBasicBlock *MBB); + }; + char ARMPreAllocLoadStoreOpt::ID = 0; +} + +bool ARMPreAllocLoadStoreOpt::runOnMachineFunction(MachineFunction &Fn) { + TII = Fn.getTarget().getInstrInfo(); + TRI = Fn.getTarget().getRegisterInfo(); + MRI = &Fn.getRegInfo(); + + bool Modified = false; + for (MachineFunction::iterator MFI = Fn.begin(), E = Fn.end(); MFI != E; + ++MFI) + Modified |= RescheduleLoadStoreInstrs(MFI); + + return Modified; +} + +static bool IsSafeToMove(bool isLd, unsigned Base, + MachineBasicBlock::iterator I, + MachineBasicBlock::iterator E, + SmallPtrSet MoveOps, + const TargetRegisterInfo *TRI) { + // Are there stores / loads / calls between them? + // FIXME: This is overly conservative. We should make use of alias information + // some day. + while (++I != E) { + const TargetInstrDesc &TID = I->getDesc(); + if (TID.isCall() || TID.isTerminator() || TID.hasUnmodeledSideEffects()) + return false; + if (isLd && TID.mayStore()) + return false; + if (!isLd) { + if (TID.mayLoad()) + return false; + // It's not safe to move the first 'str' down. + // str r1, [r0] + // strh r5, [r0] + // str r4, [r0, #+4] + if (TID.mayStore() && !MoveOps.count(&*I)) + return false; + } + for (unsigned j = 0, NumOps = I->getNumOperands(); j != NumOps; ++j) { + MachineOperand &MO = I->getOperand(j); + if (MO.isReg() && MO.isDef() && TRI->regsOverlap(MO.getReg(), Base)) + return false; + } + } + return true; +} + +bool ARMPreAllocLoadStoreOpt::RescheduleOps(MachineBasicBlock *MBB, + SmallVector &Ops, + unsigned Base, bool isLd, + DenseMap &MI2LocMap) { + bool RetVal = false; + + // Sort by offset (in reverse order). + std::sort(Ops.begin(), Ops.end(), OffsetCompare()); + + // The loads / stores of the same base are in order. Scan them from first to + // last and check for the followins: + // 1. Any def of base. + // 2. Any gaps. + while (Ops.size() > 1) { + unsigned FirstLoc = ~0U; + unsigned LastLoc = 0; + MachineInstr *FirstOp = 0; + MachineInstr *LastOp = 0; + int LastOffset = 0; + unsigned LastBytes = 0; + unsigned NumMove = 0; + for (int i = Ops.size() - 1; i >= 0; --i) { + MachineInstr *Op = Ops[i]; + unsigned Loc = MI2LocMap[Op]; + if (Loc <= FirstLoc) { + FirstLoc = Loc; + FirstOp = Op; + } + if (Loc >= LastLoc) { + LastLoc = Loc; + LastOp = Op; + } + + int Offset = getMemoryOpOffset(Op); + unsigned Bytes = getLSMultipleTransferSize(Op); + if (LastBytes) { + if (Bytes != LastBytes || Offset != (LastOffset + (int)Bytes)) + break; + } + LastOffset = Offset; + LastBytes = Bytes; + if (++NumMove == 4) + break; + } + + if (NumMove <= 1) + Ops.pop_back(); + else { + SmallPtrSet MoveOps; + for (int i = NumMove-1; i >= 0; --i) + MoveOps.insert(Ops[i]); + + // Be conservative, if the instructions are too far apart, don't + // move them. We want to limit the increase of register pressure. + bool DoMove = (LastLoc - FirstLoc) < NumMove*4; + if (DoMove) + DoMove = IsSafeToMove(isLd, Base, FirstOp, LastOp, MoveOps, TRI); + if (!DoMove) { + for (unsigned i = 0; i != NumMove; ++i) + Ops.pop_back(); + } else { + // This is the new location for the loads / stores. + MachineBasicBlock::iterator InsertPos = isLd ? FirstOp : LastOp; + while (InsertPos != MBB->end() && MoveOps.count(InsertPos)) + ++InsertPos; + for (unsigned i = 0; i != NumMove; ++i) { + MachineInstr *Op = Ops.back(); + Ops.pop_back(); + MBB->splice(InsertPos, MBB, Op); + } + + NumLdStMoved += NumMove; + RetVal = true; + } + } + } + + return RetVal; +} + +bool +ARMPreAllocLoadStoreOpt::RescheduleLoadStoreInstrs(MachineBasicBlock *MBB) { + bool RetVal = false; + + DenseMap MI2LocMap; + DenseMap > Base2LdsMap; + DenseMap > Base2StsMap; + SmallVector LdBases; + SmallVector StBases; + + unsigned Loc = 0; + MachineBasicBlock::iterator MBBI = MBB->begin(); + MachineBasicBlock::iterator E = MBB->end(); + while (MBBI != E) { + for (; MBBI != E; ++MBBI) { + MachineInstr *MI = MBBI; + const TargetInstrDesc &TID = MI->getDesc(); + if (TID.isCall() || TID.isTerminator()) { + // Stop at barriers. + ++MBBI; + break; + } + + MI2LocMap[MI] = Loc++; + if (!isMemoryOp(MI)) + continue; + unsigned PredReg = 0; + if (getInstrPredicate(MI, PredReg) != ARMCC::AL) + continue; + + int Opcode = MI->getOpcode(); + bool isLd = Opcode == ARM::LDR || + Opcode == ARM::FLDS || Opcode == ARM::FLDD; + unsigned Base = MI->getOperand(1).getReg(); + int Offset = getMemoryOpOffset(MI); + + bool StopHere = false; + if (isLd) { + DenseMap >::iterator BI = + Base2LdsMap.find(Base); + if (BI != Base2LdsMap.end()) { + for (unsigned i = 0, e = BI->second.size(); i != e; ++i) { + if (Offset == getMemoryOpOffset(BI->second[i])) { + StopHere = true; + break; + } + } + if (!StopHere) + BI->second.push_back(MI); + } else { + SmallVector MIs; + MIs.push_back(MI); + Base2LdsMap[Base] = MIs; + LdBases.push_back(Base); + } + } else { + DenseMap >::iterator BI = + Base2StsMap.find(Base); + if (BI != Base2StsMap.end()) { + for (unsigned i = 0, e = BI->second.size(); i != e; ++i) { + if (Offset == getMemoryOpOffset(BI->second[i])) { + StopHere = true; + break; + } + } + if (!StopHere) + BI->second.push_back(MI); + } else { + SmallVector MIs; + MIs.push_back(MI); + Base2StsMap[Base] = MIs; + StBases.push_back(Base); + } + } + + if (StopHere) { + // Found a duplicate (a base+offset combination that's seen earlier). Backtrack. + --Loc; + break; + } + } + + // Re-schedule loads. + for (unsigned i = 0, e = LdBases.size(); i != e; ++i) { + unsigned Base = LdBases[i]; + SmallVector &Lds = Base2LdsMap[Base]; + if (Lds.size() > 1) + RetVal |= RescheduleOps(MBB, Lds, Base, true, MI2LocMap); + } + + // Re-schedule stores. + for (unsigned i = 0, e = StBases.size(); i != e; ++i) { + unsigned Base = StBases[i]; + SmallVector &Sts = Base2StsMap[Base]; + if (Sts.size() > 1) + RetVal |= RescheduleOps(MBB, Sts, Base, false, MI2LocMap); + } + + if (MBBI != E) { + Base2LdsMap.clear(); + Base2StsMap.clear(); + LdBases.clear(); + StBases.clear(); + } + } + + return RetVal; +} + + +/// createARMLoadStoreOptimizationPass - returns an instance of the load / store +/// optimization pass. +FunctionPass *llvm::createARMLoadStoreOptimizationPass(bool PreAlloc) { + if (PreAlloc) + return new ARMPreAllocLoadStoreOpt(); + return new ARMLoadStoreOpt(); +} Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=73291&r1=73290&r2=73291&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Sat Jun 13 04:12:55 2009 @@ -23,6 +23,9 @@ #include "llvm/Target/TargetOptions.h" using namespace llvm; +static cl::opt +EnablePreLdStOpti("arm-pre-alloc-loadstore-opti", cl::Hidden, + cl::desc("Enable pre-regalloc load store optimization pass")); static cl::opt DisableLdStOpti("disable-arm-loadstore-opti", cl::Hidden, cl::desc("Disable load store optimization pass")); static cl::opt DisableIfConversion("disable-arm-if-conversion",cl::Hidden, @@ -144,6 +147,16 @@ return false; } +bool ARMTargetMachine::addPreRegAlloc(PassManagerBase &PM, + CodeGenOpt::Level OptLevel) { + if (!EnablePreLdStOpti) + return false; + // FIXME: temporarily disabling load / store optimization pass for Thumb mode. + if (OptLevel != CodeGenOpt::None && !DisableLdStOpti && !Subtarget.isThumb()) + PM.add(createARMLoadStoreOptimizationPass(true)); + return true; +} + bool ARMTargetMachine::addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel) { // FIXME: temporarily disabling load / store optimization pass for Thumb mode. Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.h?rev=73291&r1=73290&r2=73291&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.h (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.h Sat Jun 13 04:12:55 2009 @@ -71,6 +71,7 @@ // Pass Pipeline Configuration virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel); + virtual bool addPreRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel); virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel); virtual bool addAssemblyEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel, Added: llvm/trunk/test/CodeGen/ARM/stm.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/stm.ll?rev=73291&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/stm.ll (added) +++ llvm/trunk/test/CodeGen/ARM/stm.ll Sat Jun 13 04:12:55 2009 @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin -mattr=+v6,+vfp2 -arm-pre-alloc-loadstore-opti | grep stm | count 2 + +@"\01LC" = internal constant [32 x i8] c"Boolean Not: %d %d %d %d %d %d\0A\00", section "__TEXT,__cstring,cstring_literals" ; <[32 x i8]*> [#uses=1] +@"\01LC1" = internal constant [26 x i8] c"Bitwise Not: %d %d %d %d\0A\00", section "__TEXT,__cstring,cstring_literals" ; <[26 x i8]*> [#uses=1] + +declare i32 @printf(i8* nocapture, ...) nounwind + +define i32 @main() nounwind { +entry: + %0 = tail call i32 (i8*, ...)* @printf(i8* getelementptr ([26 x i8]* @"\01LC1", i32 0, i32 0), i32 -2, i32 -3, i32 2, i32 -6) nounwind ; [#uses=0] + %1 = tail call i32 (i8*, ...)* @printf(i8* getelementptr ([32 x i8]* @"\01LC", i32 0, i32 0), i32 0, i32 1, i32 0, i32 1, i32 0, i32 1) nounwind ; [#uses=0] + ret i32 0 +} From gohman at apple.com Sat Jun 13 10:56:47 2009 From: gohman at apple.com (Dan Gohman) Date: Sat, 13 Jun 2009 15:56:47 -0000 Subject: [llvm-commits] [llvm] r73293 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp Message-ID: <200906131556.n5DFumW2016898@zion.cs.uiuc.edu> Author: djg Date: Sat Jun 13 10:56:47 2009 New Revision: 73293 URL: http://llvm.org/viewvc/llvm-project?rev=73293&view=rev Log: Add a ScalarEvolution::getAnyExtendExpr utility function for performing extension with unspecified bits. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=73293&r1=73292&r2=73293&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Sat Jun 13 10:56:47 2009 @@ -393,6 +393,7 @@ SCEVHandle getTruncateExpr(const SCEVHandle &Op, const Type *Ty); SCEVHandle getZeroExtendExpr(const SCEVHandle &Op, const Type *Ty); SCEVHandle getSignExtendExpr(const SCEVHandle &Op, const Type *Ty); + SCEVHandle getAnyExtendExpr(const SCEVHandle &Op, const Type *Ty); SCEVHandle getAddExpr(std::vector &Ops); SCEVHandle getAddExpr(const SCEVHandle &LHS, const SCEVHandle &RHS) { std::vector Ops; @@ -465,6 +466,12 @@ /// it is sign extended. The conversion must not be narrowing. SCEVHandle getNoopOrSignExtend(const SCEVHandle &V, const Type *Ty); + /// getNoopOrAnyExtend - Return a SCEV corresponding to a conversion of + /// the input value to the specified type. If the type must be extended, + /// it is extended with unspecified bits. The conversion must not be + /// narrowing. + SCEVHandle getNoopOrAnyExtend(const SCEVHandle &V, const Type *Ty); + /// getTruncateOrNoop - Return a SCEV corresponding to a conversion of the /// input value to the specified type. The conversion must not be /// widening. Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=73293&r1=73292&r2=73293&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sat Jun 13 10:56:47 2009 @@ -937,6 +937,48 @@ return Result; } +/// getAnyExtendExpr - Return a SCEV for the given operand extended with +/// unspecified bits out to the given type. +/// +SCEVHandle ScalarEvolution::getAnyExtendExpr(const SCEVHandle &Op, + const Type *Ty) { + assert(getTypeSizeInBits(Op->getType()) < getTypeSizeInBits(Ty) && + "This is not an extending conversion!"); + assert(isSCEVable(Ty) && + "This is not a conversion to a SCEVable type!"); + Ty = getEffectiveSCEVType(Ty); + + // Sign-extend negative constants. + if (const SCEVConstant *SC = dyn_cast(Op)) + if (SC->getValue()->getValue().isNegative()) + return getSignExtendExpr(Op, Ty); + + // Peel off a truncate cast. + if (const SCEVTruncateExpr *T = dyn_cast(Op)) { + SCEVHandle NewOp = T->getOperand(); + if (getTypeSizeInBits(NewOp->getType()) < getTypeSizeInBits(Ty)) + return getAnyExtendExpr(NewOp, Ty); + return getTruncateOrNoop(NewOp, Ty); + } + + // Next try a zext cast. If the cast is folded, use it. + SCEVHandle ZExt = getZeroExtendExpr(Op, Ty); + if (!isa(ZExt)) + return ZExt; + + // Next try a sext cast. If the cast is folded, use it. + SCEVHandle SExt = getSignExtendExpr(Op, Ty); + if (!isa(SExt)) + return SExt; + + // If the expression is obviously signed, use the sext cast value. + if (isa(Op)) + return SExt; + + // Absent any other information, use the zext cast value. + return ZExt; +} + /// getAddExpr - Get a canonical add expression, or something simpler if /// possible. SCEVHandle ScalarEvolution::getAddExpr(std::vector &Ops) { @@ -1903,6 +1945,23 @@ return getSignExtendExpr(V, Ty); } +/// getNoopOrAnyExtend - Return a SCEV corresponding to a conversion of +/// the input value to the specified type. If the type must be extended, +/// it is extended with unspecified bits. The conversion must not be +/// narrowing. +SCEVHandle +ScalarEvolution::getNoopOrAnyExtend(const SCEVHandle &V, const Type *Ty) { + const Type *SrcTy = V->getType(); + assert((SrcTy->isInteger() || (TD && isa(SrcTy))) && + (Ty->isInteger() || (TD && isa(Ty))) && + "Cannot noop or any extend with non-integer arguments!"); + assert(getTypeSizeInBits(SrcTy) <= getTypeSizeInBits(Ty) && + "getNoopOrAnyExtend cannot truncate!"); + if (getTypeSizeInBits(SrcTy) == getTypeSizeInBits(Ty)) + return V; // No conversion + return getAnyExtendExpr(V, Ty); +} + /// getTruncateOrNoop - Return a SCEV corresponding to a conversion of the /// input value to the specified type. The conversion must not be widening. SCEVHandle From gohman at apple.com Sat Jun 13 11:25:49 2009 From: gohman at apple.com (Dan Gohman) Date: Sat, 13 Jun 2009 16:25:49 -0000 Subject: [llvm-commits] [llvm] r73294 - in /llvm/trunk: lib/Analysis/ScalarEvolutionExpander.cpp lib/Transforms/Scalar/IndVarSimplify.cpp test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll test/Transforms/IndVarSimplify/masked-iv.ll Message-ID: <200906131625.n5DGPngp017729@zion.cs.uiuc.edu> Author: djg Date: Sat Jun 13 11:25:49 2009 New Revision: 73294 URL: http://llvm.org/viewvc/llvm-project?rev=73294&view=rev Log: Teach SCEVExpander's visitAddRecExpr to reuse an existing canonical induction variable when the addrec to be expanded does not require a wider type. This eliminates the need for IndVarSimplify to micro-manage SCEV expansions, because SCEVExpander now automatically expands them in the form that IndVarSimplify considers to be canonical. (LSR still micro-manages its SCEV expansions, because it's optimizing for the target, rather than for other optimizations.) Also, this uses the new getAnyExtendExpr, which has more clever expression simplification logic than the IndVarSimplify code it replaces, and this cleans up some ugly expansions in code such as the included masked-iv.ll testcase. Added: llvm/trunk/test/Transforms/IndVarSimplify/masked-iv.ll Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp llvm/trunk/test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=73294&r1=73293&r2=73294&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Sat Jun 13 11:25:49 2009 @@ -16,6 +16,7 @@ #include "llvm/Analysis/ScalarEvolutionExpander.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Target/TargetData.h" +#include "llvm/ADT/STLExtras.h" using namespace llvm; /// InsertCastOfTo - Insert a cast of V to the specified type, doing what @@ -442,6 +443,34 @@ const Type *Ty = SE.getEffectiveSCEVType(S->getType()); const Loop *L = S->getLoop(); + // First check for an existing canonical IV in a suitable type. + PHINode *CanonicalIV = 0; + if (PHINode *PN = L->getCanonicalInductionVariable()) + if (SE.isSCEVable(PN->getType()) && + isa(SE.getEffectiveSCEVType(PN->getType())) && + SE.getTypeSizeInBits(PN->getType()) >= SE.getTypeSizeInBits(Ty)) + CanonicalIV = PN; + + // Rewrite an AddRec in terms of the canonical induction variable, if + // its type is more narrow. + if (CanonicalIV && + SE.getTypeSizeInBits(CanonicalIV->getType()) > + SE.getTypeSizeInBits(Ty)) { + SCEVHandle Start = SE.getAnyExtendExpr(S->getStart(), + CanonicalIV->getType()); + SCEVHandle Step = SE.getAnyExtendExpr(S->getStepRecurrence(SE), + CanonicalIV->getType()); + Value *V = expand(SE.getAddRecExpr(Start, Step, S->getLoop())); + BasicBlock::iterator SaveInsertPt = getInsertionPoint(); + BasicBlock::iterator NewInsertPt = + next(BasicBlock::iterator(cast(V))); + while (isa(NewInsertPt)) ++NewInsertPt; + V = expandCodeFor(SE.getTruncateExpr(SE.getUnknown(V), Ty), 0, + NewInsertPt); + setInsertionPoint(SaveInsertPt); + return V; + } + // {X,+,F} --> X + {0,+,F} if (!S->getStart()->isZero()) { std::vector NewOps(S->getOperands()); @@ -475,6 +504,14 @@ // {0,+,1} --> Insert a canonical induction variable into the loop! if (S->isAffine() && S->getOperand(1) == SE.getIntegerSCEV(1, Ty)) { + // If there's a canonical IV, just use it. + if (CanonicalIV) { + assert(Ty == SE.getEffectiveSCEVType(CanonicalIV->getType()) && + "IVs with types different from the canonical IV should " + "already have been handled!"); + return CanonicalIV; + } + // Create and insert the PHI node for the induction variable in the // specified loop. BasicBlock *Header = L->getHeader(); @@ -502,18 +539,16 @@ return PN; } + // {0,+,F} --> {0,+,1} * F // Get the canonical induction variable I for this loop. - Value *I = getOrInsertCanonicalInductionVariable(L, Ty); + Value *I = CanonicalIV ? + CanonicalIV : + getOrInsertCanonicalInductionVariable(L, Ty); // If this is a simple linear addrec, emit it now as a special case. if (S->isAffine()) { // {0,+,F} --> i*F Value *F = expandCodeFor(S->getOperand(1), Ty); - - // If the step is by one, just return the inserted IV. - if (ConstantInt *CI = dyn_cast(F)) - if (CI->getValue() == 1) - return I; - + // If the insert point is directly inside of the loop, emit the multiply at // the insert point. Otherwise, L is a loop that is a parent of the insert // point loop. If we can, move the multiply to the outer most loop that it @@ -548,9 +583,17 @@ // into this folder. SCEVHandle IH = SE.getUnknown(I); // Get I as a "symbolic" SCEV. - SCEVHandle V = S->evaluateAtIteration(IH, SE); + // Promote S up to the canonical IV type, if the cast is foldable. + SCEVHandle NewS = S; + SCEVHandle Ext = SE.getNoopOrAnyExtend(S, I->getType()); + if (isa(Ext)) + NewS = Ext; + + SCEVHandle V = cast(NewS)->evaluateAtIteration(IH, SE); //cerr << "Evaluated: " << *this << "\n to: " << *V << "\n"; + // Truncate the result down to the original type, if needed. + SCEVHandle T = SE.getTruncateOrNoop(V, Ty); return expand(V); } Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=73294&r1=73293&r2=73294&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Sat Jun 13 11:25:49 2009 @@ -168,7 +168,7 @@ // Expand the code for the iteration count into the preheader of the loop. BasicBlock *Preheader = L->getLoopPreheader(); - Value *ExitCnt = Rewriter.expandCodeFor(RHS, CmpIndVar->getType(), + Value *ExitCnt = Rewriter.expandCodeFor(RHS, IndVar->getType(), Preheader->getTerminator()); // Insert a new icmp_ne or icmp_eq instruction before the branch. @@ -392,10 +392,31 @@ // in this loop, insert a canonical induction variable of the largest size. Value *IndVar = 0; if (NeedCannIV) { + // Check to see if the loop already has a canonical-looking induction + // variable. If one is present and it's wider than the planned canonical + // induction variable, temporarily remove it, so that the Rewriter + // doesn't attempt to reuse it. + PHINode *OldCannIV = L->getCanonicalInductionVariable(); + if (OldCannIV) { + if (SE->getTypeSizeInBits(OldCannIV->getType()) > + SE->getTypeSizeInBits(LargestType)) + OldCannIV->removeFromParent(); + else + OldCannIV = 0; + } + IndVar = Rewriter.getOrInsertCanonicalInductionVariable(L,LargestType); + ++NumInserted; Changed = true; DOUT << "INDVARS: New CanIV: " << *IndVar; + + // Now that the official induction variable is established, reinsert + // the old canonical-looking variable after it so that the IR remains + // consistent. It will be deleted as part of the dead-PHI deletion at + // the end of the pass. + if (OldCannIV) + OldCannIV->insertAfter(cast(IndVar)); } // If we have a trip count expression, rewrite the loop's exit condition @@ -459,8 +480,8 @@ E = List.end(); UI != E; ++UI) { SCEVHandle Offset = UI->getOffset(); Value *Op = UI->getOperandValToReplace(); + const Type *UseTy = Op->getType(); Instruction *User = UI->getUser(); - bool isSigned = UI->isSigned(); // Compute the final addrec to expand into code. SCEVHandle AR = IU->getReplacementExpr(*UI); @@ -471,7 +492,7 @@ // Expand loop-invariant values in the loop preheader. They will // be sunk to the exit block later, if possible. NewVal = - Rewriter.expandCodeFor(AR, LargestType, + Rewriter.expandCodeFor(AR, UseTy, L->getLoopPreheader()->getTerminator()); Rewriter.setInsertionPoint(I); ++NumReplaced; @@ -485,74 +506,6 @@ if (!Stride->isLoopInvariant(L)) continue; - const Type *IVTy = Offset->getType(); - const Type *UseTy = Op->getType(); - - // Promote the Offset and Stride up to the canonical induction - // variable's bit width. - SCEVHandle PromotedOffset = Offset; - SCEVHandle PromotedStride = Stride; - if (SE->getTypeSizeInBits(IVTy) != SE->getTypeSizeInBits(LargestType)) { - // It doesn't matter for correctness whether zero or sign extension - // is used here, since the value is truncated away below, but if the - // value is signed, sign extension is more likely to be folded. - if (isSigned) { - PromotedOffset = SE->getSignExtendExpr(PromotedOffset, LargestType); - PromotedStride = SE->getSignExtendExpr(PromotedStride, LargestType); - } else { - PromotedOffset = SE->getZeroExtendExpr(PromotedOffset, LargestType); - // If the stride is obviously negative, use sign extension to - // produce things like x-1 instead of x+255. - if (isa(PromotedStride) && - cast(PromotedStride) - ->getValue()->getValue().isNegative()) - PromotedStride = SE->getSignExtendExpr(PromotedStride, - LargestType); - else - PromotedStride = SE->getZeroExtendExpr(PromotedStride, - LargestType); - } - } - - // Create the SCEV representing the offset from the canonical - // induction variable, still in the canonical induction variable's - // type, so that all expanded arithmetic is done in the same type. - SCEVHandle NewAR = SE->getAddRecExpr(SE->getIntegerSCEV(0, LargestType), - PromotedStride, L); - // Add the PromotedOffset as a separate step, because it may not be - // loop-invariant. - NewAR = SE->getAddExpr(NewAR, PromotedOffset); - - // Expand the addrec into instructions. - Value *V = Rewriter.expandCodeFor(NewAR); - - // Insert an explicit cast if necessary to truncate the value - // down to the original stride type. This is done outside of - // SCEVExpander because in SCEV expressions, a truncate of an - // addrec is always folded. - if (LargestType != IVTy) { - if (SE->getTypeSizeInBits(IVTy) != SE->getTypeSizeInBits(LargestType)) - NewAR = SE->getTruncateExpr(NewAR, IVTy); - if (Rewriter.isInsertedExpression(NewAR)) - V = Rewriter.expandCodeFor(NewAR); - else { - V = Rewriter.InsertCastOfTo(CastInst::getCastOpcode(V, false, - IVTy, false), - V, IVTy); - assert(!isa(V) && !isa(V) && - "LargestType wasn't actually the largest type!"); - // Force the rewriter to use this trunc whenever this addrec - // appears so that it doesn't insert new phi nodes or - // arithmetic in a different type. - Rewriter.addInsertedValue(V, NewAR); - } - } - - DOUT << "INDVARS: Made offset-and-trunc IV for offset " - << *IVTy << " " << *Offset << ": "; - DEBUG(WriteAsOperand(*DOUT, V, false)); - DOUT << "\n"; - // Now expand it into actual Instructions and patch it into place. NewVal = Rewriter.expandCodeFor(AR, UseTy); } Modified: llvm/trunk/test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll?rev=73294&r1=73293&r2=73294&view=diff ============================================================================== --- llvm/trunk/test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll (original) +++ llvm/trunk/test/Transforms/IndVarSimplify/2003-09-23-NotAtTop.ll Sat Jun 13 11:25:49 2009 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -indvars | llvm-dis | %prcontext Loop: 1 | grep %indvar +; RUN: llvm-as < %s | opt -indvars | llvm-dis | %prcontext ^Loop: 1 | grep %Canonical ; The indvar simplification code should ensure that the first PHI in the block ; is the canonical one! Added: llvm/trunk/test/Transforms/IndVarSimplify/masked-iv.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/masked-iv.ll?rev=73294&view=auto ============================================================================== --- llvm/trunk/test/Transforms/IndVarSimplify/masked-iv.ll (added) +++ llvm/trunk/test/Transforms/IndVarSimplify/masked-iv.ll Sat Jun 13 11:25:49 2009 @@ -0,0 +1,24 @@ +; RUN: llvm-as < %s | opt -indvars | llvm-dis | grep trunc | count 1 + +; Indvars should do the IV arithmetic in the canonical IV type (i64), +; and only use one truncation. + +define void @foo(i64* %A, i64* %B, i64 %n, i64 %a, i64 %s) nounwind { +entry: + %t0 = icmp sgt i64 %n, 0 ; [#uses=1] + br i1 %t0, label %bb.preheader, label %return + +bb.preheader: ; preds = %entry + br label %bb + +bb: ; preds = %bb, %bb.preheader + %i.01 = phi i64 [ %t6, %bb ], [ %a, %bb.preheader ] ; [#uses=3] + %t1 = and i64 %i.01, 255 ; [#uses=1] + %t2 = getelementptr i64* %A, i64 %t1 ; [#uses=1] + store i64 %i.01, i64* %t2, align 8 + %t6 = add i64 %i.01, %s ; [#uses=1] + br label %bb + +return: ; preds = %entry + ret void +} From sanjiv.gupta at microchip.com Sat Jun 13 12:35:55 2009 From: sanjiv.gupta at microchip.com (Sanjiv Gupta) Date: Sat, 13 Jun 2009 17:35:55 -0000 Subject: [llvm-commits] [llvm] r73295 - in /llvm/trunk/lib/Target/PIC16: PIC16AsmPrinter.cpp PIC16DebugInfo.cpp PIC16DebugInfo.h Message-ID: <200906131735.n5DHZt0Q019890@zion.cs.uiuc.edu> Author: sgupta Date: Sat Jun 13 12:35:54 2009 New Revision: 73295 URL: http://llvm.org/viewvc/llvm-project?rev=73295&view=rev Log: The subprogram descriptor for a function may be missing (llvm-ld linking two static functions with same name), so pick up the compilation unit for the function from the first valid debug loc of its instructions. This patch also emits debug info for structure (aggregate types in general) types. Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=73295&r1=73294&r2=73295&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Sat Jun 13 12:35:54 2009 @@ -48,8 +48,21 @@ const Function *F = MF.getFunction(); CurrentFnName = Mang->getValueName(F); - // Emit .file directive. - DbgInfo.EmitFileDirective(F); + // Iterate over the first basic block instructions to find if it has a + // DebugLoc. If so emit .file directive. Instructions such as movlw do not + // have valid DebugLoc, so need to iterate over instructions. + MachineFunction::const_iterator I = MF.begin(); + for (MachineBasicBlock::const_iterator MBBI = I->begin(), E = I->end(); + MBBI != E; MBBI++) { + const DebugLoc DLoc = MBBI->getDebugLoc(); + if (!DLoc.isUnknown()) { + GlobalVariable *CU = MF.getDebugLocTuple(DLoc).CompileUnit; + unsigned line = MF.getDebugLocTuple(DLoc).Line; + DbgInfo.EmitFileDirective(CU); + DbgInfo.SetFunctBeginLine(line); + break; + } + } // Emit the function frame (args and temps). EmitFunctionFrame(MF); @@ -213,14 +226,13 @@ I->setSection(TAI->SectionForGlobal(I)->getName()); } - DbgInfo.EmitFileDirective(M); + DbgInfo.Init(M); EmitFunctionDecls(M); EmitUndefinedVars(M); EmitDefinedVars(M); EmitIData(M); EmitUData(M); EmitRomData(M); - DbgInfo.PopulateFunctsDI(M); return Result; } @@ -230,7 +242,7 @@ /// void PIC16AsmPrinter::EmitFunctionDecls (Module &M) { // Emit declarations for external functions. - O << TAI->getCommentString() << "Function Declarations - BEGIN." <<"\n"; + O <<"\n"<getCommentString() << "Function Declarations - BEGIN." <<"\n"; for (Module::iterator I = M.begin(), E = M.end(); I != E; I++) { std::string Name = Mang->getValueName(I); if (Name.compare("@abort") == 0) Modified: llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp?rev=73295&r1=73294&r2=73295&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.cpp Sat Jun 13 12:35:54 2009 @@ -18,13 +18,6 @@ using namespace llvm; -PIC16DbgInfo::~PIC16DbgInfo() { - for(std::map::iterator i = FunctNameMap.begin(); - i!=FunctNameMap.end(); i++) - delete i->second; - FunctNameMap.clear(); -} - void PIC16DbgInfo::PopulateDebugInfo(DIType Ty, unsigned short &TypeNo, bool &HasAux, int Aux[], std::string &TypeName) { @@ -70,7 +63,7 @@ } HasAux = true; // In auxillary entry for array, 7th and 8th byte represent array size. - Aux[6] = size; + Aux[6] = size & 0xff; Aux[7] = size >> 8; DIType BaseType = CTy.getTypeDerivedFrom(); PopulateDebugInfo(BaseType, TypeNo, HasAux, Aux, TypeName); @@ -86,10 +79,14 @@ else TypeNo = TypeNo | PIC16Dbg::T_UNION; CTy.getName(TypeName); - unsigned size = CTy.getSizeInBits()/8; + // UniqueSuffix is .number where number is obtained from + // llvm.dbg.composite. + std::string UniqueSuffix = "." + Ty.getGV()->getName().substr(18); + TypeName += UniqueSuffix; + unsigned short size = CTy.getSizeInBits()/8; // 7th and 8th byte represent size. HasAux = true; - Aux[6] = size; + Aux[6] = size & 0xff; Aux[7] = size >> 8; break; } @@ -145,37 +142,84 @@ return ClassNo; } -void PIC16DbgInfo::PopulateFunctsDI(Module &M) { - GlobalVariable *Root = M.getGlobalVariable("llvm.dbg.subprograms"); - if (!Root) - return; - Constant *RootC = cast(*Root->use_begin()); - - for (Value::use_iterator UI = RootC->use_begin(), UE = Root->use_end(); - UI != UE; ++UI) - for (Value::use_iterator UUI = UI->use_begin(), UUE = UI->use_end(); - UUI != UUE; ++UUI) { - GlobalVariable *GVSP = cast(*UUI); - DISubprogram *SP = new DISubprogram(GVSP); - std::string Name; - SP->getLinkageName(Name); - FunctNameMap[Name] = SP; +void PIC16DbgInfo::Init(Module &M) { + // Do all debug related initializations here. + EmitFileDirective(M); + EmitCompositeTypeDecls(M); +} + +void PIC16DbgInfo::EmitCompositeTypeDecls(Module &M) { + for(iplist::iterator I = M.getGlobalList().begin(), + E = M.getGlobalList().end(); I != E; I++) { + // Structures and union declaration's debug info has llvm.dbg.composite + // in its name. + if(I->getName().find("llvm.dbg.composite") != std::string::npos) { + GlobalVariable *GV = cast(I); + DICompositeType CTy(GV); + if (CTy.getTag() == dwarf::DW_TAG_union_type || + CTy.getTag() == dwarf::DW_TAG_structure_type ) { + std::string name; + CTy.getName(name); + std::string DIVar = I->getName(); + // Get the number after llvm.dbg.composite and make UniqueSuffix from + // it. + std::string UniqueSuffix = "." + DIVar.substr(18); + std::string MangledCTyName = name + UniqueSuffix; + unsigned short size = CTy.getSizeInBits()/8; + int Aux[PIC16Dbg::AuxSize] = {0}; + // 7th and 8th byte represent size of structure/union. + Aux[6] = size & 0xff; + Aux[7] = size >> 8; + // Emit .def for structure/union tag. + if( CTy.getTag() == dwarf::DW_TAG_union_type) + EmitSymbol(MangledCTyName, PIC16Dbg::C_UNTAG); + else if (CTy.getTag() == dwarf::DW_TAG_structure_type) + EmitSymbol(MangledCTyName, PIC16Dbg::C_STRTAG); + + // Emit auxiliary debug information for structure/union tag. + EmitAuxEntry(MangledCTyName, Aux, PIC16Dbg::AuxSize); + unsigned long Value = 0; + DIArray Elements = CTy.getTypeArray(); + for (unsigned i = 0, N = Elements.getNumElements(); i < N; i++) { + DIDescriptor Element = Elements.getElement(i); + unsigned short TypeNo = 0; + bool HasAux = false; + int ElementAux[PIC16Dbg::AuxSize] = { 0 }; + std::string TypeName = ""; + std::string ElementName; + GlobalVariable *GV = Element.getGV(); + DIDerivedType DITy(GV); + DITy.getName(ElementName); + unsigned short ElementSize = DITy.getSizeInBits()/8; + // Get mangleddd name for this structure/union element. + std::string MangMemName = ElementName + UniqueSuffix; + PopulateDebugInfo(DITy, TypeNo, HasAux, ElementAux, TypeName); + short Class; + if( CTy.getTag() == dwarf::DW_TAG_union_type) + Class = PIC16Dbg::C_MOU; + else if (CTy.getTag() == dwarf::DW_TAG_structure_type) + Class = PIC16Dbg::C_MOS; + EmitSymbol(MangMemName, Class, TypeNo, Value); + if (CTy.getTag() == dwarf::DW_TAG_structure_type) + Value += ElementSize; + if (HasAux) + EmitAuxEntry(MangMemName, ElementAux, PIC16Dbg::AuxSize, TypeName); + } + // Emit mangled Symbol for end of structure/union. + std::string EOSSymbol = ".eos" + UniqueSuffix; + EmitSymbol(EOSSymbol, PIC16Dbg::C_EOS); + EmitAuxEntry(EOSSymbol, Aux, PIC16Dbg::AuxSize, MangledCTyName); + } } - return; -} - -DISubprogram* PIC16DbgInfo::getFunctDI(std::string FunctName) { - return FunctNameMap[FunctName]; + } } void PIC16DbgInfo::EmitFunctBeginDI(const Function *F) { std::string FunctName = F->getName(); - DISubprogram *SP = getFunctDI(FunctName); - if (SP) { + if (EmitDebugDirectives) { std::string FunctBeginSym = ".bf." + FunctName; std::string BlockBeginSym = ".bb." + FunctName; - int FunctBeginLine = SP->getLineNumber(); int BFAux[PIC16Dbg::AuxSize] = {0}; BFAux[4] = FunctBeginLine; BFAux[5] = FunctBeginLine >> 8; @@ -189,8 +233,7 @@ void PIC16DbgInfo::EmitFunctEndDI(const Function *F, unsigned Line) { std::string FunctName = F->getName(); - DISubprogram *SP = getFunctDI(FunctName); - if (SP) { + if (EmitDebugDirectives) { std::string FunctEndSym = ".ef." + FunctName; std::string BlockEndSym = ".eb." + FunctName; @@ -208,14 +251,21 @@ /// EmitAuxEntry - Emit Auxiliary debug information. /// -void PIC16DbgInfo::EmitAuxEntry(const std::string VarName, int Aux[], int num) { +void PIC16DbgInfo::EmitAuxEntry(const std::string VarName, int Aux[], int num, + std::string tag) { O << "\n\t.dim " << VarName << ", 1" ; + if (tag != "") + O << ", " << tag; for (int i = 0; igetName(); - DISubprogram *SP = getFunctDI(FunctName); - if (SP) { - std::string Dir, FN; - DICompileUnit CU = SP->getCompileUnit(); - std::string File = CU.getDirectory(Dir) + "/" + CU.getFilename(FN); - if ( File != CurFile) { +void PIC16DbgInfo::EmitFileDirective(GlobalVariable *CU, bool EmitEof) { + std::string Dir, FN; + DICompileUnit DIUnit(CU); + std::string File = DIUnit.getDirectory(Dir) + "/" + DIUnit.getFilename(FN); + if ( File != CurFile ) { + if (EmitEof) EmitEOF(); - O << "\n\t.file\t\"" << File << "\"\n" ; - CurFile = File; - } + O << "\n\t.file\t\"" << File << "\"\n" ; + CurFile = File; } } @@ -290,3 +324,6 @@ O << "\n\t.EOF"; } +void PIC16DbgInfo::SetFunctBeginLine(unsigned line) { + FunctBeginLine = line; +} Modified: llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h?rev=73295&r1=73294&r2=73295&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h (original) +++ llvm/trunk/lib/Target/PIC16/PIC16DebugInfo.h Sat Jun 13 12:35:54 2009 @@ -91,29 +91,36 @@ class raw_ostream; class PIC16DbgInfo { - std::map FunctNameMap; raw_ostream &O; const TargetAsmInfo *TAI; std::string CurFile; + // EmitDebugDirectives is set if debug information is available. Default + // value for it is false. + bool EmitDebugDirectives; + unsigned FunctBeginLine; public: PIC16DbgInfo(raw_ostream &o, const TargetAsmInfo *T) : O(o), TAI(T) { - CurFile = ""; + CurFile = ""; + EmitDebugDirectives = false; } - ~PIC16DbgInfo(); void PopulateDebugInfo(DIType Ty, unsigned short &TypeNo, bool &HasAux, int Aux[], std::string &TypeName); unsigned GetTypeDebugNumber(std::string &type); short getClass(DIGlobalVariable DIGV); - void PopulateFunctsDI(Module &M); - DISubprogram *getFunctDI(std::string FunctName); void EmitFunctBeginDI(const Function *F); + void Init(Module &M); + void EmitCompositeTypeDecls(Module &M); void EmitFunctEndDI(const Function *F, unsigned Line); - void EmitAuxEntry(const std::string VarName, int Aux[], int num); - inline void EmitSymbol(std::string Name, int Class); + void EmitAuxEntry(const std::string VarName, int Aux[], + int num = PIC16Dbg::AuxSize, std::string tag = ""); + inline void EmitSymbol(std::string Name, short Class, + unsigned short Type = PIC16Dbg::T_NULL, + unsigned long Value = 0); void EmitVarDebugInfo(Module &M); void EmitFileDirective(Module &M); - void EmitFileDirective(const Function *F); + void EmitFileDirective(GlobalVariable *CU, bool EmitEof = true); void EmitEOF(); + void SetFunctBeginLine(unsigned line); }; } // end namespace llvm; #endif From nicholas at mxc.ca Sat Jun 13 13:57:20 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 13 Jun 2009 11:57:20 -0700 Subject: [llvm-commits] patch: support instructions in MDNode In-Reply-To: <4A2A7FD1.20507@mxc.ca> References: <4A2A7FD1.20507@mxc.ca> Message-ID: <4A33F690.7030906@mxc.ca> Ping! I found a bug in the previous patch where it broke parsing of "metadata undef" so I fixed that and added a test for that to the test. Please review? Nick Nick Lewycky wrote: > The attached patch adds support for Instructions in MDNodes to the .ll > parser (the printer already supported it) and the .bc reader/writer. > > This also breaks the .bc format for existing .bc files that use MDNode. > If you don't know whether you're using MDNode, you aren't. :) > > The design I chose creates a new METADATA_BLOCK which contains entries > that list off the node elements. The constants block encodes nothing > about an MDNode when it encounters one except for the fact that it exists. > > The alternative I know would work is to store the valueids of the MDNode > elements in the constant block. This means that the reader would need to > create a ConstantPlaceHolder that stores the list of valueids to use in > the ResolveMetadata step. That sounds like a lot of memory usage in the > reader to save a few bytes ("enter block") at 1 per module plus 1 per > function (assuming the module/functions use metadata; when they don't > it's free). > > Please review! I'm particularly interested in way of shaving bytes off > the .bc format and speeding up the .bc reading and writing. > > Nick > > > ------------------------------------------------------------------------ > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: mdnode-instructions2.patch Type: text/x-patch Size: 21154 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090613/6c5812b8/attachment.bin From nicholas at mxc.ca Sat Jun 13 14:09:52 2009 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 13 Jun 2009 19:09:52 -0000 Subject: [llvm-commits] [llvm] r73299 - /llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Message-ID: <200906131909.n5DJ9qt0022775@zion.cs.uiuc.edu> Author: nicholas Date: Sat Jun 13 14:09:52 2009 New Revision: 73299 URL: http://llvm.org/viewvc/llvm-project?rev=73299&view=rev Log: Unlike the other instructions, GEP really does need to look at the type of a pointer. This fixes kimwitu++. Pointed out by Frits van Bommel on review! Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=73299&r1=73298&r2=73299&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Sat Jun 13 14:09:52 2009 @@ -284,6 +284,20 @@ if (!isEquivalentOperation(FI, GI)) return false; + if (isa(FI)) { + const GetElementPtrInst *GEPF = cast(FI); + const GetElementPtrInst *GEPG = cast(GI); + if (GEPF->hasAllZeroIndices() && GEPG->hasAllZeroIndices()) { + // It's effectively a bitcast. + ++FI, ++GI; + continue; + } + + // TODO: we only really care about the elements before the index + if (FI->getOperand(0)->getType() != GI->getOperand(0)->getType()) + return false; + } + if (ValueMap[FI] == GI) { ++FI, ++GI; continue; From benny.kra at googlemail.com Sat Jun 13 16:58:54 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Sat, 13 Jun 2009 23:58:54 +0200 Subject: [llvm-commits] [PATCH] work around a nasty g++/glibc incompatiblity Message-ID: <490026FF-6594-4EDA-8082-C98858D897B2@gmail.com> glibc has two versions of strerror_r, a standards compliant one and a GNU specific one. The GNU one is chosen when _GNU_SOURCE is defined. g+ + always defines _GNU_SOURCE on linux platforms because glibc's headers won't compile in C++ mode without it. The GNU strerror_r doesn't always modify the buffer which causes empty error messages on linux. The attached patch fixes this by falling back to the less threadsafe method if _GNU_SOURCE is defined. -------------- next part -------------- A non-text attachment was scrubbed... Name: glibcstrerror_r.patch Type: application/octet-stream Size: 848 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090613/b8e78025/attachment.obj -------------- next part -------------- From dgregor at apple.com Sun Jun 14 02:24:49 2009 From: dgregor at apple.com (Douglas Gregor) Date: Sun, 14 Jun 2009 07:24:49 -0000 Subject: [llvm-commits] [llvm] r73331 - /llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp Message-ID: <200906140724.n5E7OnRP013379@zion.cs.uiuc.edu> Author: dgregor Date: Sun Jun 14 02:24:49 2009 New Revision: 73331 URL: http://llvm.org/viewvc/llvm-project?rev=73331&view=rev Log: Add output of the SFINAE bit for Clang's diagnostics Modified: llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp Modified: llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp?rev=73331&r1=73330&r2=73331&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp Sun Jun 14 02:24:49 2009 @@ -65,6 +65,12 @@ } else { OS << ", 0"; } + + // SFINAE bit + if (R.getValueAsBit("SFINAE")) + OS << ", true"; + else + OS << ", false"; OS << ")\n"; } } From edwintorok at gmail.com Sun Jun 14 02:38:34 2009 From: edwintorok at gmail.com (=?ISO-8859-1?Q?T=F6r=F6k_Edwin?=) Date: Sun, 14 Jun 2009 10:38:34 +0300 Subject: [llvm-commits] [PATCH] work around a nasty g++/glibc incompatiblity In-Reply-To: <490026FF-6594-4EDA-8082-C98858D897B2@gmail.com> References: <490026FF-6594-4EDA-8082-C98858D897B2@gmail.com> Message-ID: <4A34A8FA.6020601@gmail.com> On 2009-06-14 00:58, Benjamin Kramer wrote: > glibc has two versions of strerror_r, a standards compliant one and a > GNU specific one. The GNU one is chosen when _GNU_SOURCE is defined. > g++ always defines _GNU_SOURCE on linux platforms because glibc's > headers won't compile in C++ mode without it. The GNU strerror_r > doesn't always modify the buffer which causes empty error messages on > linux. The attached patch fixes this by falling back to the less > threadsafe method if _GNU_SOURCE is defined. > The GNU version always returns a pointer to the error message, it may or may not use the buffer supplied. (I think it doesn't use the buffer if it can return a pointer to the error message table). Accessing the returned pointer is thread safe in either case, so you could check if the returned value == buffer, and if not copy it to buffer. It would still be thread safe. Or we could just use a mutex around strerror invocations. Best regards, --Edwin From bruno.cardoso at gmail.com Sun Jun 14 02:53:21 2009 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Sun, 14 Jun 2009 07:53:21 -0000 Subject: [llvm-commits] [llvm] r73333 - in /llvm/trunk: include/llvm/CodeGen/BinaryObject.h include/llvm/Target/TargetELFWriterInfo.h lib/CodeGen/ELF.h lib/CodeGen/ELFCodeEmitter.cpp lib/CodeGen/ELFWriter.cpp lib/CodeGen/ELFWriter.h lib/Target/TargetELFWriterInfo.cpp Message-ID: <200906140753.n5E7rMhi025093@zion.cs.uiuc.edu> Author: bruno Date: Sun Jun 14 02:53:21 2009 New Revision: 73333 URL: http://llvm.org/viewvc/llvm-project?rev=73333&view=rev Log: Introduce new BinaryObject (blob) class, ELF Writer modified to use it. BinaryObject.h by Aaron Gray Added: llvm/trunk/include/llvm/CodeGen/BinaryObject.h Modified: llvm/trunk/include/llvm/Target/TargetELFWriterInfo.h llvm/trunk/lib/CodeGen/ELF.h llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp llvm/trunk/lib/CodeGen/ELFWriter.cpp llvm/trunk/lib/CodeGen/ELFWriter.h llvm/trunk/lib/Target/TargetELFWriterInfo.cpp Added: llvm/trunk/include/llvm/CodeGen/BinaryObject.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/BinaryObject.h?rev=73333&view=auto ============================================================================== --- llvm/trunk/include/llvm/CodeGen/BinaryObject.h (added) +++ llvm/trunk/include/llvm/CodeGen/BinaryObject.h Sun Jun 14 02:53:21 2009 @@ -0,0 +1,325 @@ +//===-- llvm/CodeGen/BinaryObject.h - Binary Object. -----------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines a Binary Object Aka. "blob" for holding data from code +// generators, ready for data to the object module code writters. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CODEGEN_BINARYOBJECT_H +#define LLVM_CODEGEN_BINARYOBJECT_H + +#include +#include + +namespace llvm { + +class MachineRelocation; +typedef std::vector BinaryData; + +class BinaryObject { +protected: + std::string Name; + bool IsLittleEndian; + bool Is64Bit; + BinaryData Data; + std::vector Relocations; + +public: + /// Constructors and destructor + BinaryObject() {} + + BinaryObject(bool isLittleEndian, bool is64Bit) + : IsLittleEndian(isLittleEndian), Is64Bit(is64Bit) {} + + BinaryObject(const std::string &name, bool isLittleEndian, bool is64Bit) + : Name(name), IsLittleEndian(isLittleEndian), Is64Bit(is64Bit) {} + + ~BinaryObject() {} + + /// getName - get name of BinaryObject + inline std::string getName() const { return Name; } + + /// get size of binary data + size_t size() const { + return Data.size(); + } + + /// get binary data + BinaryData& getData() { + return Data; + } + + /// get machine relocations + const std::vector& getRelocations() const { + return Relocations; + } + + /// emitByte - This callback is invoked when a byte needs to be + /// written to the data stream. + inline void emitByte(uint8_t B) { + Data.push_back(B); + } + + /// emitWord16 - This callback is invoked when a 16-bit word needs to be + /// written to the data stream in correct endian format and correct size. + inline void emitWord16(uint16_t W) { + if (IsLittleEndian) + emitWord16LE(W); + else + emitWord16BE(W); + } + + /// emitWord16LE - This callback is invoked when a 16-bit word needs to be + /// written to the data stream in correct endian format and correct size. + inline void emitWord16LE(uint16_t W) { + Data.push_back((W >> 0) & 255); + Data.push_back((W >> 8) & 255); + } + + /// emitWord16BE - This callback is invoked when a 16-bit word needs to be + /// written to the data stream in correct endian format and correct size. + inline void emitWord16BE(uint16_t W) { + Data.push_back((W >> 8) & 255); + Data.push_back((W >> 0) & 255); + } + + /// emitWord - This callback is invoked when a word needs to be + /// written to the data stream in correct endian format and correct size. + inline void emitWord(uint64_t W) { + if (!Is64Bit) + emitWord32(W); + else + emitWord64(W); + } + + /// emitWord32 - This callback is invoked when a 32-bit word needs to be + /// written to the data stream in correct endian format. + inline void emitWord32(uint32_t W) { + if (IsLittleEndian) + emitWordLE(W); + else + emitWordBE(W); + } + + /// emitWord64 - This callback is invoked when a 32-bit word needs to be + /// written to the data stream in correct endian format. + inline void emitWord64(uint64_t W) { + if (IsLittleEndian) + emitDWordLE(W); + else + emitDWordBE(W); + } + + /// emitWordLE - This callback is invoked when a 32-bit word needs to be + /// written to the data stream in little-endian format. + inline void emitWordLE(uint32_t W) { + Data.push_back((W >> 0) & 255); + Data.push_back((W >> 8) & 255); + Data.push_back((W >> 16) & 255); + Data.push_back((W >> 24) & 255); + } + + /// emitWordBE - This callback is invoked when a 32-bit word needs to be + /// written to the data stream in big-endian format. + /// + inline void emitWordBE(uint32_t W) { + Data.push_back((W >> 24) & 255); + Data.push_back((W >> 16) & 255); + Data.push_back((W >> 8) & 255); + Data.push_back((W >> 0) & 255); + } + + /// emitDWordLE - This callback is invoked when a 64-bit word needs to be + /// written to the data stream in little-endian format. + inline void emitDWordLE(uint64_t W) { + Data.push_back(unsigned(W >> 0) & 255); + Data.push_back(unsigned(W >> 8) & 255); + Data.push_back(unsigned(W >> 16) & 255); + Data.push_back(unsigned(W >> 24) & 255); + Data.push_back(unsigned(W >> 32) & 255); + Data.push_back(unsigned(W >> 40) & 255); + Data.push_back(unsigned(W >> 48) & 255); + Data.push_back(unsigned(W >> 56) & 255); + } + + /// emitDWordBE - This callback is invoked when a 64-bit word needs to be + /// written to the data stream in big-endian format. + inline void emitDWordBE(uint64_t W) { + Data.push_back(unsigned(W >> 56) & 255); + Data.push_back(unsigned(W >> 48) & 255); + Data.push_back(unsigned(W >> 40) & 255); + Data.push_back(unsigned(W >> 32) & 255); + Data.push_back(unsigned(W >> 24) & 255); + Data.push_back(unsigned(W >> 16) & 255); + Data.push_back(unsigned(W >> 8) & 255); + Data.push_back(unsigned(W >> 0) & 255); + } + + /// fixByte - This callback is invoked when a byte needs to be + /// fixup the buffer. + inline void fixByte(uint8_t B, uint32_t offset) { + Data[offset] = B; + } + + /// fixWord16 - This callback is invoked when a 16-bit word needs to + /// fixup the data stream in correct endian format. + inline void fixWord16(uint16_t W, uint32_t offset) { + if (IsLittleEndian) + fixWord16LE(W, offset); + else + fixWord16BE(W, offset); + } + + /// emitWord16LE - This callback is invoked when a 16-bit word needs to + /// fixup the data stream in little endian format. + inline void fixWord16LE(uint16_t W, uint32_t offset) { + Data[offset++] = W & 255; + Data[offset] = (W >> 8) & 255; + } + + /// fixWord16BE - This callback is invoked when a 16-bit word needs to + /// fixup data stream in big endian format. + inline void fixWord16BE(uint16_t W, uint32_t offset) { + Data[offset++] = (W >> 8) & 255; + Data[offset] = W & 255; + } + + /// emitWord - This callback is invoked when a word needs to + /// fixup the data in correct endian format and correct size. + inline void fixWord(uint64_t W, uint32_t offset) { + if (!Is64Bit) + fixWord32(W, offset); + else + fixWord64(W, offset); + } + + /// fixWord32 - This callback is invoked when a 32-bit word needs to + /// fixup the data in correct endian format. + inline void fixWord32(uint32_t W, uint32_t offset) { + if (IsLittleEndian) + fixWord32LE(W, offset); + else + fixWord32BE(W, offset); + } + + /// fixWord32LE - This callback is invoked when a 32-bit word needs to + /// fixup the data in little endian format. + inline void fixWord32LE(uint32_t W, uint32_t offset) { + Data[offset++] = W & 255; + Data[offset++] = (W >> 8) & 255; + Data[offset++] = (W >> 16) & 255; + Data[offset] = (W >> 24) & 255; + } + + /// fixWord32BE - This callback is invoked when a 32-bit word needs to + /// fixup the data in big endian format. + inline void fixWord32BE(uint32_t W, uint32_t offset) { + Data[offset++] = (W >> 24) & 255; + Data[offset++] = (W >> 16) & 255; + Data[offset++] = (W >> 8) & 255; + Data[offset] = W & 255; + } + + /// fixWord64 - This callback is invoked when a 64-bit word needs to + /// fixup the data in correct endian format. + inline void fixWord64(uint64_t W, uint32_t offset) { + if (IsLittleEndian) + fixWord64LE(W, offset); + else + fixWord64BE(W, offset); + } + + /// fixWord64BE - This callback is invoked when a 64-bit word needs to + /// fixup the data in little endian format. + inline void fixWord64LE(uint64_t W, uint32_t offset) { + Data[offset++] = W & 255; + Data[offset++] = (W >> 8) & 255; + Data[offset++] = (W >> 16) & 255; + Data[offset++] = (W >> 24) & 255; + Data[offset++] = (W >> 32) & 255; + Data[offset++] = (W >> 40) & 255; + Data[offset++] = (W >> 48) & 255; + Data[offset] = (W >> 56) & 255; + } + + /// fixWord64BE - This callback is invoked when a 64-bit word needs to + /// fixup the data in big endian format. + inline void fixWord64BE(uint64_t W, uint32_t offset) { + Data[offset++] = (W >> 56) & 255; + Data[offset++] = (W >> 48) & 255; + Data[offset++] = (W >> 40) & 255; + Data[offset++] = (W >> 32) & 255; + Data[offset++] = (W >> 24) & 255; + Data[offset++] = (W >> 16) & 255; + Data[offset++] = (W >> 8) & 255; + Data[offset] = W & 255; + } + + /// emitAlignment - Pad the data to the specified alignment. + void emitAlignment(unsigned Alignment) { + if (Alignment <= 1) return; + unsigned PadSize = -Data.size() & (Alignment-1); + for (unsigned i = 0; i>= 7; + if (Value) Byte |= 0x80; + emitByte(Byte); + } while (Value); + } + + /// emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be + /// written to the data stream. + void emitSLEB128Bytes(int64_t Value) { + int Sign = Value >> (8 * sizeof(Value) - 1); + bool IsMore; + + do { + unsigned char Byte = Value & 0x7f; + Value >>= 7; + IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0; + if (IsMore) Byte |= 0x80; + emitByte(Byte); + } while (IsMore); + } + + /// emitString - This callback is invoked when a String needs to be + /// written to the data stream. + void emitString(const std::string &String) { + for (unsigned i = 0, N = static_cast(String.size()); i namespace llvm { + class BinaryObject; // Identification Indexes enum { @@ -47,62 +48,17 @@ ET_HIPROC = 0xffff // Processor-specific }; - // Object file classes. - enum { - ELFCLASS32 = 1, // 32-bit object file - ELFCLASS64 = 2 // 64-bit object file - }; - - // Object file byte orderings. - enum { - ELFDATA2LSB = 1, // Little-endian object file - ELFDATA2MSB = 2 // Big-endian object file - }; - // Versioning enum { EV_NONE = 0, EV_CURRENT = 1 }; - struct ELFHeader { - // e_machine - This field is the target specific value to emit as the - // e_machine member of the ELF header. - unsigned short e_machine; - - // e_flags - The machine flags for the target. This defaults to zero. - unsigned e_flags; - - // e_size - Holds the ELF header's size in bytes - unsigned e_ehsize; - - // Endianess and ELF Class (64 or 32 bits) - unsigned ByteOrder; - unsigned ElfClass; - - unsigned getByteOrder() const { return ByteOrder; } - unsigned getElfClass() const { return ElfClass; } - unsigned getSize() const { return e_ehsize; } - unsigned getMachine() const { return e_machine; } - unsigned getFlags() const { return e_flags; } - - ELFHeader(unsigned short machine, unsigned flags, - bool is64Bit, bool isLittleEndian) - : e_machine(machine), e_flags(flags) { - ElfClass = is64Bit ? ELFCLASS64 : ELFCLASS32; - ByteOrder = isLittleEndian ? ELFDATA2LSB : ELFDATA2MSB; - e_ehsize = is64Bit ? 64 : 52; - } - }; - /// ELFSection - This struct contains information about each section that is /// emitted to the file. This is eventually turned into the section header /// table at the end of the file. - struct ELFSection { - - // Name of the section - std::string Name; - + class ELFSection : public BinaryObject { + public: // ELF specific fields unsigned NameIdx; // sh_name - .shstrtab idx of name, once emitted. unsigned Type; // sh_type - Section contents & semantics @@ -143,8 +99,8 @@ SHT_REL = 9, // Relocation entries; no explicit addends. SHT_SHLIB = 10, // Reserved. SHT_DYNSYM = 11, // Symbol table. - SHT_LOPROC = 0x70000000, // Lowest processor architecture-specific type. - SHT_HIPROC = 0x7fffffff, // Highest processor architecture-specific type. + SHT_LOPROC = 0x70000000, // Lowest processor arch-specific type. + SHT_HIPROC = 0x7fffffff, // Highest processor arch-specific type. SHT_LOUSER = 0x80000000, // Lowest type reserved for applications. SHT_HIUSER = 0xffffffff // Highest type reserved for applications. }; @@ -163,22 +119,9 @@ /// SectionIdx - The number of the section in the Section Table. unsigned short SectionIdx; - /// SectionData - The actual data for this section which we are building - /// up for emission to the file. - std::vector SectionData; - - /// Relocations - The relocations that we have encountered so far in this - /// section that we will need to convert to Elf relocation entries when - /// the file is written. - std::vector Relocations; - - /// Section Header Size - static unsigned getSectionHdrSize(bool is64Bit) - { return is64Bit ? 64 : 40; } - - ELFSection(const std::string &name) - : Name(name), Type(0), Flags(0), Addr(0), Offset(0), Size(0), - Link(0), Info(0), Align(0), EntSize(0) {} + ELFSection(const std::string &name, bool isLittleEndian, bool is64Bit) + : BinaryObject(name, isLittleEndian, is64Bit), Type(0), Flags(0), Addr(0), + Offset(0), Size(0), Link(0), Info(0), Align(0), EntSize(0) {} }; /// ELFSym - This struct contains information about each symbol that is @@ -245,9 +188,6 @@ assert(X == (X & 0xF) && "Type value out of range!"); Info = (Info & 0xF0) | X; } - - static unsigned getEntrySize(bool is64Bit) - { return is64Bit ? 24 : 16; } }; } // end namespace llvm Modified: llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp?rev=73333&r1=73332&r2=73333&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFCodeEmitter.cpp Sun Jun 14 02:53:21 2009 @@ -13,6 +13,7 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" +#include "llvm/CodeGen/BinaryObject.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/Target/TargetMachine.h" @@ -33,9 +34,10 @@ DOUT << "processing function: " << MF.getFunction()->getName() << "\n"; // FIXME: better memory management, this will be replaced by BinaryObjects - ES->SectionData.reserve(4096); - BufferBegin = &ES->SectionData[0]; - BufferEnd = BufferBegin + ES->SectionData.capacity(); + BinaryData &BD = ES->getData(); + BD.reserve(4096); + BufferBegin = &BD[0]; + BufferEnd = BufferBegin + BD.capacity(); // Align the output buffer with function alignment, and // upgrade the section alignment if required @@ -100,7 +102,7 @@ FnSym.Value = FnStartPtr-BufferBegin; // Finally, add it to the symtab. - EW.SymbolTable.push_back(FnSym); + EW.SymbolList.push_back(FnSym); // Relocations // ----------- @@ -121,7 +123,7 @@ } else { assert(0 && "Unhandled relocation type"); } - ES->Relocations.push_back(MR); + ES->addRelocation(MR); } Relocations.clear(); Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=73333&r1=73332&r2=73333&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Sun Jun 14 02:53:21 2009 @@ -37,6 +37,7 @@ #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/DerivedTypes.h" +#include "llvm/CodeGen/BinaryObject.h" #include "llvm/CodeGen/FileWriters.h" #include "llvm/CodeGen/MachineCodeEmitter.h" #include "llvm/CodeGen/MachineConstantPool.h" @@ -66,22 +67,23 @@ //===----------------------------------------------------------------------===// ELFWriter::ELFWriter(raw_ostream &o, TargetMachine &tm) - : MachineFunctionPass(&ID), O(o), TM(tm), ElfHdr() { - is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64; - isLittleEndian = TM.getTargetData()->isLittleEndian(); + : MachineFunctionPass(&ID), O(o), TM(tm), + is64Bit(TM.getTargetData()->getPointerSizeInBits() == 64), + isLittleEndian(TM.getTargetData()->isLittleEndian()), + ElfHdr(isLittleEndian, is64Bit) { - ElfHdr = new ELFHeader(TM.getELFWriterInfo()->getEMachine(), 0, - is64Bit, isLittleEndian); TAI = TM.getTargetAsmInfo(); + TEW = TM.getELFWriterInfo(); // Create the machine code emitter object for this target. MCE = new ELFCodeEmitter(*this); + + // Inital number of sections NumSections = 0; } ELFWriter::~ELFWriter() { delete MCE; - delete ElfHdr; } // doInitialization - Emit the file header and all of the global variables for @@ -89,10 +91,6 @@ bool ELFWriter::doInitialization(Module &M) { Mang = new Mangler(M); - // Local alias to shortenify coming code. - std::vector &FH = FileHeader; - OutputBuffer FHOut(FH, is64Bit, isLittleEndian); - // ELF Header // ---------- // Fields e_shnum e_shstrndx are only known after all section have @@ -101,49 +99,48 @@ // // Note // ---- - // FHOut.outaddr method behaves differently for ELF32 and ELF64 writing + // emitWord method behaves differently for ELF32 and ELF64, writing // 4 bytes in the former and 8 in the last for *_off and *_addr elf types - FHOut.outbyte(0x7f); // e_ident[EI_MAG0] - FHOut.outbyte('E'); // e_ident[EI_MAG1] - FHOut.outbyte('L'); // e_ident[EI_MAG2] - FHOut.outbyte('F'); // e_ident[EI_MAG3] - - FHOut.outbyte(ElfHdr->getElfClass()); // e_ident[EI_CLASS] - FHOut.outbyte(ElfHdr->getByteOrder()); // e_ident[EI_DATA] - FHOut.outbyte(EV_CURRENT); // e_ident[EI_VERSION] - - FH.resize(16); // e_ident[EI_NIDENT-EI_PAD] - - FHOut.outhalf(ET_REL); // e_type - FHOut.outhalf(ElfHdr->getMachine()); // e_machine = target - FHOut.outword(EV_CURRENT); // e_version - FHOut.outaddr(0); // e_entry = 0, no entry point in .o file - FHOut.outaddr(0); // e_phoff = 0, no program header for .o - ELFHdr_e_shoff_Offset = FH.size(); - FHOut.outaddr(0); // e_shoff = sec hdr table off in bytes - FHOut.outword(ElfHdr->getFlags()); // e_flags = whatever the target wants - FHOut.outhalf(ElfHdr->getSize()); // e_ehsize = ELF header size - FHOut.outhalf(0); // e_phentsize = prog header entry size - FHOut.outhalf(0); // e_phnum = # prog header entries = 0 + ElfHdr.emitByte(0x7f); // e_ident[EI_MAG0] + ElfHdr.emitByte('E'); // e_ident[EI_MAG1] + ElfHdr.emitByte('L'); // e_ident[EI_MAG2] + ElfHdr.emitByte('F'); // e_ident[EI_MAG3] + + ElfHdr.emitByte(TEW->getEIClass()); // e_ident[EI_CLASS] + ElfHdr.emitByte(TEW->getEIData()); // e_ident[EI_DATA] + ElfHdr.emitByte(EV_CURRENT); // e_ident[EI_VERSION] + ElfHdr.emitAlignment(16); // e_ident[EI_NIDENT-EI_PAD] + + ElfHdr.emitWord16(ET_REL); // e_type + ElfHdr.emitWord16(TEW->getEMachine()); // e_machine = target + ElfHdr.emitWord32(EV_CURRENT); // e_version + ElfHdr.emitWord(0); // e_entry, no entry point in .o file + ElfHdr.emitWord(0); // e_phoff, no program header for .o + ELFHdr_e_shoff_Offset = ElfHdr.size(); + ElfHdr.emitWord(0); // e_shoff = sec hdr table off in bytes + ElfHdr.emitWord32(TEW->getEFlags()); // e_flags = whatever the target wants + ElfHdr.emitWord16(TEW->getHdrSize()); // e_ehsize = ELF header size + ElfHdr.emitWord16(0); // e_phentsize = prog header entry size + ElfHdr.emitWord16(0); // e_phnum = # prog header entries = 0 // e_shentsize = Section header entry size - FHOut.outhalf(ELFSection::getSectionHdrSize(is64Bit)); + ElfHdr.emitWord16(TEW->getSHdrSize()); // e_shnum = # of section header ents - ELFHdr_e_shnum_Offset = FH.size(); - FHOut.outhalf(0); + ELFHdr_e_shnum_Offset = ElfHdr.size(); + ElfHdr.emitWord16(0); // Placeholder // e_shstrndx = Section # of '.shstrtab' - ELFHdr_e_shstrndx_Offset = FH.size(); - FHOut.outhalf(0); + ELFHdr_e_shstrndx_Offset = ElfHdr.size(); + ElfHdr.emitWord16(0); // Placeholder // Add the null section, which is required to be first in the file. getSection("", ELFSection::SHT_NULL, 0); - // Start up the symbol table. The first entry in the symtab is the null + // Start up the symbol table. The first entry in the symtab is the null // entry. - SymbolTable.push_back(ELFSym(0)); + SymbolList.push_back(ELFSym(0)); return false; } @@ -162,7 +159,7 @@ ExternalSym.SetBind(ELFSym::STB_GLOBAL); ExternalSym.SetType(ELFSym::STT_NOTYPE); ExternalSym.SectionIdx = ELFSection::SHN_UNDEF; - SymbolTable.push_back(ExternalSym); + SymbolList.push_back(ExternalSym); return; } @@ -185,7 +182,7 @@ CommonSym.SetBind(ELFSym::STB_GLOBAL); CommonSym.SetType(ELFSym::STT_OBJECT); CommonSym.SectionIdx = ELFSection::SHN_COMMON; - SymbolTable.push_back(CommonSym); + SymbolList.push_back(CommonSym); getSection(S->getName(), ELFSection::SHT_NOBITS, ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC, 1); return; @@ -222,7 +219,7 @@ // Set the idx of the .bss section BSSSym.SectionIdx = BSSSection.SectionIdx; if (!GV->hasPrivateLinkage()) - SymbolTable.push_back(BSSSym); + SymbolList.push_back(BSSSym); // Reserve space in the .bss section for this symbol. BSSSection.Size += Size; @@ -262,21 +259,18 @@ if (Align > ElfS.Align) ElfS.Align = Align; - DataBuffer &GblCstBuf = ElfS.SectionData; - OutputBuffer GblCstTab(GblCstBuf, is64Bit, isLittleEndian); - // S.Value should contain the symbol index inside the section, // and all symbols should start on their required alignment boundary - GblSym.Value = (GblCstBuf.size() + (Align-1)) & (-Align); - GblCstBuf.insert(GblCstBuf.end(), GblSym.Value-GblCstBuf.size(), 0); + GblSym.Value = (ElfS.size() + (Align-1)) & (-Align); + ElfS.emitAlignment(Align); // Emit the constant symbol to its section - EmitGlobalConstant(CV, GblCstTab); - SymbolTable.push_back(GblSym); + EmitGlobalConstant(CV, ElfS); + SymbolList.push_back(GblSym); } void ELFWriter::EmitGlobalConstantStruct(const ConstantStruct *CVS, - OutputBuffer &GblCstTab) { + ELFSection &GblS) { // Print the fields in successive locations. Pad to align if needed! const TargetData *TD = TM.getTargetData(); @@ -293,40 +287,40 @@ sizeSoFar += fieldSize + padSize; // Now print the actual field value. - EmitGlobalConstant(field, GblCstTab); + EmitGlobalConstant(field, GblS); // Insert padding - this may include padding to increase the size of the // current field up to the ABI size (if the struct is not packed) as well // as padding to ensure that the next field starts at the right offset. for (unsigned p=0; p < padSize; p++) - GblCstTab.outbyte(0); + GblS.emitByte(0); } assert(sizeSoFar == cvsLayout->getSizeInBytes() && "Layout of constant struct may be incorrect!"); } -void ELFWriter::EmitGlobalConstant(const Constant *CV, OutputBuffer &GblCstTab) { +void ELFWriter::EmitGlobalConstant(const Constant *CV, ELFSection &GblS) { const TargetData *TD = TM.getTargetData(); unsigned Size = TD->getTypeAllocSize(CV->getType()); if (const ConstantArray *CVA = dyn_cast(CV)) { if (CVA->isString()) { std::string GblStr = CVA->getAsString(); - GblCstTab.outstring(GblStr, GblStr.length()); + GblS.emitString(GblStr); } else { // Not a string. Print the values in successive locations for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i) - EmitGlobalConstant(CVA->getOperand(i), GblCstTab); + EmitGlobalConstant(CVA->getOperand(i), GblS); } return; } else if (const ConstantStruct *CVS = dyn_cast(CV)) { - EmitGlobalConstantStruct(CVS, GblCstTab); + EmitGlobalConstantStruct(CVS, GblS); return; } else if (const ConstantFP *CFP = dyn_cast(CV)) { uint64_t Val = CFP->getValueAPF().bitcastToAPInt().getZExtValue(); if (CFP->getType() == Type::DoubleTy) - GblCstTab.outxword(Val); + GblS.emitWord64(Val); else if (CFP->getType() == Type::FloatTy) - GblCstTab.outword(Val); + GblS.emitWord32(Val); else if (CFP->getType() == Type::X86_FP80Ty) { assert(0 && "X86_FP80Ty global emission not implemented"); } else if (CFP->getType() == Type::PPC_FP128Ty) @@ -334,16 +328,16 @@ return; } else if (const ConstantInt *CI = dyn_cast(CV)) { if (Size == 4) - GblCstTab.outword(CI->getZExtValue()); + GblS.emitWord32(CI->getZExtValue()); else if (Size == 8) - GblCstTab.outxword(CI->getZExtValue()); + GblS.emitWord64(CI->getZExtValue()); else assert(0 && "LargeInt global emission not implemented"); return; } else if (const ConstantVector *CP = dyn_cast(CV)) { const VectorType *PTy = CP->getType(); for (unsigned I = 0, E = PTy->getNumElements(); I < E; ++I) - EmitGlobalConstant(CP->getOperand(I), GblCstTab); + EmitGlobalConstant(CP->getOperand(I), GblS); return; } assert(0 && "unknown global constant"); @@ -358,26 +352,30 @@ /// doFinalization - Now that the module has been completely processed, emit /// the ELF file to 'O'. bool ELFWriter::doFinalization(Module &M) { - /// FIXME: This should be removed when moving to BinaryObjects. Since the - /// current ELFCodeEmiter uses CurrBuff, ... it doesn't update S.SectionData + /// FIXME: This should be removed when moving to ObjectCodeEmiter. Since the + /// current ELFCodeEmiter uses CurrBuff, ... it doesn't update S.Data /// vector size for .text sections, so this is a quick dirty fix ELFSection &TS = getTextSection(); - if (TS.Size) + if (TS.Size) { + BinaryData &BD = TS.getData(); for (unsigned e=0; egetNonexecutableStackDirective()) - getSection(".note.GNU-stack", ELFSection::SHT_PROGBITS, 0, 1); + getNonExecStackSection(); // Emit the symbol table now, if non-empty. EmitSymbolTable(); @@ -385,10 +383,10 @@ // Emit the relocation sections. EmitRelocations(); - // Emit the string table for the sections in the ELF file. + // Emit the sections string table. EmitSectionTableStringTable(); - // Emit the sections to the .o file, and emit the section table for the file. + // Dump the sections and section table to the .o file. OutputSectionsAndSectionTable(); // We are done with the abstract symbols. @@ -404,106 +402,97 @@ void ELFWriter::EmitRelocations() { } -/// EmitSymbol - Write symbol 'Sym' to the symbol table 'SymTabOut' -void ELFWriter::EmitSymbol(OutputBuffer &SymTabOut, ELFSym &Sym) { +/// EmitSymbol - Write symbol 'Sym' to the symbol table 'SymbolTable' +void ELFWriter::EmitSymbol(BinaryObject &SymbolTable, ELFSym &Sym) { if (is64Bit) { - SymTabOut.outword(Sym.NameIdx); - SymTabOut.outbyte(Sym.Info); - SymTabOut.outbyte(Sym.Other); - SymTabOut.outhalf(Sym.SectionIdx); - SymTabOut.outaddr64(Sym.Value); - SymTabOut.outxword(Sym.Size); + SymbolTable.emitWord32(Sym.NameIdx); + SymbolTable.emitByte(Sym.Info); + SymbolTable.emitByte(Sym.Other); + SymbolTable.emitWord16(Sym.SectionIdx); + SymbolTable.emitWord64(Sym.Value); + SymbolTable.emitWord64(Sym.Size); } else { - SymTabOut.outword(Sym.NameIdx); - SymTabOut.outaddr32(Sym.Value); - SymTabOut.outword(Sym.Size); - SymTabOut.outbyte(Sym.Info); - SymTabOut.outbyte(Sym.Other); - SymTabOut.outhalf(Sym.SectionIdx); + SymbolTable.emitWord32(Sym.NameIdx); + SymbolTable.emitWord32(Sym.Value); + SymbolTable.emitWord32(Sym.Size); + SymbolTable.emitByte(Sym.Info); + SymbolTable.emitByte(Sym.Other); + SymbolTable.emitWord16(Sym.SectionIdx); } } -/// EmitSectionHeader - Write section 'Section' header in 'TableOut' +/// EmitSectionHeader - Write section 'Section' header in 'SHdrTab' /// Section Header Table -void ELFWriter::EmitSectionHeader(OutputBuffer &TableOut, const ELFSection &S) { - TableOut.outword(S.NameIdx); - TableOut.outword(S.Type); +void ELFWriter::EmitSectionHeader(BinaryObject &SHdrTab, + const ELFSection &SHdr) { + SHdrTab.emitWord32(SHdr.NameIdx); + SHdrTab.emitWord32(SHdr.Type); if (is64Bit) { - TableOut.outxword(S.Flags); - TableOut.outaddr(S.Addr); - TableOut.outaddr(S.Offset); - TableOut.outxword(S.Size); - TableOut.outword(S.Link); - TableOut.outword(S.Info); - TableOut.outxword(S.Align); - TableOut.outxword(S.EntSize); + SHdrTab.emitWord64(SHdr.Flags); + SHdrTab.emitWord(SHdr.Addr); + SHdrTab.emitWord(SHdr.Offset); + SHdrTab.emitWord64(SHdr.Size); + SHdrTab.emitWord32(SHdr.Link); + SHdrTab.emitWord32(SHdr.Info); + SHdrTab.emitWord64(SHdr.Align); + SHdrTab.emitWord64(SHdr.EntSize); } else { - TableOut.outword(S.Flags); - TableOut.outaddr(S.Addr); - TableOut.outaddr(S.Offset); - TableOut.outword(S.Size); - TableOut.outword(S.Link); - TableOut.outword(S.Info); - TableOut.outword(S.Align); - TableOut.outword(S.EntSize); + SHdrTab.emitWord32(SHdr.Flags); + SHdrTab.emitWord(SHdr.Addr); + SHdrTab.emitWord(SHdr.Offset); + SHdrTab.emitWord32(SHdr.Size); + SHdrTab.emitWord32(SHdr.Link); + SHdrTab.emitWord32(SHdr.Info); + SHdrTab.emitWord32(SHdr.Align); + SHdrTab.emitWord32(SHdr.EntSize); } } /// EmitSymbolTable - If the current symbol table is non-empty, emit the string /// table for it and then the symbol table itself. void ELFWriter::EmitSymbolTable() { - if (SymbolTable.size() == 1) return; // Only the null entry. + if (SymbolList.size() == 1) return; // Only the null entry. // FIXME: compact all local symbols to the start of the symtab. unsigned FirstNonLocalSymbol = 1; ELFSection &StrTab = getStringTableSection(); - DataBuffer &StrTabBuf = StrTab.SectionData; - OutputBuffer StrTabOut(StrTabBuf, is64Bit, isLittleEndian); // Set the zero'th symbol to a null byte, as required. - StrTabOut.outbyte(0); + StrTab.emitByte(0); unsigned Index = 1; - for (unsigned i = 1, e = SymbolTable.size(); i != e; ++i) { + for (unsigned i = 1, e = SymbolList.size(); i != e; ++i) { // Use the name mangler to uniquify the LLVM symbol. - std::string Name = Mang->getValueName(SymbolTable[i].GV); + std::string Name = Mang->getValueName(SymbolList[i].GV); if (Name.empty()) { - SymbolTable[i].NameIdx = 0; + SymbolList[i].NameIdx = 0; } else { - SymbolTable[i].NameIdx = Index; - - // Add the name to the output buffer, including the null terminator. - StrTabBuf.insert(StrTabBuf.end(), Name.begin(), Name.end()); - - // Add a null terminator. - StrTabBuf.push_back(0); + SymbolList[i].NameIdx = Index; + StrTab.emitString(Name); // Keep track of the number of bytes emitted to this section. Index += Name.size()+1; } } - assert(Index == StrTabBuf.size()); + assert(Index == StrTab.size()); StrTab.Size = Index; // Now that we have emitted the string table and know the offset into the // string table of each symbol, emit the symbol table itself. ELFSection &SymTab = getSymbolTableSection(); - SymTab.Align = is64Bit ? 8 : 4; - SymTab.Link = StrTab.SectionIdx; // Section Index of .strtab. - SymTab.Info = FirstNonLocalSymbol; // First non-STB_LOCAL symbol. + SymTab.Align = TEW->getSymTabAlignment(); + SymTab.Link = StrTab.SectionIdx; // Section Index of .strtab. + SymTab.Info = FirstNonLocalSymbol; // First non-STB_LOCAL symbol. // Size of each symtab entry. - SymTab.EntSize = ELFSym::getEntrySize(is64Bit); - - DataBuffer &SymTabBuf = SymTab.SectionData; - OutputBuffer SymTabOut(SymTabBuf, is64Bit, isLittleEndian); + SymTab.EntSize = TEW->getSymTabEntrySize(); - for (unsigned i = 0, e = SymbolTable.size(); i != e; ++i) - EmitSymbol(SymTabOut, SymbolTable[i]); + for (unsigned i = 0, e = SymbolList.size(); i != e; ++i) + EmitSymbol(SymTab, SymbolList[i]); - SymTab.Size = SymTabBuf.size(); + SymTab.Size = SymTab.size(); } /// EmitSectionTableStringTable - This method adds and emits a section for the @@ -515,32 +504,25 @@ // Now that we know which section number is the .shstrtab section, update the // e_shstrndx entry in the ELF header. - OutputBuffer FHOut(FileHeader, is64Bit, isLittleEndian); - FHOut.fixhalf(SHStrTab.SectionIdx, ELFHdr_e_shstrndx_Offset); + ElfHdr.fixWord16(SHStrTab.SectionIdx, ELFHdr_e_shstrndx_Offset); // Set the NameIdx of each section in the string table and emit the bytes for // the string table. unsigned Index = 0; - DataBuffer &Buf = SHStrTab.SectionData; for (std::list::iterator I = SectionList.begin(), E = SectionList.end(); I != E; ++I) { // Set the index into the table. Note if we have lots of entries with // common suffixes, we could memoize them here if we cared. I->NameIdx = Index; - - // Add the name to the output buffer, including the null terminator. - Buf.insert(Buf.end(), I->Name.begin(), I->Name.end()); - - // Add a null terminator. - Buf.push_back(0); + SHStrTab.emitString(I->getName()); // Keep track of the number of bytes emitted to this section. - Index += I->Name.size()+1; + Index += I->getName().size()+1; } // Set the size of .shstrtab now that we know what it is. - assert(Index == Buf.size()); + assert(Index == SHStrTab.size()); SHStrTab.Size = Index; } @@ -549,7 +531,7 @@ /// SectionTable. void ELFWriter::OutputSectionsAndSectionTable() { // Pass #1: Compute the file offset for each section. - size_t FileOff = FileHeader.size(); // File header first. + size_t FileOff = ElfHdr.size(); // File header first. // Adjust alignment of all section if needed. for (std::list::iterator I = SectionList.begin(), @@ -559,14 +541,14 @@ if (!I->SectionIdx) continue; - if (!I->SectionData.size()) { + if (!I->size()) { I->Offset = FileOff; continue; } // Update Section size if (!I->Size) - I->Size = I->SectionData.size(); + I->Size = I->size(); // Align FileOff to whatever the alignment restrictions of the section are. if (I->Align) @@ -582,43 +564,40 @@ // Now that we know where all of the sections will be emitted, set the e_shnum // entry in the ELF header. - OutputBuffer FHOut(FileHeader, is64Bit, isLittleEndian); - FHOut.fixhalf(NumSections, ELFHdr_e_shnum_Offset); + ElfHdr.fixWord16(NumSections, ELFHdr_e_shnum_Offset); // Now that we know the offset in the file of the section table, update the // e_shoff address in the ELF header. - FHOut.fixaddr(FileOff, ELFHdr_e_shoff_Offset); + ElfHdr.fixWord(FileOff, ELFHdr_e_shoff_Offset); // Now that we know all of the data in the file header, emit it and all of the // sections! - O.write((char*)&FileHeader[0], FileHeader.size()); - FileOff = FileHeader.size(); - DataBuffer().swap(FileHeader); + O.write((char *)&ElfHdr.getData()[0], ElfHdr.size()); + FileOff = ElfHdr.size(); - DataBuffer Table; - OutputBuffer TableOut(Table, is64Bit, isLittleEndian); + // Section Header Table blob + BinaryObject SHdrTable(isLittleEndian, is64Bit); - // Emit all of the section data and build the section table itself. + // Emit all of sections to the file and build the section header table. while (!SectionList.empty()) { - const ELFSection &S = *SectionList.begin(); - DOUT << "SectionIdx: " << S.SectionIdx << ", Name: " << S.Name + ELFSection &S = *SectionList.begin(); + DOUT << "SectionIdx: " << S.SectionIdx << ", Name: " << S.getName() << ", Size: " << S.Size << ", Offset: " << S.Offset - << ", SectionData Size: " << S.SectionData.size() << "\n"; - + << ", SectionData Size: " << S.size() << "\n"; // Align FileOff to whatever the alignment restrictions of the section are. if (S.Align) { for (size_t NewFileOff = (FileOff+S.Align-1) & ~(S.Align-1); - FileOff != NewFileOff; ++FileOff) + FileOff != NewFileOff; ++FileOff) O << (char)0xAB; } - if (S.SectionData.size()) { - O.write((char*)&S.SectionData[0], S.Size); + if (S.size()) { + O.write((char *)&S.getData()[0], S.Size); FileOff += S.Size; } - EmitSectionHeader(TableOut, S); + EmitSectionHeader(SHdrTable, S); SectionList.pop_front(); } @@ -628,5 +607,5 @@ O << (char)0xAB; // Emit the section table itself. - O.write((char*)&Table[0], Table.size()); + O.write((char *)&SHdrTable.getData()[0], SHdrTable.size()); } Modified: llvm/trunk/lib/CodeGen/ELFWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.h?rev=73333&r1=73332&r2=73333&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.h (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.h Sun Jun 14 02:53:21 2009 @@ -24,6 +24,7 @@ #include namespace llvm { + class BinaryObject; class ConstantStruct; class ELFCodeEmitter; class GlobalVariable; @@ -56,6 +57,9 @@ /// Target machine description. TargetMachine &TM; + /// Target Elf Writer description. + const TargetELFWriterInfo *TEW; + /// Mang - The object used to perform name mangling for this module. Mangler *Mang; @@ -85,13 +89,8 @@ bool doFinalization(Module &M); private: - // The buffer we accumulate the file header into. Note that this should be - // changed into something much more efficient later (and the bitcode writer - // as well!). - DataBuffer FileHeader; - - /// ElfHdr - Hold information about the ELF Header - ELFHeader *ElfHdr; + // Blob containing the Elf header + BinaryObject ElfHdr; /// SectionList - This is the list of sections that we have emitted to the /// file. Once the file has been completely built, the section header table @@ -110,7 +109,7 @@ ELFSection *&SN = SectionLookup[Name]; if (SN) return *SN; - SectionList.push_back(Name); + SectionList.push_back(ELFSection(Name, isLittleEndian, is64Bit)); SN = &SectionList.back(); SN->SectionIdx = NumSections++; SN->Type = Type; @@ -125,6 +124,10 @@ ELFSection::SHF_EXECINSTR | ELFSection::SHF_ALLOC); } + ELFSection &getNonExecStackSection() { + return getSection(".note.GNU-stack", ELFSection::SHT_PROGBITS, 0, 1); + } + ELFSection &getSymbolTableSection() { return getSection(".symtab", ELFSection::SHT_SYMTAB, 0); } @@ -143,14 +146,14 @@ ELFSection::SHF_WRITE | ELFSection::SHF_ALLOC); } - /// SymbolTable - This is the list of symbols we have emitted to the file. + /// SymbolList - This is the list of symbols we have emitted to the file. /// This actually gets rearranged before emission to the file (to put the /// local symbols first in the list). - std::vector SymbolTable; + std::vector SymbolList; - /// PendingSyms - This is a list of externally defined symbols that we have - /// been asked to emit, but have not seen a reference to. When a reference - /// is seen, the symbol will move from this list to the SymbolTable. + /// PendingGlobals - List of externally defined symbols that we have been + /// asked to emit, but have not seen a reference to. When a reference + /// is seen, the symbol will move from this list to the SymbolList. SetVector PendingGlobals; // As we complete the ELF file, we need to update fields in the ELF header @@ -160,15 +163,16 @@ unsigned ELFHdr_e_shoff_Offset; // e_shoff in ELF header. unsigned ELFHdr_e_shstrndx_Offset; // e_shstrndx in ELF header. unsigned ELFHdr_e_shnum_Offset; // e_shnum in ELF header. + private: void EmitGlobal(GlobalVariable *GV); - void EmitGlobalConstant(const Constant *C, OutputBuffer &GblCstTab); + void EmitGlobalConstant(const Constant *C, ELFSection &GblS); void EmitGlobalConstantStruct(const ConstantStruct *CVS, - OutputBuffer &GblCstTab); + ELFSection &GblS); void EmitRelocations(); - void EmitSectionHeader(OutputBuffer &TableOut, const ELFSection &Section); + void EmitSectionHeader(BinaryObject &SHdrTab, const ELFSection &SHdr); void EmitSectionTableStringTable(); - void EmitSymbol(OutputBuffer &SymTabOut, ELFSym &Sym); + void EmitSymbol(BinaryObject &SymbolTable, ELFSym &Sym); void EmitSymbolTable(); void OutputSectionsAndSectionTable(); }; Modified: llvm/trunk/lib/Target/TargetELFWriterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetELFWriterInfo.cpp?rev=73333&r1=73332&r2=73333&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetELFWriterInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetELFWriterInfo.cpp Sun Jun 14 02:53:21 2009 @@ -17,7 +17,10 @@ #include "llvm/Target/TargetMachine.h" using namespace llvm; -TargetELFWriterInfo::TargetELFWriterInfo(TargetMachine &tm) : TM(tm) {} +TargetELFWriterInfo::TargetELFWriterInfo(TargetMachine &tm) : TM(tm) { + is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64; + isLittleEndian = TM.getTargetData()->isLittleEndian(); +} TargetELFWriterInfo::~TargetELFWriterInfo() {} From isanbard at gmail.com Sun Jun 14 03:02:05 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 14 Jun 2009 08:02:05 -0000 Subject: [llvm-commits] [llvm] r73334 - /llvm/tags/Apple/llvmCore-2112/ Message-ID: <200906140802.n5E825uE025606@zion.cs.uiuc.edu> Author: void Date: Sun Jun 14 03:02:04 2009 New Revision: 73334 URL: http://llvm.org/viewvc/llvm-project?rev=73334&view=rev Log: Creating llvmCore-2112 branch Added: llvm/tags/Apple/llvmCore-2112/ - copied from r73333, llvm/branches/Apple/Bender/ From isanbard at gmail.com Sun Jun 14 03:02:13 2009 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 14 Jun 2009 08:02:13 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r73335 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2112/ Message-ID: <200906140802.n5E82DrI025620@zion.cs.uiuc.edu> Author: void Date: Sun Jun 14 03:02:13 2009 New Revision: 73335 URL: http://llvm.org/viewvc/llvm-project?rev=73335&view=rev Log: Creating llvmgcc42-2112 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2112/ - copied from r73334, llvm-gcc-4.2/branches/Apple/Bender/ From resistor at mac.com Sun Jun 14 03:26:46 2009 From: resistor at mac.com (Owen Anderson) Date: Sun, 14 Jun 2009 08:26:46 -0000 Subject: [llvm-commits] [llvm] r73338 - in /llvm/trunk: include/llvm/LinkAllPasses.h include/llvm/Transforms/IPO.h lib/Transforms/IPO/PartialInlining.cpp Message-ID: <200906140826.n5E8QnKY026439@zion.cs.uiuc.edu> Author: resistor Date: Sun Jun 14 03:26:32 2009 New Revision: 73338 URL: http://llvm.org/viewvc/llvm-project?rev=73338&view=rev Log: Add an early implementation of a partial inlining pass. The idea behind this is that, for functions whose bodies are entirely guarded by an if-statement, it can be profitable to pull the test out of the callee and into the caller. This code has had some cursory testing, but still has a number of known issues on the LLVM test suite. Added: llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp Modified: llvm/trunk/include/llvm/LinkAllPasses.h llvm/trunk/include/llvm/Transforms/IPO.h Modified: llvm/trunk/include/llvm/LinkAllPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=73338&r1=73337&r2=73338&view=diff ============================================================================== --- llvm/trunk/include/llvm/LinkAllPasses.h (original) +++ llvm/trunk/include/llvm/LinkAllPasses.h Sun Jun 14 03:26:32 2009 @@ -127,6 +127,7 @@ (void) llvm::createPrintModulePass(0); (void) llvm::createPrintFunctionPass("", 0); (void) llvm::createDbgInfoPrinterPass(); + (void) llvm::createPartialInliningPass(); (void)new llvm::IntervalPartition(); (void)new llvm::FindUsedTypes(); Modified: llvm/trunk/include/llvm/Transforms/IPO.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO.h?rev=73338&r1=73337&r2=73338&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/IPO.h (original) +++ llvm/trunk/include/llvm/Transforms/IPO.h Sun Jun 14 03:26:32 2009 @@ -214,6 +214,11 @@ /// ModulePass *createMergeFunctionsPass(); +//===----------------------------------------------------------------------===// +/// createPartialInliningPass - This pass inlines parts of functions. +/// +ModulePass *createPartialInliningPass(); + } // End llvm namespace #endif Added: llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp?rev=73338&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp (added) +++ llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp Sun Jun 14 03:26:32 2009 @@ -0,0 +1,171 @@ +//===- PartialInlining.cpp - Inline parts of functions --------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This pass performs partial inlining, typically by inlining an if statement +// that surrounds the body of the function. +// +//===----------------------------------------------------------------------===// + +#define DEBUG_TYPE "partialinlining" +#include "llvm/Transforms/IPO.h" +#include "llvm/Instructions.h" +#include "llvm/Module.h" +#include "llvm/Pass.h" +#include "llvm/Analysis/Dominators.h" +#include "llvm/Transforms/Utils/Cloning.h" +#include "llvm/Transforms/Utils/FunctionUtils.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/CFG.h" +using namespace llvm; + +namespace { + struct VISIBILITY_HIDDEN PartialInliner : public ModulePass { + virtual void getAnalysisUsage(AnalysisUsage &AU) const { } + static char ID; // Pass identification, replacement for typeid + PartialInliner() : ModulePass(&ID) {} + + bool runOnModule(Module& M); + + private: + Function* unswitchFunction(Function* F); + }; +} + +char PartialInliner::ID = 0; +static RegisterPass X("partial-inliner", "Partial Inliner"); + +ModulePass* llvm::createPartialInliningPass() { return new PartialInliner(); } + +Function* PartialInliner::unswitchFunction(Function* F) { + // First, verify that this function is an unswitching candidate... + BasicBlock* entryBlock = F->begin(); + if (!isa(entryBlock->getTerminator())) + return 0; + + BasicBlock* returnBlock = 0; + BasicBlock* nonReturnBlock = 0; + unsigned returnCount = 0; + for (succ_iterator SI = succ_begin(entryBlock), SE = succ_end(entryBlock); + SI != SE; ++SI) + if (isa((*SI)->getTerminator())) { + returnBlock = *SI; + returnCount++; + } else + nonReturnBlock = *SI; + + if (returnCount != 1) + return 0; + + // Clone the function, so that we can hack away on it. + DenseMap ValueMap; + Function* duplicateFunction = CloneFunction(F, ValueMap); + duplicateFunction->setLinkage(GlobalValue::InternalLinkage); + F->getParent()->getFunctionList().push_back(duplicateFunction); + BasicBlock* newEntryBlock = cast(ValueMap[entryBlock]); + BasicBlock* newReturnBlock = cast(ValueMap[returnBlock]); + BasicBlock* newNonReturnBlock = cast(ValueMap[nonReturnBlock]); + + // Go ahead and update all uses to the duplicate, so that we can just + // use the inliner functionality when we're done hacking. + F->replaceAllUsesWith(duplicateFunction); + + // Special hackery is needed with PHI nodes that have inputs from more than + // one extracted block. For simplicity, just split the PHIs into a two-level + // sequence of PHIs, some of which will go in the extracted region, and some + // of which will go outside. + BasicBlock* preReturn = newReturnBlock; + newReturnBlock = newReturnBlock->splitBasicBlock( + newReturnBlock->getFirstNonPHI()); + BasicBlock::iterator I = preReturn->begin(); + BasicBlock::iterator Ins = newReturnBlock->begin(); + while (I != preReturn->end()) { + PHINode* OldPhi = dyn_cast(I); + if (!OldPhi) break; + + PHINode* retPhi = PHINode::Create(OldPhi->getType(), "", Ins); + OldPhi->replaceAllUsesWith(retPhi); + Ins = newReturnBlock->getFirstNonPHI(); + + retPhi->addIncoming(I, preReturn); + retPhi->addIncoming(OldPhi->getIncomingValueForBlock(newEntryBlock), + newEntryBlock); + OldPhi->removeIncomingValue(newEntryBlock); + + ++I; + } + newEntryBlock->getTerminator()->replaceUsesOfWith(preReturn, newReturnBlock); + + // Gather up the blocks that we're going to extract. + std::vector toExtract; + toExtract.push_back(newNonReturnBlock); + for (Function::iterator FI = duplicateFunction->begin(), + FE = duplicateFunction->end(); FI != FE; ++FI) + if (&*FI != newEntryBlock && &*FI != newReturnBlock && + &*FI != newNonReturnBlock) + toExtract.push_back(FI); + + // The CodeExtractor needs a dominator tree. + DominatorTree DT; + DT.runOnFunction(*duplicateFunction); + + // Extract the body of the the if. + Function* extractedFunction = ExtractCodeRegion(DT, toExtract); + + // Inline the top-level if test into all callers. + std::vector Users(duplicateFunction->use_begin(), + duplicateFunction->use_end()); + for (std::vector::iterator UI = Users.begin(), UE = Users.end(); + UI != UE; ++UI) + if (CallInst* CI = dyn_cast(*UI)) + InlineFunction(CI); + else if (InvokeInst* II = dyn_cast(*UI)) + InlineFunction(II); + + // Ditch the duplicate, since we're done with it, and rewrite all remaining + // users (function pointers, etc.) back to the original function. + duplicateFunction->replaceAllUsesWith(F); + duplicateFunction->eraseFromParent(); + + return extractedFunction; +} + +bool PartialInliner::runOnModule(Module& M) { + std::vector worklist; + worklist.reserve(M.size()); + for (Module::iterator FI = M.begin(), FE = M.end(); FI != FE; ++FI) + if (!FI->use_empty() && !FI->isDeclaration()) + worklist.push_back(&*FI); + + bool changed = false; + while (!worklist.empty()) { + Function* currFunc = worklist.back(); + worklist.pop_back(); + + if (currFunc->use_empty()) continue; + + bool recursive = false; + for (Function::use_iterator UI = currFunc->use_begin(), + UE = currFunc->use_end(); UI != UE; ++UI) + if (Instruction* I = dyn_cast(UI)) + if (I->getParent()->getParent() == currFunc) { + recursive = true; + break; + } + if (recursive) continue; + + + if (Function* newFunc = unswitchFunction(currFunc)) { + worklist.push_back(newFunc); + changed = true; + } + + } + + return changed; +} \ No newline at end of file From benny.kra at googlemail.com Sun Jun 14 05:55:09 2009 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Sun, 14 Jun 2009 12:55:09 +0200 Subject: [llvm-commits] [PATCH] work around a nasty g++/glibc incompatiblity Message-ID: <4A34D70D.6050200@googlemail.com> T?r?k Edwin wrote: > The GNU version always returns a pointer to the error message, it may or > may not use the buffer supplied. > (I think it doesn't use the buffer if it can return a pointer to the > error message table). > Accessing the returned pointer is thread safe in either case, so you > could check if the returned value == buffer, and if not copy it to > buffer. It would still be thread safe. Here's a thread safe codepath for GNU's strerror_r. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: glibcstrerror_r.patch Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090614/6185a4a6/attachment.pl From edwintorok at gmail.com Sun Jun 14 08:39:57 2009 From: edwintorok at gmail.com (Torok Edwin) Date: Sun, 14 Jun 2009 13:39:57 -0000 Subject: [llvm-commits] [llvm] r73342 - /llvm/trunk/lib/Transforms/IPO/CMakeLists.txt Message-ID: <200906141339.n5EDdvYw028615@zion.cs.uiuc.edu> Author: edwin Date: Sun Jun 14 08:39:56 2009 New Revision: 73342 URL: http://llvm.org/viewvc/llvm-project?rev=73342&view=rev Log: Fix CMake build. Patch from Ingmar Vanhassel. Modified: llvm/trunk/lib/Transforms/IPO/CMakeLists.txt Modified: llvm/trunk/lib/Transforms/IPO/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/CMakeLists.txt?rev=73342&r1=73341&r2=73342&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/CMakeLists.txt (original) +++ llvm/trunk/lib/Transforms/IPO/CMakeLists.txt Sun Jun 14 08:39:56 2009 @@ -16,6 +16,7 @@ LoopExtractor.cpp LowerSetJmp.cpp MergeFunctions.cpp + PartialInlining.cpp PartialSpecialization.cpp PruneEH.cpp RaiseAllocations.cpp From evan.cheng at apple.com Sun Jun 14 15:22:55 2009 From: evan.cheng at apple.com (Evan Cheng) Date: Sun, 14 Jun 2009 20:22:55 -0000 Subject: [llvm-commits] [llvm] r73346 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h include/llvm/CodeGen/MachineRegisterInfo.h include/llvm/Target/TargetRegisterInfo.h lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/MachineRegisterInfo.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/RegAllocPBQP.cpp lib/CodeGen/SimpleRegisterCoalescing.cpp lib/CodeGen/VirtRegMap.cpp lib/CodeGen/VirtRegMap.h Message-ID: <200906142022.n5EKMuIi010036@zion.cs.uiuc.edu> Author: evancheng Date: Sun Jun 14 15:22:55 2009 New Revision: 73346 URL: http://llvm.org/viewvc/llvm-project?rev=73346&view=rev Log: Move register allocation preference (or hint) from LiveInterval to MachineRegisterInfo. This allows more passes to set them. Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h llvm/trunk/include/llvm/Target/TargetRegisterInfo.h llvm/trunk/lib/CodeGen/LiveInterval.cpp llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/lib/CodeGen/VirtRegMap.cpp llvm/trunk/lib/CodeGen/VirtRegMap.h Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=73346&r1=73345&r2=73346&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Sun Jun 14 15:22:55 2009 @@ -29,6 +29,7 @@ namespace llvm { class MachineInstr; + class MachineRegisterInfo; class TargetRegisterInfo; struct LiveInterval; @@ -108,7 +109,6 @@ unsigned reg; // the register or stack slot of this interval // if the top bits is set, it represents a stack slot. float weight; // weight of this interval - unsigned short preference; // preferred register for this interval Ranges ranges; // the ranges in which this register is live VNInfoList valnos; // value#'s @@ -134,7 +134,7 @@ }; LiveInterval(unsigned Reg, float Weight, bool IsSS = false) - : reg(Reg), weight(Weight), preference(0) { + : reg(Reg), weight(Weight) { if (IsSS) reg = reg | (1U << (sizeof(unsigned)*CHAR_BIT-1)); } @@ -339,7 +339,8 @@ /// Copy - Copy the specified live interval. This copies all the fields /// except for the register of the interval. - void Copy(const LiveInterval &RHS, BumpPtrAllocator &VNInfoAllocator); + void Copy(const LiveInterval &RHS, MachineRegisterInfo *MRI, + BumpPtrAllocator &VNInfoAllocator); bool empty() const { return ranges.empty(); } @@ -416,7 +417,8 @@ /// the intervals are not joinable, this aborts. void join(LiveInterval &Other, const int *ValNoAssignments, const int *RHSValNoAssignments, - SmallVector &NewVNInfo); + SmallVector &NewVNInfo, + MachineRegisterInfo *MRI); /// isInOneLiveRange - Return true if the range specified is entirely in the /// a single LiveRange of the live interval. Modified: llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h?rev=73346&r1=73345&r2=73346&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h Sun Jun 14 15:22:55 2009 @@ -25,6 +25,16 @@ /// registers, including vreg register classes, use/def chains for registers, /// etc. class MachineRegisterInfo { +public: + /// Register allocation hints. + enum RegAllocHintType { + RA_None, /// No preference + RA_Preference, /// Prefer a particular register + RA_PairEven, /// Even register of a register pair + RA_PairOdd /// Odd register of a register pair + }; + +private: /// VRegInfo - Information we keep for each virtual register. The entries in /// this vector are actually converted to vreg numbers by adding the /// TargetRegisterInfo::FirstVirtualRegister delta to their index. @@ -37,6 +47,14 @@ /// virtual registers. For each target register class, it keeps a list of /// virtual registers belonging to the class. std::vector > RegClass2VRegMap; + + /// RegAllocHints - This vector records register allocation hints for virtual + /// registers. For each virtual register, it keeps a register and type enum + /// pair making up the allocation hint. For example, if the hint type is + /// RA_Specified, it means the virtual register prefers the specified physical + /// register of the hint or the physical register allocated to the virtual + /// register of the hint. + std::vector > RegAllocHints; /// PhysRegUseDefLists - This is an array of the head of the use/def list for /// physical registers. @@ -170,7 +188,26 @@ std::vector &getRegClassVirtRegs(const TargetRegisterClass *RC) { return RegClass2VRegMap[RC->getID()]; } - + + /// setRegAllocationHint - Specify a register allocation hint for the + /// specified virtual register. + void setRegAllocationHint(unsigned Reg, + RegAllocHintType Type, unsigned PrefReg) { + Reg -= TargetRegisterInfo::FirstVirtualRegister; + assert(Reg < VRegInfo.size() && "Invalid vreg!"); + RegAllocHints[Reg].first = Type; + RegAllocHints[Reg].second = PrefReg; + } + + /// getRegAllocationHint - Return the register allocation hint for the + /// specified virtual register. + std::pair + getRegAllocationHint(unsigned Reg) const { + Reg -= TargetRegisterInfo::FirstVirtualRegister; + assert(Reg < VRegInfo.size() && "Invalid vreg!"); + return RegAllocHints[Reg]; + } + //===--------------------------------------------------------------------===// // Physical Register Use Info //===--------------------------------------------------------------------===// Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=73346&r1=73345&r2=73346&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Sun Jun 14 15:22:55 2009 @@ -484,6 +484,20 @@ return 0; } + /// getRegisterPairEven - Return the even register of the register pair that + /// contains the specified register. + virtual unsigned getRegisterPairEven(const MachineFunction &MF, + unsigned Reg) const { + return 0; + } + + /// getRegisterPairOdd - Return the odd register of the register pair that + /// contains the specified register. + virtual unsigned getRegisterPairOdd(const MachineFunction &MF, + unsigned Reg) const { + return 0; + } + //===--------------------------------------------------------------------===// // Register Class Information // Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=73346&r1=73345&r2=73346&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Sun Jun 14 15:22:55 2009 @@ -19,6 +19,7 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/LiveInterval.h" +#include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/STLExtras.h" @@ -421,13 +422,13 @@ return VNI; } - /// join - Join two live intervals (this, and other) together. This applies /// mappings to the value numbers in the LHS/RHS intervals as specified. If /// the intervals are not joinable, this aborts. void LiveInterval::join(LiveInterval &Other, const int *LHSValNoAssignments, const int *RHSValNoAssignments, - SmallVector &NewVNInfo) { + SmallVector &NewVNInfo, + MachineRegisterInfo *MRI) { // Determine if any of our live range values are mapped. This is uncommon, so // we want to avoid the interval scan if not. bool MustMapCurValNos = false; @@ -502,8 +503,19 @@ } weight += Other.weight; - if (Other.preference && !preference) - preference = Other.preference; + + // Update regalloc hint if currently there isn't one. + if (TargetRegisterInfo::isVirtualRegister(reg) && + TargetRegisterInfo::isVirtualRegister(Other.reg)) { + std::pair Hint = + MRI->getRegAllocationHint(reg); + if (Hint.first == MachineRegisterInfo::RA_None) { + std::pair OtherHint = + MRI->getRegAllocationHint(Other.reg); + if (OtherHint.first != MachineRegisterInfo::RA_None) + MRI->setRegAllocationHint(reg, OtherHint.first, OtherHint.second); + } + } } /// MergeRangesInAsValue - Merge all of the intervals in RHS into this live @@ -756,10 +768,14 @@ } void LiveInterval::Copy(const LiveInterval &RHS, + MachineRegisterInfo *MRI, BumpPtrAllocator &VNInfoAllocator) { ranges.clear(); valnos.clear(); - preference = RHS.preference; + std::pair Hint = + MRI->getRegAllocationHint(RHS.reg); + MRI->setRegAllocationHint(reg, Hint.first, Hint.second); + weight = RHS.weight; for (unsigned i = 0, e = RHS.getNumValNums(); i != e; ++i) { const VNInfo *VNI = RHS.getValNumInfo(i); Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=73346&r1=73345&r2=73346&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Sun Jun 14 15:22:55 2009 @@ -896,7 +896,7 @@ /// managing the allocated memory. LiveInterval* LiveIntervals::dupInterval(LiveInterval *li) { LiveInterval *NewLI = createInterval(li->reg); - NewLI->Copy(*li, getVNInfoAllocator()); + NewLI->Copy(*li, mri_, getVNInfoAllocator()); return NewLI; } Modified: llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp?rev=73346&r1=73345&r2=73346&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp Sun Jun 14 15:22:55 2009 @@ -16,6 +16,7 @@ MachineRegisterInfo::MachineRegisterInfo(const TargetRegisterInfo &TRI) { VRegInfo.reserve(256); + RegAllocHints.reserve(256); RegClass2VRegMap.resize(TRI.getNumRegClasses()+1); // RC ID starts at 1. UsedPhysRegs.resize(TRI.getNumRegs()); @@ -64,6 +65,7 @@ // Add a reg, but keep track of whether the vector reallocated or not. void *ArrayBase = VRegInfo.empty() ? 0 : &VRegInfo[0]; VRegInfo.push_back(std::make_pair(RegClass, (MachineOperand*)0)); + RegAllocHints.push_back(std::make_pair(RA_None, 0)); if (!((&VRegInfo[0] == ArrayBase || VRegInfo.size() == 1))) // The vector reallocated, handle this now. Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=73346&r1=73345&r2=73346&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Sun Jun 14 15:22:55 2009 @@ -352,7 +352,8 @@ /// different register classes or because the coalescer was overly /// conservative. unsigned RALinScan::attemptTrivialCoalescing(LiveInterval &cur, unsigned Reg) { - if ((cur.preference && cur.preference == Reg) || !cur.containsOneValue()) + unsigned Preference = vrm_->getRegAllocPref(cur.reg); + if ((Preference && Preference == Reg) || !cur.containsOneValue()) return Reg; VNInfo *vni = cur.begin()->valno; @@ -584,7 +585,7 @@ // register allocator had to spill other registers in its register class. if (ls_->getNumIntervals() == 0) return; - if (!vrm_->FindUnusedRegisters(tri_, li_)) + if (!vrm_->FindUnusedRegisters(li_)) return; } @@ -897,7 +898,7 @@ // This is an implicitly defined live interval, just assign any register. const TargetRegisterClass *RC = mri_->getRegClass(cur->reg); if (cur->empty()) { - unsigned physReg = cur->preference; + unsigned physReg = vrm_->getRegAllocPref(cur->reg); if (!physReg) physReg = *RC->allocation_order_begin(*mf_); DOUT << tri_->getName(physReg) << '\n'; @@ -917,7 +918,7 @@ // register class, then we should try to assign it the same register. // This can happen when the move is from a larger register class to a smaller // one, e.g. X86::mov32to32_. These move instructions are not coalescable. - if (!cur->preference && cur->hasAtLeastOneValue()) { + if (!vrm_->getRegAllocPref(cur->reg) && cur->hasAtLeastOneValue()) { VNInfo *vni = cur->begin()->valno; if (vni->def && vni->def != ~1U && vni->def != ~0U) { MachineInstr *CopyMI = li_->getInstructionFromIndex(vni->def); @@ -935,7 +936,8 @@ if (DstSubReg) Reg = tri_->getMatchingSuperReg(Reg, DstSubReg, RC); if (Reg && allocatableRegs_[Reg] && RC->contains(Reg)) - cur->preference = Reg; + mri_->setRegAllocationHint(cur->reg, + MachineRegisterInfo::RA_Preference, Reg); } } } @@ -1044,7 +1046,8 @@ if (LiveInterval *NextReloadLI = hasNextReloadInterval(cur)) { // "Downgrade" physReg to try to keep physReg from being allocated until // the next reload from the same SS is allocated. - NextReloadLI->preference = physReg; + mri_->setRegAllocationHint(NextReloadLI->reg, + MachineRegisterInfo::RA_Preference, physReg); DowngradeRegister(cur, physReg); } return; @@ -1071,7 +1074,7 @@ // Find a register to spill. float minWeight = HUGE_VALF; - unsigned minReg = 0; /*cur->preference*/; // Try the pref register first. + unsigned minReg = 0; bool Found = false; std::vector > RegsWeights; @@ -1290,7 +1293,7 @@ // It interval has a preference, it must be defined by a copy. Clear the // preference now since the source interval allocation may have been // undone as well. - i->preference = 0; + mri_->setRegAllocationHint(i->reg, MachineRegisterInfo::RA_None, 0); else { UpgradeRegister(ii->second); } @@ -1428,11 +1431,12 @@ // If copy coalescer has assigned a "preferred" register, check if it's // available first. - if (cur->preference) { - DOUT << "(preferred: " << tri_->getName(cur->preference) << ") "; - if (isRegAvail(cur->preference) && - RC->contains(cur->preference)) - return cur->preference; + unsigned Preference = vrm_->getRegAllocPref(cur->reg); + if (Preference) { + DOUT << "(preferred: " << tri_->getName(Preference) << ") "; + if (isRegAvail(Preference) && + RC->contains(Preference)) + return Preference; } if (!DowngradedRegs.empty()) { Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=73346&r1=73345&r2=73346&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Sun Jun 14 15:22:55 2009 @@ -733,8 +733,7 @@ itr != end; ++itr) { LiveInterval *li = *itr; - unsigned physReg = li->preference; - + unsigned physReg = vrm->getRegAllocPref(li->reg); if (physReg == 0) { const TargetRegisterClass *liRC = mri->getRegClass(li->reg); physReg = *liRC->allocation_order_begin(*mf); Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=73346&r1=73345&r2=73346&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Sun Jun 14 15:22:55 2009 @@ -1265,6 +1265,35 @@ return true; } +/// getRegAllocPreference - Return register allocation preference register. +/// +static unsigned getRegAllocPreference(unsigned Reg, MachineFunction &MF, + MachineRegisterInfo *MRI, + const TargetRegisterInfo *TRI) { + if (TargetRegisterInfo::isPhysicalRegister(Reg)) + return 0; + + std::pair Hint = + MRI->getRegAllocationHint(Reg); + switch (Hint.first) { + default: assert(0); + case MachineRegisterInfo::RA_None: + return 0; + case MachineRegisterInfo::RA_Preference: + return Hint.second; + case MachineRegisterInfo::RA_PairEven: + if (TargetRegisterInfo::isPhysicalRegister(Hint.second)) + return TRI->getRegisterPairOdd(MF, Hint.second); + return Hint.second; + case MachineRegisterInfo::RA_PairOdd: + if (TargetRegisterInfo::isPhysicalRegister(Hint.second)) + return TRI->getRegisterPairEven(MF, Hint.second); + return Hint.second; + } + // Shouldn't reach here. + return 0; +} + /// JoinCopy - Attempt to join intervals corresponding to SrcReg/DstReg, /// which are the src/dst of the copy instruction CopyMI. This returns true /// if the copy was successfully coalesced away. If it is not currently @@ -1566,7 +1595,8 @@ if (PhysJoinTweak) { if (SrcIsPhys) { if (!isWinToJoinVRWithSrcPhysReg(CopyMI, CopyMBB, DstInt, SrcInt)) { - DstInt.preference = SrcReg; + mri_->setRegAllocationHint(DstInt.reg, + MachineRegisterInfo::RA_Preference, SrcReg); ++numAborts; DOUT << "\tMay tie down a physical register, abort!\n"; Again = true; // May be possible to coalesce later. @@ -1574,7 +1604,8 @@ } } else { if (!isWinToJoinVRWithDstPhysReg(CopyMI, CopyMBB, DstInt, SrcInt)) { - SrcInt.preference = DstReg; + mri_->setRegAllocationHint(SrcInt.reg, + MachineRegisterInfo::RA_Preference, DstReg); ++numAborts; DOUT << "\tMay tie down a physical register, abort!\n"; Again = true; // May be possible to coalesce later. @@ -1598,7 +1629,8 @@ if (Length > Threshold && (((float)std::distance(mri_->use_begin(JoinVReg), mri_->use_end()) / Length) < Ratio)) { - JoinVInt.preference = JoinPReg; + mri_->setRegAllocationHint(JoinVInt.reg, + MachineRegisterInfo::RA_Preference, JoinPReg); ++numAborts; DOUT << "\tMay tie down a physical register, abort!\n"; Again = true; // May be possible to coalesce later. @@ -1691,7 +1723,7 @@ !SrcIsPhys && !DstIsPhys) { if ((isExtSubReg && !Swapped) || ((isInsSubReg || isSubRegToReg) && Swapped)) { - ResSrcInt->Copy(*ResDstInt, li_->getVNInfoAllocator()); + ResSrcInt->Copy(*ResDstInt, mri_, li_->getVNInfoAllocator()); std::swap(SrcReg, DstReg); std::swap(ResSrcInt, ResDstInt); } @@ -1778,11 +1810,13 @@ // If resulting interval has a preference that no longer fits because of subreg // coalescing, just clear the preference. - if (ResDstInt->preference && (isExtSubReg || isInsSubReg || isSubRegToReg) && + unsigned Preference = getRegAllocPreference(ResDstInt->reg, *mf_, mri_, tri_); + if (Preference && (isExtSubReg || isInsSubReg || isSubRegToReg) && TargetRegisterInfo::isVirtualRegister(ResDstInt->reg)) { const TargetRegisterClass *RC = mri_->getRegClass(ResDstInt->reg); - if (!RC->contains(ResDstInt->preference)) - ResDstInt->preference = 0; + if (!RC->contains(Preference)) + mri_->setRegAllocationHint(ResDstInt->reg, + MachineRegisterInfo::RA_None, 0); } DOUT << "\n\t\tJoined. Result = "; ResDstInt->print(DOUT, tri_); @@ -2029,8 +2063,18 @@ LHS.addKills(LHSValNo, VNI->kills); LHS.MergeRangesInAsValue(RHS, LHSValNo); LHS.weight += RHS.weight; - if (RHS.preference && !LHS.preference) - LHS.preference = RHS.preference; + + // Update regalloc hint if both are virtual registers. + if (TargetRegisterInfo::isVirtualRegister(LHS.reg) && + TargetRegisterInfo::isVirtualRegister(RHS.reg)) { + std::pair RHSPref = + mri_->getRegAllocationHint(RHS.reg); + std::pair LHSPref = + mri_->getRegAllocationHint(LHS.reg); + if (RHSPref.first != MachineRegisterInfo::RA_None && + LHSPref.first == MachineRegisterInfo::RA_None) + mri_->setRegAllocationHint(LHS.reg, RHSPref.first, RHSPref.second); + } // Update the liveintervals of sub-registers. if (TargetRegisterInfo::isPhysicalRegister(LHS.reg)) @@ -2315,10 +2359,12 @@ if ((RHS.ranges.size() > LHS.ranges.size() && TargetRegisterInfo::isVirtualRegister(LHS.reg)) || TargetRegisterInfo::isPhysicalRegister(RHS.reg)) { - RHS.join(LHS, &RHSValNoAssignments[0], &LHSValNoAssignments[0], NewVNInfo); + RHS.join(LHS, &RHSValNoAssignments[0], &LHSValNoAssignments[0], NewVNInfo, + mri_); Swapped = true; } else { - LHS.join(RHS, &LHSValNoAssignments[0], &RHSValNoAssignments[0], NewVNInfo); + LHS.join(RHS, &LHSValNoAssignments[0], &RHSValNoAssignments[0], NewVNInfo, + mri_); Swapped = false; } return true; @@ -2800,7 +2846,8 @@ } // Slightly prefer live interval that has been assigned a preferred reg. - if (LI.preference) + if (mri_->getRegAllocationHint(LI.reg).first != + MachineRegisterInfo::RA_None) LI.weight *= 1.01F; // Divide the weight of the interval by its size. This encourages Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=73346&r1=73345&r2=73346&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Sun Jun 14 15:22:55 2009 @@ -51,6 +51,7 @@ X("virtregmap", "Virtual Register Map"); bool VirtRegMap::runOnMachineFunction(MachineFunction &mf) { + MRI = &mf.getRegInfo(); TII = mf.getTarget().getInstrInfo(); TRI = mf.getTarget().getRegisterInfo(); MF = &mf; @@ -98,6 +99,39 @@ ImplicitDefed.resize(LastVirtReg-TargetRegisterInfo::FirstVirtualRegister+1); } +unsigned VirtRegMap::getRegAllocPref(unsigned virtReg) { + std::pair Hint = + MRI->getRegAllocationHint(virtReg); + switch (Hint.first) { + default: assert(0); + case MachineRegisterInfo::RA_None: + return 0; + case MachineRegisterInfo::RA_Preference: + if (TargetRegisterInfo::isPhysicalRegister(Hint.second)) + return Hint.second; + if (hasPhys(Hint.second)) + return getPhys(Hint.second); + case MachineRegisterInfo::RA_PairEven: { + unsigned physReg = Hint.second; + if (TargetRegisterInfo::isPhysicalRegister(physReg)) + return TRI->getRegisterPairEven(*MF, physReg); + else if (hasPhys(physReg)) + return TRI->getRegisterPairEven(*MF, getPhys(physReg)); + return 0; + } + case MachineRegisterInfo::RA_PairOdd: { + unsigned physReg = Hint.second; + if (TargetRegisterInfo::isPhysicalRegister(physReg)) + return TRI->getRegisterPairOdd(*MF, physReg); + else if (hasPhys(physReg)) + return TRI->getRegisterPairOdd(*MF, getPhys(physReg)); + return 0; + } + } + // Shouldn't reach here. + return 0; +} + int VirtRegMap::assignVirt2StackSlot(unsigned virtReg) { assert(TargetRegisterInfo::isVirtualRegister(virtReg)); assert(Virt2StackSlotMap[virtReg] == NO_STACK_SLOT && @@ -213,8 +247,7 @@ /// FindUnusedRegisters - Gather a list of allocatable registers that /// have not been allocated to any virtual register. -bool VirtRegMap::FindUnusedRegisters(const TargetRegisterInfo *TRI, - LiveIntervals* LIs) { +bool VirtRegMap::FindUnusedRegisters(LiveIntervals* LIs) { unsigned NumRegs = TRI->getNumRegs(); UnusedRegs.reset(); UnusedRegs.resize(NumRegs); Modified: llvm/trunk/lib/CodeGen/VirtRegMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.h?rev=73346&r1=73345&r2=73346&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegMap.h (original) +++ llvm/trunk/lib/CodeGen/VirtRegMap.h Sun Jun 14 15:22:55 2009 @@ -31,6 +31,7 @@ class LiveIntervals; class MachineInstr; class MachineFunction; + class MachineRegisterInfo; class TargetInstrInfo; class TargetRegisterInfo; @@ -47,6 +48,7 @@ std::pair > MI2VirtMapTy; private: + MachineRegisterInfo *MRI; const TargetInstrInfo *TII; const TargetRegisterInfo *TRI; MachineFunction *MF; @@ -190,6 +192,9 @@ grow(); } + /// @brief returns the register allocation preference. + unsigned getRegAllocPref(unsigned virtReg); + /// @brief records virtReg is a split live interval from SReg. void setIsSplitFromReg(unsigned virtReg, unsigned SReg) { Virt2SplitMap[virtReg] = SReg; @@ -445,8 +450,7 @@ /// FindUnusedRegisters - Gather a list of allocatable registers that /// have not been allocated to any virtual register. - bool FindUnusedRegisters(const TargetRegisterInfo *TRI, - LiveIntervals* LIs); + bool FindUnusedRegisters(LiveIntervals* LIs); /// HasUnusedRegisters - Return true if there are any allocatable registers /// that have not been allocated to any virtual register. From ssen at apple.com Sat Jun 13 21:03:17 2009 From: ssen at apple.com (Shantonu Sen) Date: Sun, 14 Jun 2009 02:03:17 -0000 Subject: [llvm-commits] [llvm] r73320 - /llvm/trunk/CREDITS.TXT Message-ID: <200906140203.n5E23IKv003660@zion.cs.uiuc.edu> Author: ssen Date: Sat Jun 13 21:03:17 2009 New Revision: 73320 URL: http://llvm.org/viewvc/llvm-project?rev=73320&view=rev Log: Add myself, test commit Modified: llvm/trunk/CREDITS.TXT Modified: llvm/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=73320&r1=73319&r2=73320&view=diff ============================================================================== --- llvm/trunk/CREDITS.TXT (original) +++ llvm/trunk/CREDITS.TXT Sat Jun 13 21:03:17 2009 @@ -273,6 +273,10 @@ E: arnold.schwaighofer at gmail.com D: Tail call optimization for the x86 backend +N: Shantonu Sen +E: ssen at apple.com +D: Miscellaneous bug fixes + N: Anand Shukla E: ashukla at cs.uiuc.edu D: The `paths' pass From baldrick at free.fr Sun Jun 14 17:22:42 2009 From: baldrick at free.fr (Duncan Sands) Date: Sun, 14 Jun 2009 22:22:42 -0000 Subject: [llvm-commits] [llvm] r73353 - /llvm/trunk/test/FrontendC/2009-06-14-HighlyAligned.c Message-ID: <200906142222.n5EMMgLa014260@zion.cs.uiuc.edu> Author: baldrick Date: Sun Jun 14 17:22:42 2009 New Revision: 73353 URL: http://llvm.org/viewvc/llvm-project?rev=73353&view=rev Log: Testcase for PR4332. Added: llvm/trunk/test/FrontendC/2009-06-14-HighlyAligned.c Added: llvm/trunk/test/FrontendC/2009-06-14-HighlyAligned.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2009-06-14-HighlyAligned.c?rev=73353&view=auto ============================================================================== --- llvm/trunk/test/FrontendC/2009-06-14-HighlyAligned.c (added) +++ llvm/trunk/test/FrontendC/2009-06-14-HighlyAligned.c Sun Jun 14 17:22:42 2009 @@ -0,0 +1,8 @@ +// RUN: %llvmgcc %s -S +// PR4332 + +static int highly_aligned __attribute__((aligned(4096))); + +int f() { + return highly_aligned; +} From baldrick at free.fr Sun Jun 14 17:25:11 2009 From: baldrick at free.fr (Duncan Sands) Date: Sun, 14 Jun 2009 22:25:11 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r73354 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h Message-ID: <200906142225.n5EMPBZ7014347@zion.cs.uiuc.edu> Author: baldrick Date: Sun Jun 14 17:25:11 2009 New Revision: 73354 URL: http://llvm.org/viewvc/llvm-project?rev=73354&view=rev Log: Store the log of the alignment rather than the actual alignment in LValue/MemRef. Previously LValue could store at most an alignment of 128, resulting in crashes and other strangeness for larger alignments. This fixes PR4332. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-internal.h Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=73354&r1=73353&r2=73354&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sun Jun 14 17:25:11 2009 @@ -947,7 +947,7 @@ /// the address of the result. LValue TreeToLLVM::EmitLV(tree exp) { // Needs to be in sync with EmitVIEW_CONVERT_EXPR. - LValue LV(0, 0); + LValue LV; switch (TREE_CODE(exp)) { default: @@ -982,7 +982,7 @@ // Constants. case LABEL_DECL: { Value *Ptr = TreeConstantToLLVM::EmitLV_LABEL_DECL(exp); - LV = LValue(Ptr, DECL_ALIGN(exp) / 8); + LV = LValue(Ptr, 1); break; } case COMPLEX_CST: { @@ -1180,7 +1180,7 @@ const Type *ElTy = cast(DestLoc.Ptr->getType())->getElementType(); - unsigned Alignment = std::min(DestLoc.Alignment, SrcLoc.Alignment); + unsigned Alignment = std::min(DestLoc.getAlignment(), SrcLoc.getAlignment()); if (ElTy->isSingleValueType()) { LoadInst *V = Builder.CreateLoad(SrcLoc.Ptr, SrcLoc.Volatile); @@ -1291,7 +1291,7 @@ Value *TypeSize = Emit(TYPE_SIZE_UNIT(type), 0); EmitMemCpy(DestLoc.Ptr, SrcLoc.Ptr, TypeSize, - std::min(DestLoc.Alignment, SrcLoc.Alignment)); + std::min(DestLoc.getAlignment(), SrcLoc.getAlignment())); } /// ZeroAggregate - Recursively traverse the potentially aggregate DestLoc, @@ -1302,12 +1302,13 @@ if (ElTy->isSingleValueType()) { StoreInst *St = Builder.CreateStore(Constant::getNullValue(ElTy), DestLoc.Ptr, DestLoc.Volatile); - St->setAlignment(DestLoc.Alignment); + St->setAlignment(DestLoc.getAlignment()); } else if (const StructType *STy = dyn_cast(ElTy)) { const StructLayout *SL = getTargetData().getStructLayout(STy); for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { Value *Ptr = Builder.CreateStructGEP(DestLoc.Ptr, i); - unsigned Alignment = MinAlign(DestLoc.Alignment, SL->getElementOffset(i)); + unsigned Alignment = MinAlign(DestLoc.getAlignment(), + SL->getElementOffset(i)); ZeroAggregate(MemRef(Ptr, Alignment, DestLoc.Volatile), Builder); } } else { @@ -1315,7 +1316,7 @@ unsigned EltSize = getTargetData().getTypeAllocSize(ATy->getElementType()); for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i) { Value *Ptr = Builder.CreateStructGEP(DestLoc.Ptr, i); - unsigned Alignment = MinAlign(DestLoc.Alignment, i * EltSize); + unsigned Alignment = MinAlign(DestLoc.getAlignment(), i * EltSize); ZeroAggregate(MemRef(Ptr, Alignment, DestLoc.Volatile), Builder); } } @@ -1341,7 +1342,7 @@ } EmitMemSet(DestLoc.Ptr, ConstantInt::get(Type::Int8Ty, 0), - Emit(TYPE_SIZE_UNIT(type), 0), DestLoc.Alignment); + Emit(TYPE_SIZE_UNIT(type), 0), DestLoc.getAlignment()); } Value *TreeToLLVM::EmitMemCpy(Value *DestPtr, Value *SrcPtr, Value *Size, @@ -2730,7 +2731,7 @@ } Ptr = BitCastToType(Ptr, PointerType::getUnqual(Call->getType())); StoreInst *St = Builder.CreateStore(Call, Ptr, DestLoc->Volatile); - St->setAlignment(DestLoc->Alignment); + St->setAlignment(DestLoc->getAlignment()); return 0; } @@ -2982,7 +2983,7 @@ Value *Ptr = BitCastToType(DestLoc->Ptr, PointerType::getUnqual(OpVal->getType())); StoreInst *St = Builder.CreateStore(OpVal, Ptr, DestLoc->Volatile); - St->setAlignment(DestLoc->Alignment); + St->setAlignment(DestLoc->getAlignment()); return 0; } @@ -3059,7 +3060,7 @@ Value *Ptr = BitCastToType(DestLoc->Ptr, PointerType::getUnqual(OpVal->getType())); StoreInst *St = Builder.CreateStore(OpVal, Ptr, DestLoc->Volatile); - St->setAlignment(DestLoc->Alignment); + St->setAlignment(DestLoc->getAlignment()); return 0; } @@ -5719,12 +5720,12 @@ MemRef SrcComplex) { Value *RealPtr = Builder.CreateStructGEP(SrcComplex.Ptr, 0, "real"); Real = Builder.CreateLoad(RealPtr, SrcComplex.Volatile, "real"); - cast(Real)->setAlignment(SrcComplex.Alignment); + cast(Real)->setAlignment(SrcComplex.getAlignment()); Value *ImagPtr = Builder.CreateStructGEP(SrcComplex.Ptr, 1, "imag"); Imag = Builder.CreateLoad(ImagPtr, SrcComplex.Volatile, "imag"); cast(Imag)->setAlignment( - MinAlign(SrcComplex.Alignment, TD.getTypeAllocSize(Real->getType())) + MinAlign(SrcComplex.getAlignment(), TD.getTypeAllocSize(Real->getType())) ); } @@ -5734,12 +5735,12 @@ Value *RealPtr = Builder.CreateStructGEP(DestComplex.Ptr, 0, "real"); St = Builder.CreateStore(Real, RealPtr, DestComplex.Volatile); - St->setAlignment(DestComplex.Alignment); + St->setAlignment(DestComplex.getAlignment()); Value *ImagPtr = Builder.CreateStructGEP(DestComplex.Ptr, 1, "imag"); St = Builder.CreateStore(Imag, ImagPtr, DestComplex.Volatile); St->setAlignment( - MinAlign(DestComplex.Alignment, TD.getTypeAllocSize(Real->getType())) + MinAlign(DestComplex.getAlignment(), TD.getTypeAllocSize(Real->getType())) ); } @@ -5949,7 +5950,7 @@ LValue ArrayAddrLV = EmitLV(Array); assert(!ArrayAddrLV.isBitfield() && "Arrays cannot be bitfields!"); ArrayAddr = ArrayAddrLV.Ptr; - ArrayAlign = ArrayAddrLV.Alignment; + ArrayAlign = ArrayAddrLV.getAlignment(); } else { ArrayAddr = Emit(Array, 0); if (TREE_CODE (ArrayTreeType) == POINTER_TYPE) @@ -6095,7 +6096,7 @@ LValue TreeToLLVM::EmitLV_COMPONENT_REF(tree exp) { LValue StructAddrLV = EmitLV(TREE_OPERAND(exp, 0)); tree FieldDecl = TREE_OPERAND(exp, 1); - unsigned LVAlign = StructAddrLV.Alignment; + unsigned LVAlign = StructAddrLV.getAlignment(); assert((TREE_CODE(DECL_CONTEXT(FieldDecl)) == RECORD_TYPE || TREE_CODE(DECL_CONTEXT(FieldDecl)) == UNION_TYPE || @@ -6320,7 +6321,7 @@ // If this is referring to the whole field, return the whole thing. if (BitStart == 0 && BitSize == ValueSizeInBits) { return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy)), - Ptr.Alignment); + Ptr.getAlignment()); } return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy)), 1, @@ -6334,10 +6335,10 @@ unsigned Alignment; if (Idx == 0) // REALPART alignment is same as the complex operand. - Alignment = Ptr.Alignment; + Alignment = Ptr.getAlignment(); else // IMAGPART alignment = MinAlign(Ptr.Alignment, sizeof field); - Alignment = MinAlign(Ptr.Alignment, + Alignment = MinAlign(Ptr.getAlignment(), TD.getTypeAllocSize(Ptr.Ptr->getType())); return LValue(Builder.CreateStructGEP(Ptr.Ptr, Idx), Alignment); } @@ -6452,7 +6453,7 @@ Value *Ptr = BitCastToType(DestLoc->Ptr, PointerType::getUnqual(V->getType())); StoreInst *St = Builder.CreateStore(V, Ptr, DestLoc->Volatile); - St->setAlignment(DestLoc->Alignment); + St->setAlignment(DestLoc->getAlignment()); } break; } Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=73354&r1=73353&r2=73354&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Sun Jun 14 17:25:11 2009 @@ -38,6 +38,7 @@ #include "llvm/ADT/SetVector.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/IRBuilder.h" +#include "llvm/Support/MathExtras.h" #include "llvm/Support/Streams.h" #include "llvm/Support/TargetFolder.h" @@ -233,14 +234,20 @@ /// a pointer to the memory, its alignment and whether the access is volatile. struct MemRef { Value *Ptr; - unsigned Alignment; bool Volatile; +private: + unsigned char LogAlign; + +public: + MemRef() : Ptr(0), Volatile(false), LogAlign(0) {} + MemRef(Value *P, uint32_t A, bool V) : Ptr(P), Volatile(V) { + // Forbid alignment 0 along with non-power-of-2 alignment values. + assert(isPowerOf2_32(A) && "Alignment not a power of 2!"); + LogAlign = Log2_32(A); + } - MemRef() : Ptr(0), Alignment(0), Volatile(false) {} - MemRef(Value *P, unsigned A, bool V) - : Ptr(P), Alignment(A), Volatile(V) { - // Allowing alignment 0 would complicate calculations, so forbid it. - assert(A && !(A & (A - 1)) && "Alignment not a power of 2!"); + uint32_t getAlignment() const { + return 1U << LogAlign; } }; @@ -253,21 +260,29 @@ /// "LValue" is intended to be a light-weight object passed around by-value. struct LValue { Value *Ptr; - unsigned char Alignment; unsigned char BitStart; unsigned char BitSize; - - LValue(Value *P, unsigned Align) - : Ptr(P), Alignment(Align), BitStart(255), BitSize(255) {} - LValue(Value *P, unsigned Align, unsigned BSt, unsigned BSi) - : Ptr(P), Alignment(Align), BitStart(BSt), BitSize(BSi) { - assert(BitStart == BSt && BitSize == BSi && - "Bit values larger than 256?"); - } - - unsigned getAlignment() const { - assert(Alignment && "LValue alignment cannot be zero!"); - return Alignment; +private: + unsigned char LogAlign; + +public: + LValue() : Ptr(0), BitStart(255), BitSize(255), LogAlign(0) {} + LValue(Value *P, uint32_t A) : Ptr(P), BitStart(255), BitSize(255) { + // Forbid alignment 0 along with non-power-of-2 alignment values. + assert(isPowerOf2_32(A) && "Alignment not a power of 2!"); + LogAlign = Log2_32(A); + } + LValue(Value *P, uint32_t A, unsigned BSt, unsigned BSi) + : Ptr(P), BitStart(BSt), BitSize(BSi) { + assert(BitStart == BSt && BitSize == BSi && + "Bit values larger than 256?"); + // Forbid alignment 0 along with non-power-of-2 alignment values. + assert(isPowerOf2_32(A) && "Alignment not a power of 2!"); + LogAlign = Log2_32(A); + } + + uint32_t getAlignment() const { + return 1U << LogAlign; } bool isBitfield() const { return BitStart != 255; } }; From gohman at apple.com Sun Jun 14 17:38:41 2009 From: gohman at apple.com (Dan Gohman) Date: Sun, 14 Jun 2009 22:38:41 -0000 Subject: [llvm-commits] [llvm] r73355 - /llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Message-ID: <200906142238.n5EMcfa0014829@zion.cs.uiuc.edu> Author: djg Date: Sun Jun 14 17:38:41 2009 New Revision: 73355 URL: http://llvm.org/viewvc/llvm-project?rev=73355&view=rev Log: Add another item to the list of things that indvars does. Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=73355&r1=73354&r2=73355&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Sun Jun 14 17:38:41 2009 @@ -17,7 +17,10 @@ // which starts at zero and steps by one. // 2. The canonical induction variable is guaranteed to be the first PHI node // in the loop header block. -// 3. Any pointer arithmetic recurrences are raised to use array subscripts. +// 3. The canonical induction variable is guaranteed to be in a wide enough +// type so that IV expressions need not be (directly) zero-extended or +// sign-extended. +// 4. Any pointer arithmetic recurrences are raised to use array subscripts. // // If the trip count of a loop is computable, this pass also makes the following // changes: From gohman at apple.com Sun Jun 14 17:47:23 2009 From: gohman at apple.com (Dan Gohman) Date: Sun, 14 Jun 2009 22:47:23 -0000 Subject: [llvm-commits] [llvm] r73357 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h include/llvm/Analysis/ScalarEvolutionExpressions.h lib/Analysis/ScalarEvolution.cpp lib/Analysis/ScalarEvolutionExpander.cpp lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200906142247.n5EMlNRv015113@zion.cs.uiuc.edu> Author: djg Date: Sun Jun 14 17:47:23 2009 New Revision: 73357 URL: http://llvm.org/viewvc/llvm-project?rev=73357&view=rev Log: Convert several parts of the ScalarEvolution framework to use SmallVector instead of std::vector. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h llvm/trunk/lib/Analysis/ScalarEvolution.cpp llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=73357&r1=73356&r2=73357&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Sun Jun 14 17:47:23 2009 @@ -394,24 +394,24 @@ SCEVHandle getZeroExtendExpr(const SCEVHandle &Op, const Type *Ty); SCEVHandle getSignExtendExpr(const SCEVHandle &Op, const Type *Ty); SCEVHandle getAnyExtendExpr(const SCEVHandle &Op, const Type *Ty); - SCEVHandle getAddExpr(std::vector &Ops); + SCEVHandle getAddExpr(SmallVectorImpl &Ops); SCEVHandle getAddExpr(const SCEVHandle &LHS, const SCEVHandle &RHS) { - std::vector Ops; + SmallVector Ops; Ops.push_back(LHS); Ops.push_back(RHS); return getAddExpr(Ops); } SCEVHandle getAddExpr(const SCEVHandle &Op0, const SCEVHandle &Op1, const SCEVHandle &Op2) { - std::vector Ops; + SmallVector Ops; Ops.push_back(Op0); Ops.push_back(Op1); Ops.push_back(Op2); return getAddExpr(Ops); } - SCEVHandle getMulExpr(std::vector &Ops); + SCEVHandle getMulExpr(SmallVectorImpl &Ops); SCEVHandle getMulExpr(const SCEVHandle &LHS, const SCEVHandle &RHS) { - std::vector Ops; + SmallVector Ops; Ops.push_back(LHS); Ops.push_back(RHS); return getMulExpr(Ops); @@ -419,17 +419,17 @@ SCEVHandle getUDivExpr(const SCEVHandle &LHS, const SCEVHandle &RHS); SCEVHandle getAddRecExpr(const SCEVHandle &Start, const SCEVHandle &Step, const Loop *L); - SCEVHandle getAddRecExpr(std::vector &Operands, + SCEVHandle getAddRecExpr(SmallVectorImpl &Operands, const Loop *L); - SCEVHandle getAddRecExpr(const std::vector &Operands, + SCEVHandle getAddRecExpr(const SmallVectorImpl &Operands, const Loop *L) { - std::vector NewOp(Operands); + SmallVector NewOp(Operands.begin(), Operands.end()); return getAddRecExpr(NewOp, L); } SCEVHandle getSMaxExpr(const SCEVHandle &LHS, const SCEVHandle &RHS); - SCEVHandle getSMaxExpr(std::vector Operands); + SCEVHandle getSMaxExpr(SmallVectorImpl &Operands); SCEVHandle getUMaxExpr(const SCEVHandle &LHS, const SCEVHandle &RHS); - SCEVHandle getUMaxExpr(std::vector Operands); + SCEVHandle getUMaxExpr(SmallVectorImpl &Operands); SCEVHandle getUnknown(Value *V); SCEVHandle getCouldNotCompute(); Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=73357&r1=73356&r2=73357&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Sun Jun 14 17:47:23 2009 @@ -199,10 +199,10 @@ /// class SCEVNAryExpr : public SCEV { protected: - std::vector Operands; + SmallVector Operands; - SCEVNAryExpr(enum SCEVTypes T, const std::vector &ops) - : SCEV(T), Operands(ops) {} + SCEVNAryExpr(enum SCEVTypes T, const SmallVectorImpl &ops) + : SCEV(T), Operands(ops.begin(), ops.end()) {} virtual ~SCEVNAryExpr() {} public: @@ -212,8 +212,8 @@ return Operands[i]; } - const std::vector &getOperands() const { return Operands; } - typedef std::vector::const_iterator op_iterator; + const SmallVectorImpl &getOperands() const { return Operands; } + typedef SmallVectorImpl::const_iterator op_iterator; op_iterator op_begin() const { return Operands.begin(); } op_iterator op_end() const { return Operands.end(); } @@ -259,7 +259,7 @@ /// class SCEVCommutativeExpr : public SCEVNAryExpr { protected: - SCEVCommutativeExpr(enum SCEVTypes T, const std::vector &ops) + SCEVCommutativeExpr(enum SCEVTypes T, const SmallVectorImpl &ops) : SCEVNAryExpr(T, ops) {} ~SCEVCommutativeExpr(); @@ -289,7 +289,7 @@ class SCEVAddExpr : public SCEVCommutativeExpr { friend class ScalarEvolution; - explicit SCEVAddExpr(const std::vector &ops) + explicit SCEVAddExpr(const SmallVectorImpl &ops) : SCEVCommutativeExpr(scAddExpr, ops) { } @@ -309,7 +309,7 @@ class SCEVMulExpr : public SCEVCommutativeExpr { friend class ScalarEvolution; - explicit SCEVMulExpr(const std::vector &ops) + explicit SCEVMulExpr(const SmallVectorImpl &ops) : SCEVCommutativeExpr(scMulExpr, ops) { } @@ -387,7 +387,7 @@ const Loop *L; - SCEVAddRecExpr(const std::vector &ops, const Loop *l) + SCEVAddRecExpr(const SmallVectorImpl &ops, const Loop *l) : SCEVNAryExpr(scAddRecExpr, ops), L(l) { for (size_t i = 0, e = Operands.size(); i != e; ++i) assert(Operands[i]->isLoopInvariant(l) && @@ -404,7 +404,7 @@ /// of degree N, it returns a chrec of degree N-1. SCEVHandle getStepRecurrence(ScalarEvolution &SE) const { if (isAffine()) return getOperand(1); - return SE.getAddRecExpr(std::vector(op_begin()+1,op_end()), + return SE.getAddRecExpr(SmallVector(op_begin()+1,op_end()), getLoop()); } @@ -463,7 +463,7 @@ class SCEVSMaxExpr : public SCEVCommutativeExpr { friend class ScalarEvolution; - explicit SCEVSMaxExpr(const std::vector &ops) + explicit SCEVSMaxExpr(const SmallVectorImpl &ops) : SCEVCommutativeExpr(scSMaxExpr, ops) { } @@ -484,7 +484,7 @@ class SCEVUMaxExpr : public SCEVCommutativeExpr { friend class ScalarEvolution; - explicit SCEVUMaxExpr(const std::vector &ops) + explicit SCEVUMaxExpr(const SmallVectorImpl &ops) : SCEVCommutativeExpr(scUMaxExpr, ops) { } Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=73357&r1=73356&r2=73357&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun Jun 14 17:47:23 2009 @@ -293,7 +293,7 @@ SCEVHandle H = getOperand(i)->replaceSymbolicValuesWithConcrete(Sym, Conc, SE); if (H != getOperand(i)) { - std::vector NewOps; + SmallVector NewOps; NewOps.reserve(getNumOperands()); for (unsigned j = 0; j != i; ++j) NewOps.push_back(getOperand(j)); @@ -373,7 +373,7 @@ SCEVHandle H = getOperand(i)->replaceSymbolicValuesWithConcrete(Sym, Conc, SE); if (H != getOperand(i)) { - std::vector NewOps; + SmallVector NewOps; NewOps.reserve(getNumOperands()); for (unsigned j = 0; j != i; ++j) NewOps.push_back(getOperand(j)); @@ -558,7 +558,7 @@ /// this to depend on where the addresses of various SCEV objects happened to /// land in memory. /// -static void GroupByComplexity(std::vector &Ops, +static void GroupByComplexity(SmallVectorImpl &Ops, LoopInfo *LI) { if (Ops.size() < 2) return; // Noop if (Ops.size() == 2) { @@ -766,7 +766,7 @@ // If the input value is a chrec scev made out of constants, truncate // all of the constants. if (const SCEVAddRecExpr *AddRec = dyn_cast(Op)) { - std::vector Operands; + SmallVector Operands; for (unsigned i = 0, e = AddRec->getNumOperands(); i != e; ++i) Operands.push_back(getTruncateExpr(AddRec->getOperand(i), Ty)); return getAddRecExpr(Operands, AddRec->getLoop()); @@ -981,7 +981,7 @@ /// getAddExpr - Get a canonical add expression, or something simpler if /// possible. -SCEVHandle ScalarEvolution::getAddExpr(std::vector &Ops) { +SCEVHandle ScalarEvolution::getAddExpr(SmallVectorImpl &Ops) { assert(!Ops.empty() && "Cannot get empty add!"); if (Ops.size() == 1) return Ops[0]; #ifndef NDEBUG @@ -1001,9 +1001,8 @@ assert(Idx < Ops.size()); while (const SCEVConstant *RHSC = dyn_cast(Ops[Idx])) { // We found two constants, fold them together! - ConstantInt *Fold = ConstantInt::get(LHSC->getValue()->getValue() + - RHSC->getValue()->getValue()); - Ops[0] = getConstant(Fold); + Ops[0] = getConstant(LHSC->getValue()->getValue() + + RHSC->getValue()->getValue()); Ops.erase(Ops.begin()+1); // Erase the folded element if (Ops.size() == 1) return Ops[0]; LHSC = cast(Ops[0]); @@ -1043,7 +1042,7 @@ const SCEVTruncateExpr *Trunc = cast(Ops[Idx]); const Type *DstType = Trunc->getType(); const Type *SrcType = Trunc->getOperand()->getType(); - std::vector LargeOps; + SmallVector LargeOps; bool Ok = true; // Check all the operands to see if they can be represented in the // source type of the truncate. @@ -1059,7 +1058,7 @@ // is much more likely to be foldable here. LargeOps.push_back(getSignExtendExpr(C, SrcType)); } else if (const SCEVMulExpr *M = dyn_cast(Ops[i])) { - std::vector LargeMulOps; + SmallVector LargeMulOps; for (unsigned j = 0, f = M->getNumOperands(); j != f && Ok; ++j) { if (const SCEVTruncateExpr *T = dyn_cast(M->getOperand(j))) { @@ -1128,13 +1127,13 @@ for (unsigned MulOp = 0, e = Mul->getNumOperands(); MulOp != e; ++MulOp) { const SCEV *MulOpSCEV = Mul->getOperand(MulOp); for (unsigned AddOp = 0, e = Ops.size(); AddOp != e; ++AddOp) - if (MulOpSCEV == Ops[AddOp] && !isa(MulOpSCEV)) { + if (MulOpSCEV == Ops[AddOp] && !isa(Ops[AddOp])) { // Fold W + X + (X * Y * Z) --> W + (X * ((Y*Z)+1)) SCEVHandle InnerMul = Mul->getOperand(MulOp == 0); if (Mul->getNumOperands() != 2) { // If the multiply has more than two operands, we must get the // Y*Z term. - std::vector MulOps(Mul->op_begin(), Mul->op_end()); + SmallVector MulOps(Mul->op_begin(), Mul->op_end()); MulOps.erase(MulOps.begin()+MulOp); InnerMul = getMulExpr(MulOps); } @@ -1166,13 +1165,13 @@ // Fold X + (A*B*C) + (A*D*E) --> X + (A*(B*C+D*E)) SCEVHandle InnerMul1 = Mul->getOperand(MulOp == 0); if (Mul->getNumOperands() != 2) { - std::vector MulOps(Mul->op_begin(), Mul->op_end()); + SmallVector MulOps(Mul->op_begin(), Mul->op_end()); MulOps.erase(MulOps.begin()+MulOp); InnerMul1 = getMulExpr(MulOps); } SCEVHandle InnerMul2 = OtherMul->getOperand(OMulOp == 0); if (OtherMul->getNumOperands() != 2) { - std::vector MulOps(OtherMul->op_begin(), + SmallVector MulOps(OtherMul->op_begin(), OtherMul->op_end()); MulOps.erase(MulOps.begin()+OMulOp); InnerMul2 = getMulExpr(MulOps); @@ -1199,7 +1198,7 @@ for (; Idx < Ops.size() && isa(Ops[Idx]); ++Idx) { // Scan all of the other operands to this add and add them to the vector if // they are loop invariant w.r.t. the recurrence. - std::vector LIOps; + SmallVector LIOps; const SCEVAddRecExpr *AddRec = cast(Ops[Idx]); for (unsigned i = 0, e = Ops.size(); i != e; ++i) if (Ops[i]->isLoopInvariant(AddRec->getLoop())) { @@ -1213,7 +1212,8 @@ // NLI + LI + {Start,+,Step} --> NLI + {LI+Start,+,Step} LIOps.push_back(AddRec->getStart()); - std::vector AddRecOps(AddRec->op_begin(), AddRec->op_end()); + SmallVector AddRecOps(AddRec->op_begin(), + AddRec->op_end()); AddRecOps[0] = getAddExpr(LIOps); SCEVHandle NewRec = getAddRecExpr(AddRecOps, AddRec->getLoop()); @@ -1238,7 +1238,7 @@ const SCEVAddRecExpr *OtherAddRec = cast(Ops[OtherIdx]); if (AddRec->getLoop() == OtherAddRec->getLoop()) { // Other + {A,+,B} + {C,+,D} --> Other + {A+C,+,B+D} - std::vector NewOps(AddRec->op_begin(), AddRec->op_end()); + SmallVector NewOps(AddRec->op_begin(), AddRec->op_end()); for (unsigned i = 0, e = OtherAddRec->getNumOperands(); i != e; ++i) { if (i >= NewOps.size()) { NewOps.insert(NewOps.end(), OtherAddRec->op_begin()+i, @@ -1274,7 +1274,7 @@ /// getMulExpr - Get a canonical multiply expression, or something simpler if /// possible. -SCEVHandle ScalarEvolution::getMulExpr(std::vector &Ops) { +SCEVHandle ScalarEvolution::getMulExpr(SmallVectorImpl &Ops) { assert(!Ops.empty() && "Cannot get empty mul!"); #ifndef NDEBUG for (unsigned i = 1, e = Ops.size(); i != e; ++i) @@ -1355,7 +1355,7 @@ for (; Idx < Ops.size() && isa(Ops[Idx]); ++Idx) { // Scan all of the other operands to this mul and add them to the vector if // they are loop invariant w.r.t. the recurrence. - std::vector LIOps; + SmallVector LIOps; const SCEVAddRecExpr *AddRec = cast(Ops[Idx]); for (unsigned i = 0, e = Ops.size(); i != e; ++i) if (Ops[i]->isLoopInvariant(AddRec->getLoop())) { @@ -1367,7 +1367,7 @@ // If we found some loop invariants, fold them into the recurrence. if (!LIOps.empty()) { // NLI * LI * {Start,+,Step} --> NLI * {LI*Start,+,LI*Step} - std::vector NewOps; + SmallVector NewOps; NewOps.reserve(AddRec->getNumOperands()); if (LIOps.size() == 1) { const SCEV *Scale = LIOps[0]; @@ -1375,7 +1375,7 @@ NewOps.push_back(getMulExpr(Scale, AddRec->getOperand(i))); } else { for (unsigned i = 0, e = AddRec->getNumOperands(); i != e; ++i) { - std::vector MulOps(LIOps); + SmallVector MulOps(LIOps.begin(), LIOps.end()); MulOps.push_back(AddRec->getOperand(i)); NewOps.push_back(getMulExpr(MulOps)); } @@ -1473,14 +1473,14 @@ getAddRecExpr(getZeroExtendExpr(AR->getStart(), ExtTy), getZeroExtendExpr(Step, ExtTy), AR->getLoop())) { - std::vector Operands; + SmallVector Operands; for (unsigned i = 0, e = AR->getNumOperands(); i != e; ++i) Operands.push_back(getUDivExpr(AR->getOperand(i), RHS)); return getAddRecExpr(Operands, AR->getLoop()); } // (A*B)/C --> A*(B/C) if safe and B/C can be folded. if (const SCEVMulExpr *M = dyn_cast(LHS)) { - std::vector Operands; + SmallVector Operands; for (unsigned i = 0, e = M->getNumOperands(); i != e; ++i) Operands.push_back(getZeroExtendExpr(M->getOperand(i), ExtTy)); if (getZeroExtendExpr(M, ExtTy) == getMulExpr(Operands)) @@ -1489,7 +1489,9 @@ SCEVHandle Op = M->getOperand(i); SCEVHandle Div = getUDivExpr(Op, RHSC); if (!isa(Div) && getMulExpr(Div, RHSC) == Op) { - Operands = M->getOperands(); + const SmallVectorImpl &MOperands = M->getOperands(); + Operands = SmallVector(MOperands.begin(), + MOperands.end()); Operands[i] = Div; return getMulExpr(Operands); } @@ -1497,7 +1499,7 @@ } // (A+B)/C --> (A/C + B/C) if safe and A/C and B/C can be folded. if (const SCEVAddRecExpr *A = dyn_cast(LHS)) { - std::vector Operands; + SmallVector Operands; for (unsigned i = 0, e = A->getNumOperands(); i != e; ++i) Operands.push_back(getZeroExtendExpr(A->getOperand(i), ExtTy)); if (getZeroExtendExpr(A, ExtTy) == getAddExpr(Operands)) { @@ -1531,7 +1533,7 @@ /// Simplify the expression as much as possible. SCEVHandle ScalarEvolution::getAddRecExpr(const SCEVHandle &Start, const SCEVHandle &Step, const Loop *L) { - std::vector Operands; + SmallVector Operands; Operands.push_back(Start); if (const SCEVAddRecExpr *StepChrec = dyn_cast(Step)) if (StepChrec->getLoop() == L) { @@ -1546,7 +1548,7 @@ /// getAddRecExpr - Get an add recurrence expression for the specified loop. /// Simplify the expression as much as possible. -SCEVHandle ScalarEvolution::getAddRecExpr(std::vector &Operands, +SCEVHandle ScalarEvolution::getAddRecExpr(SmallVectorImpl &Operands, const Loop *L) { if (Operands.size() == 1) return Operands[0]; #ifndef NDEBUG @@ -1565,8 +1567,8 @@ if (const SCEVAddRecExpr *NestedAR = dyn_cast(Operands[0])) { const Loop* NestedLoop = NestedAR->getLoop(); if (L->getLoopDepth() < NestedLoop->getLoopDepth()) { - std::vector NestedOperands(NestedAR->op_begin(), - NestedAR->op_end()); + SmallVector NestedOperands(NestedAR->op_begin(), + NestedAR->op_end()); SCEVHandle NestedARHandle(NestedAR); Operands[0] = NestedAR->getStart(); NestedOperands[0] = getAddRecExpr(Operands, L); @@ -1582,13 +1584,14 @@ SCEVHandle ScalarEvolution::getSMaxExpr(const SCEVHandle &LHS, const SCEVHandle &RHS) { - std::vector Ops; + SmallVector Ops; Ops.push_back(LHS); Ops.push_back(RHS); return getSMaxExpr(Ops); } -SCEVHandle ScalarEvolution::getSMaxExpr(std::vector Ops) { +SCEVHandle +ScalarEvolution::getSMaxExpr(SmallVectorImpl &Ops) { assert(!Ops.empty() && "Cannot get empty smax!"); if (Ops.size() == 1) return Ops[0]; #ifndef NDEBUG @@ -1668,13 +1671,14 @@ SCEVHandle ScalarEvolution::getUMaxExpr(const SCEVHandle &LHS, const SCEVHandle &RHS) { - std::vector Ops; + SmallVector Ops; Ops.push_back(LHS); Ops.push_back(RHS); return getUMaxExpr(Ops); } -SCEVHandle ScalarEvolution::getUMaxExpr(std::vector Ops) { +SCEVHandle +ScalarEvolution::getUMaxExpr(SmallVectorImpl &Ops) { assert(!Ops.empty() && "Cannot get empty umax!"); if (Ops.size() == 1) return Ops[0]; #ifndef NDEBUG @@ -2040,7 +2044,7 @@ if (FoundIndex != Add->getNumOperands()) { // Create an add with everything but the specified operand. - std::vector Ops; + SmallVector Ops; for (unsigned i = 0, e = Add->getNumOperands(); i != e; ++i) if (i != FoundIndex) Ops.push_back(Add->getOperand(i)); @@ -3074,7 +3078,7 @@ if (OpAtScope != Comm->getOperand(i)) { // Okay, at least one of these operands is loop variant but might be // foldable. Build a new instance of the folded commutative expression. - std::vector NewOps(Comm->op_begin(), Comm->op_begin()+i); + SmallVector NewOps(Comm->op_begin(), Comm->op_begin()+i); NewOps.push_back(OpAtScope); for (++i; i != e; ++i) { @@ -3611,7 +3615,7 @@ // If the start is a non-zero constant, shift the range to simplify things. if (const SCEVConstant *SC = dyn_cast(getStart())) if (!SC->getValue()->isZero()) { - std::vector Operands(op_begin(), op_end()); + SmallVector Operands(op_begin(), op_end()); Operands[0] = SE.getIntegerSCEV(0, SC->getType()); SCEVHandle Shifted = SE.getAddRecExpr(Operands, getLoop()); if (const SCEVAddRecExpr *ShiftedAddRec = @@ -3672,7 +3676,7 @@ // quadratic equation to solve it. To do this, we must frame our problem in // terms of figuring out when zero is crossed, instead of when // Range.getUpper() is crossed. - std::vector NewOps(op_begin(), op_end()); + SmallVector NewOps(op_begin(), op_end()); NewOps[0] = SE.getNegativeSCEV(SE.getConstant(Range.getUpper())); SCEVHandle NewAddRec = SE.getAddRecExpr(NewOps, getLoop()); Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=73357&r1=73356&r2=73357&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Sun Jun 14 17:47:23 2009 @@ -182,7 +182,8 @@ if (const SCEVMulExpr *M = dyn_cast(S)) if (const SCEVConstant *C = dyn_cast(M->getOperand(0))) if (!C->getValue()->getValue().srem(Factor)) { - std::vector NewMulOps(M->getOperands()); + const SmallVectorImpl &MOperands = M->getOperands(); + SmallVector NewMulOps(MOperands.begin(), MOperands.end()); NewMulOps[0] = SE.getConstant(C->getValue()->getValue().sdiv(Factor)); S = SE.getMulExpr(NewMulOps); @@ -239,7 +240,7 @@ Value *V) { const Type *ElTy = PTy->getElementType(); SmallVector GepIndices; - std::vector Ops(op_begin, op_end); + SmallVector Ops(op_begin, op_end); bool AnyNonZeroIndices = false; // Decend down the pointer's type and attempt to convert the other @@ -250,8 +251,8 @@ for (;;) { APInt ElSize = APInt(SE.getTypeSizeInBits(Ty), ElTy->isSized() ? SE.TD->getTypeAllocSize(ElTy) : 0); - std::vector NewOps; - std::vector ScaledOps; + SmallVector NewOps; + SmallVector ScaledOps; for (unsigned i = 0, e = Ops.size(); i != e; ++i) { // Split AddRecs up into parts as either of the parts may be usable // without the other. @@ -365,7 +366,7 @@ // comments on expandAddToGEP for details. if (SE.TD) if (const PointerType *PTy = dyn_cast(V->getType())) { - const std::vector &Ops = S->getOperands(); + const SmallVectorImpl &Ops = S->getOperands(); return expandAddToGEP(&Ops[0], &Ops[Ops.size() - 1], PTy, Ty, V); } @@ -432,7 +433,7 @@ } if (const SCEVAddExpr *A = dyn_cast(Base)) { Base = A->getOperand(A->getNumOperands()-1); - std::vector NewAddOps(A->op_begin(), A->op_end()); + SmallVector NewAddOps(A->op_begin(), A->op_end()); NewAddOps.back() = Rest; Rest = SE.getAddExpr(NewAddOps); ExposePointerBase(Base, Rest, SE); @@ -473,7 +474,8 @@ // {X,+,F} --> X + {0,+,F} if (!S->getStart()->isZero()) { - std::vector NewOps(S->getOperands()); + const SmallVectorImpl &SOperands = S->getOperands(); + SmallVector NewOps(SOperands.begin(), SOperands.end()); NewOps[0] = SE.getIntegerSCEV(0, Ty); SCEVHandle Rest = SE.getAddRecExpr(NewOps, L); Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=73357&r1=73356&r2=73357&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sun Jun 14 17:47:23 2009 @@ -592,7 +592,7 @@ if (Val->isLoopInvariant(L)) return; // Nothing to do. if (const SCEVAddExpr *SAE = dyn_cast(Val)) { - std::vector NewOps; + SmallVector NewOps; NewOps.reserve(SAE->getNumOperands()); for (unsigned i = 0; i != SAE->getNumOperands(); ++i) @@ -613,7 +613,7 @@ SCEVHandle Start = SARE->getStart(); MoveLoopVariantsToImmediateField(Start, Imm, L, SE); - std::vector Ops(SARE->op_begin(), SARE->op_end()); + SmallVector Ops(SARE->op_begin(), SARE->op_end()); Ops[0] = Start; Val = SE->getAddRecExpr(Ops, SARE->getLoop()); } else { @@ -633,7 +633,7 @@ bool isAddress, Loop *L, ScalarEvolution *SE) { if (const SCEVAddExpr *SAE = dyn_cast(Val)) { - std::vector NewOps; + SmallVector NewOps; NewOps.reserve(SAE->getNumOperands()); for (unsigned i = 0; i != SAE->getNumOperands(); ++i) { @@ -660,7 +660,7 @@ MoveImmediateValues(TLI, AccessTy, Start, Imm, isAddress, L, SE); if (Start != SARE->getStart()) { - std::vector Ops(SARE->op_begin(), SARE->op_end()); + SmallVector Ops(SARE->op_begin(), SARE->op_end()); Ops[0] = Start; Val = SE->getAddRecExpr(Ops, SARE->getLoop()); } @@ -717,7 +717,7 @@ /// SeparateSubExprs - Decompose Expr into all of the subexpressions that are /// added together. This is used to reassociate common addition subexprs /// together for maximal sharing when rewriting bases. -static void SeparateSubExprs(std::vector &SubExprs, +static void SeparateSubExprs(SmallVector &SubExprs, SCEVHandle Expr, ScalarEvolution *SE) { if (const SCEVAddExpr *AE = dyn_cast(Expr)) { @@ -729,7 +729,7 @@ SubExprs.push_back(Expr); } else { // Compute the addrec with zero as its base. - std::vector Ops(SARE->op_begin(), SARE->op_end()); + SmallVector Ops(SARE->op_begin(), SARE->op_end()); Ops[0] = Zero; // Start with zero base. SubExprs.push_back(SE->getAddRecExpr(Ops, SARE->getLoop())); @@ -783,9 +783,9 @@ // UniqueSubExprs - Keep track of all of the subexpressions we see in the // order we see them. - std::vector UniqueSubExprs; + SmallVector UniqueSubExprs; - std::vector SubExprs; + SmallVector SubExprs; unsigned NumUsesInsideLoop = 0; for (unsigned i = 0; i != NumUses; ++i) { // If the user is outside the loop, just ignore it for base computation. From gohman at apple.com Sun Jun 14 17:51:25 2009 From: gohman at apple.com (Dan Gohman) Date: Sun, 14 Jun 2009 22:51:25 -0000 Subject: [llvm-commits] [llvm] r73358 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp Message-ID: <200906142251.n5EMpPvv015229@zion.cs.uiuc.edu> Author: djg Date: Sun Jun 14 17:51:25 2009 New Revision: 73358 URL: http://llvm.org/viewvc/llvm-project?rev=73358&view=rev Log: Do compare constant SCEV values in SCEVComplexityCompare, because even though the order doesn't matter at the top level of an expression, it does matter when the constant is a subexpression of an n-ary expression, because n-ary expressions are sorted lexicographically. Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=73358&r1=73357&r2=73358&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun Jun 14 17:51:25 2009 @@ -504,9 +504,18 @@ return false; } - // Constant sorting doesn't matter since they'll be folded. - if (isa(LHS)) - return false; + // Compare constant values. + if (const SCEVConstant *LC = dyn_cast(LHS)) { + const SCEVConstant *RC = cast(RHS); + return LC->getValue()->getValue().ult(RC->getValue()->getValue()); + } + + // Compare addrec loop depths. + if (const SCEVAddRecExpr *LA = dyn_cast(LHS)) { + const SCEVAddRecExpr *RA = cast(RHS); + if (LA->getLoop()->getLoopDepth() != RA->getLoop()->getLoopDepth()) + return LA->getLoop()->getLoopDepth() < RA->getLoop()->getLoopDepth(); + } // Lexicographically compare n-ary expressions. if (const SCEVNAryExpr *LC = dyn_cast(LHS)) { From gohman at apple.com Sun Jun 14 17:53:58 2009 From: gohman at apple.com (Dan Gohman) Date: Sun, 14 Jun 2009 22:53:58 -0000 Subject: [llvm-commits] [llvm] r73359 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp Message-ID: <200906142253.n5EMrwsb015303@zion.cs.uiuc.edu> Author: djg Date: Sun Jun 14 17:53:57 2009 New Revision: 73359 URL: http://llvm.org/viewvc/llvm-project?rev=73359&view=rev Log: Check for the short-circuiting condition before performing the potentially expensive erase. Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=73359&r1=73358&r2=73359&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun Jun 14 17:53:57 2009 @@ -1012,8 +1012,8 @@ // We found two constants, fold them together! Ops[0] = getConstant(LHSC->getValue()->getValue() + RHSC->getValue()->getValue()); + if (Ops.size() == 2) return Ops[0]; Ops.erase(Ops.begin()+1); // Erase the folded element - if (Ops.size() == 1) return Ops[0]; LHSC = cast(Ops[0]); } From gohman at apple.com Sun Jun 14 17:55:07 2009 From: gohman at apple.com (Dan Gohman) Date: Sun, 14 Jun 2009 22:55:07 -0000 Subject: [llvm-commits] [llvm] r73360 - /llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Message-ID: <200906142255.n5EMt8uK015343@zion.cs.uiuc.edu> Author: djg Date: Sun Jun 14 17:55:07 2009 New Revision: 73360 URL: http://llvm.org/viewvc/llvm-project?rev=73360&view=rev Log: Specialize DenseMapInfo for SCEVHandle, so that SCEVHandles can be used as keys in DenseMaps. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=73360&r1=73359&r2=73360&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Sun Jun 14 17:55:07 2009 @@ -25,6 +25,7 @@ #include "llvm/Analysis/LoopInfo.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/ValueHandle.h" +#include "llvm/ADT/DenseMap.h" #include namespace llvm { @@ -34,6 +35,7 @@ class SCEVHandle; class ScalarEvolution; class TargetData; + template<> struct DenseMapInfo; /// SCEV - This class represents an analyzed expression in the program. These /// are reference-counted opaque objects that the client is not allowed to @@ -44,6 +46,7 @@ mutable unsigned RefCount; friend class SCEVHandle; + friend class DenseMapInfo; void addRef() const { ++RefCount; } void dropRef() const { if (--RefCount == 0) @@ -197,6 +200,31 @@ template<> struct simplify_type : public simplify_type {}; + // Specialize DenseMapInfo for SCEVHandle so that SCEVHandle may be used + // as a key in DenseMaps. + template<> + struct DenseMapInfo { + static inline SCEVHandle getEmptyKey() { + static SCEVCouldNotCompute Empty; + if (Empty.RefCount == 0) + Empty.addRef(); + return &Empty; + } + static inline SCEVHandle getTombstoneKey() { + static SCEVCouldNotCompute Tombstone; + if (Tombstone.RefCount == 0) + Tombstone.addRef(); + return &Tombstone; + } + static unsigned getHashValue(const SCEVHandle &Val) { + return DenseMapInfo::getHashValue(Val); + } + static bool isEqual(const SCEVHandle &LHS, const SCEVHandle &RHS) { + return LHS == RHS; + } + static bool isPod() { return false; } + }; + /// ScalarEvolution - This class is the main scalar evolution driver. Because /// client code (intentionally) can't do much with the SCEV objects directly, /// they must ask this class for services. From gohman at apple.com Sun Jun 14 17:58:51 2009 From: gohman at apple.com (Dan Gohman) Date: Sun, 14 Jun 2009 22:58:51 -0000 Subject: [llvm-commits] [llvm] r73361 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Transforms/IndVarSimplify/pointer.ll Message-ID: <200906142258.n5EMwpYJ015444@zion.cs.uiuc.edu> Author: djg Date: Sun Jun 14 17:58:51 2009 New Revision: 73361 URL: http://llvm.org/viewvc/llvm-project?rev=73361&view=rev Log: Implement more aggressive folding of add operand lists when they contain multiplications of constants with add operations. This helps simplify several kinds of things; in particular it helps simplify expressions like ((-1 * (%a + %b)) + %a) to %b, as expressions like this often come up in loop trip count computations. Added: llvm/trunk/test/Transforms/IndVarSimplify/pointer.ll Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=73361&r1=73360&r2=73361&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun Jun 14 17:58:51 2009 @@ -988,6 +988,102 @@ return ZExt; } +/// CollectAddOperandsWithScales - Process the given Ops list, which is +/// a list of operands to be added under the given scale, update the given +/// map. This is a helper function for getAddRecExpr. As an example of +/// what it does, given a sequence of operands that would form an add +/// expression like this: +/// +/// m + n + 13 + (A * (o + p + (B * q + m + 29))) + r + (-1 * r) +/// +/// where A and B are constants, update the map with these values: +/// +/// (m, 1+A*B), (n, 1), (o, A), (p, A), (q, A*B), (r, 0) +/// +/// and add 13 + A*B*29 to AccumulatedConstant. +/// This will allow getAddRecExpr to produce this: +/// +/// 13+A*B*29 + n + (m * (1+A*B)) + ((o + p) * A) + (q * A*B) +/// +/// This form often exposes folding opportunities that are hidden in +/// the original operand list. +/// +/// Return true iff it appears that any interesting folding opportunities +/// may be exposed. This helps getAddRecExpr short-circuit extra work in +/// the common case where no interesting opportunities are present, and +/// is also used as a check to avoid infinite recursion. +/// +static bool +CollectAddOperandsWithScales(DenseMap &M, + SmallVector &NewOps, + APInt &AccumulatedConstant, + const SmallVectorImpl &Ops, + const APInt &Scale, + ScalarEvolution &SE) { + bool Interesting = false; + + // Iterate over the add operands. + for (unsigned i = 0, e = Ops.size(); i != e; ++i) { + const SCEVMulExpr *Mul = dyn_cast(Ops[i]); + if (Mul && isa(Mul->getOperand(0))) { + APInt NewScale = + Scale * cast(Mul->getOperand(0))->getValue()->getValue(); + if (Mul->getNumOperands() == 2 && isa(Mul->getOperand(1))) { + // A multiplication of a constant with another add; recurse. + Interesting |= + CollectAddOperandsWithScales(M, NewOps, AccumulatedConstant, + cast(Mul->getOperand(1)) + ->getOperands(), + NewScale, SE); + } else { + // A multiplication of a constant with some other value. Update + // the map. + SmallVector MulOps(Mul->op_begin()+1, Mul->op_end()); + SCEVHandle Key = SE.getMulExpr(MulOps); + std::pair::iterator, bool> Pair = + M.insert(std::make_pair(Key, APInt())); + if (Pair.second) { + Pair.first->second = NewScale; + NewOps.push_back(Pair.first->first); + } else { + Pair.first->second += NewScale; + // The map already had an entry for this value, which may indicate + // a folding opportunity. + Interesting = true; + } + } + } else if (const SCEVConstant *C = dyn_cast(Ops[i])) { + // Pull a buried constant out to the outside. + if (Scale != 1 || AccumulatedConstant != 0 || C->isZero()) + Interesting = true; + AccumulatedConstant += Scale * C->getValue()->getValue(); + } else { + // An ordinary operand. Update the map. + std::pair::iterator, bool> Pair = + M.insert(std::make_pair(Ops[i], APInt())); + if (Pair.second) { + Pair.first->second = Scale; + NewOps.push_back(Pair.first->first); + } else { + Pair.first->second += Scale; + // The map already had an entry for this value, which may indicate + // a folding opportunity. + Interesting = true; + } + } + } + + return Interesting; +} + +namespace { + struct APIntCompare { + bool operator()(const APInt &LHS, const APInt &RHS) const { + return LHS.ult(RHS); + } + }; +} + /// getAddExpr - Get a canonical add expression, or something simpler if /// possible. SCEVHandle ScalarEvolution::getAddExpr(SmallVectorImpl &Ops) { @@ -1128,6 +1224,38 @@ while (Idx < Ops.size() && Ops[Idx]->getSCEVType() < scMulExpr) ++Idx; + // Check to see if there are any folding opportunities present with + // operands multiplied by constant values. + if (Idx < Ops.size() && isa(Ops[Idx])) { + uint64_t BitWidth = getTypeSizeInBits(Ty); + DenseMap M; + SmallVector NewOps; + APInt AccumulatedConstant(BitWidth, 0); + if (CollectAddOperandsWithScales(M, NewOps, AccumulatedConstant, + Ops, APInt(BitWidth, 1), *this)) { + // Some interesting folding opportunity is present, so its worthwhile to + // re-generate the operands list. Group the operands by constant scale, + // to avoid multiplying by the same constant scale multiple times. + std::map, APIntCompare> MulOpLists; + for (SmallVector::iterator I = NewOps.begin(), + E = NewOps.end(); I != E; ++I) + MulOpLists[M.find(*I)->second].push_back(*I); + // Re-generate the operands list. + Ops.clear(); + if (AccumulatedConstant != 0) + Ops.push_back(getConstant(AccumulatedConstant)); + for (std::map, APIntCompare>::iterator I = + MulOpLists.begin(), E = MulOpLists.end(); I != E; ++I) + if (I->first != 0) + Ops.push_back(getMulExpr(getConstant(I->first), getAddExpr(I->second))); + if (Ops.empty()) + return getIntegerSCEV(0, Ty); + if (Ops.size() == 1) + return Ops[0]; + return getAddExpr(Ops); + } + } + // If we are adding something to a multiply expression, make sure the // something is not already an operand of the multiply. If so, merge it into // the multiply. Added: llvm/trunk/test/Transforms/IndVarSimplify/pointer.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/IndVarSimplify/pointer.ll?rev=73361&view=auto ============================================================================== --- llvm/trunk/test/Transforms/IndVarSimplify/pointer.ll (added) +++ llvm/trunk/test/Transforms/IndVarSimplify/pointer.ll Sun Jun 14 17:58:51 2009 @@ -0,0 +1,38 @@ +; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t +; RUN: grep {%exitcond = icmp eq i64 %indvar.next, %n} %t +; RUN: grep {getelementptr i8\\* %A, i64 %indvar} %t +; RUN: grep getelementptr %t | count 1 +; RUN: grep add %t | count 1 +; RUN: not grep scevgep %t +; RUN: not grep ptrtoint %t + +; Indvars should be able to expand the pointer-arithmetic +; IV into an integer IV indexing into a simple getelementptr. + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" + +define void @foo(i8* %A, i64 %n) nounwind { +entry: + %0 = icmp eq i64 %n, 0 ; [#uses=1] + br i1 %0, label %return, label %bb.nph + +bb.nph: ; preds = %entry + %1 = getelementptr i8* %A, i64 %n ; [#uses=1] + br label %bb + +bb: ; preds = %bb1, %bb.nph + %q.01 = phi i8* [ %2, %bb1 ], [ %A, %bb.nph ] ; [#uses=2] + store i8 0, i8* %q.01, align 1 + %2 = getelementptr i8* %q.01, i64 1 ; [#uses=2] + br label %bb1 + +bb1: ; preds = %bb + %3 = icmp eq i8* %1, %2 ; [#uses=1] + br i1 %3, label %bb1.return_crit_edge, label %bb + +bb1.return_crit_edge: ; preds = %bb1 + br label %return + +return: ; preds = %bb1.return_crit_edge, %entry + ret void +} From gohman at apple.com Sun Jun 14 18:30:43 2009 From: gohman at apple.com (Dan Gohman) Date: Sun, 14 Jun 2009 23:30:43 -0000 Subject: [llvm-commits] [llvm] r73362 - in /llvm/trunk: include/llvm/Transforms/Scalar.h lib/Analysis/DebugInfo.cpp lib/AsmParser/LLParser.cpp lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Target/Alpha/AlphaISelLowering.cpp lib/Transforms/IPO/RaiseAllocations.cpp lib/Transforms/Scalar/CodeGenPrepare.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/Transforms/Utils/LowerAllocations.cpp lib/VMCore/Instructions.cpp Message-ID: <200906142330.n5ENUh2W016413@zion.cs.uiuc.edu> Author: djg Date: Sun Jun 14 18:30:43 2009 New Revision: 73362 URL: http://llvm.org/viewvc/llvm-project?rev=73362&view=rev Log: Fix old-style type names in comments. Modified: llvm/trunk/include/llvm/Transforms/Scalar.h llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/AsmParser/LLParser.cpp llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp llvm/trunk/lib/VMCore/Instructions.cpp Modified: llvm/trunk/include/llvm/Transforms/Scalar.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar.h?rev=73362&r1=73361&r2=73362&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Scalar.h (original) +++ llvm/trunk/include/llvm/Transforms/Scalar.h Sun Jun 14 18:30:43 2009 @@ -143,10 +143,10 @@ // this pass is: // // FROM CODE TO CODE -// %X = alloca int, uint 1 ret int 42 -// store int 42, int *%X -// %Y = load int* %X -// ret int %Y +// %X = alloca i32, i32 1 ret i32 42 +// store i32 42, i32 *%X +// %Y = load i32* %X +// ret i32 %Y // FunctionPass *createPromoteMemoryToRegisterPass(); extern const PassInfo *const PromoteMemoryToRegisterID; Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=73362&r1=73361&r2=73362&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Sun Jun 14 18:30:43 2009 @@ -352,7 +352,7 @@ const PointerType *DestTy = PointerType::getUnqual(Type::Int8Ty); - // If empty string then use a sbyte* null instead. + // If empty string then use a i8* null instead. if (String.empty()) return Slot = ConstantPointerNull::get(DestTy); Modified: llvm/trunk/lib/AsmParser/LLParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=73362&r1=73361&r2=73362&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLParser.cpp (original) +++ llvm/trunk/lib/AsmParser/LLParser.cpp Sun Jun 14 18:30:43 2009 @@ -3145,7 +3145,7 @@ } /// ParseLoad -/// ::= 'volatile'? 'load' TypeAndValue (',' 'align' uint)? +/// ::= 'volatile'? 'load' TypeAndValue (',' 'align' i32)? bool LLParser::ParseLoad(Instruction *&Inst, PerFunctionState &PFS, bool isVolatile) { Value *Val; LocTy Loc; @@ -3163,7 +3163,7 @@ } /// ParseStore -/// ::= 'volatile'? 'store' TypeAndValue ',' TypeAndValue (',' 'align' uint)? +/// ::= 'volatile'? 'store' TypeAndValue ',' TypeAndValue (',' 'align' i32)? bool LLParser::ParseStore(Instruction *&Inst, PerFunctionState &PFS, bool isVolatile) { Value *Val, *Ptr; LocTy Loc, PtrLoc; @@ -3186,7 +3186,7 @@ } /// ParseGetResult -/// ::= 'getresult' TypeAndValue ',' uint +/// ::= 'getresult' TypeAndValue ',' i32 /// FIXME: Remove support for getresult in LLVM 3.0 bool LLParser::ParseGetResult(Instruction *&Inst, PerFunctionState &PFS) { Value *Val; LocTy ValLoc, EltLoc; Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=73362&r1=73361&r2=73362&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Sun Jun 14 18:30:43 2009 @@ -502,7 +502,7 @@ void AsmPrinter::EmitLLVMUsedList(Constant *List) { const char *Directive = TAI->getUsedDirective(); - // Should be an array of 'sbyte*'. + // Should be an array of 'i8*'. ConstantArray *InitList = dyn_cast(List); if (InitList == 0) return; Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=73362&r1=73361&r2=73362&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Sun Jun 14 18:30:43 2009 @@ -39,7 +39,7 @@ AlphaTargetLowering::AlphaTargetLowering(TargetMachine &TM) : TargetLowering(TM) { // Set up the TargetLowering object. - //I am having problems with shr n ubyte 1 + //I am having problems with shr n i8 1 setShiftAmountType(MVT::i64); setBooleanContents(ZeroOrOneBooleanContent); Modified: llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp?rev=73362&r1=73361&r2=73362&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp Sun Jun 14 18:30:43 2009 @@ -82,14 +82,14 @@ // Chck to see if we got the expected malloc if (TyWeHave != Malloc1Type) { - // Check to see if the prototype is wrong, giving us sbyte*(uint) * malloc + // Check to see if the prototype is wrong, giving us i8*(i32) * malloc // This handles the common declaration of: 'void *malloc(unsigned);' const FunctionType *Malloc2Type = FunctionType::get(PointerType::getUnqual(Type::Int8Ty), std::vector(1, Type::Int32Ty), false); if (TyWeHave != Malloc2Type) { // Check to see if the prototype is missing, giving us - // sbyte*(...) * malloc + // i8*(...) * malloc // This handles the common declaration of: 'void *malloc();' const FunctionType *Malloc3Type = FunctionType::get(PointerType::getUnqual(Type::Int8Ty), Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=73362&r1=73361&r2=73362&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Sun Jun 14 18:30:43 2009 @@ -401,8 +401,8 @@ /// OptimizeNoopCopyExpression - If the specified cast instruction is a noop -/// copy (e.g. it's casting from one pointer type to another, int->uint, or -/// int->sbyte on PPC), sink it into user blocks to reduce the number of virtual +/// copy (e.g. it's casting from one pointer type to another, i32->i8 on PPC), +/// sink it into user blocks to reduce the number of virtual /// registers that must be created and coalesced. /// /// Return true if any changes are made. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=73362&r1=73361&r2=73362&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun Jun 14 18:30:43 2009 @@ -2290,7 +2290,7 @@ } // add (cast *A to intptrtype) B -> - // cast (GEP (cast *A to sbyte*) B) --> intptrtype + // cast (GEP (cast *A to i8*) B) --> intptrtype { CastInst *CI = dyn_cast(LHS); Value *Other = RHS; @@ -7133,10 +7133,10 @@ if (Res2 == CI) { // Make sure that sign of the Cmp and the sign of the Cast are the same. // For example, we might have: - // %A = sext short %X to uint - // %B = icmp ugt uint %A, 1330 + // %A = sext i16 %X to i32 + // %B = icmp ugt i32 %A, 1330 // It is incorrect to transform this into - // %B = icmp ugt short %X, 1330 + // %B = icmp ugt i16 %X, 1330 // because %A may have negative value. // // However, we allow this when the compare is EQ/NE, because they are @@ -7273,8 +7273,8 @@ // purpose is to compute bits we don't care about. uint32_t TypeBits = Op0->getType()->getPrimitiveSizeInBits(); - // shl uint X, 32 = 0 and shr ubyte Y, 9 = 0, ... just don't eliminate shr - // of a signed value. + // shl i32 X, 32 = 0 and srl i8 Y, 9 = 0, ... just don't eliminate + // a signed shift. // if (Op1->uge(TypeBits)) { if (I.getOpcode() != Instruction::AShr) Modified: llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp?rev=73362&r1=73361&r2=73362&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp Sun Jun 14 18:30:43 2009 @@ -112,7 +112,7 @@ if (MallocInst *MI = dyn_cast(I)) { const Type *AllocTy = MI->getType()->getElementType(); - // malloc(type) becomes sbyte *malloc(size) + // malloc(type) becomes i8 *malloc(size) Value *MallocArg; if (LowerMallocArgToInteger) MallocArg = ConstantInt::get(Type::Int64Ty, Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=73362&r1=73361&r2=73362&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Sun Jun 14 18:30:43 2009 @@ -1310,7 +1310,7 @@ return false;// Second operand of insertelement must be vector element type. if (Index->getType() != Type::Int32Ty) - return false; // Third operand of insertelement must be uint. + return false; // Third operand of insertelement must be i32. return true; } @@ -1880,8 +1880,8 @@ // BITCONVERT = FirstClass n/a FirstClass n/a // // NOTE: some transforms are safe, but we consider them to be non-profitable. - // For example, we could merge "fptoui double to uint" + "zext uint to ulong", - // into "fptoui double to ulong", but this loses information about the range + // For example, we could merge "fptoui double to i32" + "zext i32 to i64", + // into "fptoui double to i64", but this loses information about the range // of the produced value (we no longer know the top-part is all zeros). // Further this conversion is often much more expensive for typical hardware, // and causes issues when building libgcc. We disallow fptosi+sext for the From gohman at apple.com Sun Jun 14 18:50:46 2009 From: gohman at apple.com (Dan Gohman) Date: Sun, 14 Jun 2009 16:50:46 -0700 Subject: [llvm-commits] [PATCH] work around a nasty g++/glibc incompatiblity In-Reply-To: <4A34D70D.6050200@googlemail.com> References: <4A34D70D.6050200@googlemail.com> Message-ID: <1A0039DD-7080-494C-B7B0-CF379B445278@apple.com> On Jun 14, 2009, at 3:55 AM, Benjamin Kramer wrote: > T?r?k Edwin wrote: >> The GNU version always returns a pointer to the error message, it >> may or >> may not use the buffer supplied. >> (I think it doesn't use the buffer if it can return a pointer to the >> error message table). >> Accessing the returned pointer is thread safe in either case, so you >> could check if the returned value == buffer, and if not copy it to >> buffer. It would still be thread safe. Instead of copying the string into the buffer for the GLIBC case, could you add a new char* variable at the top of the function and assign to it the address of the buffer, and make the std::string construction at the bottom use that variable instead of the buffer? Then, the glibc case could just reassign the char* variable. Also, please make the test be defined(__GLIBC__) && defined(_GNU_SOURCE) because _GNU_SOURCE sometimes ends up defined on non-GLIBC systems. Thanks, Dan From sabre at nondot.org Sun Jun 14 23:01:41 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jun 2009 04:01:41 -0000 Subject: [llvm-commits] [llvm] r73366 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200906150401.n5F41f67025124@zion.cs.uiuc.edu> Author: lattner Date: Sun Jun 14 23:01:39 2009 New Revision: 73366 URL: http://llvm.org/viewvc/llvm-project?rev=73366&view=rev Log: implement support for the 'K' asm constraint, PR4347 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=73366&r1=73365&r2=73366&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Jun 14 23:01:39 2009 @@ -8468,6 +8468,14 @@ return; case 'J': if (ConstantSDNode *C = dyn_cast(Op)) { + if ((int8_t)C->getSExtValue() == C->getSExtValue()) { + Result = DAG.getTargetConstant(C->getZExtValue(), Op.getValueType()); + break; + } + } + return; + case 'K': + if (ConstantSDNode *C = dyn_cast(Op)) { if (C->getZExtValue() <= 63) { Result = DAG.getTargetConstant(C->getZExtValue(), Op.getValueType()); break; From eli.friedman at gmail.com Sun Jun 14 23:16:38 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Sun, 14 Jun 2009 21:16:38 -0700 Subject: [llvm-commits] [llvm] r73366 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <200906150401.n5F41f67025124@zion.cs.uiuc.edu> References: <200906150401.n5F41f67025124@zion.cs.uiuc.edu> Message-ID: On Sun, Jun 14, 2009 at 9:01 PM, Chris Lattner wrote: > @@ -8468,6 +8468,14 @@ > ? ? return; > ? case 'J': > ? ? if (ConstantSDNode *C = dyn_cast(Op)) { > + ? ? ?if ((int8_t)C->getSExtValue() == C->getSExtValue()) { > + ? ? ? ?Result = DAG.getTargetConstant(C->getZExtValue(), Op.getValueType()); > + ? ? ? ?break; > + ? ? ?} > + ? ?} > + ? ?return; > + ?case 'K': > + ? ?if (ConstantSDNode *C = dyn_cast(Op)) { > ? ? ? if (C->getZExtValue() <= 63) { > ? ? ? ? Result = DAG.getTargetConstant(C->getZExtValue(), Op.getValueType()); > ? ? ? ? break; Isn't this mixing up the 'J' and 'K' constraints? -Eli From sabre at nondot.org Sun Jun 14 23:17:07 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jun 2009 04:17:07 -0000 Subject: [llvm-commits] [llvm] r73368 - in /llvm/trunk: include/llvm/System/Path.h lib/System/Unix/Path.inc lib/System/Win32/Path.inc Message-ID: <200906150417.n5F4H7RW025657@zion.cs.uiuc.edu> Author: lattner Date: Sun Jun 14 23:17:07 2009 New Revision: 73368 URL: http://llvm.org/viewvc/llvm-project?rev=73368&view=rev Log: add a new static method to portably determine whether a patch is absolute or not, based on a patch by Gregory Curfman! Modified: llvm/trunk/include/llvm/System/Path.h llvm/trunk/lib/System/Unix/Path.inc llvm/trunk/lib/System/Win32/Path.inc Modified: llvm/trunk/include/llvm/System/Path.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Path.h?rev=73368&r1=73367&r2=73368&view=diff ============================================================================== --- llvm/trunk/include/llvm/System/Path.h (original) +++ llvm/trunk/include/llvm/System/Path.h Sun Jun 14 23:17:07 2009 @@ -309,6 +309,11 @@ /// @brief Determine if the path is absolute. bool isAbsolute() const; + /// This function determines if the path name is absolute, as opposed to + /// relative. + /// @brief Determine if the path is absolute. + static bool isAbsolute(const char *NameStart, unsigned NameLen); + /// This function opens the file associated with the path name provided by /// the Path object and reads its magic number. If the magic number at the /// start of the file matches \p magic, true is returned. In all other Modified: llvm/trunk/lib/System/Unix/Path.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=73368&r1=73367&r2=73368&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Path.inc (original) +++ llvm/trunk/lib/System/Unix/Path.inc Sun Jun 14 23:17:07 2009 @@ -104,6 +104,14 @@ } bool +Path::isAbsolute(const char *NameStart, unsigned NameLen) { + assert(NameStart); + if (NameLen == 0) + return false; + return NameStart[0] == '/'; +} + +bool Path::isAbsolute() const { if (path.empty()) return false; Modified: llvm/trunk/lib/System/Win32/Path.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Path.inc?rev=73368&r1=73367&r2=73368&view=diff ============================================================================== --- llvm/trunk/lib/System/Win32/Path.inc (original) +++ llvm/trunk/lib/System/Win32/Path.inc Sun Jun 14 23:17:07 2009 @@ -125,6 +125,20 @@ return true; } +bool +Path::isAbsolute(const char *NameStart, unsigned NameLen) { + assert(NameStart); + switch (NameLen) { + case 0: + return false; + case 1: + case 2: + return NameStart[0] == '/'; + default: + return NameStart[0] == '/' || (NameStart[1] == ':' && NameStart[2] == '/'); + } +} + bool Path::isAbsolute() const { switch (path.length()) { From sabre at nondot.org Sun Jun 14 23:18:54 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jun 2009 04:18:54 -0000 Subject: [llvm-commits] [llvm] r73369 - /llvm/trunk/docs/DeveloperPolicy.html Message-ID: <200906150418.n5F4IsAh025822@zion.cs.uiuc.edu> Author: lattner Date: Sun Jun 14 23:18:54 2009 New Revision: 73369 URL: http://llvm.org/viewvc/llvm-project?rev=73369&view=rev Log: remove some old CVS-specific arguments that don't work with SVN. Modified: llvm/trunk/docs/DeveloperPolicy.html Modified: llvm/trunk/docs/DeveloperPolicy.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/DeveloperPolicy.html?rev=73369&r1=73368&r2=73369&view=diff ============================================================================== --- llvm/trunk/docs/DeveloperPolicy.html (original) +++ llvm/trunk/docs/DeveloperPolicy.html Sun Jun 14 23:18:54 2009 @@ -108,7 +108,7 @@
  • Patches should be made with this command:
    -svn diff -x -u
    +svn diff
     
    or with the utility utils/mkpatch, which makes it easy to read From eli.friedman at gmail.com Sun Jun 14 23:22:29 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Sun, 14 Jun 2009 21:22:29 -0700 Subject: [llvm-commits] [llvm] r73369 - /llvm/trunk/docs/DeveloperPolicy.html In-Reply-To: <200906150418.n5F4IsAh025822@zion.cs.uiuc.edu> References: <200906150418.n5F4IsAh025822@zion.cs.uiuc.edu> Message-ID: On Sun, Jun 14, 2009 at 9:18 PM, Chris Lattner wrote: > Author: lattner > Date: Sun Jun 14 23:18:54 2009 > New Revision: 73369 > > URL: http://llvm.org/viewvc/llvm-project?rev=73369&view=rev > Log: > remove some old CVS-specific arguments that don't work with SVN. Actually, it works, but it doesn't do anything :) -Eli From sabre at nondot.org Sun Jun 14 23:39:05 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jun 2009 04:39:05 -0000 Subject: [llvm-commits] [llvm] r73372 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200906150439.n5F4d5NM026780@zion.cs.uiuc.edu> Author: lattner Date: Sun Jun 14 23:39:05 2009 New Revision: 73372 URL: http://llvm.org/viewvc/llvm-project?rev=73372&view=rev Log: I got J and K backward, many thanks to Eli for spotting this! 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=73372&r1=73371&r2=73372&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Jun 14 23:39:05 2009 @@ -8468,7 +8468,7 @@ return; case 'J': if (ConstantSDNode *C = dyn_cast(Op)) { - if ((int8_t)C->getSExtValue() == C->getSExtValue()) { + if (C->getZExtValue() <= 63) { Result = DAG.getTargetConstant(C->getZExtValue(), Op.getValueType()); break; } @@ -8476,7 +8476,7 @@ return; case 'K': if (ConstantSDNode *C = dyn_cast(Op)) { - if (C->getZExtValue() <= 63) { + if ((int8_t)C->getSExtValue() == C->getSExtValue()) { Result = DAG.getTargetConstant(C->getZExtValue(), Op.getValueType()); break; } From clattner at apple.com Sun Jun 14 23:39:14 2009 From: clattner at apple.com (Chris Lattner) Date: Sun, 14 Jun 2009 21:39:14 -0700 Subject: [llvm-commits] [llvm] r73366 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp In-Reply-To: References: <200906150401.n5F41f67025124@zion.cs.uiuc.edu> Message-ID: <93191CA7-A68C-4106-B42F-9DC9917802D4@apple.com> On Jun 14, 2009, at 9:16 PM, Eli Friedman wrote: > On Sun, Jun 14, 2009 at 9:01 PM, Chris Lattner > wrote: >> @@ -8468,6 +8468,14 @@ >> return; >> case 'J': >> if (ConstantSDNode *C = dyn_cast(Op)) { >> + if ((int8_t)C->getSExtValue() == C->getSExtValue()) { >> + Result = DAG.getTargetConstant(C->getZExtValue(), >> Op.getValueType()); >> + break; >> + } >> + } >> + return; >> + case 'K': >> + if (ConstantSDNode *C = dyn_cast(Op)) { >> if (C->getZExtValue() <= 63) { >> Result = DAG.getTargetConstant(C->getZExtValue(), >> Op.getValueType()); >> break; > > Isn't this mixing up the 'J' and 'K' constraints? Uh, yes, great catch! -Chris From clattner at apple.com Sun Jun 14 23:40:02 2009 From: clattner at apple.com (Chris Lattner) Date: Sun, 14 Jun 2009 21:40:02 -0700 Subject: [llvm-commits] [llvm] r73369 - /llvm/trunk/docs/DeveloperPolicy.html In-Reply-To: References: <200906150418.n5F4IsAh025822@zion.cs.uiuc.edu> Message-ID: <452A8EE2-F4B3-4CEC-8E4E-1501C3FD913E@apple.com> On Jun 14, 2009, at 9:22 PM, Eli Friedman wrote: > On Sun, Jun 14, 2009 at 9:18 PM, Chris Lattner > wrote: >> Author: lattner >> Date: Sun Jun 14 23:18:54 2009 >> New Revision: 73369 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=73369&view=rev >> Log: >> remove some old CVS-specific arguments that don't work with SVN. > > Actually, it works, but it doesn't do anything :) $ svn diff -u Subcommand 'diff' doesn't accept option '-u [--show-updates]' Type 'svn help diff' for usage. *shrug* It took my fingers a long time to stop passing -u when we switched from cvs to svn :) -Chris From sabre at nondot.org Sun Jun 14 23:42:32 2009 From: sabre at nondot.org (Chris Lattner) Date: Mon, 15 Jun 2009 04:42:32 -0000 Subject: [llvm-commits] [llvm] r73373 - in /llvm/trunk/lib/Target/X86/AsmPrinter: X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h Message-ID: <200906150442.n5F4gWDa026901@zion.cs.uiuc.edu> Author: lattner Date: Sun Jun 14 23:42:32 2009 New Revision: 73373 URL: http://llvm.org/viewvc/llvm-project?rev=73373&view=rev Log: remove extraneous const qualifier Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=73373&r1=73372&r2=73373&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Sun Jun 14 23:42:32 2009 @@ -673,8 +673,7 @@ printBasicBlockLabel(MBB, false, false, false); } -bool X86ATTAsmPrinter::printAsmMRegister(const MachineOperand &MO, - const char Mode) { +bool X86ATTAsmPrinter::printAsmMRegister(const MachineOperand &MO, char Mode) { unsigned Reg = MO.getReg(); switch (Mode) { default: return true; // Unknown mode. Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h?rev=73373&r1=73372&r2=73373&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h Sun Jun 14 23:42:32 2009 @@ -104,7 +104,7 @@ printLeaMemReference(MI, OpNo, "subreg64"); } - bool printAsmMRegister(const MachineOperand &MO, const char Mode); + bool printAsmMRegister(const MachineOperand &MO, char Mode); bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode); bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo, From eli.friedman at gmail.com Sun Jun 14 23:47:48 2009 From: eli.friedman at gmail.com (Eli Friedman) Date: Sun, 14 Jun 2009 21:47:48 -0700 Subject: [llvm-commits] [llvm] r73369 - /llvm/trunk/docs/DeveloperPolicy.html In-Reply-To: <452A8EE2-F4B3-4CEC-8E4E-1501C3FD913E@apple.com> References: <200906150418.n5F4IsAh025822@zion.cs.uiuc.edu> <452A8EE2-F4B3-4CEC-8E4E-1501C3FD913E@apple.com> Message-ID: On Sun, Jun 14, 2009 at 9:40 PM, Chris Lattner wrote: > > On Jun 14, 2009, at 9:22 PM, Eli Friedman wrote: > >> On Sun, Jun 14, 2009 at 9:18 PM, Chris Lattner >> wrote: >>> Author: lattner >>> Date: Sun Jun 14 23:18:54 2009 >>> New Revision: 73369 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=73369&view=rev >>> Log: >>> remove some old CVS-specific arguments that don't work with SVN. >> >> Actually, it works, but it doesn't do anything :) > > $ svn diff -u > Subcommand 'diff' doesn't accept option '-u [--show-updates]' > Type 'svn help diff' for usage. Right, but "svn diff -x -u" does work, at least with recent versions of SVN. -Eli