From baldrick at free.fr Mon Jun 7 10:59:37 2010 From: baldrick at free.fr (Duncan Sands) Date: Mon, 07 Jun 2010 15:59:37 -0000 Subject: [llvm-commits] [dragonegg] r105530 - /dragonegg/trunk/llvm-backend.cpp Message-ID: <20100607155937.861A22A6C12C@llvm.org> Author: baldrick Date: Mon Jun 7 10:59:37 2010 New Revision: 105530 URL: http://llvm.org/viewvc/llvm-project?rev=105530&view=rev Log: There is no need to defer output of globals: at the point we see them, the front-end will never change them. Also, do not rely on the LTO infrastructure passing us all static global variables. It doesn't do so for globals with defer-output set. Instead just output such when used. This fixes Fortran common variables, for which only the declaration was being output before. It also takes care of exception handling type infos when -fno-rtti is used, so remove the previous fix for that, namely the call to mark_decl_referenced. Modified: dragonegg/trunk/llvm-backend.cpp Modified: dragonegg/trunk/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=105530&r1=105529&r2=105530&view=diff ============================================================================== --- dragonegg/trunk/llvm-backend.cpp (original) +++ dragonegg/trunk/llvm-backend.cpp Mon Jun 7 10:59:37 2010 @@ -987,11 +987,6 @@ if (TREE_CODE(decl) == VAR_DECL && DECL_REGISTER(decl)) return; - // If tree nodes says defer output then do not emit global yet. - if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS) - && (DECL_DEFER_OUTPUT(decl))) - return; - // If we encounter a forward declaration then do not emit the global yet. if (!TYPE_SIZE(TREE_TYPE(decl))) return; @@ -1426,11 +1421,6 @@ /// make_definition_llvm - Ensures that the body or initial value of the given /// GCC global will be output, and returns a declaration for it. Value *make_definition_llvm(tree decl) { - // Inform cgraph that we used the global. Usually it knows this already, but - // in some cases, for example if decl is an exception handling typeinfo, it - // expects to be told explicitly. - mark_decl_referenced(decl); - // Only need to do something special for global variables. if (TREE_CODE(decl) != CONST_DECL && TREE_CODE(decl) != VAR_DECL) return DECL_LLVM(decl); @@ -1442,10 +1432,6 @@ assert(!DECL_INITIAL(decl) && "Non-static global has initial value!"); return DECL_LLVM(decl); } - // Public static variables will be output later anyway, so there is no point - // in outputting them here. - if (TREE_CODE(decl) == VAR_DECL && TREE_PUBLIC(decl)) - return DECL_LLVM(decl); GlobalValue *GV = cast(DECL_LLVM(decl)); // If we already output a definition for this declaration, then reuse it. if (!GV->isDeclaration()) From natebegeman at mac.com Mon Jun 7 11:00:37 2010 From: natebegeman at mac.com (Nate Begeman) Date: Mon, 07 Jun 2010 16:00:37 -0000 Subject: [llvm-commits] [llvm] r105531 - /llvm/trunk/utils/TableGen/NeonEmitter.cpp Message-ID: <20100607160037.E4C6A2A6C12C@llvm.org> Author: sampo Date: Mon Jun 7 11:00:37 2010 New Revision: 105531 URL: http://llvm.org/viewvc/llvm-project?rev=105531&view=rev Log: clang codegen support Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105531&r1=105530&r2=105531&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Mon Jun 7 11:00:37 2010 @@ -100,24 +100,9 @@ return ty[off]; } -static std::string TypeString(const char mod, StringRef typestr, - bool ret = false) { - bool quad = false; - bool poly = false; - bool usgn = false; - bool scal = false; - bool cnst = false; - bool pntr = false; - - // base type to get the type string for. - char type = ClassifyType(typestr, quad, poly, usgn); - - // Based on the modifying character, change the type and width if necessary. +static char ModType(const char mod, char type, bool &quad, bool &poly, + bool &usgn, bool &scal, bool &cnst, bool &pntr) { switch (mod) { - case 'v': - return "void"; - case 'i': - return "int"; case 't': if (poly) { poly = false; @@ -155,6 +140,8 @@ case 'c': cnst = true; case 'p': + usgn = false; + poly = false; pntr = true; scal = true; break; @@ -168,6 +155,28 @@ default: break; } + return type; +} + +static std::string TypeString(const char mod, StringRef typestr, + bool ret = false) { + bool quad = false; + bool poly = false; + bool usgn = false; + bool scal = false; + bool cnst = false; + bool pntr = false; + + if (mod == 'v') + return "void"; + if (mod == 'i') + return "int"; + + // base type to get the type string for. + char type = ClassifyType(typestr, quad, poly, usgn); + + // Based on the modifying character, change the type and width if necessary. + type = ModType(mod, type, quad, poly, usgn, scal, cnst, pntr); SmallString<128> s; @@ -256,60 +265,11 @@ char type = ClassifyType(typestr, quad, poly, usgn); // Based on the modifying character, change the type and width if necessary. - switch (mod) { - case 't': - if (poly) { - poly = false; - usgn = true; - } - break; - case 'x': - usgn = true; - poly = false; - if (type == 'f') - type = 'i'; - break; - case 'f': - type = 'f'; - usgn = false; - break; - case 'w': - type = Widen(type); - quad = true; - break; - case 'n': - type = Widen(type); - break; - case 'l': - type = 'l'; - scal = true; - usgn = true; - break; - case 's': - scal = true; - break; - case 'k': - quad = true; - break; - case 'c': - cnst = true; - case 'p': - type = 'v'; - usgn = false; - poly = false; - pntr = true; - scal = true; - break; - case 'h': - type = Narrow(type); - break; - case 'e': - type = Narrow(type); - usgn = true; - break; - default: - break; - } + type = ModType(mod, type, quad, poly, usgn, scal, cnst, pntr); + + if (pntr) + type = 'v'; + if (type == 'h') { type = 's'; usgn = true; @@ -534,6 +494,57 @@ return s; } +static unsigned GetNeonEnum(const std::string &proto, StringRef typestr) { + unsigned mod = proto[0]; + unsigned ret = 0; + + if (mod == 'v') + mod = proto[1]; + + bool quad = false; + bool poly = false; + bool usgn = false; + bool scal = false; + bool cnst = false; + bool pntr = false; + + // base type to get the type string for. + char type = ClassifyType(typestr, quad, poly, usgn); + + // Based on the modifying character, change the type and width if necessary. + type = ModType(mod, type, quad, poly, usgn, scal, cnst, pntr); + + if (usgn) + ret |= 0x08; + if (quad) + ret |= 0x10; + + switch (type) { + case 'c': + ret |= poly ? 5 : 0; + break; + case 's': + ret |= poly ? 6 : 1; + break; + case 'i': + ret |= 2; + break; + case 'l': + ret |= 3; + break; + case 'h': + ret |= 7; + break; + case 'f': + ret |= 4; + break; + default: + throw "unhandled type!"; + break; + } + return ret; +} + // Generate the definition for this intrinsic, e.g. __builtin_neon_cls(a) // If structTypes is true, the NEON types are structs of vector types rather // than vector types, and the call becomes __builtin_neon_cls(a.val) @@ -599,9 +610,8 @@ } // Extra constant integer to hold type class enum for this function, e.g. s8 - // FIXME: emit actual type num. if (ck == ClassB) - s += ", 0"; + s += ", " + utostr(GetNeonEnum(proto, typestr)); s += ");"; From rafael.espindola at gmail.com Mon Jun 7 11:45:23 2010 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 07 Jun 2010 16:45:23 -0000 Subject: [llvm-commits] [llvm] r105534 - /llvm/trunk/tools/gold/gold-plugin.cpp Message-ID: <20100607164523.15A412A6C12C@llvm.org> Author: rafael Date: Mon Jun 7 11:45:22 2010 New Revision: 105534 URL: http://llvm.org/viewvc/llvm-project?rev=105534&view=rev Log: Misc cleanups to the gold plugin. Modified: llvm/trunk/tools/gold/gold-plugin.cpp Modified: llvm/trunk/tools/gold/gold-plugin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=105534&r1=105533&r2=105534&view=diff ============================================================================== --- llvm/trunk/tools/gold/gold-plugin.cpp (original) +++ llvm/trunk/tools/gold/gold-plugin.cpp Mon Jun 7 11:45:22 2010 @@ -63,7 +63,7 @@ static bool generate_api_file = false; static generate_bc generate_bc_file = BC_NO; static std::string bc_path; - static const char *as_path = NULL; + static std::string as_path; // Additional options to pass into the code generator. // Note: This array will contain all plugin options which are not claimed // as plugin exclusive to pass to the code generator. @@ -71,36 +71,37 @@ // use only and will not be passed. static std::vector extra; - static void process_plugin_option(const char* opt) + static void process_plugin_option(const char* opt_) { - if (opt == NULL) + if (opt_ == NULL) return; + llvm::StringRef opt = opt_; - if (strcmp("generate-api-file", opt) == 0) { + if (opt == "generate-api-file") { generate_api_file = true; - } else if (strncmp("as=", opt, 3) == 0) { - if (as_path) { + } else if (opt.startswith("as=")) { + if (!as_path.empty()) { (*message)(LDPL_WARNING, "Path to as specified twice. " - "Discarding %s", opt); + "Discarding %s", opt_); } else { - as_path = strdup(opt + 3); + as_path = opt.substr(strlen("as=")); } - } else if (strcmp("emit-llvm", opt) == 0) { + } else if (opt == "emit-llvm") { generate_bc_file = BC_ONLY; - } else if (strcmp("also-emit-llvm", opt) == 0) { + } else if (opt == "also-emit-llvm") { generate_bc_file = BC_ALSO; - } else if (llvm::StringRef(opt).startswith("also-emit-llvm=")) { - const char *path = opt + strlen("also-emit-llvm="); + } else if (opt.startswith("also-emit-llvm=")) { + llvm::StringRef path = opt.substr(strlen("also-emit-llvm=")); generate_bc_file = BC_ALSO; if (!bc_path.empty()) { (*message)(LDPL_WARNING, "Path to the output IL file specified twice. " - "Discarding %s", opt); + "Discarding %s", opt_); } else { bc_path = path; } } else { // Save this option to pass to the code generator. - extra.push_back(std::string(opt)); + extra.push_back(opt); } } } @@ -380,7 +381,7 @@ lto_codegen_set_pic_model(cg, output_type); lto_codegen_set_debug_model(cg, LTO_DEBUG_MODEL_DWARF); - if (options::as_path) { + if (!options::as_path.empty()) { sys::Path p = sys::Program::FindProgramByName(options::as_path); lto_codegen_set_assembler_path(cg, p.c_str()); } From bob.wilson at apple.com Mon Jun 7 12:09:02 2010 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 07 Jun 2010 17:09:02 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r105535 - /llvm-gcc-4.2/trunk/driverdriver.c Message-ID: <20100607170902.D8F642A6C12C@llvm.org> Author: bwilson Date: Mon Jun 7 12:09:02 2010 New Revision: 105535 URL: http://llvm.org/viewvc/llvm-project?rev=105535&view=rev Log: Follow multiple levels of symbolic links for the driver-driver. Otherwise, the driver-driver fails to find the right compiler when it is linked via multiple levels of symlinks, e.g., cc -> llvm-gcc-4.2 -> $DEVELOPER_DIR/usr/bin/llvm-gcc-4.2. Radar 8022536. Modified: llvm-gcc-4.2/trunk/driverdriver.c Modified: llvm-gcc-4.2/trunk/driverdriver.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/driverdriver.c?rev=105535&r1=105534&r2=105535&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/driverdriver.c (original) +++ llvm-gcc-4.2/trunk/driverdriver.c Mon Jun 7 12:09:02 2010 @@ -1306,8 +1306,8 @@ /* If argv[0] is a symbolic link, use the directory of the pointed-to file to find compiler components. */ - - if ((linklen = readlink (argv[0], path_buffer, PATH_MAX)) != -1) + /* LLVM LOCAL: loop to follow multiple levels of links */ + while ((linklen = readlink (argv[0], path_buffer, PATH_MAX)) != -1) { /* readlink succeeds if argv[0] is a symlink. path_buffer now contains the file referenced. */ From jyasskin at google.com Mon Jun 7 12:37:29 2010 From: jyasskin at google.com (Jeffrey Yasskin) Date: Mon, 7 Jun 2010 10:37:29 -0700 Subject: [llvm-commits] [llvm] r104029 - /llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp In-Reply-To: <20100518172220.27B32312800A@llvm.org> References: <20100518172220.27B32312800A@llvm.org> Message-ID: I'm guessing this is the change that broke http://google1.osuosl.org:8011/builders/llvm-i686-linux-vg_leak/builds/755/steps/test-llvm/logs/mcinst-lowering.ll (since it admits leaking memory). Could you fix it? On Tue, May 18, 2010 at 10:22 AM, Daniel Dunbar wrote: > Author: ddunbar > Date: Tue May 18 12:22:19 2010 > New Revision: 104029 > > URL: http://llvm.org/viewvc/llvm-project?rev=104029&view=rev > Log: > llc (et al): Add support for --show-encoding and --show-inst. > > Modified: > ? ?llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp > > Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=104029&r1=104028&r2=104029&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) > +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Tue May 18 12:22:19 2010 > @@ -65,6 +65,10 @@ > ? ? cl::desc("Print LLVM IR input to isel pass")); > ?static cl::opt PrintGCInfo("print-gc", cl::Hidden, > ? ? cl::desc("Dump garbage collector data")); > +static cl::opt ShowMCEncoding("show-mc-encoding", cl::Hidden, > + ? ?cl::desc("Show encoding in .s output")); > +static cl::opt ShowMCInst("show-mc-inst", cl::Hidden, > + ? ?cl::desc("Show instruction structure in .s output")); > ?static cl::opt VerifyMachineCode("verify-machineinstrs", cl::Hidden, > ? ? cl::desc("Verify generated machine code"), > ? ? cl::init(getenv("LLVM_VERIFY_MACHINEINSTRS")!=NULL)); > @@ -131,10 +135,18 @@ > ? case CGFT_AssemblyFile: { > ? ? MCInstPrinter *InstPrinter = > ? ? ? getTarget().createMCInstPrinter(MAI.getAssemblerDialect(), MAI); > + > + ? ?// Create a code emitter if asked to show the encoding. > + ? ?// > + ? ?// FIXME: These are currently leaked. > + ? ?MCCodeEmitter *MCE = 0; > + ? ?if (ShowMCEncoding) > + ? ? ?MCE = getTarget().createCodeEmitter(*this, *Context); > + > ? ? AsmStreamer.reset(createAsmStreamer(*Context, Out, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? getTargetData()->isLittleEndian(), > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? getVerboseAsm(), InstPrinter, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/*codeemitter*/0)); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MCE, ShowMCInst)); > ? ? break; > ? } > ? case CGFT_ObjectFile: { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From jyasskin at google.com Mon Jun 7 12:37:29 2010 From: jyasskin at google.com (Jeffrey Yasskin) Date: Mon, 7 Jun 2010 10:37:29 -0700 Subject: [llvm-commits] [llvm] r104029 - /llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp In-Reply-To: <20100518172220.27B32312800A@llvm.org> References: <20100518172220.27B32312800A@llvm.org> Message-ID: I'm guessing this is the change that broke http://google1.osuosl.org:8011/builders/llvm-i686-linux-vg_leak/builds/755/steps/test-llvm/logs/mcinst-lowering.ll (since it admits leaking memory). Could you fix it? On Tue, May 18, 2010 at 10:22 AM, Daniel Dunbar wrote: > Author: ddunbar > Date: Tue May 18 12:22:19 2010 > New Revision: 104029 > > URL: http://llvm.org/viewvc/llvm-project?rev=104029&view=rev > Log: > llc (et al): Add support for --show-encoding and --show-inst. > > Modified: > ? ?llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp > > Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=104029&r1=104028&r2=104029&view=diff > ============================================================================== > --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) > +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Tue May 18 12:22:19 2010 > @@ -65,6 +65,10 @@ > ? ? cl::desc("Print LLVM IR input to isel pass")); > ?static cl::opt PrintGCInfo("print-gc", cl::Hidden, > ? ? cl::desc("Dump garbage collector data")); > +static cl::opt ShowMCEncoding("show-mc-encoding", cl::Hidden, > + ? ?cl::desc("Show encoding in .s output")); > +static cl::opt ShowMCInst("show-mc-inst", cl::Hidden, > + ? ?cl::desc("Show instruction structure in .s output")); > ?static cl::opt VerifyMachineCode("verify-machineinstrs", cl::Hidden, > ? ? cl::desc("Verify generated machine code"), > ? ? cl::init(getenv("LLVM_VERIFY_MACHINEINSTRS")!=NULL)); > @@ -131,10 +135,18 @@ > ? case CGFT_AssemblyFile: { > ? ? MCInstPrinter *InstPrinter = > ? ? ? getTarget().createMCInstPrinter(MAI.getAssemblerDialect(), MAI); > + > + ? ?// Create a code emitter if asked to show the encoding. > + ? ?// > + ? ?// FIXME: These are currently leaked. > + ? ?MCCodeEmitter *MCE = 0; > + ? ?if (ShowMCEncoding) > + ? ? ?MCE = getTarget().createCodeEmitter(*this, *Context); > + > ? ? AsmStreamer.reset(createAsmStreamer(*Context, Out, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? getTargetData()->isLittleEndian(), > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? getVerboseAsm(), InstPrinter, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?/*codeemitter*/0)); > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?MCE, ShowMCInst)); > ? ? break; > ? } > ? case CGFT_ObjectFile: { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From isanbard at gmail.com Mon Jun 7 14:05:06 2010 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 07 Jun 2010 19:05:06 -0000 Subject: [llvm-commits] [llvm] r105539 - in /llvm/trunk: include/llvm/Instructions.h lib/Analysis/IPA/GlobalsModRef.cpp lib/Target/CppBackend/CPPBackend.cpp lib/Target/MSIL/MSILWriter.cpp Message-ID: <20100607190506.961B62A6C12C@llvm.org> Author: void Date: Mon Jun 7 14:05:06 2010 New Revision: 105539 URL: http://llvm.org/viewvc/llvm-project?rev=105539&view=rev Log: Create new accessors to get arguments for call/invoke instructions. It breaks encapsulation to force the users of these classes to know about the internal data structure of the Operands structure. It also can lead to errors, like in the MSIL writer. Modified: llvm/trunk/include/llvm/Instructions.h llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=105539&r1=105538&r2=105539&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Mon Jun 7 14:05:06 2010 @@ -940,6 +940,9 @@ /// Provide fast operand accessors DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); + unsigned getNumArgOperands() const { return getNumOperands() - 1; } + Value *getArgOperand(unsigned i) const { return getOperand(i + 1); } + /// getCallingConv/setCallingConv - Get or set the calling convention of this /// function call. CallingConv::ID getCallingConv() const { @@ -2432,6 +2435,9 @@ /// Provide fast operand accessors DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); + unsigned getNumArgOperands() const { return getNumOperands() - 3; } + Value *getArgOperand(unsigned i) const { return getOperand(i); } + /// getCallingConv/setCallingConv - Get or set the calling convention of this /// function call. CallingConv::ID getCallingConv() const { Modified: llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp?rev=105539&r1=105538&r2=105539&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp Mon Jun 7 14:05:06 2010 @@ -252,13 +252,13 @@ } else if (CallInst *CI = dyn_cast(*UI)) { // Make sure that this is just the function being called, not that it is // passing into the function. - for (unsigned i = 1, e = CI->getNumOperands(); i != e; ++i) - if (CI->getOperand(i) == V) return true; + for (unsigned i = 0, e = CI->getNumArgOperands(); i != e; ++i) + if (CI->getArgOperand(i) == V) return true; } else if (InvokeInst *II = dyn_cast(*UI)) { // Make sure that this is just the function being called, not that it is // passing into the function. - for (unsigned i = 0, e = II->getNumOperands() - 3; i != e; ++i) - if (II->getOperand(i) == V) return true; + for (unsigned i = 0, e = II->getNumArgOperands(); i != e; ++i) + if (II->getArgOperand(i) == V) return true; } else if (ConstantExpr *CE = dyn_cast(*UI)) { if (CE->getOpcode() == Instruction::GetElementPtr || CE->getOpcode() == Instruction::BitCast) { Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=105539&r1=105538&r2=105539&view=diff ============================================================================== --- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original) +++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Mon Jun 7 14:05:06 2010 @@ -1150,16 +1150,18 @@ const InvokeInst* inv = cast(I); Out << "std::vector " << iName << "_params;"; nl(Out); - for (unsigned i = 0; i < inv->getNumOperands() - 3; ++i) { + for (unsigned i = 0; i < inv->getNumArgOperands(); ++i) { Out << iName << "_params.push_back(" - << opNames[i] << ");"; + << getOpName(inv->getArgOperand(i)) << ");"; nl(Out); } + // FIXME: This shouldn't use magic numbers -3, -2, and -1. Out << "InvokeInst *" << iName << " = InvokeInst::Create(" - << opNames[Ops - 3] << ", " - << opNames[Ops - 2] << ", " - << opNames[Ops - 1] << ", " - << iName << "_params.begin(), " << iName << "_params.end(), \""; + << getOpName(inv->getCalledFunction()) << ", " + << getOpName(inv->getNormalDest()) << ", " + << getOpName(inv->getUnwindDest()) << ", " + << iName << "_params.begin(), " + << iName << "_params.end(), \""; printEscapedString(inv->getName()); Out << "\", " << bbname << ");"; nl(Out) << iName << "->setCallingConv("; Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=105539&r1=105538&r2=105539&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original) +++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Mon Jun 7 14:05:06 2010 @@ -845,10 +845,11 @@ // Handle intrinsic function. printIntrinsicCall(cast(Inst)); } else { + const CallInst *CI = cast(Inst); // Load arguments to stack and call function. - for (int I = 1, E = Inst->getNumOperands(); I!=E; ++I) - printValueLoad(Inst->getOperand(I)); - printFunctionCall(Inst->getOperand(0),Inst); + for (int I = 0, E = CI->getNumArgOperands(); I!=E; ++I) + printValueLoad(CI->getArgOperand(I)); + printFunctionCall(CI->getCalledFunction(), Inst); } } @@ -1002,8 +1003,8 @@ std::string Label = "leave$normal_"+utostr(getUniqID()); Out << ".try {\n"; // Load arguments - for (int I = 3, E = Inst->getNumOperands(); I!=E; ++I) - printValueLoad(Inst->getOperand(I)); + for (int I = 0, E = Inst->getNumArgOperands(); I!=E; ++I) + printValueLoad(Inst->getArgOperand(I)); // Print call instruction printFunctionCall(Inst->getOperand(0),Inst); // Save function result and leave "try" block From gohman at apple.com Mon Jun 7 14:06:13 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jun 2010 19:06:13 -0000 Subject: [llvm-commits] [llvm] r105540 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll Message-ID: <20100607190613.7F62E2A6C12C@llvm.org> Author: djg Date: Mon Jun 7 14:06:13 2010 New Revision: 105540 URL: http://llvm.org/viewvc/llvm-project?rev=105540&view=rev Log: Optimize ScalarEvolution's SCEVComplexityCompare predicate: don't go scrounging through SCEVUnknown contents and SCEVNAryExpr operands; instead just do a simple deterministic comparison of the precomputed hash data. Also, since this is more precise, it eliminates the need for the slow N^2 duplicate detection code. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h llvm/trunk/lib/Analysis/ScalarEvolution.cpp llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=105540&r1=105539&r2=105540&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Mon Jun 7 14:06:13 2010 @@ -76,6 +76,9 @@ /// Profile - FoldingSet support. void Profile(FoldingSetNodeID& ID) { ID = FastID; } + /// getProfile - Like Profile, but a different interface which doesn't copy. + const FoldingSetNodeIDRef &getProfile() const { return FastID; } + /// isLoopInvariant - Return true if the value of this SCEV is unchanging in /// the specified loop. virtual bool isLoopInvariant(const Loop *L) const = 0; Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=105540&r1=105539&r2=105540&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jun 7 14:06:13 2010 @@ -508,106 +508,15 @@ if (LHS->getSCEVType() != RHS->getSCEVType()) return LHS->getSCEVType() < RHS->getSCEVType(); - // Aside from the getSCEVType() ordering, the particular ordering - // isn't very important except that it's beneficial to be consistent, - // so that (a + b) and (b + a) don't end up as different expressions. - - // Sort SCEVUnknown values with some loose heuristics. TODO: This is - // not as complete as it could be. - if (const SCEVUnknown *LU = dyn_cast(LHS)) { - const SCEVUnknown *RU = cast(RHS); - - // Order pointer values after integer values. This helps SCEVExpander - // form GEPs. - if (LU->getType()->isPointerTy() && !RU->getType()->isPointerTy()) - return false; - if (RU->getType()->isPointerTy() && !LU->getType()->isPointerTy()) - return true; - - // Compare getValueID values. - if (LU->getValue()->getValueID() != RU->getValue()->getValueID()) - return LU->getValue()->getValueID() < RU->getValue()->getValueID(); - - // Sort arguments by their position. - if (const Argument *LA = dyn_cast(LU->getValue())) { - const Argument *RA = cast(RU->getValue()); - return LA->getArgNo() < RA->getArgNo(); - } - - // For instructions, compare their loop depth, and their opcode. - // This is pretty loose. - if (Instruction *LV = dyn_cast(LU->getValue())) { - Instruction *RV = cast(RU->getValue()); - - // Compare loop depths. - if (LI->getLoopDepth(LV->getParent()) != - LI->getLoopDepth(RV->getParent())) - return LI->getLoopDepth(LV->getParent()) < - LI->getLoopDepth(RV->getParent()); - - // Compare opcodes. - if (LV->getOpcode() != RV->getOpcode()) - return LV->getOpcode() < RV->getOpcode(); - - // Compare the number of operands. - if (LV->getNumOperands() != RV->getNumOperands()) - return LV->getNumOperands() < RV->getNumOperands(); - } - - return false; - } - - // Compare constant values. - if (const SCEVConstant *LC = dyn_cast(LHS)) { - const SCEVConstant *RC = cast(RHS); - if (LC->getValue()->getBitWidth() != RC->getValue()->getBitWidth()) - return LC->getValue()->getBitWidth() < RC->getValue()->getBitWidth(); - 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)) { - const SCEVNAryExpr *RC = cast(RHS); - for (unsigned i = 0, e = LC->getNumOperands(); i != e; ++i) { - if (i >= RC->getNumOperands()) - return false; - if (operator()(LC->getOperand(i), RC->getOperand(i))) - return true; - if (operator()(RC->getOperand(i), LC->getOperand(i))) - return false; - } - return LC->getNumOperands() < RC->getNumOperands(); - } - - // Lexicographically compare udiv expressions. - if (const SCEVUDivExpr *LC = dyn_cast(LHS)) { - const SCEVUDivExpr *RC = cast(RHS); - if (operator()(LC->getLHS(), RC->getLHS())) - return true; - if (operator()(RC->getLHS(), LC->getLHS())) - return false; - if (operator()(LC->getRHS(), RC->getRHS())) - return true; - if (operator()(RC->getRHS(), LC->getRHS())) - return false; - return false; - } - - // Compare cast expressions by operand. - if (const SCEVCastExpr *LC = dyn_cast(LHS)) { - const SCEVCastExpr *RC = cast(RHS); - return operator()(LC->getOperand(), RC->getOperand()); - } - - llvm_unreachable("Unknown SCEV kind!"); - return false; + // Then, pick an arbitrary sort. Use the profiling data for speed. + const FoldingSetNodeIDRef &L = LHS->getProfile(); + const FoldingSetNodeIDRef &R = RHS->getProfile(); + size_t LSize = L.getSize(); + size_t RSize = R.getSize(); + if (LSize != RSize) + return LSize < RSize; + return memcmp(L.getData(), R.getData(), + LSize * sizeof(*L.getData())) < 0; } }; } @@ -625,36 +534,18 @@ static void GroupByComplexity(SmallVectorImpl &Ops, LoopInfo *LI) { if (Ops.size() < 2) return; // Noop + + SCEVComplexityCompare Comp(LI); + if (Ops.size() == 2) { // This is the common case, which also happens to be trivially simple. // Special case it. - if (SCEVComplexityCompare(LI)(Ops[1], Ops[0])) + if (Comp(Ops[1], Ops[0])) std::swap(Ops[0], Ops[1]); return; } - // Do the rough sort by complexity. - std::stable_sort(Ops.begin(), Ops.end(), SCEVComplexityCompare(LI)); - - // Now that we are sorted by complexity, group elements of the same - // complexity. Note that this is, at worst, N^2, but the vector is likely to - // be extremely short in practice. Note that we take this approach because we - // do not want to depend on the addresses of the objects we are grouping. - for (unsigned i = 0, e = Ops.size(); i != e-2; ++i) { - const SCEV *S = Ops[i]; - unsigned Complexity = S->getSCEVType(); - - // If there are any objects of the same complexity and same value as this - // one, group them. - for (unsigned j = i+1; j != e && Ops[j]->getSCEVType() == Complexity; ++j) { - if (Ops[j] == S) { // Found a duplicate. - // Move it to immediately after i'th element. - std::swap(Ops[i+1], Ops[j]); - ++i; // no need to rescan it. - if (i == e-2) return; // Done! - } - } - } + std::stable_sort(Ops.begin(), Ops.end(), Comp); } Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll?rev=105540&r1=105539&r2=105540&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll Mon Jun 7 14:06:13 2010 @@ -22,5 +22,5 @@ ret i32 %j.0.lcssa } -; CHECK: backedge-taken count is (-2147483632 + ((-1 + (-1 * %x)) smax (-1 + (-1 * %y)))) +; CHECK: backedge-taken count is (-2147483632 + ((-1 + (-1 * %y)) smax (-1 + (-1 * %x)))) From grosbach at apple.com Mon Jun 7 14:12:21 2010 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 07 Jun 2010 19:12:21 -0000 Subject: [llvm-commits] [llvm] r105541 - /llvm/trunk/lib/CodeGen/IfConversion.cpp Message-ID: <20100607191221.7CECE2A6C12C@llvm.org> Author: grosbach Date: Mon Jun 7 14:12:21 2010 New Revision: 105541 URL: http://llvm.org/viewvc/llvm-project?rev=105541&view=rev Log: Move exit check where it really belongs. Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IfConversion.cpp?rev=105541&r1=105540&r2=105541&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/IfConversion.cpp (original) +++ llvm/trunk/lib/CodeGen/IfConversion.cpp Mon Jun 7 14:12:21 2010 @@ -515,13 +515,13 @@ MachineBasicBlock::iterator TI = TrueBBI.BB->begin(); MachineBasicBlock::iterator FI = FalseBBI.BB->begin(); while (1) { + if (TI == TrueBBI.BB->end() || FI == FalseBBI.BB->end()) + break; // Skip dbg_value instructions if (TI->isDebugValue()) ++TI; if (FI->isDebugValue()) ++FI; - if (TI == TrueBBI.BB->end() || FI == FalseBBI.BB->end()) - break; if (!TI->isIdenticalTo(FI)) break; @@ -533,13 +533,13 @@ TI = firstNonBranchInst(TrueBBI.BB, TII); FI = firstNonBranchInst(FalseBBI.BB, TII); while (1) { + if (TI == TrueBBI.BB->begin() || FI == FalseBBI.BB->begin()) + break; // Skip dbg_value instructions if (TI->isDebugValue()) --TI; if (FI->isDebugValue()) --FI; - if (TI == TrueBBI.BB->begin() || FI == FalseBBI.BB->begin()) - break; if (!TI->isIdenticalTo(FI)) break; From gohman at apple.com Mon Jun 7 14:12:54 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jun 2010 19:12:54 -0000 Subject: [llvm-commits] [llvm] r105542 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp Message-ID: <20100607191254.CD05F2A6C12C@llvm.org> Author: djg Date: Mon Jun 7 14:12:54 2010 New Revision: 105542 URL: http://llvm.org/viewvc/llvm-project?rev=105542&view=rev Log: Micro-optimize this. 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=105542&r1=105541&r2=105542&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jun 7 14:12:54 2010 @@ -505,8 +505,10 @@ return false; // Primarily, sort the SCEVs by their getSCEVType(). - if (LHS->getSCEVType() != RHS->getSCEVType()) - return LHS->getSCEVType() < RHS->getSCEVType(); + unsigned LST = LHS->getSCEVType(); + unsigned RST = RHS->getSCEVType(); + if (LST != RST) + return LST < RST; // Then, pick an arbitrary sort. Use the profiling data for speed. const FoldingSetNodeIDRef &L = LHS->getProfile(); From gohman at apple.com Mon Jun 7 14:16:37 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jun 2010 19:16:37 -0000 Subject: [llvm-commits] [llvm] r105544 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp Message-ID: <20100607191637.84D002A6C12C@llvm.org> Author: djg Date: Mon Jun 7 14:16:37 2010 New Revision: 105544 URL: http://llvm.org/viewvc/llvm-project?rev=105544&view=rev Log: Micro-optimize this, to speed up this hotspot in debug builds a little. 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=105544&r1=105543&r2=105544&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jun 7 14:16:37 2010 @@ -1168,9 +1168,9 @@ assert(!Ops.empty() && "Cannot get empty add!"); if (Ops.size() == 1) return Ops[0]; #ifndef NDEBUG + const Type *ETy = getEffectiveSCEVType(Ops[0]->getType()); for (unsigned i = 1, e = Ops.size(); i != e; ++i) - assert(getEffectiveSCEVType(Ops[i]->getType()) == - getEffectiveSCEVType(Ops[0]->getType()) && + assert(getEffectiveSCEVType(Ops[i]->getType()) == ETy && "SCEVAddExpr operand types don't match!"); #endif From isanbard at gmail.com Mon Jun 7 14:18:58 2010 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 07 Jun 2010 19:18:58 -0000 Subject: [llvm-commits] [llvm] r105545 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <20100607191858.4CCBA2A6C12C@llvm.org> Author: void Date: Mon Jun 7 14:18:58 2010 New Revision: 105545 URL: http://llvm.org/viewvc/llvm-project?rev=105545&view=rev Log: Another place where the code wanted to access the argument list and not all of the operands. Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=105545&r1=105544&r2=105545&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Mon Jun 7 14:18:58 2010 @@ -1628,8 +1628,8 @@ // If the intrinsic takes MDNode arguments, verify that they are either global // or are local to *this* function. - for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i) - if (MDNode *MD = dyn_cast(CI.getOperand(i))) + for (unsigned i = 0, e = CI.getNumArgOperands(); i != e; ++i) + if (MDNode *MD = dyn_cast(CI.getArgOperand(i))) visitMDNode(*MD, CI.getParent()->getParent()); switch (ID) { From gohman at apple.com Mon Jun 7 14:20:57 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jun 2010 19:20:57 -0000 Subject: [llvm-commits] [llvm] r105546 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp Message-ID: <20100607192058.0A9B52A6C12C@llvm.org> Author: djg Date: Mon Jun 7 14:20:57 2010 New Revision: 105546 URL: http://llvm.org/viewvc/llvm-project?rev=105546&view=rev Log: Optimize this code somewhat by taking advantage of the fact that the operands are sorted. 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=105546&r1=105545&r2=105546&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jun 7 14:20:57 2010 @@ -1101,8 +1101,19 @@ ScalarEvolution &SE) { bool Interesting = false; - // Iterate over the add operands. - for (unsigned i = 0, e = NumOperands; i != e; ++i) { + // Iterate over the add operands. They are sorted, with constants first. + unsigned i = 0; + while (const SCEVConstant *C = dyn_cast(Ops[i])) { + ++i; + // Pull a buried constant out to the outside. + if (Scale != 1 || AccumulatedConstant != 0 || C->getValue()->isZero()) + Interesting = true; + AccumulatedConstant += Scale * C->getValue()->getValue(); + } + + // Next comes everything else. We're especially interested in multiplies + // here, but they're in the middle, so just visit the rest with one loop. + for (; i != NumOperands; ++i) { const SCEVMulExpr *Mul = dyn_cast(Ops[i]); if (Mul && isa(Mul->getOperand(0))) { APInt NewScale = @@ -1130,11 +1141,6 @@ 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->getValue()->isZero()) - Interesting = true; - AccumulatedConstant += Scale * C->getValue()->getValue(); } else { // An ordinary operand. Update the map. std::pair::iterator, bool> Pair = From gohman at apple.com Mon Jun 7 14:36:14 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jun 2010 19:36:14 -0000 Subject: [llvm-commits] [llvm] r105548 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h include/llvm/Analysis/ScalarEvolutionExpressions.h lib/Analysis/ScalarEvolution.cpp Message-ID: <20100607193614.6D5392A6C12C@llvm.org> Author: djg Date: Mon Jun 7 14:36:14 2010 New Revision: 105548 URL: http://llvm.org/viewvc/llvm-project?rev=105548&view=rev Log: The FoldingSet hash data includes pointer values, so it isn't determinstic. Instead, give SCEV objects an arbitrary sequence number. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.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=105548&r1=105547&r2=105548&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Mon Jun 7 14:36:14 2010 @@ -54,6 +54,10 @@ /// The ScalarEvolution's BumpPtrAllocator holds the data. FoldingSetNodeIDRef FastID; + /// AllocationSequenceNumber - This is used as a deterministic tie + /// breaker when sorting SCEVs. + unsigned AllocationSequenceNumber; + // The SCEV baseclass this node corresponds to const unsigned short SCEVType; @@ -68,17 +72,21 @@ protected: virtual ~SCEV(); public: - explicit SCEV(const FoldingSetNodeIDRef ID, unsigned SCEVTy) : - FastID(ID), SCEVType(SCEVTy), SubclassData(0) {} + explicit SCEV(const FoldingSetNodeIDRef ID, unsigned num, unsigned SCEVTy) : + FastID(ID), AllocationSequenceNumber(num), + SCEVType(SCEVTy), SubclassData(0) {} unsigned getSCEVType() const { return SCEVType; } + /// getAllocationSequenceNumber - Return an arbitrary value which can be + /// used to deterministically order a sequence of SCEVs. + unsigned getAllocationSequenceNumber() const { + return AllocationSequenceNumber; + } + /// Profile - FoldingSet support. void Profile(FoldingSetNodeID& ID) { ID = FastID; } - /// getProfile - Like Profile, but a different interface which doesn't copy. - const FoldingSetNodeIDRef &getProfile() const { return FastID; } - /// isLoopInvariant - Return true if the value of this SCEV is unchanging in /// the specified loop. virtual bool isLoopInvariant(const Loop *L) const = 0; @@ -670,6 +678,7 @@ private: FoldingSet UniqueSCEVs; BumpPtrAllocator SCEVAllocator; + unsigned CurAllocationSequenceNumber; }; } Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=105548&r1=105547&r2=105548&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Mon Jun 7 14:36:14 2010 @@ -37,8 +37,8 @@ friend class ScalarEvolution; ConstantInt *V; - SCEVConstant(const FoldingSetNodeIDRef ID, ConstantInt *v) : - SCEV(ID, scConstant), V(v) {} + SCEVConstant(const FoldingSetNodeIDRef ID, unsigned Num, ConstantInt *v) + : SCEV(ID, Num, scConstant), V(v) {} public: ConstantInt *getValue() const { return V; } @@ -81,7 +81,7 @@ const SCEV *Op; const Type *Ty; - SCEVCastExpr(const FoldingSetNodeIDRef ID, + SCEVCastExpr(const FoldingSetNodeIDRef ID, unsigned Num, unsigned SCEVTy, const SCEV *op, const Type *ty); public: @@ -120,7 +120,7 @@ class SCEVTruncateExpr : public SCEVCastExpr { friend class ScalarEvolution; - SCEVTruncateExpr(const FoldingSetNodeIDRef ID, + SCEVTruncateExpr(const FoldingSetNodeIDRef ID, unsigned Num, const SCEV *op, const Type *ty); public: @@ -140,7 +140,7 @@ class SCEVZeroExtendExpr : public SCEVCastExpr { friend class ScalarEvolution; - SCEVZeroExtendExpr(const FoldingSetNodeIDRef ID, + SCEVZeroExtendExpr(const FoldingSetNodeIDRef ID, unsigned Num, const SCEV *op, const Type *ty); public: @@ -160,7 +160,7 @@ class SCEVSignExtendExpr : public SCEVCastExpr { friend class ScalarEvolution; - SCEVSignExtendExpr(const FoldingSetNodeIDRef ID, + SCEVSignExtendExpr(const FoldingSetNodeIDRef ID, unsigned Num, const SCEV *op, const Type *ty); public: @@ -187,9 +187,9 @@ const SCEV *const *Operands; size_t NumOperands; - SCEVNAryExpr(const FoldingSetNodeIDRef ID, + SCEVNAryExpr(const FoldingSetNodeIDRef ID, unsigned Num, enum SCEVTypes T, const SCEV *const *O, size_t N) - : SCEV(ID, T), Operands(O), NumOperands(N) {} + : SCEV(ID, Num, T), Operands(O), NumOperands(N) {} public: size_t getNumOperands() const { return NumOperands; } @@ -262,9 +262,9 @@ /// class SCEVCommutativeExpr : public SCEVNAryExpr { protected: - SCEVCommutativeExpr(const FoldingSetNodeIDRef ID, + SCEVCommutativeExpr(const FoldingSetNodeIDRef ID, unsigned Num, enum SCEVTypes T, const SCEV *const *O, size_t N) - : SCEVNAryExpr(ID, T, O, N) {} + : SCEVNAryExpr(ID, Num, T, O, N) {} public: virtual const char *getOperationStr() const = 0; @@ -288,9 +288,9 @@ class SCEVAddExpr : public SCEVCommutativeExpr { friend class ScalarEvolution; - SCEVAddExpr(const FoldingSetNodeIDRef ID, + SCEVAddExpr(const FoldingSetNodeIDRef ID, unsigned Num, const SCEV *const *O, size_t N) - : SCEVCommutativeExpr(ID, scAddExpr, O, N) { + : SCEVCommutativeExpr(ID, Num, scAddExpr, O, N) { } public: @@ -316,9 +316,9 @@ class SCEVMulExpr : public SCEVCommutativeExpr { friend class ScalarEvolution; - SCEVMulExpr(const FoldingSetNodeIDRef ID, + SCEVMulExpr(const FoldingSetNodeIDRef ID, unsigned Num, const SCEV *const *O, size_t N) - : SCEVCommutativeExpr(ID, scMulExpr, O, N) { + : SCEVCommutativeExpr(ID, Num, scMulExpr, O, N) { } public: @@ -340,8 +340,9 @@ const SCEV *LHS; const SCEV *RHS; - SCEVUDivExpr(const FoldingSetNodeIDRef ID, const SCEV *lhs, const SCEV *rhs) - : SCEV(ID, scUDivExpr), LHS(lhs), RHS(rhs) {} + SCEVUDivExpr(const FoldingSetNodeIDRef ID, unsigned Num, + const SCEV *lhs, const SCEV *rhs) + : SCEV(ID, Num, scUDivExpr), LHS(lhs), RHS(rhs) {} public: const SCEV *getLHS() const { return LHS; } @@ -390,9 +391,9 @@ const Loop *L; - SCEVAddRecExpr(const FoldingSetNodeIDRef ID, + SCEVAddRecExpr(const FoldingSetNodeIDRef ID, unsigned Num, const SCEV *const *O, size_t N, const Loop *l) - : SCEVNAryExpr(ID, scAddRecExpr, O, N), L(l) { + : SCEVNAryExpr(ID, Num, scAddRecExpr, O, N), L(l) { for (size_t i = 0, e = NumOperands; i != e; ++i) assert(Operands[i]->isLoopInvariant(l) && "Operands of AddRec must be loop-invariant!"); @@ -472,9 +473,9 @@ class SCEVSMaxExpr : public SCEVCommutativeExpr { friend class ScalarEvolution; - SCEVSMaxExpr(const FoldingSetNodeIDRef ID, + SCEVSMaxExpr(const FoldingSetNodeIDRef ID, unsigned Num, const SCEV *const *O, size_t N) - : SCEVCommutativeExpr(ID, scSMaxExpr, O, N) { + : SCEVCommutativeExpr(ID, Num, scSMaxExpr, O, N) { // Max never overflows. setHasNoUnsignedWrap(true); setHasNoSignedWrap(true); @@ -497,9 +498,9 @@ class SCEVUMaxExpr : public SCEVCommutativeExpr { friend class ScalarEvolution; - SCEVUMaxExpr(const FoldingSetNodeIDRef ID, + SCEVUMaxExpr(const FoldingSetNodeIDRef ID, unsigned Num, const SCEV *const *O, size_t N) - : SCEVCommutativeExpr(ID, scUMaxExpr, O, N) { + : SCEVCommutativeExpr(ID, Num, scUMaxExpr, O, N) { // Max never overflows. setHasNoUnsignedWrap(true); setHasNoSignedWrap(true); @@ -524,8 +525,8 @@ friend class ScalarEvolution; Value *V; - SCEVUnknown(const FoldingSetNodeIDRef ID, Value *v) : - SCEV(ID, scUnknown), V(v) {} + SCEVUnknown(const FoldingSetNodeIDRef ID, unsigned Num, Value *v) + : SCEV(ID, Num, scUnknown), V(v) {} public: Value *getValue() const { return V; } Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=105548&r1=105547&r2=105548&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jun 7 14:36:14 2010 @@ -141,7 +141,7 @@ } SCEVCouldNotCompute::SCEVCouldNotCompute() : - SCEV(FoldingSetNodeIDRef(), scCouldNotCompute) {} + SCEV(FoldingSetNodeIDRef(), 0, scCouldNotCompute) {} bool SCEVCouldNotCompute::isLoopInvariant(const Loop *L) const { llvm_unreachable("Attempt to use a SCEVCouldNotCompute object!"); @@ -177,7 +177,9 @@ ID.AddPointer(V); void *IP = 0; if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; - SCEV *S = new (SCEVAllocator) SCEVConstant(ID.Intern(SCEVAllocator), V); + SCEV *S = new (SCEVAllocator) SCEVConstant(ID.Intern(SCEVAllocator), + CurAllocationSequenceNumber++, + V); UniqueSCEVs.InsertNode(S, IP); return S; } @@ -198,9 +200,9 @@ WriteAsOperand(OS, V, false); } -SCEVCastExpr::SCEVCastExpr(const FoldingSetNodeIDRef ID, +SCEVCastExpr::SCEVCastExpr(const FoldingSetNodeIDRef ID, unsigned Num, unsigned SCEVTy, const SCEV *op, const Type *ty) - : SCEV(ID, SCEVTy), Op(op), Ty(ty) {} + : SCEV(ID, Num, SCEVTy), Op(op), Ty(ty) {} bool SCEVCastExpr::dominates(BasicBlock *BB, DominatorTree *DT) const { return Op->dominates(BB, DT); @@ -210,9 +212,9 @@ return Op->properlyDominates(BB, DT); } -SCEVTruncateExpr::SCEVTruncateExpr(const FoldingSetNodeIDRef ID, +SCEVTruncateExpr::SCEVTruncateExpr(const FoldingSetNodeIDRef ID, unsigned Num, const SCEV *op, const Type *ty) - : SCEVCastExpr(ID, scTruncate, op, ty) { + : SCEVCastExpr(ID, Num, scTruncate, op, ty) { assert((Op->getType()->isIntegerTy() || Op->getType()->isPointerTy()) && (Ty->isIntegerTy() || Ty->isPointerTy()) && "Cannot truncate non-integer value!"); @@ -222,9 +224,9 @@ OS << "(trunc " << *Op->getType() << " " << *Op << " to " << *Ty << ")"; } -SCEVZeroExtendExpr::SCEVZeroExtendExpr(const FoldingSetNodeIDRef ID, +SCEVZeroExtendExpr::SCEVZeroExtendExpr(const FoldingSetNodeIDRef ID, unsigned Num, const SCEV *op, const Type *ty) - : SCEVCastExpr(ID, scZeroExtend, op, ty) { + : SCEVCastExpr(ID, Num, scZeroExtend, op, ty) { assert((Op->getType()->isIntegerTy() || Op->getType()->isPointerTy()) && (Ty->isIntegerTy() || Ty->isPointerTy()) && "Cannot zero extend non-integer value!"); @@ -234,9 +236,9 @@ OS << "(zext " << *Op->getType() << " " << *Op << " to " << *Ty << ")"; } -SCEVSignExtendExpr::SCEVSignExtendExpr(const FoldingSetNodeIDRef ID, +SCEVSignExtendExpr::SCEVSignExtendExpr(const FoldingSetNodeIDRef ID, unsigned Num, const SCEV *op, const Type *ty) - : SCEVCastExpr(ID, scSignExtend, op, ty) { + : SCEVCastExpr(ID, Num, scSignExtend, op, ty) { assert((Op->getType()->isIntegerTy() || Op->getType()->isPointerTy()) && (Ty->isIntegerTy() || Ty->isPointerTy()) && "Cannot sign extend non-integer value!"); @@ -510,15 +512,9 @@ if (LST != RST) return LST < RST; - // Then, pick an arbitrary sort. Use the profiling data for speed. - const FoldingSetNodeIDRef &L = LHS->getProfile(); - const FoldingSetNodeIDRef &R = RHS->getProfile(); - size_t LSize = L.getSize(); - size_t RSize = R.getSize(); - if (LSize != RSize) - return LSize < RSize; - return memcmp(L.getData(), R.getData(), - LSize * sizeof(*L.getData())) < 0; + // Then, pick an arbitrary deterministic sort. + return LHS->getAllocationSequenceNumber() < + RHS->getAllocationSequenceNumber(); } }; } @@ -741,6 +737,7 @@ // Recompute the insert position, as it may have been invalidated. if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; SCEV *S = new (SCEVAllocator) SCEVTruncateExpr(ID.Intern(SCEVAllocator), + CurAllocationSequenceNumber++, Op, Ty); UniqueSCEVs.InsertNode(S, IP); return S; @@ -876,6 +873,7 @@ // Recompute the insert position, as it may have been invalidated. if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; SCEV *S = new (SCEVAllocator) SCEVZeroExtendExpr(ID.Intern(SCEVAllocator), + CurAllocationSequenceNumber++, Op, Ty); UniqueSCEVs.InsertNode(S, IP); return S; @@ -1011,6 +1009,7 @@ // Recompute the insert position, as it may have been invalidated. if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; SCEV *S = new (SCEVAllocator) SCEVSignExtendExpr(ID.Intern(SCEVAllocator), + CurAllocationSequenceNumber++, Op, Ty); UniqueSCEVs.InsertNode(S, IP); return S; @@ -1512,6 +1511,7 @@ const SCEV **O = SCEVAllocator.Allocate(Ops.size()); std::uninitialized_copy(Ops.begin(), Ops.end(), O); S = new (SCEVAllocator) SCEVAddExpr(ID.Intern(SCEVAllocator), + CurAllocationSequenceNumber++, O, Ops.size()); UniqueSCEVs.InsertNode(S, IP); } @@ -1722,6 +1722,7 @@ const SCEV **O = SCEVAllocator.Allocate(Ops.size()); std::uninitialized_copy(Ops.begin(), Ops.end(), O); S = new (SCEVAllocator) SCEVMulExpr(ID.Intern(SCEVAllocator), + CurAllocationSequenceNumber++, O, Ops.size()); UniqueSCEVs.InsertNode(S, IP); } @@ -1826,6 +1827,7 @@ void *IP = 0; if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; SCEV *S = new (SCEVAllocator) SCEVUDivExpr(ID.Intern(SCEVAllocator), + CurAllocationSequenceNumber++, LHS, RHS); UniqueSCEVs.InsertNode(S, IP); return S; @@ -1937,6 +1939,7 @@ const SCEV **O = SCEVAllocator.Allocate(Operands.size()); std::uninitialized_copy(Operands.begin(), Operands.end(), O); S = new (SCEVAllocator) SCEVAddRecExpr(ID.Intern(SCEVAllocator), + CurAllocationSequenceNumber++, O, Operands.size(), L); UniqueSCEVs.InsertNode(S, IP); } @@ -2045,6 +2048,7 @@ const SCEV **O = SCEVAllocator.Allocate(Ops.size()); std::uninitialized_copy(Ops.begin(), Ops.end(), O); SCEV *S = new (SCEVAllocator) SCEVSMaxExpr(ID.Intern(SCEVAllocator), + CurAllocationSequenceNumber++, O, Ops.size()); UniqueSCEVs.InsertNode(S, IP); return S; @@ -2150,6 +2154,7 @@ const SCEV **O = SCEVAllocator.Allocate(Ops.size()); std::uninitialized_copy(Ops.begin(), Ops.end(), O); SCEV *S = new (SCEVAllocator) SCEVUMaxExpr(ID.Intern(SCEVAllocator), + CurAllocationSequenceNumber++, O, Ops.size()); UniqueSCEVs.InsertNode(S, IP); return S; @@ -2230,7 +2235,9 @@ ID.AddPointer(V); void *IP = 0; if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; - SCEV *S = new (SCEVAllocator) SCEVUnknown(ID.Intern(SCEVAllocator), V); + SCEV *S = new (SCEVAllocator) SCEVUnknown(ID.Intern(SCEVAllocator), + CurAllocationSequenceNumber++, + V); UniqueSCEVs.InsertNode(S, IP); return S; } @@ -5590,7 +5597,7 @@ //===----------------------------------------------------------------------===// ScalarEvolution::ScalarEvolution() - : FunctionPass(&ID) { + : FunctionPass(&ID), CurAllocationSequenceNumber(0) { } bool ScalarEvolution::runOnFunction(Function &F) { From gohman at apple.com Mon Jun 7 15:19:27 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jun 2010 20:19:27 -0000 Subject: [llvm-commits] [llvm] r105550 - in /llvm/trunk/tools/bugpoint: CrashDebugger.cpp ExtractFunction.cpp Miscompilation.cpp Message-ID: <20100607201927.16F492A6C12C@llvm.org> Author: djg Date: Mon Jun 7 15:19:26 2010 New Revision: 105550 URL: http://llvm.org/viewvc/llvm-project?rev=105550&view=rev Log: Use ->isVoidTy(). Modified: llvm/trunk/tools/bugpoint/CrashDebugger.cpp llvm/trunk/tools/bugpoint/ExtractFunction.cpp llvm/trunk/tools/bugpoint/Miscompilation.cpp Modified: llvm/trunk/tools/bugpoint/CrashDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CrashDebugger.cpp?rev=105550&r1=105549&r2=105550&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/CrashDebugger.cpp (original) +++ llvm/trunk/tools/bugpoint/CrashDebugger.cpp Mon Jun 7 15:19:26 2010 @@ -298,8 +298,7 @@ TerminatorInst *BBTerm = BB->getTerminator(); - if (BB->getTerminator()->getType() != - Type::getVoidTy(BB->getContext())) + if (!BB->getTerminator()->getType()->isVoidTy()) BBTerm->replaceAllUsesWith(Constant::getNullValue(BBTerm->getType())); // Replace the old terminator instruction. @@ -393,7 +392,7 @@ for (BasicBlock::iterator I = FI->begin(), E = FI->end(); I != E;) { Instruction *Inst = I++; if (!Instructions.count(Inst) && !isa(Inst)) { - if (Inst->getType() != Type::getVoidTy(Inst->getContext())) + if (!Inst->getType()->isVoidTy()) Inst->replaceAllUsesWith(UndefValue::get(Inst->getType())); Inst->eraseFromParent(); } Modified: llvm/trunk/tools/bugpoint/ExtractFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ExtractFunction.cpp?rev=105550&r1=105549&r2=105550&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/ExtractFunction.cpp (original) +++ llvm/trunk/tools/bugpoint/ExtractFunction.cpp Mon Jun 7 15:19:26 2010 @@ -73,7 +73,7 @@ Instruction *TheInst = RI; // Got the corresponding instruction! // If this instruction produces a value, replace any users with null values - if (TheInst->getType() != Type::getVoidTy(I->getContext())) + if (!TheInst->getType()->isVoidTy()) TheInst->replaceAllUsesWith(Constant::getNullValue(TheInst->getType())); // Remove the instruction from the program. Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=105550&r1=105549&r2=105550&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original) +++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Mon Jun 7 15:19:26 2010 @@ -848,7 +848,7 @@ Args.push_back(i); // Pass on the arguments to the real function, return its result - if (F->getReturnType() == Type::getVoidTy(F->getContext())) { + if (F->getReturnType()->isVoidTy()) { CallInst::Create(FuncPtr, Args.begin(), Args.end(), "", DoCallBB); ReturnInst::Create(F->getContext(), DoCallBB); } else { From gohman at apple.com Mon Jun 7 15:20:33 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jun 2010 20:20:33 -0000 Subject: [llvm-commits] [llvm] r105551 - in /llvm/trunk: lib/Transforms/IPO/DeadArgumentElimination.cpp test/BugPoint/remove_arguments_test.ll Message-ID: <20100607202033.EA06F2A6C12C@llvm.org> Author: djg Date: Mon Jun 7 15:20:33 2010 New Revision: 105551 URL: http://llvm.org/viewvc/llvm-project?rev=105551&view=rev Log: Make bugpoint dead-argument-hacking actually work, and actually test it. Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp llvm/trunk/test/BugPoint/remove_arguments_test.ll Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=105551&r1=105550&r2=105551&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Mon Jun 7 15:20:33 2010 @@ -120,9 +120,14 @@ typedef SmallVector UseVector; + protected: + // DAH uses this to specify a different ID. + explicit DAE(void *ID) : ModulePass(ID) {} + public: static char ID; // Pass identification, replacement for typeid DAE() : ModulePass(&ID) {} + bool runOnModule(Module &M); virtual bool ShouldHackArguments() const { return false; } @@ -155,6 +160,8 @@ /// by bugpoint. struct DAH : public DAE { static char ID; + DAH() : DAE(&ID) {} + virtual bool ShouldHackArguments() const { return true; } }; } Modified: llvm/trunk/test/BugPoint/remove_arguments_test.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/BugPoint/remove_arguments_test.ll?rev=105551&r1=105550&r2=105551&view=diff ============================================================================== --- llvm/trunk/test/BugPoint/remove_arguments_test.ll (original) +++ llvm/trunk/test/BugPoint/remove_arguments_test.ll Mon Jun 7 15:20:33 2010 @@ -1,10 +1,12 @@ ; RUN: bugpoint %s -output-prefix %t -bugpoint-crashcalls -silence-passes +; RUN: llvm-dis remove_arguments_test.ll.tmp-reduced-simplified.bc -o - | FileCheck %s ; Test to make sure that arguments are removed from the function if they are ; unnecessary. declare i32 @test2() +; CHECK: define void @test() { define i32 @test(i32 %A, i32 %B, float %C) { call i32 @test2() ret i32 %1 From gohman at apple.com Mon Jun 7 15:28:38 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jun 2010 20:28:38 -0000 Subject: [llvm-commits] [llvm] r105552 - in /llvm/trunk: test/BugPoint/remove_arguments_test.ll tools/bugpoint/ExtractFunction.cpp Message-ID: <20100607202838.290C12A6C12C@llvm.org> Author: djg Date: Mon Jun 7 15:28:37 2010 New Revision: 105552 URL: http://llvm.org/viewvc/llvm-project?rev=105552&view=rev Log: Run dead type elimination after dead argument elimination. Modified: llvm/trunk/test/BugPoint/remove_arguments_test.ll llvm/trunk/tools/bugpoint/ExtractFunction.cpp Modified: llvm/trunk/test/BugPoint/remove_arguments_test.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/BugPoint/remove_arguments_test.ll?rev=105552&r1=105551&r2=105552&view=diff ============================================================================== --- llvm/trunk/test/BugPoint/remove_arguments_test.ll (original) +++ llvm/trunk/test/BugPoint/remove_arguments_test.ll Mon Jun 7 15:28:37 2010 @@ -2,12 +2,16 @@ ; RUN: llvm-dis remove_arguments_test.ll.tmp-reduced-simplified.bc -o - | FileCheck %s ; Test to make sure that arguments are removed from the function if they are -; unnecessary. +; unnecessary. And clean up any types that that frees up too. + +; CHECK: target triple +; CHECK-NOT: struct.anon +%struct.anon = type { i32 } declare i32 @test2() ; CHECK: define void @test() { -define i32 @test(i32 %A, i32 %B, float %C) { +define i32 @test(i32 %A, %struct.anon* %B, float %C) { call i32 @test2() ret i32 %1 } Modified: llvm/trunk/tools/bugpoint/ExtractFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/ExtractFunction.cpp?rev=105552&r1=105551&r2=105552&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/ExtractFunction.cpp (original) +++ llvm/trunk/tools/bugpoint/ExtractFunction.cpp Mon Jun 7 15:28:37 2010 @@ -116,13 +116,14 @@ std::vector CleanupPasses; CleanupPasses.push_back(getPI(createGlobalDCEPass())); - CleanupPasses.push_back(getPI(createDeadTypeEliminationPass())); if (MayModifySemantics) CleanupPasses.push_back(getPI(createDeadArgHackingPass())); else CleanupPasses.push_back(getPI(createDeadArgEliminationPass())); + CleanupPasses.push_back(getPI(createDeadTypeEliminationPass())); + Module *New = runPassesOn(M, CleanupPasses); if (New == 0) { errs() << "Final cleanups failed. Sorry. :( Please report a bug!\n"; From gohman at apple.com Mon Jun 7 15:58:11 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jun 2010 20:58:11 -0000 Subject: [llvm-commits] [llvm] r105553 - /llvm/trunk/test/BugPoint/remove_arguments_test.ll Message-ID: <20100607205811.D2CEA2A6C12C@llvm.org> Author: djg Date: Mon Jun 7 15:58:11 2010 New Revision: 105553 URL: http://llvm.org/viewvc/llvm-project?rev=105553&view=rev Log: Fix this test to work under lit. Modified: llvm/trunk/test/BugPoint/remove_arguments_test.ll Modified: llvm/trunk/test/BugPoint/remove_arguments_test.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/BugPoint/remove_arguments_test.ll?rev=105553&r1=105552&r2=105553&view=diff ============================================================================== --- llvm/trunk/test/BugPoint/remove_arguments_test.ll (original) +++ llvm/trunk/test/BugPoint/remove_arguments_test.ll Mon Jun 7 15:58:11 2010 @@ -1,5 +1,5 @@ ; RUN: bugpoint %s -output-prefix %t -bugpoint-crashcalls -silence-passes -; RUN: llvm-dis remove_arguments_test.ll.tmp-reduced-simplified.bc -o - | FileCheck %s +; RUN: llvm-dis %t-reduced-simplified.bc -o - | FileCheck %s ; Test to make sure that arguments are removed from the function if they are ; unnecessary. And clean up any types that that frees up too. From grosbach at apple.com Mon Jun 7 16:28:55 2010 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 07 Jun 2010 21:28:55 -0000 Subject: [llvm-commits] [llvm] r105554 - /llvm/trunk/lib/CodeGen/IfConversion.cpp Message-ID: <20100607212855.E6F0C2A6C12C@llvm.org> Author: grosbach Date: Mon Jun 7 16:28:55 2010 New Revision: 105554 URL: http://llvm.org/viewvc/llvm-project?rev=105554&view=rev Log: Cleanup. Process the dbg_values separately Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IfConversion.cpp?rev=105554&r1=105553&r2=105554&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/IfConversion.cpp (original) +++ llvm/trunk/lib/CodeGen/IfConversion.cpp Mon Jun 7 16:28:55 2010 @@ -514,15 +514,14 @@ MachineBasicBlock::iterator TI = TrueBBI.BB->begin(); MachineBasicBlock::iterator FI = FalseBBI.BB->begin(); - while (1) { - if (TI == TrueBBI.BB->end() || FI == FalseBBI.BB->end()) - break; - // Skip dbg_value instructions - if (TI->isDebugValue()) - ++TI; - if (FI->isDebugValue()) - ++FI; - + MachineBasicBlock::iterator TIE = TrueBBI.BB->end(); + MachineBasicBlock::iterator FIE = FalseBBI.BB->end(); + // Skip dbg_value instructions + while (TI != TIE && TI->isDebugValue()) + ++TI; + while (FI != FIE && FI->isDebugValue()) + ++FI; + while (TI != TIE && FI != FIE) { if (!TI->isIdenticalTo(FI)) break; ++Dups1; @@ -532,15 +531,14 @@ TI = firstNonBranchInst(TrueBBI.BB, TII); FI = firstNonBranchInst(FalseBBI.BB, TII); - while (1) { - if (TI == TrueBBI.BB->begin() || FI == FalseBBI.BB->begin()) - break; - // Skip dbg_value instructions - if (TI->isDebugValue()) - --TI; - if (FI->isDebugValue()) - --FI; - + MachineBasicBlock::iterator TIB = TrueBBI.BB->begin(); + MachineBasicBlock::iterator FIB = FalseBBI.BB->begin(); + // Skip dbg_value instructions + while (TI != TIB && TI->isDebugValue()) + --TI; + while (FI != FIB && FI->isDebugValue()) + --FI; + while (TI != TIB && FI != FIB) { if (!TI->isIdenticalTo(FI)) break; ++Dups2; From nicholas at mxc.ca Mon Jun 7 16:42:19 2010 From: nicholas at mxc.ca (Nick Lewycky) Date: Mon, 07 Jun 2010 21:42:19 -0000 Subject: [llvm-commits] [llvm] r105556 - /llvm/trunk/tools/gold/gold-plugin.cpp Message-ID: <20100607214219.695872A6C12C@llvm.org> Author: nicholas Date: Mon Jun 7 16:42:19 2010 New Revision: 105556 URL: http://llvm.org/viewvc/llvm-project?rev=105556&view=rev Log: Plug a leak in the non-error case by removing one level of indirection. Modified: llvm/trunk/tools/gold/gold-plugin.cpp Modified: llvm/trunk/tools/gold/gold-plugin.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=105556&r1=105555&r2=105556&view=diff ============================================================================== --- llvm/trunk/tools/gold/gold-plugin.cpp (original) +++ llvm/trunk/tools/gold/gold-plugin.cpp Mon Jun 7 16:42:19 2010 @@ -419,17 +419,15 @@ (*message)(LDPL_ERROR, "%s", ErrMsg.c_str()); return LDPS_ERR; } - raw_fd_ostream *objFile = - new raw_fd_ostream(uniqueObjPath.c_str(), ErrMsg, - raw_fd_ostream::F_Binary); + raw_fd_ostream objFile(uniqueObjPath.c_str(), ErrMsg, + raw_fd_ostream::F_Binary); if (!ErrMsg.empty()) { - delete objFile; (*message)(LDPL_ERROR, "%s", ErrMsg.c_str()); return LDPS_ERR; } - objFile->write(buffer, bufsize); - objFile->close(); + objFile.write(buffer, bufsize); + objFile.close(); lto_codegen_dispose(cg); From grosbach at apple.com Mon Jun 7 16:48:47 2010 From: grosbach at apple.com (Jim Grosbach) Date: Mon, 07 Jun 2010 21:48:47 -0000 Subject: [llvm-commits] [llvm] r105557 - /llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp Message-ID: <20100607214847.E04732A6C12C@llvm.org> Author: grosbach Date: Mon Jun 7 16:48:47 2010 New Revision: 105557 URL: http://llvm.org/viewvc/llvm-project?rev=105557&view=rev Log: Handle dbg_value instructions (i.e., skip them) when generating IT blocks. rdar://7797940 Modified: llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp Modified: llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp?rev=105557&r1=105556&r2=105557&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp Mon Jun 7 16:48:47 2010 @@ -71,8 +71,10 @@ unsigned Mask = 0, Pos = 3; // Branches, including tricky ones like LDM_RET, need to end an IT // block so check the instruction we just put in the block. - while (MBBI != E && Pos && - (!MI->getDesc().isBranch() && !MI->getDesc().isReturn())) { + for (; MBBI != E && Pos && + (!MI->getDesc().isBranch() && !MI->getDesc().isReturn()) ; ++MBBI) { + if (MBBI->isDebugValue()) + continue; MachineInstr *NMI = &*MBBI; MI = NMI; DebugLoc ndl = NMI->getDebugLoc(); @@ -83,7 +85,6 @@ else break; --Pos; - ++MBBI; } Mask |= (1 << Pos); // Tag along (firstcond[0] << 4) with the mask. From stuart at apple.com Mon Jun 7 16:50:54 2010 From: stuart at apple.com (Stuart Hastings) Date: Mon, 07 Jun 2010 21:50:54 -0000 Subject: [llvm-commits] [llvm] r105559 - /llvm/trunk/test/FrontendC++/2010-04-30-OptimizedMethod-Dbg.cpp Message-ID: <20100607215054.4777A2A6C12C@llvm.org> Author: stuart Date: Mon Jun 7 16:50:54 2010 New Revision: 105559 URL: http://llvm.org/viewvc/llvm-project?rev=105559&view=rev Log: Tweak test for debug/metadata change, update to FileCheck. Radar 7424645. Modified: llvm/trunk/test/FrontendC++/2010-04-30-OptimizedMethod-Dbg.cpp Modified: llvm/trunk/test/FrontendC++/2010-04-30-OptimizedMethod-Dbg.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2010-04-30-OptimizedMethod-Dbg.cpp?rev=105559&r1=105558&r2=105559&view=diff ============================================================================== --- llvm/trunk/test/FrontendC++/2010-04-30-OptimizedMethod-Dbg.cpp (original) +++ llvm/trunk/test/FrontendC++/2010-04-30-OptimizedMethod-Dbg.cpp Mon Jun 7 16:50:54 2010 @@ -1,5 +1,4 @@ -// RUN: %llvmgcc -g -S -O2 %s -o %t -// RUN: grep "i1 false, i1 true. . . DW_TAG_subprogram" %t | count 2 +// RUN: %llvmgcc -g -S -O2 %s -o - | FileCheck %s class foo { public: @@ -8,10 +7,12 @@ }; int foo::bar(int x) { + // CHECK: {{i1 false, i1 true(, i[0-9]+ [^\}]+[}]|[}]) ; \[ DW_TAG_subprogram \]}} return x*4 + 1; } int foo::baz(int x) { + // CHECK: {{i1 false, i1 true(, i[0-9]+ [^\},]+[}]|[}]) ; \[ DW_TAG_subprogram \]}} return x*4 + 1; } From gohman at apple.com Mon Jun 7 17:32:11 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jun 2010 22:32:11 -0000 Subject: [llvm-commits] [llvm] r105561 - /llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp Message-ID: <20100607223211.121FC2A6C12C@llvm.org> Author: djg Date: Mon Jun 7 17:32:10 2010 New Revision: 105561 URL: http://llvm.org/viewvc/llvm-project?rev=105561&view=rev Log: Add some basic debug output. Modified: llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp Modified: llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp?rev=105561&r1=105560&r2=105561&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp (original) +++ llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp Mon Jun 7 17:32:10 2010 @@ -178,6 +178,8 @@ continue; // Move the block. + DEBUG(dbgs() << "CGP: Moving blocks starting at BB#" << Pred->getNumber() + << " to top of loop.\n"); Changed = true; // Move it and all the blocks that can reach it via fallthrough edges @@ -297,6 +299,8 @@ continue; // Move the block. + DEBUG(dbgs() << "CGP: Moving blocks starting at BB#" << BB->getNumber() + << " to be contiguous with loop.\n"); Changed = true; // Process this block and all loop blocks contiguous with it, to keep From daniel at zuster.org Mon Jun 7 18:00:12 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 07 Jun 2010 23:00:12 -0000 Subject: [llvm-commits] [zorg] r105562 - /zorg/trunk/lnt/lnt/formats/__init__.py Message-ID: <20100607230012.1167E2A6C12C@llvm.org> Author: ddunbar Date: Mon Jun 7 18:00:11 2010 New Revision: 105562 URL: http://llvm.org/viewvc/llvm-project?rev=105562&view=rev Log: lnt checkformat: Fix a typo on an error path. Modified: zorg/trunk/lnt/lnt/formats/__init__.py Modified: zorg/trunk/lnt/lnt/formats/__init__.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/formats/__init__.py?rev=105562&r1=105561&r2=105562&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/formats/__init__.py (original) +++ zorg/trunk/lnt/lnt/formats/__init__.py Mon Jun 7 18:00:11 2010 @@ -24,7 +24,7 @@ """ return formats_by_name.get(name) - + def guess_format(path_or_file): """guess_format(path_or_file) -> [format] @@ -71,7 +71,8 @@ f = guess_format(path_or_file) if f is None: if isinstance(path_or_file, str): - raise SystemExit("unable to guess input format for %r" % input) + raise SystemExit("unable to guess input format for %r" % ( + path_or_file,)) else: raise SystemExit("unable to guess input format for file") else: From daniel at zuster.org Mon Jun 7 18:00:15 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 07 Jun 2010 23:00:15 -0000 Subject: [llvm-commits] [zorg] r105563 - /zorg/trunk/lnt/lnt/viewer/PerfDB.py Message-ID: <20100607230015.5506F2A6C12D@llvm.org> Author: ddunbar Date: Mon Jun 7 18:00:15 2010 New Revision: 105563 URL: http://llvm.org/viewvc/llvm-project?rev=105563&view=rev Log: DB: Track Machine, Run, and Test table revisions, so we can effectively cache information which is mostly static. Modified: zorg/trunk/lnt/lnt/viewer/PerfDB.py Modified: zorg/trunk/lnt/lnt/viewer/PerfDB.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/PerfDB.py?rev=105563&r1=105562&r2=105563&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/viewer/PerfDB.py (original) +++ zorg/trunk/lnt/lnt/viewer/PerfDB.py Mon Jun 7 18:00:15 2010 @@ -12,6 +12,20 @@ from sqlalchemy.orm.collections import attribute_mapped_collection Base = sqlalchemy.ext.declarative.declarative_base() +class Revision(Base): + __tablename__ = 'Revision' + + id = Column("ID", Integer, primary_key=True) + name = Column("Name", String(256)) + number = Column("Number", Integer) + + def __init__(self, name, number): + self.name = name + self.number = number + + def __repr__(self): + return '%s%r' % (self.__class__.__name__, (self.name, self.number)) + class Machine(Base): __tablename__ = 'Machine' @@ -165,6 +179,21 @@ Base.metadata.create_all(self.engine) self.session = sqlalchemy.orm.sessionmaker(self.engine)() + self.modified_machine = self.modified_run = self.modified_test = False + + # Make sure revision numbers exists. + for r in ("Machine","MachineInfo","Run","RunInfo","Test","TestInfo"): + self.get_revision(r) + self.commit() + + def get_revision(self, name): + for r in self.session.query(Revision).filter_by(name=name): + return r + r = Revision(name, 0) + self.session.add(r) + return r + def get_revision_number(self, name): + return self.get_revision(name).number def machines(self, name=None): q = self.session.query(Machine) @@ -225,6 +254,7 @@ m = Machine(name, number) m.info = dict((k,MachineInfo(m,k,v)) for k,v in info) self.session.add(m) + self.modified_machine = True return m,True def getOrCreateTest(self, name, info): @@ -236,6 +266,7 @@ t = Test(name) t.info = dict((k,TestInfo(t,k,v)) for k,v in info) self.session.add(t) + self.modified_test = True return t,True def getOrCreateRun(self, machine, start_time, end_time, info): @@ -262,6 +293,7 @@ r = Run(machine, start_time, end_time) r.info = dict((k,RunInfo(r,k,v)) for k,v in info) self.session.add(r) + self.modified_run = True return r,True def addSample(self, run, test, value): @@ -284,10 +316,21 @@ self.session.execute(q) def commit(self): + if self.modified_machine: + self.get_revision("Machine").number += 1 + self.get_revision("MachineInfo").number += 1 + if self.modified_run: + self.get_revision("Run").number += 1 + self.get_revision("RunInfo").number += 1 + if self.modified_test: + self.get_revision("Test").number += 1 + self.get_revision("TestInfo").number += 1 self.session.commit() + self.modified_machine = self.modified_test = self.modified_run = False def rollback(self): self.session.rollback() + self.modified_machine = self.modified_test = self.modified_run = False def importDataFromDict(db, data): # FIXME: Validate data From daniel at zuster.org Mon Jun 7 18:00:19 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 07 Jun 2010 23:00:19 -0000 Subject: [llvm-commits] [zorg] r105564 - in /zorg/trunk/lnt/lnt: db/ db/__init__.py db/perfdbsummary.py viewer/NTStyleBrowser.ptl viewer/root.ptl viewer/simple.ptl Message-ID: <20100607230020.069A12A6C12C@llvm.org> Author: ddunbar Date: Mon Jun 7 18:00:19 2010 New Revision: 105564 URL: http://llvm.org/viewvc/llvm-project?rev=105564&view=rev Log: LNT/viewer: Add support for multiple 'simple' style test suites within the same database. Added: zorg/trunk/lnt/lnt/db/ zorg/trunk/lnt/lnt/db/__init__.py zorg/trunk/lnt/lnt/db/perfdbsummary.py Modified: zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl zorg/trunk/lnt/lnt/viewer/root.ptl zorg/trunk/lnt/lnt/viewer/simple.ptl Added: zorg/trunk/lnt/lnt/db/__init__.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/db/__init__.py?rev=105564&view=auto ============================================================================== --- zorg/trunk/lnt/lnt/db/__init__.py (added) +++ zorg/trunk/lnt/lnt/db/__init__.py Mon Jun 7 18:00:19 2010 @@ -0,0 +1 @@ +__all__ = [] Added: zorg/trunk/lnt/lnt/db/perfdbsummary.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/db/perfdbsummary.py?rev=105564&view=auto ============================================================================== --- zorg/trunk/lnt/lnt/db/perfdbsummary.py (added) +++ zorg/trunk/lnt/lnt/db/perfdbsummary.py Mon Jun 7 18:00:19 2010 @@ -0,0 +1,36 @@ +""" +Classes for caching metadata about a PerfDB instance. +""" + +from lnt.viewer.PerfDB import RunInfo + +class SuiteSummary: + def __init__(self, name, path): + self.name = name + self.path = path + +class PerfDBSummary: + @staticmethod + def fromdb(db): + revision = db.get_revision_number("Run") + + # Look for all the run tags and use them to identify the available + # suites. + q = db.session.query(RunInfo.value.distinct()) + q = q.filter(RunInfo.key == "tag") + + suites = [SuiteSummary("Nightlytest", ("nightlytest",))] + for tag, in q: + if tag == 'nightlytest': + continue + suites.append(SuiteSummary(tag, ("simple",tag))) + + suites.sort(key=lambda s: s.name) + return PerfDBSummary(revision, suites) + + def __init__(self, revision, suites): + self.revision = revision + self.suites = suites + + def is_up_to_date(self, db): + return self.revision == db.get_revision("Run") Modified: zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl?rev=105564&r1=105563&r2=105564&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl (original) +++ zorg/trunk/lnt/lnt/viewer/NTStyleBrowser.ptl Mon Jun 7 18:00:19 2010 @@ -17,7 +17,7 @@ import Util from NTUtil import * -from PerfDB import Machine, Run +from PerfDB import Machine, Run, RunInfo class TestRunUI(Directory): def __init__(self, root, idstr): @@ -316,8 +316,9 @@ class MachineUI(Directory): _q_exports = [""] - def __init__(self, root, idstr): + def __init__(self, root, parent, idstr): self.root = root + self.parent = parent try: self.id = int(idstr) except ValueError, exc: @@ -345,8 +346,8 @@ machine = db.getMachine(self.id) self.root.getHeader("Machine: %s:%d" % (machine.name,machine.number), - "../../..", - components=(('nightlytest','nightlytest'),), + "%s/../.." % self.parent.root_path, + components=self.parent.components, addPopupJS=True) # Find all runs on this machine. @@ -489,7 +490,7 @@ """ def _q_lookup(self, component): - return MachineUI(self.parent.root, component) + return MachineUI(self.parent.root, self.parent, component) class ProgramsDirectory(Directory): _q_exports = [""] @@ -510,6 +511,8 @@ def __init__(self, root): Directory.__init__(self) self.root = root + self.root_path = '..' + self.components = (('nightlytest','nightlytest'),) def getTags(self): abstract @@ -518,8 +521,7 @@ # Get a DB connection db = self.root.getDB() - self.root.getHeader('Overview', "..", - components=(('nightlytest','nightlytest'),)) + self.root.getHeader('Overview', self.root_path, self.components) # Find recent runs. """ Modified: zorg/trunk/lnt/lnt/viewer/root.ptl URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/root.ptl?rev=105564&r1=105563&r2=105564&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/viewer/root.ptl (original) +++ zorg/trunk/lnt/lnt/viewer/root.ptl Mon Jun 7 18:00:19 2010 @@ -17,8 +17,9 @@ from quixote.util import StaticDirectory import lnt -import PerfDB, Util -from PerfDB import Machine, Run +from lnt.db import perfdbsummary +from lnt.viewer import PerfDB, Util +from lnt.viewer.PerfDB import Machine, Run class RootDirectory(Resolving, Directory): _q_exports = ["", "resources", "js", "machines", "runs", "tests", @@ -36,6 +37,7 @@ if self.dbInfo is None: self.dbInfo = config.databases[dbName] self.pathToRoot = pathToRoot + self.db_summary = None def getDB(self): db = PerfDB.PerfDB(self.dbInfo.path) @@ -170,22 +172,25 @@ time.localtime(current)), current - quixote.get_request().start_time) + def get_db_summary(self, db): + if not self.db_summary or not self.db_summary.is_up_to_date(db): + self.db_summary = perfdbsummary.PerfDBSummary.fromdb(db) + return self.db_summary + def _q_index [html] (self): + # Get a DB connection. + db = self.getDB() + self.getHeader("Overview", ".", components=(),) - # Available UIs. - - if self.dbInfo.showSimple: - """ - Simple Test Viewer - """ - - if self.dbInfo.showNightlytest: - """ -

Nightly Test Results

- Nightly Test + # Display available test result suites. + summary = self.get_db_summary(db) + """ +

Test Results

""" + for suite in summary.suites: """ + %s
""" % (os.path.join(*suite.path), suite.name) if self.dbInfo.showGeneral: """ Modified: zorg/trunk/lnt/lnt/viewer/simple.ptl URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/simple.ptl?rev=105564&r1=105563&r2=105564&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/viewer/simple.ptl (original) +++ zorg/trunk/lnt/lnt/viewer/simple.ptl Mon Jun 7 18:00:19 2010 @@ -33,8 +33,9 @@ class SimpleRunUI(Directory): _q_exports = ["", "graph"] - def __init__(self, root, idstr): + def __init__(self, root, tag, idstr): self.root = root + self.tag = tag try: self.id = int(idstr) except ValueError, exc: @@ -70,8 +71,9 @@ # Find previous runs, ordered by time. runs = db.runs(run.machine).order_by(Run.start_time.desc()).all() + # FIXME: Fold this into query. runs = [r for r in runs - if 'tag' in r.info and r.info['tag'].value == 'simple'] + if 'tag' in r.info and r.info['tag'].value == self.tag] # Order by run_order info key, if given. for r in runs: @@ -204,10 +206,12 @@ run,runs,has_order,compareTo = self.getInfo(db) machine = run.machine - self.root.getHeader('Run Results', "../..", - components=(('simple','simple'), + self.root.getHeader('Run Results', "../../..", + components=((self.tag, + '%s/%s' % ('simple',self.tag)), ('machine', - 'simple/machines/%d' % machine.id)), + 'simple/%s/machines/%d'%(self.tag, + machine.id))), addPopupJS=True, addFormCSS=True) self.show_run_page(db, run, runs, compareTo, self._q_index_body) @@ -458,7 +462,7 @@ graph.draw(); } """ % (plots,xAxis_format) - self.root.getHeader('Run Results', "..", + self.root.getHeader('Run Results', "../..", components=(('simple','simple'), ('machine', 'simple/machines/%d' % machine.id), @@ -476,7 +480,7 @@ # Find all test names. q = db.session.query(Test) - q = q.filter(Test.name.startswith(str('simple.'))) + q = q.filter(Test.name.startswith(self.tag)) tests = list(q) # Collect all the test data. @@ -631,11 +635,25 @@ """ -class RootDirectory(NTStyleBrowser.RecentMachineDirectory): +class TagRootDirectory(NTStyleBrowser.RecentMachineDirectory): _q_exports = [""] + def __init__(self, root, tag): + NTStyleBrowser.RecentMachineDirectory.__init__(self, root) + self.tag = tag + self.root_path = '../..' + self.components = ((self.tag, '%s/%s' % ('simple',self.tag)),) + def getTags(self): - return ('simple',) + return (self.tag,) def getTestRunUI(self, component): - return SimpleRunUI(self.root, component) + return SimpleRunUI(self.root, self.tag, component) + +class RootDirectory(Directory): + def __init__(self, root): + Directory.__init__(self) + self.root = root + + def _q_lookup(self, component): + return TagRootDirectory(self.root, component) From daniel at zuster.org Mon Jun 7 18:00:23 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 07 Jun 2010 23:00:23 -0000 Subject: [llvm-commits] [zorg] r105565 - in /zorg/trunk/lnt/lnt: db/perfdbsummary.py viewer/PerfDB.py viewer/simple.ptl Message-ID: <20100607230023.93B352A6C12D@llvm.org> Author: ddunbar Date: Mon Jun 7 18:00:23 2010 New Revision: 105565 URL: http://llvm.org/viewvc/llvm-project?rev=105565&view=rev Log: LNT/viewer: Add a cache for 'simple' style test suite test metadata. Modified: zorg/trunk/lnt/lnt/db/perfdbsummary.py zorg/trunk/lnt/lnt/viewer/PerfDB.py zorg/trunk/lnt/lnt/viewer/simple.ptl Modified: zorg/trunk/lnt/lnt/db/perfdbsummary.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/db/perfdbsummary.py?rev=105565&r1=105564&r2=105565&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/db/perfdbsummary.py (original) +++ zorg/trunk/lnt/lnt/db/perfdbsummary.py Mon Jun 7 18:00:23 2010 @@ -2,7 +2,7 @@ Classes for caching metadata about a PerfDB instance. """ -from lnt.viewer.PerfDB import RunInfo +from lnt.viewer.PerfDB import RunInfo, Test class SuiteSummary: def __init__(self, name, path): @@ -33,4 +33,65 @@ self.suites = suites def is_up_to_date(self, db): - return self.revision == db.get_revision("Run") + return self.revision == db.get_revision_number("Run") + +class SimpleSuiteSummary: + @staticmethod + def fromdb(db, tag): + revision = db.get_revision_number("Test") + + # Find all test names. + q = db.session.query(Test) + q = q.filter(Test.name.startswith(tag)) + tests = list(q) + + # Collect all the test data. + test_names = set() + parameter_sets = set() + test_map = {} + for t in tests: + name = t.name.split(str('.'),1)[1] + test_names.add(name) + + items = [(k,v.value) for k,v in t.info.items()] + items.sort() + key = tuple(items) + + parameter_sets.add(key) + test_map[(name, key)] = t + + # Order the test names. + test_names = list(test_names) + test_names.sort() + + # Collect the set of all parameter keys. + parameter_keys = list(set([k for pset in parameter_sets + for k,v in pset])) + parameter_keys.sort() + + # Order the parameter sets and convert to dictionaries. + parameter_sets = list(parameter_sets) + parameter_sets.sort() + + return SimpleSuiteSummary(revision, tag, test_names, test_map, + parameter_keys, parameter_sets) + + def __init__(self, revision, tag, test_names, test_map, + parameter_keys, parameter_sets): + self.revision = revision + self.tag = tag + self.test_names = test_names + self.test_map = test_map + self.parameter_keys = parameter_keys + self.parameter_sets = parameter_sets + + def is_up_to_date(self, db): + return self.revision == db.get_revision_number("Test") + +_cache = {} +def get_simple_suite_summary(db, tag): + key = (db.path, tag) + entry = _cache.get(key) + if entry is None or not entry.is_up_to_date(db): + _cache[key] = entry = SimpleSuiteSummary.fromdb(db, tag) + return entry Modified: zorg/trunk/lnt/lnt/viewer/PerfDB.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/PerfDB.py?rev=105565&r1=105564&r2=105565&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/viewer/PerfDB.py (original) +++ zorg/trunk/lnt/lnt/viewer/PerfDB.py Mon Jun 7 18:00:23 2010 @@ -173,6 +173,7 @@ if (not path.startswith('mysql://') and not path.startswith('sqlite://')): path = 'sqlite:///' + path + self.path = path self.engine = sqlalchemy.create_engine(path, echo=echo) # Create the tables in case this is a new database. Modified: zorg/trunk/lnt/lnt/viewer/simple.ptl URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/simple.ptl?rev=105565&r1=105564&r2=105565&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/viewer/simple.ptl (original) +++ zorg/trunk/lnt/lnt/viewer/simple.ptl Mon Jun 7 18:00:23 2010 @@ -13,6 +13,8 @@ from quixote.directory import Directory from quixote.errors import TraversalError +from lnt.db import perfdbsummary + import Util, NTStyleBrowser from Util import safediv from NTUtil import * @@ -225,10 +227,8 @@ run,runs,has_order,compareTo = self.getInfo(db) machine = run.machine - # Load the metadata. - - test_names,test_map,parameter_keys,parameter_sets = self.\ - get_simple_metadata(db) + # Load the test suite summary. + ts_summary = perfdbsummary.get_simple_suite_summary(db, self.tag) # Load the form data. graph_tests = [] @@ -237,10 +237,10 @@ if name.startswith(str('test.')): graph_tests.append(name[5:]) elif name.startswith(str('pset.')): - graph_psets.append(parameter_sets[int(name[5:])]) + graph_psets.append(ts_summary.parameter_sets[int(name[5:])]) # Get the test ids we want data for. - test_ids = [test_map[(name,pset)].id + test_ids = [ts_summary.test_map[(name,pset)].id for name in graph_tests for pset in graph_psets] @@ -272,7 +272,8 @@ d[run_key] = value # Build the graph data - pset_id_map = dict([(pset,i) for i,pset in enumerate(parameter_sets)]) + pset_id_map = dict([(pset,i) + for i,pset in enumerate(ts_summary.parameter_sets)]) legend = [] plot_points = [] plots = "" @@ -284,7 +285,7 @@ show_all_points = False for name in graph_tests: for pset in graph_psets: - test_id = test_map[(name,pset)].id + test_id = ts_summary.test_map[(name,pset)].id # Get the plot for this test. # @@ -447,7 +448,6 @@ %s

""" % (' '.join(map(str, new_sample_list)), ' '.join(map(str, Util.sorted(resample_list)))) - if has_order: xAxis_format = 'graph.xAxis.formats.normal' @@ -462,57 +462,20 @@ graph.draw(); } """ % (plots,xAxis_format) - self.root.getHeader('Run Results', "../..", - components=(('simple','simple'), + self.root.getHeader('Run Results', "../../..", + components=((self.tag, + '%s/%s' % ('simple',self.tag)), ('machine', - 'simple/machines/%d' % machine.id), - ('run', 'simple/%d' % run.id)), + 'simple/%s/machines/%d' %(self.tag, + machine.id)), + ('run', 'simple/%s/%d' % (self.tag, + run.id))), addPopupJS=True, addGraphJS=True, addJSScript=graph_init, onload="init()") self.show_run_page(db, run, runs, compareTo, graph_body) - def get_simple_metadata(self, db): - """Compute the metadata about tests, parameter sets, etc.""" - - # FIXME: We can cache this in a number of ways. - - # Find all test names. - q = db.session.query(Test) - q = q.filter(Test.name.startswith(self.tag)) - tests = list(q) - - # Collect all the test data. - test_names = set() - parameter_sets = set() - test_map = {} - for t in tests: - name = t.name.split(str('.'),1)[1] - test_names.add(name) - - items = [(k,v.value) for k,v in t.info.items()] - items.sort() - key = tuple(items) - - parameter_sets.add(key) - test_map[(name, key)] = t - - # Order the test names. - test_names = list(test_names) - test_names.sort() - - # Collect the set of all parameter keys. - parameter_keys = list(set([k for pset in parameter_sets - for k,v in pset])) - parameter_keys.sort() - - # Order the parameter sets and convert to dictionaries. - parameter_sets = list(parameter_sets) - parameter_sets.sort() - - return test_names,test_map,parameter_keys,parameter_sets - def _q_index_body [html] (self, db, run, runs, compare_to): # Find the tests. The simple UI maps all tests that start with # 'simple.'. @@ -529,13 +492,10 @@ prev_id = None interesting_runs = (run.id,) - # Load the metadata. - - test_names,test_map,parameter_keys,parameter_sets = self.\ - get_simple_metadata(db) + # Load the test suite summary. + ts_summary = perfdbsummary.get_simple_suite_summary(db, self.tag) # Load the run sample data. - q = db.session.query(Sample.value, Sample.run_id, Sample.test_id) q = q.filter(Sample.run_id.in_(interesting_runs)) @@ -579,18 +539,18 @@ Name Parameters - """ % len(parameter_sets) - for key in parameter_keys: + """ % len(ts_summary.parameter_sets) + for key in ts_summary.parameter_keys: """ %s""" % key """ """ - for (i,pset) in enumerate(parameter_sets): + for (i,pset) in enumerate(ts_summary.parameter_sets): """ P%s""" % (i,) pmap = dict(pset) - for key in parameter_keys: + for key in ts_summary.parameter_keys: item = pmap.get(key) if item is None: item = "-" @@ -609,19 +569,19 @@ """ - for i in range(len(parameter_sets)): + for i in range(len(ts_summary.parameter_sets)): """ """ % (i, i) """ """ - for name in test_names: + for name in ts_summary.test_names: """ """ % (name, name) - for pset in parameter_sets: - test = test_map.get((name,pset)) + for pset in ts_summary.parameter_sets: + test = ts_summary.test_map.get((name,pset)) if test is None: """ """ From daniel at zuster.org Mon Jun 7 18:00:27 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 07 Jun 2010 23:00:27 -0000 Subject: [llvm-commits] [zorg] r105566 - in /zorg/trunk/lnt/lnt: db/perfdbsummary.py testing/__init__.py viewer/simple.ptl Message-ID: <20100607230027.228902A6C12C@llvm.org> Author: ddunbar Date: Mon Jun 7 18:00:26 2010 New Revision: 105566 URL: http://llvm.org/viewvc/llvm-project?rev=105566&view=rev Log: LNT/viewer: Add support for using a '.success' and '.status' naming convention to attach test status results to performance data. Modified: zorg/trunk/lnt/lnt/db/perfdbsummary.py zorg/trunk/lnt/lnt/testing/__init__.py zorg/trunk/lnt/lnt/viewer/simple.ptl Modified: zorg/trunk/lnt/lnt/db/perfdbsummary.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/db/perfdbsummary.py?rev=105566&r1=105565&r2=105566&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/db/perfdbsummary.py (original) +++ zorg/trunk/lnt/lnt/db/perfdbsummary.py Mon Jun 7 18:00:26 2010 @@ -35,7 +35,7 @@ def is_up_to_date(self, db): return self.revision == db.get_revision_number("Run") -class SimpleSuiteSummary: +class SimpleSuiteSummary(object): @staticmethod def fromdb(db, tag): revision = db.get_revision_number("Test") @@ -49,9 +49,9 @@ test_names = set() parameter_sets = set() test_map = {} + test_status_map = {} for t in tests: - name = t.name.split(str('.'),1)[1] - test_names.add(name) + name = t.name.split('.', 1)[1] items = [(k,v.value) for k,v in t.info.items()] items.sort() @@ -60,6 +60,17 @@ parameter_sets.add(key) test_map[(name, key)] = t + if name.endswith('.success'): + test_name = name.rsplit('.', 1)[0] + test_status_map[test_name] = (name, False) + elif name.endswith('.status'): + test_name = name.rsplit('.', 1)[0] + test_status_map[test_name] = (name, True) + else: + test_name = name + + test_names.add(test_name) + # Order the test names. test_names = list(test_names) test_names.sort() @@ -73,15 +84,18 @@ parameter_sets = list(parameter_sets) parameter_sets.sort() - return SimpleSuiteSummary(revision, tag, test_names, test_map, + return SimpleSuiteSummary(revision, tag, test_names, + test_map, test_status_map, parameter_keys, parameter_sets) - def __init__(self, revision, tag, test_names, test_map, + def __init__(self, revision, tag, test_names, + test_map, test_status_map, parameter_keys, parameter_sets): self.revision = revision self.tag = tag self.test_names = test_names self.test_map = test_map + self.test_status_map = test_status_map self.parameter_keys = parameter_keys self.parameter_sets = parameter_sets Modified: zorg/trunk/lnt/lnt/testing/__init__.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/testing/__init__.py?rev=105566&r1=105565&r2=105566&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/testing/__init__.py (original) +++ zorg/trunk/lnt/lnt/testing/__init__.py Mon Jun 7 18:00:26 2010 @@ -14,6 +14,11 @@ except ImportError: import simplejson as json +# We define the following constants for use as sample values by convention. +PASS = 0 +FAIL = 1 +XFAIL = 2 + def normalize_time(t): if isinstance(t,float): t = datetime.datetime.utcfromtimestamp(t) Modified: zorg/trunk/lnt/lnt/viewer/simple.ptl URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/simple.ptl?rev=105566&r1=105565&r2=105566&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/viewer/simple.ptl (original) +++ zorg/trunk/lnt/lnt/viewer/simple.ptl Mon Jun 7 18:00:26 2010 @@ -506,23 +506,50 @@ # Render the page. - def get_cell_value [html] (test, name, pset): + def get_cell_value [html] (test, status_test, status_kind, name, pset): run_values = sample_map.get((run.id,test.id)) prev_values = sample_map.get((prev_id,test.id)) - # FIXME: Check success - failed = not run_values + # Determine whether this (test,pset) passed or failed in the current + # and previous runs. + run_failed = prev_failed = False + if not status_test: + run_failed = not run_values + prev_failed = not prev_values + else: + run_status = sample_map.get((run.id,status_test.id)) + prev_status = sample_map.get((prev_id,status_test.id)) + + # FIXME: What to do about the multiple entries here. We could + # start by just treating non-matching samples as errors. + if status_kind == False: # .success style + run_failed = not run_status or not run_status[0] + prev_failed = not prev_status or not prev_status[0] + else: + run_failed = run_status and run_status[0] != 0 + prev_failed = prev_status and prev_status[0] != 0 run_cell_value = "-" if run_values: run_cell_value = "%.4f" % min(run_values) - if failed: + cell_color = None + if run_failed: + if prev_failed: + cell_color = (255,195,67) + else: + cell_color = (233,128,128) + else: + if prev_failed: + cell_color = (143,223,95) + + if cell_color: """ - """ continue - get_cell_value(test, name, pset) + status_info = ts_summary.test_status_map.get(name) + if status_info: + status_name,status_kind = status_info + status_test = ts_summary.test_map.get((status_name,pset)) + else: + status_test = status_kind = None + get_cell_value(test, status_test, status_kind, name, pset) """ """ """ From daniel at zuster.org Mon Jun 7 18:00:29 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 07 Jun 2010 23:00:29 -0000 Subject: [llvm-commits] [zorg] r105567 - /zorg/trunk/lnt/lnt/viewer/simple.ptl Message-ID: <20100607230029.DE6472A6C12E@llvm.org> Author: ddunbar Date: Mon Jun 7 18:00:29 2010 New Revision: 105567 URL: http://llvm.org/viewvc/llvm-project?rev=105567&view=rev Log: LNT/simple: Inline uses of NTStyleBrowser. Modified: zorg/trunk/lnt/lnt/viewer/simple.ptl Modified: zorg/trunk/lnt/lnt/viewer/simple.ptl URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/simple.ptl?rev=105567&r1=105566&r2=105567&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/viewer/simple.ptl (original) +++ zorg/trunk/lnt/lnt/viewer/simple.ptl Mon Jun 7 18:00:29 2010 @@ -4,8 +4,6 @@ Nightly Test UI instance for actual nightly test data. """ -# FIXME: The NTStyleBrowser abstraction is no longer useful. We should kill it. - import sys import time @@ -15,7 +13,7 @@ from lnt.db import perfdbsummary -import Util, NTStyleBrowser +import Util from Util import safediv from NTUtil import * @@ -628,19 +626,298 @@ """ -class TagRootDirectory(NTStyleBrowser.RecentMachineDirectory): +class MachineUI(Directory): + _q_exports = [""] + + def __init__(self, root, parent, idstr): + self.root = root + self.parent = parent + try: + self.id = int(idstr) + except ValueError, exc: + raise TraversalError(str(exc)) + self.popupDepth = 0 + + def renderPopupBegin [html] (self, id, title, hidden): + self.popupDepth += 1 + """\ +

+ (%s) %s +

+ """ % (id, id, ("+","-")[hidden], title, id, ("","none")[hidden], + self.popupDepth) + + def renderPopupEnd [html] (self): + """ +
""" + self.popupDepth -= 1 + + def _q_index [html] (self): + # Get a DB connection. + db = self.root.getDB() + + machine = db.getMachine(self.id) + + self.root.getHeader("Machine: %s:%d" % (machine.name,machine.number), + "%s/../.." % self.parent.root_path, + components=self.parent.components, + addPopupJS=True) + + # Find all runs on this machine. + runs = db.runs(machine).order_by(Run.start_time.desc()).all() + + # Order by run_order info key, if given. + for r in runs: + if 'run_order' in r.info: + has_order = True + break + else: + has_order = False + if has_order: + runs.sort(key = lambda r: ('run_order' in r.info and + r.info['run_order'].value)) + runs.reverse() + + # FIXME: List previous machines with the same nickname? + """ +
NameP%d %%
%s%s%s%s%s
+ + + + +
+ Homepage +

Relatives:

+
    + """ + # List all machines with this name. + for m in db.machines(name=machine.name): + """
  • %s:%d
  • """ % (m.id, m.name, m.number) + """ +
+

Runs:

+
    + """ + + # Show the most recent 10 runs. + for r in runs[:10]: + """
  • %s """ % (r.id, r.start_time) + + # Full list of runs in a drop down. + # + # FIXME: Link to run correctly. + """ +

    +

    + + +
    + """ + + """ +
+
+ + + + + + + + + +
Nickname %s
Machine ID %d
""" % (machine.name, machine.id) + self.renderPopupBegin('machine_info', 'Machine Info', True) + """ + """ + info = machine.info.values() + info.sort(key = lambda i: i.key) + for mi in info: + """ + + + + """ % (mi.key, mi.value) + """ +
%s %s
""" + self.renderPopupEnd() + + # List associated runs. + + """ +

+ + + """ + if has_order: + """ + """ + """ + + + + + """ + for r in runs: + """ + """ + if has_order: + if 'run_order' in r.info: + order_value = r.info['run_order'].value + else: + order_value = str(' ') + """ + """ % order_value + """ + + + + """ % (r.start_time, r.end_time, r.id) + """ +
Run OrderStart TimeEnd Time 
%s%s%sView Results
+ """ + + """ +

+ """ + + self.root.getFooter() + +class MachinesDirectory(Directory): + _q_exports = [""] + + def __init__(self, parent): + Directory.__init__(self) + self.parent = parent + + def _q_index [plain] (self): + """ + machine access + """ + + def _q_lookup(self, component): + return MachineUI(self.parent.root, self.parent, component) + + +class TagRootDirectory(Directory): _q_exports = [""] def __init__(self, root, tag): - NTStyleBrowser.RecentMachineDirectory.__init__(self, root) + Directory.__init__(self) self.tag = tag + self.root = root self.root_path = '../..' self.components = ((self.tag, '%s/%s' % ('simple',self.tag)),) def getTags(self): return (self.tag,) - def getTestRunUI(self, component): + def _q_index [plain] (self): + # Get a DB connection + db = self.root.getDB() + + self.root.getHeader('Overview', self.root_path, self.components) + + # Find recent runs. + """ +

Submission Overview

+ + + + + +
+
+

Test Machines

+ + + + + + + + + """ + + # Show the most recent entry for each machine. + q = db.session.query(Machine.name).distinct().order_by(Machine.name) + for name, in q: + # Get the most recent run for this machine name. + q = db.session.query(Run).join(Machine).filter(Machine.name == name) + r = q.order_by(Run.start_time.desc()).first() + + # Limit by matching tags. + if 'tag' in r.info: + tag = r.info['tag'].value + else: + tag = None + if tag not in self.getTags(): + continue + + """ + + + + + + """ % (r.start_time, r.machine.id, r.machine.name, + r.machine.number, r.id) + + """ +
Latest SubmissionMachineResults
%s%s:%dView Results
+
+
+
+

Recent Submissions

+ + + + + + + + + + """ + + # Show the 20 most recent submissions, ordered by time. + for r in db.session.query(Run).order_by(Run.start_time.desc())[:20]: + # Limit by matching tags. + if 'tag' in r.info: + tag = r.info['tag'].value + else: + tag = None + if tag not in self.getTags(): + continue + + m = r.machine + """ + + + + + + + """ % (r.start_time, r.end_time, m.id, m.name, m.number, r.id) + + """ +
Start TimeEnd TimeMachineResults
%s%s%s:%dView Results
+
+
+ """ + + self.root.getFooter() + + def _q_lookup(self, component): + if component == 'machines': + return MachinesDirectory(self) return SimpleRunUI(self.root, self.tag, component) class RootDirectory(Directory): From daniel at zuster.org Mon Jun 7 18:00:32 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 07 Jun 2010 23:00:32 -0000 Subject: [llvm-commits] [zorg] r105568 - /zorg/trunk/lnt/lnt/db/perfdbsummary.py Message-ID: <20100607230032.B9EA32A6C12D@llvm.org> Author: ddunbar Date: Mon Jun 7 18:00:32 2010 New Revision: 105568 URL: http://llvm.org/viewvc/llvm-project?rev=105568&view=rev Log: LNT/simple: Add a summary object for run information for a specific test suite. Modified: zorg/trunk/lnt/lnt/db/perfdbsummary.py Modified: zorg/trunk/lnt/lnt/db/perfdbsummary.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/db/perfdbsummary.py?rev=105568&r1=105567&r2=105568&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/db/perfdbsummary.py (original) +++ zorg/trunk/lnt/lnt/db/perfdbsummary.py Mon Jun 7 18:00:32 2010 @@ -2,7 +2,7 @@ Classes for caching metadata about a PerfDB instance. """ -from lnt.viewer.PerfDB import RunInfo, Test +from lnt.viewer.PerfDB import Run, RunInfo, Test class SuiteSummary: def __init__(self, name, path): @@ -109,3 +109,96 @@ if entry is None or not entry.is_up_to_date(db): _cache[key] = entry = SimpleSuiteSummary.fromdb(db, tag) return entry + +class SimpleSuiteRunSummary(object): + _cache = {} + @staticmethod + def get_summary(db, tag): + key = (db.path, tag) + entry = SimpleSuiteRunSummary._cache.get(key) + if entry is None or not entry.is_up_to_date(db): + entry = SimpleSuiteRunSummary.fromdb(db, tag) + SimpleSuiteRunSummary._cache[key] = entry + return entry + + @staticmethod + def fromdb(db, tag): + revision = db.get_revision_number("RunInfo") + + # Find all run_orders for runs with this tag. + all_run_orders = db.session.query(RunInfo.value, RunInfo.run_id, + Run.machine_id).\ + join(Run).\ + filter(RunInfo.key == "run_order").\ + filter(RunInfo.run_id.in_( + db.session.query(RunInfo.run_id).\ + filter(RunInfo.key == "tag").\ + filter(RunInfo.value == tag).subquery())) + order_by_run = dict((run_id,order) + for order,run_id,machine_id in all_run_orders) + machine_id_by_run = dict((run_id,machine_id) + for order,run_id,machine_id in all_run_orders) + + # Create a mapping from run_order to the available runs with that order. + runs_by_order = {} + for order,run_id,_ in all_run_orders: + runs = runs_by_order.get(order) + if runs is None: + runs = runs_by_order[order] = [] + runs.append(run_id) + + # Get all available run_orders, in order. + def order_key(run_order): + return run_order + run_orders = runs_by_order.keys() + run_orders.sort(key = order_key) + run_orders.reverse() + + # Construct the total order of runs. + runs_in_order = [] + for order in run_orders: + runs_in_order.extend(runs_by_order[order]) + + return SimpleSuiteRunSummary( + revision, tag, run_orders, runs_by_order, runs_in_order, + order_by_run, machine_id_by_run) + + def __init__(self, revision, tag, run_orders, runs_by_order, runs_in_order, + order_by_run, machine_id_by_run): + self.revision = revision + self.tag = tag + self.run_orders = run_orders + self.runs_by_order = runs_by_order + self.runs_in_order = runs_in_order + self.order_by_run = order_by_run + self.machine_id_by_run = machine_id_by_run + + def is_up_to_date(self, db): + return self.revision == db.get_revision_number("RunInfo") + + def get_run_order(self, run_id): + return self.order_by_run.get(run_id) + + def get_run_ordered_index(self, run_id): + try: + return self.runs_in_order.index(run_id) + except: + print run_id + print self.runs_in_order + raise + + def get_previous_run_on_machine(self, run_id): + machine_id = self.machine_id_by_run[run_id] + index = self.get_run_ordered_index(run_id) + for i in range(index + 1, len(self.runs_in_order)): + id = self.runs_in_order[i] + if machine_id == self.machine_id_by_run[id]: + return id + + def get_next_run_on_machine(self, run_id): + machine_id = self.machine_id_by_run[run_id] + index = self.get_run_ordered_index(run_id) + for i in range(0, index)[::-1]: + id = self.runs_in_order[i] + if machine_id == self.machine_id_by_run[id]: + return id From daniel at zuster.org Mon Jun 7 18:00:40 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 07 Jun 2010 23:00:40 -0000 Subject: [llvm-commits] [zorg] r105571 - /zorg/trunk/lnt/lnt/tests/nt.py Message-ID: <20100607230040.C62AE2A6C12D@llvm.org> Author: ddunbar Date: Mon Jun 7 18:00:40 2010 New Revision: 105571 URL: http://llvm.org/viewvc/llvm-project?rev=105571&view=rev Log: LNT/nt: Update to use .status convention for reporting test pass/fail/xfail results. Modified: zorg/trunk/lnt/lnt/tests/nt.py Modified: zorg/trunk/lnt/lnt/tests/nt.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/tests/nt.py?rev=105571&r1=105570&r2=105571&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/tests/nt.py (original) +++ zorg/trunk/lnt/lnt/tests/nt.py Mon Jun 7 18:00:40 2010 @@ -7,11 +7,12 @@ from datetime import datetime +import lnt.testing +import lnt.testing.util.compilers + from lnt.testing.util.commands import note, warning, error, fatal from lnt.testing.util.commands import capture, which -import lnt.testing.util.compilers - def timestamp(): return datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S') @@ -24,7 +25,7 @@ if opts.arch is not None: target_flags.append('-arch') - target_flags.append(opts.arch) + target_flags.append(opts.arch) if opts.isysroot is not None: target_flags.append('-isysroot') target_flags.append(opts.isysroot) @@ -146,7 +147,7 @@ make_variables['REMOTE_USER'] = opts.remote_user make_variables['REMOTE_PORT'] = str(opts.remote_port) make_variables['REMOTE_CLIENT'] = opts.remote_client - + nick = nick_prefix if opts.auto_name: # Construct the nickname from a few key parameters. @@ -249,9 +250,11 @@ # Compute the test samples to report. sample_keys = [] if opts.test_simple: + test_namespace = 'nts' sample_keys.append(('compile', 'CC_Time', None, 'CC')) sample_keys.append(('exec', 'Exec_Time', None, 'Exec')) else: + test_namespace = 'nightlytest' sample_keys.append(('gcc.compile', 'GCCAS', 'time')) sample_keys.append(('bc.compile', 'Bytecode', 'size')) if opts.test_llc: @@ -294,10 +297,6 @@ fatal('missing key %r in report header' % item[1]) # We don't use the test info, currently. - if opts.test_simple: - test_namespace = 'simple' - else: - test_namespace = 'nightlytest' test_info = {} for row in reader_it: record = dict(zip(header, row)) @@ -322,11 +321,20 @@ # FIXME: Move to simpler and more succinct format, using .failed. if success_value == '*': - test_samples.append(lnt.testing.TestSamples( - test_name + '.success', [0], test_info)) + status_value = lnt.testing.FAIL + elif success_value == 'xfail': + status_value = lnt.testing.XFAIL else: + status_value = lnt.testing.PASS + + if test_namespace == 'nightlytest': test_samples.append(lnt.testing.TestSamples( - test_name + '.success', [1], test_info)) + test_name + '.success', + [status_value != lnt.testing.FAIL], test_info)) + else: + if status_value != lnt.testing.PASS: + test_samples.append(lnt.testing.TestSamples( + test_name + '.status', [status_value], test_info)) if value != '*': if tname is None: test_samples.append(lnt.testing.TestSamples( @@ -357,10 +365,7 @@ # FIXME: We aren't getting the LLCBETA options. run_info = {} - if opts.test_simple: - run_info['tag'] = 'simple' - else: - run_info['tag'] = 'nightlytest' + run_info['tag'] = test_namespace run_info.update(cc_info) # FIXME: Hack, use better method of getting versions. Ideally, from binaries @@ -609,7 +614,7 @@ if opts.sandbox_path is None: parser.error('--sandbox is required') - + if opts.test_simple: # TEST=simple doesn't use a reference compiler. if opts.cc_reference is not None: From daniel at zuster.org Mon Jun 7 18:00:35 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 07 Jun 2010 23:00:35 -0000 Subject: [llvm-commits] [zorg] r105569 - /zorg/trunk/lnt/lnt/viewer/simple.ptl Message-ID: <20100607230035.695BB2A6C12C@llvm.org> Author: ddunbar Date: Mon Jun 7 18:00:35 2010 New Revision: 105569 URL: http://llvm.org/viewvc/llvm-project?rev=105569&view=rev Log: LNT/simple: Switch to using run summary object instead of multiple queries. Modified: zorg/trunk/lnt/lnt/viewer/simple.ptl Modified: zorg/trunk/lnt/lnt/viewer/simple.ptl URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/simple.ptl?rev=105569&r1=105568&r2=105569&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/viewer/simple.ptl (original) +++ zorg/trunk/lnt/lnt/viewer/simple.ptl Mon Jun 7 18:00:35 2010 @@ -17,7 +17,7 @@ from Util import safediv from NTUtil import * -from PerfDB import Machine, Run, Test +from PerfDB import Machine, Run, RunInfo, Test def median(l): l = list(l) @@ -69,33 +69,20 @@ run = db.getRun(self.id) - # Find previous runs, ordered by time. - runs = db.runs(run.machine).order_by(Run.start_time.desc()).all() - # FIXME: Fold this into query. - runs = [r for r in runs - if 'tag' in r.info and r.info['tag'].value == self.tag] - - # Order by run_order info key, if given. - for r in runs: - if 'run_order' in r.info: - has_order = True - break - else: - has_order = False - if has_order: - runs.sort(key = lambda r: ('run_order' in r.info and - r.info['run_order'].value)) - runs.reverse() - + # Get the run summary which has run ordering information. + run_summary = perfdbsummary.SimpleSuiteRunSummary.get_summary(db, + self.tag) + # Find previous run to compare to. if compareTo is None: - run_index = runs.index(run) - if run_index < len(runs) - 1: - compareTo = runs[run_index + 1] + id = run_summary.get_previous_run_on_machine(run.id) + if id is not None: + compareTo = db.getRun(id) - return run, runs, has_order, compareTo + return run, run_summary, compareTo - def show_run_page [html] (self, db, run, runs, compareTo, contents_fn): + def show_run_page [html] (self, db, run, run_summary, compare_to, + contents_fn): machine = run.machine """ @@ -107,16 +94,17 @@ Run: - %s + %s (%s) - """ % (machine.name, machine.number, run.start_time) - if compareTo: + """ % (machine.name, machine.number, run.start_time, + run.info['run_order'].value) + if compare_to: """ Compare To: - %s + %s (%s) - """ % (compareTo.start_time,) + """ % (compare_to.start_time, compare_to.info['run_order'].value) """ @@ -135,13 +123,23 @@ """ % (machine.id, machine.name, machine.number) # Show a small number of neighboring runs. - runIndex = runs.index(run) - for r in runs[max(0,runIndex-3):runIndex+6]: + cur_id = run.id + for i in range(3): + id = run_summary.get_next_run_on_machine(cur_id) + if not id: + break + cur_id = id + for i in range(6): + r = db.getRun(cur_id) if r == run: """
  • %s

    """ % (r.id, r.start_time) else: """
  • %s """ % (r.id, r.start_time) + cur_id = run_summary.get_previous_run_on_machine(cur_id) + if cur_id is None: + break + """ @@ -189,7 +187,7 @@ """ self.renderPopupEnd() - contents_fn(db, run, runs, compareTo) + contents_fn() """ @@ -203,7 +201,7 @@ # Get a DB connection. db = self.root.getDB() - run,runs,has_order,compareTo = self.getInfo(db) + run,run_summary,compare_to = self.getInfo(db) machine = run.machine self.root.getHeader('Run Results', "../../..", @@ -214,7 +212,8 @@ machine.id))), addPopupJS=True, addFormCSS=True) - self.show_run_page(db, run, runs, compareTo, self._q_index_body) + self.show_run_page(db, run, run_summary, compare_to, + lambda: self._q_index_body(db, run, compare_to)) def graph [html] (self): request = quixote.get_request() @@ -222,7 +221,7 @@ # Get a DB connection. db = self.root.getDB() - run,runs,has_order,compareTo = self.getInfo(db) + run,run_summary,compare_to = self.getInfo(db) machine = run.machine # Load the test suite summary. @@ -252,21 +251,17 @@ # Aggregate by test id and then run key. # # FIXME: Pretty expensive. - run_id_map = dict([(r.id,r) for r in runs]) samples_by_test_id = {} for run_id,test_id,value in samples: d = samples_by_test_id.get(test_id) if d is None: d = samples_by_test_id[test_id] = Util.multidict() - r = run_id_map.get(run_id) - if r is None: + run_key = run_summary.get_run_order(run_id) + if run_key is None: continue - if has_order: - # FIXME: What to do on failure? - run_key = int(r.info.get('run_order').value) - else: - run_key = time.mktime(r.start_time.timetuple()) + # FIXME: What to do on failure? + run_key = int(run_key) d[run_key] = value # Build the graph data @@ -278,8 +273,8 @@ num_plots = len(graph_tests) * len(graph_psets) num_points = 0 index = 0 - show_mad_error = has_order - show_points = has_order + show_mad_error = True + show_points = True show_all_points = False for name in graph_tests: for pset in graph_psets: @@ -334,7 +329,7 @@ plot_points.append(points) index += 1 - def graph_body [html] (db, run, runs, compare_to): + def graph_body [html] (): """

    Graph

    @@ -447,10 +442,8 @@

    """ % (' '.join(map(str, new_sample_list)), ' '.join(map(str, Util.sorted(resample_list)))) - if has_order: - xAxis_format = 'graph.xAxis.formats.normal' - else: - xAxis_format = 'graph.xAxis.formats.day' + # FIXME: Allow run_order to define this. + xAxis_format = 'graph.xAxis.formats.normal' graph_init = """\ function init() { graph = new Graph2D("graph"); @@ -472,9 +465,9 @@ addJSScript=graph_init, onload="init()") - self.show_run_page(db, run, runs, compareTo, graph_body) + self.show_run_page(db, run, run_summary, compare_to, graph_body) - def _q_index_body [html] (self, db, run, runs, compare_to): + def _q_index_body [html] (self, db, run, compare_to): # Find the tests. The simple UI maps all tests that start with # 'simple.'. # @@ -591,7 +584,7 @@ """
    -

    +
    """ for i in range(len(ts_summary.parameter_sets)): @@ -663,22 +656,10 @@ components=self.parent.components, addPopupJS=True) - # Find all runs on this machine. - runs = db.runs(machine).order_by(Run.start_time.desc()).all() + # Get the run summary which has run ordering information. + run_summary = perfdbsummary.SimpleSuiteRunSummary.get_summary( + db, self.parent.tag) - # Order by run_order info key, if given. - for r in runs: - if 'run_order' in r.info: - has_order = True - break - else: - has_order = False - if has_order: - runs.sort(key = lambda r: ('run_order' in r.info and - r.info['run_order'].value)) - runs.reverse() - - # FIXME: List previous machines with the same nickname? """
    Name
    @@ -692,34 +673,6 @@ """
  • %s:%d
  • """ % (m.id, m.name, m.number) """ -

    Runs:

    -
      - """ - - # Show the most recent 10 runs. - for r in runs[:10]: - """
    • %s """ % (r.id, r.start_time) - - # Full list of runs in a drop down. - # - # FIXME: Link to run correctly. - """ -

      - - - - - """ - - """ -

    """ % (start_time, end_time, run_id) """ +
    @@ -748,45 +701,48 @@ self.renderPopupEnd() # List associated runs. - + run_info = db.session.query(Run.id, Run.start_time, Run.end_time).\ + filter(Run.machine_id == machine.id).\ + filter(Run.id.in_(run_summary.runs_in_order)).all() + run_info_map = dict((id,(start_time,end_time)) + for id,start_time,end_time in run_info) """

    - """ - if has_order: - """ - """ - """ + + + """ - for r in runs: + for order in run_summary.run_orders: + run_ids = [id for id in run_summary.runs_by_order[order] + if id in run_info_map] + if not run_ids: + continue + """ - """ - if has_order: - if 'run_order' in r.info: - order_value = r.info['run_order'].value - else: - order_value = str(' ') + + """ % (len(run_ids), order) + for run_id in run_ids: + start_time,end_time = run_info_map[run_id] + if run_id != run_ids[0]: + """""" """ - """ % order_value - """ - """ % (r.start_time, r.end_time, r.id) - """ -
    Run Order
    Run Order Start Time End Time  
    %s
    %s%s %s View Results
    +
    """ """ - - """ + """ self.root.getFooter() From daniel at zuster.org Mon Jun 7 18:00:43 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 07 Jun 2010 23:00:43 -0000 Subject: [llvm-commits] [zorg] r105572 - /zorg/trunk/lnt/lnt/tests/nt.py Message-ID: <20100607230043.97C6D2A6C12C@llvm.org> Author: ddunbar Date: Mon Jun 7 18:00:43 2010 New Revision: 105572 URL: http://llvm.org/viewvc/llvm-project?rev=105572&view=rev Log: LNT/nt: Report build number as run_order for production builds. Modified: zorg/trunk/lnt/lnt/tests/nt.py Modified: zorg/trunk/lnt/lnt/tests/nt.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/tests/nt.py?rev=105572&r1=105571&r2=105572&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/tests/nt.py (original) +++ zorg/trunk/lnt/lnt/tests/nt.py Mon Jun 7 18:00:43 2010 @@ -385,16 +385,25 @@ # Set the run order from the user, if given. if opts.run_order is not None: run_info['run_order'] = opts.run_order + else: - # Otherwise, infer as the most forward revision we found. + # Otherwise, try to infer something sensible. # # FIXME: Pretty lame, should we just require the user to specify this? - if run_info['llvm_revision'].isdigit(): - run_info['run_order'] = run_info['llvm_revision'] - if (run_info.get('cc_src_revision','').isdigit() and - ('run_order' not in run_info or - int(run_info['run_order'] < int(run_info['cc_src_revision'])))): + + # If the CC has a src revision, use that. + if run_info.get('cc_src_version','').isdigit(): run_info['run_order'] = run_info['cc_src_revision'] + + # Otherwise, if this is a production compiler, look for a source tag. + elif (run_info.get('cc_build') == 'PROD' and + run_info.get('cc_src_tag','').isdigit()): + run_info['run_order'] = run_info['cc_src_tag'] + + # Otherwise, infer from the llvm revision. + elif run_info.get('llvm_revision','').isdigit(): + run_info['run_order'] = run_info['llvm_revision'] + if 'run_order' in run_info: run_info['run_order'] = '%7d' % int(run_info['run_order']) From daniel at zuster.org Mon Jun 7 18:00:38 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Mon, 07 Jun 2010 23:00:38 -0000 Subject: [llvm-commits] [zorg] r105570 - /zorg/trunk/lnt/lnt/viewer/simple.ptl Message-ID: <20100607230038.219D82A6C12E@llvm.org> Author: ddunbar Date: Mon Jun 7 18:00:37 2010 New Revision: 105570 URL: http://llvm.org/viewvc/llvm-project?rev=105570&view=rev Log: LNT/simple: Add run order to submission view. Modified: zorg/trunk/lnt/lnt/viewer/simple.ptl Modified: zorg/trunk/lnt/lnt/viewer/simple.ptl URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/simple.ptl?rev=105570&r1=105569&r2=105570&view=diff ============================================================================== --- zorg/trunk/lnt/lnt/viewer/simple.ptl (original) +++ zorg/trunk/lnt/lnt/viewer/simple.ptl Mon Jun 7 18:00:37 2010 @@ -833,6 +833,7 @@ + @@ -844,10 +845,8 @@ # Show the 20 most recent submissions, ordered by time. for r in db.session.query(Run).order_by(Run.start_time.desc())[:20]: # Limit by matching tags. - if 'tag' in r.info: - tag = r.info['tag'].value - else: - tag = None + if 'tag' not in r.info or 'run_order' not in r.info: + continue if tag not in self.getTags(): continue @@ -856,10 +855,12 @@ + - """ % (r.start_time, r.end_time, m.id, m.name, m.number, r.id) + """ % (r.info['run_order'].value, r.start_time, r.end_time, m.id, + m.name, m.number, r.id) """
    Run Order Start Time End Time Machine
    %s %s%s %s:%d View Results
    From gohman at apple.com Mon Jun 7 18:15:16 2010 From: gohman at apple.com (Dan Gohman) Date: Mon, 07 Jun 2010 23:15:16 -0000 Subject: [llvm-commits] [llvm] r105573 - /llvm/trunk/test/Transforms/PartialSpecialize/ Message-ID: <20100607231516.22EC52A6C12C@llvm.org> Author: djg Date: Mon Jun 7 18:15:15 2010 New Revision: 105573 URL: http://llvm.org/viewvc/llvm-project?rev=105573&view=rev Log: Add an svn:ignore. Modified: llvm/trunk/test/Transforms/PartialSpecialize/ (props changed) Propchange: llvm/trunk/test/Transforms/PartialSpecialize/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Jun 7 18:15:15 2010 @@ -0,0 +1,3 @@ +Output +*.log +*.sum From bob.wilson at apple.com Mon Jun 7 18:48:47 2010 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 07 Jun 2010 23:48:47 -0000 Subject: [llvm-commits] [llvm] r105585 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <20100607234847.26ECE2A6C12C@llvm.org> Author: bwilson Date: Mon Jun 7 18:48:46 2010 New Revision: 105585 URL: http://llvm.org/viewvc/llvm-project?rev=105585&view=rev Log: Fix a mistake in my previous change r105437: don't access operand 2 and assume that it is an immediate before checking that the instruction is an EXTRACT_SUBREG. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=105585&r1=105584&r2=105585&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Jun 7 18:48:46 2010 @@ -1178,17 +1178,16 @@ UI = MRI->use_nodbg_begin(SrcReg), UE = MRI->use_nodbg_end(); UI != UE; ++UI) { MachineInstr *UseMI = &*UI; - unsigned SubRegIdx = UseMI->getOperand(2).getImm(); // FIXME: For now require that the destination subregs match the subregs // being extracted. if (!UseMI->isExtractSubreg() || UseMI->getOperand(0).getReg() != DstReg || - UseMI->getOperand(0).getSubReg() != SubRegIdx || + UseMI->getOperand(0).getSubReg() != UseMI->getOperand(2).getImm() || UseMI->getOperand(1).getSubReg() != 0) { CanCoalesce = false; break; } - SubIndices.push_back(SubRegIdx); + SubIndices.push_back(UseMI->getOperand(2).getImm()); } if (!CanCoalesce || SubIndices.size() < 2) From bob.wilson at apple.com Mon Jun 7 18:53:38 2010 From: bob.wilson at apple.com (Bob Wilson) Date: Mon, 07 Jun 2010 23:53:38 -0000 Subject: [llvm-commits] [llvm] r105586 - in /llvm/trunk/lib/Target/ARM: ARMISelLowering.cpp ARMInstrNEON.td Message-ID: <20100607235338.CDEB22A6C12C@llvm.org> Author: bwilson Date: Mon Jun 7 18:53:38 2010 New Revision: 105586 URL: http://llvm.org/viewvc/llvm-project?rev=105586&view=rev Log: Further changes for Neon vector shuffles: - change isShuffleMaskLegal to show that all shuffles with 32-bit and 64-bit elements are legal - the Neon shuffle instructions do not support 64-bit elements, but we were not checking for that before lowering shuffles to use them - remove some 64-bit element vduplane patterns that are no longer needed Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=105586&r1=105585&r2=105586&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Jun 7 18:53:38 2010 @@ -3171,7 +3171,9 @@ bool ReverseVEXT; unsigned Imm, WhichResult; - return (ShuffleVectorSDNode::isSplatMask(&M[0], VT) || + unsigned EltSize = VT.getVectorElementType().getSizeInBits(); + return (EltSize >= 32 || + ShuffleVectorSDNode::isSplatMask(&M[0], VT) || isVREVMask(M, VT, 64) || isVREVMask(M, VT, 32) || isVREVMask(M, VT, 16) || @@ -3269,59 +3271,62 @@ // of the same time so that they get CSEd properly. SVN->getMask(ShuffleMask); - if (ShuffleVectorSDNode::isSplatMask(&ShuffleMask[0], VT)) { - int Lane = SVN->getSplatIndex(); - // If this is undef splat, generate it via "just" vdup, if possible. - if (Lane == -1) Lane = 0; + unsigned EltSize = VT.getVectorElementType().getSizeInBits(); + if (EltSize <= 32) { + if (ShuffleVectorSDNode::isSplatMask(&ShuffleMask[0], VT)) { + int Lane = SVN->getSplatIndex(); + // If this is undef splat, generate it via "just" vdup, if possible. + if (Lane == -1) Lane = 0; - if (Lane == 0 && V1.getOpcode() == ISD::SCALAR_TO_VECTOR) { - return DAG.getNode(ARMISD::VDUP, dl, VT, V1.getOperand(0)); + if (Lane == 0 && V1.getOpcode() == ISD::SCALAR_TO_VECTOR) { + return DAG.getNode(ARMISD::VDUP, dl, VT, V1.getOperand(0)); + } + return DAG.getNode(ARMISD::VDUPLANE, dl, VT, V1, + DAG.getConstant(Lane, MVT::i32)); } - return DAG.getNode(ARMISD::VDUPLANE, dl, VT, V1, - DAG.getConstant(Lane, MVT::i32)); - } - bool ReverseVEXT; - unsigned Imm; - if (isVEXTMask(ShuffleMask, VT, ReverseVEXT, Imm)) { - if (ReverseVEXT) - std::swap(V1, V2); - return DAG.getNode(ARMISD::VEXT, dl, VT, V1, V2, - DAG.getConstant(Imm, MVT::i32)); - } - - if (isVREVMask(ShuffleMask, VT, 64)) - return DAG.getNode(ARMISD::VREV64, dl, VT, V1); - if (isVREVMask(ShuffleMask, VT, 32)) - return DAG.getNode(ARMISD::VREV32, dl, VT, V1); - if (isVREVMask(ShuffleMask, VT, 16)) - return DAG.getNode(ARMISD::VREV16, dl, VT, V1); - - // Check for Neon shuffles that modify both input vectors in place. - // If both results are used, i.e., if there are two shuffles with the same - // source operands and with masks corresponding to both results of one of - // these operations, DAG memoization will ensure that a single node is - // used for both shuffles. - unsigned WhichResult; - if (isVTRNMask(ShuffleMask, VT, WhichResult)) - return DAG.getNode(ARMISD::VTRN, dl, DAG.getVTList(VT, VT), - V1, V2).getValue(WhichResult); - if (isVUZPMask(ShuffleMask, VT, WhichResult)) - return DAG.getNode(ARMISD::VUZP, dl, DAG.getVTList(VT, VT), - V1, V2).getValue(WhichResult); - if (isVZIPMask(ShuffleMask, VT, WhichResult)) - return DAG.getNode(ARMISD::VZIP, dl, DAG.getVTList(VT, VT), - V1, V2).getValue(WhichResult); + bool ReverseVEXT; + unsigned Imm; + if (isVEXTMask(ShuffleMask, VT, ReverseVEXT, Imm)) { + if (ReverseVEXT) + std::swap(V1, V2); + return DAG.getNode(ARMISD::VEXT, dl, VT, V1, V2, + DAG.getConstant(Imm, MVT::i32)); + } - if (isVTRN_v_undef_Mask(ShuffleMask, VT, WhichResult)) - return DAG.getNode(ARMISD::VTRN, dl, DAG.getVTList(VT, VT), - V1, V1).getValue(WhichResult); - if (isVUZP_v_undef_Mask(ShuffleMask, VT, WhichResult)) - return DAG.getNode(ARMISD::VUZP, dl, DAG.getVTList(VT, VT), - V1, V1).getValue(WhichResult); - if (isVZIP_v_undef_Mask(ShuffleMask, VT, WhichResult)) - return DAG.getNode(ARMISD::VZIP, dl, DAG.getVTList(VT, VT), - V1, V1).getValue(WhichResult); + if (isVREVMask(ShuffleMask, VT, 64)) + return DAG.getNode(ARMISD::VREV64, dl, VT, V1); + if (isVREVMask(ShuffleMask, VT, 32)) + return DAG.getNode(ARMISD::VREV32, dl, VT, V1); + if (isVREVMask(ShuffleMask, VT, 16)) + return DAG.getNode(ARMISD::VREV16, dl, VT, V1); + + // Check for Neon shuffles that modify both input vectors in place. + // If both results are used, i.e., if there are two shuffles with the same + // source operands and with masks corresponding to both results of one of + // these operations, DAG memoization will ensure that a single node is + // used for both shuffles. + unsigned WhichResult; + if (isVTRNMask(ShuffleMask, VT, WhichResult)) + return DAG.getNode(ARMISD::VTRN, dl, DAG.getVTList(VT, VT), + V1, V2).getValue(WhichResult); + if (isVUZPMask(ShuffleMask, VT, WhichResult)) + return DAG.getNode(ARMISD::VUZP, dl, DAG.getVTList(VT, VT), + V1, V2).getValue(WhichResult); + if (isVZIPMask(ShuffleMask, VT, WhichResult)) + return DAG.getNode(ARMISD::VZIP, dl, DAG.getVTList(VT, VT), + V1, V2).getValue(WhichResult); + + if (isVTRN_v_undef_Mask(ShuffleMask, VT, WhichResult)) + return DAG.getNode(ARMISD::VTRN, dl, DAG.getVTList(VT, VT), + V1, V1).getValue(WhichResult); + if (isVUZP_v_undef_Mask(ShuffleMask, VT, WhichResult)) + return DAG.getNode(ARMISD::VUZP, dl, DAG.getVTList(VT, VT), + V1, V1).getValue(WhichResult); + if (isVZIP_v_undef_Mask(ShuffleMask, VT, WhichResult)) + return DAG.getNode(ARMISD::VZIP, dl, DAG.getVTList(VT, VT), + V1, V1).getValue(WhichResult); + } // If the shuffle is not directly supported and it has 4 elements, use // the PerfectShuffle-generated table to synthesize it from other shuffles. @@ -3346,7 +3351,6 @@ } // Implement shuffles with 32- or 64-bit elements as ARMISD::BUILD_VECTORs. - unsigned EltSize = VT.getVectorElementType().getSizeInBits(); if (EltSize >= 32) { // Do the expansion with floating-point types, since that is what the VFP // registers are defined to use, and since i64 is not legal. Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=105586&r1=105585&r2=105586&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Mon Jun 7 18:53:38 2010 @@ -812,11 +812,6 @@ assert(ARM::dsub_7 == ARM::dsub_0+7 && "Unexpected subreg numbering"); return CurDAG->getTargetConstant(ARM::dsub_0 + N->getZExtValue(), MVT::i32); }]>; -def DSubReg_f64_other_reg : SDNodeXFormgetTargetConstant(ARM::dsub_0 + (1 - N->getZExtValue()), - MVT::i32); -}]>; // Extract S sub-registers of Q/D registers. def SSubReg_f32_reg : SDNodeXForm; -def : Pat<(v2i64 (NEONvduplane (v2i64 QPR:$src), imm:$lane)), - (INSERT_SUBREG QPR:$src, - (i64 (EXTRACT_SUBREG QPR:$src, - (DSubReg_f64_reg imm:$lane))), - (DSubReg_f64_other_reg imm:$lane))>; -def : Pat<(v2f64 (NEONvduplane (v2f64 QPR:$src), imm:$lane)), - (INSERT_SUBREG QPR:$src, - (f64 (EXTRACT_SUBREG QPR:$src, - (DSubReg_f64_reg imm:$lane))), - (DSubReg_f64_other_reg imm:$lane))>; - // VMOVN : Vector Narrowing Move defm VMOVN : N2VNInt_HSD<0b11,0b11,0b10,0b00100,0,0, IIC_VMOVD, "vmovn", "i", int_arm_neon_vmovn>; From natebegeman at mac.com Mon Jun 7 19:14:42 2010 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 08 Jun 2010 00:14:42 -0000 Subject: [llvm-commits] [llvm] r105588 - in /llvm/trunk/utils/TableGen: NeonEmitter.cpp NeonEmitter.h Message-ID: <20100608001442.E755E2A6C12C@llvm.org> Author: sampo Date: Mon Jun 7 19:14:42 2010 New Revision: 105588 URL: http://llvm.org/viewvc/llvm-project?rev=105588&view=rev Log: ARM NEON: fix vcvt naming handle vdup, vcombine with generic vector code Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp llvm/trunk/utils/TableGen/NeonEmitter.h Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105588&r1=105587&r2=105588&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Mon Jun 7 19:14:42 2010 @@ -70,6 +70,8 @@ return 's'; case 'l': return 'i'; + case 'f': + return 'h'; default: throw "unhandled type in widen!"; } return '\0'; @@ -109,13 +111,16 @@ usgn = true; } break; - case 'x': + case 'u': usgn = true; + case 'x': poly = false; if (type == 'f') type = 'i'; break; case 'f': + if (type == 'h') + quad = true; type = 'f'; usgn = false; break; @@ -147,6 +152,8 @@ break; case 'h': type = Narrow(type); + if (type == 'h') + quad = false; break; case 'e': type = Narrow(type); @@ -303,7 +310,9 @@ return quad ? "V48c" : "V24c"; if (mod == '4') return quad ? "V64c" : "V32c"; - + if (mod == 'f') + return quad ? "V4f" : "V2f"; + return quad ? "V16c" : "V8c"; } @@ -314,6 +323,8 @@ return quad ? "V16cV16cV16c" : "V8cV8cV8c"; if (mod == '4') return quad ? "V16cV16cV16cV16c" : "V8cV8cV8cV8c"; + if (mod == 'f') + return quad ? "V4f" : "V2f"; return quad ? "V16c" : "V8c"; } @@ -321,6 +332,9 @@ // Turn "vst2_lane" into "vst2q_lane_f32", etc. static std::string MangleName(const std::string &name, StringRef typestr, ClassKind ck) { + if (name == "vcvt_f32_f16") + return name; + bool quad = false; bool poly = false; bool usgn = false; @@ -417,14 +431,30 @@ // than vector types, and the call becomes "a.val + b.val" static std::string GenOpString(OpKind op, const std::string &proto, StringRef typestr, bool structTypes = true) { - std::string s("return "); std::string ts = TypeString(proto[0], typestr); + std::string s = ts + " r; r"; + + bool quad, dummy; + char type = ClassifyType(typestr, quad, dummy, dummy); + unsigned nElts = 0; + switch (type) { + case 'c': nElts = 8; break; + case 's': nElts = 4; break; + case 'i': nElts = 2; break; + case 'l': nElts = 1; break; + case 'h': nElts = 4; break; + case 'f': nElts = 2; break; + } + nElts <<= quad; + if (structTypes) - s += "(" + ts + "){"; + s += ".val"; + s += " = "; + std::string a, b, c; if (proto.size() > 1) - a = (structTypes && proto[1] != 'l') ? "a.val" : "a"; + a = (structTypes && proto[1] != 'l' && proto[1] != 's') ? "a.val" : "a"; b = structTypes ? "b.val" : "b"; c = structTypes ? "c.val" : "c"; @@ -483,14 +513,24 @@ case OpCast: s += "(__neon_" + ts + ")" + a; break; + case OpConcat: + s += "__builtin_shufflevector((__neon_int64x1_t)" + a; + s += ", (__neon_int64x1_t)" + b + ", 0, 1)"; + break; + case OpDup: + s += "(__neon_" + ts + "){ "; + for (unsigned i = 0; i != nElts; ++i) { + s += a; + if ((i + 1) < nElts) + s += ", "; + } + s += " }"; + break; default: throw "unknown OpKind!"; break; } - - if (structTypes) - s += "}"; - s += ";"; + s += "; return r;"; return s; } @@ -498,7 +538,7 @@ unsigned mod = proto[0]; unsigned ret = 0; - if (mod == 'v') + if (mod == 'v' || mod == 'f') mod = proto[1]; bool quad = false; Modified: llvm/trunk/utils/TableGen/NeonEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.h?rev=105588&r1=105587&r2=105588&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.h (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.h Mon Jun 7 19:14:42 2010 @@ -40,7 +40,9 @@ OpXor, OpAndNot, OpOrNot, - OpCast + OpCast, + OpConcat, + OpDup }; enum ClassKind { @@ -79,6 +81,8 @@ OpMap["OP_ANDN"] = OpAndNot; OpMap["OP_ORN"] = OpOrNot; OpMap["OP_CAST"] = OpCast; + OpMap["OP_CONC"] = OpConcat; + OpMap["OP_DUP"] = OpDup; Record *SI = R.getClass("SInst"); Record *II = R.getClass("IInst"); From bob.wilson at apple.com Mon Jun 7 19:42:08 2010 From: bob.wilson at apple.com (Bob Wilson) Date: Tue, 08 Jun 2010 00:42:08 -0000 Subject: [llvm-commits] [llvm] r105591 - /llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp Message-ID: <20100608004208.E19C92A6C12C@llvm.org> Author: bwilson Date: Mon Jun 7 19:42:08 2010 New Revision: 105591 URL: http://llvm.org/viewvc/llvm-project?rev=105591&view=rev Log: Fix up a comment. Modified: llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp Modified: llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp?rev=105591&r1=105590&r2=105591&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/NEONPreAllocPass.cpp Mon Jun 7 19:42:08 2010 @@ -434,11 +434,11 @@ // FIXME: Update the uses of EXTRACT_SUBREG from REG_SEQUENCE is // currently required for correctness. e.g. - // %reg1041; = REG_SEQUENCE %reg1040, 5, %reg1035, 6 + // %reg1041 = REG_SEQUENCE %reg1040, 5, %reg1035, 6 // %reg1042 = EXTRACT_SUBREG %reg1041, 6 // %reg1043 = EXTRACT_SUBREG %reg1041, 5 // VST1q16 %reg1025, 0, %reg1043, %reg1042, - // reg1025 and reg1043 should be replaced with reg1041:6 and reg1041:5 + // reg1042 and reg1043 should be replaced with reg1041:6 and reg1041:5 // respectively. // We need to change how we model uses of REG_SEQUENCE. for (unsigned R = 0; R < NumRegs; ++R) { From natebegeman at mac.com Tue Jun 8 01:01:16 2010 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 08 Jun 2010 06:01:16 -0000 Subject: [llvm-commits] [llvm] r105598 - /llvm/trunk/utils/TableGen/NeonEmitter.cpp Message-ID: <20100608060116.A20452A6C12C@llvm.org> Author: sampo Date: Tue Jun 8 01:01:16 2010 New Revision: 105598 URL: http://llvm.org/viewvc/llvm-project?rev=105598&view=rev Log: Refine BuiltinsARM.def types a bit, we should do a better job of this to save some c++ code in CGBuiltins. Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105598&r1=105597&r2=105598&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Tue Jun 8 01:01:16 2010 @@ -310,8 +310,10 @@ return quad ? "V48c" : "V24c"; if (mod == '4') return quad ? "V64c" : "V32c"; - if (mod == 'f') - return quad ? "V4f" : "V2f"; + if (mod == 'f') + return quad ? "V4f" : "V2f"; + if (mod == 'x' || mod == 'u') + return quad ? "V4i" : "V2i"; return quad ? "V16c" : "V8c"; } From natebegeman at mac.com Tue Jun 8 02:11:17 2010 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 08 Jun 2010 07:11:17 -0000 Subject: [llvm-commits] [llvm] r105600 - /llvm/trunk/utils/TableGen/NeonEmitter.cpp Message-ID: <20100608071117.BA4832A6C12C@llvm.org> Author: sampo Date: Tue Jun 8 02:11:17 2010 New Revision: 105600 URL: http://llvm.org/viewvc/llvm-project?rev=105600&view=rev Log: Fix a valgrind error. Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105600&r1=105599&r2=105600&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Tue Jun 8 02:11:17 2010 @@ -436,7 +436,7 @@ std::string ts = TypeString(proto[0], typestr); std::string s = ts + " r; r"; - bool quad, dummy; + bool dummy, quad = false; char type = ClassifyType(typestr, quad, dummy, dummy); unsigned nElts = 0; switch (type) { From kalle.raiskila at nokia.com Tue Jun 8 02:55:16 2010 From: kalle.raiskila at nokia.com (Kalle Raiskila) Date: Tue, 08 Jun 2010 07:55:16 -0000 Subject: [llvm-commits] [llvm] r105601 - /llvm/trunk/lib/Target/CellSPU/SPUNodes.td Message-ID: <20100608075516.B11A62A6C12D@llvm.org> Author: kraiskil Date: Tue Jun 8 02:55:16 2010 New Revision: 105601 URL: http://llvm.org/viewvc/llvm-project?rev=105601&view=rev Log: Flag SPU's function call sequence together. Discussed here: http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-June/032107.html Modified: llvm/trunk/lib/Target/CellSPU/SPUNodes.td Modified: llvm/trunk/lib/Target/CellSPU/SPUNodes.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUNodes.td?rev=105601&r1=105600&r2=105601&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUNodes.td (original) +++ llvm/trunk/lib/Target/CellSPU/SPUNodes.td Tue Jun 8 02:55:16 2010 @@ -21,7 +21,7 @@ def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_SPUCallSeq, [SDNPHasChain, SDNPOutFlag]>; def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_SPUCallSeq, - [SDNPHasChain, SDNPOutFlag]>; + [SDNPHasChain, SDNPInFlag, SDNPOutFlag]>; //===----------------------------------------------------------------------===// // Operand constraints: //===----------------------------------------------------------------------===// From visa.putkinen at iki.fi Tue Jun 8 04:26:44 2010 From: visa.putkinen at iki.fi (Visa Putkinen) Date: Tue, 8 Jun 2010 12:26:44 +0300 Subject: [llvm-commits] Buggy SelectionDAG binop vector widening In-Reply-To: <86CAA4FC-4CE3-4E7E-B0A4-58DE974B9176@apple.com> References: <20100603132756.GA30866@cc.hut.fi> <86CAA4FC-4CE3-4E7E-B0A4-58DE974B9176@apple.com> Message-ID: <20100608092644.GB30866@cc.hut.fi> On Thu, Jun 03, 2010 at 11:12:59AM -0700, Dale Johannesen wrote: > On Jun 3, 2010, at 6:27 AMPDT, Visa Putkinen wrote: >> The function responsible for widening vector binary operation nodes in >> SelectionDAGs (DAGTypeLegalizer::WidenVecRes_Binary in >> lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp, r105388) returns >> incorrect results for many vector lengths and even triggers asserts on >> lengths 9 and 13. I didn't find a bug report about this bug. >> >> >> + NextVT = EVT::getVectorVT(*DAG.getContext(), WidenEltVT, >> NextSize); >> + } while (!TLI.isTypeLegal(NextVT)); > > This should be isTypeSynthesizable, not isTypeLegal. There are probably > other places in here where that's also true. Thanks for the advice. I changed all three occurances of isTypeLegal to isTypeSynthesizable in DAGTypeLegalizer::WidenVecRes_Binary. There are still six other isTypeLegal call sites in LegalizeVectorTypes.cpp that probably should be updated, but I didn't touch those for now. The updated patch is attached. Any other thoughts about the patch? The issue is still relevant in r105601: my patch passes http://vpu.me/v-binop-widen.ll and http://vpu.me/v-binop-widen2.ll , which fail without the patch. The patch doesn't seem to break any other DejaGNU tests. -- Visa Putkinen // visa.putkinen at iki.fi -------------- next part -------------- A non-text attachment was scrubbed... Name: vector-binop-widen.patch Type: text/x-diff Size: 6392 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100608/e69fe2d9/attachment.bin From baldrick at free.fr Tue Jun 8 05:12:30 2010 From: baldrick at free.fr (Duncan Sands) Date: Tue, 08 Jun 2010 10:12:30 -0000 Subject: [llvm-commits] [dragonegg] r105603 - /dragonegg/trunk/extras/do_self_strap Message-ID: <20100608101231.02AEE2A6C12C@llvm.org> Author: baldrick Date: Tue Jun 8 05:12:30 2010 New Revision: 105603 URL: http://llvm.org/viewvc/llvm-project?rev=105603&view=rev Log: Currently gcc mainline (gcc-4.6) is quite unstable, so do not use it when doing self-host builds. Modified: dragonegg/trunk/extras/do_self_strap Modified: dragonegg/trunk/extras/do_self_strap URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/extras/do_self_strap?rev=105603&r1=105602&r2=105603&view=diff ============================================================================== --- dragonegg/trunk/extras/do_self_strap (original) +++ dragonegg/trunk/extras/do_self_strap Tue Jun 8 05:12:30 2010 @@ -97,7 +97,7 @@ if [ ! -e $GCC_SOURCE ] ; then echo "Checking out GCC" - svn co -r $GCC_REVISION svn://gcc.gnu.org/svn/gcc/trunk $GCC_SOURCE + svn co -r $GCC_REVISION svn://gcc.gnu.org/svn/gcc/branches/gcc-4_5-branch $GCC_SOURCE elif [ ! -L $GCC_SOURCE ] ; then # Do not update symbolic links. This is # for the benefit of the buildbots. echo "Reverting any applied patches" From benny.kra at googlemail.com Tue Jun 8 06:44:30 2010 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Tue, 08 Jun 2010 11:44:30 -0000 Subject: [llvm-commits] [llvm] r105605 - in /llvm/trunk: include/llvm/ADT/SmallVector.h lib/Support/SmallVector.cpp Message-ID: <20100608114430.CB8F02A6C12C@llvm.org> Author: d0k Date: Tue Jun 8 06:44:30 2010 New Revision: 105605 URL: http://llvm.org/viewvc/llvm-project?rev=105605&view=rev Log: Use realloc instead of malloc+memcpy when growing a POD SmallVector. A smart realloc implementation can try to expand the allocated memory block in-place, avoiding the copy. Modified: llvm/trunk/include/llvm/ADT/SmallVector.h llvm/trunk/lib/Support/SmallVector.cpp Modified: llvm/trunk/include/llvm/ADT/SmallVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=105605&r1=105604&r2=105605&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallVector.h (original) +++ llvm/trunk/include/llvm/ADT/SmallVector.h Tue Jun 8 06:44:30 2010 @@ -17,6 +17,7 @@ #include "llvm/Support/type_traits.h" #include #include +#include #include #include @@ -207,7 +208,7 @@ size_t NewCapacity = 2*CurCapacity; if (NewCapacity < MinSize) NewCapacity = MinSize; - T *NewElts = static_cast(operator new(NewCapacity*sizeof(T))); + T *NewElts = static_cast(malloc(NewCapacity*sizeof(T))); // Copy the elements over. this->uninitialized_copy(this->begin(), this->end(), NewElts); @@ -217,7 +218,7 @@ // If this wasn't grown from the inline copy, deallocate the old space. if (!this->isSmall()) - operator delete(this->begin()); + free(this->begin()); this->setEnd(NewElts+CurSize); this->BeginX = NewElts; @@ -282,7 +283,7 @@ // If this wasn't grown from the inline copy, deallocate the old space. if (!this->isSmall()) - operator delete(this->begin()); + free(this->begin()); } Modified: llvm/trunk/lib/Support/SmallVector.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SmallVector.cpp?rev=105605&r1=105604&r2=105605&view=diff ============================================================================== --- llvm/trunk/lib/Support/SmallVector.cpp (original) +++ llvm/trunk/lib/Support/SmallVector.cpp Tue Jun 8 06:44:30 2010 @@ -21,15 +21,18 @@ size_t NewCapacityInBytes = 2 * capacity_in_bytes(); if (NewCapacityInBytes < MinSizeInBytes) NewCapacityInBytes = MinSizeInBytes; - void *NewElts = operator new(NewCapacityInBytes); - - // Copy the elements over. No need to run dtors on PODs. - memcpy(NewElts, this->BeginX, CurSizeBytes); - - // If this wasn't grown from the inline copy, deallocate the old space. - if (!this->isSmall()) - operator delete(this->BeginX); - + + void *NewElts; + if (this->isSmall()) { + NewElts = malloc(NewCapacityInBytes); + + // Copy the elements over. No need to run dtors on PODs. + memcpy(NewElts, this->BeginX, CurSizeBytes); + } else { + // If this wasn't grown from the inline copy, grow the allocated space. + NewElts = realloc(this->BeginX, NewCapacityInBytes); + } + this->EndX = (char*)NewElts+CurSizeBytes; this->BeginX = NewElts; this->CapacityX = (char*)this->BeginX + NewCapacityInBytes; From daniel at zuster.org Tue Jun 8 10:09:35 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 8 Jun 2010 08:09:35 -0700 Subject: [llvm-commits] [llvm] r105540 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h lib/Analysis/ScalarEvolution.cpp test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll In-Reply-To: <20100607190613.7F62E2A6C12C@llvm.org> References: <20100607190613.7F62E2A6C12C@llvm.org> Message-ID: Hi Dan, This broke '2008-07-29-sminexpr.ll' when using Clang to compile, or when using the system compiler on Darwin/PowerPC. I believe that something is non-deterministic with your change, because the diff shows LHS/RHS flipped from the expected output: -- /Users/buildslave/zorg/buildbot/smooshlab/slave/build.clang-x86_64-darwin10-selfhost-rel/llvm.src/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll:25:10: error: expected string not found in input ; CHECK: backedge-taken count is (-2147483632 + ((-1 + (-1 * %y)) smax (-1 + (-1 * %x)))) ^ :1:1: note: scanning from here Printing analysis 'Scalar Evolution Analysis' for function 'b': ^ :14:15: note: possible intended match here Loop %forinc: backedge-taken count is (-2147483632 + ((-1 + (-1 * %x)) smax (-1 + (-1 * %y)))) ^ -- Can you take a look? - Daniel On Mon, Jun 7, 2010 at 12:06 PM, Dan Gohman wrote: > Author: djg > Date: Mon Jun ?7 14:06:13 2010 > New Revision: 105540 > > URL: http://llvm.org/viewvc/llvm-project?rev=105540&view=rev > Log: > Optimize ScalarEvolution's SCEVComplexityCompare predicate: don't go > scrounging through SCEVUnknown contents and SCEVNAryExpr operands; > instead just do a simple deterministic comparison of the precomputed > hash data. > > Also, since this is more precise, it eliminates the need for the slow > N^2 duplicate detection code. > > Modified: > ? ?llvm/trunk/include/llvm/Analysis/ScalarEvolution.h > ? ?llvm/trunk/lib/Analysis/ScalarEvolution.cpp > ? ?llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll > > Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=105540&r1=105539&r2=105540&view=diff > ============================================================================== > --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original) > +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Mon Jun ?7 14:06:13 2010 > @@ -76,6 +76,9 @@ > ? ? /// Profile - FoldingSet support. > ? ? void Profile(FoldingSetNodeID& ID) { ID = FastID; } > > + ? ?/// getProfile - Like Profile, but a different interface which doesn't copy. > + ? ?const FoldingSetNodeIDRef &getProfile() const { return FastID; } > + > ? ? /// isLoopInvariant - Return true if the value of this SCEV is unchanging in > ? ? /// the specified loop. > ? ? virtual bool isLoopInvariant(const Loop *L) const = 0; > > Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=105540&r1=105539&r2=105540&view=diff > ============================================================================== > --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) > +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Jun ?7 14:06:13 2010 > @@ -508,106 +508,15 @@ > ? ? ? if (LHS->getSCEVType() != RHS->getSCEVType()) > ? ? ? ? return LHS->getSCEVType() < RHS->getSCEVType(); > > - ? ? ?// Aside from the getSCEVType() ordering, the particular ordering > - ? ? ?// isn't very important except that it's beneficial to be consistent, > - ? ? ?// so that (a + b) and (b + a) don't end up as different expressions. > - > - ? ? ?// Sort SCEVUnknown values with some loose heuristics. TODO: This is > - ? ? ?// not as complete as it could be. > - ? ? ?if (const SCEVUnknown *LU = dyn_cast(LHS)) { > - ? ? ? ?const SCEVUnknown *RU = cast(RHS); > - > - ? ? ? ?// Order pointer values after integer values. This helps SCEVExpander > - ? ? ? ?// form GEPs. > - ? ? ? ?if (LU->getType()->isPointerTy() && !RU->getType()->isPointerTy()) > - ? ? ? ? ?return false; > - ? ? ? ?if (RU->getType()->isPointerTy() && !LU->getType()->isPointerTy()) > - ? ? ? ? ?return true; > - > - ? ? ? ?// Compare getValueID values. > - ? ? ? ?if (LU->getValue()->getValueID() != RU->getValue()->getValueID()) > - ? ? ? ? ?return LU->getValue()->getValueID() < RU->getValue()->getValueID(); > - > - ? ? ? ?// Sort arguments by their position. > - ? ? ? ?if (const Argument *LA = dyn_cast(LU->getValue())) { > - ? ? ? ? ?const Argument *RA = cast(RU->getValue()); > - ? ? ? ? ?return LA->getArgNo() < RA->getArgNo(); > - ? ? ? ?} > - > - ? ? ? ?// For instructions, compare their loop depth, and their opcode. > - ? ? ? ?// This is pretty loose. > - ? ? ? ?if (Instruction *LV = dyn_cast(LU->getValue())) { > - ? ? ? ? ?Instruction *RV = cast(RU->getValue()); > - > - ? ? ? ? ?// Compare loop depths. > - ? ? ? ? ?if (LI->getLoopDepth(LV->getParent()) != > - ? ? ? ? ? ? ?LI->getLoopDepth(RV->getParent())) > - ? ? ? ? ? ?return LI->getLoopDepth(LV->getParent()) < > - ? ? ? ? ? ? ? ? ? LI->getLoopDepth(RV->getParent()); > - > - ? ? ? ? ?// Compare opcodes. > - ? ? ? ? ?if (LV->getOpcode() != RV->getOpcode()) > - ? ? ? ? ? ?return LV->getOpcode() < RV->getOpcode(); > - > - ? ? ? ? ?// Compare the number of operands. > - ? ? ? ? ?if (LV->getNumOperands() != RV->getNumOperands()) > - ? ? ? ? ? ?return LV->getNumOperands() < RV->getNumOperands(); > - ? ? ? ?} > - > - ? ? ? ?return false; > - ? ? ?} > - > - ? ? ?// Compare constant values. > - ? ? ?if (const SCEVConstant *LC = dyn_cast(LHS)) { > - ? ? ? ?const SCEVConstant *RC = cast(RHS); > - ? ? ? ?if (LC->getValue()->getBitWidth() != RC->getValue()->getBitWidth()) > - ? ? ? ? ?return LC->getValue()->getBitWidth() < RC->getValue()->getBitWidth(); > - ? ? ? ?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)) { > - ? ? ? ?const SCEVNAryExpr *RC = cast(RHS); > - ? ? ? ?for (unsigned i = 0, e = LC->getNumOperands(); i != e; ++i) { > - ? ? ? ? ?if (i >= RC->getNumOperands()) > - ? ? ? ? ? ?return false; > - ? ? ? ? ?if (operator()(LC->getOperand(i), RC->getOperand(i))) > - ? ? ? ? ? ?return true; > - ? ? ? ? ?if (operator()(RC->getOperand(i), LC->getOperand(i))) > - ? ? ? ? ? ?return false; > - ? ? ? ?} > - ? ? ? ?return LC->getNumOperands() < RC->getNumOperands(); > - ? ? ?} > - > - ? ? ?// Lexicographically compare udiv expressions. > - ? ? ?if (const SCEVUDivExpr *LC = dyn_cast(LHS)) { > - ? ? ? ?const SCEVUDivExpr *RC = cast(RHS); > - ? ? ? ?if (operator()(LC->getLHS(), RC->getLHS())) > - ? ? ? ? ?return true; > - ? ? ? ?if (operator()(RC->getLHS(), LC->getLHS())) > - ? ? ? ? ?return false; > - ? ? ? ?if (operator()(LC->getRHS(), RC->getRHS())) > - ? ? ? ? ?return true; > - ? ? ? ?if (operator()(RC->getRHS(), LC->getRHS())) > - ? ? ? ? ?return false; > - ? ? ? ?return false; > - ? ? ?} > - > - ? ? ?// Compare cast expressions by operand. > - ? ? ?if (const SCEVCastExpr *LC = dyn_cast(LHS)) { > - ? ? ? ?const SCEVCastExpr *RC = cast(RHS); > - ? ? ? ?return operator()(LC->getOperand(), RC->getOperand()); > - ? ? ?} > - > - ? ? ?llvm_unreachable("Unknown SCEV kind!"); > - ? ? ?return false; > + ? ? ?// Then, pick an arbitrary sort. Use the profiling data for speed. > + ? ? ?const FoldingSetNodeIDRef &L = LHS->getProfile(); > + ? ? ?const FoldingSetNodeIDRef &R = RHS->getProfile(); > + ? ? ?size_t LSize = L.getSize(); > + ? ? ?size_t RSize = R.getSize(); > + ? ? ?if (LSize != RSize) > + ? ? ? ?return LSize < RSize; > + ? ? ?return memcmp(L.getData(), R.getData(), > + ? ? ? ? ? ? ? ? ? ?LSize * sizeof(*L.getData())) < 0; > ? ? } > ? }; > ?} > @@ -625,36 +534,18 @@ > ?static void GroupByComplexity(SmallVectorImpl &Ops, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? LoopInfo *LI) { > ? if (Ops.size() < 2) return; ?// Noop > + > + ?SCEVComplexityCompare Comp(LI); > + > ? if (Ops.size() == 2) { > ? ? // This is the common case, which also happens to be trivially simple. > ? ? // Special case it. > - ? ?if (SCEVComplexityCompare(LI)(Ops[1], Ops[0])) > + ? ?if (Comp(Ops[1], Ops[0])) > ? ? ? std::swap(Ops[0], Ops[1]); > ? ? return; > ? } > > - ?// Do the rough sort by complexity. > - ?std::stable_sort(Ops.begin(), Ops.end(), SCEVComplexityCompare(LI)); > - > - ?// Now that we are sorted by complexity, group elements of the same > - ?// complexity. ?Note that this is, at worst, N^2, but the vector is likely to > - ?// be extremely short in practice. ?Note that we take this approach because we > - ?// do not want to depend on the addresses of the objects we are grouping. > - ?for (unsigned i = 0, e = Ops.size(); i != e-2; ++i) { > - ? ?const SCEV *S = Ops[i]; > - ? ?unsigned Complexity = S->getSCEVType(); > - > - ? ?// If there are any objects of the same complexity and same value as this > - ? ?// one, group them. > - ? ?for (unsigned j = i+1; j != e && Ops[j]->getSCEVType() == Complexity; ++j) { > - ? ? ?if (Ops[j] == S) { // Found a duplicate. > - ? ? ? ?// Move it to immediately after i'th element. > - ? ? ? ?std::swap(Ops[i+1], Ops[j]); > - ? ? ? ?++i; ? // no need to rescan it. > - ? ? ? ?if (i == e-2) return; ?// Done! > - ? ? ?} > - ? ?} > - ?} > + ?std::stable_sort(Ops.begin(), Ops.end(), Comp); > ?} > > > > Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll?rev=105540&r1=105539&r2=105540&view=diff > ============================================================================== > --- llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll (original) > +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll Mon Jun ?7 14:06:13 2010 > @@ -22,5 +22,5 @@ > ? ? ? ?ret i32 %j.0.lcssa > ?} > > -; CHECK: backedge-taken count is (-2147483632 + ((-1 + (-1 * %x)) smax (-1 + (-1 * %y)))) > +; CHECK: backedge-taken count is (-2147483632 + ((-1 + (-1 * %y)) smax (-1 + (-1 * %x)))) > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From daniel at zuster.org Tue Jun 8 11:13:27 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 8 Jun 2010 09:13:27 -0700 Subject: [llvm-commits] [patch] More virtual memory for lit In-Reply-To: References: Message-ID: Sure, seems fine to me. - Daniel On Fri, Jun 4, 2010 at 4:14 PM, Rafael Espindola wrote: > The python is x86-64 fedora 13 needs more than 512 MB of virtual > memory to run the llvm tests :-( It currently fails with > > -- Testing: 5324 tests, 8 threads -- > Fatal Python error: PyEval_AcquireThread: NULL new thread state > > Is the attached patch OK? > > Cheers, > -- > Rafael ?vila de Esp?ndola > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > From daniel at zuster.org Tue Jun 8 11:15:40 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 08 Jun 2010 16:15:40 -0000 Subject: [llvm-commits] [test-suite] r105609 - /test-suite/trunk/SingleSource/UnitTests/ObjC++/reference-in-block-args.reference_output Message-ID: <20100608161540.418822A6C12C@llvm.org> Author: ddunbar Date: Tue Jun 8 11:15:40 2010 New Revision: 105609 URL: http://llvm.org/viewvc/llvm-project?rev=105609&view=rev Log: Add reference output for 'SingleSource/UnitTests/ObjC++/reference-in-block-args'. Added: test-suite/trunk/SingleSource/UnitTests/ObjC++/reference-in-block-args.reference_output Added: test-suite/trunk/SingleSource/UnitTests/ObjC++/reference-in-block-args.reference_output URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/ObjC%2B%2B/reference-in-block-args.reference_output?rev=105609&view=auto ============================================================================== --- test-suite/trunk/SingleSource/UnitTests/ObjC++/reference-in-block-args.reference_output (added) +++ test-suite/trunk/SingleSource/UnitTests/ObjC++/reference-in-block-args.reference_output Tue Jun 8 11:15:40 2010 @@ -0,0 +1 @@ +exit 0 From rafael.espindola at gmail.com Tue Jun 8 11:17:58 2010 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 08 Jun 2010 16:17:58 -0000 Subject: [llvm-commits] [llvm] r105610 - /llvm/trunk/test/Makefile Message-ID: <20100608161758.86D172A6C12C@llvm.org> Author: rafael Date: Tue Jun 8 11:17:58 2010 New Revision: 105610 URL: http://llvm.org/viewvc/llvm-project?rev=105610&view=rev Log: Add more virtual memory to lit. The python in x86-64 fedora 13 needs it to run the llvm tests :-( It was failing with -- Testing: 5324 tests, 8 threads -- Fatal Python error: PyEval_AcquireThread: NULL new thread state Modified: llvm/trunk/test/Makefile Modified: llvm/trunk/test/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=105610&r1=105609&r2=105610&view=diff ============================================================================== --- llvm/trunk/test/Makefile (original) +++ llvm/trunk/test/Makefile Tue Jun 8 11:17:58 2010 @@ -84,7 +84,8 @@ ifeq ($(HOST_OS),AuroraUX) ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -v 512000 ; else # !AuroraUX -ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -v 512000 ; +# Fedora 13 x86-64 python fails with -v 51200 +ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -v 768000 ; endif # AuroraUX endif # SunOS From daniel at zuster.org Tue Jun 8 11:21:22 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 08 Jun 2010 16:21:22 -0000 Subject: [llvm-commits] [llvm] r105612 - in /llvm/trunk: include/llvm/ADT/DAGDeltaAlgorithm.h lib/Support/CMakeLists.txt lib/Support/DAGDeltaAlgorithm.cpp unittests/ADT/DAGDeltaAlgorithmTest.cpp Message-ID: <20100608162122.4C5942A6C12C@llvm.org> Author: ddunbar Date: Tue Jun 8 11:21:22 2010 New Revision: 105612 URL: http://llvm.org/viewvc/llvm-project?rev=105612&view=rev Log: ADT: Add DAGDeltaAlgorithm, which is a DAG minimization algorithm built on top of the standard 'delta debugging' algorithm. - This can give substantial speedups in the delta process for inputs we can construct dependency information for. Added: llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h llvm/trunk/lib/Support/DAGDeltaAlgorithm.cpp llvm/trunk/unittests/ADT/DAGDeltaAlgorithmTest.cpp Modified: llvm/trunk/lib/Support/CMakeLists.txt Added: llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h?rev=105612&view=auto ============================================================================== --- llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h (added) +++ llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h Tue Jun 8 11:21:22 2010 @@ -0,0 +1,73 @@ +//===--- DAGDeltaAlgorithm.h - A DAG Minimization Algorithm ----*- C++ -*--===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_DAGDELTAALGORITHM_H +#define LLVM_ADT_DAGDELTAALGORITHM_H + +#include +#include + +namespace llvm { + +/// DAGDeltaAlgorithm - Implements a "delta debugging" algorithm for minimizing +/// directed acyclic graphs using a predicate function. +/// +/// The result of the algorithm is a subset of the input change set which is +/// guaranteed to satisfy the predicate, assuming that the input set did. For +/// well formed predicates, the result set is guaranteed to be such that +/// removing any single element not required by the dependencies on the other +/// elements would falsify the predicate. +/// +/// The DAG should be used to represent dependencies in the changes which are +/// likely to hold across the predicate function. That is, for a particular +/// changeset S and predicate P: +/// +/// P(S) => P(S union pred(S)) +/// +/// The minization algorithm uses this dependency information to attempt to +/// eagerly prune large subsets of changes. As with \see DeltaAlgorithm, the DAG +/// is not required to satisfy this property, but the algorithm will run +/// substantially fewer tests with appropriate dependencies. \see DeltaAlgorithm +/// for more information on the properties which the predicate function itself +/// should satisfy. +class DAGDeltaAlgorithm { +public: + typedef unsigned change_ty; + typedef std::pair edge_ty; + + // FIXME: Use a decent data structure. + typedef std::set changeset_ty; + typedef std::vector changesetlist_ty; + +public: + /// Run - Minimize the DAG formed by the \arg Changes vertices and the \arg + /// Dependencies edges by executing \see ExecuteOneTest() on subsets of + /// changes and returning the smallest set which still satisfies the test + /// predicate and the input \arg Dependencies. + /// + /// \param Changes The list of changes. + /// + /// \param Dependencies The list of dependencies amongst changes. For each + /// (x,y) in \arg Dependencies, both x and y must be in \arg Changes. The + /// minimization algorithm guarantees that for each tested changed set S, x + /// \in S implies y \in S. It is an error to have cyclic dependencies. + changeset_ty Run(const changeset_ty &Changes, + const std::vector &Dependencies); + + /// UpdatedSearchState - Callback used when the search state changes. + virtual void UpdatedSearchState(const changeset_ty &Changes, + const changesetlist_ty &Sets, + const changeset_ty &Required) {} + + /// ExecuteOneTest - Execute a single test predicate on the change set \arg S. + virtual bool ExecuteOneTest(const changeset_ty &S) = 0; +}; + +} // end namespace llvm + +#endif Modified: llvm/trunk/lib/Support/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CMakeLists.txt?rev=105612&r1=105611&r2=105612&view=diff ============================================================================== --- llvm/trunk/lib/Support/CMakeLists.txt (original) +++ llvm/trunk/lib/Support/CMakeLists.txt Tue Jun 8 11:21:22 2010 @@ -8,6 +8,7 @@ ConstantRange.cpp Debug.cpp DeltaAlgorithm.cpp + DAGDeltaAlgorithm.cpp Dwarf.cpp ErrorHandling.cpp FileUtilities.cpp Added: llvm/trunk/lib/Support/DAGDeltaAlgorithm.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/DAGDeltaAlgorithm.cpp?rev=105612&view=auto ============================================================================== --- llvm/trunk/lib/Support/DAGDeltaAlgorithm.cpp (added) +++ llvm/trunk/lib/Support/DAGDeltaAlgorithm.cpp Tue Jun 8 11:21:22 2010 @@ -0,0 +1,357 @@ +//===--- DAGDeltaAlgorithm.cpp - A DAG Minimization Algorithm --*- C++ -*--===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +//===----------------------------------------------------------------------===// +// +// The algorithm we use attempts to exploit the dependency information by +// minimizing top-down. We start by constructing an initial root set R, and +// then iteratively: +// +// 1. Minimize the set R using the test predicate: +// P'(S) = P(S union pred*(S)) +// +// 2. Extend R to R' = R union pred(R). +// +// until a fixed point is reached. +// +// The idea is that we want to quickly prune entire portions of the graph, so we +// try to find high-level nodes that can be eliminated with all of their +// dependents. +// +// FIXME: The current algorithm doesn't actually provide a strong guarantee +// about the minimality of the result. The problem is that after adding nodes to +// the required set, we no longer consider them for elimination. For strictly +// well formed predicates, this doesn't happen, but it commonly occurs in +// practice when there are unmodelled dependencies. I believe we can resolve +// this by allowing the required set to be minimized as well, but need more test +// cases first. +// +//===----------------------------------------------------------------------===// + +#include "llvm/ADT/DAGDeltaAlgorithm.h" +#include "llvm/ADT/DeltaAlgorithm.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/Format.h" +#include "llvm/Support/raw_ostream.h" +#include +#include +#include +#include +using namespace llvm; + +namespace { + +class DAGDeltaAlgorithmImpl { + friend class DeltaActiveSetHelper; + +public: + typedef DAGDeltaAlgorithm::change_ty change_ty; + typedef DAGDeltaAlgorithm::changeset_ty changeset_ty; + typedef DAGDeltaAlgorithm::changesetlist_ty changesetlist_ty; + typedef DAGDeltaAlgorithm::edge_ty edge_ty; + +private: + typedef std::vector::iterator pred_iterator_ty; + typedef std::vector::iterator succ_iterator_ty; + typedef std::set::iterator pred_closure_iterator_ty; + typedef std::set::iterator succ_closure_iterator_ty; + + DAGDeltaAlgorithm &DDA; + + const changeset_ty &Changes; + const std::vector &Dependencies; + + std::vector Roots; + + /// Cache of failed test results. Successful test results are never cached + /// since we always reduce following a success. We maintain an independent + /// cache from that used by the individual delta passes because we may get + /// hits across multiple individual delta invocations. + mutable std::set FailedTestsCache; + + // FIXME: Gross. + std::map > Predecessors; + std::map > Successors; + + std::map > PredClosure; + std::map > SuccClosure; + +private: + pred_iterator_ty pred_begin(change_ty Node) { + assert(Predecessors.count(Node) && "Invalid node!"); + return Predecessors[Node].begin(); + } + pred_iterator_ty pred_end(change_ty Node) { + assert(Predecessors.count(Node) && "Invalid node!"); + return Predecessors[Node].end(); + } + + pred_closure_iterator_ty pred_closure_begin(change_ty Node) { + assert(PredClosure.count(Node) && "Invalid node!"); + return PredClosure[Node].begin(); + } + pred_closure_iterator_ty pred_closure_end(change_ty Node) { + assert(PredClosure.count(Node) && "Invalid node!"); + return PredClosure[Node].end(); + } + + succ_iterator_ty succ_begin(change_ty Node) { + assert(Successors.count(Node) && "Invalid node!"); + return Successors[Node].begin(); + } + succ_iterator_ty succ_end(change_ty Node) { + assert(Successors.count(Node) && "Invalid node!"); + return Successors[Node].end(); + } + + succ_closure_iterator_ty succ_closure_begin(change_ty Node) { + assert(SuccClosure.count(Node) && "Invalid node!"); + return SuccClosure[Node].begin(); + } + succ_closure_iterator_ty succ_closure_end(change_ty Node) { + assert(SuccClosure.count(Node) && "Invalid node!"); + return SuccClosure[Node].end(); + } + + void UpdatedSearchState(const changeset_ty &Changes, + const changesetlist_ty &Sets, + const changeset_ty &Required) { + DDA.UpdatedSearchState(Changes, Sets, Required); + } + + /// ExecuteOneTest - Execute a single test predicate on the change set \arg S. + bool ExecuteOneTest(const changeset_ty &S) { + // Check dependencies invariant. + DEBUG({ + for (changeset_ty::const_iterator it = S.begin(), + ie = S.end(); it != ie; ++it) + for (succ_iterator_ty it2 = succ_begin(*it), + ie2 = succ_end(*it); it2 != ie2; ++it2) + assert(S.count(*it2) && "Attempt to run invalid changeset!"); + }); + + return DDA.ExecuteOneTest(S); + } + +public: + DAGDeltaAlgorithmImpl(DAGDeltaAlgorithm &_DDA, + const changeset_ty &_Changes, + const std::vector &_Dependencies); + + changeset_ty Run(); + + /// GetTestResult - Get the test result for the active set \arg Changes with + /// \arg Required changes from the cache, executing the test if necessary. + /// + /// \param Changes - The set of active changes being minimized, which should + /// have their pred closure included in the test. + /// \param Required - The set of changes which have previously been + /// established to be required. + /// \return - The test result. + bool GetTestResult(const changeset_ty &Changes, const changeset_ty &Required); +}; + +/// Helper object for minimizing an active set of changes. +class DeltaActiveSetHelper : public DeltaAlgorithm { + DAGDeltaAlgorithmImpl &DDAI; + + const changeset_ty &Required; + +protected: + /// UpdatedSearchState - Callback used when the search state changes. + virtual void UpdatedSearchState(const changeset_ty &Changes, + const changesetlist_ty &Sets) { + DDAI.UpdatedSearchState(Changes, Sets, Required); + } + + virtual bool ExecuteOneTest(const changeset_ty &S) { + return DDAI.GetTestResult(S, Required); + } + +public: + DeltaActiveSetHelper(DAGDeltaAlgorithmImpl &_DDAI, + const changeset_ty &_Required) + : DDAI(_DDAI), Required(_Required) {} +}; + +} + +DAGDeltaAlgorithmImpl::DAGDeltaAlgorithmImpl(DAGDeltaAlgorithm &_DDA, + const changeset_ty &_Changes, + const std::vector + &_Dependencies) + : DDA(_DDA), + Changes(_Changes), + Dependencies(_Dependencies) +{ + for (changeset_ty::const_iterator it = Changes.begin(), + ie = Changes.end(); it != ie; ++it) { + Predecessors.insert(std::make_pair(*it, std::vector())); + Successors.insert(std::make_pair(*it, std::vector())); + } + for (std::vector::const_iterator it = Dependencies.begin(), + ie = Dependencies.end(); it != ie; ++it) { + Predecessors[it->second].push_back(it->first); + Successors[it->first].push_back(it->second); + } + + // Compute the roots. + for (changeset_ty::const_iterator it = Changes.begin(), + ie = Changes.end(); it != ie; ++it) + if (succ_begin(*it) == succ_end(*it)) + Roots.push_back(*it); + + // Pre-compute the closure of the successor relation. + std::vector Worklist(Roots.begin(), Roots.end()); + while (!Worklist.empty()) { + change_ty Change = Worklist.back(); + Worklist.pop_back(); + + std::set &ChangeSuccs = SuccClosure[Change]; + for (pred_iterator_ty it = pred_begin(Change), + ie = pred_end(Change); it != ie; ++it) { + SuccClosure[*it].insert(Change); + SuccClosure[*it].insert(ChangeSuccs.begin(), ChangeSuccs.end()); + Worklist.push_back(*it); + } + } + + // Invert to form the predecessor closure map. + for (changeset_ty::const_iterator it = Changes.begin(), + ie = Changes.end(); it != ie; ++it) + PredClosure.insert(std::make_pair(*it, std::set())); + for (changeset_ty::const_iterator it = Changes.begin(), + ie = Changes.end(); it != ie; ++it) + for (succ_closure_iterator_ty it2 = succ_closure_begin(*it), + ie2 = succ_closure_end(*it); it2 != ie2; ++it2) + PredClosure[*it2].insert(*it); + + // Dump useful debug info. + DEBUG({ + llvm::errs() << "-- DAGDeltaAlgorithmImpl --\n"; + llvm::errs() << "Changes: ["; + for (changeset_ty::const_iterator it = Changes.begin(), + ie = Changes.end(); it != ie; ++it) { + if (it != Changes.begin()) llvm::errs() << ", "; + llvm::errs() << *it; + + if (succ_begin(*it) != succ_end(*it)) { + llvm::errs() << "("; + for (succ_iterator_ty it2 = succ_begin(*it), + ie2 = succ_end(*it); it2 != ie2; ++it2) { + if (it2 != succ_begin(*it)) llvm::errs() << ", "; + llvm::errs() << "->" << *it2; + } + llvm::errs() << ")"; + } + } + llvm::errs() << "]\n"; + + llvm::errs() << "Roots: ["; + for (std::vector::const_iterator it = Roots.begin(), + ie = Roots.end(); it != ie; ++it) { + if (it != Roots.begin()) llvm::errs() << ", "; + llvm::errs() << *it; + } + llvm::errs() << "]\n"; + + llvm::errs() << "Predecessor Closure:\n"; + for (changeset_ty::const_iterator it = Changes.begin(), + ie = Changes.end(); it != ie; ++it) { + llvm::errs() << format(" %-4d: [", *it); + for (pred_closure_iterator_ty it2 = pred_closure_begin(*it), + ie2 = pred_closure_end(*it); it2 != ie2; ++it2) { + if (it2 != pred_closure_begin(*it)) llvm::errs() << ", "; + llvm::errs() << *it2; + } + llvm::errs() << "]\n"; + } + + llvm::errs() << "Successor Closure:\n"; + for (changeset_ty::const_iterator it = Changes.begin(), + ie = Changes.end(); it != ie; ++it) { + llvm::errs() << format(" %-4d: [", *it); + for (succ_closure_iterator_ty it2 = succ_closure_begin(*it), + ie2 = succ_closure_end(*it); it2 != ie2; ++it2) { + if (it2 != succ_closure_begin(*it)) llvm::errs() << ", "; + llvm::errs() << *it2; + } + llvm::errs() << "]\n"; + } + + llvm::errs() << "\n\n"; + }); +} + +bool DAGDeltaAlgorithmImpl::GetTestResult(const changeset_ty &Changes, + const changeset_ty &Required) { + changeset_ty Extended(Required); + Extended.insert(Changes.begin(), Changes.end()); + for (changeset_ty::iterator it = Changes.begin(), + ie = Changes.end(); it != ie; ++it) + Extended.insert(pred_closure_begin(*it), pred_closure_end(*it)); + + if (FailedTestsCache.count(Extended)) + return false; + + bool Result = ExecuteOneTest(Extended); + if (!Result) + FailedTestsCache.insert(Extended); + + return Result; +} + +DAGDeltaAlgorithm::changeset_ty +DAGDeltaAlgorithmImpl::Run() { + // The current set of changes we are minimizing, starting at the roots. + changeset_ty CurrentSet(Roots.begin(), Roots.end()); + + // The set of required changes. + changeset_ty Required; + + // Iterate until the active set of changes is empty. Convergence is guaranteed + // assuming input was a DAG. + // + // Invariant: CurrentSet intersect Required == {} + // Invariant: Required == (Required union succ*(Required)) + while (!CurrentSet.empty()) { + DEBUG({ + llvm::errs() << "DAG_DD - " << CurrentSet.size() << " active changes, " + << Required.size() << " required changes\n"; + }); + + // Minimize the current set of changes. + DeltaActiveSetHelper Helper(*this, Required); + changeset_ty CurrentMinSet = Helper.Run(CurrentSet); + + // Update the set of required changes. Since + // CurrentMinSet subset CurrentSet + // and after the last iteration, + // succ(CurrentSet) subset Required + // then + // succ(CurrentMinSet) subset Required + // and our invariant on Required is maintained. + Required.insert(CurrentMinSet.begin(), CurrentMinSet.end()); + + // Replace the current set with the predecssors of the minimized set of + // active changes. + CurrentSet.clear(); + for (changeset_ty::const_iterator it = CurrentMinSet.begin(), + ie = CurrentMinSet.end(); it != ie; ++it) + CurrentSet.insert(pred_begin(*it), pred_end(*it)); + + // FIXME: We could enforce CurrentSet intersect Required == {} here if we + // wanted to protect against cyclic graphs. + } + + return Required; +} + +DAGDeltaAlgorithm::changeset_ty +DAGDeltaAlgorithm::Run(const changeset_ty &Changes, + const std::vector &Dependencies) { + return DAGDeltaAlgorithmImpl(*this, Changes, Dependencies).Run(); +} Added: llvm/trunk/unittests/ADT/DAGDeltaAlgorithmTest.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/DAGDeltaAlgorithmTest.cpp?rev=105612&view=auto ============================================================================== --- llvm/trunk/unittests/ADT/DAGDeltaAlgorithmTest.cpp (added) +++ llvm/trunk/unittests/ADT/DAGDeltaAlgorithmTest.cpp Tue Jun 8 11:21:22 2010 @@ -0,0 +1,122 @@ +//===- llvm/unittest/ADT/DAGDeltaAlgorithmTest.cpp ------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "gtest/gtest.h" +#include "llvm/ADT/DAGDeltaAlgorithm.h" +#include +#include +using namespace llvm; + +namespace std { + +static std::ostream &operator<<(std::ostream &OS, + const std::set &S) { + OS << "{"; + for (std::set::const_iterator it = S.begin(), + ie = S.end(); it != ie; ++it) { + if (it != S.begin()) + OS << ","; + OS << *it; + } + OS << "}"; + return OS; +} + +} + +namespace { + +typedef DAGDeltaAlgorithm::edge_ty edge_ty; + +class FixedDAGDeltaAlgorithm : public DAGDeltaAlgorithm { + changeset_ty FailingSet; + unsigned NumTests; + +protected: + virtual bool ExecuteOneTest(const changeset_ty &Changes) { + ++NumTests; + return std::includes(Changes.begin(), Changes.end(), + FailingSet.begin(), FailingSet.end()); + } + +public: + FixedDAGDeltaAlgorithm(const changeset_ty &_FailingSet) + : FailingSet(_FailingSet), + NumTests(0) {} + + unsigned getNumTests() const { return NumTests; } +}; + +std::set fixed_set(unsigned N, ...) { + std::set S; + va_list ap; + va_start(ap, N); + for (unsigned i = 0; i != N; ++i) + S.insert(va_arg(ap, unsigned)); + va_end(ap); + return S; +} + +std::set range(unsigned Start, unsigned End) { + std::set S; + while (Start != End) + S.insert(Start++); + return S; +} + +std::set range(unsigned N) { + return range(0, N); +} + +TEST(DAGDeltaAlgorithmTest, Basic) { + std::vector Deps; + + // Dependencies: + // 1 - 3 + Deps.clear(); + Deps.push_back(std::make_pair(3, 1)); + + // P = {3,5,7} \in S, + // [0, 20), + // should minimize to {1,3,5,7} in a reasonable number of tests. + FixedDAGDeltaAlgorithm FDA(fixed_set(3, 3, 5, 7)); + EXPECT_EQ(fixed_set(4, 1, 3, 5, 7), FDA.Run(range(20), Deps)); + EXPECT_GE(46U, FDA.getNumTests()); + + // Dependencies: + // 0 - 1 + // \- 2 - 3 + // \- 4 + Deps.clear(); + Deps.push_back(std::make_pair(1, 0)); + Deps.push_back(std::make_pair(2, 0)); + Deps.push_back(std::make_pair(4, 0)); + Deps.push_back(std::make_pair(3, 2)); + + // This is a case where we must hold required changes. + // + // P = {1,3} \in S, + // [0, 5), + // should minimize to {0,1,2,3} in a small number of tests. + FixedDAGDeltaAlgorithm FDA2(fixed_set(2, 1, 3)); + EXPECT_EQ(fixed_set(4, 0, 1, 2, 3), FDA2.Run(range(5), Deps)); + EXPECT_GE(9U, FDA2.getNumTests()); + + // This is a case where we should quickly prune part of the tree. + // + // P = {4} \in S, + // [0, 5), + // should minimize to {0,4} in a small number of tests. + FixedDAGDeltaAlgorithm FDA3(fixed_set(1, 4)); + EXPECT_EQ(fixed_set(2, 0, 4), FDA3.Run(range(5), Deps)); + EXPECT_GE(6U, FDA3.getNumTests()); +} + +} + From daniel at zuster.org Tue Jun 8 11:21:26 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 08 Jun 2010 16:21:26 -0000 Subject: [llvm-commits] [llvm] r105613 - /llvm/trunk/lib/Support/DeltaAlgorithm.cpp Message-ID: <20100608162126.F2B972A6C12D@llvm.org> Author: ddunbar Date: Tue Jun 8 11:21:26 2010 New Revision: 105613 URL: http://llvm.org/viewvc/llvm-project?rev=105613&view=rev Log: DeltaAlgorithm: Tweak split to split by first/second half instead of even/odd, since adjacent changes are more likely to be related. Modified: llvm/trunk/lib/Support/DeltaAlgorithm.cpp Modified: llvm/trunk/lib/Support/DeltaAlgorithm.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/DeltaAlgorithm.cpp?rev=105613&r1=105612&r2=105613&view=diff ============================================================================== --- llvm/trunk/lib/Support/DeltaAlgorithm.cpp (original) +++ llvm/trunk/lib/Support/DeltaAlgorithm.cpp Tue Jun 8 11:21:26 2010 @@ -30,10 +30,10 @@ // FIXME: This is really slow. changeset_ty LHS, RHS; - unsigned idx = 0; + unsigned idx = 0, N = S.size() / 2; for (changeset_ty::const_iterator it = S.begin(), ie = S.end(); it != ie; ++it, ++idx) - ((idx & 1) ? LHS : RHS).insert(*it); + ((idx < N) ? LHS : RHS).insert(*it); if (!LHS.empty()) Res.push_back(LHS); if (!RHS.empty()) From daniel at zuster.org Tue Jun 8 12:21:57 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 08 Jun 2010 17:21:57 -0000 Subject: [llvm-commits] [llvm] r105620 - /llvm/trunk/lib/Support/DAGDeltaAlgorithm.cpp Message-ID: <20100608172157.3AEEF2A6C12C@llvm.org> Author: ddunbar Date: Tue Jun 8 12:21:57 2010 New Revision: 105620 URL: http://llvm.org/viewvc/llvm-project?rev=105620&view=rev Log: Use const_iterator where appropriate. Modified: llvm/trunk/lib/Support/DAGDeltaAlgorithm.cpp Modified: llvm/trunk/lib/Support/DAGDeltaAlgorithm.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/DAGDeltaAlgorithm.cpp?rev=105620&r1=105619&r2=105620&view=diff ============================================================================== --- llvm/trunk/lib/Support/DAGDeltaAlgorithm.cpp (original) +++ llvm/trunk/lib/Support/DAGDeltaAlgorithm.cpp Tue Jun 8 12:21:57 2010 @@ -290,7 +290,7 @@ const changeset_ty &Required) { changeset_ty Extended(Required); Extended.insert(Changes.begin(), Changes.end()); - for (changeset_ty::iterator it = Changes.begin(), + for (changeset_ty::const_iterator it = Changes.begin(), ie = Changes.end(); it != ie; ++it) Extended.insert(pred_closure_begin(*it), pred_closure_end(*it)); From daniel at zuster.org Tue Jun 8 13:53:18 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 08 Jun 2010 18:53:18 -0000 Subject: [llvm-commits] [zorg] r105627 - /zorg/trunk/buildbot/osuosl/master/config/slaves.py Message-ID: <20100608185318.18E5E2A6C12C@llvm.org> Author: ddunbar Date: Tue Jun 8 13:53:17 2010 New Revision: 105627 URL: http://llvm.org/viewvc/llvm-project?rev=105627&view=rev Log: Update max_builds for a couple slaves Modified: zorg/trunk/buildbot/osuosl/master/config/slaves.py Modified: zorg/trunk/buildbot/osuosl/master/config/slaves.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/slaves.py?rev=105627&r1=105626&r2=105627&view=diff ============================================================================== --- zorg/trunk/buildbot/osuosl/master/config/slaves.py (original) +++ zorg/trunk/buildbot/osuosl/master/config/slaves.py Tue Jun 8 13:53:17 2010 @@ -12,7 +12,7 @@ create_slave("osu1", properties={'jobs' : 4}, max_builds=1), # FreeBSD zero.sajd.net 9.0-CURRENT i386 - create_slave("freebsd1", properties={'jobs' : 1}), + create_slave("freebsd1", properties={'jobs' : 1}, max_builds=1), # PowerPC Linux machine. 900MHz G3 processor with 256MB of RAM. create_slave("nick1", properties={'jobs' : 1}, max_builds=1), @@ -27,7 +27,7 @@ create_slave("dunbar-win32", properties={'jobs' : 1}, max_builds=1), # Dual Quad Core Mc Pro (Nehalem) running SnowLeopard. - create_slave("dunbar-darwin10", properties={'jobs' : 4}, max_builds=4), + create_slave("dunbar-darwin10", properties={'jobs' : 4}, max_builds=2), # Dual Core Pentium M, XP SP 3. create_slave("dunbar-win32-2", properties={'jobs' : 2}, max_builds=1), From grosbach at apple.com Tue Jun 8 14:14:01 2010 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 08 Jun 2010 19:14:01 -0000 Subject: [llvm-commits] [test-suite] r105629 - /test-suite/trunk/TEST.optllcdbg.Makefile Message-ID: <20100608191401.0D7CE2A6C12C@llvm.org> Author: grosbach Date: Tue Jun 8 14:14:00 2010 New Revision: 105629 URL: http://llvm.org/viewvc/llvm-project?rev=105629&view=rev Log: ignore debug info label numbering for codegen comparisons. Filter out Lpubtypes, Lpubnames and Linfo_ labels. The content is already filtered by the .long, .byte, .asciiz, etc. filters. Modified: test-suite/trunk/TEST.optllcdbg.Makefile Modified: test-suite/trunk/TEST.optllcdbg.Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/TEST.optllcdbg.Makefile?rev=105629&r1=105628&r2=105629&view=diff ============================================================================== --- test-suite/trunk/TEST.optllcdbg.Makefile (original) +++ test-suite/trunk/TEST.optllcdbg.Makefile Tue Jun 8 14:14:00 2010 @@ -33,7 +33,7 @@ $(LLC) $(LLC_DEBUG_FLAGS) $< -o $@ Output/%.first.s: Output/%.t1c.s Output/.dir $(LLC) - grep -v '\.long' < $< | grep -v '\.byte' | grep -v '\.short' | grep -v '\.asci' | grep -v '\.quad' | grep -v '## DW_AT' | grep -v '## Abbrev' | grep -v '## End Of Children' | grep -v '## Extended Op' | grep -v 'Ltmp[0-9]' | grep -v '## DIE' | grep -v '## $$' | grep -v '^#.*' | grep -v '^$$' | grep -v '__debug_str' | grep -v 'Lstring' | grep -v 'Lset' | grep -v 'debug_loc' > $@ + grep -v '\.long' < $< | grep -v '\.byte' | grep -v '\.short' | grep -v '\.asci' | grep -v '\.quad' | grep -v '## DW_AT' | grep -v '## Abbrev' | grep -v '## End Of Children' | grep -v '## Extended Op' | grep -v 'Ltmp[0-9]' | grep -v '## DIE' | grep -v '## $$' | grep -v '^#.*' | grep -v '^$$' | grep -v '__debug_str' | grep -v 'Lstring' | grep -v 'Lset' | grep -v 'debug_loc' | grep -v 'Lpubtypes' | grep -v 'Lpubnames' | grep -v 'Linfo_' > $@ Output/%.t2a.bc: Output/%.linked.rbc Output/.dir $(LOPT) $(LOPT) -strip-nondebug $< -f -o $@ @@ -45,7 +45,7 @@ $(LLC) $(LLC_DEBUG_FLAGS) $< -o $@ Output/%.second.s: Output/%.t2c.s Output/.dir - grep -v DEBUG_VALUE < $< | grep -v '\.long' | grep -v '\.byte' | grep -v '\.short' | grep -v '\.asci' | grep -v '## DW_AT' | grep -v '## Abbrev' | grep -v '## End Of Children' | grep -v '## Extended Op' | grep -v 'Ltmp[0-9]' | grep -v '## DIE' | grep -v '## $$' | grep -v '\.quad' | grep -v '^#' | grep -v '^$$' | grep -v '__debug_str' | grep -v 'Lstring' | grep -v 'Lset' | grep -v 'debug_loc' > $@ + grep -v DEBUG_VALUE < $< | grep -v '\.long' | grep -v '\.byte' | grep -v '\.short' | grep -v '\.asci' | grep -v '## DW_AT' | grep -v '## Abbrev' | grep -v '## End Of Children' | grep -v '## Extended Op' | grep -v 'Ltmp[0-9]' | grep -v '## DIE' | grep -v '## $$' | grep -v '\.quad' | grep -v '^#' | grep -v '^$$' | grep -v '__debug_str' | grep -v 'Lstring' | grep -v 'Lset' | grep -v 'debug_loc' | grep -v 'Lpubtypes' | grep -v 'Lpubnames' | grep -v 'Linfo_' > $@ Output/%.diff: Output/%.first.s Output/%.second.s @-if diff $^ > $@; then \ From grosbach at apple.com Tue Jun 8 14:55:35 2010 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 08 Jun 2010 19:55:35 -0000 Subject: [llvm-commits] [test-suite] r105632 - /test-suite/trunk/TEST.optllcdbg.Makefile Message-ID: <20100608195535.0FB622A6C12E@llvm.org> Author: grosbach Date: Tue Jun 8 14:55:34 2010 New Revision: 105632 URL: http://llvm.org/viewvc/llvm-project?rev=105632&view=rev Log: readability cleanup. no functional change. Modified: test-suite/trunk/TEST.optllcdbg.Makefile Modified: test-suite/trunk/TEST.optllcdbg.Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/TEST.optllcdbg.Makefile?rev=105632&r1=105631&r2=105632&view=diff ============================================================================== --- test-suite/trunk/TEST.optllcdbg.Makefile (original) +++ test-suite/trunk/TEST.optllcdbg.Makefile Tue Jun 8 14:55:34 2010 @@ -33,7 +33,27 @@ $(LLC) $(LLC_DEBUG_FLAGS) $< -o $@ Output/%.first.s: Output/%.t1c.s Output/.dir $(LLC) - grep -v '\.long' < $< | grep -v '\.byte' | grep -v '\.short' | grep -v '\.asci' | grep -v '\.quad' | grep -v '## DW_AT' | grep -v '## Abbrev' | grep -v '## End Of Children' | grep -v '## Extended Op' | grep -v 'Ltmp[0-9]' | grep -v '## DIE' | grep -v '## $$' | grep -v '^#.*' | grep -v '^$$' | grep -v '__debug_str' | grep -v 'Lstring' | grep -v 'Lset' | grep -v 'debug_loc' | grep -v 'Lpubtypes' | grep -v 'Lpubnames' | grep -v 'Linfo_' > $@ + grep -v '\.long' < $< \ + | grep -v '\.byte' \ + | grep -v '\.short' \ + | grep -v '\.asci' \ + | grep -v '\.quad' \ + | grep -v '## DW_AT' \ + | grep -v '## Abbrev' \ + | grep -v '## End Of Children' \ + | grep -v '## Extended Op' \ + | grep -v 'Ltmp[0-9]' \ + | grep -v '## DIE' \ + | grep -v '## $$' \ + | grep -v '^#.*' \ + | grep -v '^$$' \ + | grep -v '__debug_str' \ + | grep -v 'Lstring' \ + | grep -v 'Lset' \ + | grep -v 'debug_loc' \ + | grep -v 'Lpubtypes' \ + | grep -v 'Lpubnames' \ + | grep -v 'Linfo_' > $@ Output/%.t2a.bc: Output/%.linked.rbc Output/.dir $(LOPT) $(LOPT) -strip-nondebug $< -f -o $@ @@ -45,7 +65,27 @@ $(LLC) $(LLC_DEBUG_FLAGS) $< -o $@ Output/%.second.s: Output/%.t2c.s Output/.dir - grep -v DEBUG_VALUE < $< | grep -v '\.long' | grep -v '\.byte' | grep -v '\.short' | grep -v '\.asci' | grep -v '## DW_AT' | grep -v '## Abbrev' | grep -v '## End Of Children' | grep -v '## Extended Op' | grep -v 'Ltmp[0-9]' | grep -v '## DIE' | grep -v '## $$' | grep -v '\.quad' | grep -v '^#' | grep -v '^$$' | grep -v '__debug_str' | grep -v 'Lstring' | grep -v 'Lset' | grep -v 'debug_loc' | grep -v 'Lpubtypes' | grep -v 'Lpubnames' | grep -v 'Linfo_' > $@ + grep -v '\.long' < $< \ + | grep -v '\.byte' \ + | grep -v '\.short' \ + | grep -v '\.asci' \ + | grep -v '\.quad' \ + | grep -v '## DW_AT' \ + | grep -v '## Abbrev' \ + | grep -v '## End Of Children' \ + | grep -v '## Extended Op' \ + | grep -v 'Ltmp[0-9]' \ + | grep -v '## DIE' \ + | grep -v '## $$' \ + | grep -v '^#.*' \ + | grep -v '^$$' \ + | grep -v '__debug_str' \ + | grep -v 'Lstring' \ + | grep -v 'Lset' \ + | grep -v 'debug_loc' \ + | grep -v 'Lpubtypes' \ + | grep -v 'Lpubnames' \ + | grep -v 'Linfo_' > $@ Output/%.diff: Output/%.first.s Output/%.second.s @-if diff $^ > $@; then \ From grosbach at apple.com Tue Jun 8 15:06:55 2010 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 08 Jun 2010 20:06:55 -0000 Subject: [llvm-commits] [llvm] r105634 - /llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Message-ID: <20100608200655.901012A6C12E@llvm.org> Author: grosbach Date: Tue Jun 8 15:06:55 2010 New Revision: 105634 URL: http://llvm.org/viewvc/llvm-project?rev=105634&view=rev Log: fix typo Modified: llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Modified: llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp?rev=105634&r1=105633&r2=105634&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2SizeReduction.cpp Tue Jun 8 15:06:55 2010 @@ -689,7 +689,7 @@ goto ProcessNext; } - // Try to transform ro a 16-bit non-two-address instruction. + // Try to transform to a 16-bit non-two-address instruction. if (Entry.NarrowOpc1 && ReduceToNarrow(MBB, MI, Entry, LiveCPSR)) { Modified = true; MachineBasicBlock::iterator I = prior(NextMII); From grosbach at apple.com Tue Jun 8 15:09:23 2010 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 08 Jun 2010 20:09:23 -0000 Subject: [llvm-commits] [test-suite] r105635 - /test-suite/trunk/TEST.optllcdbg.Makefile Message-ID: <20100608200924.03A132A6C12E@llvm.org> Author: grosbach Date: Tue Jun 8 15:09:23 2010 New Revision: 105635 URL: http://llvm.org/viewvc/llvm-project?rev=105635&view=rev Log: add more debug info filters to optllcdbg test Modified: test-suite/trunk/TEST.optllcdbg.Makefile Modified: test-suite/trunk/TEST.optllcdbg.Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/TEST.optllcdbg.Makefile?rev=105635&r1=105634&r2=105635&view=diff ============================================================================== --- test-suite/trunk/TEST.optllcdbg.Makefile (original) +++ test-suite/trunk/TEST.optllcdbg.Makefile Tue Jun 8 15:09:23 2010 @@ -38,6 +38,7 @@ | grep -v '\.short' \ | grep -v '\.asci' \ | grep -v '\.quad' \ + | grep -v '\.align' \ | grep -v '## DW_AT' \ | grep -v '## Abbrev' \ | grep -v '## End Of Children' \ @@ -53,7 +54,11 @@ | grep -v 'debug_loc' \ | grep -v 'Lpubtypes' \ | grep -v 'Lpubnames' \ - | grep -v 'Linfo_' > $@ + | grep -v 'Linfo_' \ + | grep -v 'Lfunc_begin' \ + | grep -v 'Lfunc_end' \ + | grep -v 'Ldebug_frame_begin' \ + | grep -v 'Ldebug_frame_end' > $@ Output/%.t2a.bc: Output/%.linked.rbc Output/.dir $(LOPT) $(LOPT) -strip-nondebug $< -f -o $@ @@ -70,6 +75,7 @@ | grep -v '\.short' \ | grep -v '\.asci' \ | grep -v '\.quad' \ + | grep -v '\.align' \ | grep -v '## DW_AT' \ | grep -v '## Abbrev' \ | grep -v '## End Of Children' \ @@ -85,7 +91,11 @@ | grep -v 'debug_loc' \ | grep -v 'Lpubtypes' \ | grep -v 'Lpubnames' \ - | grep -v 'Linfo_' > $@ + | grep -v 'Linfo_' \ + | grep -v 'Lfunc_begin' \ + | grep -v 'Lfunc_end' \ + | grep -v 'Ldebug_frame_begin' \ + | grep -v 'Ldebug_frame_end' > $@ Output/%.diff: Output/%.first.s Output/%.second.s @-if diff $^ > $@; then \ From daniel at zuster.org Tue Jun 8 15:10:13 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Tue, 08 Jun 2010 20:10:13 -0000 Subject: [llvm-commits] [llvm] r105636 - /llvm/trunk/Makefile.rules Message-ID: <20100608201013.6B1682A6C12E@llvm.org> Author: ddunbar Date: Tue Jun 8 15:10:13 2010 New Revision: 105636 URL: http://llvm.org/viewvc/llvm-project?rev=105636&view=rev Log: Makefiles: Teach LLVM's recursive makefile descent to update objdir Makefiles if they are out of date, instead of only testing if they exist. Modified: llvm/trunk/Makefile.rules Modified: llvm/trunk/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=105636&r1=105635&r2=105636&view=diff ============================================================================== --- llvm/trunk/Makefile.rules (original) +++ llvm/trunk/Makefile.rules Tue Jun 8 15:10:13 2010 @@ -807,7 +807,8 @@ ifneq ($(PROJ_SRC_ROOT),$(PROJ_OBJ_ROOT)) $(RecursiveTargets):: $(Verb) for dir in $(DIRS); do \ - if [ ! -f $$dir/Makefile ]; then \ + if ([ ! -f $$dir/Makefile ] || \ + [ $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ]); then \ $(MKDIR) $$dir; \ $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \ fi; \ @@ -829,7 +830,8 @@ ifdef EXPERIMENTAL_DIRS $(RecursiveTargets):: $(Verb) for dir in $(EXPERIMENTAL_DIRS); do \ - if [ ! -f $$dir/Makefile ]; then \ + if ([ ! -f $$dir/Makefile ] || \ + [ $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ]); then \ $(MKDIR) $$dir; \ $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \ fi; \ @@ -863,7 +865,9 @@ ParallelTargets := $(foreach T,$(RecursiveTargets),%/.make$(T)) $(ParallelTargets) : - $(Verb) if [ ! -f $(@D)/Makefile ]; then \ + $(Verb) if ([ ! -f $(@D)/Makefile ] || \ + [ $(@D)/Makefile -ot \ + $(PROJ_SRC_DIR)/$(@D)/Makefile ]); then \ $(MKDIR) $(@D); \ $(CP) $(PROJ_SRC_DIR)/$(@D)/Makefile $(@D)/Makefile; \ fi; \ @@ -882,7 +886,8 @@ $(RecursiveTargets):: $(Verb) for dir in $(OPTIONAL_DIRS); do \ if [ -d $(PROJ_SRC_DIR)/$$dir ]; then\ - if [ ! -f $$dir/Makefile ]; then \ + if ([ ! -f $$dir/Makefile ] || \ + [ $$dir/Makefile -ot $(PROJ_SRC_DIR)/$$dir/Makefile ]); then \ $(MKDIR) $$dir; \ $(CP) $(PROJ_SRC_DIR)/$$dir/Makefile $$dir/Makefile; \ fi; \ From echristo at apple.com Tue Jun 8 17:04:26 2010 From: echristo at apple.com (Eric Christopher) Date: Tue, 08 Jun 2010 22:04:26 -0000 Subject: [llvm-commits] [llvm] r105645 - in /llvm/trunk/lib/Target/X86: X86ISelLowering.cpp X86Instr64bit.td X86InstrInfo.td Message-ID: <20100608220426.598272A6C12E@llvm.org> Author: echristo Date: Tue Jun 8 17:04:25 2010 New Revision: 105645 URL: http://llvm.org/viewvc/llvm-project?rev=105645&view=rev Log: Ensure that mov and not lea are used to stick the address into the register. While we're at it, make sure it's in the right one. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86Instr64bit.td llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=105645&r1=105644&r2=105645&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jun 8 17:04:25 2010 @@ -8527,18 +8527,29 @@ // our load from the relocation, sticking it in either RDI (x86-64) // or EAX and doing an indirect call. The return value will then // be in the normal return register. - const TargetInstrInfo *TII = getTargetMachine().getInstrInfo(); + const X86InstrInfo *TII + = static_cast(getTargetMachine().getInstrInfo()); DebugLoc DL = MI->getDebugLoc(); MachineFunction *F = BB->getParent(); + assert(MI->getOperand(3).isGlobal() && "This should be a global"); + if (Subtarget->is64Bit()) { - MachineInstrBuilder MIB = BuildMI(BB, DL, TII->get(X86::MOV64rr), X86::RDI) - .addReg(MI->getOperand(0).getReg()); + MachineInstrBuilder MIB = BuildMI(BB, DL, TII->get(X86::MOV64rm), X86::RDI) + .addReg(X86::RIP) + .addImm(0).addReg(0) + .addGlobalAddress(MI->getOperand(3).getGlobal(), 0, + MI->getOperand(3).getTargetFlags()) + .addReg(0); MIB = BuildMI(BB, DL, TII->get(X86::CALL64m)); addDirectMem(MIB, X86::RDI).addReg(0); } else { - MachineInstrBuilder MIB = BuildMI(BB, DL, TII->get(X86::MOV32rr), X86::EAX) - .addReg(MI->getOperand(0).getReg()); + MachineInstrBuilder MIB = BuildMI(BB, DL, TII->get(X86::MOV32rm), X86::EAX) + .addReg(TII->getGlobalBaseReg(F)) + .addImm(0).addReg(0) + .addGlobalAddress(MI->getOperand(3).getGlobal(), 0, + MI->getOperand(3).getTargetFlags()) + .addReg(0); MIB = BuildMI(BB, DL, TII->get(X86::CALL32m)); addDirectMem(MIB, X86::EAX).addReg(0); } Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=105645&r1=105644&r2=105645&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original) +++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Tue Jun 8 17:04:25 2010 @@ -66,7 +66,7 @@ def tls64addr : ComplexPattern; - + //===----------------------------------------------------------------------===// // Pattern fragments. // @@ -1717,9 +1717,9 @@ XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS], Uses = [RSP], usesCustomInserter = 1 in -def TLSCall_64 : I<0, Pseudo, (outs), (ins GR64:$sym), +def TLSCall_64 : I<0, Pseudo, (outs), (ins i64mem:$sym), "# Fixme into a call", - [(X86TLSCall GR64:$sym)]>, + [(X86TLSCall addr:$sym)]>, Requires<[In64BitMode]>; let AddedComplexity = 5, isCodeGenOnly = 1 in Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=105645&r1=105644&r2=105645&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Jun 8 17:04:25 2010 @@ -3837,9 +3837,9 @@ XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS], Uses = [ESP], usesCustomInserter = 1 in -def TLSCall_32 : I<0, Pseudo, (outs), (ins GR32:$sym), +def TLSCall_32 : I<0, Pseudo, (outs), (ins i32mem:$sym), "# Fixme into a call", - [(X86TLSCall GR32:$sym)]>, + [(X86TLSCall addr:$sym)]>, Requires<[In32BitMode]>; let AddedComplexity = 5, isCodeGenOnly = 1 in From bruno.cardoso at gmail.com Tue Jun 8 17:51:23 2010 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Tue, 08 Jun 2010 22:51:23 -0000 Subject: [llvm-commits] [llvm] r105652 - in /llvm/trunk: include/llvm/Target/ lib/Target/ARM/ lib/Target/ARM/Disassembler/ lib/Target/PowerPC/ lib/Target/X86/ test/MC/AsmParser/X86/ utils/TableGen/ Message-ID: <20100608225124.385022A6C12E@llvm.org> Author: bruno Date: Tue Jun 8 17:51:23 2010 New Revision: 105652 URL: http://llvm.org/viewvc/llvm-project?rev=105652&view=rev Log: Reapply r105521, this time appending "LLU" to 64 bit immediates to avoid breaking the build. Modified: llvm/trunk/include/llvm/Target/Target.td llvm/trunk/include/llvm/Target/TargetInstrDesc.h llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.h llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp llvm/trunk/lib/Target/X86/X86InstrFormats.td llvm/trunk/lib/Target/X86/X86InstrInfo.h llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s llvm/trunk/test/MC/AsmParser/X86/x86_64-encoding.s llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp llvm/trunk/utils/TableGen/X86RecognizableInstr.h Modified: llvm/trunk/include/llvm/Target/Target.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/Target.td?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/Target.td (original) +++ llvm/trunk/include/llvm/Target/Target.td Tue Jun 8 17:51:23 2010 @@ -244,7 +244,7 @@ string DisableEncoding = ""; /// Target-specific flags. This becomes the TSFlags field in TargetInstrDesc. - bits<32> TSFlags = 0; + bits<64> TSFlags = 0; } /// Predicates - These are extra conditionals which are turned into instruction Modified: llvm/trunk/include/llvm/Target/TargetInstrDesc.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrDesc.h?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrDesc.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrDesc.h Tue Jun 8 17:51:23 2010 @@ -15,6 +15,8 @@ #ifndef LLVM_TARGET_TARGETINSTRDESC_H #define LLVM_TARGET_TARGETINSTRDESC_H +#include "llvm/System/DataTypes.h" + namespace llvm { class TargetRegisterClass; @@ -131,7 +133,7 @@ unsigned short SchedClass; // enum identifying instr sched class const char * Name; // Name of the instruction record in td file unsigned Flags; // Flags identifying machine instr class - unsigned TSFlags; // Target Specific Flag values + uint64_t TSFlags; // Target Specific Flag values const unsigned *ImplicitUses; // Registers implicitly read by this instr const unsigned *ImplicitDefs; // Registers implicitly defined by this instr const TargetRegisterClass **RCBarriers; // Reg classes completely "clobbered" Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Tue Jun 8 17:51:23 2010 @@ -56,7 +56,7 @@ MachineInstr *MI = MBBI; MachineFunction &MF = *MI->getParent()->getParent(); - unsigned TSFlags = MI->getDesc().TSFlags; + uint64_t TSFlags = MI->getDesc().TSFlags; bool isPre = false; switch ((TSFlags & ARMII::IndexModeMask) >> ARMII::IndexModeShift) { default: return NULL; @@ -488,7 +488,7 @@ // Basic size info comes from the TSFlags field. const TargetInstrDesc &TID = MI->getDesc(); - unsigned TSFlags = TID.TSFlags; + uint64_t TSFlags = TID.TSFlags; unsigned Opc = MI->getOpcode(); switch ((TSFlags & ARMII::SizeMask) >> ARMII::SizeShift) { Modified: llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.h?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.h (original) +++ llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.h Tue Jun 8 17:51:23 2010 @@ -137,25 +137,25 @@ /// Various utilities for checking the target specific flags. /// A unary data processing instruction doesn't have an Rn operand. -static inline bool isUnaryDP(unsigned TSFlags) { +static inline bool isUnaryDP(uint64_t TSFlags) { return (TSFlags & ARMII::UnaryDP); } /// This four-bit field describes the addressing mode used. /// See also ARMBaseInstrInfo.h. -static inline unsigned getAddrMode(unsigned TSFlags) { +static inline unsigned getAddrMode(uint64_t TSFlags) { return (TSFlags & ARMII::AddrModeMask); } /// {IndexModePre, IndexModePost} /// Only valid for load and store ops. /// See also ARMBaseInstrInfo.h. -static inline unsigned getIndexMode(unsigned TSFlags) { +static inline unsigned getIndexMode(uint64_t TSFlags) { return (TSFlags & ARMII::IndexModeMask) >> ARMII::IndexModeShift; } /// Pre-/post-indexed operations define an extra $base_wb in the OutOperandList. -static inline bool isPrePostLdSt(unsigned TSFlags) { +static inline bool isPrePostLdSt(uint64_t TSFlags) { return (TSFlags & ARMII::IndexModeMask) != 0; } Modified: llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCHazardRecognizers.cpp Tue Jun 8 17:51:23 2010 @@ -78,7 +78,7 @@ isLoad = TID.mayLoad(); isStore = TID.mayStore(); - unsigned TSFlags = TID.TSFlags; + uint64_t TSFlags = TID.TSFlags; isFirst = TSFlags & PPCII::PPC970_First; isSingle = TSFlags & PPCII::PPC970_Single; Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Tue Jun 8 17:51:23 2010 @@ -232,7 +232,7 @@ for (MachineBasicBlock::iterator I = BB.begin(); I != BB.end(); ++I) { MachineInstr *MI = I; - unsigned Flags = MI->getDesc().TSFlags; + uint64_t Flags = MI->getDesc().TSFlags; unsigned FPInstClass = Flags & X86II::FPTypeMask; if (MI->isInlineAsm()) Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFormats.td?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFormats.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFormats.td Tue Jun 8 17:51:23 2010 @@ -83,6 +83,7 @@ class OpSize { bit hasOpSizePrefix = 1; } class AdSize { bit hasAdSizePrefix = 1; } class REX_W { bit hasREX_WPrefix = 1; } +class VEX_4V { bit hasVEX_4VPrefix = 1; } class LOCK { bit hasLockPrefix = 1; } class SegFS { bits<2> SegOvrBits = 1; } class SegGS { bits<2> SegOvrBits = 2; } @@ -124,6 +125,7 @@ bits<4> Prefix = 0; // Which prefix byte does this inst have? bit hasREX_WPrefix = 0; // Does this inst requires the REX.W prefix? + bit hasVEX_4VPrefix = 0; // Does this inst requires the VEX.VVVV prefix? FPFormat FPForm = NotFP; // What flavor of FP instruction is this? bit hasLockPrefix = 0; // Does this inst have a 0xF0 prefix? bits<2> SegOvrBits = 0; // Segment override prefix. @@ -141,6 +143,7 @@ let TSFlags{21-20} = SegOvrBits; let TSFlags{23-22} = ExeDomain.Value; let TSFlags{31-24} = Opcode; + let TSFlags{32} = hasVEX_4VPrefix; } class I o, Format f, dag outs, dag ins, string asm, @@ -216,6 +219,7 @@ // SSI - SSE1 instructions with XS prefix. // PSI - SSE1 instructions with TB prefix. // PSIi8 - SSE1 instructions with ImmT == Imm8 and TB prefix. +// VSSI - SSE1 instructions with XS prefix in AVX form. class SSI o, Format F, dag outs, dag ins, string asm, list pattern> : I, XS, Requires<[HasSSE1]>; @@ -229,6 +233,10 @@ list pattern> : Ii8, TB, Requires<[HasSSE1]>; +class VSSI o, Format F, dag outs, dag ins, string asm, + list pattern> + : I, XS, VEX_4V, + Requires<[HasAVX, HasSSE1]>; // SSE2 Instruction Templates: // @@ -237,6 +245,7 @@ // SSDIi8 - SSE2 instructions with ImmT == Imm8 and XS prefix. // PDI - SSE2 instructions with TB and OpSize prefixes. // PDIi8 - SSE2 instructions with ImmT == Imm8 and TB and OpSize prefixes. +// VSDI - SSE2 instructions with XD prefix in AVX form. class SDI o, Format F, dag outs, dag ins, string asm, list pattern> : I, XD, Requires<[HasSSE2]>; @@ -253,6 +262,10 @@ list pattern> : Ii8, TB, OpSize, Requires<[HasSSE2]>; +class VSDI o, Format F, dag outs, dag ins, string asm, + list pattern> + : I, XD, VEX_4V, + Requires<[HasAVX, HasSSE2]>; // SSE3 Instruction Templates: // Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Tue Jun 8 17:51:23 2010 @@ -417,22 +417,36 @@ OpcodeShift = 24, OpcodeMask = 0xFF << OpcodeShift + }; + // FIXME: The enum opcode space is over and more bits are needed. Anywhere + // those enums below are used, TSFlags must be shifted right by 32 first. + enum { + //===------------------------------------------------------------------===// + // VEX_4V - VEX prefixes are instruction prefixes used in AVX. + // VEX_4V is used to specify an additional AVX/SSE register. Several 2 + // address instructions in SSE are represented as 3 address ones in AVX + // and the additional register is encoded in VEX_VVVV prefix. + // + VEXShift = 0, + VEX_4V = 1 << VEXShift + }; + // getBaseOpcodeFor - This function returns the "base" X86 opcode for the // specified machine instruction. // - static inline unsigned char getBaseOpcodeFor(unsigned TSFlags) { + static inline unsigned char getBaseOpcodeFor(uint64_t TSFlags) { return TSFlags >> X86II::OpcodeShift; } - static inline bool hasImm(unsigned TSFlags) { + static inline bool hasImm(uint64_t TSFlags) { return (TSFlags & X86II::ImmMask) != 0; } /// getSizeOfImm - Decode the "size of immediate" field from the TSFlags field /// of the specified instruction. - static inline unsigned getSizeOfImm(unsigned TSFlags) { + static inline unsigned getSizeOfImm(uint64_t TSFlags) { switch (TSFlags & X86II::ImmMask) { default: assert(0 && "Unknown immediate size"); case X86II::Imm8: @@ -446,7 +460,7 @@ /// isImmPCRel - Return true if the immediate of the specified instruction's /// TSFlags indicates that it is pc relative. - static inline unsigned isImmPCRel(unsigned TSFlags) { + static inline unsigned isImmPCRel(uint64_t TSFlags) { switch (TSFlags & X86II::ImmMask) { default: assert(0 && "Unknown immediate size"); case X86II::Imm8PCRel: Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue Jun 8 17:51:23 2010 @@ -673,6 +673,26 @@ let isCommutable = Commutable; } + def V#NAME#SSrr : VSSI { + let isCommutable = Commutable; + let Constraints = ""; + let isAsmParserOnly = 1; + } + + def V#NAME#SDrr : VSDI { + let isCommutable = Commutable; + let Constraints = ""; + let isAsmParserOnly = 1; + } + // Scalar operation, reg+mem. def SSrm : SSI &Fixups) const; void EncodeInstruction(const MCInst &MI, raw_ostream &OS, SmallVectorImpl &Fixups) const; + void EmitVEXOpcodePrefix(uint64_t TSFlags, unsigned &CurByte, + const MCInst &MI, const TargetInstrDesc &Desc, + raw_ostream &OS) const; + + void EmitOpcodePrefix(uint64_t TSFlags, unsigned &CurByte, + const MCInst &MI, const TargetInstrDesc &Desc, + raw_ostream &OS) const; }; } // end anonymous namespace @@ -133,7 +140,7 @@ /// getImmFixupKind - Return the appropriate fixup kind to use for an immediate /// in an instruction with the specified TSFlags. -static MCFixupKind getImmFixupKind(unsigned TSFlags) { +static MCFixupKind getImmFixupKind(uint64_t TSFlags) { unsigned Size = X86II::getSizeOfImm(TSFlags); bool isPCRel = X86II::isImmPCRel(TSFlags); @@ -184,7 +191,7 @@ void X86MCCodeEmitter::EmitMemModRMByte(const MCInst &MI, unsigned Op, unsigned RegOpcodeField, - unsigned TSFlags, unsigned &CurByte, + uint64_t TSFlags, unsigned &CurByte, raw_ostream &OS, SmallVectorImpl &Fixups) const{ const MCOperand &Disp = MI.getOperand(Op+3); @@ -324,10 +331,159 @@ EmitImmediate(Disp, 4, FK_Data_4, CurByte, OS, Fixups); } +/// EmitVEXOpcodePrefix - AVX instructions are encoded using a opcode prefix +/// called VEX. +void X86MCCodeEmitter::EmitVEXOpcodePrefix(uint64_t TSFlags, unsigned &CurByte, + const MCInst &MI, const TargetInstrDesc &Desc, + raw_ostream &OS) const { + + // Pseudo instructions never have a VEX prefix. + if ((TSFlags & X86II::FormMask) == X86II::Pseudo) + return; + + // VEX_R: opcode externsion equivalent to REX.R in + // 1's complement (inverted) form + // + // 1: Same as REX_R=0 (must be 1 in 32-bit mode) + // 0: Same as REX_R=1 (64 bit mode only) + // + unsigned char VEX_R = 0x1; + + // VEX_B: + // + // 1: Same as REX_B=0 (ignored in 32-bit mode) + // 0: Same as REX_B=1 (64 bit mode only) + // + unsigned char VEX_B = 0x1; + + // VEX_W: opcode specific (use like REX.W, or used for + // opcode extension, or ignored, depending on the opcode byte) + unsigned char VEX_W = 0; + + // VEX_5M (VEX m-mmmmm field): + // + // 0b00000: Reserved for future use + // 0b00001: implied 0F leading opcode + // 0b00010: implied 0F 38 leading opcode bytes + // 0b00011: implied 0F 3A leading opcode bytes + // 0b00100-0b11111: Reserved for future use + // + unsigned char VEX_5M = 0x1; + + // VEX_4V (VEX vvvv field): a register specifier + // (in 1's complement form) or 1111 if unused. + unsigned char VEX_4V = 0xf; + + // VEX_L (Vector Length): + // + // 0: scalar or 128-bit vector + // 1: 256-bit vector + // + unsigned char VEX_L = 0; + + // VEX_PP: opcode extension providing equivalent + // functionality of a SIMD prefix + // + // 0b00: None + // 0b01: 66 (not handled yet) + // 0b10: F3 + // 0b11: F2 + // + unsigned char VEX_PP = 0; + + switch (TSFlags & X86II::Op0Mask) { + default: assert(0 && "Invalid prefix!"); + case 0: break; // No prefix! + case X86II::T8: // 0F 38 + VEX_5M = 0x2; + break; + case X86II::TA: // 0F 3A + VEX_5M = 0x3; + break; + case X86II::TF: // F2 0F 38 + VEX_PP = 0x3; + VEX_5M = 0x2; + break; + case X86II::XS: // F3 0F + VEX_PP = 0x2; + break; + case X86II::XD: // F2 0F + VEX_PP = 0x3; + break; + } + + unsigned NumOps = MI.getNumOperands(); + unsigned i = 0; + unsigned SrcReg = 0, SrcRegNum = 0; + + switch (TSFlags & X86II::FormMask) { + case X86II::MRMInitReg: assert(0 && "FIXME: Remove this!"); + case X86II::MRMSrcReg: + if (MI.getOperand(0).isReg() && + X86InstrInfo::isX86_64ExtendedReg(MI.getOperand(0).getReg())) + VEX_R = 0x0; + + // On regular x86, both XMM0-XMM7 and XMM8-XMM15 are encoded in the + // range 0-7 and the difference between the 2 groups is given by the + // REX prefix. In the VEX prefix, registers are seen sequencially + // from 0-15 and encoded in 1's complement form, example: + // + // ModRM field => XMM9 => 1 + // VEX.VVVV => XMM9 => ~9 + // + // See table 4-35 of Intel AVX Programming Reference for details. + SrcReg = MI.getOperand(1).getReg(); + SrcRegNum = GetX86RegNum(MI.getOperand(1)); + if (SrcReg >= X86::XMM8 && SrcReg <= X86::XMM15) + SrcRegNum += 8; + + // The registers represented through VEX_VVVV should + // be encoded in 1's complement form. + if ((TSFlags >> 32) & X86II::VEX_4V) + VEX_4V = (~SrcRegNum) & 0xf; + + i = 2; // Skip the VEX.VVVV operand. + for (; i != NumOps; ++i) { + const MCOperand &MO = MI.getOperand(i); + if (MO.isReg() && X86InstrInfo::isX86_64ExtendedReg(MO.getReg())) + VEX_B = 0x0; + } + break; + default: + assert(0 && "Not implemented!"); + } + + // VEX opcode prefix can have 2 or 3 bytes + // + // 3 bytes: + // +-----+ +--------------+ +-------------------+ + // | C4h | | RXB | m-mmmm | | W | vvvv | L | pp | + // +-----+ +--------------+ +-------------------+ + // 2 bytes: + // +-----+ +-------------------+ + // | C5h | | R | vvvv | L | pp | + // +-----+ +-------------------+ + // + // Note: VEX.X isn't used so far + // + unsigned char LastByte = VEX_PP | (VEX_L << 2) | (VEX_4V << 3); + + if (VEX_B /* & VEX_X */) { // 2 byte VEX prefix + EmitByte(0xC5, CurByte, OS); + EmitByte(LastByte | (VEX_R << 7), CurByte, OS); + return; + } + + // 3 byte VEX prefix + EmitByte(0xC4, CurByte, OS); + EmitByte(VEX_R << 7 | 1 << 6 /* VEX_X = 1 */ | VEX_5M, CurByte, OS); + EmitByte(LastByte | (VEX_W << 7), CurByte, OS); +} + /// DetermineREXPrefix - Determine if the MCInst has to be encoded with a X86-64 /// REX prefix which specifies 1) 64-bit instructions, 2) non-default operand /// size, and 3) use of X86-64 extended registers. -static unsigned DetermineREXPrefix(const MCInst &MI, unsigned TSFlags, +static unsigned DetermineREXPrefix(const MCInst &MI, uint64_t TSFlags, const TargetInstrDesc &Desc) { // Pseudo instructions never have a rex byte. if ((TSFlags & X86II::FormMask) == X86II::Pseudo) @@ -422,18 +578,10 @@ return REX; } -void X86MCCodeEmitter:: -EncodeInstruction(const MCInst &MI, raw_ostream &OS, - SmallVectorImpl &Fixups) const { - unsigned Opcode = MI.getOpcode(); - const TargetInstrDesc &Desc = TII.get(Opcode); - unsigned TSFlags = Desc.TSFlags; - - // Keep track of the current byte being emitted. - unsigned CurByte = 0; - - // FIXME: We should emit the prefixes in exactly the same order as GAS does, - // in order to provide diffability. +/// EmitOpcodePrefix - Emit all instruction prefixes prior to the opcode. +void X86MCCodeEmitter::EmitOpcodePrefix(uint64_t TSFlags, unsigned &CurByte, + const MCInst &MI, const TargetInstrDesc &Desc, + raw_ostream &OS) const { // Emit the lock opcode prefix as needed. if (TSFlags & X86II::LOCK) @@ -516,6 +664,30 @@ EmitByte(0x3A, CurByte, OS); break; } +} + +void X86MCCodeEmitter:: +EncodeInstruction(const MCInst &MI, raw_ostream &OS, + SmallVectorImpl &Fixups) const { + unsigned Opcode = MI.getOpcode(); + const TargetInstrDesc &Desc = TII.get(Opcode); + uint64_t TSFlags = Desc.TSFlags; + + // Keep track of the current byte being emitted. + unsigned CurByte = 0; + + // Is this instruction encoded in AVX form? + bool IsAVXForm = false; + if ((TSFlags >> 32) & X86II::VEX_4V) + IsAVXForm = true; + + // FIXME: We should emit the prefixes in exactly the same order as GAS does, + // in order to provide diffability. + + if (!IsAVXForm) + EmitOpcodePrefix(TSFlags, CurByte, MI, Desc, OS); + else + EmitVEXOpcodePrefix(TSFlags, CurByte, MI, Desc, OS); // If this is a two-address instruction, skip one of the register operands. unsigned NumOps = Desc.getNumOperands(); @@ -527,6 +699,7 @@ --NumOps; unsigned char BaseOpcode = X86II::getBaseOpcodeFor(TSFlags); + unsigned SrcRegNum = 0; switch (TSFlags & X86II::FormMask) { case X86II::MRMInitReg: assert(0 && "FIXME: Remove this form when the JIT moves to MCCodeEmitter!"); @@ -558,9 +731,14 @@ case X86II::MRMSrcReg: EmitByte(BaseOpcode, CurByte, OS); - EmitRegModRMByte(MI.getOperand(CurOp+1), GetX86RegNum(MI.getOperand(CurOp)), - CurByte, OS); - CurOp += 2; + SrcRegNum = CurOp + 1; + + if (IsAVXForm) // Skip 1st src (which is encoded in VEX_VVVV) + SrcRegNum++; + + EmitRegModRMByte(MI.getOperand(SrcRegNum), + GetX86RegNum(MI.getOperand(CurOp)), CurByte, OS); + CurOp = SrcRegNum + 1; break; case X86II::MRMSrcMem: { Modified: llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s Tue Jun 8 17:51:23 2010 @@ -10052,3 +10052,35 @@ // CHECK: ficomps 32493 // CHECK: encoding: [0xde,0x1d,0xed,0x7e,0x00,0x00] ficomps 32493 + +// CHECK: vaddss %xmm4, %xmm6, %xmm2 +// CHECK: encoding: [0xc5,0xca,0x58,0xd4] + vaddss %xmm4, %xmm6, %xmm2 + +// CHECK: vmulss %xmm4, %xmm6, %xmm2 +// CHECK: encoding: [0xc5,0xca,0x59,0xd4] + vmulss %xmm4, %xmm6, %xmm2 + +// CHECK: vsubss %xmm4, %xmm6, %xmm2 +// CHECK: encoding: [0xc5,0xca,0x5c,0xd4] + vsubss %xmm4, %xmm6, %xmm2 + +// CHECK: vdivss %xmm4, %xmm6, %xmm2 +// CHECK: encoding: [0xc5,0xca,0x5e,0xd4] + vdivss %xmm4, %xmm6, %xmm2 + +// CHECK: vaddsd %xmm4, %xmm6, %xmm2 +// CHECK: encoding: [0xc5,0xcb,0x58,0xd4] + vaddsd %xmm4, %xmm6, %xmm2 + +// CHECK: vmulsd %xmm4, %xmm6, %xmm2 +// CHECK: encoding: [0xc5,0xcb,0x59,0xd4] + vmulsd %xmm4, %xmm6, %xmm2 + +// CHECK: vsubsd %xmm4, %xmm6, %xmm2 +// CHECK: encoding: [0xc5,0xcb,0x5c,0xd4] + vsubsd %xmm4, %xmm6, %xmm2 + +// CHECK: vdivsd %xmm4, %xmm6, %xmm2 +// CHECK: encoding: [0xc5,0xcb,0x5e,0xd4] + vdivsd %xmm4, %xmm6, %xmm2 Modified: llvm/trunk/test/MC/AsmParser/X86/x86_64-encoding.s URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/X86/x86_64-encoding.s?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/test/MC/AsmParser/X86/x86_64-encoding.s (original) +++ llvm/trunk/test/MC/AsmParser/X86/x86_64-encoding.s Tue Jun 8 17:51:23 2010 @@ -103,3 +103,35 @@ // CHECK: movd %mm1, %edx // CHECK: encoding: [0x0f,0x7e,0xca] movd %mm1, %edx + +// CHECK: vaddss %xmm8, %xmm9, %xmm10 +// CHECK: encoding: [0xc4,0x41,0x32,0x58,0xd0] +vaddss %xmm8, %xmm9, %xmm10 + +// CHECK: vmulss %xmm8, %xmm9, %xmm10 +// CHECK: encoding: [0xc4,0x41,0x32,0x59,0xd0] +vmulss %xmm8, %xmm9, %xmm10 + +// CHECK: vsubss %xmm8, %xmm9, %xmm10 +// CHECK: encoding: [0xc4,0x41,0x32,0x5c,0xd0] +vsubss %xmm8, %xmm9, %xmm10 + +// CHECK: vdivss %xmm8, %xmm9, %xmm10 +// CHECK: encoding: [0xc4,0x41,0x32,0x5e,0xd0] +vdivss %xmm8, %xmm9, %xmm10 + +// CHECK: vaddsd %xmm8, %xmm9, %xmm10 +// CHECK: encoding: [0xc4,0x41,0x33,0x58,0xd0] +vaddsd %xmm8, %xmm9, %xmm10 + +// CHECK: vmulsd %xmm8, %xmm9, %xmm10 +// CHECK: encoding: [0xc4,0x41,0x33,0x59,0xd0] +vmulsd %xmm8, %xmm9, %xmm10 + +// CHECK: vsubsd %xmm8, %xmm9, %xmm10 +// CHECK: encoding: [0xc4,0x41,0x33,0x5c,0xd0] +vsubsd %xmm8, %xmm9, %xmm10 + +// CHECK: vdivsd %xmm8, %xmm9, %xmm10 +// CHECK: encoding: [0xc4,0x41,0x33,0x5e,0xd0] +vdivsd %xmm8, %xmm9, %xmm10 Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Tue Jun 8 17:51:23 2010 @@ -301,7 +301,7 @@ } OS << ", 0x"; OS.write_hex(Value); - OS << ", "; + OS << "LLU, "; // Emit the implicit uses and defs lists... std::vector UseList = Inst.TheDef->getValueAsListOfDefs("Uses"); Modified: llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp (original) +++ llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp Tue Jun 8 17:51:23 2010 @@ -212,6 +212,7 @@ HasOpSizePrefix = Rec->getValueAsBit("hasOpSizePrefix"); HasREX_WPrefix = Rec->getValueAsBit("hasREX_WPrefix"); + HasVEX_4VPrefix = Rec->getValueAsBit("hasVEX_4VPrefix"); HasLockPrefix = Rec->getValueAsBit("hasLockPrefix"); IsCodeGenOnly = Rec->getValueAsBit("isCodeGenOnly"); @@ -532,7 +533,12 @@ "Unexpected number of operands for MRMSrcRegFrm"); HANDLE_OPERAND(roRegister) HANDLE_OPERAND(rmRegister) - HANDLE_OPTIONAL(immediate) + + if (HasVEX_4VPrefix) + // FIXME: encoding of registers in AVX is in 1's complement form. + HANDLE_OPTIONAL(rmRegister) + else + HANDLE_OPTIONAL(immediate) break; case X86Local::MRMSrcMem: // Operand 1 is a register operand in the Reg/Opcode field. Modified: llvm/trunk/utils/TableGen/X86RecognizableInstr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/X86RecognizableInstr.h?rev=105652&r1=105651&r2=105652&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/X86RecognizableInstr.h (original) +++ llvm/trunk/utils/TableGen/X86RecognizableInstr.h Tue Jun 8 17:51:23 2010 @@ -52,6 +52,8 @@ bool HasOpSizePrefix; /// The hasREX_WPrefix field from the record bool HasREX_WPrefix; + /// The hasVEX_4VPrefix field from the record + bool HasVEX_4VPrefix; /// The hasLockPrefix field from the record bool HasLockPrefix; /// The isCodeGenOnly filed from the record From grosbach at apple.com Tue Jun 8 17:53:32 2010 From: grosbach at apple.com (Jim Grosbach) Date: Tue, 08 Jun 2010 22:53:32 -0000 Subject: [llvm-commits] [llvm] r105653 - /llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Message-ID: <20100608225333.0639D2A6C12E@llvm.org> Author: grosbach Date: Tue Jun 8 17:53:32 2010 New Revision: 105653 URL: http://llvm.org/viewvc/llvm-project?rev=105653&view=rev Log: fix copy/paste/modify think-o Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=105653&r1=105652&r2=105653&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Tue Jun 8 17:53:32 2010 @@ -694,7 +694,7 @@ } // Try merging with the next instruction. - MachineBasicBlock::iterator EndMBBI = MBB.begin(); + MachineBasicBlock::iterator EndMBBI = MBB.end(); if (!DoMerge && MBBI != EndMBBI) { MachineBasicBlock::iterator NextMBBI = llvm::next(MBBI); while (NextMBBI != EndMBBI && NextMBBI->isDebugValue()) From echristo at apple.com Tue Jun 8 17:57:33 2010 From: echristo at apple.com (Eric Christopher) Date: Tue, 08 Jun 2010 22:57:33 -0000 Subject: [llvm-commits] [llvm] r105656 - /llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Message-ID: <20100608225733.CC2852A6C12E@llvm.org> Author: echristo Date: Tue Jun 8 17:57:33 2010 New Revision: 105656 URL: http://llvm.org/viewvc/llvm-project?rev=105656&view=rev Log: Split out these asserts so it's more apparent why we're not assembling that rip-relative address when executing in 32-bit mode. Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=105656&r1=105655&r2=105656&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Tue Jun 8 17:57:33 2010 @@ -202,8 +202,8 @@ // Handle %rip relative addressing. if (BaseReg == X86::RIP) { // [disp32+RIP] in X86-64 mode - assert(IndexReg.getReg() == 0 && Is64BitMode && - "Invalid rip-relative address"); + assert(Is64BitMode && "Rip-relative addressing requires 64-bit mode"); + assert(IndexReg.getReg() == 0 && "Invalid rip-relative address"); EmitByte(ModRMByte(0, RegOpcodeField, 5), CurByte, OS); unsigned FixupKind = X86::reloc_riprel_4byte; From enderby at apple.com Tue Jun 8 18:48:45 2010 From: enderby at apple.com (Kevin Enderby) Date: Tue, 08 Jun 2010 23:48:45 -0000 Subject: [llvm-commits] [llvm] r105661 - /llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Message-ID: <20100608234845.20E4D2A6C12E@llvm.org> Author: enderby Date: Tue Jun 8 18:48:44 2010 New Revision: 105661 URL: http://llvm.org/viewvc/llvm-project?rev=105661&view=rev Log: Incremental improvement to the handling of the x86 "Jump if rCX Zero" instruction. Added the 64-bit version "jrcxz" so it is recognized and also added the checks for incorrect uses of "jcxz" in 64-bit mode and "jrcxz" in 32-bit mode. Still to do is to correctly handle the encoding of the instruction adding the Address-size override prefix byte, 0x67, when the width of the count register is not the same as the mode the machine is running in. Which for example means the encoding of "jecxz" depends if you are assembling as a 32-bit target or a 64-bit target. Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=105661&r1=105660&r2=105661&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original) +++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Jun 8 18:48:44 2010 @@ -597,6 +597,16 @@ return Error(NameLoc, "pushfq cannot be encoded in 32-bit mode"); } + // The "Jump if rCX Zero" form jcxz is not allowed in 64-bit mode and + // the form jrcxz is not allowed in 32-bit mode. + if (Is64Bit) { + if (Name == "jcxz") + return Error(NameLoc, "jcxz cannot be encoded in 64-bit mode"); + } else { + if (Name == "jrcxz") + return Error(NameLoc, "jrcxz cannot be encoded in 32-bit mode"); + } + // FIXME: Hack to recognize "sal..." and "rep..." for now. We need a way to // represent alternative syntaxes in the .td file, without requiring // instruction duplication. @@ -618,7 +628,11 @@ .Case("jz", "je") .Case("jnz", "jne") .Case("jc", "jb") + // FIXME: in 32-bit mode jcxz requires an AdSize prefix. In 64-bit mode + // jecxz requires an AdSize prefix but jecxz does not have a prefix in + // 32-bit mode. .Case("jecxz", "jcxz") + .Case("jrcxz", "jcxz") .Case("jna", "jbe") .Case("jnae", "jb") .Case("jnb", "jae") From gkistanova at gmail.com Tue Jun 8 18:55:21 2010 From: gkistanova at gmail.com (Galina Kistanova) Date: Tue, 08 Jun 2010 23:55:21 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r105662 - in /llvm-gcc-4.2/trunk/extras: build-4-mingw32 build-x-4-mingw32 buildbot-launcher Message-ID: <20100608235521.C1D072A6C12E@llvm.org> Author: gkistanova Date: Tue Jun 8 18:55:21 2010 New Revision: 105662 URL: http://llvm.org/viewvc/llvm-project?rev=105662&view=rev Log: Cosmetic changes Modified: llvm-gcc-4.2/trunk/extras/build-4-mingw32 llvm-gcc-4.2/trunk/extras/build-x-4-mingw32 llvm-gcc-4.2/trunk/extras/buildbot-launcher Modified: llvm-gcc-4.2/trunk/extras/build-4-mingw32 URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/extras/build-4-mingw32?rev=105662&r1=105661&r2=105662&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/extras/build-4-mingw32 (original) +++ llvm-gcc-4.2/trunk/extras/build-4-mingw32 Tue Jun 8 18:55:21 2010 @@ -106,7 +106,7 @@ #------------------------------------------------------------------------------ if [ "$do_configure_llvm" == "yes" ] ; then - # Remove previous build files if any. + # Remove previously build files if any. rm -rf ${BUILD_ROOT}/${LLVM_obj} mkdir -p ${BUILD_ROOT}/${LLVM_obj} chmod a+rx ${BUILD_ROOT}/${LLVM_obj} @@ -147,7 +147,7 @@ #------------------------------------------------------------------------------ if [ "$do_configure_llvmgcc" == "yes" ] ; then - # Remove previous build files if any. + # Remove previously build files if any. rm -rf ${BUILD_ROOT}/${LLVM_GCC_obj} mkdir -p ${BUILD_ROOT}/${LLVM_GCC_obj} chmod a+rx ${BUILD_ROOT}/${LLVM_GCC_obj} Modified: llvm-gcc-4.2/trunk/extras/build-x-4-mingw32 URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/extras/build-x-4-mingw32?rev=105662&r1=105661&r2=105662&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/extras/build-x-4-mingw32 (original) +++ llvm-gcc-4.2/trunk/extras/build-x-4-mingw32 Tue Jun 8 18:55:21 2010 @@ -44,10 +44,11 @@ # This script supports the following steps: do_clean=no # Clean up the build directory. +do_copy_cross_tools=no # Copy cross-tools. do_configure_llvm=no # Configure LLVM. do_make_llvm=no # Make LLVM. do_test_llvm=no # Test LLVM. -do_cross_tools=no # Copy cross-tools. +do_cross_tools=no # Copy cross-tools. Deprecated. Use copy_cross_tools instead. do_configure_llvmgcc=no # Configure LLVM-GCC. do_make_llvmgcc=no # Make LLVM-GCC. do_install_llvmgcc=no # Install LLVM-GCC. @@ -62,6 +63,7 @@ # First check that the parameter actually defines a step. case $1 in clean | \ + copy_cross_tools | \ configure_llvm | \ make_llvm | \ test_llvm | \ @@ -83,15 +85,20 @@ if [ "$do_all" == "yes" ] ; then # Set all steps to yes do_clean=yes + do_copy_cross_tools=yes do_configure_llvm=yes do_make_llvm=yes do_test_llvm=yes - do_cross_tools=yes do_configure_llvmgcc=yes do_make_llvmgcc=yes do_install_llvmgcc=yes fi +# Handle deprecated steps. +if [ "$do_cross_tools" == "yes" ] ; then + do_copy_cross_tools=yes +fi + #------------------------------------------------------------------------------ # Step: Clean up. #------------------------------------------------------------------------------ @@ -105,11 +112,22 @@ fi #------------------------------------------------------------------------------ +# Step: Copy cross-tools. +#------------------------------------------------------------------------------ +if [ "$do_copy_cross_tools" == "yes" ] ; then + + # We need a local copy of binutils, system libraries and headers, + # since we will be installing there. + cp -RL /cross-tools/ ${PRIVATE_INSTALL} + +fi + +#------------------------------------------------------------------------------ # Step: Configure LLVM. #------------------------------------------------------------------------------ if [ "$do_configure_llvm" == "yes" ] ; then - # Remove previous build files if any. + # Remove previously build files if any. rm -rf ${BUILD_ROOT}/${LLVM_obj} mkdir -p ${BUILD_ROOT}/${LLVM_obj} chmod a+rx ${BUILD_ROOT}/${LLVM_obj} @@ -119,7 +137,7 @@ --build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10 \ --target=i686-pc-mingw32 \ --enable-optimize \ - --without-llvmgcc --without-llvmgxx \ + --without-llvmgcc --without-llvmgxx \ $@ # Extra args if any fi @@ -148,22 +166,11 @@ fi #------------------------------------------------------------------------------ -# Step: Copy cross-tools. -#------------------------------------------------------------------------------ -if [ "$do_cross_tools" == "yes" ] ; then - - # We need a local copy of binutils, system libraries and headers, - # since we will be installing there. - cp -RL /cross-tools/ ${PRIVATE_INSTALL} - -fi - -#------------------------------------------------------------------------------ # Step: Configure LLVM-GCC. #------------------------------------------------------------------------------ if [ "$do_configure_llvmgcc" == "yes" ] ; then - # Remove previous build files if any. + # Remove previously build files if any. rm -rf ${BUILD_ROOT}/${LLVM_GCC_obj} mkdir -p ${BUILD_ROOT}/${LLVM_GCC_obj} chmod a+rx ${BUILD_ROOT}/${LLVM_GCC_obj} @@ -171,7 +178,7 @@ ../${LLVM_GCC_src}/configure --prefix=${PRIVATE_INSTALL} \ --build=x86_64-apple-darwin10 --host=x86_64-apple-darwin10 \ - --with-local-prefix=/tools \ + --with-local-prefix=/tools \ --target=i686-pc-mingw32 \ --program-prefix=i686-pc-mingw32- \ --enable-llvm=${BUILD_ROOT}/${LLVM_obj} \ Modified: llvm-gcc-4.2/trunk/extras/buildbot-launcher URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/extras/buildbot-launcher?rev=105662&r1=105661&r2=105662&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/extras/buildbot-launcher (original) +++ llvm-gcc-4.2/trunk/extras/buildbot-launcher Tue Jun 8 18:55:21 2010 @@ -19,13 +19,12 @@ cd $BUILD_DIR # The build script expects source code directories in certain place with -# certain names. -# TODO: Handle relative paths here -if [ "$LLVM_SOURCE" != "llvm.src" ] ; then - ln -sf $BUILD_DIR/$LLVM_SOURCE $BUILD_DIR/llvm.src +# certain names. Create link only if target directory or link does not exist. +if [ ! -d $BUILD_DIR/llvm.src ] ; then + ln -sf $LLVM_SOURCE $BUILD_DIR/llvm.src fi -if [ "$LLVM_GCC_SOURCE" != "llvm-gcc.src" ] ; then - ln -sf $BUILD_DIR/$LLVM_GCC_SOURCE $BUILD_DIR/llvm-gcc.src +if [ ! -d $BUILD_DIR/llvm-gcc.src ] ; then + ln -sf $LLVM_GCC_SOURCE $BUILD_DIR/llvm-gcc.src fi # Launch the build script with all the remaining parameters From gkistanova at gmail.com Tue Jun 8 18:55:48 2010 From: gkistanova at gmail.com (Galina Kistanova) Date: Tue, 08 Jun 2010 23:55:48 -0000 Subject: [llvm-commits] [zorg] r105663 - /zorg/trunk/buildbot/osuosl/master/config/builders.py Message-ID: <20100608235548.14A4D2A6C12E@llvm.org> Author: gkistanova Date: Tue Jun 8 18:55:47 2010 New Revision: 105663 URL: http://llvm.org/viewvc/llvm-project?rev=105663&view=rev Log: Cosmetic changes Modified: zorg/trunk/buildbot/osuosl/master/config/builders.py Modified: zorg/trunk/buildbot/osuosl/master/config/builders.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/osuosl/master/config/builders.py?rev=105663&r1=105662&r2=105663&view=diff ============================================================================== --- zorg/trunk/buildbot/osuosl/master/config/builders.py (original) +++ zorg/trunk/buildbot/osuosl/master/config/builders.py Tue Jun 8 18:55:47 2010 @@ -284,21 +284,24 @@ launcher = 'llvm-gcc.src/extras/buildbot-launcher', build_script = 'llvm-gcc.src/extras/build-4-mingw32', extra_args = [], - build_steps = [{'name' : 'configure_llvm', - 'description' : 'Configure LLVM', + build_steps = [{'name' : 'clean', + 'description' : 'clean', + 'haltOnFailure' : True }, + {'name' : 'configure_llvm', + 'description' : 'configure llvm', 'haltOnFailure' : True }, {'name' : 'make_llvm', - 'description' : 'Make LLVM', + 'description' : 'make llvm', 'extra_args' : ['-j8'], # Extra step-specific properties 'haltOnFailure' : True }, {'name' : 'configure_llvmgcc', - 'description' : 'Configure LLVM-GCC', + 'description' : 'configure llvm-gcc', 'haltOnFailure' : True }, {'name' : 'make_llvmgcc', - 'description' : 'Make LLVM-GCC', + 'description' : 'make llvm-gcc', 'haltOnFailure' : True }, {'name' : 'install_llvmgcc', - 'description' : 'Install LLVM-GCC', + 'description' : 'install llvm-gcc', 'haltOnFailure' : True },]), 'category' : 'llvm-gcc' }, @@ -317,28 +320,31 @@ launcher = 'llvm-gcc.src/extras/buildbot-launcher', build_script = 'llvm-gcc.src/extras/build-x-4-mingw32', extra_args = [], - build_steps = [{'name' : 'configure_llvm', - 'description' : 'Configure LLVM', + build_steps = [{'name' : 'clean', + 'description' : 'clean', + 'haltOnFailure' : True }, + {'name' : 'copy_cross_tools', + 'description' : 'copy cross-tools', + 'haltOnFailure' : True }, + {'name' : 'configure_llvm', + 'description' : 'configure llvm', 'haltOnFailure' : True }, {'name' : 'make_llvm', - 'description' : 'Make LLVM', + 'description' : 'make llvm', 'extra_args' : ['-j8'], # Extra step-specific properties 'haltOnFailure' : True }, {'name' : 'test_llvm', 'type' : ClangTestCommand, - 'description' : 'Test LLVM', + 'description' : 'test llvm', 'haltOnFailure' : False }, - {'name' : 'cross_tools', - 'description' : 'Copy cross-tools', - 'haltOnFailure' : True }, {'name' : 'configure_llvmgcc', - 'description' : 'Configure LLVM-GCC', + 'description' : 'configure llvm-gcc', 'haltOnFailure' : True }, {'name' : 'make_llvmgcc', - 'description' : 'Make LLVM-GCC', + 'description' : 'make llvm-gcc', 'haltOnFailure' : True }, {'name' : 'install_llvmgcc', - 'description' : 'Install LLVM-GCC', + 'description' : 'install llvm-gcc', 'haltOnFailure' : True },]), 'category' : 'llvm-gcc' }, From stoklund at 2pi.dk Tue Jun 8 19:40:31 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 09 Jun 2010 00:40:31 -0000 Subject: [llvm-commits] [llvm] r105665 - /llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Message-ID: <20100609004031.4CC002A6C12E@llvm.org> Author: stoklund Date: Tue Jun 8 19:40:31 2010 New Revision: 105665 URL: http://llvm.org/viewvc/llvm-project?rev=105665&view=rev Log: Add argument name comments. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp?rev=105665&r1=105664&r2=105665&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Tue Jun 8 19:40:31 2010 @@ -827,8 +827,12 @@ case InlineAsm::Kind_RegDefEarlyClobber: for (; NumVals; --NumVals, ++i) { unsigned Reg = cast(Node->getOperand(i))->getReg(); - MI->addOperand(MachineOperand::CreateReg(Reg, true, false, false, - false, false, true)); + MI->addOperand(MachineOperand::CreateReg(Reg, /*isDef=*/ true, + /*isImp=*/ false, + /*isKill=*/ false, + /*isDead=*/ false, + /*isUndef=*/false, + /*isEarlyClobber=*/ true)); } break; case InlineAsm::Kind_RegUse: // Use of register. From natebegeman at mac.com Tue Jun 8 20:09:01 2010 From: natebegeman at mac.com (Nate Begeman) Date: Wed, 09 Jun 2010 01:09:01 -0000 Subject: [llvm-commits] [llvm] r105666 - in /llvm/trunk/utils/TableGen: NeonEmitter.cpp NeonEmitter.h Message-ID: <20100609010901.1E43A2A6C12E@llvm.org> Author: sampo Date: Tue Jun 8 20:09:00 2010 New Revision: 105666 URL: http://llvm.org/viewvc/llvm-project?rev=105666&view=rev Log: Handle instructions which need to be #defines for the purpose of capturing constant arguments Handle extract hi/lo with common code Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp llvm/trunk/utils/TableGen/NeonEmitter.h Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105666&r1=105665&r2=105666&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Tue Jun 8 20:09:00 2010 @@ -411,14 +411,17 @@ // Generate the string "(argtype a, argtype b, ...)" static std::string GenArgs(const std::string &proto, StringRef typestr) { + bool define = proto.find('i') != std::string::npos; char arg = 'a'; std::string s; s += "("; for (unsigned i = 1, e = proto.size(); i != e; ++i, ++arg) { - s += TypeString(proto[i], typestr); - s.push_back(' '); + if (!define) { + s += TypeString(proto[i], typestr); + s.push_back(' '); + } s.push_back(arg); if ((i + 1) < e) s += ", "; @@ -519,6 +522,12 @@ s += "__builtin_shufflevector((__neon_int64x1_t)" + a; s += ", (__neon_int64x1_t)" + b + ", 0, 1)"; break; + case OpHi: + s += "(__neon_int64x1_t)(((__neon_int64x2_t)" + a + ")[1])"; + break; + case OpLo: + s += "(__neon_int64x1_t)(((__neon_int64x2_t)" + a + ")[0])"; + break; case OpDup: s += "(__neon_" + ts + "){ "; for (unsigned i = 0; i != nElts; ++i) { @@ -597,6 +606,7 @@ std::string s; bool unioning = (proto[0] == '2' || proto[0] == '3' || proto[0] == '4'); + bool define = proto.find('i') != std::string::npos; // If all types are the same size, bitcasting the args will take care // of arg checking. The actual signedness etc. will be taken care of with @@ -605,20 +615,27 @@ ck = ClassB; if (proto[0] != 'v') { - if (unioning) { - s += "union { "; - s += TypeString(proto[0], typestr, true) + " val; "; - s += TypeString(proto[0], typestr, false) + " s; "; - s += "} r;"; + std::string ts = TypeString(proto[0], typestr); + + if (define) { + if (proto[0] != 's') + s += "(" + ts + "){(__neon_" + ts + ")"; } else { - s += TypeString(proto[0], typestr); + if (unioning) { + s += "union { "; + s += TypeString(proto[0], typestr, true) + " val; "; + s += TypeString(proto[0], typestr, false) + " s; "; + s += "} r;"; + } else { + s += ts; + } + + s += " r; r"; + if (structTypes && proto[0] != 's' && proto[0] != 'i' && proto[0] != 'l') + s += ".val"; + + s += " = "; } - - s += " r; r"; - if (structTypes && proto[0] != 's' && proto[0] != 'i' && proto[0] != 'l') - s += ".val"; - - s += " = "; } s += "__builtin_neon_"; @@ -655,13 +672,21 @@ if (ck == ClassB) s += ", " + utostr(GetNeonEnum(proto, typestr)); - s += ");"; + if (define) + s += ")"; + else + s += ");"; if (proto[0] != 'v') { - if (unioning) - s += " return r.s;"; - else - s += " return r;"; + if (define) { + if (proto[0] != 's') + s += "}"; + } else { + if (unioning) + s += " return r.s;"; + else + s += " return r;"; + } } return s; } @@ -767,11 +792,16 @@ OpKind k = OpMap[R->getValueAsDef("Operand")->getName()]; + bool define = Proto.find('i') != std::string::npos; + for (unsigned ti = 0, te = TypeVec.size(); ti != te; ++ti) { assert(!Proto.empty() && ""); // static always inline + return type - OS << "__ai " << TypeString(Proto[0], TypeVec[ti]); + if (define) + OS << "#define"; + else + OS << "__ai " << TypeString(Proto[0], TypeVec[ti]); // Function name with type suffix OS << " " << MangleName(name, TypeVec[ti], ClassS); @@ -780,7 +810,10 @@ OS << GenArgs(Proto, TypeVec[ti]); // Definition. - OS << " { "; + if (define) + OS << " "; + else + OS << " { "; if (k != OpNone) { OS << GenOpString(k, Proto, TypeVec[ti]); @@ -794,8 +827,9 @@ throw TGError(R->getLoc(), "Builtin has no class kind"); OS << GenBuiltin(name, Proto, TypeVec[ti], ck); } - - OS << " }\n"; + if (!define) + OS << " }"; + OS << "\n"; } OS << "\n"; } Modified: llvm/trunk/utils/TableGen/NeonEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.h?rev=105666&r1=105665&r2=105666&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.h (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.h Tue Jun 8 20:09:00 2010 @@ -42,7 +42,9 @@ OpOrNot, OpCast, OpConcat, - OpDup + OpDup, + OpHi, + OpLo }; enum ClassKind { @@ -82,6 +84,8 @@ OpMap["OP_ORN"] = OpOrNot; OpMap["OP_CAST"] = OpCast; OpMap["OP_CONC"] = OpConcat; + OpMap["OP_HI"] = OpHi; + OpMap["OP_LO"] = OpLo; OpMap["OP_DUP"] = OpDup; Record *SI = R.getClass("SInst"); From evan.cheng at apple.com Tue Jun 8 20:46:50 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 09 Jun 2010 01:46:50 -0000 Subject: [llvm-commits] [llvm] r105669 - in /llvm/trunk/lib/Target/ARM: ARM.h ARMTargetMachine.cpp Thumb2ITBlockPass.cpp Message-ID: <20100609014650.6CB322A6C12E@llvm.org> Author: evancheng Date: Tue Jun 8 20:46:50 2010 New Revision: 105669 URL: http://llvm.org/viewvc/llvm-project?rev=105669&view=rev Log: Thumb2 IT blocks are fairly expensive. When there are multiple selects using the same condition, it's important to make sure they are scheduled together to avoid forming multiple IT blocks. I'm adding a pre-regalloc pass that forms IT blocks early (by re-scheduling instructions and split basic blocks) to attempt to fix this. This is not turned on by default since I am not sure this is the right fix. Another issue is llvm selects are modeled as two-address conditional moves. This can be very bad when the copies before the conditional moves are not coalesced away. Teach IT formation pass to move the copies above the IT block (when legal) to avoid breaking the IT block. Modified: llvm/trunk/lib/Target/ARM/ARM.h llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp Modified: llvm/trunk/lib/Target/ARM/ARM.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARM.h?rev=105669&r1=105668&r2=105669&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARM.h (original) +++ llvm/trunk/lib/Target/ARM/ARM.h Tue Jun 8 20:46:50 2010 @@ -105,7 +105,7 @@ FunctionPass *createARMConstantIslandPass(); FunctionPass *createNEONPreAllocPass(); FunctionPass *createNEONMoveFixPass(); -FunctionPass *createThumb2ITBlockPass(); +FunctionPass *createThumb2ITBlockPass(bool PreAlloc = false); FunctionPass *createThumb2SizeReductionPass(); extern Target TheARMTarget, TheThumbTarget; Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=105669&r1=105668&r2=105669&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Tue Jun 8 20:46:50 2010 @@ -16,11 +16,17 @@ #include "ARM.h" #include "llvm/PassManager.h" #include "llvm/CodeGen/Passes.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegistry.h" using namespace llvm; +static cl::opt +EarlyITBlockFormation("thumb2-early-it-blocks", cl::Hidden, + cl::desc("Form IT blocks earlt, before register allocation"), + cl::init(false)); + static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) { Triple TheTriple(TT); switch (TheTriple.getOS()) { @@ -98,6 +104,10 @@ // FIXME: temporarily disabling load / store optimization pass for Thumb1. if (OptLevel != CodeGenOpt::None && !Subtarget.isThumb1Only()) PM.add(createARMLoadStoreOptimizationPass(true)); + + if (OptLevel != CodeGenOpt::None && Subtarget.isThumb2() && + EarlyITBlockFormation) + PM.add(createThumb2ITBlockPass(true)); return true; } Modified: llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp?rev=105669&r1=105668&r2=105669&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp Tue Jun 8 20:46:50 2010 @@ -14,15 +14,21 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/Statistic.h" using namespace llvm; -STATISTIC(NumITs, "Number of IT blocks inserted"); +STATISTIC(NumITs, "Number of IT blocks inserted"); +STATISTIC(NumMovedInsts, "Number of predicated instructions moved"); namespace { - struct Thumb2ITBlockPass : public MachineFunctionPass { + class Thumb2ITBlockPass : public MachineFunctionPass { + bool PreRegAlloc; + + public: static char ID; - Thumb2ITBlockPass() : MachineFunctionPass(&ID) {} + Thumb2ITBlockPass(bool PreRA) : + MachineFunctionPass(&ID), PreRegAlloc(PreRA) {} const Thumb2InstrInfo *TII; ARMFunctionInfo *AFI; @@ -34,7 +40,19 @@ } private: + bool MoveCPSRUseUp(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI, + MachineBasicBlock::iterator E, + unsigned PredReg, + ARMCC::CondCodes CC, ARMCC::CondCodes OCC, + bool &Done); + + void FindITBlockRanges(MachineBasicBlock &MBB, + SmallVector &FirstUses, + SmallVector &LastUses); + bool InsertITBlock(MachineInstr *First, MachineInstr *Last); bool InsertITBlocks(MachineBasicBlock &MBB); + bool InsertITInstructions(MachineBasicBlock &MBB); }; char Thumb2ITBlockPass::ID = 0; } @@ -43,27 +61,255 @@ unsigned Opc = MI->getOpcode(); if (Opc == ARM::tBcc || Opc == ARM::t2Bcc) return ARMCC::AL; - return llvm::getInstrPredicate(MI, PredReg); + + int PIdx = MI->findFirstPredOperandIdx(); + if (PIdx == -1) { + PredReg = 0; + return ARMCC::AL; + } + + PredReg = MI->getOperand(PIdx+1).getReg(); + return (ARMCC::CondCodes)MI->getOperand(PIdx).getImm(); +} + +bool +Thumb2ITBlockPass::MoveCPSRUseUp(MachineBasicBlock &MBB, + MachineBasicBlock::iterator MBBI, + MachineBasicBlock::iterator E, + unsigned PredReg, + ARMCC::CondCodes CC, ARMCC::CondCodes OCC, + bool &Done) { + SmallSet Defs, Uses; + MachineBasicBlock::iterator I = MBBI; + // Look for next CPSR use by scanning up to 4 instructions. + for (unsigned i = 0; i < 4; ++i) { + MachineInstr *MI = &*I; + unsigned MPredReg = 0; + ARMCC::CondCodes MCC = getPredicate(MI, MPredReg); + if (MCC != ARMCC::AL) { + if (MPredReg != PredReg || (MCC != CC && MCC != OCC)) + return false; + + // Check if the instruction is using any register that's defined + // below the previous predicated instruction. Also return false if + // it defines any register which is used in between. + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + const MachineOperand &MO = MI->getOperand(i); + if (!MO.isReg()) + continue; + unsigned Reg = MO.getReg(); + if (!Reg) + continue; + if (MO.isDef()) { + if (Reg == PredReg || Uses.count(Reg)) + return false; + } else { + if (Defs.count(Reg)) + return false; + } + } + + Done = (I == E); + MBB.remove(MI); + MBB.insert(MBBI, MI); + ++NumMovedInsts; + return true; + } + + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + const MachineOperand &MO = MI->getOperand(i); + if (!MO.isReg()) + continue; + unsigned Reg = MO.getReg(); + if (!Reg) + continue; + if (MO.isDef()) { + if (Reg == PredReg) + return false; + Defs.insert(Reg); + } else + Uses.insert(Reg); + } + + if (I == E) + break; + ++I; + } + return false; +} + +static bool isCPSRLiveout(MachineBasicBlock &MBB) { + for (MachineBasicBlock::succ_iterator I = MBB.succ_begin(), + E = MBB.succ_end(); I != E; ++I) { + if ((*I)->isLiveIn(ARM::CPSR)) + return true; + } + return false; +} + +void Thumb2ITBlockPass::FindITBlockRanges(MachineBasicBlock &MBB, + SmallVector &FirstUses, + SmallVector &LastUses) { + bool SeenUse = false; + MachineOperand *LastDef = 0; + MachineOperand *LastUse = 0; + MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end(); + while (MBBI != E) { + MachineInstr *MI = &*MBBI; + ++MBBI; + + MachineOperand *Def = 0; + MachineOperand *Use = 0; + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI->getOperand(i); + if (!MO.isReg() || MO.getReg() != ARM::CPSR) + continue; + if (MO.isDef()) { + assert(Def == 0 && "Multiple defs of CPSR?"); + Def = &MO; + } else { + assert(Use == 0 && "Multiple uses of CPSR?"); + Use = &MO; + } + } + + if (Use) { + LastUse = Use; + if (!SeenUse) { + FirstUses.push_back(MI); + SeenUse = true; + } + } + if (Def) { + if (LastUse) { + LastUses.push_back(LastUse->getParent()); + LastUse = 0; + } + LastDef = Def; + SeenUse = false; + } + } + + if (LastUse) { + // Is the last use a kill? + if (isCPSRLiveout(MBB)) + LastUses.push_back(0); + else + LastUses.push_back(LastUse->getParent()); + } +} + +bool Thumb2ITBlockPass::InsertITBlock(MachineInstr *First, MachineInstr *Last) { + if (First == Last) + return false; + + bool Modified = false; + MachineBasicBlock *MBB = First->getParent(); + MachineBasicBlock::iterator MBBI = First; + MachineBasicBlock::iterator E = Last; + + if (First->getDesc().isBranch() || First->getDesc().isReturn()) + return false; + + unsigned PredReg = 0; + ARMCC::CondCodes CC = getPredicate(First, PredReg); + if (CC == ARMCC::AL) + return Modified; + + // Move uses of the CPSR together if possible. + ARMCC::CondCodes OCC = ARMCC::getOppositeCondition(CC); + + do { + ++MBBI; + if (MBBI->getDesc().isBranch() || MBBI->getDesc().isReturn()) + return Modified; + MachineInstr *NMI = &*MBBI; + unsigned NPredReg = 0; + ARMCC::CondCodes NCC = getPredicate(NMI, NPredReg); + if (NCC != CC && NCC != OCC) { + if (NCC != ARMCC::AL) + return Modified; + assert(MBBI != E); + bool Done = false; + if (!MoveCPSRUseUp(*MBB, MBBI, E, PredReg, CC, OCC, Done)) + return Modified; + Modified = true; + if (Done) + MBBI = E; + } + } while (MBBI != E); + + // Insert a new block for consecutive predicated instructions. + MachineFunction *MF = MBB->getParent(); + MachineBasicBlock *NewMBB = MF->CreateMachineBasicBlock(MBB->getBasicBlock()); + MachineFunction::iterator Pos = MBB; + MF->insert(++Pos, NewMBB); + + // Move all the successors of this block to the specified block. + NewMBB->transferSuccessors(MBB); + + // Add an edge from CurMBB to NewMBB for the fall-through. + MBB->addSuccessor(NewMBB); + NewMBB->splice(NewMBB->end(), MBB, ++MBBI, MBB->end()); + return true; } bool Thumb2ITBlockPass::InsertITBlocks(MachineBasicBlock &MBB) { + SmallVector FirstUses; + SmallVector LastUses; + FindITBlockRanges(MBB, FirstUses, LastUses); + assert(FirstUses.size() == LastUses.size() && "Incorrect range information!"); + bool Modified = false; + for (unsigned i = 0, e = FirstUses.size(); i != e; ++i) { + if (LastUses[i] == 0) + // Must be the last pair where CPSR is live out of the block. + return Modified; + Modified |= InsertITBlock(FirstUses[i], LastUses[i]); + } + return Modified; +} + +static void TrackDefUses(MachineInstr *MI, SmallSet &Defs, + SmallSet &Uses) { + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI->getOperand(i); + if (!MO.isReg()) + continue; + unsigned Reg = MO.getReg(); + if (!Reg) + continue; + if (MO.isDef()) + Defs.insert(Reg); + else + Uses.insert(Reg); + } +} +bool Thumb2ITBlockPass::InsertITInstructions(MachineBasicBlock &MBB) { + bool Modified = false; + + SmallSet Defs; + SmallSet Uses; MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end(); while (MBBI != E) { MachineInstr *MI = &*MBBI; DebugLoc dl = MI->getDebugLoc(); unsigned PredReg = 0; ARMCC::CondCodes CC = getPredicate(MI, PredReg); - if (CC == ARMCC::AL) { ++MBBI; continue; } + Defs.clear(); + Uses.clear(); + TrackDefUses(MI, Defs, Uses); + // Insert an IT instruction. MachineInstrBuilder MIB = BuildMI(MBB, MBBI, dl, TII->get(ARM::t2IT)) .addImm(CC); + MachineBasicBlock::iterator InsertPos = MIB; ++MBBI; // Finalize IT mask. @@ -75,17 +321,37 @@ (!MI->getDesc().isBranch() && !MI->getDesc().isReturn()) ; ++MBBI) { if (MBBI->isDebugValue()) continue; + MachineInstr *NMI = &*MBBI; MI = NMI; - DebugLoc ndl = NMI->getDebugLoc(); + unsigned NPredReg = 0; ARMCC::CondCodes NCC = getPredicate(NMI, NPredReg); if (NCC == CC || NCC == OCC) Mask |= (NCC & 1) << Pos; - else + else { + unsigned SrcReg, DstReg, SrcSubIdx, DstSubIdx; + if (NCC == ARMCC::AL && + TII->isMoveInstr(*NMI, SrcReg, DstReg, SrcSubIdx, DstSubIdx)) { + assert(SrcSubIdx == 0 && DstSubIdx == 0 && + "Sub-register indices still around?"); + // llvm models select's as two-address instructions. That means a copy + // is inserted before a t2MOVccr, etc. If the copy is scheduled in + // between selects we would end up creating multiple IT blocks. + if (!Uses.count(DstReg) && !Defs.count(SrcReg)) { + --MBBI; + MBB.remove(NMI); + MBB.insert(InsertPos, NMI); + ++NumMovedInsts; + continue; + } + } break; + } + TrackDefUses(NMI, Defs, Uses); --Pos; } + Mask |= (1 << Pos); // Tag along (firstcond[0] << 4) with the mask. Mask |= (CC & 1) << 4; @@ -106,10 +372,13 @@ return false; bool Modified = false; - for (MachineFunction::iterator MFI = Fn.begin(), E = Fn.end(); MFI != E; - ++MFI) { + for (MachineFunction::iterator MFI = Fn.begin(), E = Fn.end(); MFI != E; ) { MachineBasicBlock &MBB = *MFI; - Modified |= InsertITBlocks(MBB); + ++MFI; + if (PreRegAlloc) + Modified |= InsertITBlocks(MBB); + else + Modified |= InsertITInstructions(MBB); } return Modified; @@ -117,6 +386,6 @@ /// createThumb2ITBlockPass - Returns an instance of the Thumb2 IT blocks /// insertion pass. -FunctionPass *llvm::createThumb2ITBlockPass() { - return new Thumb2ITBlockPass(); +FunctionPass *llvm::createThumb2ITBlockPass(bool PreAlloc) { + return new Thumb2ITBlockPass(PreAlloc); } From eli.friedman at gmail.com Tue Jun 8 21:43:17 2010 From: eli.friedman at gmail.com (Eli Friedman) Date: Wed, 09 Jun 2010 02:43:17 -0000 Subject: [llvm-commits] [llvm] r105674 - /llvm/trunk/lib/Target/X86/README-X86-64.txt Message-ID: <20100609024317.9FD622A6C12E@llvm.org> Author: efriedma Date: Tue Jun 8 21:43:17 2010 New Revision: 105674 URL: http://llvm.org/viewvc/llvm-project?rev=105674&view=rev Log: A few new x86-64 specific README entries. Modified: llvm/trunk/lib/Target/X86/README-X86-64.txt Modified: llvm/trunk/lib/Target/X86/README-X86-64.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README-X86-64.txt?rev=105674&r1=105673&r2=105674&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README-X86-64.txt (original) +++ llvm/trunk/lib/Target/X86/README-X86-64.txt Tue Jun 8 21:43:17 2010 @@ -74,6 +74,15 @@ movq %rax, (%rdx) ret +And the codegen is even worse for the following +(from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33103): + void fill1(char *s, int a) + { + __builtin_memset(s, a, 15); + } + +For this version, we duplicate the computation of the constant to store. + //===---------------------------------------------------------------------===// It's not possible to reference AH, BH, CH, and DH registers in an instruction @@ -158,3 +167,76 @@ if we have whole-function selectiondags. //===---------------------------------------------------------------------===// + +Take the following C code +(from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43640): + +struct u1 +{ + float x; + float y; +}; + +float foo(struct u1 u) +{ + return u.x + u.y; +} + +Optimizes to the following IR: +define float @foo(double %u.0) nounwind readnone { +entry: + %tmp8 = bitcast double %u.0 to i64 ; [#uses=2] + %tmp6 = trunc i64 %tmp8 to i32 ; [#uses=1] + %tmp7 = bitcast i32 %tmp6 to float ; [#uses=1] + %tmp2 = lshr i64 %tmp8, 32 ; [#uses=1] + %tmp3 = trunc i64 %tmp2 to i32 ; [#uses=1] + %tmp4 = bitcast i32 %tmp3 to float ; [#uses=1] + %0 = fadd float %tmp7, %tmp4 ; [#uses=1] + ret float %0 +} + +And current llvm-gcc/clang output: + movd %xmm0, %rax + movd %eax, %xmm1 + shrq $32, %rax + movd %eax, %xmm0 + addss %xmm1, %xmm0 + ret + +We really shouldn't move the floats to RAX, only to immediately move them +straight back to the XMM registers. + +There really isn't any good way to handle this purely in IR optimizers; it +could possibly be handled by changing the output of the fronted, though. It +would also be feasible to add a x86-specific DAGCombine to optimize the +bitcast+trunc+(lshr+)bitcast combination. + +//===---------------------------------------------------------------------===// + +Take the following code +(from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34653): +extern unsigned long table[]; +unsigned long foo(unsigned char *p) { + unsigned long tag = *p; + return table[tag >> 4] + table[tag & 0xf]; +} + +Current code generated: + movzbl (%rdi), %eax + movq %rax, %rcx + andq $240, %rcx + shrq %rcx + andq $15, %rax + movq table(,%rax,8), %rax + addq table(%rcx), %rax + ret + +Issues: +1. First movq should be movl; saves a byte. +2. Both andq's should be andl; saves another two bytes. I think this was + implemented at one point, but subsequently regressed. +3. shrq should be shrl; saves another byte. +4. The first andq can be completely eliminated by using a slightly more + expensive addressing mode. + +//===---------------------------------------------------------------------===// From rafael.espindola at gmail.com Tue Jun 8 22:00:05 2010 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Wed, 09 Jun 2010 03:00:05 -0000 Subject: [llvm-commits] [llvm] r105675 - /llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h Message-ID: <20100609030005.B43752A6C12E@llvm.org> Author: rafael Date: Tue Jun 8 22:00:05 2010 New Revision: 105675 URL: http://llvm.org/viewvc/llvm-project?rev=105675&view=rev Log: Fix a gcc warning: 'class llvm::DAGDeltaAlgorithm' has virtual functions and accessible non-virtual destructor Not sure if this is the best solution, but this class has state and some of the classes that inherit from it also do, so it looks appropriate. Modified: llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h Modified: llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h?rev=105675&r1=105674&r2=105675&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h (original) +++ llvm/trunk/include/llvm/ADT/DAGDeltaAlgorithm.h Tue Jun 8 22:00:05 2010 @@ -45,6 +45,8 @@ typedef std::vector changesetlist_ty; public: + virtual ~DAGDeltaAlgorithm() {} + /// Run - Minimize the DAG formed by the \arg Changes vertices and the \arg /// Dependencies edges by executing \see ExecuteOneTest() on subsets of /// changes and returning the smallest set which still satisfies the test From dalej at apple.com Tue Jun 8 22:03:51 2010 From: dalej at apple.com (Dale Johannesen) Date: Tue, 8 Jun 2010 20:03:51 -0700 Subject: [llvm-commits] Buggy SelectionDAG binop vector widening In-Reply-To: <20100608092644.GB30866@cc.hut.fi> References: <20100603132756.GA30866@cc.hut.fi> <86CAA4FC-4CE3-4E7E-B0A4-58DE974B9176@apple.com> <20100608092644.GB30866@cc.hut.fi> Message-ID: <097373B3-998A-4F32-8688-AF7CB8271F35@apple.com> On Jun 8, 2010, at 2:26 AM, Visa Putkinen wrote: > On Thu, Jun 03, 2010 at 11:12:59AM -0700, Dale Johannesen wrote: >> On Jun 3, 2010, at 6:27 AMPDT, Visa Putkinen wrote: >>> The function responsible for widening vector binary operation >>> nodes in >>> SelectionDAGs (DAGTypeLegalizer::WidenVecRes_Binary in >>> lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp, r105388) returns >>> incorrect results for many vector lengths and even triggers >>> asserts on >>> lengths 9 and 13. I didn't find a bug report about this bug. >>> >>> >>> + NextVT = EVT::getVectorVT(*DAG.getContext(), WidenEltVT, >>> NextSize); >>> + } while (!TLI.isTypeLegal(NextVT)); >> >> This should be isTypeSynthesizable, not isTypeLegal. There are >> probably >> other places in here where that's also true. > > Thanks for the advice. I changed all three occurances of isTypeLegal > to > isTypeSynthesizable in DAGTypeLegalizer::WidenVecRes_Binary. There are > still six other isTypeLegal call sites in LegalizeVectorTypes.cpp that > probably should be updated, but I didn't touch those for now. The > updated patch is attached. It looks OK to me but I am not expert in this code. Duncan, you wrote this didn't you? Can you look? > Any other thoughts about the patch? The issue is still relevant in > r105601: my patch passes http://vpu.me/v-binop-widen.ll and > http://vpu.me/v-binop-widen2.ll , which fail without the patch. The > patch doesn't seem to break any other DejaGNU tests. > > -- > Visa Putkinen // visa.putkinen at iki.fi > From evan.cheng at apple.com Tue Jun 8 22:49:12 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 09 Jun 2010 03:49:12 -0000 Subject: [llvm-commits] [llvm] r105677 - /llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Message-ID: <20100609034912.7606C2A6C12E@llvm.org> Author: evancheng Date: Tue Jun 8 22:49:12 2010 New Revision: 105677 URL: http://llvm.org/viewvc/llvm-project?rev=105677&view=rev Log: Typo. Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=105677&r1=105676&r2=105677&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Tue Jun 8 22:49:12 2010 @@ -24,7 +24,7 @@ static cl::opt EarlyITBlockFormation("thumb2-early-it-blocks", cl::Hidden, - cl::desc("Form IT blocks earlt, before register allocation"), + cl::desc("Form IT blocks early before register allocation"), cl::init(false)); static MCAsmInfo *createMCAsmInfo(const Target &T, StringRef TT) { From natebegeman at mac.com Wed Jun 9 00:11:55 2010 From: natebegeman at mac.com (Nate Begeman) Date: Wed, 09 Jun 2010 05:11:55 -0000 Subject: [llvm-commits] [llvm] r105682 - /llvm/trunk/utils/TableGen/NeonEmitter.cpp Message-ID: <20100609051155.7FF8F2A6C12E@llvm.org> Author: sampo Date: Wed Jun 9 00:11:55 2010 New Revision: 105682 URL: http://llvm.org/viewvc/llvm-project?rev=105682&view=rev Log: Specialize I-Class instructions better so that we have less work to do in codegen. Parenthesize macro args Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105682&r1=105681&r2=105682&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Wed Jun 9 00:11:55 2010 @@ -310,10 +310,14 @@ return quad ? "V48c" : "V24c"; if (mod == '4') return quad ? "V64c" : "V32c"; - if (mod == 'f') + if (mod == 'f' || (ck == ClassI && type == 'f')) return quad ? "V4f" : "V2f"; - if (mod == 'x' || mod == 'u') + if (ck == ClassI && type == 's') + return quad ? "V8s" : "V4s"; + if (ck == ClassI && type == 'i') return quad ? "V4i" : "V2i"; + if (ck == ClassI && type == 'l') + return quad ? "V2LLi" : "V1LLi"; return quad ? "V16c" : "V8c"; } @@ -325,9 +329,16 @@ return quad ? "V16cV16cV16c" : "V8cV8cV8c"; if (mod == '4') return quad ? "V16cV16cV16cV16c" : "V8cV8cV8cV8c"; - if (mod == 'f') - return quad ? "V4f" : "V2f"; + if (mod == 'f' || (ck == ClassI && type == 'f')) + return quad ? "V4f" : "V2f"; + if (ck == ClassI && type == 's') + return quad ? "V8s" : "V4s"; + if (ck == ClassI && type == 'i') + return quad ? "V4i" : "V2i"; + if (ck == ClassI && type == 'l') + return quad ? "V2LLi" : "V1LLi"; + return quad ? "V16c" : "V8c"; } @@ -658,7 +669,12 @@ continue; } + // Parenthesize the args from the macro. + if (define) + s.push_back('('); s.push_back(arg); + if (define) + s.push_back(')'); if (structTypes && proto[i] != 's' && proto[i] != 'i' && proto[i] != 'l' && proto[i] != 'p' && proto[i] != 'c') { From baldrick at free.fr Wed Jun 9 01:32:03 2010 From: baldrick at free.fr (Duncan Sands) Date: Wed, 09 Jun 2010 08:32:03 +0200 Subject: [llvm-commits] Buggy SelectionDAG binop vector widening In-Reply-To: <097373B3-998A-4F32-8688-AF7CB8271F35@apple.com> References: <20100603132756.GA30866@cc.hut.fi> <86CAA4FC-4CE3-4E7E-B0A4-58DE974B9176@apple.com> <20100608092644.GB30866@cc.hut.fi> <097373B3-998A-4F32-8688-AF7CB8271F35@apple.com> Message-ID: <4C0F3563.1040702@free.fr> Hi Dale, >> Thanks for the advice. I changed all three occurances of isTypeLegal to >> isTypeSynthesizable in DAGTypeLegalizer::WidenVecRes_Binary. There are >> still six other isTypeLegal call sites in LegalizeVectorTypes.cpp that >> probably should be updated, but I didn't touch those for now. The >> updated patch is attached. > > It looks OK to me but I am not expert in this code. Duncan, you wrote > this didn't you? Can you look? Mon Ping wrote the vector widening stuff. I will try to take a look too. Ciao, Duncan. From kalle.raiskila at nokia.com Wed Jun 9 03:29:41 2010 From: kalle.raiskila at nokia.com (Kalle Raiskila) Date: Wed, 09 Jun 2010 08:29:41 -0000 Subject: [llvm-commits] [llvm] r105710 - in /llvm/trunk: lib/Target/CellSPU/SPUISelDAGToDAG.cpp test/CodeGen/CellSPU/loads.ll Message-ID: <20100609082941.D02292A6C12E@llvm.org> Author: kraiskil Date: Wed Jun 9 03:29:41 2010 New Revision: 105710 URL: http://llvm.org/viewvc/llvm-project?rev=105710&view=rev Log: Handle loading from/storing to undef pointers on SPU by inserting a random load/store, rather than crashing llc. Modified: llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp llvm/trunk/test/CodeGen/CellSPU/loads.ll Modified: llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp?rev=105710&r1=105709&r2=105710&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp Wed Jun 9 03:29:41 2010 @@ -606,7 +606,9 @@ Base = CurDAG->getTargetConstant(0, N.getValueType()); Index = N; return true; - } else if (Opc == ISD::Register || Opc == ISD::CopyFromReg) { + } else if (Opc == ISD::Register + ||Opc == ISD::CopyFromReg + ||Opc == ISD::UNDEF) { unsigned OpOpc = Op->getOpcode(); if (OpOpc == ISD::STORE || OpOpc == ISD::LOAD) { Modified: llvm/trunk/test/CodeGen/CellSPU/loads.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CellSPU/loads.ll?rev=105710&r1=105709&r2=105710&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CellSPU/loads.ll (original) +++ llvm/trunk/test/CodeGen/CellSPU/loads.ll Wed Jun 9 03:29:41 2010 @@ -31,3 +31,8 @@ ret <4 x i32> %rv3 } +define <4 x float> @load_undef(){ + ;CHECK lqd $3, 0($3) + %val = load <4 x float>* undef + ret <4 x float> %val +} From kalle.raiskila at nokia.com Wed Jun 9 04:58:18 2010 From: kalle.raiskila at nokia.com (Kalle Raiskila) Date: Wed, 09 Jun 2010 09:58:18 -0000 Subject: [llvm-commits] [llvm] r105722 - in /llvm/trunk: lib/Target/CellSPU/SPUISelLowering.cpp test/CodeGen/CellSPU/vecinsert.ll Message-ID: <20100609095818.30C422A6C12E@llvm.org> Author: kraiskil Date: Wed Jun 9 04:58:17 2010 New Revision: 105722 URL: http://llvm.org/viewvc/llvm-project?rev=105722&view=rev Log: Fix SPU to cope with vector insertelement to an undef position. We default to inserting to lane 0. Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/test/CodeGen/CellSPU/vecinsert.ll Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=105722&r1=105721&r2=105722&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Wed Jun 9 04:58:17 2010 @@ -2056,14 +2056,19 @@ DebugLoc dl = Op.getDebugLoc(); EVT VT = Op.getValueType(); - ConstantSDNode *CN = cast(IdxOp); - assert(CN != 0 && "LowerINSERT_VECTOR_ELT: Index is not constant!"); + // use 0 when the lane to insert to is 'undef' + int64_t Idx=0; + if (IdxOp.getOpcode() != ISD::UNDEF) { + ConstantSDNode *CN = cast(IdxOp); + assert(CN != 0 && "LowerINSERT_VECTOR_ELT: Index is not constant!"); + Idx = (CN->getSExtValue()); + } EVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy(); // Use $sp ($1) because it's always 16-byte aligned and it's available: SDValue Pointer = DAG.getNode(SPUISD::IndirectAddr, dl, PtrVT, DAG.getRegister(SPU::R1, PtrVT), - DAG.getConstant(CN->getSExtValue(), PtrVT)); + DAG.getConstant(Idx, PtrVT)); SDValue ShufMask = DAG.getNode(SPUISD::SHUFFLE_MASK, dl, VT, Pointer); SDValue result = Modified: llvm/trunk/test/CodeGen/CellSPU/vecinsert.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CellSPU/vecinsert.ll?rev=105722&r1=105721&r2=105722&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/CellSPU/vecinsert.ll (original) +++ llvm/trunk/test/CodeGen/CellSPU/vecinsert.ll Wed Jun 9 04:58:17 2010 @@ -1,17 +1,19 @@ ; RUN: llc < %s -march=cellspu > %t1.s ; RUN: grep cbd %t1.s | count 5 ; RUN: grep chd %t1.s | count 5 -; RUN: grep cwd %t1.s | count 10 +; RUN: grep cwd %t1.s | count 11 ; RUN: grep -w il %t1.s | count 5 ; RUN: grep -w ilh %t1.s | count 6 ; RUN: grep iohl %t1.s | count 1 ; RUN: grep ilhu %t1.s | count 4 -; RUN: grep shufb %t1.s | count 26 +; RUN: grep shufb %t1.s | count 27 ; RUN: grep 17219 %t1.s | count 1 ; RUN: grep 22598 %t1.s | count 1 ; RUN: grep -- -39 %t1.s | count 1 ; RUN: grep 24 %t1.s | count 1 ; RUN: grep 1159 %t1.s | count 1 +; RUN: FileCheck %s < %t1.s + ; ModuleID = 'vecinsert.bc' target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128" target triple = "spu-unknown-elf" @@ -118,3 +120,12 @@ store <2 x double> %tmp3, <2 x double>* %arrayidx ret void } + +define <4 x i32> @undef_v4i32( i32 %param ) { + ;CHECK: cwd + ;CHECK: lqa + ;CHECK: shufb + %val = insertelement <4 x i32> , i32 %param, i32 undef + ret <4 x i32> %val +} + From kennethuil at gmail.com Wed Jun 9 10:11:37 2010 From: kennethuil at gmail.com (Kenneth Uildriks) Date: Wed, 09 Jun 2010 15:11:37 -0000 Subject: [llvm-commits] [llvm] r105725 - in /llvm/trunk: include/llvm/Analysis/CodeMetrics.h include/llvm/Analysis/InlineCost.h lib/Analysis/InlineCost.cpp lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <20100609151137.89A582A6C12E@llvm.org> Author: kennethuil Date: Wed Jun 9 10:11:37 2010 New Revision: 105725 URL: http://llvm.org/viewvc/llvm-project?rev=105725&view=rev Log: Pulled CodeMetrics out of InlineCost.h and made it a bit more general, so it can be reused from PartialSpecializationCost Added: llvm/trunk/include/llvm/Analysis/CodeMetrics.h Modified: llvm/trunk/include/llvm/Analysis/InlineCost.h llvm/trunk/lib/Analysis/InlineCost.cpp llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Added: llvm/trunk/include/llvm/Analysis/CodeMetrics.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CodeMetrics.h?rev=105725&view=auto ============================================================================== --- llvm/trunk/include/llvm/Analysis/CodeMetrics.h (added) +++ llvm/trunk/include/llvm/Analysis/CodeMetrics.h Wed Jun 9 10:11:37 2010 @@ -0,0 +1,72 @@ +//===- CodeMetrics.h - Measures the weight of a function---------*- 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 various weight measurements for a function, helping +// the Inliner and PartialSpecialization decide whether to duplicate its +// contents. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ANALYSIS_CODEMETRICS_H +#define LLVM_ANALYSIS_CODEMETRICS_H + +namespace llvm { + // CodeMetrics - Calculate size and a few similar metrics for a set of + // basic blocks. + struct CodeMetrics { + /// NeverInline - True if this callee should never be inlined into a + /// caller. + // bool NeverInline; + + // True if this function contains a call to setjmp or _setjmp + bool callsSetJmp; + + // True if this function calls itself + bool isRecursive; + + // True if this function contains one or more indirect branches + bool containsIndirectBr; + + /// usesDynamicAlloca - True if this function calls alloca (in the C sense). + bool usesDynamicAlloca; + + /// NumInsts, NumBlocks - Keep track of how large each function is, which + /// is used to estimate the code size cost of inlining it. + unsigned NumInsts, NumBlocks; + + /// NumBBInsts - Keeps track of basic block code size estimates. + DenseMap NumBBInsts; + + /// NumCalls - Keep track of the number of calls to 'big' functions. + unsigned NumCalls; + + /// NumVectorInsts - Keep track of how many instructions produce vector + /// values. The inliner is being more aggressive with inlining vector + /// kernels. + unsigned NumVectorInsts; + + /// NumRets - Keep track of how many Ret instructions the block contains. + unsigned NumRets; + + CodeMetrics() : callsSetJmp(false), isRecursive(false), + containsIndirectBr(false), usesDynamicAlloca(false), + NumInsts(0), NumBlocks(0), NumCalls(0), NumVectorInsts(0), + NumRets(0) {} + + /// analyzeBasicBlock - Add information about the specified basic block + /// to the current structure. + void analyzeBasicBlock(const BasicBlock *BB); + + /// analyzeFunction - Add information about the specified function + /// to the current structure. + void analyzeFunction(Function *F); + }; +} + +#endif Modified: llvm/trunk/include/llvm/Analysis/InlineCost.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/InlineCost.h?rev=105725&r1=105724&r2=105725&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/InlineCost.h (original) +++ llvm/trunk/include/llvm/Analysis/InlineCost.h Wed Jun 9 10:11:37 2010 @@ -19,6 +19,7 @@ #include #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/ValueMap.h" +#include "llvm/Analysis/CodeMetrics.h" namespace llvm { @@ -29,46 +30,6 @@ template class SmallPtrSet; - // CodeMetrics - Calculate size and a few similar metrics for a set of - // basic blocks. - struct CodeMetrics { - /// NeverInline - True if this callee should never be inlined into a - /// caller. - bool NeverInline; - - /// usesDynamicAlloca - True if this function calls alloca (in the C sense). - bool usesDynamicAlloca; - - /// NumInsts, NumBlocks - Keep track of how large each function is, which - /// is used to estimate the code size cost of inlining it. - unsigned NumInsts, NumBlocks; - - /// NumBBInsts - Keeps track of basic block code size estimates. - DenseMap NumBBInsts; - - /// NumCalls - Keep track of the number of calls to 'big' functions. - unsigned NumCalls; - - /// NumVectorInsts - Keep track of how many instructions produce vector - /// values. The inliner is being more aggressive with inlining vector - /// kernels. - unsigned NumVectorInsts; - - /// NumRets - Keep track of how many Ret instructions the block contains. - unsigned NumRets; - - CodeMetrics() : NeverInline(false), usesDynamicAlloca(false), NumInsts(0), - NumBlocks(0), NumCalls(0), NumVectorInsts(0), NumRets(0) {} - - /// analyzeBasicBlock - Add information about the specified basic block - /// to the current structure. - void analyzeBasicBlock(const BasicBlock *BB); - - /// analyzeFunction - Add information about the specified function - /// to the current structure. - void analyzeFunction(Function *F); - }; - namespace InlineConstants { // Various magic constants used to adjust heuristics. const int InstrCost = 5; @@ -163,6 +124,10 @@ /// analyzeFunction - Add information about the specified function /// to the current structure. void analyzeFunction(Function *F); + + /// NeverInline - Returns true if the function should never be + /// inlined into any caller. + bool NeverInline(); }; // The Function* for a function can be changed (by ArgumentPromotion); Modified: llvm/trunk/lib/Analysis/InlineCost.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=105725&r1=105724&r2=105725&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/InlineCost.cpp (original) +++ llvm/trunk/lib/Analysis/InlineCost.cpp Wed Jun 9 10:11:37 2010 @@ -162,14 +162,14 @@ if (Function *F = CS.getCalledFunction()) { if (F->isDeclaration() && (F->getName() == "setjmp" || F->getName() == "_setjmp")) - NeverInline = true; + callsSetJmp = true; // If this call is to function itself, then the function is recursive. // Inlining it into other functions is a bad idea, because this is // basically just a form of loop peeling, and our metrics aren't useful // for that case. if (F == BB->getParent()) - NeverInline = true; + isRecursive = true; } if (!isa(II) && !callIsSmall(CS.getCalledFunction())) { @@ -220,7 +220,7 @@ // jump would jump from the inlined copy of the function into the original // function which is extremely undefined behavior. if (isa(BB->getTerminator())) - NeverInline = true; + containsIndirectBr = true; // Remember NumInsts for this BB. NumBBInsts[BB] = NumInsts - NumInstsBeforeThisBB; @@ -247,7 +247,7 @@ // Don't bother calculating argument weights if we are never going to inline // the function anyway. - if (Metrics.NeverInline) + if (NeverInline()) return; // Check out all of the arguments to the function, figuring out how much @@ -258,6 +258,14 @@ CountCodeReductionForAlloca(I))); } +/// NeverInline - returns true if the function should never be inlined into +/// any caller +bool InlineCostAnalyzer::FunctionInfo::NeverInline() +{ + return (Metrics.callsSetJmp || Metrics.isRecursive || + Metrics.containsIndirectBr); + +} // getInlineCost - The heuristic used to determine if we should inline the // function call or not. // @@ -315,7 +323,7 @@ CalleeFI->analyzeFunction(Callee); // If we should never inline this, return a huge cost. - if (CalleeFI->Metrics.NeverInline) + if (CalleeFI->NeverInline()) return InlineCost::getNever(); // FIXME: It would be nice to kill off CalleeFI->NeverInline. Then we @@ -443,10 +451,15 @@ } // Since CalleeMetrics were already calculated, we know that the CallerMetrics - // reference isn't invalidated: both were in the DenseMap. - CallerMetrics.NeverInline |= CalleeMetrics.NeverInline; + // reference isn't invalidated: both were in the DenseMap. CallerMetrics.usesDynamicAlloca |= CalleeMetrics.usesDynamicAlloca; + // FIXME: If any of these three are true for the callee, the callee was + // not inlined into the caller, so I think they're redundant here. + CallerMetrics.callsSetJmp |= CalleeMetrics.callsSetJmp; + CallerMetrics.isRecursive |= CalleeMetrics.isRecursive; + CallerMetrics.containsIndirectBr |= CalleeMetrics.containsIndirectBr; + CallerMetrics.NumInsts += CalleeMetrics.NumInsts; CallerMetrics.NumBlocks += CalleeMetrics.NumBlocks; CallerMetrics.NumCalls += CalleeMetrics.NumCalls; Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=105725&r1=105724&r2=105725&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Jun 9 10:11:37 2010 @@ -445,7 +445,7 @@ // This is a very ad-hoc heuristic. if (Metrics.NumInsts > Threshold || Metrics.NumBlocks * 5 > Threshold || - Metrics.NeverInline) { + Metrics.containsIndirectBr || Metrics.isRecursive) { DEBUG(dbgs() << "NOT unswitching loop %" << currentLoop->getHeader()->getName() << ", cost too high: " << currentLoop->getBlocks().size() << "\n"); From renato.golin at arm.com Wed Jun 9 04:00:04 2010 From: renato.golin at arm.com (Renato Golin) Date: Wed, 9 Jun 2010 10:00:04 +0100 Subject: [llvm-commits] ARM MC Relocation Message-ID: <001301cb07b2$26a7b7d0$73f72770$@golin@arm.com> Add ASM relocation information for the ARM platform to enable cross-linking with GCC/ARM tools, similar to what Codesourcery's GCC does. This is just one small part. If the patch is correct (in line with current MC work), there are many more relocation information that would be good to add to the assembly output. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100609/8d6430ef/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: arm-relocations.patch Type: application/octet-stream Size: 5835 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100609/8d6430ef/attachment.obj From bigcheesegs at gmail.com Wed Jun 9 04:25:05 2010 From: bigcheesegs at gmail.com (Bigcheese) Date: Wed, 9 Jun 2010 05:25:05 -0400 Subject: [llvm-commits] r105652 breaks the build with visual studio Message-ID: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?r1=105652&r2=105651&pathrev=105652 Visual Studio doesn't support LLU. I'm not sure how this should be corrected. 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(304) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(304) : error C2146: syntax error : missing '}' before identifier 'U' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(304) : error C2146: syntax error : missing '}' before identifier 'U' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(304) : error C2146: syntax error : missing ';' before identifier 'U' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(304) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(304) : error C2059: syntax error : 'constant' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(304) : error C2143: syntax error : missing ';' before '}' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(304) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(305) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(305) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(305) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(305) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(306) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(306) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(306) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(306) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(307) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(307) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(307) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(307) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(308) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(308) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(308) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(308) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(309) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(309) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(309) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(309) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(310) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(310) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(310) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(310) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(311) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(311) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(311) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(311) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(312) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(312) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(312) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(312) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(313) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(313) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(313) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(313) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(314) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(314) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(314) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(314) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(315) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(315) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(315) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(315) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(316) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(316) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(316) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(316) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(317) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(317) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(317) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(317) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(318) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(318) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(318) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(318) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(319) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(319) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(319) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(319) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(320) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(320) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(320) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(320) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(321) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(321) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(321) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(321) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(322) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(322) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(322) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(322) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(323) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(323) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(323) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(323) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(324) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(324) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(324) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(324) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(325) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(325) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(325) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(325) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(326) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(326) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(326) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(326) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(327) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(327) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(327) : error C2059: syntax error : 'bad suffix on number' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(327) : error C2059: syntax error : ',' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(328) : error C2143: syntax error : missing ';' before '{' 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(328) : error C2447: '{' : missing function header (old-style formal list?) 31>C:\Users\Michael\Projects\llvm-build\VS9\lib\Target\X86\X86GenInstrInfo.inc(328) : fatal error C1003: error count exceeds 100; stopping compilation - Michael Spencer -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100609/48522fac/attachment.html From aaronngray.lists at gmail.com Wed Jun 9 08:36:44 2010 From: aaronngray.lists at gmail.com (Aaron Gray) Date: Wed, 9 Jun 2010 14:36:44 +0100 Subject: [llvm-commits] VS2008 CMake build tabelgen coding error In-Reply-To: References: Message-ID: On 9 June 2010 14:20, Aaron Gray wrote: > I am getting 'bad suffix on number' > for lib\target\x86\X86GenInstrInfo.inc:304, 305, ... > > Tablegen is generating 0x0LLU instead of 0x0ULL and VS2008 does not like > it. > Patch attached. Aaron -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100609/bb59a373/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: tablegen.patch Type: application/octet-stream Size: 451 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100609/bb59a373/attachment.obj From echristo at apple.com Wed Jun 9 11:16:49 2010 From: echristo at apple.com (Eric Christopher) Date: Wed, 09 Jun 2010 16:16:49 -0000 Subject: [llvm-commits] [llvm] r105726 - /llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Message-ID: <20100609161649.166D42A6C12E@llvm.org> Author: echristo Date: Wed Jun 9 11:16:48 2010 New Revision: 105726 URL: http://llvm.org/viewvc/llvm-project?rev=105726&view=rev Log: How about ULL... Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=105726&r1=105725&r2=105726&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Wed Jun 9 11:16:48 2010 @@ -301,7 +301,7 @@ } OS << ", 0x"; OS.write_hex(Value); - OS << "LLU, "; + OS << "ULL, "; // Emit the implicit uses and defs lists... std::vector UseList = Inst.TheDef->getValueAsListOfDefs("Uses"); From evan.cheng at apple.com Wed Jun 9 11:17:04 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 09 Jun 2010 16:17:04 -0000 Subject: [llvm-commits] [test-suite] r105727 - in /test-suite/trunk: TEST.beta-compare.Makefile TEST.llcdbg.Makefile TEST.m2regllcdbg.Makefile Message-ID: <20100609161704.414D82A6C12E@llvm.org> Author: evancheng Date: Wed Jun 9 11:17:04 2010 New Revision: 105727 URL: http://llvm.org/viewvc/llvm-project?rev=105727&view=rev Log: llc -f option is gone. Modified: test-suite/trunk/TEST.beta-compare.Makefile test-suite/trunk/TEST.llcdbg.Makefile test-suite/trunk/TEST.m2regllcdbg.Makefile Modified: test-suite/trunk/TEST.beta-compare.Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/TEST.beta-compare.Makefile?rev=105727&r1=105726&r2=105727&view=diff ============================================================================== --- test-suite/trunk/TEST.beta-compare.Makefile (original) +++ test-suite/trunk/TEST.beta-compare.Makefile Wed Jun 9 11:17:04 2010 @@ -5,7 +5,7 @@ # ##===----------------------------------------------------------------------===## -LLC_OPTS = $(LLCFLAGS) -f -o=/dev/null -stats -time-passes +LLC_OPTS = $(LLCFLAGS) -o=/dev/null -stats -time-passes CURDIR := $(shell cd .; pwd) PROGDIR := $(PROJ_SRC_ROOT) RELDIR := $(subst $(PROGDIR),,$(CURDIR)) Modified: test-suite/trunk/TEST.llcdbg.Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/TEST.llcdbg.Makefile?rev=105727&r1=105726&r2=105727&view=diff ============================================================================== --- test-suite/trunk/TEST.llcdbg.Makefile (original) +++ test-suite/trunk/TEST.llcdbg.Makefile Wed Jun 9 11:17:04 2010 @@ -26,7 +26,7 @@ $(LOPT) -strip-debug-declare -strip-nondebug $< -f -o $@ Output/%.t1b.s: Output/%.t1a.bc Output/.dir $(LLC) - $(LLC) $(LLC_DEBUG_FLAGS) $< -f -o $@ + $(LLC) $(LLC_DEBUG_FLAGS) $< -o $@ Output/%.first.s: Output/%.t1b.s Output/.dir $(LLC) grep -v '.long' < $< | grep -v '.byte' | grep -v '.short' | grep -v '.asci' | grep -v '.quad' | grep -v '## DW_AT' | grep -v '## Abbrev' | grep -v '## End Of Children' | grep -v '## DIE' | grep -v '## $$' | grep -v '^$$' > $@ @@ -35,7 +35,7 @@ $(LOPT) -strip-nondebug $< -f -o $@ Output/%.t2b.s: Output/%.t2a.bc Output/.dir $(LLC) - $(LLC) $(LLC_DEBUG_FLAGS) $< -f -o $@ + $(LLC) $(LLC_DEBUG_FLAGS) $< -o $@ Output/%.second.s: Output/%.t2b.s Output/.dir grep -v DEBUG_VALUE < $< | grep -v '.long' | grep -v '.byte' | grep -v '.short' | grep -v '.asci' | grep -v '## DW_AT' | grep -v '## Abbrev' | grep -v '## End Of Children' | grep -v '## DIE' | grep -v '## $$' | grep -v '.quad' | grep -v '^$$' > $@ Modified: test-suite/trunk/TEST.m2regllcdbg.Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/TEST.m2regllcdbg.Makefile?rev=105727&r1=105726&r2=105727&view=diff ============================================================================== --- test-suite/trunk/TEST.m2regllcdbg.Makefile (original) +++ test-suite/trunk/TEST.m2regllcdbg.Makefile Wed Jun 9 11:17:04 2010 @@ -29,7 +29,7 @@ $(LOPT) -mem2reg $< -f -o $@ Output/%.t1c.s: Output/%.t1b.bc Output/.dir $(LLC) - $(LLC) $(LLC_DEBUG_FLAGS) $< -f -o $@ + $(LLC) $(LLC_DEBUG_FLAGS) $< -o $@ Output/%.first.s: Output/%.t1c.s Output/.dir $(LLC) grep -v '\.long' < $< | grep -v '\.byte' | grep -v '\.short' | grep -v '\.asci' | grep -v '\.quad' | grep -v '## DW_AT' | grep -v '## Abbrev' | grep -v '## End Of Children' | grep -v '## Extended Op' | grep -v 'Ltmp[0-9]' | grep -v '## DIE' | grep -v '## $$' | grep -v '^#.*' | grep -v '^$$' > $@ @@ -41,7 +41,7 @@ $(LOPT) -mem2reg $< -f -o $@ Output/%.t2c.s: Output/%.t2b.bc Output/.dir $(LLC) - $(LLC) $(LLC_DEBUG_FLAGS) $< -f -o $@ + $(LLC) $(LLC_DEBUG_FLAGS) $< -o $@ Output/%.second.s: Output/%.t2c.s Output/.dir grep -v DEBUG_VALUE < $< | grep -v '\.long' | grep -v '\.byte' | grep -v '\.short' | grep -v '\.asci' | grep -v '## DW_AT' | grep -v '## Abbrev' | grep -v '## End Of Children' | grep -v '## Extended Op' | grep -v 'Ltmp[0-9]' | grep -v '## DIE' | grep -v '## $$' | grep -v '\.quad' | grep -v '^#' | grep -v '^$$' > $@ From echristo at apple.com Wed Jun 9 11:17:06 2010 From: echristo at apple.com (Eric Christopher) Date: Wed, 9 Jun 2010 09:17:06 -0700 Subject: [llvm-commits] r105652 breaks the build with visual studio In-Reply-To: References: Message-ID: <3E773894-C244-45D2-AC42-2DA36A2F807A@apple.com> On Jun 9, 2010, at 2:25 AM, Bigcheese wrote: > http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?r1=105652&r2=105651&pathrev=105652 > > Visual Studio doesn't support LLU. I'm not sure how this should be corrected. > Let's go with ULL. :) -eric From wangmp at apple.com Wed Jun 9 11:31:32 2010 From: wangmp at apple.com (Mon Ping Wang) Date: Wed, 9 Jun 2010 09:31:32 -0700 Subject: [llvm-commits] Buggy SelectionDAG binop vector widening In-Reply-To: <4C0F3563.1040702@free.fr> References: <20100603132756.GA30866@cc.hut.fi> <86CAA4FC-4CE3-4E7E-B0A4-58DE974B9176@apple.com> <20100608092644.GB30866@cc.hut.fi> <097373B3-998A-4F32-8688-AF7CB8271F35@apple.com> <4C0F3563.1040702@free.fr> Message-ID: I'll take a look as well. -- Mon Ping On Jun 8, 2010, at 11:32 PM, Duncan Sands wrote: > Hi Dale, > >>> Thanks for the advice. I changed all three occurances of isTypeLegal to >>> isTypeSynthesizable in DAGTypeLegalizer::WidenVecRes_Binary. There are >>> still six other isTypeLegal call sites in LegalizeVectorTypes.cpp that >>> probably should be updated, but I didn't touch those for now. The >>> updated patch is attached. >> >> It looks OK to me but I am not expert in this code. Duncan, you wrote >> this didn't you? Can you look? > > Mon Ping wrote the vector widening stuff. I will try to take a look too. > > Ciao, > > Duncan. From sabre at nondot.org Wed Jun 9 11:38:50 2010 From: sabre at nondot.org (Chris Lattner) Date: Wed, 09 Jun 2010 16:38:50 -0000 Subject: [llvm-commits] [www] r105728 - /www/trunk/index.html Message-ID: <20100609163850.14EE12A6C12E@llvm.org> Author: lattner Date: Wed Jun 9 11:38:49 2010 New Revision: 105728 URL: http://llvm.org/viewvc/llvm-project?rev=105728&view=rev Log: add lldb to project list Modified: www/trunk/index.html Modified: www/trunk/index.html URL: http://llvm.org/viewvc/llvm-project/www/trunk/index.html?rev=105728&r1=105727&r2=105728&view=diff ============================================================================== --- www/trunk/index.html (original) +++ www/trunk/index.html Wed Jun 9 11:38:49 2010 @@ -56,6 +56,13 @@ Fortran, and other languages supported by the GCC compiler frontends, and provides high-fidelity drop-in compatibility with their respective versions of GCC.

  • + +
  • The LLDB project builds on + libraries provided by LLVM and Clang to provide a great native debugger. + It uses the Clang ASTs and expression parser, LLVM JIT, LLVM disassembler, + etc so that it provides an experience that "just works". It is also + blazing fast and much more memory efficient than GDB at loading symbols. +

  • The libc++ project provides a standard conformant and high-performance implementation of the C++ From dimitry at andric.com Wed Jun 9 11:54:18 2010 From: dimitry at andric.com (Dimitry Andric) Date: Wed, 09 Jun 2010 18:54:18 +0200 Subject: [llvm-commits] [LLVMdev] VS2008 CMake build tabelgen coding error In-Reply-To: References: Message-ID: <4C0FC73A.7070004@andric.com> On 2010-06-09 15:36, Aaron Gray wrote: >> Tablegen is generating 0x0LLU instead of 0x0ULL and VS2008 does not like >> it. Patch fixes the problem for me too. Weird that VC++ has no problems with ULL, but doesn't recognize LLU... From baldrick at free.fr Wed Jun 9 12:35:00 2010 From: baldrick at free.fr (Duncan Sands) Date: Wed, 09 Jun 2010 17:35:00 -0000 Subject: [llvm-commits] [llvm] r105730 - /llvm/trunk/tools/opt/PrintSCC.cpp Message-ID: <20100609173500.C45C02A6C12E@llvm.org> Author: baldrick Date: Wed Jun 9 12:35:00 2010 New Revision: 105730 URL: http://llvm.org/viewvc/llvm-project?rev=105730&view=rev Log: Output "external node" rather than "Indirect CallGraph node" when printing callgraph SCC's. This makes it match what the node itself would print. Also, "indirect callgraph node" doesn't make sense - it has nothing particularly to do with indirect calls. Modified: llvm/trunk/tools/opt/PrintSCC.cpp Modified: llvm/trunk/tools/opt/PrintSCC.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/PrintSCC.cpp?rev=105730&r1=105729&r2=105730&view=diff ============================================================================== --- llvm/trunk/tools/opt/PrintSCC.cpp (original) +++ llvm/trunk/tools/opt/PrintSCC.cpp Wed Jun 9 12:35:00 2010 @@ -102,7 +102,7 @@ for (std::vector::const_iterator I = nextSCC.begin(), E = nextSCC.end(); I != E; ++I) outs() << ((*I)->getFunction() ? (*I)->getFunction()->getNameStr() - : std::string("Indirect CallGraph node")) << ", "; + : std::string("external node")) << ", "; if (nextSCC.size() == 1 && SCCI.hasLoop()) outs() << " (Has self-loop)."; } From baldrick at free.fr Wed Jun 9 12:39:05 2010 From: baldrick at free.fr (Duncan Sands) Date: Wed, 09 Jun 2010 17:39:05 -0000 Subject: [llvm-commits] [llvm] r105731 - /llvm/trunk/tools/opt/GraphPrinters.cpp Message-ID: <20100609173905.9A5F72A6C12E@llvm.org> Author: baldrick Date: Wed Jun 9 12:39:05 2010 New Revision: 105731 URL: http://llvm.org/viewvc/llvm-project?rev=105731&view=rev Log: Change another reference to the "indirect callgraph node" to refer to the "external node" instead. Modified: llvm/trunk/tools/opt/GraphPrinters.cpp Modified: llvm/trunk/tools/opt/GraphPrinters.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/GraphPrinters.cpp?rev=105731&r1=105730&r2=105731&view=diff ============================================================================== --- llvm/trunk/tools/opt/GraphPrinters.cpp (original) +++ llvm/trunk/tools/opt/GraphPrinters.cpp Wed Jun 9 12:39:05 2010 @@ -56,7 +56,7 @@ if (Node->getFunction()) return ((Value*)Node->getFunction())->getName(); else - return "Indirect call node"; + return "external node"; } }; } From daniel at zuster.org Wed Jun 9 12:54:40 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Wed, 09 Jun 2010 17:54:40 -0000 Subject: [llvm-commits] [llvm] r105732 - /llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll Message-ID: <20100609175440.908882A6C130@llvm.org> Author: ddunbar Date: Wed Jun 9 12:54:40 2010 New Revision: 105732 URL: http://llvm.org/viewvc/llvm-project?rev=105732&view=rev Log: Workaround SCEV non-determinism on this test, for now, to get buildbots back to green. Dan, please revert this once the real problem is fixed. Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll?rev=105732&r1=105731&r2=105732&view=diff ============================================================================== --- llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll (original) +++ llvm/trunk/test/Analysis/ScalarEvolution/2008-07-29-SMinExpr.ll Wed Jun 9 12:54:40 2010 @@ -22,5 +22,5 @@ ret i32 %j.0.lcssa } -; CHECK: backedge-taken count is (-2147483632 + ((-1 + (-1 * %y)) smax (-1 + (-1 * %x)))) +; CHECK: backedge-taken count is (-2147483632 + ((-1 + (-1 * %{{[xy]}})) smax (-1 + (-1 * %{{[xy]}})))) From natebegeman at mac.com Wed Jun 9 13:02:26 2010 From: natebegeman at mac.com (Nate Begeman) Date: Wed, 09 Jun 2010 18:02:26 -0000 Subject: [llvm-commits] [llvm] r105733 - /llvm/trunk/utils/TableGen/NeonEmitter.cpp Message-ID: <20100609180226.47FC62A6C130@llvm.org> Author: sampo Date: Wed Jun 9 13:02:26 2010 New Revision: 105733 URL: http://llvm.org/viewvc/llvm-project?rev=105733&view=rev Log: Further refine types for operations which take scalars. This will be used primarily by NEON shift intrinsics. Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105733&r1=105732&r2=105733&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Wed Jun 9 13:02:26 2010 @@ -310,13 +310,13 @@ return quad ? "V48c" : "V24c"; if (mod == '4') return quad ? "V64c" : "V32c"; - if (mod == 'f' || (ck == ClassI && type == 'f')) + if (mod == 'f' || (ck != ClassB && type == 'f')) return quad ? "V4f" : "V2f"; - if (ck == ClassI && type == 's') + if (ck != ClassB && type == 's') return quad ? "V8s" : "V4s"; - if (ck == ClassI && type == 'i') + if (ck != ClassB && type == 'i') return quad ? "V4i" : "V2i"; - if (ck == ClassI && type == 'l') + if (ck != ClassB && type == 'l') return quad ? "V2LLi" : "V1LLi"; return quad ? "V16c" : "V8c"; @@ -330,13 +330,13 @@ if (mod == '4') return quad ? "V16cV16cV16cV16c" : "V8cV8cV8cV8c"; - if (mod == 'f' || (ck == ClassI && type == 'f')) + if (mod == 'f' || (ck != ClassB && type == 'f')) return quad ? "V4f" : "V2f"; - if (ck == ClassI && type == 's') + if (ck != ClassB && type == 's') return quad ? "V8s" : "V4s"; - if (ck == ClassI && type == 'i') + if (ck != ClassB && type == 'i') return quad ? "V4i" : "V2i"; - if (ck == ClassI && type == 'l') + if (ck != ClassB && type == 'l') return quad ? "V2LLi" : "V1LLi"; return quad ? "V16c" : "V8c"; From isanbard at gmail.com Wed Jun 9 13:15:37 2010 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 09 Jun 2010 18:15:37 -0000 Subject: [llvm-commits] [llvm] r105735 - /llvm/trunk/include/llvm/Target/TargetOpcodes.h Message-ID: <20100609181537.175F52A6C12E@llvm.org> Author: void Date: Wed Jun 9 13:15:36 2010 New Revision: 105735 URL: http://llvm.org/viewvc/llvm-project?rev=105735&view=rev Log: - Fix description of SUBREG_TO_REG. It's not going to generate a zext. But it is used to assert that an *implicit* zext is performed. - Fix grammar-o in INSERT_SUBREG. (required reformatting) Modified: llvm/trunk/include/llvm/Target/TargetOpcodes.h Modified: llvm/trunk/include/llvm/Target/TargetOpcodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOpcodes.h?rev=105735&r1=105734&r2=105735&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetOpcodes.h (original) +++ llvm/trunk/include/llvm/Target/TargetOpcodes.h Wed Jun 9 13:15:36 2010 @@ -36,22 +36,21 @@ /// truncation operations on target architectures which support it. EXTRACT_SUBREG = 6, - /// INSERT_SUBREG - This instruction takes three operands: a register - /// that has subregisters, a register providing an insert value, and a - /// subregister index. It returns the value of the first register with - /// the value of the second register inserted. The first register is - /// often defined by an IMPLICIT_DEF, as is commonly used to implement + /// INSERT_SUBREG - This instruction takes three operands: a register that + /// has subregisters, a register providing an insert value, and a + /// subregister index. It returns the value of the first register with the + /// value of the second register inserted. The first register is often + /// defined by an IMPLICIT_DEF, because it is commonly used to implement /// anyext operations on target architectures which support it. INSERT_SUBREG = 7, /// IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef. IMPLICIT_DEF = 8, - /// SUBREG_TO_REG - This instruction is similar to INSERT_SUBREG except - /// that the first operand is an immediate integer constant. This constant - /// is often zero, as is commonly used to implement zext operations on - /// target architectures which support it, such as with x86-64 (with - /// zext from i32 to i64 via implicit zero-extension). + /// SUBREG_TO_REG - This instruction is similar to INSERT_SUBREG except that + /// the first operand is an immediate integer constant. This constant is + /// often zero, because it is commonly used to assert that the instruction + /// defining the register implicitly clears the high bits. SUBREG_TO_REG = 9, /// COPY_TO_REGCLASS - This instruction is a placeholder for a plain From bruno.cardoso at gmail.com Wed Jun 9 13:21:13 2010 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Wed, 9 Jun 2010 11:21:13 -0700 Subject: [llvm-commits] [llvm] r105726 - /llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp In-Reply-To: <20100609161649.166D42A6C12E@llvm.org> References: <20100609161649.166D42A6C12E@llvm.org> Message-ID: Thanks :) On Wed, Jun 9, 2010 at 9:16 AM, Eric Christopher wrote: > Author: echristo > Date: Wed Jun ?9 11:16:48 2010 > New Revision: 105726 > > URL: http://llvm.org/viewvc/llvm-project?rev=105726&view=rev > Log: > How about ULL... > > Modified: > ? ?llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp > > Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=105726&r1=105725&r2=105726&view=diff > ============================================================================== > --- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original) > +++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Wed Jun ?9 11:16:48 2010 > @@ -301,7 +301,7 @@ > ? } > ? OS << ", 0x"; > ? OS.write_hex(Value); > - ?OS << "LLU, "; > + ?OS << "ULL, "; > > ? // Emit the implicit uses and defs lists... > ? std::vector UseList = Inst.TheDef->getValueAsListOfDefs("Uses"); > > > _______________________________________________ > 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 evan.cheng at apple.com Wed Jun 9 13:59:43 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 09 Jun 2010 18:59:43 -0000 Subject: [llvm-commits] [llvm] r105740 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h include/llvm/Analysis/ScalarEvolutionExpressions.h lib/Analysis/ScalarEvolution.cpp Message-ID: <20100609185943.827592A6C12E@llvm.org> Author: evancheng Date: Wed Jun 9 13:59:43 2010 New Revision: 105740 URL: http://llvm.org/viewvc/llvm-project?rev=105740&view=rev Log: Revert 105540, 105542, 105544, 105546, and 105548 to unbreak bootstrapping. Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.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=105740&r1=105739&r2=105740&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Wed Jun 9 13:59:43 2010 @@ -54,10 +54,6 @@ /// The ScalarEvolution's BumpPtrAllocator holds the data. FoldingSetNodeIDRef FastID; - /// AllocationSequenceNumber - This is used as a deterministic tie - /// breaker when sorting SCEVs. - unsigned AllocationSequenceNumber; - // The SCEV baseclass this node corresponds to const unsigned short SCEVType; @@ -72,18 +68,11 @@ protected: virtual ~SCEV(); public: - explicit SCEV(const FoldingSetNodeIDRef ID, unsigned num, unsigned SCEVTy) : - FastID(ID), AllocationSequenceNumber(num), - SCEVType(SCEVTy), SubclassData(0) {} + explicit SCEV(const FoldingSetNodeIDRef ID, unsigned SCEVTy) : + FastID(ID), SCEVType(SCEVTy), SubclassData(0) {} unsigned getSCEVType() const { return SCEVType; } - /// getAllocationSequenceNumber - Return an arbitrary value which can be - /// used to deterministically order a sequence of SCEVs. - unsigned getAllocationSequenceNumber() const { - return AllocationSequenceNumber; - } - /// Profile - FoldingSet support. void Profile(FoldingSetNodeID& ID) { ID = FastID; } @@ -678,7 +667,6 @@ private: FoldingSet UniqueSCEVs; BumpPtrAllocator SCEVAllocator; - unsigned CurAllocationSequenceNumber; }; } Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=105740&r1=105739&r2=105740&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h (original) +++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpressions.h Wed Jun 9 13:59:43 2010 @@ -37,8 +37,8 @@ friend class ScalarEvolution; ConstantInt *V; - SCEVConstant(const FoldingSetNodeIDRef ID, unsigned Num, ConstantInt *v) - : SCEV(ID, Num, scConstant), V(v) {} + SCEVConstant(const FoldingSetNodeIDRef ID, ConstantInt *v) : + SCEV(ID, scConstant), V(v) {} public: ConstantInt *getValue() const { return V; } @@ -81,7 +81,7 @@ const SCEV *Op; const Type *Ty; - SCEVCastExpr(const FoldingSetNodeIDRef ID, unsigned Num, + SCEVCastExpr(const FoldingSetNodeIDRef ID, unsigned SCEVTy, const SCEV *op, const Type *ty); public: @@ -120,7 +120,7 @@ class SCEVTruncateExpr : public SCEVCastExpr { friend class ScalarEvolution; - SCEVTruncateExpr(const FoldingSetNodeIDRef ID, unsigned Num, + SCEVTruncateExpr(const FoldingSetNodeIDRef ID, const SCEV *op, const Type *ty); public: @@ -140,7 +140,7 @@ class SCEVZeroExtendExpr : public SCEVCastExpr { friend class ScalarEvolution; - SCEVZeroExtendExpr(const FoldingSetNodeIDRef ID, unsigned Num, + SCEVZeroExtendExpr(const FoldingSetNodeIDRef ID, const SCEV *op, const Type *ty); public: @@ -160,7 +160,7 @@ class SCEVSignExtendExpr : public SCEVCastExpr { friend class ScalarEvolution; - SCEVSignExtendExpr(const FoldingSetNodeIDRef ID, unsigned Num, + SCEVSignExtendExpr(const FoldingSetNodeIDRef ID, const SCEV *op, const Type *ty); public: @@ -187,9 +187,9 @@ const SCEV *const *Operands; size_t NumOperands; - SCEVNAryExpr(const FoldingSetNodeIDRef ID, unsigned Num, + SCEVNAryExpr(const FoldingSetNodeIDRef ID, enum SCEVTypes T, const SCEV *const *O, size_t N) - : SCEV(ID, Num, T), Operands(O), NumOperands(N) {} + : SCEV(ID, T), Operands(O), NumOperands(N) {} public: size_t getNumOperands() const { return NumOperands; } @@ -262,9 +262,9 @@ /// class SCEVCommutativeExpr : public SCEVNAryExpr { protected: - SCEVCommutativeExpr(const FoldingSetNodeIDRef ID, unsigned Num, + SCEVCommutativeExpr(const FoldingSetNodeIDRef ID, enum SCEVTypes T, const SCEV *const *O, size_t N) - : SCEVNAryExpr(ID, Num, T, O, N) {} + : SCEVNAryExpr(ID, T, O, N) {} public: virtual const char *getOperationStr() const = 0; @@ -288,9 +288,9 @@ class SCEVAddExpr : public SCEVCommutativeExpr { friend class ScalarEvolution; - SCEVAddExpr(const FoldingSetNodeIDRef ID, unsigned Num, + SCEVAddExpr(const FoldingSetNodeIDRef ID, const SCEV *const *O, size_t N) - : SCEVCommutativeExpr(ID, Num, scAddExpr, O, N) { + : SCEVCommutativeExpr(ID, scAddExpr, O, N) { } public: @@ -316,9 +316,9 @@ class SCEVMulExpr : public SCEVCommutativeExpr { friend class ScalarEvolution; - SCEVMulExpr(const FoldingSetNodeIDRef ID, unsigned Num, + SCEVMulExpr(const FoldingSetNodeIDRef ID, const SCEV *const *O, size_t N) - : SCEVCommutativeExpr(ID, Num, scMulExpr, O, N) { + : SCEVCommutativeExpr(ID, scMulExpr, O, N) { } public: @@ -340,9 +340,8 @@ const SCEV *LHS; const SCEV *RHS; - SCEVUDivExpr(const FoldingSetNodeIDRef ID, unsigned Num, - const SCEV *lhs, const SCEV *rhs) - : SCEV(ID, Num, scUDivExpr), LHS(lhs), RHS(rhs) {} + SCEVUDivExpr(const FoldingSetNodeIDRef ID, const SCEV *lhs, const SCEV *rhs) + : SCEV(ID, scUDivExpr), LHS(lhs), RHS(rhs) {} public: const SCEV *getLHS() const { return LHS; } @@ -391,9 +390,9 @@ const Loop *L; - SCEVAddRecExpr(const FoldingSetNodeIDRef ID, unsigned Num, + SCEVAddRecExpr(const FoldingSetNodeIDRef ID, const SCEV *const *O, size_t N, const Loop *l) - : SCEVNAryExpr(ID, Num, scAddRecExpr, O, N), L(l) { + : SCEVNAryExpr(ID, scAddRecExpr, O, N), L(l) { for (size_t i = 0, e = NumOperands; i != e; ++i) assert(Operands[i]->isLoopInvariant(l) && "Operands of AddRec must be loop-invariant!"); @@ -473,9 +472,9 @@ class SCEVSMaxExpr : public SCEVCommutativeExpr { friend class ScalarEvolution; - SCEVSMaxExpr(const FoldingSetNodeIDRef ID, unsigned Num, + SCEVSMaxExpr(const FoldingSetNodeIDRef ID, const SCEV *const *O, size_t N) - : SCEVCommutativeExpr(ID, Num, scSMaxExpr, O, N) { + : SCEVCommutativeExpr(ID, scSMaxExpr, O, N) { // Max never overflows. setHasNoUnsignedWrap(true); setHasNoSignedWrap(true); @@ -498,9 +497,9 @@ class SCEVUMaxExpr : public SCEVCommutativeExpr { friend class ScalarEvolution; - SCEVUMaxExpr(const FoldingSetNodeIDRef ID, unsigned Num, + SCEVUMaxExpr(const FoldingSetNodeIDRef ID, const SCEV *const *O, size_t N) - : SCEVCommutativeExpr(ID, Num, scUMaxExpr, O, N) { + : SCEVCommutativeExpr(ID, scUMaxExpr, O, N) { // Max never overflows. setHasNoUnsignedWrap(true); setHasNoSignedWrap(true); @@ -525,8 +524,8 @@ friend class ScalarEvolution; Value *V; - SCEVUnknown(const FoldingSetNodeIDRef ID, unsigned Num, Value *v) - : SCEV(ID, Num, scUnknown), V(v) {} + SCEVUnknown(const FoldingSetNodeIDRef ID, Value *v) : + SCEV(ID, scUnknown), V(v) {} public: Value *getValue() const { return V; } Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=105740&r1=105739&r2=105740&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Jun 9 13:59:43 2010 @@ -141,7 +141,7 @@ } SCEVCouldNotCompute::SCEVCouldNotCompute() : - SCEV(FoldingSetNodeIDRef(), 0, scCouldNotCompute) {} + SCEV(FoldingSetNodeIDRef(), scCouldNotCompute) {} bool SCEVCouldNotCompute::isLoopInvariant(const Loop *L) const { llvm_unreachable("Attempt to use a SCEVCouldNotCompute object!"); @@ -177,9 +177,7 @@ ID.AddPointer(V); void *IP = 0; if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; - SCEV *S = new (SCEVAllocator) SCEVConstant(ID.Intern(SCEVAllocator), - CurAllocationSequenceNumber++, - V); + SCEV *S = new (SCEVAllocator) SCEVConstant(ID.Intern(SCEVAllocator), V); UniqueSCEVs.InsertNode(S, IP); return S; } @@ -200,9 +198,9 @@ WriteAsOperand(OS, V, false); } -SCEVCastExpr::SCEVCastExpr(const FoldingSetNodeIDRef ID, unsigned Num, +SCEVCastExpr::SCEVCastExpr(const FoldingSetNodeIDRef ID, unsigned SCEVTy, const SCEV *op, const Type *ty) - : SCEV(ID, Num, SCEVTy), Op(op), Ty(ty) {} + : SCEV(ID, SCEVTy), Op(op), Ty(ty) {} bool SCEVCastExpr::dominates(BasicBlock *BB, DominatorTree *DT) const { return Op->dominates(BB, DT); @@ -212,9 +210,9 @@ return Op->properlyDominates(BB, DT); } -SCEVTruncateExpr::SCEVTruncateExpr(const FoldingSetNodeIDRef ID, unsigned Num, +SCEVTruncateExpr::SCEVTruncateExpr(const FoldingSetNodeIDRef ID, const SCEV *op, const Type *ty) - : SCEVCastExpr(ID, Num, scTruncate, op, ty) { + : SCEVCastExpr(ID, scTruncate, op, ty) { assert((Op->getType()->isIntegerTy() || Op->getType()->isPointerTy()) && (Ty->isIntegerTy() || Ty->isPointerTy()) && "Cannot truncate non-integer value!"); @@ -224,9 +222,9 @@ OS << "(trunc " << *Op->getType() << " " << *Op << " to " << *Ty << ")"; } -SCEVZeroExtendExpr::SCEVZeroExtendExpr(const FoldingSetNodeIDRef ID, unsigned Num, +SCEVZeroExtendExpr::SCEVZeroExtendExpr(const FoldingSetNodeIDRef ID, const SCEV *op, const Type *ty) - : SCEVCastExpr(ID, Num, scZeroExtend, op, ty) { + : SCEVCastExpr(ID, scZeroExtend, op, ty) { assert((Op->getType()->isIntegerTy() || Op->getType()->isPointerTy()) && (Ty->isIntegerTy() || Ty->isPointerTy()) && "Cannot zero extend non-integer value!"); @@ -236,9 +234,9 @@ OS << "(zext " << *Op->getType() << " " << *Op << " to " << *Ty << ")"; } -SCEVSignExtendExpr::SCEVSignExtendExpr(const FoldingSetNodeIDRef ID, unsigned Num, +SCEVSignExtendExpr::SCEVSignExtendExpr(const FoldingSetNodeIDRef ID, const SCEV *op, const Type *ty) - : SCEVCastExpr(ID, Num, scSignExtend, op, ty) { + : SCEVCastExpr(ID, scSignExtend, op, ty) { assert((Op->getType()->isIntegerTy() || Op->getType()->isPointerTy()) && (Ty->isIntegerTy() || Ty->isPointerTy()) && "Cannot sign extend non-integer value!"); @@ -507,14 +505,109 @@ return false; // Primarily, sort the SCEVs by their getSCEVType(). - unsigned LST = LHS->getSCEVType(); - unsigned RST = RHS->getSCEVType(); - if (LST != RST) - return LST < RST; - - // Then, pick an arbitrary deterministic sort. - return LHS->getAllocationSequenceNumber() < - RHS->getAllocationSequenceNumber(); + if (LHS->getSCEVType() != RHS->getSCEVType()) + return LHS->getSCEVType() < RHS->getSCEVType(); + + // Aside from the getSCEVType() ordering, the particular ordering + // isn't very important except that it's beneficial to be consistent, + // so that (a + b) and (b + a) don't end up as different expressions. + + // Sort SCEVUnknown values with some loose heuristics. TODO: This is + // not as complete as it could be. + if (const SCEVUnknown *LU = dyn_cast(LHS)) { + const SCEVUnknown *RU = cast(RHS); + + // Order pointer values after integer values. This helps SCEVExpander + // form GEPs. + if (LU->getType()->isPointerTy() && !RU->getType()->isPointerTy()) + return false; + if (RU->getType()->isPointerTy() && !LU->getType()->isPointerTy()) + return true; + + // Compare getValueID values. + if (LU->getValue()->getValueID() != RU->getValue()->getValueID()) + return LU->getValue()->getValueID() < RU->getValue()->getValueID(); + + // Sort arguments by their position. + if (const Argument *LA = dyn_cast(LU->getValue())) { + const Argument *RA = cast(RU->getValue()); + return LA->getArgNo() < RA->getArgNo(); + } + + // For instructions, compare their loop depth, and their opcode. + // This is pretty loose. + if (Instruction *LV = dyn_cast(LU->getValue())) { + Instruction *RV = cast(RU->getValue()); + + // Compare loop depths. + if (LI->getLoopDepth(LV->getParent()) != + LI->getLoopDepth(RV->getParent())) + return LI->getLoopDepth(LV->getParent()) < + LI->getLoopDepth(RV->getParent()); + + // Compare opcodes. + if (LV->getOpcode() != RV->getOpcode()) + return LV->getOpcode() < RV->getOpcode(); + + // Compare the number of operands. + if (LV->getNumOperands() != RV->getNumOperands()) + return LV->getNumOperands() < RV->getNumOperands(); + } + + return false; + } + + // Compare constant values. + if (const SCEVConstant *LC = dyn_cast(LHS)) { + const SCEVConstant *RC = cast(RHS); + if (LC->getValue()->getBitWidth() != RC->getValue()->getBitWidth()) + return LC->getValue()->getBitWidth() < RC->getValue()->getBitWidth(); + 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)) { + const SCEVNAryExpr *RC = cast(RHS); + for (unsigned i = 0, e = LC->getNumOperands(); i != e; ++i) { + if (i >= RC->getNumOperands()) + return false; + if (operator()(LC->getOperand(i), RC->getOperand(i))) + return true; + if (operator()(RC->getOperand(i), LC->getOperand(i))) + return false; + } + return LC->getNumOperands() < RC->getNumOperands(); + } + + // Lexicographically compare udiv expressions. + if (const SCEVUDivExpr *LC = dyn_cast(LHS)) { + const SCEVUDivExpr *RC = cast(RHS); + if (operator()(LC->getLHS(), RC->getLHS())) + return true; + if (operator()(RC->getLHS(), LC->getLHS())) + return false; + if (operator()(LC->getRHS(), RC->getRHS())) + return true; + if (operator()(RC->getRHS(), LC->getRHS())) + return false; + return false; + } + + // Compare cast expressions by operand. + if (const SCEVCastExpr *LC = dyn_cast(LHS)) { + const SCEVCastExpr *RC = cast(RHS); + return operator()(LC->getOperand(), RC->getOperand()); + } + + llvm_unreachable("Unknown SCEV kind!"); + return false; } }; } @@ -532,18 +625,36 @@ static void GroupByComplexity(SmallVectorImpl &Ops, LoopInfo *LI) { if (Ops.size() < 2) return; // Noop - - SCEVComplexityCompare Comp(LI); - if (Ops.size() == 2) { // This is the common case, which also happens to be trivially simple. // Special case it. - if (Comp(Ops[1], Ops[0])) + if (SCEVComplexityCompare(LI)(Ops[1], Ops[0])) std::swap(Ops[0], Ops[1]); return; } - std::stable_sort(Ops.begin(), Ops.end(), Comp); + // Do the rough sort by complexity. + std::stable_sort(Ops.begin(), Ops.end(), SCEVComplexityCompare(LI)); + + // Now that we are sorted by complexity, group elements of the same + // complexity. Note that this is, at worst, N^2, but the vector is likely to + // be extremely short in practice. Note that we take this approach because we + // do not want to depend on the addresses of the objects we are grouping. + for (unsigned i = 0, e = Ops.size(); i != e-2; ++i) { + const SCEV *S = Ops[i]; + unsigned Complexity = S->getSCEVType(); + + // If there are any objects of the same complexity and same value as this + // one, group them. + for (unsigned j = i+1; j != e && Ops[j]->getSCEVType() == Complexity; ++j) { + if (Ops[j] == S) { // Found a duplicate. + // Move it to immediately after i'th element. + std::swap(Ops[i+1], Ops[j]); + ++i; // no need to rescan it. + if (i == e-2) return; // Done! + } + } + } } @@ -737,7 +848,6 @@ // Recompute the insert position, as it may have been invalidated. if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; SCEV *S = new (SCEVAllocator) SCEVTruncateExpr(ID.Intern(SCEVAllocator), - CurAllocationSequenceNumber++, Op, Ty); UniqueSCEVs.InsertNode(S, IP); return S; @@ -873,7 +983,6 @@ // Recompute the insert position, as it may have been invalidated. if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; SCEV *S = new (SCEVAllocator) SCEVZeroExtendExpr(ID.Intern(SCEVAllocator), - CurAllocationSequenceNumber++, Op, Ty); UniqueSCEVs.InsertNode(S, IP); return S; @@ -1009,7 +1118,6 @@ // Recompute the insert position, as it may have been invalidated. if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; SCEV *S = new (SCEVAllocator) SCEVSignExtendExpr(ID.Intern(SCEVAllocator), - CurAllocationSequenceNumber++, Op, Ty); UniqueSCEVs.InsertNode(S, IP); return S; @@ -1100,19 +1208,8 @@ ScalarEvolution &SE) { bool Interesting = false; - // Iterate over the add operands. They are sorted, with constants first. - unsigned i = 0; - while (const SCEVConstant *C = dyn_cast(Ops[i])) { - ++i; - // Pull a buried constant out to the outside. - if (Scale != 1 || AccumulatedConstant != 0 || C->getValue()->isZero()) - Interesting = true; - AccumulatedConstant += Scale * C->getValue()->getValue(); - } - - // Next comes everything else. We're especially interested in multiplies - // here, but they're in the middle, so just visit the rest with one loop. - for (; i != NumOperands; ++i) { + // Iterate over the add operands. + for (unsigned i = 0, e = NumOperands; i != e; ++i) { const SCEVMulExpr *Mul = dyn_cast(Ops[i]); if (Mul && isa(Mul->getOperand(0))) { APInt NewScale = @@ -1140,6 +1237,11 @@ 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->getValue()->isZero()) + Interesting = true; + AccumulatedConstant += Scale * C->getValue()->getValue(); } else { // An ordinary operand. Update the map. std::pair::iterator, bool> Pair = @@ -1173,9 +1275,9 @@ assert(!Ops.empty() && "Cannot get empty add!"); if (Ops.size() == 1) return Ops[0]; #ifndef NDEBUG - const Type *ETy = getEffectiveSCEVType(Ops[0]->getType()); for (unsigned i = 1, e = Ops.size(); i != e; ++i) - assert(getEffectiveSCEVType(Ops[i]->getType()) == ETy && + assert(getEffectiveSCEVType(Ops[i]->getType()) == + getEffectiveSCEVType(Ops[0]->getType()) && "SCEVAddExpr operand types don't match!"); #endif @@ -1511,7 +1613,6 @@ const SCEV **O = SCEVAllocator.Allocate(Ops.size()); std::uninitialized_copy(Ops.begin(), Ops.end(), O); S = new (SCEVAllocator) SCEVAddExpr(ID.Intern(SCEVAllocator), - CurAllocationSequenceNumber++, O, Ops.size()); UniqueSCEVs.InsertNode(S, IP); } @@ -1722,7 +1823,6 @@ const SCEV **O = SCEVAllocator.Allocate(Ops.size()); std::uninitialized_copy(Ops.begin(), Ops.end(), O); S = new (SCEVAllocator) SCEVMulExpr(ID.Intern(SCEVAllocator), - CurAllocationSequenceNumber++, O, Ops.size()); UniqueSCEVs.InsertNode(S, IP); } @@ -1827,7 +1927,6 @@ void *IP = 0; if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; SCEV *S = new (SCEVAllocator) SCEVUDivExpr(ID.Intern(SCEVAllocator), - CurAllocationSequenceNumber++, LHS, RHS); UniqueSCEVs.InsertNode(S, IP); return S; @@ -1939,7 +2038,6 @@ const SCEV **O = SCEVAllocator.Allocate(Operands.size()); std::uninitialized_copy(Operands.begin(), Operands.end(), O); S = new (SCEVAllocator) SCEVAddRecExpr(ID.Intern(SCEVAllocator), - CurAllocationSequenceNumber++, O, Operands.size(), L); UniqueSCEVs.InsertNode(S, IP); } @@ -2048,7 +2146,6 @@ const SCEV **O = SCEVAllocator.Allocate(Ops.size()); std::uninitialized_copy(Ops.begin(), Ops.end(), O); SCEV *S = new (SCEVAllocator) SCEVSMaxExpr(ID.Intern(SCEVAllocator), - CurAllocationSequenceNumber++, O, Ops.size()); UniqueSCEVs.InsertNode(S, IP); return S; @@ -2154,7 +2251,6 @@ const SCEV **O = SCEVAllocator.Allocate(Ops.size()); std::uninitialized_copy(Ops.begin(), Ops.end(), O); SCEV *S = new (SCEVAllocator) SCEVUMaxExpr(ID.Intern(SCEVAllocator), - CurAllocationSequenceNumber++, O, Ops.size()); UniqueSCEVs.InsertNode(S, IP); return S; @@ -2235,9 +2331,7 @@ ID.AddPointer(V); void *IP = 0; if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S; - SCEV *S = new (SCEVAllocator) SCEVUnknown(ID.Intern(SCEVAllocator), - CurAllocationSequenceNumber++, - V); + SCEV *S = new (SCEVAllocator) SCEVUnknown(ID.Intern(SCEVAllocator), V); UniqueSCEVs.InsertNode(S, IP); return S; } @@ -5597,7 +5691,7 @@ //===----------------------------------------------------------------------===// ScalarEvolution::ScalarEvolution() - : FunctionPass(&ID), CurAllocationSequenceNumber(0) { + : FunctionPass(&ID) { } bool ScalarEvolution::runOnFunction(Function &F) { From isanbard at gmail.com Wed Jun 9 14:00:55 2010 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 09 Jun 2010 19:00:55 -0000 Subject: [llvm-commits] [llvm] r105741 - /llvm/trunk/lib/CodeGen/OptimizeExts.cpp Message-ID: <20100609190055.48DFB2A6C12E@llvm.org> Author: void Date: Wed Jun 9 14:00:55 2010 New Revision: 105741 URL: http://llvm.org/viewvc/llvm-project?rev=105741&view=rev Log: It's an error to translate this: %reg1025 = %reg1024 ... %reg1026 = SUBREG_TO_REG 0, %reg1024, 4 into this: %reg1025 = %reg1024 ... %reg1027 = EXTRACT_SUBREG %reg1025, 4 %reg1026 = SUBREG_TO_REG 0, %reg1027, 4 The problem here is that SUBREG_TO_REG is there to assert that an implicit zext occurs. It doesn't insert a zext instruction. If we allow the EXTRACT_SUBREG here, it will give us the value after the , not the original value of %reg1024 before . Modified: llvm/trunk/lib/CodeGen/OptimizeExts.cpp Modified: llvm/trunk/lib/CodeGen/OptimizeExts.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/OptimizeExts.cpp?rev=105741&r1=105740&r2=105741&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/OptimizeExts.cpp (original) +++ llvm/trunk/lib/CodeGen/OptimizeExts.cpp Wed Jun 9 14:00:55 2010 @@ -118,6 +118,26 @@ continue; } + // It's an error to translate this: + // + // %reg1025 = %reg1024 + // ... + // %reg1026 = SUBREG_TO_REG 0, %reg1024, 4 + // + // into this: + // + // %reg1025 = %reg1024 + // ... + // %reg1027 = EXTRACT_SUBREG %reg1025, 4 + // %reg1026 = SUBREG_TO_REG 0, %reg1027, 4 + // + // The problem here is that SUBREG_TO_REG is there to assert that an + // implicit zext occurs. It doesn't insert a zext instruction. If we allow + // the EXTRACT_SUBREG here, it will give us the value after the , + // not the original value of %reg1024 before . + if (UseMI->getOpcode() == TargetOpcode::SUBREG_TO_REG) + continue; + MachineBasicBlock *UseMBB = UseMI->getParent(); if (UseMBB == MBB) { // Local uses that come after the extension. From evan.cheng at apple.com Wed Jun 9 14:26:01 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 09 Jun 2010 19:26:01 -0000 Subject: [llvm-commits] [llvm] r105745 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/TwoAddressInstructionPass.cpp lib/Target/ARM/Thumb2ITBlockPass.cpp lib/Target/ARM/Thumb2InstrInfo.cpp lib/Target/ARM/Thumb2InstrInfo.h Message-ID: <20100609192601.414472A6C12E@llvm.org> Author: evancheng Date: Wed Jun 9 14:26:01 2010 New Revision: 105745 URL: http://llvm.org/viewvc/llvm-project?rev=105745&view=rev Log: Allow target to place 2-address pass inserted copies in better spots. Thumb2 will use this to try to avoid breaking up IT blocks. Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=105745&r1=105744&r2=105745&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Wed Jun 9 14:26:01 2010 @@ -203,6 +203,14 @@ const MachineInstr *Orig, const TargetRegisterInfo &TRI) const = 0; + /// scheduleTwoAddrSource - Schedule the copy / re-mat of the source of the + /// two-addrss instruction inserted by two-address pass. + virtual void scheduleTwoAddrSource(MachineInstr *SrcMI, + MachineInstr *UseMI, + const TargetRegisterInfo &TRI) const { + // Do nothing. + } + /// duplicate - Create a duplicate of the Orig instruction in MF. This is like /// MachineFunction::CloneMachineInstr(), but the target may update operands /// that are required to be unique. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=105745&r1=105744&r2=105745&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed Jun 9 14:26:01 2010 @@ -1104,7 +1104,12 @@ } } } - + + // Schedule the source copy / remat inserted to form two-address + // instruction. FIXME: Does it matter the distance map may not be + // accurate after it's scheduled? + TII->scheduleTwoAddrSource(prior(mi), mi, *TRI); + MadeChange = true; DEBUG(dbgs() << "\t\trewrite to:\t" << *mi); Modified: llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp?rev=105745&r1=105744&r2=105745&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp Wed Jun 9 14:26:01 2010 @@ -61,15 +61,7 @@ unsigned Opc = MI->getOpcode(); if (Opc == ARM::tBcc || Opc == ARM::t2Bcc) return ARMCC::AL; - - int PIdx = MI->findFirstPredOperandIdx(); - if (PIdx == -1) { - PredReg = 0; - return ARMCC::AL; - } - - PredReg = MI->getOperand(PIdx+1).getReg(); - return (ARMCC::CondCodes)MI->getOperand(PIdx).getImm(); + return llvm::getInstrPredicate(MI, PredReg); } bool @@ -242,15 +234,15 @@ // Insert a new block for consecutive predicated instructions. MachineFunction *MF = MBB->getParent(); MachineBasicBlock *NewMBB = MF->CreateMachineBasicBlock(MBB->getBasicBlock()); - MachineFunction::iterator Pos = MBB; - MF->insert(++Pos, NewMBB); + MachineFunction::iterator InsertPos = MBB; + MF->insert(++InsertPos, NewMBB); // Move all the successors of this block to the specified block. NewMBB->transferSuccessors(MBB); // Add an edge from CurMBB to NewMBB for the fall-through. MBB->addSuccessor(NewMBB); - NewMBB->splice(NewMBB->end(), MBB, ++MBBI, MBB->end()); + NewMBB->splice(NewMBB->end(), MBB, ++MBBI, MBB->end()); return true; } Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=105745&r1=105744&r2=105745&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.cpp Wed Jun 9 14:26:01 2010 @@ -503,3 +503,46 @@ Offset = (isSub) ? -Offset : Offset; return Offset == 0; } + +/// scheduleTwoAddrSource - Schedule the copy / re-mat of the source of the +/// two-addrss instruction inserted by two-address pass. +void +Thumb2InstrInfo::scheduleTwoAddrSource(MachineInstr *SrcMI, + MachineInstr *UseMI, + const TargetRegisterInfo &TRI) const { + if (SrcMI->getOpcode() != ARM::tMOVgpr2gpr || + SrcMI->getOperand(1).isKill()) + return; + + unsigned PredReg = 0; + ARMCC::CondCodes CC = llvm::getInstrPredicate(UseMI, PredReg); + if (CC == ARMCC::AL || PredReg != ARM::CPSR) + return; + + // Schedule the copy so it doesn't come between previous instructions + // and UseMI which can form an IT block. + unsigned SrcReg = SrcMI->getOperand(1).getReg(); + ARMCC::CondCodes OCC = ARMCC::getOppositeCondition(CC); + MachineBasicBlock *MBB = UseMI->getParent(); + MachineBasicBlock::iterator MBBI = SrcMI; + unsigned NumInsts = 0; + while (--MBBI != MBB->begin()) { + if (MBBI->isDebugValue()) + continue; + + MachineInstr *NMI = &*MBBI; + ARMCC::CondCodes NCC = llvm::getInstrPredicate(NMI, PredReg); + if (!(NCC == CC || NCC == OCC) || + NMI->modifiesRegister(SrcReg, &TRI) || + NMI->definesRegister(ARM::CPSR)) + break; + if (++NumInsts == 4) + // Too many in a row! + return; + } + + if (NumInsts) { + MBB->remove(SrcMI); + MBB->insert(++MBBI, SrcMI); + } +} Modified: llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h?rev=105745&r1=105744&r2=105745&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/Thumb2InstrInfo.h Wed Jun 9 14:26:01 2010 @@ -50,6 +50,11 @@ const TargetRegisterClass *RC, const TargetRegisterInfo *TRI) const; + /// scheduleTwoAddrSource - Schedule the copy / re-mat of the source of the + /// two-addrss instruction inserted by two-address pass. + void scheduleTwoAddrSource(MachineInstr *SrcMI, MachineInstr *UseMI, + const TargetRegisterInfo &TRI) const; + /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As /// such, whenever a client has an instance of instruction info, it should /// always be able to get register info as well (through this method). From stoklund at 2pi.dk Wed Jun 9 15:05:00 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 09 Jun 2010 20:05:00 -0000 Subject: [llvm-commits] [llvm] r105749 - in /llvm/trunk: lib/CodeGen/SelectionDAG/InstrEmitter.cpp test/CodeGen/X86/2010-06-09-FastAllocRegisters.ll Message-ID: <20100609200500.651982A6C12E@llvm.org> Author: stoklund Date: Wed Jun 9 15:05:00 2010 New Revision: 105749 URL: http://llvm.org/viewvc/llvm-project?rev=105749&view=rev Log: Mark physregs defined by inline asm as implicit. This is a bit of a hack to make inline asm look more like call instructions. It would be better to produce correct dead flags during isel. Added: llvm/trunk/test/CodeGen/X86/2010-06-09-FastAllocRegisters.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp?rev=105749&r1=105748&r2=105749&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/InstrEmitter.cpp Wed Jun 9 15:05:00 2010 @@ -821,14 +821,18 @@ case InlineAsm::Kind_RegDef: for (; NumVals; --NumVals, ++i) { unsigned Reg = cast(Node->getOperand(i))->getReg(); - MI->addOperand(MachineOperand::CreateReg(Reg, true)); + // FIXME: Add dead flags for physical and virtual registers defined. + // For now, mark physical register defs as implicit to help fast + // regalloc. This makes inline asm look a lot like calls. + MI->addOperand(MachineOperand::CreateReg(Reg, true, + /*isImp=*/ TargetRegisterInfo::isPhysicalRegister(Reg))); } break; case InlineAsm::Kind_RegDefEarlyClobber: for (; NumVals; --NumVals, ++i) { unsigned Reg = cast(Node->getOperand(i))->getReg(); MI->addOperand(MachineOperand::CreateReg(Reg, /*isDef=*/ true, - /*isImp=*/ false, + /*isImp=*/ TargetRegisterInfo::isPhysicalRegister(Reg), /*isKill=*/ false, /*isDead=*/ false, /*isUndef=*/false, Added: llvm/trunk/test/CodeGen/X86/2010-06-09-FastAllocRegisters.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-06-09-FastAllocRegisters.ll?rev=105749&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2010-06-09-FastAllocRegisters.ll (added) +++ llvm/trunk/test/CodeGen/X86/2010-06-09-FastAllocRegisters.ll Wed Jun 9 15:05:00 2010 @@ -0,0 +1,17 @@ +; RUN: llc < %s -O0 -disable-fp-elim -relocation-model=pic +; PR7313 +; +; The inline asm in this function clobbers almost all allocatable registers. +; Make sure that the register allocator recovers. +; +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-unknown-linux-gnu" + +declare void @snapshot() + +define void @test_too_many_longs() nounwind { +entry: + call void asm sideeffect "xor %rax, %rax\0A\09xor %rbx, %rbx\0A\09xor %rcx, %rcx\0A\09xor %rdx, %rdx\0A\09xor %rsi, %rsi\0A\09xor %rdi, %rdi\0A\09xor %r8, %r8\0A\09xor %r9, %r9\0A\09xor %r10, %r10\0A\09xor %r11, %r11\0A\09xor %r12, %r12\0A\09xor %r13, %r13\0A\09xor %r14, %r14\0A\09xor %r15, %r15\0A\09", "~{fpsr},~{flags},~{r15},~{r14},~{r13},~{r12},~{r11},~{r10},~{r9},~{r8},~{rdi},~{rsi},~{rdx},~{rcx},~{rbx},~{rax}"() nounwind + call void bitcast (void ()* @snapshot to void (i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64)*)(i64 32, i64 33, i64 34, i64 35, i64 36, i64 37, i64 38, i64 39, i64 40, i64 41, i64 42, i64 43) nounwind + ret void +} From isanbard at gmail.com Wed Jun 9 15:30:22 2010 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 09 Jun 2010 20:30:22 -0000 Subject: [llvm-commits] [llvm] r105750 - /llvm/trunk/test/CodeGen/X86/zext-sext.ll Message-ID: <20100609203022.C85F82A6C12E@llvm.org> Author: void Date: Wed Jun 9 15:30:22 2010 New Revision: 105750 URL: http://llvm.org/viewvc/llvm-project?rev=105750&view=rev Log: Testcase for r105741. Added: llvm/trunk/test/CodeGen/X86/zext-sext.ll Added: llvm/trunk/test/CodeGen/X86/zext-sext.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/zext-sext.ll?rev=105750&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/zext-sext.ll (added) +++ llvm/trunk/test/CodeGen/X86/zext-sext.ll Wed Jun 9 15:30:22 2010 @@ -0,0 +1,53 @@ +; RUN: llc < %s -march=x86-64 | FileCheck %s +; + + at llvm.used = appending global [1 x i8*] [i8* bitcast (void ([40 x i16]*, i32*, i16**, i64*)* @func to i8*)], section "llvm.metadata" + +define void @func([40 x i16]* %a, i32* %b, i16** %c, i64* %d) nounwind { +entry: + %tmp103 = getelementptr inbounds [40 x i16]* %a, i64 0, i64 4 + %tmp104 = load i16* %tmp103, align 2 + %tmp105 = sext i16 %tmp104 to i32 + %tmp106 = load i32* %b, align 4 + %tmp107 = sub nsw i32 4, %tmp106 + %tmp108 = load i16** %c, align 8 + %tmp109 = sext i32 %tmp107 to i64 + %tmp110 = getelementptr inbounds i16* %tmp108, i64 %tmp109 + %tmp111 = load i16* %tmp110, align 1 + %tmp112 = sext i16 %tmp111 to i32 + %tmp = mul i32 355244649, %tmp112 + %tmp1 = mul i32 %tmp, %tmp105 + %tmp2 = add i32 %tmp1, 2138875574 + %tmp3 = add i32 %tmp2, 1546991088 + %tmp4 = mul i32 %tmp3, 2122487257 + %tmp5 = icmp sge i32 %tmp4, 2138875574 + %tmp6 = icmp slt i32 %tmp4, -8608074 + %tmp7 = or i1 %tmp5, %tmp6 + %outSign = select i1 %tmp7, i32 1, i32 -1 + %tmp8 = icmp slt i32 %tmp4, 0 + %tmp9 = icmp eq i32 %outSign, 1 + %tmp10 = and i1 %tmp8, %tmp9 + %tmp11 = sext i32 %tmp4 to i64 + %tmp12 = add i64 %tmp11, 5089792279245435153 + +; CHECK: addl $2138875574, %e[[REGISTER_zext:[a-z]+]] +; CHECK-NEXT: movslq %e[[REGISTER_zext]], [[REGISTER_tmp:%[a-z]+]] +; CHECK: movq [[REGISTER_tmp]], [[REGISTER_sext:%[a-z]+]] +; CHECK-NEXT: subq %r[[REGISTER_zext]], [[REGISTER_sext]] + + %tmp13 = sub i64 %tmp12, 2138875574 + %tmp14 = zext i32 %tmp4 to i64 + %tmp15 = sub i64 %tmp11, %tmp14 + %tmp16 = select i1 %tmp10, i64 %tmp15, i64 0 + %tmp17 = sub i64 %tmp13, %tmp16 + %tmp18 = mul i64 %tmp17, 4540133155013554595 + %tmp19 = sub i64 %tmp18, 5386586244038704851 + %tmp20 = add i64 %tmp19, -1368057358110947217 + %tmp21 = mul i64 %tmp20, -422037402840850817 + %tmp115 = load i64* %d, align 8 + %alphaX = mul i64 468858157810230901, %tmp21 + %alphaXbetaY = add i64 %alphaX, %tmp115 + %transformed = add i64 %alphaXbetaY, 9040145182981852475 + store i64 %transformed, i64* %d, align 8 + ret void +} From grosbach at apple.com Wed Jun 9 17:21:24 2010 From: grosbach at apple.com (Jim Grosbach) Date: Wed, 09 Jun 2010 22:21:24 -0000 Subject: [llvm-commits] [llvm] r105758 - /llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Message-ID: <20100609222125.05C792A6C12E@llvm.org> Author: grosbach Date: Wed Jun 9 17:21:24 2010 New Revision: 105758 URL: http://llvm.org/viewvc/llvm-project?rev=105758&view=rev Log: be slightly more subtle about skipping dbg_value instructions; otherwise, if a dbg_value immediately follows a sequence of ldr/str instructions that should be combined into an ldm/stm and is the last instruction in the block, then combine may end up being skipped. Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=105758&r1=105757&r2=105758&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Wed Jun 9 17:21:24 2010 @@ -1024,10 +1024,6 @@ RS->enterBasicBlock(&MBB); MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end(); while (MBBI != E) { - if (MBBI->isDebugValue()) { - ++MBBI; - continue; - } if (FixInvalidRegPairOp(MBB, MBBI)) continue; @@ -1094,7 +1090,12 @@ } } - if (Advance) { + if (MBBI->isDebugValue()) { + ++MBBI; + if (MBBI == E) + // Reach the end of the block, try merging the memory instructions. + TryMerge = true; + } else if (Advance) { ++Position; ++MBBI; if (MBBI == E) From natebegeman at mac.com Wed Jun 9 19:16:56 2010 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 10 Jun 2010 00:16:56 -0000 Subject: [llvm-commits] [llvm] r105769 - in /llvm/trunk/utils/TableGen: NeonEmitter.cpp NeonEmitter.h Message-ID: <20100610001656.B7E3B2A6C12E@llvm.org> Author: sampo Date: Wed Jun 9 19:16:56 2010 New Revision: 105769 URL: http://llvm.org/viewvc/llvm-project?rev=105769&view=rev Log: NEON support for _lane ops, and multiplies by scalar. Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp llvm/trunk/utils/TableGen/NeonEmitter.h Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105769&r1=105768&r2=105769&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Wed Jun 9 19:16:56 2010 @@ -137,6 +137,7 @@ usgn = true; break; case 's': + case 'a': scal = true; break; case 'k': @@ -442,14 +443,7 @@ return s; } -// Generate the definition for this intrinsic, e.g. "a + b" for OpAdd. -// If structTypes is true, the NEON types are structs of vector types rather -// than vector types, and the call becomes "a.val + b.val" -static std::string GenOpString(OpKind op, const std::string &proto, - StringRef typestr, bool structTypes = true) { - std::string ts = TypeString(proto[0], typestr); - std::string s = ts + " r; r"; - +static std::string Duplicate(StringRef typestr, const std::string &a) { bool dummy, quad = false; char type = ClassifyType(typestr, quad, dummy, dummy); unsigned nElts = 0; @@ -462,6 +456,27 @@ case 'f': nElts = 2; break; } nElts <<= quad; + + std::string s; + + s = "(__neon_" + TypeString('d', typestr) + "){ "; + for (unsigned i = 0; i != nElts; ++i) { + s += a; + if ((i + 1) < nElts) + s += ", "; + } + s += " }"; + + return s; +} + +// Generate the definition for this intrinsic, e.g. "a + b" for OpAdd. +// If structTypes is true, the NEON types are structs of vector types rather +// than vector types, and the call becomes "a.val + b.val" +static std::string GenOpString(OpKind op, const std::string &proto, + StringRef typestr, bool structTypes = true) { + std::string ts = TypeString(proto[0], typestr); + std::string s = ts + " r; r"; if (structTypes) s += ".val"; @@ -481,12 +496,18 @@ case OpSub: s += a + " - " + b; break; + case OpMulN: + b = Duplicate(typestr, "b"); case OpMul: s += a + " * " + b; break; + case OpMlaN: + c = Duplicate(typestr, "c"); case OpMla: s += a + " + ( " + b + " * " + c + " )"; break; + case OpMlsN: + c = Duplicate(typestr, "c"); case OpMls: s += a + " - ( " + b + " * " + c + " )"; break; @@ -540,13 +561,7 @@ s += "(__neon_int64x1_t)(((__neon_int64x2_t)" + a + ")[0])"; break; case OpDup: - s += "(__neon_" + ts + "){ "; - for (unsigned i = 0; i != nElts; ++i) { - s += a; - if ((i + 1) < nElts) - s += ", "; - } - s += " }"; + s += Duplicate(typestr, a); break; default: throw "unknown OpKind!"; @@ -647,10 +662,17 @@ s += " = "; } - } + } + + bool splat = proto.find('a') != std::string::npos; s += "__builtin_neon_"; - s += MangleName(name, typestr, ck); + if (splat) { + std::string vname(name, 0, name.size()-2); + s += MangleName(vname, typestr, ck); + } else { + s += MangleName(name, typestr, ck); + } s += "("; for (unsigned i = 1, e = proto.size(); i != e; ++i, ++arg) { @@ -672,12 +694,18 @@ // Parenthesize the args from the macro. if (define) s.push_back('('); - s.push_back(arg); + + if (splat && (i + 1) == e) + s += Duplicate(typestr, std::string(&arg, 1)); + else + s.push_back(arg); + + // Parenthesize the args from the macro. if (define) s.push_back(')'); if (structTypes && proto[i] != 's' && proto[i] != 'i' && proto[i] != 'l' && - proto[i] != 'p' && proto[i] != 'c') { + proto[i] != 'p' && proto[i] != 'c' && proto[i] != 'a') { s += ".val"; } if ((i + 1) < e) @@ -748,7 +776,6 @@ // Emit NEON-specific scalar typedefs. // FIXME: probably need to do something better for polynomial types. - // FIXME: is this the correct thing to do for float16? OS << "typedef float float32_t;\n"; OS << "typedef uint8_t poly8_t;\n"; OS << "typedef uint16_t poly16_t;\n"; @@ -869,6 +896,9 @@ std::string Proto = R->getValueAsString("Prototype"); std::string Types = R->getValueAsString("Types"); + if (Proto.find('a') != std::string::npos) + continue; + SmallVector TypeVec; ParseTypes(R, Types, TypeVec); Modified: llvm/trunk/utils/TableGen/NeonEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.h?rev=105769&r1=105768&r2=105769&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.h (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.h Wed Jun 9 19:16:56 2010 @@ -28,6 +28,9 @@ OpMul, OpMla, OpMls, + OpMulN, + OpMlaN, + OpMlsN, OpEq, OpGe, OpLe, @@ -64,38 +67,39 @@ public: NeonEmitter(RecordKeeper &R) : Records(R) { - OpMap["OP_NONE"] = OpNone; - OpMap["OP_ADD"] = OpAdd; - OpMap["OP_SUB"] = OpSub; - OpMap["OP_MUL"] = OpMul; - OpMap["OP_MLA"] = OpMla; - OpMap["OP_MLS"] = OpMls; - OpMap["OP_EQ"] = OpEq; - OpMap["OP_GE"] = OpGe; - OpMap["OP_LE"] = OpLe; - OpMap["OP_GT"] = OpGt; - OpMap["OP_LT"] = OpLt; - OpMap["OP_NEG"] = OpNeg; - OpMap["OP_NOT"] = OpNot; - OpMap["OP_AND"] = OpAnd; - OpMap["OP_OR"] = OpOr; - OpMap["OP_XOR"] = OpXor; - OpMap["OP_ANDN"] = OpAndNot; - OpMap["OP_ORN"] = OpOrNot; - OpMap["OP_CAST"] = OpCast; - OpMap["OP_CONC"] = OpConcat; - OpMap["OP_HI"] = OpHi; - OpMap["OP_LO"] = OpLo; - OpMap["OP_DUP"] = OpDup; + OpMap["OP_NONE"] = OpNone; + OpMap["OP_ADD"] = OpAdd; + OpMap["OP_SUB"] = OpSub; + OpMap["OP_MUL"] = OpMul; + OpMap["OP_MLA"] = OpMla; + OpMap["OP_MLS"] = OpMls; + OpMap["OP_MUL_N"] = OpMulN; + OpMap["OP_MLA_N"] = OpMlaN; + OpMap["OP_MLS_N"] = OpMlsN; + OpMap["OP_EQ"] = OpEq; + OpMap["OP_GE"] = OpGe; + OpMap["OP_LE"] = OpLe; + OpMap["OP_GT"] = OpGt; + OpMap["OP_LT"] = OpLt; + OpMap["OP_NEG"] = OpNeg; + OpMap["OP_NOT"] = OpNot; + OpMap["OP_AND"] = OpAnd; + OpMap["OP_OR"] = OpOr; + OpMap["OP_XOR"] = OpXor; + OpMap["OP_ANDN"] = OpAndNot; + OpMap["OP_ORN"] = OpOrNot; + OpMap["OP_CAST"] = OpCast; + OpMap["OP_CONC"] = OpConcat; + OpMap["OP_HI"] = OpHi; + OpMap["OP_LO"] = OpLo; + OpMap["OP_DUP"] = OpDup; Record *SI = R.getClass("SInst"); Record *II = R.getClass("IInst"); Record *WI = R.getClass("WInst"); - Record *BI = R.getClass("BInst"); ClassMap[SI] = ClassS; ClassMap[II] = ClassI; ClassMap[WI] = ClassW; - ClassMap[BI] = ClassB; } // run - Emit arm_neon.h.inc From evan.cheng at apple.com Wed Jun 9 21:08:20 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 10 Jun 2010 02:08:20 -0000 Subject: [llvm-commits] [llvm] r105774 - /llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp Message-ID: <20100610020820.5469C2A6C12E@llvm.org> Author: evancheng Date: Wed Jun 9 21:08:20 2010 New Revision: 105774 URL: http://llvm.org/viewvc/llvm-project?rev=105774&view=rev Log: Delete code that's not safe. Modified: llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp Modified: llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp?rev=105774&r1=105773&r2=105774&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp (original) +++ llvm/trunk/lib/Target/ARM/Thumb2ITBlockPass.cpp Wed Jun 9 21:08:20 2010 @@ -230,19 +230,6 @@ MBBI = E; } } while (MBBI != E); - - // Insert a new block for consecutive predicated instructions. - MachineFunction *MF = MBB->getParent(); - MachineBasicBlock *NewMBB = MF->CreateMachineBasicBlock(MBB->getBasicBlock()); - MachineFunction::iterator InsertPos = MBB; - MF->insert(++InsertPos, NewMBB); - - // Move all the successors of this block to the specified block. - NewMBB->transferSuccessors(MBB); - - // Add an edge from CurMBB to NewMBB for the fall-through. - MBB->addSuccessor(NewMBB); - NewMBB->splice(NewMBB->end(), MBB, ++MBBI, MBB->end()); return true; } From evan.cheng at apple.com Wed Jun 9 21:09:31 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 10 Jun 2010 02:09:31 -0000 Subject: [llvm-commits] [llvm] r105775 - in /llvm/trunk/lib/CodeGen/SelectionDAG: ScheduleDAGSDNodes.cpp ScheduleDAGSDNodes.h Message-ID: <20100610020931.860AC2A6C12E@llvm.org> Author: evancheng Date: Wed Jun 9 21:09:31 2010 New Revision: 105775 URL: http://llvm.org/viewvc/llvm-project?rev=105775&view=rev Log: Code refactoring, no functionality changes. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp?rev=105775&r1=105774&r2=105775&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp Wed Jun 9 21:09:31 2010 @@ -128,98 +128,99 @@ /// offsets are not far apart (target specific), it add MVT::Flag inputs and /// outputs to ensure they are scheduled together and in order. This /// optimization may benefit some targets by improving cache locality. -void ScheduleDAGSDNodes::ClusterNeighboringLoads() { +void ScheduleDAGSDNodes::ClusterNeighboringLoads(SDNode *Node) { + SDNode *Chain = 0; + unsigned NumOps = Node->getNumOperands(); + if (Node->getOperand(NumOps-1).getValueType() == MVT::Other) + Chain = Node->getOperand(NumOps-1).getNode(); + if (!Chain) + return; + + // Look for other loads of the same chain. Find loads that are loading from + // the same base pointer and different offsets. SmallPtrSet Visited; SmallVector Offsets; DenseMap O2SMap; // Map from offset to SDNode. - for (SelectionDAG::allnodes_iterator NI = DAG->allnodes_begin(), - E = DAG->allnodes_end(); NI != E; ++NI) { - SDNode *Node = &*NI; - if (!Node || !Node->isMachineOpcode()) + bool Cluster = false; + SDNode *Base = Node; + int64_t BaseOffset; + for (SDNode::use_iterator I = Chain->use_begin(), E = Chain->use_end(); + I != E; ++I) { + SDNode *User = *I; + if (User == Node || !Visited.insert(User)) continue; - - unsigned Opc = Node->getMachineOpcode(); - const TargetInstrDesc &TID = TII->get(Opc); - if (!TID.mayLoad()) + int64_t Offset1, Offset2; + if (!TII->areLoadsFromSameBasePtr(Base, User, Offset1, Offset2) || + Offset1 == Offset2) + // FIXME: Should be ok if they addresses are identical. But earlier + // optimizations really should have eliminated one of the loads. continue; + if (O2SMap.insert(std::make_pair(Offset1, Base)).second) + Offsets.push_back(Offset1); + O2SMap.insert(std::make_pair(Offset2, User)); + Offsets.push_back(Offset2); + if (Offset2 < Offset1) { + Base = User; + BaseOffset = Offset2; + } else { + BaseOffset = Offset1; + } + Cluster = true; + } - SDNode *Chain = 0; - unsigned NumOps = Node->getNumOperands(); - if (Node->getOperand(NumOps-1).getValueType() == MVT::Other) - Chain = Node->getOperand(NumOps-1).getNode(); - if (!Chain) - continue; + if (!Cluster) + return; - // Look for other loads of the same chain. Find loads that are loading from - // the same base pointer and different offsets. - Visited.clear(); - Offsets.clear(); - O2SMap.clear(); - bool Cluster = false; - SDNode *Base = Node; - int64_t BaseOffset; - for (SDNode::use_iterator I = Chain->use_begin(), E = Chain->use_end(); - I != E; ++I) { - SDNode *User = *I; - if (User == Node || !Visited.insert(User)) - continue; - int64_t Offset1, Offset2; - if (!TII->areLoadsFromSameBasePtr(Base, User, Offset1, Offset2) || - Offset1 == Offset2) - // FIXME: Should be ok if they addresses are identical. But earlier - // optimizations really should have eliminated one of the loads. - continue; - if (O2SMap.insert(std::make_pair(Offset1, Base)).second) - Offsets.push_back(Offset1); - O2SMap.insert(std::make_pair(Offset2, User)); - Offsets.push_back(Offset2); - if (Offset2 < Offset1) { - Base = User; - BaseOffset = Offset2; - } else { - BaseOffset = Offset1; - } - Cluster = true; - } + // Sort them in increasing order. + std::sort(Offsets.begin(), Offsets.end()); - if (!Cluster) - continue; + // Check if the loads are close enough. + SmallVector Loads; + unsigned NumLoads = 0; + int64_t BaseOff = Offsets[0]; + SDNode *BaseLoad = O2SMap[BaseOff]; + Loads.push_back(BaseLoad); + for (unsigned i = 1, e = Offsets.size(); i != e; ++i) { + int64_t Offset = Offsets[i]; + SDNode *Load = O2SMap[Offset]; + if (!TII->shouldScheduleLoadsNear(BaseLoad, Load, BaseOff, Offset,NumLoads)) + break; // Stop right here. Ignore loads that are further away. + Loads.push_back(Load); + ++NumLoads; + } - // Sort them in increasing order. - std::sort(Offsets.begin(), Offsets.end()); + if (NumLoads == 0) + return; - // Check if the loads are close enough. - SmallVector Loads; - unsigned NumLoads = 0; - int64_t BaseOff = Offsets[0]; - SDNode *BaseLoad = O2SMap[BaseOff]; - Loads.push_back(BaseLoad); - for (unsigned i = 1, e = Offsets.size(); i != e; ++i) { - int64_t Offset = Offsets[i]; - SDNode *Load = O2SMap[Offset]; - if (!TII->shouldScheduleLoadsNear(BaseLoad, Load, BaseOff, Offset, - NumLoads)) - break; // Stop right here. Ignore loads that are further away. - Loads.push_back(Load); - ++NumLoads; - } + // Cluster loads by adding MVT::Flag outputs and inputs. This also + // ensure they are scheduled in order of increasing addresses. + SDNode *Lead = Loads[0]; + AddFlags(Lead, SDValue(0,0), true, DAG); + SDValue InFlag = SDValue(Lead, Lead->getNumValues()-1); + for (unsigned i = 1, e = Loads.size(); i != e; ++i) { + bool OutFlag = i < e-1; + SDNode *Load = Loads[i]; + AddFlags(Load, InFlag, OutFlag, DAG); + if (OutFlag) + InFlag = SDValue(Load, Load->getNumValues()-1); + ++LoadsClustered; + } +} - if (NumLoads == 0) +/// ClusterNodes - Cluster certain nodes which should be scheduled together. +/// +void ScheduleDAGSDNodes::ClusterNodes() { + for (SelectionDAG::allnodes_iterator NI = DAG->allnodes_begin(), + E = DAG->allnodes_end(); NI != E; ++NI) { + SDNode *Node = &*NI; + if (!Node || !Node->isMachineOpcode()) continue; - // Cluster loads by adding MVT::Flag outputs and inputs. This also - // ensure they are scheduled in order of increasing addresses. - SDNode *Lead = Loads[0]; - AddFlags(Lead, SDValue(0,0), true, DAG); - SDValue InFlag = SDValue(Lead, Lead->getNumValues()-1); - for (unsigned i = 1, e = Loads.size(); i != e; ++i) { - bool OutFlag = i < e-1; - SDNode *Load = Loads[i]; - AddFlags(Load, InFlag, OutFlag, DAG); - if (OutFlag) - InFlag = SDValue(Load, Load->getNumValues()-1); - ++LoadsClustered; - } + unsigned Opc = Node->getMachineOpcode(); + const TargetInstrDesc &TID = TII->get(Opc); + if (TID.mayLoad()) + // Cluster loads from "near" addresses into combined SUnits. + ClusterNeighboringLoads(Node); } } @@ -388,8 +389,8 @@ /// excludes nodes that aren't interesting to scheduling, and represents /// flagged together nodes with a single SUnit. void ScheduleDAGSDNodes::BuildSchedGraph(AliasAnalysis *AA) { - // Cluster loads from "near" addresses into combined SUnits. - ClusterNeighboringLoads(); + // Cluster certain nodes which should be scheduled together. + ClusterNodes(); // Populate the SUnits array. BuildSchedUnits(); // Compute all the scheduling dependencies between nodes. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h?rev=105775&r1=105774&r2=105775&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h Wed Jun 9 21:09:31 2010 @@ -108,7 +108,10 @@ private: /// ClusterNeighboringLoads - Cluster loads from "near" addresses into /// combined SUnits. - void ClusterNeighboringLoads(); + void ClusterNeighboringLoads(SDNode *Node); + /// ClusterNodes - Cluster certain nodes which should be scheduled together. + /// + void ClusterNodes(); /// BuildSchedUnits, AddSchedEdges - Helper functions for BuildSchedGraph. void BuildSchedUnits(); From bruno.cardoso at gmail.com Wed Jun 9 21:42:59 2010 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Thu, 10 Jun 2010 02:42:59 -0000 Subject: [llvm-commits] [llvm] r105776 - in /llvm/trunk: docs/TableGenFundamentals.html test/TableGen/LetInsideMultiClasses.td utils/TableGen/TGParser.cpp utils/TableGen/TGParser.h Message-ID: <20100610024259.CE4652A6C12E@llvm.org> Author: bruno Date: Wed Jun 9 21:42:59 2010 New Revision: 105776 URL: http://llvm.org/viewvc/llvm-project?rev=105776&view=rev Log: Teach tablegen to allow "let" expressions inside multiclasses, providing more ways to factor out commonality from the records. Added: llvm/trunk/test/TableGen/LetInsideMultiClasses.td Modified: llvm/trunk/docs/TableGenFundamentals.html llvm/trunk/utils/TableGen/TGParser.cpp llvm/trunk/utils/TableGen/TGParser.h Modified: llvm/trunk/docs/TableGenFundamentals.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGenFundamentals.html?rev=105776&r1=105775&r2=105776&view=diff ============================================================================== --- llvm/trunk/docs/TableGenFundamentals.html (original) +++ llvm/trunk/docs/TableGenFundamentals.html Wed Jun 9 21:42:59 2010 @@ -798,6 +798,32 @@ need to be added to several records, and the records do not otherwise need to be opened, as in the case with the CALL* instructions above.

    +

    It's also possible to use "let" expressions inside multiclasses, providing +more ways to factor out commonality from the records, specially if using +several levels of multiclass instanciations. This also avoids the need of using +"let" expressions within subsequent records inside a multiclass.

    + +
    +
    +multiclass basic_r<bits<4> opc> {
    +  let Predicates = [HasSSE2] in {
    +    def rr : Instruction<opc, "rr">;
    +    def rm : Instruction<opc, "rm">;
    +  }
    +  let Predicates = [HasSSE3] in
    +    def rx : Instruction<opc, "rx">;
    +}
    +
    +multiclass basic_ss<bits<4> opc> {
    +  let IsDouble = 0 in
    +    defm SS : basic_r<opc>;
    +
    +  let IsDouble = 1 in
    +    defm SD : basic_r<opc>;
    +}
    +
    +defm ADD : basic_ss<0xf>;
    +
    Added: llvm/trunk/test/TableGen/LetInsideMultiClasses.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/TableGen/LetInsideMultiClasses.td?rev=105776&view=auto ============================================================================== --- llvm/trunk/test/TableGen/LetInsideMultiClasses.td (added) +++ llvm/trunk/test/TableGen/LetInsideMultiClasses.td Wed Jun 9 21:42:59 2010 @@ -0,0 +1,29 @@ +// RUN: tblgen %s | grep "bit IsDouble = 1;" | count 3 +// XFAIL: vg_leak + +class Instruction opc, string Name> { + bits<4> opcode = opc; + string name = Name; + bit IsDouble = 0; +} + +multiclass basic_r opc> { + let name = "newname" in { + def rr : Instruction; + def rm : Instruction; + } + + let name = "othername" in + def rx : Instruction; +} + +multiclass basic_ss opc> { + let IsDouble = 0 in + defm SS : basic_r; + + let IsDouble = 1 in + defm SD : basic_r; +} + +defm ADD : basic_ss<0xf>; + Modified: llvm/trunk/utils/TableGen/TGParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=105776&r1=105775&r2=105776&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGParser.cpp (original) +++ llvm/trunk/utils/TableGen/TGParser.cpp Wed Jun 9 21:42:59 2010 @@ -1640,7 +1640,7 @@ /// /// DefInst ::= DEF ObjectName ObjectBody /// -llvm::Record *TGParser::ParseDef(MultiClass *CurMultiClass) { +bool TGParser::ParseDef(MultiClass *CurMultiClass) { SMLoc DefLoc = Lex.getLoc(); assert(Lex.getCode() == tgtok::Def && "Unknown tok"); Lex.Lex(); // Eat the 'def' token. @@ -1654,7 +1654,7 @@ // Ensure redefinition doesn't happen. if (Records.getDef(CurRec->getName())) { Error(DefLoc, "def '" + CurRec->getName() + "' already defined"); - return 0; + return true; } Records.addDef(CurRec); } else { @@ -1663,20 +1663,33 @@ if (CurMultiClass->DefPrototypes[i]->getName() == CurRec->getName()) { Error(DefLoc, "def '" + CurRec->getName() + "' already defined in this multiclass!"); - return 0; + return true; } CurMultiClass->DefPrototypes.push_back(CurRec); } if (ParseObjectBody(CurRec)) - return 0; + return true; if (CurMultiClass == 0) // Def's in multiclasses aren't really defs. CurRec->resolveReferences(); // If ObjectBody has template arguments, it's an error. assert(CurRec->getTemplateArgs().empty() && "How'd this get template args?"); - return CurRec; + + if (CurMultiClass) { + // Copy the template arguments for the multiclass into the def. + const std::vector &TArgs = + CurMultiClass->Rec.getTemplateArgs(); + + for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { + const RecordVal *RV = CurMultiClass->Rec.getValue(TArgs[i]); + assert(RV && "Template arg doesn't exist?"); + CurRec->addValue(*RV); + } + } + + return false; } @@ -1757,12 +1770,12 @@ } /// ParseTopLevelLet - Parse a 'let' at top level. This can be a couple of -/// different related productions. +/// different related productions. This works inside multiclasses too. /// /// Object ::= LET LetList IN '{' ObjectList '}' /// Object ::= LET LetList IN Object /// -bool TGParser::ParseTopLevelLet() { +bool TGParser::ParseTopLevelLet(MultiClass *CurMultiClass) { assert(Lex.getCode() == tgtok::Let && "Unexpected token"); Lex.Lex(); @@ -1778,7 +1791,7 @@ // If this is a scalar let, just handle it now if (Lex.getCode() != tgtok::l_brace) { // LET LetList IN Object - if (ParseObject()) + if (ParseObject(CurMultiClass)) return true; } else { // Object ::= LETCommand '{' ObjectList '}' SMLoc BraceLoc = Lex.getLoc(); @@ -1786,7 +1799,7 @@ Lex.Lex(); // eat the '{'. // Parse the object list. - if (ParseObjectList()) + if (ParseObjectList(CurMultiClass)) return true; if (Lex.getCode() != tgtok::r_brace) { @@ -1801,27 +1814,6 @@ return false; } -/// ParseMultiClassDef - Parse a def in a multiclass context. -/// -/// MultiClassDef ::= DefInst -/// -bool TGParser::ParseMultiClassDef(MultiClass *CurMC) { - - Record *D = ParseDef(CurMC); - if (D == 0) return true; - - // Copy the template arguments for the multiclass into the def. - const std::vector &TArgs = CurMC->Rec.getTemplateArgs(); - - for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { - const RecordVal *RV = CurMC->Rec.getValue(TArgs[i]); - assert(RV && "Template arg doesn't exist?"); - D->addValue(*RV); - } - - return false; -} - /// ParseMultiClass - Parse a multiclass definition. /// /// MultiClassInst ::= MULTICLASS ID TemplateArgList? @@ -1883,18 +1875,17 @@ return TokError("multiclass must contain at least one def"); while (Lex.getCode() != tgtok::r_brace) { - if (Lex.getCode() != tgtok::Defm && Lex.getCode() != tgtok::Def) - return TokError("expected 'def' or 'defm' in multiclass body"); - - if (Lex.getCode() == tgtok::Def) - if (ParseMultiClassDef(CurMultiClass)) - return true; - - if (Lex.getCode() == tgtok::Defm) - if (ParseDefm(CurMultiClass)) - return true; + switch (Lex.getCode()) { + default: + return TokError("expected 'let', 'def' or 'defm' in multiclass body"); + case tgtok::Let: + case tgtok::Def: + case tgtok::Defm: + if (ParseObject(CurMultiClass)) + return true; + break; + } } - Lex.Lex(); // eat the '}'. } @@ -2048,12 +2039,12 @@ /// Object ::= DefMInst /// Object ::= LETCommand '{' ObjectList '}' /// Object ::= LETCommand Object -bool TGParser::ParseObject() { +bool TGParser::ParseObject(MultiClass *MC) { switch (Lex.getCode()) { default: assert(0 && "This is not an object"); - case tgtok::Let: return ParseTopLevelLet(); - case tgtok::Def: return ParseDef(0) == 0; - case tgtok::Defm: return ParseDefm(); + case tgtok::Let: return ParseTopLevelLet(MC); + case tgtok::Def: return ParseDef(MC); + case tgtok::Defm: return ParseDefm(MC); case tgtok::Class: return ParseClass(); case tgtok::MultiClass: return ParseMultiClass(); } @@ -2061,9 +2052,9 @@ /// ParseObjectList /// ObjectList :== Object* -bool TGParser::ParseObjectList() { +bool TGParser::ParseObjectList(MultiClass *MC) { while (isObjectStart(Lex.getCode())) { - if (ParseObject()) + if (ParseObject(MC)) return true; } return false; Modified: llvm/trunk/utils/TableGen/TGParser.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.h?rev=105776&r1=105775&r2=105776&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/TGParser.h (original) +++ llvm/trunk/utils/TableGen/TGParser.h Wed Jun 9 21:42:59 2010 @@ -69,16 +69,15 @@ SubMultiClassReference &SubMultiClass); private: // Parser methods. - bool ParseObjectList(); - bool ParseObject(); + bool ParseObjectList(MultiClass *MC = 0); + bool ParseObject(MultiClass *MC); bool ParseClass(); bool ParseMultiClass(); - bool ParseMultiClassDef(MultiClass *CurMC); - bool ParseDefm(MultiClass *CurMultiClass = 0); - bool ParseTopLevelLet(); + bool ParseDefm(MultiClass *CurMultiClass); + bool ParseDef(MultiClass *CurMultiClass); + bool ParseTopLevelLet(MultiClass *CurMultiClass); std::vector ParseLetList(); - Record *ParseDef(MultiClass *CurMultiClass); bool ParseObjectBody(Record *CurRec); bool ParseBody(Record *CurRec); bool ParseBodyItem(Record *CurRec); From criswell at cs.uiuc.edu Wed Jun 9 23:14:43 2010 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 9 Jun 2010 23:14:43 -0500 Subject: [llvm-commits] CVS: llvm-www/safecode/menagerie/ Message-ID: <201006100414.o5A4Ehbn019237@maute.cs.uiuc.edu> Changes in directory llvm-www/safecode/menagerie: --- Log message: Directory /home/vadve/shared/PublicCVS/llvm-www/safecode/menagerie added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From criswell at cs.uiuc.edu Wed Jun 9 23:15:05 2010 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 9 Jun 2010 23:15:05 -0500 Subject: [llvm-commits] CVS: llvm-www/safecode/menagerie/images/ Message-ID: <201006100415.o5A4F5xb019266@maute.cs.uiuc.edu> Changes in directory llvm-www/safecode/menagerie/images: --- Log message: Directory /home/vadve/shared/PublicCVS/llvm-www/safecode/menagerie/images added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From criswell at cs.uiuc.edu Wed Jun 9 23:15:57 2010 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 9 Jun 2010 23:15:57 -0500 Subject: [llvm-commits] CVS: llvm-www/safecode/menagerie/attacks.html footer.incl index.html memsafety.html os.html other.html sidebar.incl Message-ID: <201006100415.o5A4FvOY019381@maute.cs.uiuc.edu> Changes in directory llvm-www/safecode/menagerie: attacks.html added (r1.1) footer.incl added (r1.1) index.html added (r1.1) memsafety.html added (r1.1) os.html added (r1.1) other.html added (r1.1) sidebar.incl added (r1.1) --- Log message: Beginning of memory safety menagerie site. --- Diffs of the changes: (+699 -0) attacks.html | 128 +++++++++++++++++++++++++++++++++++++++++++ footer.incl | 20 ++++++ index.html | 104 +++++++++++++++++++++++++++++++++++ memsafety.html | 169 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ os.html | 137 ++++++++++++++++++++++++++++++++++++++++++++++ other.html | 122 +++++++++++++++++++++++++++++++++++++++++ sidebar.incl | 19 ++++++ 7 files changed, 699 insertions(+) Index: llvm-www/safecode/menagerie/attacks.html diff -c /dev/null llvm-www/safecode/menagerie/attacks.html:1.1 *** /dev/null Wed Jun 9 23:15:38 2010 --- llvm-www/safecode/menagerie/attacks.html Wed Jun 9 23:15:27 2010 *************** *** 0 **** --- 1,128 ---- + + + + + + + Memory Safety Menagerie + + + + + + + + + + + + + + +
    + + + + + + +
    + + +

    Introduction

    + +

    + Understand attacks that exploit the lack of memory safety in programs is + vital to understanding the different types of memory safety as well as + the tradeoffs between enforcing one kind of memory safety over another. + Not all memory safety techniques are equally safe. +

    + +

    + Below are papers that describe how attacks exploit memory safety errors + for fun and profit. They're good to read; just don't make a career out + of using them. +

    + + +

    Memory Safety Exploit Papers

    + + +
  • + + + + + + + + + + + + Index: llvm-www/safecode/menagerie/footer.incl diff -c /dev/null llvm-www/safecode/menagerie/footer.incl:1.1 *** /dev/null Wed Jun 9 23:15:54 2010 --- llvm-www/safecode/menagerie/footer.incl Wed Jun 9 23:15:27 2010 *************** *** 0 **** --- 1,20 ---- + + + Index: llvm-www/safecode/menagerie/index.html diff -c /dev/null llvm-www/safecode/menagerie/index.html:1.1 *** /dev/null Wed Jun 9 23:15:57 2010 --- llvm-www/safecode/menagerie/index.html Wed Jun 9 23:15:28 2010 *************** *** 0 **** --- 1,104 ---- + + + + + + + Memory Safety Menagerie + + + + + + + + + + + + + + +
    + + + + + + +
    + + +

    Home

    +

    + Welcome to the Memory Safety Menagerie! This web page is a virtual + library of research papers about memory safety. I hope that it + provides a good starting point for researchers and students to learn + about the topic. +

    + +

    + In an attempt to organize the vast literature on the topic, I have + created "sub-"menageries that collect together papers on similar + topics. Organization is a tricky thing (just ask the guy who + discovered the platypus), so I suggest perusing the menagerie to get a + feel for what is inside. +

    + + +
    + + + + +
    + + + + + + Index: llvm-www/safecode/menagerie/memsafety.html diff -c /dev/null llvm-www/safecode/menagerie/memsafety.html:1.1 *** /dev/null Wed Jun 9 23:15:57 2010 --- llvm-www/safecode/menagerie/memsafety.html Wed Jun 9 23:15:28 2010 *************** *** 0 **** --- 1,169 ---- + + + + + + + Memory Safety Menagerie + + + + + + + + + + + + + + +
    + + + + + + +
    + + +

    Introduction

    + +

    + Memory-safety for application level software is not only critical for + thwarting application attacks, but the techniques developed for + user-applications often form the basis of memory safety techniques for + specialized software (e.g., operating systems). + Below are some research papers that provide the foundation of memory + safety research. +

    + + +

    Memory Safety Papers

    + +
    + + + + +
    + + + + + + Index: llvm-www/safecode/menagerie/os.html diff -c /dev/null llvm-www/safecode/menagerie/os.html:1.1 *** /dev/null Wed Jun 9 23:15:57 2010 --- llvm-www/safecode/menagerie/os.html Wed Jun 9 23:15:28 2010 *************** *** 0 **** --- 1,137 ---- + + + + + + + Memory Safety Menagerie + + + + + + + + + + + + + + +
    + + + + + + +
    + + +

    Introduction

    + +

    + In some ways, operating systems are just like any other user-space + program. They are written in a high-level language, they allocate + memory, and they have pointers, references, and array indexing. + Enforcing memory safety for an operating system is conceptually the same + as enforcing memory safety on user-space applications. +

    + +

    + And yet, operating systems are not quite the same. They introduce new + challenges. They often use custom alloctors, must induce very low + overhead, and have time-critical functionality. Operating systems also + perform certain operations that are rare in the application world: + context switching, direct hardware I/O, and asynchronous event delivery, + just to name a few. +

    + +

    + It's therefore not surprising that operating systems have gotten special + treatment in the research literature. Below are some papers on this + specialized topic. +

    + +

    Operating System Memory Safety Papers

    + + + +
    + + + + +
    + + + + + + Index: llvm-www/safecode/menagerie/other.html diff -c /dev/null llvm-www/safecode/menagerie/other.html:1.1 *** /dev/null Wed Jun 9 23:15:57 2010 --- llvm-www/safecode/menagerie/other.html Wed Jun 9 23:15:28 2010 *************** *** 0 **** --- 1,122 ---- + + + + + + + Memory Safety Menagerie + + + + + + + + + + + + + + +
    + + + + + + +
    + + +

    Introduction

    + +

    + While memory safety is at the heart of preventing attacks via undefined + semantic behavior, it is not the only approach to thwarting such attacks. + Information flow, randomization, and canaries have also been used to + detect attacks against undefined C program behavior. A researcher in + memory safety should also be aware of these techniques and understand why + memory safety is a more comprehensive techniques. +

    + +

    + Below are papers on various related topics to attack detection and + prevention. +

    + + +

    Information Flow Papers

    + + + + +

    Randomization Papers

    + + +

    Ad Hoc Technique Papers

    +
    + + + + +
    + + + + + + Index: llvm-www/safecode/menagerie/sidebar.incl diff -c /dev/null llvm-www/safecode/menagerie/sidebar.incl:1.1 *** /dev/null Wed Jun 9 23:15:57 2010 --- llvm-www/safecode/menagerie/sidebar.incl Wed Jun 9 23:15:28 2010 *************** *** 0 **** --- 1,19 ---- + + From espindola at google.com Wed Jun 9 23:27:27 2010 From: espindola at google.com (Rafael Espindola) Date: Thu, 10 Jun 2010 00:27:27 -0400 Subject: [llvm-commits] [patch] Mostly mechanical removal of getPhysicalRegisterRegClass.patch Message-ID: The attached patch is a bit ugly and evil, but is mostly a test that we can remove getPhysicalRegisterRegClass. It might actually be the lesser of two evils :-) The part that is ugly in it is that in some cases we compare register classes, but the register itself is not a hard register. In such cases we cannot use RC.contains(foo). That is why I added hasSubClassOrIs. I am mostly looking for suggestions on how to clean this up so that it can be committed. Cheers, -- Rafael ?vila de Esp?ndola -------------- next part -------------- A non-text attachment was scrubbed... Name: getPhysicalRegisterRegClass.patch Type: application/octet-stream Size: 31755 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100610/721feb46/attachment.obj From michael.g.miller at gmail.com Thu Jun 10 00:26:43 2010 From: michael.g.miller at gmail.com (Mike Miller) Date: Wed, 9 Jun 2010 22:26:43 -0700 Subject: [llvm-commits] Patch to LLDB Architecture page Message-ID: There's a closing tag with a backslash instead of a slash on http://lldb.llvm.org/architecture.html, leading a <\p> to be visible to the user on the page. Patch attached which fixes this. - Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100609/cdb47d4d/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: patch.diff Type: application/octet-stream Size: 492 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100609/cdb47d4d/attachment.obj From echristo at apple.com Thu Jun 10 00:35:59 2010 From: echristo at apple.com (Eric Christopher) Date: Wed, 9 Jun 2010 22:35:59 -0700 Subject: [llvm-commits] Patch to LLDB Architecture page In-Reply-To: References: Message-ID: On Jun 9, 2010, at 10:26 PM, Mike Miller wrote: > Committed. Thanks! -eric From stoklund at 2pi.dk Thu Jun 10 01:03:44 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Wed, 9 Jun 2010 23:03:44 -0700 Subject: [llvm-commits] [patch] Mostly mechanical removal of getPhysicalRegisterRegClass.patch In-Reply-To: References: Message-ID: On Jun 9, 2010, at 9:27 PM, Rafael Espindola wrote: > The attached patch is a bit ugly and evil, but is mostly a test that > we can remove getPhysicalRegisterRegClass. It might actually be the > lesser of two evils :-) Thanks for working on this, Rafael. The patch is a bit big, and I think you can safely break it up, switching gradually to getMinimalPhysRegClass(). Then remove getPhysicalRegisterRegClass when there are no more users. The first bit is in isel, creating virtregs for copying to and from a physreg. These all use the VT argument, and you should preserve that. It makes a difference if XMM1 is spilled as FR32, FR64, or VR128. In these cases, the physreg doesn't actually need to belong to the chosen class, and an argument could be made for using TLI.getRegClassFor(VT) instead. We want a compatible regclass to allow coalescing, but if coalescing is not possible, we want the largest possible regclass. In any case, you want a regclass compatible with VT. Second there are some changes to various copyRegToReg() methods. I don't think all of your changes are appropriate as these functions already deal with subclasses. I think is is better to just plug the holes in the current coverage, like ARM not handling SPR_8. A function like the X86 getLoadRegOpcode looks like it needs a switch(RC->getID()) > The part that is ugly in it is that in some cases we compare register > classes, but the register itself is not a hard register. In such cases > we cannot use RC.contains(foo). That is why I added hasSubClassOrIs. This is a good idea in general, but I don't think you can apply it mechanically to the *InstrInfo.cpp files. /jakob From chandlerc at google.com Thu Jun 10 00:32:51 2010 From: chandlerc at google.com (Chandler Carruth) Date: Wed, 9 Jun 2010 22:32:51 -0700 Subject: [llvm-commits] Patch to LLDB Architecture page In-Reply-To: References: Message-ID: Moving to lldb-commits rather than llvm-commits... On Wed, Jun 9, 2010 at 10:26 PM, Mike Miller wrote: > There's a closing tag with a backslash instead of a slash on > http://lldb.llvm.org/architecture.html, leading a <\p> to be visible to > the user on the page. Patch attached which fixes this. > > - Mike > > _______________________________________________ > 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/20100609/5b3b4dc9/attachment.html From monping at apple.com Thu Jun 10 01:25:20 2010 From: monping at apple.com (Mon Ping Wang) Date: Wed, 9 Jun 2010 23:25:20 -0700 Subject: [llvm-commits] Buggy SelectionDAG binop vector widening In-Reply-To: References: <20100603132756.GA30866@cc.hut.fi> <86CAA4FC-4CE3-4E7E-B0A4-58DE974B9176@apple.com> <20100608092644.GB30866@cc.hut.fi> <097373B3-998A-4F32-8688-AF7CB8271F35@apple.com> <4C0F3563.1040702@free.fr> Message-ID: <13CA807A-F47C-42F4-ABB4-58EB544226D9@apple.com> Hi Visa, All the occurrences in widening should use isTypeLegal should be updated to use isTypeSynthesizable but I can do that update if you prefer after this patch is in. Looking at the changes, it overall looks good. The code now separates the code that breaks the vector into synthesizable types with where it recombines it. I think we can simplify the code during the recombine step while (true) { bool wrongTypeInConcatOps = false; for (Idx = ConcatEnd - 1; Idx >= 0; Idx--) { if (ConcatOps[Idx].getValueType() != MaxVT) { wrongTypeInConcatOps = true; break; } } if(!wrongTypeInConcatOps) break; ... } When we split the vector into synthesizable types, we go form largest to smallest. If the last piece is the list of operations we want to concatenate is MaxVT, I believe every other piece must be MaxVT so we don't need the loop. I think we can get rid of the for loop and we can move the condition into the while. -- Mon Ping On Jun 9, 2010, at 9:31 AM, Mon Ping Wang wrote: > I'll take a look as well. > > -- Mon Ping > > On Jun 8, 2010, at 11:32 PM, Duncan Sands wrote: > >> Hi Dale, >> >>>> Thanks for the advice. I changed all three occurances of isTypeLegal to >>>> isTypeSynthesizable in DAGTypeLegalizer::WidenVecRes_Binary. There are >>>> still six other isTypeLegal call sites in LegalizeVectorTypes.cpp that >>>> probably should be updated, but I didn't touch those for now. The >>>> updated patch is attached. >>> >>> It looks OK to me but I am not expert in this code. Duncan, you wrote >>> this didn't you? Can you look? >> >> Mon Ping wrote the vector widening stuff. I will try to take a look too. >> >> Ciao, >> >> Duncan. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100609/97650195/attachment.html From baldrick at free.fr Thu Jun 10 05:13:58 2010 From: baldrick at free.fr (Duncan Sands) Date: Thu, 10 Jun 2010 10:13:58 -0000 Subject: [llvm-commits] [llvm] r105786 - in /llvm/trunk/include/llvm: ADT/DenseMap.h ADT/SmallVector.h ADT/ilist.h Use.h Message-ID: <20100610101358.943472A6C12C@llvm.org> Author: baldrick Date: Thu Jun 10 05:13:58 2010 New Revision: 105786 URL: http://llvm.org/viewvc/llvm-project?rev=105786&view=rev Log: Add includes to get ptrdiff_t. This is needed by gcc-4.6 which has done some more header trimming, resulting in cstdef being included by less header files. Modified: llvm/trunk/include/llvm/ADT/DenseMap.h llvm/trunk/include/llvm/ADT/SmallVector.h llvm/trunk/include/llvm/ADT/ilist.h llvm/trunk/include/llvm/Use.h Modified: llvm/trunk/include/llvm/ADT/DenseMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=105786&r1=105785&r2=105786&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseMap.h (original) +++ llvm/trunk/include/llvm/ADT/DenseMap.h Thu Jun 10 05:13:58 2010 @@ -22,6 +22,7 @@ #include #include #include +#include #include namespace llvm { Modified: llvm/trunk/include/llvm/ADT/SmallVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=105786&r1=105785&r2=105786&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallVector.h (original) +++ llvm/trunk/include/llvm/ADT/SmallVector.h Thu Jun 10 05:13:58 2010 @@ -17,6 +17,7 @@ #include "llvm/Support/type_traits.h" #include #include +#include #include #include #include Modified: llvm/trunk/include/llvm/ADT/ilist.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ilist.h?rev=105786&r1=105785&r2=105786&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ilist.h (original) +++ llvm/trunk/include/llvm/ADT/ilist.h Thu Jun 10 05:13:58 2010 @@ -39,6 +39,7 @@ #define LLVM_ADT_ILIST_H #include +#include #include namespace llvm { Modified: llvm/trunk/include/llvm/Use.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Use.h?rev=105786&r1=105785&r2=105786&view=diff ============================================================================== --- llvm/trunk/include/llvm/Use.h (original) +++ llvm/trunk/include/llvm/Use.h Thu Jun 10 05:13:58 2010 @@ -27,6 +27,7 @@ #include "llvm/Support/Casting.h" #include "llvm/ADT/PointerIntPair.h" +#include #include namespace llvm { From baldrick at free.fr Thu Jun 10 10:06:05 2010 From: baldrick at free.fr (Duncan Sands) Date: Thu, 10 Jun 2010 15:06:05 -0000 Subject: [llvm-commits] [llvm] r105788 - /llvm/trunk/include/llvm/SymbolTableListTraits.h Message-ID: <20100610150605.500982A6C12C@llvm.org> Author: baldrick Date: Thu Jun 10 10:06:05 2010 New Revision: 105788 URL: http://llvm.org/viewvc/llvm-project?rev=105788&view=rev Log: Avoid many "variable 'Sub' set but not used [-Wunused-but-set-variable]" warnings with gcc-4.6. The warning is wrong, since Sub *is* used (perhaps gcc is confused because the use of Sub is constant folded away?), but since it is trivial to avoid, and massively reduces the amount of warning spew, just workaround the wrong warning. Modified: llvm/trunk/include/llvm/SymbolTableListTraits.h Modified: llvm/trunk/include/llvm/SymbolTableListTraits.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/SymbolTableListTraits.h?rev=105788&r1=105787&r2=105788&view=diff ============================================================================== --- llvm/trunk/include/llvm/SymbolTableListTraits.h (original) +++ llvm/trunk/include/llvm/SymbolTableListTraits.h Thu Jun 10 10:06:05 2010 @@ -47,9 +47,8 @@ /// of instructions, it returns the BasicBlock that owns them. ItemParentClass *getListOwner() { typedef iplist ItemParentClass::*Sublist; - Sublist Sub(ItemParentClass:: - getSublistAccess(static_cast(0))); - size_t Offset(size_t(&((ItemParentClass*)0->*Sub))); + size_t Offset(size_t(&((ItemParentClass*)0->*ItemParentClass:: + getSublistAccess(static_cast(0))))); iplist* Anchor(static_cast*>(this)); return reinterpret_cast(reinterpret_cast(Anchor)- Offset); From baldrick at free.fr Thu Jun 10 11:23:15 2010 From: baldrick at free.fr (Duncan Sands) Date: Thu, 10 Jun 2010 16:23:15 -0000 Subject: [llvm-commits] [llvm] r105790 - /llvm/trunk/lib/System/Disassembler.cpp Message-ID: <20100610162315.C0DC22A6C12C@llvm.org> Author: baldrick Date: Thu Jun 10 11:23:15 2010 New Revision: 105790 URL: http://llvm.org/viewvc/llvm-project?rev=105790&view=rev Log: Avoid "variable 'bits' set but not used [-Wunused-but-set-variable]" warnings with gcc-4.6, by not setting bits when the result is not used. Modified: llvm/trunk/lib/System/Disassembler.cpp Modified: llvm/trunk/lib/System/Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Disassembler.cpp?rev=105790&r1=105789&r2=105790&view=diff ============================================================================== --- llvm/trunk/lib/System/Disassembler.cpp (original) +++ llvm/trunk/lib/System/Disassembler.cpp Thu Jun 10 11:23:15 2010 @@ -44,33 +44,29 @@ uint64_t pc) { std::stringstream res; -#if defined (__i386__) || defined (__amd64__) || defined (__x86_64__) +#if (defined (__i386__) || defined (__amd64__) || defined (__x86_64__)) \ + && USE_UDIS86 unsigned bits; # if defined(__i386__) bits = 32; # else bits = 64; # endif - -# if USE_UDIS86 + ud_t ud_obj; - + ud_init(&ud_obj); ud_set_input_buffer(&ud_obj, start, length); ud_set_mode(&ud_obj, bits); ud_set_pc(&ud_obj, pc); ud_set_syntax(&ud_obj, UD_SYN_ATT); - + res << std::setbase(16) << std::setw(bits/4); - + while (ud_disassemble(&ud_obj)) { res << ud_insn_off(&ud_obj) << ":\t" << ud_insn_asm(&ud_obj) << "\n"; } -# else - res << "No disassembler available. See configure help for options.\n"; -# endif - #else res << "No disassembler available. See configure help for options.\n"; #endif From natebegeman at mac.com Thu Jun 10 13:06:07 2010 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 10 Jun 2010 18:06:07 -0000 Subject: [llvm-commits] [llvm] r105792 - /llvm/trunk/utils/TableGen/NeonEmitter.cpp Message-ID: <20100610180607.783052A6C12C@llvm.org> Author: sampo Date: Thu Jun 10 13:06:07 2010 New Revision: 105792 URL: http://llvm.org/viewvc/llvm-project?rev=105792&view=rev Log: Add support for polynomial type, for polynomial multiply Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105792&r1=105791&r2=105792&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Thu Jun 10 13:06:07 2010 @@ -595,6 +595,8 @@ ret |= 0x08; if (quad) ret |= 0x10; + if (poly) + ret |= 0x20; switch (type) { case 'c': From criswell at cs.uiuc.edu Thu Jun 10 17:32:57 2010 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu, 10 Jun 2010 17:32:57 -0500 Subject: [llvm-commits] CVS: llvm-www/safecode/menagerie/links.html Message-ID: <201006102232.o5AMWv5g031343@maute.cs.uiuc.edu> Changes in directory llvm-www/safecode/menagerie: links.html added (r1.1) --- Log message: Add the links page. --- Diffs of the changes: (+76 -0) links.html | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) Index: llvm-www/safecode/menagerie/links.html diff -c /dev/null llvm-www/safecode/menagerie/links.html:1.1 *** /dev/null Thu Jun 10 17:32:54 2010 --- llvm-www/safecode/menagerie/links.html Thu Jun 10 17:32:43 2010 *************** *** 0 **** --- 1,76 ---- + + + + + + + Memory Safety Menagerie + + + + + + + + + + + + + + +
    + + + + + + +
    + + +

    Links

    + +
    + + + + +
    + + + + + + From criswell at cs.uiuc.edu Thu Jun 10 17:33:17 2010 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu, 10 Jun 2010 17:33:17 -0500 Subject: [llvm-commits] CVS: llvm-www/safecode/menagerie/attacks.html index.html memsafety.html os.html other.html sidebar.incl Message-ID: <201006102233.o5AMXHIu031375@maute.cs.uiuc.edu> Changes in directory llvm-www/safecode/menagerie: attacks.html updated: 1.1 -> 1.2 index.html updated: 1.1 -> 1.2 memsafety.html updated: 1.1 -> 1.2 os.html updated: 1.1 -> 1.2 other.html updated: 1.1 -> 1.2 sidebar.incl updated: 1.1 -> 1.2 --- Log message: Removed tabs. Added a links page. --- Diffs of the changes: (+35 -10) attacks.html | 2 ++ index.html | 34 +++++++++++++++++++++++++--------- memsafety.html | 2 ++ os.html | 2 ++ other.html | 4 +++- sidebar.incl | 1 + 6 files changed, 35 insertions(+), 10 deletions(-) Index: llvm-www/safecode/menagerie/attacks.html diff -u llvm-www/safecode/menagerie/attacks.html:1.1 llvm-www/safecode/menagerie/attacks.html:1.2 --- llvm-www/safecode/menagerie/attacks.html:1.1 Wed Jun 9 23:15:27 2010 +++ llvm-www/safecode/menagerie/attacks.html Thu Jun 10 17:32:32 2010 @@ -27,6 +27,7 @@ + Index: llvm-www/safecode/menagerie/index.html diff -u llvm-www/safecode/menagerie/index.html:1.1 llvm-www/safecode/menagerie/index.html:1.2 --- llvm-www/safecode/menagerie/index.html:1.1 Wed Jun 9 23:15:28 2010 +++ llvm-www/safecode/menagerie/index.html Thu Jun 10 17:32:32 2010 @@ -27,15 +27,13 @@ - - + + Index: llvm-www/safecode/menagerie/other.html diff -u llvm-www/safecode/menagerie/other.html:1.1 llvm-www/safecode/menagerie/other.html:1.2 --- llvm-www/safecode/menagerie/other.html:1.1 Wed Jun 9 23:15:28 2010 +++ llvm-www/safecode/menagerie/other.html Thu Jun 10 17:32:32 2010 @@ -27,6 +27,7 @@ + @@ -62,7 +64,7 @@ Information flow, randomization, and canaries have also been used to detect attacks against undefined C program behavior. A researcher in memory safety should also be aware of these techniques and understand why - memory safety is a more comprehensive techniques. + memory safety is a more comprehensive technique.

    Index: llvm-www/safecode/menagerie/sidebar.incl diff -u llvm-www/safecode/menagerie/sidebar.incl:1.1 llvm-www/safecode/menagerie/sidebar.incl:1.2 --- llvm-www/safecode/menagerie/sidebar.incl:1.1 Wed Jun 9 23:15:28 2010 +++ llvm-www/safecode/menagerie/sidebar.incl Thu Jun 10 17:32:32 2010 @@ -3,6 +3,7 @@

    From criswell at cs.uiuc.edu Thu Jun 10 23:32:55 2010 From: criswell at cs.uiuc.edu (John Criswell) Date: Thu, 10 Jun 2010 23:32:55 -0500 Subject: [llvm-commits] CVS: llvm-www/safecode/menagerie/memsafety.html Message-ID: <201006110432.o5B4Wtx8012985@maute.cs.uiuc.edu> Changes in directory llvm-www/safecode/menagerie: memsafety.html updated: 1.2 -> 1.3 --- Log message: Added CETS, Baggy Bounds Checking, and the CCured journal paper. --- Diffs of the changes: (+57 -0) memsafety.html | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) Index: llvm-www/safecode/menagerie/memsafety.html diff -u llvm-www/safecode/menagerie/memsafety.html:1.2 llvm-www/safecode/menagerie/memsafety.html:1.3 --- llvm-www/safecode/menagerie/memsafety.html:1.2 Thu Jun 10 17:32:32 2010 +++ llvm-www/safecode/menagerie/memsafety.html Thu Jun 10 23:32:43 2010 @@ -71,6 +71,49 @@

    Memory Safety Papers

      +
    • + + + CETS: Compiler Enforced Temporal Safety for C + +
      + Santosh Nagarakatte, Jianzhou Zhao, Milo M K Martin and Steve Zdancewic. +
      + International Conference on Memory Management (ISMM 2010), June, 2010 +
    • + +
      + +
    • + + + Baggy Bounds Checking: An Efficient and Backwards-Compatible Defense + against Out-of-Bounds Errors + +
      + Periklis Akritidis, Manuel Costa, Miguel Castro, and Steven Hand. +
      + Proceedings of the Eighteenth USENIX Security Symposium, + Montreal, Canada, August 2009. +
    • + +
      + + +
    • + + + SoftBound: Highly Compatible and Complete Spatial Memory Safety for C + +
      + Santosh Nagarakatte, Jianzhou Zhao, Milo M. K. Martin, Steve Zdancewic. +
      + ACM SIGPLAN Conference on Programming Language Design and + Implementation (PLDI), 2009 +
    • + +
      +
    • Efficiently Detecting All Dangling Pointer Uses in Production Servers @@ -120,6 +163,20 @@
    • + + CCured: type-safe retrofitting of legacy software + +
      + George C. Necula, Jeremy Condit, Matthew Harren, Scott McPeak, and + Westley Weimer. +
      + ACM Transactions on Programming Languages and Systems (TOPLAS), + May 2005. +
    • + +
      + +
    • Memory Safety Without Garbage Collection for Embedded Applications From rjmccall at apple.com Fri Jun 11 06:06:44 2010 From: rjmccall at apple.com (John McCall) Date: Fri, 11 Jun 2010 11:06:44 -0000 Subject: [llvm-commits] [llvm] r105819 - /llvm/trunk/include/llvm/ADT/FoldingSet.h Message-ID: <20100611110644.499F82A6C12C@llvm.org> Author: rjmccall Date: Fri Jun 11 06:06:44 2010 New Revision: 105819 URL: http://llvm.org/viewvc/llvm-project?rev=105819&view=rev Log: Define ContextualFoldingSet, which stores a context parameter to pass down to the Profile method. Currently this only works with the default FoldingSetTraits implementation. The point of this is to allow nodes to not store context values which are only used during profiling. A better solution would thread this value through the folding algorithms, but then those would need to be (1) templated and (2) non-opaque. Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=105819&r1=105818&r2=105819&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/FoldingSet.h (original) +++ llvm/trunk/include/llvm/ADT/FoldingSet.h Fri Jun 11 06:06:44 2010 @@ -196,6 +196,10 @@ template struct FoldingSetTrait { static inline void Profile(const T& X, FoldingSetNodeID& ID) { X.Profile(ID);} static inline void Profile(T& X, FoldingSetNodeID& ID) { X.Profile(ID); } + template + static inline void Profile(T &X, FoldingSetNodeID &ID, Ctx Context) { + X.Profile(ID, Context); + } }; //===--------------------------------------------------------------------===// @@ -322,6 +326,77 @@ }; //===----------------------------------------------------------------------===// +/// ContextualFoldingSet - This template class is a further refinement +/// of FoldingSet which provides a context argument when calling +/// Profile on its nodes. Currently, that argument is fixed at +/// initialization time. +/// +/// T must be a subclass of FoldingSetNode and implement a Profile +/// function with signature +/// void Profile(llvm::FoldingSetNodeID &, Ctx); +template +class ContextualFoldingSet : public FoldingSetImpl { + // Unfortunately, this can't derive from FoldingSet because the + // construction vtable for FoldingSet requires + // FoldingSet::GetNodeProfile to be instantiated, which in turn + // requires a single-argument T::Profile(). + +private: + Ctx Context; + + /// GetNodeProfile - Each instantiatation of the FoldingSet needs to provide a + /// way to convert nodes into a unique specifier. + virtual void GetNodeProfile(FoldingSetNodeID &ID, + FoldingSetImpl::Node *N) const { + T *TN = static_cast(N); + + // We must use explicit template arguments in case Ctx is a + // reference type. + FoldingSetTrait::template Profile(*TN, ID, Context); + } + +public: + explicit ContextualFoldingSet(Ctx Context, unsigned Log2InitSize = 6) + : FoldingSetImpl(Log2InitSize), Context(Context) + {} + + Ctx getContext() const { return Context; } + + + typedef FoldingSetIterator iterator; + iterator begin() { return iterator(Buckets); } + iterator end() { return iterator(Buckets+NumBuckets); } + + typedef FoldingSetIterator const_iterator; + const_iterator begin() const { return const_iterator(Buckets); } + const_iterator end() const { return const_iterator(Buckets+NumBuckets); } + + typedef FoldingSetBucketIterator bucket_iterator; + + bucket_iterator bucket_begin(unsigned hash) { + return bucket_iterator(Buckets + (hash & (NumBuckets-1))); + } + + bucket_iterator bucket_end(unsigned hash) { + return bucket_iterator(Buckets + (hash & (NumBuckets-1)), true); + } + + /// GetOrInsertNode - If there is an existing simple Node exactly + /// equal to the specified node, return it. Otherwise, insert 'N' + /// and return it instead. + T *GetOrInsertNode(Node *N) { + return static_cast(FoldingSetImpl::GetOrInsertNode(N)); + } + + /// FindNodeOrInsertPos - Look up the node specified by ID. If it + /// exists, return it. If not, return the insertion token that will + /// make insertion faster. + T *FindNodeOrInsertPos(const FoldingSetNodeID &ID, void *&InsertPos) { + return static_cast(FoldingSetImpl::FindNodeOrInsertPos(ID, InsertPos)); + } +}; + +//===----------------------------------------------------------------------===// /// FoldingSetIteratorImpl - This is the common iterator support shared by all /// folding sets, which knows how to walk the folding set hash table. class FoldingSetIteratorImpl { From daniel at zuster.org Fri Jun 11 12:32:41 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 11 Jun 2010 17:32:41 -0000 Subject: [llvm-commits] [zorg] r105822 - /zorg/trunk/zorg/buildbot/builders/ChrootSetup.py Message-ID: <20100611173241.1FBF32A6C12C@llvm.org> Author: ddunbar Date: Fri Jun 11 12:32:40 2010 New Revision: 105822 URL: http://llvm.org/viewvc/llvm-project?rev=105822&view=rev Log: buildbot/ChrootSetup: Mount images with -readonly and make sure to create /dev/ mount point. Modified: zorg/trunk/zorg/buildbot/builders/ChrootSetup.py Modified: zorg/trunk/zorg/buildbot/builders/ChrootSetup.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/builders/ChrootSetup.py?rev=105822&r1=105821&r2=105822&view=diff ============================================================================== --- zorg/trunk/zorg/buildbot/builders/ChrootSetup.py (original) +++ zorg/trunk/zorg/buildbot/builders/ChrootSetup.py Fri Jun 11 12:32:40 2010 @@ -44,7 +44,8 @@ # Setup the build root we will build projects in. f.addStep(ShellCommand( name="attach.buildroot", - command=("hdiutil attach -noverify -plist -mountrandom . %s | " + command=("hdiutil attach -readonly -noverify " + "-plist -mountrandom . %s | " "tee mount_info.plist") % image, description="attach build root image", haltOnFailure=True, @@ -109,6 +110,11 @@ workdir=build_root_name)) # Initialize /dev/. + f.addStep(ShellCommand(name="chroot.init.mkdir.dev", + command=["sudo", "mkdir", "-p", "dev"], + haltOnFailure=True, + description="mkdir /dev", + workdir=build_root_name)) f.addStep(ShellCommand(name="chroot.init.mount.devfs", command=["sudo", "mount", "-t", "devfs", "devfs", "dev"], From clattner at apple.com Fri Jun 11 14:59:22 2010 From: clattner at apple.com (Chris Lattner) Date: Fri, 11 Jun 2010 12:59:22 -0700 Subject: [llvm-commits] [llvm] r105788 - /llvm/trunk/include/llvm/SymbolTableListTraits.h In-Reply-To: <20100610150605.500982A6C12C@llvm.org> References: <20100610150605.500982A6C12C@llvm.org> Message-ID: <3562725B-F4D5-4C8D-982F-5F5001319077@apple.com> On Jun 10, 2010, at 8:06 AM, Duncan Sands wrote: > Author: baldrick > Date: Thu Jun 10 10:06:05 2010 > New Revision: 105788 > > URL: http://llvm.org/viewvc/llvm-project?rev=105788&view=rev > Log: > Avoid many "variable 'Sub' set but not used [-Wunused-but-set-variable]" warnings > with gcc-4.6. The warning is wrong, since Sub *is* used (perhaps gcc is confused > because the use of Sub is constant folded away?), but since it is trivial to avoid, > and massively reduces the amount of warning spew, just workaround the wrong warning. Hi Duncan, If you haven't already, please file a bug against gcc for this so they have an opportunity to fix it. -Chris From stuart at apple.com Fri Jun 11 15:05:01 2010 From: stuart at apple.com (Stuart Hastings) Date: Fri, 11 Jun 2010 20:05:01 -0000 Subject: [llvm-commits] [llvm] r105827 - /llvm/trunk/lib/Analysis/DebugInfo.cpp Message-ID: <20100611200501.CB4452A6C12C@llvm.org> Author: stuart Date: Fri Jun 11 15:05:01 2010 New Revision: 105827 URL: http://llvm.org/viewvc/llvm-project?rev=105827&view=rev Log: Delete duplicate function. Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=105827&r1=105826&r2=105827&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Fri Jun 11 15:05:01 2010 @@ -1110,18 +1110,6 @@ return DILocation(MDNode::get(VMContext, &Elts[0], 4)); } -/// CreateLocation - Creates a debug info location. -DILocation DIFactory::CreateLocation(unsigned LineNo, unsigned ColumnNo, - DIScope S, MDNode *OrigLoc) { - Value *Elts[] = { - ConstantInt::get(Type::getInt32Ty(VMContext), LineNo), - ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo), - S, - OrigLoc - }; - return DILocation(MDNode::get(VMContext, &Elts[0], 4)); -} - //===----------------------------------------------------------------------===// // DIFactory: Routines for inserting code into a function //===----------------------------------------------------------------------===// From stuart at apple.com Fri Jun 11 15:08:44 2010 From: stuart at apple.com (Stuart Hastings) Date: Fri, 11 Jun 2010 20:08:44 -0000 Subject: [llvm-commits] [llvm] r105828 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp test/FrontendC++/2010-02-17-DbgArtificialArg.cpp Message-ID: <20100611200844.A700A2A6C12C@llvm.org> Author: stuart Date: Fri Jun 11 15:08:44 2010 New Revision: 105828 URL: http://llvm.org/viewvc/llvm-project?rev=105828&view=rev Log: Support for nested functions/classes in debug output. (Again.) Radar 7424645. Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h llvm/trunk/lib/Analysis/DebugInfo.cpp llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp llvm/trunk/test/FrontendC++/2010-02-17-DbgArtificialArg.cpp Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=105828&r1=105827&r2=105828&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original) +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Fri Jun 11 15:08:44 2010 @@ -56,6 +56,7 @@ } GlobalVariable *getGlobalVariableField(unsigned Elt) const; + Function *getFunctionField(unsigned Elt) const; public: explicit DIDescriptor() : DbgNode(0) {} @@ -409,6 +410,8 @@ /// describes - Return true if this subprogram provides debugging /// information for the function F. bool describes(const Function *F); + + Function *getFunction() const { return getFunctionField(16); } }; /// DIGlobalVariable - This is a wrapper for a global variable. @@ -658,7 +661,8 @@ unsigned VIndex = 0, DIType = DIType(), bool isArtificial = 0, - bool isOptimized = false); + bool isOptimized = false, + Function *Fn = 0); /// CreateSubprogramDefinition - Create new subprogram descriptor for the /// given declaration. Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=105828&r1=105827&r2=105828&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/DebugInfo.cpp (original) +++ llvm/trunk/lib/Analysis/DebugInfo.cpp Fri Jun 11 15:08:44 2010 @@ -73,6 +73,15 @@ return 0; } +Function *DIDescriptor::getFunctionField(unsigned Elt) const { + if (DbgNode == 0) + return 0; + + if (Elt < DbgNode->getNumOperands()) + return dyn_cast_or_null(DbgNode->getOperand(Elt)); + return 0; +} + unsigned DIVariable::getNumAddrElements() const { return DbgNode->getNumOperands()-6; } @@ -938,7 +947,8 @@ unsigned VK, unsigned VIndex, DIType ContainingType, bool isArtificial, - bool isOptimized) { + bool isOptimized, + Function *Fn) { Value *Elts[] = { GetTagConstant(dwarf::DW_TAG_subprogram), @@ -956,9 +966,10 @@ ConstantInt::get(Type::getInt32Ty(VMContext), VIndex), ContainingType, ConstantInt::get(Type::getInt1Ty(VMContext), isArtificial), - ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized) + ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized), + Fn }; - return DISubprogram(MDNode::get(VMContext, &Elts[0], 16)); + return DISubprogram(MDNode::get(VMContext, &Elts[0], 17)); } /// CreateSubprogramDefinition - Create new subprogram descriptor for the Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=105828&r1=105827&r2=105828&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jun 11 15:08:44 2010 @@ -866,6 +866,10 @@ } else if (Context.isNameSpace()) { DIE *ContextDIE = getOrCreateNameSpace(DINameSpace(Context)); ContextDIE->addChild(Die); + } else if (Context.isSubprogram()) { + DIE *ContextDIE = createSubprogramDIE(DISubprogram(Context), + /*MakeDecl=*/false); + ContextDIE->addChild(Die); } else if (DIE *ContextDIE = getCompileUnit(Context)->getDIE(Context)) ContextDIE->addChild(Die); else @@ -1055,6 +1059,10 @@ if (DIDescriptor(ContainingType).isCompositeType()) addDIEEntry(&Buffer, dwarf::DW_AT_containing_type, dwarf::DW_FORM_ref4, getOrCreateTypeDIE(DIType(ContainingType))); + else { + DIDescriptor Context = CTy.getContext(); + addToContextOwner(&Buffer, Context); + } break; } default: @@ -1329,6 +1337,9 @@ // DW_TAG_inlined_subroutine may refer to this DIE. SPCU->insertDIE(SP, SPDie); + // Add to context owner. + addToContextOwner(SPDie, SP.getContext()); + return SPDie; } @@ -2342,7 +2353,8 @@ if (!WScope->getParent()) { StringRef SPName = DISubprogram(Scope).getLinkageName(); - if (SPName == Asm->MF->getFunction()->getName()) + if (SPName == Asm->MF->getFunction()->getName() || + DISubprogram(Scope).getFunction() == Asm->MF->getFunction()) CurrentFnDbgScope = WScope; } @@ -2803,6 +2815,16 @@ Src = GetOrCreateSourceID(Dir, Fn); } +#if 0 + if (!Lines.empty()) { + SrcLineInfo lastSrcLineInfo = Lines.back(); + // Emitting sequential line records with the same line number (but + // different addresses) seems to confuse GDB. Avoid this. + if (lastSrcLineInfo.getLine() == Line) + return NULL; + } +#endif + MCSymbol *Label = MMI->getContext().CreateTempSymbol(); Lines.push_back(SrcLineInfo(Line, Col, Src, Label)); Modified: llvm/trunk/test/FrontendC++/2010-02-17-DbgArtificialArg.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2010-02-17-DbgArtificialArg.cpp?rev=105828&r1=105827&r2=105828&view=diff ============================================================================== --- llvm/trunk/test/FrontendC++/2010-02-17-DbgArtificialArg.cpp (original) +++ llvm/trunk/test/FrontendC++/2010-02-17-DbgArtificialArg.cpp Fri Jun 11 15:08:44 2010 @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -g -S %s -o - | grep DW_TAG_pointer_type | grep "i32 524303, metadata .., metadata ..., metadata .., i32 ., i64 .., i64 .., i64 0, i32 64, metadata ..." +// RUN: %llvmgcc -g -S %s -o - | FileCheck %s // Here, second to last argument "i32 64" indicates that artificial type is set. // Test to artificial attribute attahed to "this" pointer type. // Radar 7655792 and 7655002 @@ -10,5 +10,7 @@ int foo() { A a; + // Matching "i32 64, metadata !} ; [ DW_TAG_pointer_type ]" + // CHECK: i32 64, metadata {{![0-9]+\} ; \[ DW_TAG_pointer_type \]}} return a.fn1(1); } From stuart at apple.com Fri Jun 11 15:08:48 2010 From: stuart at apple.com (Stuart Hastings) Date: Fri, 11 Jun 2010 20:08:48 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r105829 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp llvm-debug.cpp llvm-debug.h llvm-internal.h Message-ID: <20100611200848.2E6062A6C12D@llvm.org> Author: stuart Date: Fri Jun 11 15:08:47 2010 New Revision: 105829 URL: http://llvm.org/viewvc/llvm-project?rev=105829&view=rev Log: Support for nested functions/classes in debug output. (Again.) Radar 7424645. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp llvm-gcc-4.2/trunk/gcc/llvm-debug.h llvm-gcc-4.2/trunk/gcc/llvm-internal.h Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=105829&r1=105828&r2=105829&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Fri Jun 11 15:08:47 2010 @@ -526,6 +526,8 @@ if (debug_info_level > DINFO_LEVEL_NONE) TheDebugInfo = new DebugInfo(TheModule); + else + TheDebugInfo = 0; } /// performLateBackendInitialization - Set backend options that may only be @@ -1018,7 +1020,8 @@ // Convert the AST to raw/ugly LLVM code. Function *Fn; { - TreeToLLVM Emitter(fndecl); + TreeToLLVM *Emitter = new TreeToLLVM(fndecl); + // FIXME: should we store TheTreeToLLVM right here (current in constructor)? enum symbol_visibility vis = DECL_VISIBILITY (fndecl); if (vis != VISIBILITY_DEFAULT) @@ -1026,7 +1029,8 @@ // visibility that's not supported by the target. targetm.asm_out.visibility(fndecl, vis); - Fn = Emitter.EmitFunction(); + Fn = TheTreeToLLVM->EmitFunction(); + Emitter->~TreeToLLVM(); } #if 0 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=105829&r1=105828&r2=105829&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Jun 11 15:08:47 2010 @@ -148,7 +148,7 @@ //===----------------------------------------------------------------------===// /// TheTreeToLLVM - Keep track of the current function being compiled. -static TreeToLLVM *TheTreeToLLVM = 0; +TreeToLLVM *TheTreeToLLVM = 0; const TargetData &getTargetData() { return *TheTarget->getTargetData(); @@ -157,7 +157,7 @@ /// EmitDebugInfo - Return true if debug info is to be emitted for current /// function. bool TreeToLLVM::EmitDebugInfo() { - if (TheDebugInfo && !DECL_IGNORED_P(getFUNCTION_DECL())) + if (TheDebugInfo && getFUNCTION_DECL() && !DECL_IGNORED_P(getFUNCTION_DECL())) return true; return false; } @@ -616,7 +616,7 @@ SeenBlocks.clear(); if (EmitDebugInfo()) - TheDebugInfo->EmitFunctionStart(FnDecl, Fn, Builder.GetInsertBlock()); + TheDebugInfo->EmitFunctionStart(FnDecl); // Loop over all of the arguments to the function, setting Argument names and // creating argument alloca's for the PARM_DECLs in case their address is @@ -631,7 +631,7 @@ ABIConverter.HandleReturnType(TREE_TYPE(TREE_TYPE(FnDecl)), FnDecl, DECL_BUILT_IN(FnDecl)); // Remember this for use by FinishFunctionBody. - TheTreeToLLVM->ReturnOffset = Client.Offset; + ReturnOffset = Client.Offset; // Prepend the static chain (if any) to the list of arguments. tree Args = static_chain ? static_chain : DECL_ARGUMENTS(FnDecl); Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=105829&r1=105828&r2=105829&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Fri Jun 11 15:08:47 2010 @@ -277,7 +277,7 @@ // regions to arrive at 'desired'. This was inspired (cribbed from) // by GCC's cfglayout.c:change_scope(). void DebugInfo::change_regions(tree desired, tree grand) { - tree current_lexical_block = getCurrentLexicalBlock(); + tree current_lexical_block = getCurrentLexicalBlock(), t; // FIXME: change_regions is currently never called with desired == // grand, but it should be fixed so nothing weird happens if they're // equal. @@ -288,28 +288,34 @@ RegionStack.pop_back(); } DebugInfo::push_regions(desired, grand); - setCurrentLexicalBlock(desired); + // There's no point in declaring an empty (declares no variables) + // lexical BLOCK as the current lexical BLOCK. Locate nearest + // non-empty ancestor BLOCK and declare that. + for (t = desired; TREE_CODE(t) == BLOCK; t = BLOCK_SUPERCONTEXT(t)) + if (BLOCK_VARS(t)) + break; + setCurrentLexicalBlock(t); } -/// EmitFunctionStart - Constructs the debug code for entering a function. -void DebugInfo::EmitFunctionStart(tree FnDecl, Function *Fn, - BasicBlock *CurBB) { - setCurrentLexicalBlock(FnDecl); - +/// CreateSubprogramFromFnDecl - Constructs the debug code for +/// entering a function - "llvm.dbg.func.start." +DISubprogram DebugInfo::CreateSubprogramFromFnDecl(tree FnDecl) { + DISubprogram SPDecl; + bool SPDeclIsSet = false; + // True if we're currently generating LLVM for this function. + bool definition = llvm_set_decl_p(FnDecl); DIType FNType = getOrCreateType(TREE_TYPE(FnDecl)); std::map::iterator I = SPCache.find(FnDecl); if (I != SPCache.end()) { - DISubprogram SPDecl(cast(I->second)); - DISubprogram SP = - DebugFactory.CreateSubprogramDefinition(SPDecl); - SPDecl->replaceAllUsesWith(SP); - - // Push function on region stack. - RegionStack.push_back(WeakVH(SP)); - RegionMap[FnDecl] = WeakVH(SP); - return; - } + SPDecl = DISubprogram(cast(I->second)); + SPDeclIsSet = true; + // If we've already created the defining instance, OR this + // invocation won't create the defining instance, return what we + // already have. + if (SPDecl.isDefinition() || !definition) + return SPDecl; + } bool ArtificialFnWithAbstractOrigin = false; // If this artificial function has abstract origin then put this function @@ -323,26 +329,34 @@ getOrCreateFile(main_input_filename) : findRegion (DECL_CONTEXT(FnDecl)); + // Declare block_invoke functions at file scope for GDB. + if (BLOCK_SYNTHESIZED_FUNC(FnDecl)) + SPContext = findRegion(NULL_TREE); + // Creating context may have triggered creation of this SP descriptor. So // check the cache again. - I = SPCache.find(FnDecl); - if (I != SPCache.end()) { - DISubprogram SPDecl(cast(I->second)); - DISubprogram SP = - DebugFactory.CreateSubprogramDefinition(SPDecl); - SPDecl->replaceAllUsesWith(SP); - - // Push function on region stack. - RegionStack.push_back(WeakVH(SP)); - RegionMap[FnDecl] = WeakVH(SP); - return; - } + if (!SPDeclIsSet) { + I = SPCache.find(FnDecl); + if (I != SPCache.end()) { + SPDecl = DISubprogram(cast(I->second)); + DISubprogram SP = + DebugFactory.CreateSubprogramDefinition(SPDecl); + SPDecl->replaceAllUsesWith(SP); + // Push function on region stack. + RegionStack.push_back(WeakVH(SP)); + RegionMap[FnDecl] = WeakVH(SP); + return SP; + } + } // Gather location information. expanded_location Loc = GetNodeLocation(FnDecl, false); - StringRef LinkageName = getLinkageName(FnDecl); + // If the name isn't public, omit the linkage name. Adding a + // linkage name to a class method can confuse GDB. + StringRef LinkageName = TREE_PUBLIC(FnDecl) ? + getLinkageName(FnDecl) : StringRef(); - unsigned lineno = CurLineNo; + unsigned lineno = LOCATION_LINE(Loc); if (isCopyOrDestroyHelper(FnDecl)) lineno = 0; @@ -357,23 +371,40 @@ } StringRef FnName = getFunctionName(FnDecl); - + // If the Function * hasn't been created yet, use a bogus value for + // the debug internal linkage bit. + bool hasInternalLinkage = true; + Function *Fn = 0; + if (GET_DECL_LLVM_INDEX(FnDecl)) { + Fn = castDECL_LLVM(FnDecl); + if (Fn) + hasInternalLinkage = Fn->hasInternalLinkage(); + } DISubprogram SP = DebugFactory.CreateSubprogram(SPContext, FnName, FnName, LinkageName, getOrCreateFile(Loc.file), lineno, FNType, - Fn->hasInternalLinkage(), - true /*definition*/, + hasInternalLinkage, + definition, Virtuality, VIndex, ContainingType, - DECL_ARTIFICIAL (FnDecl), optimize); + DECL_ARTIFICIAL (FnDecl), optimize, + Fn); SPCache[FnDecl] = WeakVH(SP); + RegionMap[FnDecl] = WeakVH(SP); + if (SPDeclIsSet && SPDecl != SP) + SPDecl->replaceAllUsesWith(SP); + return SP; +} +/// EmitFunctionStart - Constructs the debug code for entering a function. +void DebugInfo::EmitFunctionStart(tree FnDecl) { + setCurrentLexicalBlock(FnDecl); + DISubprogram SP = CreateSubprogramFromFnDecl(FnDecl); // Push function on region stack. RegionStack.push_back(WeakVH(SP)); - RegionMap[FnDecl] = WeakVH(SP); } /// getOrCreateNameSpace - Get name space descriptor for the tree node. @@ -392,6 +423,58 @@ return DNS; } +/// variablesDeclaredAtThisLevel - yield true if this block, or any +/// sibling thereof, declares any variables or types. Expectes a +/// BLOCK or FUNCTION_DECL tree. +// GDB Kludge +static bool variablesDeclaredAtThisLevel(tree blk) { + if (TREE_CODE(blk) == FUNCTION_DECL) + return true; + assert(TREE_CODE(blk) == BLOCK && "expected FUNCTION_DECL or BLOCK tree"); + tree supercontext = BLOCK_SUPERCONTEXT(blk); + if (!supercontext) // External scope. Pretend it's the same as module scope. + return false; + tree step = TREE_CODE(supercontext) == BLOCK ? + BLOCK_SUBBLOCKS(supercontext) : DECL_INITIAL(supercontext); + for ( ; step && TREE_CODE(step) == BLOCK; step = TREE_CHAIN(step)) + if (BLOCK_VARS(step)) + return true; + return false; +} + +/// supercontextWithDecls - walk up the BLOCKS tree, return an +/// ancestor BLOCK that has vars, or sibling BLOCKs that do. May +/// return the FUNCTION_DECL. +// GDB Kludge +static tree supercontextWithDecls(tree blk) { + assert(TREE_CODE(blk) == BLOCK && "expected BLOCK"); + tree step = BLOCK_SUPERCONTEXT(blk); + if (!step) // No parent BLOCKs to search. + return blk; + while (step && TREE_CODE(step) == BLOCK && BLOCK_SUPERCONTEXT(step) && + !variablesDeclaredAtThisLevel(step)) + step = BLOCK_SUPERCONTEXT(step); + return step; +} + +/// nonemptySibling - true if the given BLOCK has a sibling that is +/// not empty (declares types and/or vars). +// GDB Kludge +static bool nonemptySibling(tree blk) { + if (TREE_CODE(blk) == FUNCTION_DECL) + return true; + assert(TREE_CODE(blk) == BLOCK && "expected FUNCTION_DECL or BLOCK tree"); + tree supercontext = BLOCK_SUPERCONTEXT(blk); + if (!supercontext) // External scope. Pretend it's the same as module scope. + return false; + tree step = TREE_CODE(supercontext) == BLOCK ? + BLOCK_SUBBLOCKS(supercontext) : DECL_INITIAL(supercontext); + for ( ; step; step = TREE_CHAIN(step)) + if (step != blk && BLOCK_VARS(step)) + return true; + return false; +} + /// findRegion - Find tree_node N's region. DIDescriptor DebugInfo::findRegion(tree Node) { if (Node == NULL_TREE) @@ -406,20 +489,71 @@ DIType Ty = getOrCreateType(Node); return DIDescriptor(Ty); } else if (DECL_P (Node)) { - if (TREE_CODE (Node) == NAMESPACE_DECL) { + switch (TREE_CODE(Node)) { + default: + /// What kind of DECL is this? + return findRegion (DECL_CONTEXT (Node)); + case NAMESPACE_DECL: { DIDescriptor NSContext = findRegion(DECL_CONTEXT(Node)); DINameSpace NS = getOrCreateNameSpace(Node, NSContext); return DIDescriptor(NS); } - return findRegion (DECL_CONTEXT (Node)); + case FUNCTION_DECL: { + DISubprogram SP = CreateSubprogramFromFnDecl(Node); + return SP; + } + } } else if (TREE_CODE(Node) == BLOCK) { // TREE_BLOCK is GCC's lexical block. - // Recursively create all necessary contexts: - DIDescriptor context = findRegion(BLOCK_SUPERCONTEXT(Node)); - DILexicalBlock lexical_block = - DebugFactory.CreateLexicalBlock(context, CurLineNo); - RegionMap[Node] = WeakVH(lexical_block); - return DIDescriptor(lexical_block); + tree scopeToDeclare, step; + +#if 0 + // GDB Kludge + // This code section is devoted to eliminating as many lexical + // blocks as possible, in order to mimic GCC debug output. In a + // perfect world, the debugger would not be adversely affected by + // a few extra lexical scopes. Ideally this stuff could be + // drastically simplified when LLDB replaces GDB. + if (nonemptySibling(Node)) { + // If any sibling BLOCK declares anything, use this scope. + scopeToDeclare = Node; + } else { + tree upper = supercontextWithDecls(Node); + if (TREE_CODE(upper) == FUNCTION_DECL) { + scopeToDeclare = upper; + } else if (TREE_CODE(upper) == BLOCK && BLOCK_VARS(upper) && BLOCK_VARS(Node) && + upper != Node) { + // We can't use upper because it declares something. Find the + // uppermost empty BLOCK /between/ Node and upper. + for (step = BLOCK_SUPERCONTEXT(Node); + TREE_CODE(step) == BLOCK && !BLOCK_VARS(step) && + BLOCK_SUPERCONTEXT(step); + step = BLOCK_SUPERCONTEXT(step)) + ; + scopeToDeclare = step; + } else + // Either or both of upper and Node are empty (declare + // nothing); fuse Node's scope with upper. + scopeToDeclare = upper; + } +#else + scopeToDeclare = Node; +#endif + + switch (TREE_CODE(scopeToDeclare)) { + default: + assert("non-BLOCK, non-FUNCTION_DECL scope!"); + case FUNCTION_DECL: + return CreateSubprogramFromFnDecl(scopeToDeclare); + case BLOCK: + // Recursively establish ancestor scopes. + DIDescriptor context = findRegion(BLOCK_SUPERCONTEXT(scopeToDeclare)); + DILexicalBlock lexical_block = + DebugFactory.CreateLexicalBlock(context, CurLineNo); + RegionMap[scopeToDeclare] = WeakVH(lexical_block); + return DIDescriptor(lexical_block); + } + // GDB Kludge end } // Otherwise main compile unit covers everything. @@ -651,7 +785,7 @@ sprintf(FwdTypeName, "fwd.type.%d", FwdTypeCount++); llvm::DIType FwdType = DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_subroutine_type, - getOrCreateFile(main_input_filename), + findRegion(TYPE_CONTEXT(type)), FwdTypeName, getOrCreateFile(main_input_filename), 0, 0, 0, 0, 0, @@ -738,7 +872,7 @@ StringRef PName = FromTy.getName(); DIType PTy = - DebugFactory.CreateDerivedType(Tag, findRegion(TYPE_CONTEXT(type)), + DebugFactory.CreateDerivedType(Tag, findRegion(TYPE_CONTEXT(type)), Tag == DW_TAG_pointer_type ? StringRef() : PName, getOrCreateFile(main_input_filename), Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.h?rev=105829&r1=105828&r2=105829&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Fri Jun 11 15:08:47 2010 @@ -118,9 +118,13 @@ // by GCC's cfglayout.c:change_scope(). void change_regions(tree_node *desired, tree_node *grand); - /// EmitFunctionStart - Constructs the debug code for entering a function - + /// CreateSubprogramFromFnDecl - Constructs the debug code for entering a function - /// "llvm.dbg.func.start." - void EmitFunctionStart(tree_node *FnDecl, Function *Fn, BasicBlock *CurBB); + DISubprogram CreateSubprogramFromFnDecl(tree_node *FnDecl); + + /// EmitFunctionStart - Constructs the debug code for entering a function - + /// "llvm.dbg.func.start", and pushes it onto the RegionStack. + void EmitFunctionStart(tree_node *FnDecl); /// EmitFunctionEnd - Constructs the debug code for exiting a declarative /// region - "llvm.dbg.region.end." 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=105829&r1=105828&r2=105829&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Fri Jun 11 15:08:47 2010 @@ -75,7 +75,7 @@ extern llvm::Module *TheModule; /// TheDebugInfo - This object is responsible for gather all debug information. -/// If it's value is NULL then no debug information should be gathered. +/// If its value is NULL then no debug information should be gathered. extern llvm::DebugInfo *TheDebugInfo; /// TheTarget - The current target being compiled for. @@ -281,6 +281,7 @@ BasicBlock *ReturnBB; BasicBlock *UnwindBB; unsigned ReturnOffset; + // Lexical BLOCKS that we have previously seen and processed. treeset SeenBlocks; @@ -397,6 +398,10 @@ // allocation would change with -g, and users dislike that. void switchLexicalBlock(tree_node *exp); + /// StartFunctionBody - Start the emission of 'FnDecl', outputing all + /// declarations for parameters and setting things up. + void StartFunctionBody(); + private: // Helper functions. // Walk over the lexical BLOCK() tree of the given FUNCTION_DECL; @@ -405,10 +410,6 @@ // the given set. void setLexicalBlockDepths(tree_node *t, treeset &s, unsigned level); - /// StartFunctionBody - Start the emission of 'fndecl', outputing all - /// declarations for parameters and setting things up. - void StartFunctionBody(); - /// FinishFunctionBody - Once the body of the function has been emitted, this /// cleans up and returns the result function. Function *FinishFunctionBody(); @@ -608,6 +609,9 @@ Constant *EmitLV_LABEL_DECL(tree_node *exp); }; +/// TheTreeToLLVM - Keep track of the current function being compiled. +extern TreeToLLVM *TheTreeToLLVM; + /// TreeConstantToLLVM - An instance of this class is created and used to /// convert tree constant values to LLVM. This is primarily for things like /// global variable initializers. From criswell at uiuc.edu Fri Jun 11 15:21:36 2010 From: criswell at uiuc.edu (John Criswell) Date: Fri, 11 Jun 2010 20:21:36 -0000 Subject: [llvm-commits] [poolalloc] r105831 - in /poolalloc/trunk/lib/DSA: BottomUpClosure.cpp DSGraph.cpp Message-ID: <20100611202136.E16FB2A6C12C@llvm.org> Author: criswell Date: Fri Jun 11 15:21:36 2010 New Revision: 105831 URL: http://llvm.org/viewvc/llvm-project?rev=105831&view=rev Log: Added comments. Improved formatting. No functionality changes. Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp poolalloc/trunk/lib/DSA/DSGraph.cpp Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=105831&r1=105830&r2=105831&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original) +++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Fri Jun 11 15:21:36 2010 @@ -72,14 +72,26 @@ // mergeSCCs(); - //Post order traversal: + // + // Do a post-order traversal of the SCC callgraph and do bottom-up inlining. + // { //errs() << *DSG.knownRoots.begin() << " -> " << *DSG.knownRoots.rbegin() << "\n"; svset marked; for (DSCallGraph::root_iterator ii = callgraph.root_begin(), ee = callgraph.root_end(); ii != ee; ++ii) { //errs() << (*ii)->getName() << "\n"; + + // + // Do bottom-up inlining of the function. + // DSGraph* G = postOrder(*ii, marked); + + // + // Update the list of unresolved indirect function call sites in the + // globals graph with the new information learned about the current + // function. + // CloneAuxIntoGlobal(G); } } @@ -132,16 +144,19 @@ // Method: mergeSCCs() // // Description: -// For every Strongly Connected Component (SCC) in the callgraph, this method -// iterates through every function in the SCC and merges its DSGraph into a -// single DSGraph for the SCC. +// Create a single DSGraph for every Strongly Connected Component (SCC) in the +// callgraph. This is done by merging the DSGraphs of every function within +// each SCC. // void BUDataStructures::mergeSCCs() { for (DSCallGraph::flat_key_iterator ii = callgraph.flat_key_begin(), ee = callgraph.flat_key_end(); ii != ee; ++ii) { - // Externals can be singleton SCCs + // + // External functions form their own singleton SCC. + // if ((*ii)->isDeclaration()) continue; + DSGraph* SCCGraph = getOrCreateGraph(*ii); unsigned SCCSize = 1; callgraph.assertSCCRoot(*ii); @@ -177,18 +192,22 @@ // Inputs: // F - The function on which to do whatever. // marked - A reference to a set containing all values processed by -// previous invocation (this method is recursive). +// previous invocations (this method is recursive). // // Outputs: // marked - Updated to contain function F. // DSGraph* BUDataStructures::postOrder(const Function* F, svset& marked) { + // + // If we have already processed this function before, do not process it + // again. + // callgraph.assertSCCRoot(F); DSGraph* G = getDSGraph(*F); if (marked.count(F)) return G; - for(DSCallGraph::flat_iterator ii = callgraph.flat_callee_begin(F), + for (DSCallGraph::flat_iterator ii = callgraph.flat_callee_begin(F), ee = callgraph.flat_callee_end(F); ii != ee; ++ii) { callgraph.assertSCCRoot(*ii); assert (*ii != F && "Simple loop in callgraph"); @@ -196,9 +215,20 @@ postOrder(*ii, marked); } + // + // Record that we are about to process the given function. + // marked.insert(F); + + // + // Inline the graphs of callees into this function's callgraph. + // calculateGraph(G); - //once calculated, we can update the callgraph + + // + // Now that we have new information merged into the function's DSGraph, + // update the call graph using this new information. + // G->buildCallGraph(callgraph); return G; } Modified: poolalloc/trunk/lib/DSA/DSGraph.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSGraph.cpp?rev=105831&r1=105830&r2=105831&view=diff ============================================================================== --- poolalloc/trunk/lib/DSA/DSGraph.cpp (original) +++ poolalloc/trunk/lib/DSA/DSGraph.cpp Fri Jun 11 15:21:36 2010 @@ -1226,8 +1226,15 @@ } } -// Filter potential call targets -static bool functionIsCallable(CallSite CS, const Function* F) { +// +// Function: functionIsCallable() +// +// Description: +// Determine whether the specified function can be a target of the specified +// call site. We allow the user to configure what we consider to be +// uncallable at an indirect function call site. +// +static bool functionIsCallable (CallSite CS, const Function* F) { //Which targets do we choose? //Conservative: all of them //Pretty Safe: same calling convention, otherwise undefined behavior @@ -1258,18 +1265,46 @@ return true; } +// +// Method: buildCallGraph() +// +// Description: +// This method updates the given call graph with new information about targets +// of function calls that can be inferred from the unresolved call sites +// within the DSGraph. +// void DSGraph::buildCallGraph(DSCallGraph& DCG) const { + // + // Get the list of unresolved call sites. + // const std::list& Calls = getAuxFunctionCalls(); - for (std::list::const_iterator ii = Calls.begin(), ee = Calls.end(); - ii != ee; ++ii) + for (std::list::const_iterator ii = Calls.begin(), + ee = Calls.end(); + ii != ee; ++ii) { + // + // Direct calls are easy. We know to where they go. + // if (ii->isDirectCall()) { DCG.insert(ii->getCallSite(), ii->getCalleeFunc()); } else { CallSite CS = ii->getCallSite(); std::vector MaybeTargets; + + // + // Get the list of known targets of this function. + // ii->getCalleeNode()->addFullFunctionList(MaybeTargets); - //Assure have a record for this callsite + + // + // Ensure that the call graph at least knows about (has a record of) this + // call site. + // DCG.insert(CS, 0); + + // + // Add to the call graph only function targets that have well-defined + // behavior using LLVM semantics. + // for (std::vector::iterator Fi = MaybeTargets.begin(), Fe = MaybeTargets.end(); Fi != Fe; ++Fi) if (functionIsCallable(CS, *Fi)) @@ -1277,4 +1312,5 @@ else ++NumFiltered; } + } } From bob.wilson at apple.com Fri Jun 11 16:34:50 2010 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 11 Jun 2010 21:34:50 -0000 Subject: [llvm-commits] [llvm] r105836 - in /llvm/trunk: lib/Target/ARM/ARMBaseInstrInfo.h lib/Target/ARM/ARMCodeEmitter.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/ARM/ARMInstrNEON.td lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp lib/Target/ARM/AsmPrinter/ARMInstPrinter.h lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp utils/TableGen/EDEmitter.cpp Message-ID: <20100611213450.C8FA92A6C12C@llvm.org> Author: bwilson Date: Fri Jun 11 16:34:50 2010 New Revision: 105836 URL: http://llvm.org/viewvc/llvm-project?rev=105836&view=rev Log: Add instruction encoding for the Neon VMOV immediate instruction. This changes the machine instruction representation of the immediate value to be encoded into an integer with similar fields as the actual VMOV instruction. This makes things easier for the disassembler, since it can just stuff the bits into the immediate operand, but harder for the asm printer since it has to decode the value to be printed. Testcase for the encoding will follow later when MC has more support for ARM. Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMInstrNEON.td llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp llvm/trunk/utils/TableGen/EDEmitter.cpp Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h?rev=105836&r1=105835&r2=105836&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.h Fri Jun 11 16:34:50 2010 @@ -116,11 +116,23 @@ // Thumb format ThumbFrm = 24 << FormShift, - // NEON format + // NEON formats NEONFrm = 25 << FormShift, NEONGetLnFrm = 26 << FormShift, NEONSetLnFrm = 27 << FormShift, NEONDupFrm = 28 << FormShift, + NLdStFrm = 31 << FormShift, + N1RegModImmFrm= 32 << FormShift, + N2RegFrm = 33 << FormShift, + NVCVTFrm = 34 << FormShift, + NVDupLnFrm = 35 << FormShift, + N2RegVShLFrm = 36 << FormShift, + N2RegVShRFrm = 37 << FormShift, + N3RegFrm = 38 << FormShift, + N3RegVShFrm = 39 << FormShift, + NVExtFrm = 40 << FormShift, + NVMulSLFrm = 41 << FormShift, + NVTBLFrm = 42 << FormShift, //===------------------------------------------------------------------===// // Misc flags. Modified: llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp?rev=105836&r1=105835&r2=105836&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMCodeEmitter.cpp Fri Jun 11 16:34:50 2010 @@ -139,6 +139,8 @@ void emitMiscInstruction(const MachineInstr &MI); + void emitNEON1RegModImm(const MachineInstr &MI); + /// getMachineOpValue - Return binary encoding of operand. If the machine /// operand requires relocation, record the relocation and return zero. unsigned getMachineOpValue(const MachineInstr &MI,const MachineOperand &MO); @@ -408,6 +410,10 @@ case ARMII::VFPMiscFrm: emitMiscInstruction(MI); break; + // NEON instructions. + case ARMII::N1RegModImmFrm: + emitNEON1RegModImm(MI); + break; } MCE.processDebugLoc(MI.getDebugLoc(), false); } @@ -1540,4 +1546,32 @@ emitWordLE(Binary); } +static unsigned encodeNEONRd(const MachineInstr &MI, unsigned OpIdx) { + unsigned RegD = MI.getOperand(OpIdx).getReg(); + unsigned Binary = 0; + RegD = ARMRegisterInfo::getRegisterNumbering(RegD); + Binary |= (RegD & 0xf) << ARMII::RegRdShift; + Binary |= ((RegD >> 4) & 1) << ARMII::D_BitShift; + return Binary; +} + +void ARMCodeEmitter::emitNEON1RegModImm(const MachineInstr &MI) { + unsigned Binary = getBinaryCodeForInstr(MI); + // Destination register is encoded in Dd. + Binary |= encodeNEONRd(MI, 0); + // Immediate fields: Op, Cmode, I, Imm3, Imm4 + unsigned Imm = MI.getOperand(1).getImm(); + unsigned Op = (Imm >> 12) & 1; + Binary |= (Op << 5); + unsigned Cmode = (Imm >> 8) & 0xf; + Binary |= (Cmode << 8); + unsigned I = (Imm >> 7) & 1; + Binary |= (I << 24); + unsigned Imm3 = (Imm >> 4) & 0x7; + Binary |= (Imm3 << 16); + unsigned Imm4 = Imm & 0xf; + Binary |= Imm4; + emitWordLE(Binary); +} + #include "ARMGenCodeEmitter.inc" Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=105836&r1=105835&r2=105836&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Fri Jun 11 16:34:50 2010 @@ -2758,68 +2758,130 @@ } /// isVMOVSplat - Check if the specified splat value corresponds to an immediate -/// VMOV instruction, and if so, return the constant being splatted. +/// VMOV instruction. If so, return either the constant being splatted or the +/// encoded value, depending on the DoEncode parameter. The format of the +/// encoded value is: bit12=Op, bits11-8=Cmode, bits7-0=Immediate. static SDValue isVMOVSplat(uint64_t SplatBits, uint64_t SplatUndef, - unsigned SplatBitSize, SelectionDAG &DAG) { + unsigned SplatBitSize, SelectionDAG &DAG, + bool DoEncode) { + unsigned Op, Cmode, Imm; + EVT VT; + + Op = 0; switch (SplatBitSize) { case 8: - // Any 1-byte value is OK. + // Any 1-byte value is OK. Op=0, Cmode=1110. assert((SplatBits & ~0xff) == 0 && "one byte splat value is too big"); - return DAG.getTargetConstant(SplatBits, MVT::i8); + Cmode = 0xe; + Imm = SplatBits; + VT = MVT::i8; + break; case 16: // NEON's 16-bit VMOV supports splat values where only one byte is nonzero. - if ((SplatBits & ~0xff) == 0 || - (SplatBits & ~0xff00) == 0) - return DAG.getTargetConstant(SplatBits, MVT::i16); - break; + VT = MVT::i16; + if ((SplatBits & ~0xff) == 0) { + // Value = 0x00nn: Op=x, Cmode=100x. + Cmode = 0x8; + Imm = SplatBits; + break; + } + if ((SplatBits & ~0xff00) == 0) { + // Value = 0xnn00: Op=x, Cmode=101x. + Cmode = 0xa; + Imm = SplatBits >> 8; + break; + } + return SDValue(); case 32: // NEON's 32-bit VMOV supports splat values where: // * only one byte is nonzero, or // * the least significant byte is 0xff and the second byte is nonzero, or // * the least significant 2 bytes are 0xff and the third is nonzero. - if ((SplatBits & ~0xff) == 0 || - (SplatBits & ~0xff00) == 0 || - (SplatBits & ~0xff0000) == 0 || - (SplatBits & ~0xff000000) == 0) - return DAG.getTargetConstant(SplatBits, MVT::i32); + VT = MVT::i32; + if ((SplatBits & ~0xff) == 0) { + // Value = 0x000000nn: Op=x, Cmode=000x. + Cmode = 0; + Imm = SplatBits; + break; + } + if ((SplatBits & ~0xff00) == 0) { + // Value = 0x0000nn00: Op=x, Cmode=001x. + Cmode = 0x2; + Imm = SplatBits >> 8; + break; + } + if ((SplatBits & ~0xff0000) == 0) { + // Value = 0x00nn0000: Op=x, Cmode=010x. + Cmode = 0x4; + Imm = SplatBits >> 16; + break; + } + if ((SplatBits & ~0xff000000) == 0) { + // Value = 0xnn000000: Op=x, Cmode=011x. + Cmode = 0x6; + Imm = SplatBits >> 24; + break; + } if ((SplatBits & ~0xffff) == 0 && - ((SplatBits | SplatUndef) & 0xff) == 0xff) - return DAG.getTargetConstant(SplatBits | 0xff, MVT::i32); + ((SplatBits | SplatUndef) & 0xff) == 0xff) { + // Value = 0x0000nnff: Op=x, Cmode=1100. + Cmode = 0xc; + Imm = SplatBits >> 8; + SplatBits |= 0xff; + break; + } if ((SplatBits & ~0xffffff) == 0 && - ((SplatBits | SplatUndef) & 0xffff) == 0xffff) - return DAG.getTargetConstant(SplatBits | 0xffff, MVT::i32); + ((SplatBits | SplatUndef) & 0xffff) == 0xffff) { + // Value = 0x00nnffff: Op=x, Cmode=1101. + Cmode = 0xd; + Imm = SplatBits >> 16; + SplatBits |= 0xffff; + break; + } // Note: there are a few 32-bit splat values (specifically: 00ffff00, // ff000000, ff0000ff, and ffff00ff) that are valid for VMOV.I64 but not // VMOV.I32. A (very) minor optimization would be to replicate the value // and fall through here to test for a valid 64-bit splat. But, then the // caller would also need to check and handle the change in size. - break; + return SDValue(); case 64: { // NEON has a 64-bit VMOV splat where each byte is either 0 or 0xff. uint64_t BitMask = 0xff; uint64_t Val = 0; + unsigned ImmMask = 1; + Imm = 0; for (int ByteNum = 0; ByteNum < 8; ++ByteNum) { - if (((SplatBits | SplatUndef) & BitMask) == BitMask) + if (((SplatBits | SplatUndef) & BitMask) == BitMask) { Val |= BitMask; - else if ((SplatBits & BitMask) != 0) + Imm |= ImmMask; + } else if ((SplatBits & BitMask) != 0) { return SDValue(); + } BitMask <<= 8; + ImmMask <<= 1; } - return DAG.getTargetConstant(Val, MVT::i64); + // Op=1, Cmode=1110. + Op = 1; + Cmode = 0xe; + SplatBits = Val; + VT = MVT::i64; + break; } default: - llvm_unreachable("unexpected size for isVMOVSplat"); - break; + llvm_unreachable("unexpected size for EncodeNEONModImm"); + return SDValue(); } - return SDValue(); + if (DoEncode) + return DAG.getTargetConstant((Op << 12) | (Cmode << 8) | Imm, MVT::i32); + return DAG.getTargetConstant(SplatBits, VT); } /// getVMOVImm - If this is a build_vector of constants which can be @@ -2839,7 +2901,7 @@ return SDValue(); return isVMOVSplat(SplatBits.getZExtValue(), SplatUndef.getZExtValue(), - SplatBitSize, DAG); + SplatBitSize, DAG, true); } static bool isVEXTMask(const SmallVectorImpl &M, EVT VT, @@ -3080,7 +3142,8 @@ if (BVN->isConstantSplat(SplatBits, SplatUndef, SplatBitSize, HasAnyUndefs)) { if (SplatBitSize <= 64) { SDValue Val = isVMOVSplat(SplatBits.getZExtValue(), - SplatUndef.getZExtValue(), SplatBitSize, DAG); + SplatUndef.getZExtValue(), SplatBitSize, DAG, + false); if (Val.getNode()) return BuildSplat(Val, VT, DAG, dl); } Modified: llvm/trunk/lib/Target/ARM/ARMInstrNEON.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrNEON.td?rev=105836&r1=105835&r2=105836&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrNEON.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrNEON.td Fri Jun 11 16:34:50 2010 @@ -98,17 +98,8 @@ // NEON operand definitions //===----------------------------------------------------------------------===// -def h8imm : Operand { - let PrintMethod = "printHex8ImmOperand"; -} -def h16imm : Operand { - let PrintMethod = "printHex16ImmOperand"; -} -def h32imm : Operand { - let PrintMethod = "printHex32ImmOperand"; -} -def h64imm : Operand { - let PrintMethod = "printHex64ImmOperand"; +def nModImm : Operand { + let PrintMethod = "printNEONModImmOperand"; } //===----------------------------------------------------------------------===// @@ -2864,38 +2855,38 @@ let isReMaterializable = 1 in { def VMOVv8i8 : N1ModImm<1, 0b000, 0b1110, 0, 0, 0, 1, (outs DPR:$dst), - (ins h8imm:$SIMM), IIC_VMOVImm, + (ins nModImm:$SIMM), IIC_VMOVImm, "vmov", "i8", "$dst, $SIMM", "", [(set DPR:$dst, (v8i8 vmovImm8:$SIMM))]>; def VMOVv16i8 : N1ModImm<1, 0b000, 0b1110, 0, 1, 0, 1, (outs QPR:$dst), - (ins h8imm:$SIMM), IIC_VMOVImm, + (ins nModImm:$SIMM), IIC_VMOVImm, "vmov", "i8", "$dst, $SIMM", "", [(set QPR:$dst, (v16i8 vmovImm8:$SIMM))]>; -def VMOVv4i16 : N1ModImm<1, 0b000, {1,0,?,?}, 0, 0, {?}, 1, (outs DPR:$dst), - (ins h16imm:$SIMM), IIC_VMOVImm, +def VMOVv4i16 : N1ModImm<1, 0b000, {1,0,?,0}, 0, 0, 0, 1, (outs DPR:$dst), + (ins nModImm:$SIMM), IIC_VMOVImm, "vmov", "i16", "$dst, $SIMM", "", [(set DPR:$dst, (v4i16 vmovImm16:$SIMM))]>; -def VMOVv8i16 : N1ModImm<1, 0b000, {1,0,?,?}, 0, 1, {?}, 1, (outs QPR:$dst), - (ins h16imm:$SIMM), IIC_VMOVImm, +def VMOVv8i16 : N1ModImm<1, 0b000, {1,0,?,0}, 0, 1, 0, 1, (outs QPR:$dst), + (ins nModImm:$SIMM), IIC_VMOVImm, "vmov", "i16", "$dst, $SIMM", "", [(set QPR:$dst, (v8i16 vmovImm16:$SIMM))]>; -def VMOVv2i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 0, {?}, 1, (outs DPR:$dst), - (ins h32imm:$SIMM), IIC_VMOVImm, +def VMOVv2i32 : N1ModImm<1, 0b000, {0,?,?,0}, 0, 0, 0, 1, (outs DPR:$dst), + (ins nModImm:$SIMM), IIC_VMOVImm, "vmov", "i32", "$dst, $SIMM", "", [(set DPR:$dst, (v2i32 vmovImm32:$SIMM))]>; -def VMOVv4i32 : N1ModImm<1, 0b000, {?,?,?,?}, 0, 1, {?}, 1, (outs QPR:$dst), - (ins h32imm:$SIMM), IIC_VMOVImm, +def VMOVv4i32 : N1ModImm<1, 0b000, {0,?,?,0}, 0, 1, 0, 1, (outs QPR:$dst), + (ins nModImm:$SIMM), IIC_VMOVImm, "vmov", "i32", "$dst, $SIMM", "", [(set QPR:$dst, (v4i32 vmovImm32:$SIMM))]>; def VMOVv1i64 : N1ModImm<1, 0b000, 0b1110, 0, 0, 1, 1, (outs DPR:$dst), - (ins h64imm:$SIMM), IIC_VMOVImm, + (ins nModImm:$SIMM), IIC_VMOVImm, "vmov", "i64", "$dst, $SIMM", "", [(set DPR:$dst, (v1i64 vmovImm64:$SIMM))]>; def VMOVv2i64 : N1ModImm<1, 0b000, 0b1110, 0, 1, 1, 1, (outs QPR:$dst), - (ins h64imm:$SIMM), IIC_VMOVImm, + (ins nModImm:$SIMM), IIC_VMOVImm, "vmov", "i64", "$dst, $SIMM", "", [(set QPR:$dst, (v2i64 vmovImm64:$SIMM))]>; } // isReMaterializable Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp?rev=105836&r1=105835&r2=105836&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp Fri Jun 11 16:34:50 2010 @@ -175,23 +175,8 @@ raw_ostream &O); void printVFPf64ImmOperand(const MachineInstr *MI, int OpNum, raw_ostream &O); - - void printHex8ImmOperand(const MachineInstr *MI, int OpNum, - raw_ostream &O) { - O << "#0x" << utohexstr(MI->getOperand(OpNum).getImm() & 0xff); - } - void printHex16ImmOperand(const MachineInstr *MI, int OpNum, - raw_ostream &O) { - O << "#0x" << utohexstr(MI->getOperand(OpNum).getImm() & 0xffff); - } - void printHex32ImmOperand(const MachineInstr *MI, int OpNum, - raw_ostream &O) { - O << "#0x" << utohexstr(MI->getOperand(OpNum).getImm() & 0xffffffff); - } - void printHex64ImmOperand(const MachineInstr *MI, int OpNum, - raw_ostream &O) { - O << "#0x" << utohexstr(MI->getOperand(OpNum).getImm()); - } + void printNEONModImmOperand(const MachineInstr *MI, int OpNum, + raw_ostream &O); virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode, @@ -1039,6 +1024,40 @@ } } +void ARMAsmPrinter::printNEONModImmOperand(const MachineInstr *MI, int OpNum, + raw_ostream &O) { + unsigned Imm = MI->getOperand(OpNum).getImm(); + unsigned OpCmode = (Imm >> 8) & 0x1f; + unsigned Imm8 = Imm & 0xff; + uint64_t Val = 0; + + if (OpCmode == 0xe) { + // 8-bit vector elements + Val = Imm8; + } else if ((OpCmode & 0xc) == 0x8) { + // 16-bit vector elements + unsigned ByteNum = (OpCmode & 0x6) >> 1; + Val = Imm8 << (8 * ByteNum); + } else if ((OpCmode & 0x8) == 0) { + // 32-bit vector elements, zero with one byte set + unsigned ByteNum = (OpCmode & 0x6) >> 1; + Val = Imm8 << (8 * ByteNum); + } else if ((OpCmode & 0xe) == 0xc) { + // 32-bit vector elements, one byte with low bits set + unsigned ByteNum = (OpCmode & 0x1); + Val = (Imm8 << (8 * ByteNum)) | (0xffff >> (8 * (1 - ByteNum))); + } else if (OpCmode == 0x1e) { + // 64-bit vector elements + for (unsigned ByteNum = 0; ByteNum < 8; ++ByteNum) { + if ((Imm >> ByteNum) & 1) + Val |= (uint64_t)0xff << (8 * ByteNum); + } + } else { + assert(false && "Unsupported NEON immediate"); + } + O << "#0x" << utohexstr(Val); +} + bool ARMAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, unsigned AsmVariant, const char *ExtraCode, raw_ostream &O) { Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp?rev=105836&r1=105835&r2=105836&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp Fri Jun 11 16:34:50 2010 @@ -779,22 +779,36 @@ O << '#' << MI->getOperand(OpNum).getImm(); } -void ARMInstPrinter::printHex8ImmOperand(const MCInst *MI, unsigned OpNum, - raw_ostream &O) { - O << "#0x" << utohexstr(MI->getOperand(OpNum).getImm() & 0xff); -} - -void ARMInstPrinter::printHex16ImmOperand(const MCInst *MI, unsigned OpNum, - raw_ostream &O) { - O << "#0x" << utohexstr(MI->getOperand(OpNum).getImm() & 0xffff); -} - -void ARMInstPrinter::printHex32ImmOperand(const MCInst *MI, unsigned OpNum, - raw_ostream &O) { - O << "#0x" << utohexstr(MI->getOperand(OpNum).getImm() & 0xffffffff); -} +void ARMInstPrinter::printNEONModImmOperand(const MCInst *MI, unsigned OpNum, + raw_ostream &O) { + unsigned Imm = MI->getOperand(OpNum).getImm(); + unsigned OpCmode = (Imm >> 8) & 0x1f; + unsigned Imm8 = Imm & 0xff; + uint64_t Val = 0; -void ARMInstPrinter::printHex64ImmOperand(const MCInst *MI, unsigned OpNum, - raw_ostream &O) { - O << "#0x" << utohexstr(MI->getOperand(OpNum).getImm()); + if (OpCmode == 0xe) { + // 8-bit vector elements + Val = Imm8; + } else if ((OpCmode & 0xc) == 0x8) { + // 16-bit vector elements + unsigned ByteNum = (OpCmode & 0x6) >> 1; + Val = Imm8 << (8 * ByteNum); + } else if ((OpCmode & 0x8) == 0) { + // 32-bit vector elements, zero with one byte set + unsigned ByteNum = (OpCmode & 0x6) >> 1; + Val = Imm8 << (8 * ByteNum); + } else if ((OpCmode & 0xe) == 0xc) { + // 32-bit vector elements, one byte with low bits set + unsigned ByteNum = (OpCmode & 0x1); + Val = (Imm8 << (8 * ByteNum)) | (0xffff >> (8 * (1 - ByteNum))); + } else if (OpCmode == 0x1e) { + // 64-bit vector elements + for (unsigned ByteNum = 0; ByteNum < 8; ++ByteNum) { + if ((Imm >> ByteNum) & 1) + Val |= (uint64_t)0xff << (8 * ByteNum); + } + } else { + assert(false && "Unsupported NEON immediate"); + } + O << "#0x" << utohexstr(Val); } Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h?rev=105836&r1=105835&r2=105836&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h (original) +++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.h Fri Jun 11 16:34:50 2010 @@ -104,10 +104,7 @@ void printNoHashImmediate(const MCInst *MI, unsigned OpNum, raw_ostream &O); void printVFPf32ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); void printVFPf64ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); - void printHex8ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); - void printHex16ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); - void printHex32ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); - void printHex64ImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); + void printNEONModImmOperand(const MCInst *MI, unsigned OpNum, raw_ostream &O); void printPCLabel(const MCInst *MI, unsigned OpNum, raw_ostream &O); // FIXME: Implement. Modified: llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp?rev=105836&r1=105835&r2=105836&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp (original) +++ llvm/trunk/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp Fri Jun 11 16:34:50 2010 @@ -2077,42 +2077,12 @@ // imm3 = Inst{18-16}, imm4 = Inst{3-0} // Ref: Table A7-15 Modified immediate values for Advanced SIMD instructions. static uint64_t decodeN1VImm(uint32_t insn, ElemSize esize) { + unsigned char op = (insn >> 5) & 1; unsigned char cmode = (insn >> 8) & 0xF; unsigned char Imm8 = ((insn >> 24) & 1) << 7 | ((insn >> 16) & 7) << 4 | (insn & 0xF); - uint64_t Imm64 = 0; - - switch (esize) { - case ESize8: - Imm64 = Imm8; - break; - case ESize16: - Imm64 = Imm8 << 8*(cmode >> 1 & 1); - break; - case ESize32: { - if (cmode == 12) - Imm64 = (Imm8 << 8) | 0xFF; - else if (cmode == 13) - Imm64 = (Imm8 << 16) | 0xFFFF; - else { - // Imm8 to be shifted left by how many bytes... - Imm64 = Imm8 << 8*(cmode >> 1 & 3); - } - break; - } - case ESize64: { - for (unsigned i = 0; i < 8; ++i) - if ((Imm8 >> i) & 1) - Imm64 |= (uint64_t)0xFF << 8*i; - break; - } - default: - assert(0 && "Unreachable code!"); - return 0; - } - - return Imm64; + return (op << 12) | (cmode << 8) | Imm8; } // A8.6.339 VMUL, VMULL (by scalar) Modified: llvm/trunk/utils/TableGen/EDEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/EDEmitter.cpp?rev=105836&r1=105835&r2=105836&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/EDEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/EDEmitter.cpp Fri Jun 11 16:34:50 2010 @@ -592,10 +592,7 @@ IMM("msr_mask"); IMM("neg_zero"); IMM("imm0_31"); - IMM("h8imm"); - IMM("h16imm"); - IMM("h32imm"); - IMM("h64imm"); + IMM("nModImm"); IMM("imm0_4095"); IMM("jt2block_operand"); IMM("t_imm_s4"); From daniel at zuster.org Fri Jun 11 17:00:08 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 11 Jun 2010 22:00:08 -0000 Subject: [llvm-commits] [llvm] r105837 - /llvm/trunk/tools/llvm-mc/Makefile Message-ID: <20100611220008.C48672A6C12C@llvm.org> Author: ddunbar Date: Fri Jun 11 17:00:08 2010 New Revision: 105837 URL: http://llvm.org/viewvc/llvm-project?rev=105837&view=rev Log: llvm-mc: Don't set NO_INSTALL on llvm-mc. Modified: llvm/trunk/tools/llvm-mc/Makefile Modified: llvm/trunk/tools/llvm-mc/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/Makefile?rev=105837&r1=105836&r2=105837&view=diff ============================================================================== --- llvm/trunk/tools/llvm-mc/Makefile (original) +++ llvm/trunk/tools/llvm-mc/Makefile Fri Jun 11 17:00:08 2010 @@ -12,7 +12,6 @@ # This tool has no plugins, optimize startup time. TOOL_NO_EXPORTS = 1 -NO_INSTALL = 1 # Include this here so we can get the configuration of the targets # that have been configured for construction. We have to do this From pwalton at mozilla.com Fri Jun 11 17:33:34 2010 From: pwalton at mozilla.com (Patrick Walton) Date: Fri, 11 Jun 2010 15:33:34 -0700 Subject: [llvm-commits] [PATCH] Make LLVM assertions configurable Message-ID: <4C12B9BE.2080002@mozilla.com> Hi, I've created a patch against the latest svn head that makes assertions call a user-definable LLVMDie() handler, instead of abort(3). This makes bindings able to turn them into exceptions, which is the subject of the next patch :) Thanks, Patrick -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: llvm-pcwalton-configurable-assertions.diff Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100611/63466404/attachment.pl From pwalton at mozilla.com Fri Jun 11 17:35:12 2010 From: pwalton at mozilla.com (Patrick Walton) Date: Fri, 11 Jun 2010 15:35:12 -0700 Subject: [llvm-commits] [PATCH] Transforming assertions into OCaml exceptions Message-ID: <4C12BA20.4020006@mozilla.com> Hi, This patch builds on the previous one (llvm-pcwalton-configurable-assertions.diff) and transforms assertions into exceptions in the OCaml bindings. Thanks, Patrick -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: llvm-pcwalton-ocaml-assertions-as-exceptions.diff Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100611/3c7312b1/attachment.pl From bob.wilson at apple.com Fri Jun 11 17:45:25 2010 From: bob.wilson at apple.com (Bob Wilson) Date: Fri, 11 Jun 2010 22:45:25 -0000 Subject: [llvm-commits] [llvm] r105845 - in /llvm/trunk: lib/Target/ARM/ARMISelLowering.cpp test/CodeGen/ARM/2010-06-11-vmovdrr-bitcast.ll Message-ID: <20100611224525.EE6642A6C12C@llvm.org> Author: bwilson Date: Fri Jun 11 17:45:25 2010 New Revision: 105845 URL: http://llvm.org/viewvc/llvm-project?rev=105845&view=rev Log: Add a missing bitcast. This code used to only handle conversions between i64 and f64 types, but now it also handle Neon vector types, so the f64 result of VMOVDRR may need to be converted to a Neon type. Radar 8084742. Added: llvm/trunk/test/CodeGen/ARM/2010-06-11-vmovdrr-bitcast.ll Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=105845&r1=105844&r2=105845&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Fri Jun 11 17:45:25 2010 @@ -2447,7 +2447,8 @@ DAG.getConstant(0, MVT::i32)); SDValue Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, dl, MVT::i32, Op, DAG.getConstant(1, MVT::i32)); - return DAG.getNode(ARMISD::VMOVDRR, dl, MVT::f64, Lo, Hi); + return DAG.getNode(ISD::BIT_CONVERT, dl, DstVT, + DAG.getNode(ARMISD::VMOVDRR, dl, MVT::f64, Lo, Hi)); } // Turn f64->i64 into VMOVRRD. Added: llvm/trunk/test/CodeGen/ARM/2010-06-11-vmovdrr-bitcast.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2010-06-11-vmovdrr-bitcast.ll?rev=105845&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/ARM/2010-06-11-vmovdrr-bitcast.ll (added) +++ llvm/trunk/test/CodeGen/ARM/2010-06-11-vmovdrr-bitcast.ll Fri Jun 11 17:45:25 2010 @@ -0,0 +1,19 @@ +; RUN: llc < %s -march=arm -mattr=+neon +; Radar 8084742 + +%struct.__int8x8x2_t = type { [2 x <8 x i8>] } + +define arm_apcscc void @foo(%struct.__int8x8x2_t* nocapture %a, i8* %b) nounwind { +entry: + %0 = bitcast %struct.__int8x8x2_t* %a to i128* ; [#uses=1] + %srcval = load i128* %0, align 8 ; [#uses=2] + %tmp6 = trunc i128 %srcval to i64 ; [#uses=1] + %tmp8 = lshr i128 %srcval, 64 ; [#uses=1] + %tmp9 = trunc i128 %tmp8 to i64 ; [#uses=1] + %tmp16.i = bitcast i64 %tmp6 to <8 x i8> ; <<8 x i8>> [#uses=1] + %tmp20.i = bitcast i64 %tmp9 to <8 x i8> ; <<8 x i8>> [#uses=1] + tail call void @llvm.arm.neon.vst2.v8i8(i8* %b, <8 x i8> %tmp16.i, <8 x i8> %tmp20.i) nounwind + ret void +} + +declare void @llvm.arm.neon.vst2.v8i8(i8*, <8 x i8>, <8 x i8>) nounwind From daniel at zuster.org Fri Jun 11 18:27:45 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 11 Jun 2010 23:27:45 -0000 Subject: [llvm-commits] [llvm] r105855 - /llvm/trunk/utils/lit/lit/TestRunner.py Message-ID: <20100611232745.3EFF92A6C12C@llvm.org> Author: ddunbar Date: Fri Jun 11 18:27:45 2010 New Revision: 105855 URL: http://llvm.org/viewvc/llvm-project?rev=105855&view=rev Log: lit: When running Tcl style tests on Windows, substitute slashes to avoid Tcl quoting problems. Not particularly ideal, but should work ok. Based on a patch by Michael Spencer! Modified: llvm/trunk/utils/lit/lit/TestRunner.py Modified: llvm/trunk/utils/lit/lit/TestRunner.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=105855&r1=105854&r2=105855&view=diff ============================================================================== --- llvm/trunk/utils/lit/lit/TestRunner.py (original) +++ llvm/trunk/utils/lit/lit/TestRunner.py Fri Jun 11 18:27:45 2010 @@ -13,11 +13,13 @@ self.command = command self.message = message +kIsWindows = platform.system() == 'Windows' + # Don't use close_fds on Windows. -kUseCloseFDs = platform.system() != 'Windows' +kUseCloseFDs = not kIsWindows # Use temporary files to replace /dev/null on Windows. -kAvoidDevNull = platform.system() == 'Windows' +kAvoidDevNull = kIsWindows def executeCommand(command, cwd=None, env=None): p = subprocess.Popen(command, cwd=cwd, @@ -364,7 +366,7 @@ return True -def parseIntegratedTestScript(test): +def parseIntegratedTestScript(test, normalize_slashes): """parseIntegratedTestScript - Scan an LLVM/Clang style integrated test script and extract the lines to 'RUN' as well as 'XFAIL' and 'XTARGET' information. The RUN lines also will have variable substitution performed. @@ -375,18 +377,25 @@ # # FIXME: This should not be here? sourcepath = test.getSourcePath() + sourcedir = os.path.dirname(sourcepath) execpath = test.getExecPath() execdir,execbase = os.path.split(execpath) tmpBase = os.path.join(execdir, 'Output', execbase) if test.index is not None: tmpBase += '_%d' % test.index + # Normalize slashes, if requested. + if normalize_slashes: + sourcepath = sourcepath.replace('\\', '/') + sourcedir = sourcedir.replace('\\', '/') + tmpBase = tmpBase.replace('\\', '/') + # We use #_MARKER_# to hide %% while we do the other substitutions. substitutions = [('%%', '#_MARKER_#')] substitutions.extend(test.config.substitutions) substitutions.extend([('%s', sourcepath), - ('%S', os.path.dirname(sourcepath)), - ('%p', os.path.dirname(sourcepath)), + ('%S', sourcedir), + ('%p', sourcedir), ('%t', tmpBase + '.tmp'), # FIXME: Remove this once we kill DejaGNU. ('%abs_tmp', tmpBase + '.tmp'), @@ -462,7 +471,9 @@ if test.config.unsupported: return (Test.UNSUPPORTED, 'Test is unsupported') - res = parseIntegratedTestScript(test) + # Parse the test script, normalizing slashes in substitutions on Windows + # (since otherwise Tcl style lexing will treat them as escapes). + res = parseIntegratedTestScript(test, normalize_slashes=kIsWindows) if len(res) == 2: return res From daniel at zuster.org Fri Jun 11 18:29:48 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 11 Jun 2010 23:29:48 -0000 Subject: [llvm-commits] [llvm] r105856 - /llvm/trunk/test/Scripts/macho-dump.bat Message-ID: <20100611232948.8DB8F2A6C12C@llvm.org> Author: ddunbar Date: Fri Jun 11 18:29:48 2010 New Revision: 105856 URL: http://llvm.org/viewvc/llvm-project?rev=105856&view=rev Log: tests: Add wrapper script for calling macho-dump on Win32. Added: llvm/trunk/test/Scripts/macho-dump.bat Added: llvm/trunk/test/Scripts/macho-dump.bat URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Scripts/macho-dump.bat?rev=105856&view=auto ============================================================================== --- llvm/trunk/test/Scripts/macho-dump.bat (added) +++ llvm/trunk/test/Scripts/macho-dump.bat Fri Jun 11 18:29:48 2010 @@ -0,0 +1,3 @@ + at echo off +macho-dump %1 %2 %3 %4 %5 %6 %7 %8 %9 + From daniel at zuster.org Fri Jun 11 18:47:36 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Fri, 11 Jun 2010 23:47:36 -0000 Subject: [llvm-commits] [llvm] r105858 - /llvm/trunk/utils/lit/lit/TestRunner.py Message-ID: <20100611234736.B4A112A6C12C@llvm.org> Author: ddunbar Date: Fri Jun 11 18:47:36 2010 New Revision: 105858 URL: http://llvm.org/viewvc/llvm-project?rev=105858&view=rev Log: lit: Add a forgotten default argument. Modified: llvm/trunk/utils/lit/lit/TestRunner.py Modified: llvm/trunk/utils/lit/lit/TestRunner.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=105858&r1=105857&r2=105858&view=diff ============================================================================== --- llvm/trunk/utils/lit/lit/TestRunner.py (original) +++ llvm/trunk/utils/lit/lit/TestRunner.py Fri Jun 11 18:47:36 2010 @@ -366,7 +366,7 @@ return True -def parseIntegratedTestScript(test, normalize_slashes): +def parseIntegratedTestScript(test, normalize_slashes=False): """parseIntegratedTestScript - Scan an LLVM/Clang style integrated test script and extract the lines to 'RUN' as well as 'XFAIL' and 'XTARGET' information. The RUN lines also will have variable substitution performed. From bruno.cardoso at gmail.com Fri Jun 11 18:50:47 2010 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Fri, 11 Jun 2010 23:50:47 -0000 Subject: [llvm-commits] [llvm] r105859 - in /llvm/trunk: lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86MCCodeEmitter.cpp test/MC/AsmParser/X86/x86_32-encoding.s test/MC/AsmParser/X86/x86_64-encoding.s utils/TableGen/X86RecognizableInstr.cpp Message-ID: <20100611235048.0FBCD2A6C12C@llvm.org> Author: bruno Date: Fri Jun 11 18:50:47 2010 New Revision: 105859 URL: http://llvm.org/viewvc/llvm-project?rev=105859&view=rev Log: More AVX instructions ({ADD,SUB,MUL,DIV}{SS,SD}rm) Introduce the VEX_X field Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s llvm/trunk/test/MC/AsmParser/X86/x86_64-encoding.s llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=105859&r1=105858&r2=105859&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Fri Jun 11 18:50:47 2010 @@ -704,6 +704,24 @@ !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), [(set FR64:$dst, (OpNode FR64:$src1, (load addr:$src2)))]>; + def V#NAME#SSrm : VSSI { + let Constraints = ""; + let isAsmParserOnly = 1; + } + + def V#NAME#SDrm : VSDI { + let Constraints = ""; + let isAsmParserOnly = 1; + } + // Vector operation, reg+reg. def PSrr : PSI= 2 && numPhysicalOperands <= 3 && "Unexpected number of operands for MRMSrcMemFrm"); HANDLE_OPERAND(roRegister) + + if (HasVEX_4VPrefix) + // FIXME: In AVX, the register below becomes the one encoded + // in ModRMVEX and the one above the one in the VEX.VVVV field + HANDLE_OPTIONAL(rmRegister) + HANDLE_OPERAND(memory) HANDLE_OPTIONAL(immediate) break; From bruno.cardoso at gmail.com Fri Jun 11 19:03:53 2010 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Sat, 12 Jun 2010 00:03:53 -0000 Subject: [llvm-commits] [llvm] r105860 - /llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Message-ID: <20100612000353.149AC2A6C12C@llvm.org> Author: bruno Date: Fri Jun 11 19:03:52 2010 New Revision: 105860 URL: http://llvm.org/viewvc/llvm-project?rev=105860&view=rev Log: Add some comments about REX fields Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Modified: llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp?rev=105860&r1=105859&r2=105860&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp Fri Jun 11 19:03:52 2010 @@ -502,7 +502,7 @@ unsigned REX = 0; if (TSFlags & X86II::REX_W) - REX |= 1 << 3; + REX |= 1 << 3; // set REX.W if (MI.getNumOperands() == 0) return REX; @@ -520,7 +520,7 @@ if (!X86InstrInfo::isX86_64NonExtLowByteReg(Reg)) continue; // FIXME: The caller of DetermineREXPrefix slaps this prefix onto anything // that returns non-zero. - REX |= 0x40; + REX |= 0x40; // REX fixed encoding prefix break; } @@ -529,25 +529,25 @@ case X86II::MRMSrcReg: if (MI.getOperand(0).isReg() && X86InstrInfo::isX86_64ExtendedReg(MI.getOperand(0).getReg())) - REX |= 1 << 2; + REX |= 1 << 2; // set REX.R i = isTwoAddr ? 2 : 1; for (; i != NumOps; ++i) { const MCOperand &MO = MI.getOperand(i); if (MO.isReg() && X86InstrInfo::isX86_64ExtendedReg(MO.getReg())) - REX |= 1 << 0; + REX |= 1 << 0; // set REX.B } break; case X86II::MRMSrcMem: { if (MI.getOperand(0).isReg() && X86InstrInfo::isX86_64ExtendedReg(MI.getOperand(0).getReg())) - REX |= 1 << 2; + REX |= 1 << 2; // set REX.R unsigned Bit = 0; i = isTwoAddr ? 2 : 1; for (; i != NumOps; ++i) { const MCOperand &MO = MI.getOperand(i); if (MO.isReg()) { if (X86InstrInfo::isX86_64ExtendedReg(MO.getReg())) - REX |= 1 << Bit; + REX |= 1 << Bit; // set REX.B (Bit=0) and REX.X (Bit=1) Bit++; } } @@ -562,13 +562,13 @@ i = isTwoAddr ? 1 : 0; if (NumOps > e && MI.getOperand(e).isReg() && X86InstrInfo::isX86_64ExtendedReg(MI.getOperand(e).getReg())) - REX |= 1 << 2; + REX |= 1 << 2; // set REX.R unsigned Bit = 0; for (; i != e; ++i) { const MCOperand &MO = MI.getOperand(i); if (MO.isReg()) { if (X86InstrInfo::isX86_64ExtendedReg(MO.getReg())) - REX |= 1 << Bit; + REX |= 1 << Bit; // REX.B (Bit=0) and REX.X (Bit=1) Bit++; } } @@ -577,12 +577,12 @@ default: if (MI.getOperand(0).isReg() && X86InstrInfo::isX86_64ExtendedReg(MI.getOperand(0).getReg())) - REX |= 1 << 0; + REX |= 1 << 0; // set REX.B i = isTwoAddr ? 2 : 1; for (unsigned e = NumOps; i != e; ++i) { const MCOperand &MO = MI.getOperand(i); if (MO.isReg() && X86InstrInfo::isX86_64ExtendedReg(MO.getReg())) - REX |= 1 << 2; + REX |= 1 << 2; // set REX.R } break; } From evan.cheng at apple.com Fri Jun 11 19:11:53 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 12 Jun 2010 00:11:53 -0000 Subject: [llvm-commits] [llvm] r105861 - /llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Message-ID: <20100612001153.E07A02A6C12C@llvm.org> Author: evancheng Date: Fri Jun 11 19:11:53 2010 New Revision: 105861 URL: http://llvm.org/viewvc/llvm-project?rev=105861&view=rev Log: Code formatting. Modified: llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Modified: llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp?rev=105861&r1=105860&r2=105861&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp (original) +++ llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Fri Jun 11 19:11:53 2010 @@ -232,11 +232,9 @@ return NewMI; } -bool -TargetInstrInfo::isReallyTriviallyReMaterializableGeneric(const MachineInstr * - MI, - AliasAnalysis * - AA) const { +bool TargetInstrInfo:: +isReallyTriviallyReMaterializableGeneric(const MachineInstr *MI, + AliasAnalysis *AA) const { const MachineFunction &MF = *MI->getParent()->getParent(); const MachineRegisterInfo &MRI = MF.getRegInfo(); const TargetMachine &TM = MF.getTarget(); From evan.cheng at apple.com Fri Jun 11 19:12:18 2010 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 12 Jun 2010 00:12:18 -0000 Subject: [llvm-commits] [llvm] r105862 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/PostRASchedulerList.cpp Message-ID: <20100612001218.A6A722A6C12C@llvm.org> Author: evancheng Date: Fri Jun 11 19:12:18 2010 New Revision: 105862 URL: http://llvm.org/viewvc/llvm-project?rev=105862&view=rev Log: Allow target to provide its own hazard recognizer to post-ra scheduler. Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=105862&r1=105861&r2=105862&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Fri Jun 11 19:12:18 2010 @@ -20,12 +20,14 @@ namespace llvm { class CalleeSavedInfo; +class InstrItineraryData; class LiveVariables; class MCAsmInfo; class MachineMemOperand; class MDNode; class MCInst; class SDNode; +class ScheduleHazardRecognizer; class SelectionDAG; class TargetRegisterClass; class TargetRegisterInfo; @@ -575,6 +577,12 @@ /// length. virtual unsigned getInlineAsmLength(const char *Str, const MCAsmInfo &MAI) const; + + /// CreateTargetHazardRecognizer - Allocate and return a hazard recognizer + /// to use for this target when scheduling the machine instructions after + /// register allocation. + virtual ScheduleHazardRecognizer* + CreateTargetPostRAHazardRecognizer(const InstrItineraryData&) const = 0; }; /// TargetInstrInfoImpl - This is the default implementation of @@ -602,6 +610,9 @@ virtual bool produceSameValue(const MachineInstr *MI0, const MachineInstr *MI1) const; virtual unsigned GetFunctionSizeInBytes(const MachineFunction &MF) const; + + virtual ScheduleHazardRecognizer * + CreateTargetPostRAHazardRecognizer(const InstrItineraryData&) const; }; } // End llvm namespace Modified: llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp?rev=105862&r1=105861&r2=105862&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp (original) +++ llvm/trunk/lib/CodeGen/PostRASchedulerList.cpp Fri Jun 11 19:12:18 2010 @@ -67,8 +67,8 @@ cl::init("none"), cl::Hidden); static cl::opt EnablePostRAHazardAvoidance("avoid-hazards", - cl::desc("Enable exact hazard avoidance"), - cl::init(true), cl::Hidden); + cl::desc("Enable exact hazard avoidance"), + cl::init(true), cl::Hidden); // If DebugDiv > 0 then only schedule MBB with (ID % DebugDiv) == DebugMod static cl::opt @@ -237,10 +237,10 @@ const MachineLoopInfo &MLI = getAnalysis(); const MachineDominatorTree &MDT = getAnalysis(); - const InstrItineraryData &InstrItins = Fn.getTarget().getInstrItineraryData(); - ScheduleHazardRecognizer *HR = EnablePostRAHazardAvoidance ? - (ScheduleHazardRecognizer *)new ExactHazardRecognizer(InstrItins) : - (ScheduleHazardRecognizer *)new SimpleHazardRecognizer(); + const TargetMachine &TM = Fn.getTarget(); + const InstrItineraryData &InstrItins = TM.getInstrItineraryData(); + ScheduleHazardRecognizer *HR = + TM.getInstrInfo()->CreateTargetPostRAHazardRecognizer(InstrItins); AntiDepBreaker *ADB = ((AntiDepMode == TargetSubtarget::ANTIDEP_ALL) ? (AntiDepBreaker *)new AggressiveAntiDepBreaker(Fn, CriticalPathRCs) : @@ -719,6 +719,16 @@ #endif } +// Default implementation of CreateTargetPostRAHazardRecognizer. This should +// be in TargetInstrInfoImpl.cpp except it reference local command line +// option EnablePostRAHazardAvoidance +ScheduleHazardRecognizer *TargetInstrInfoImpl:: +CreateTargetPostRAHazardRecognizer(const InstrItineraryData &II) const { + if (EnablePostRAHazardAvoidance) + return (ScheduleHazardRecognizer *)new ExactHazardRecognizer(II); + return (ScheduleHazardRecognizer *)new SimpleHazardRecognizer(); +} + //===----------------------------------------------------------------------===// // Public Constructor Functions //===----------------------------------------------------------------------===// From bruno.cardoso at gmail.com Fri Jun 11 20:23:26 2010 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Sat, 12 Jun 2010 01:23:26 -0000 Subject: [llvm-commits] [llvm] r105869 - in /llvm/trunk: lib/Target/X86/X86InstrFormats.td lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86MCCodeEmitter.cpp test/MC/AsmParser/X86/x86_32-encoding.s test/MC/AsmParser/X86/x86_64-encoding.s Message-ID: <20100612012327.0126E2A6C12C@llvm.org> Author: bruno Date: Fri Jun 11 20:23:26 2010 New Revision: 105869 URL: http://llvm.org/viewvc/llvm-project?rev=105869&view=rev Log: More AVX: {ADD,SUB,MUL,DIV}{PD,PS}rr Handle OpSize TSFlag for AVX Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/lib/Target/X86/X86MCCodeEmitter.cpp llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s llvm/trunk/test/MC/AsmParser/X86/x86_64-encoding.s Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFormats.td?rev=105869&r1=105868&r2=105869&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFormats.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFormats.td Fri Jun 11 20:23:26 2010 @@ -220,6 +220,7 @@ // PSI - SSE1 instructions with TB prefix. // PSIi8 - SSE1 instructions with ImmT == Imm8 and TB prefix. // VSSI - SSE1 instructions with XS prefix in AVX form. +// VPSI - SSE1 instructions with TB prefix in AVX form. class SSI o, Format F, dag outs, dag ins, string asm, list pattern> : I, XS, Requires<[HasSSE1]>; @@ -237,6 +238,10 @@ list pattern> : I, XS, VEX_4V, Requires<[HasAVX, HasSSE1]>; +class VPSI o, Format F, dag outs, dag ins, string asm, + list pattern> + : I, + VEX_4V, Requires<[HasAVX, HasSSE1]>; // SSE2 Instruction Templates: // @@ -246,6 +251,7 @@ // PDI - SSE2 instructions with TB and OpSize prefixes. // PDIi8 - SSE2 instructions with ImmT == Imm8 and TB and OpSize prefixes. // VSDI - SSE2 instructions with XD prefix in AVX form. +// VPDI - SSE2 instructions with TB and OpSize prefixes in AVX form. class SDI o, Format F, dag outs, dag ins, string asm, list pattern> : I, XD, Requires<[HasSSE2]>; @@ -266,6 +272,10 @@ list pattern> : I, XD, VEX_4V, Requires<[HasAVX, HasSSE2]>; +class VPDI o, Format F, dag outs, dag ins, string asm, + list pattern> + : I, + VEX_4V, OpSize, Requires<[HasAVX, HasSSE2]>; // SSE3 Instruction Templates: // Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=105869&r1=105868&r2=105869&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Fri Jun 11 20:23:26 2010 @@ -737,6 +737,26 @@ let isCommutable = Commutable; } + def V#NAME#PSrr : VPSI { + let isCommutable = Commutable; + let Constraints = ""; + let isAsmParserOnly = 1; + } + + def V#NAME#PDrr : VPDI { + let isCommutable = Commutable; + let Constraints = ""; + let isAsmParserOnly = 1; + } + // Vector operation, reg+mem. def PSrm : PSI Author: bruno Date: Fri Jun 11 20:53:48 2010 New Revision: 105870 URL: http://llvm.org/viewvc/llvm-project?rev=105870&view=rev Log: More AVX: {ADD,SUB,MUL,DIV}{PD,PS}rm Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/test/MC/AsmParser/X86/x86_32-encoding.s llvm/trunk/test/MC/AsmParser/X86/x86_64-encoding.s Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=105870&r1=105869&r2=105870&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Fri Jun 11 20:53:48 2010 @@ -768,6 +768,22 @@ !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), [(set VR128:$dst, (OpNode VR128:$src1, (memopv2f64 addr:$src2)))]>; + def V#NAME#PSrm : VPSI { + let Constraints = ""; + let isAsmParserOnly = 1; + } + + def V#NAME#PDrm : VPDI { + let Constraints = ""; + let isAsmParserOnly = 1; + } + // Intrinsic operation, reg+reg. def SSrr_Int : SSI Author: void Date: Fri Jun 11 21:34:29 2010 New Revision: 105872 URL: http://llvm.org/viewvc/llvm-project?rev=105872&view=rev Log: When performing the Horrible Hack(tm-Duncan) on the EH code to convert a clean-up to a catch-all after inlining, take into account that there could be filter IDs as well. The presence of filters don't mean that the selector catches anything. It's just metadata information. Modified: llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Modified: llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp?rev=105872&r1=105871&r2=105872&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Fri Jun 11 21:34:29 2010 @@ -89,6 +89,8 @@ /// initializer instead. bool CleanupSelectors(); + bool IsACleanupSelector(IntrinsicInst *); + /// FindAllCleanupSelectors - Find all eh.selector calls that are clean-ups. void FindAllCleanupSelectors(SmallPtrSet &Sels); @@ -186,25 +188,49 @@ return new DwarfEHPrepare(tm, fast); } +/// IsACleanupSelector - Return true if the intrinsic instruction is a clean-up +/// selector instruction. +bool DwarfEHPrepare::IsACleanupSelector(IntrinsicInst *II) { + unsigned NumOps = II->getNumOperands(); + bool IsCleanUp = (NumOps == 3); + + if (IsCleanUp) + return true; + + if (ConstantInt *CI = dyn_cast(II->getOperand(3))) { + unsigned Val = CI->getZExtValue(); + + if (Val == 0 || Val + 3 == NumOps) { + // If the value is 0 or the selector has only filters in it, then it's + // a cleanup. + return true; + } else { + assert(Val + 3 < NumOps && "Ill-formed eh.selector!"); + + if (Val + 4 == NumOps) { + if (ConstantInt *FinalVal = + dyn_cast(II->getOperand(NumOps - 1))) + return (FinalVal->getZExtValue() == 0); + } + } + } + + return false; +} + /// FindAllCleanupSelectors - Find all eh.selector calls that are clean-ups. void DwarfEHPrepare:: FindAllCleanupSelectors(SmallPtrSet &Sels) { for (Value::use_iterator I = SelectorIntrinsic->use_begin(), E = SelectorIntrinsic->use_end(); I != E; ++I) { - IntrinsicInst *SI = cast(I); - if (!SI || SI->getParent()->getParent() != F) continue; + IntrinsicInst *II = cast(I); - unsigned NumOps = SI->getNumOperands(); - if (NumOps > 4) continue; - bool IsCleanUp = (NumOps == 3); - - if (!IsCleanUp) - if (ConstantInt *CI = dyn_cast(SI->getOperand(3))) - IsCleanUp = (CI->getZExtValue() == 0); + if (II->getParent()->getParent() != F) + continue; - if (IsCleanUp) - Sels.insert(SI); + if (IsACleanupSelector(II)) + Sels.insert(II); } } @@ -360,21 +386,9 @@ // an eh.selector intrinsic call. If the eh.selector is a 'clean-up', we // need to convert it to a 'catch-all'. for (SmallPtrSet::iterator - SI = SelCalls.begin(), SE = SelCalls.end(); SI != SE; ++SI) { - IntrinsicInst *II = *SI; - unsigned NumOps = II->getNumOperands(); - - if (NumOps <= 4) { - bool IsCleanUp = (NumOps == 3); - - if (!IsCleanUp) - if (ConstantInt *CI = dyn_cast(II->getOperand(3))) - IsCleanUp = (CI->getZExtValue() == 0); - - if (IsCleanUp) - SelsToConvert.insert(II); - } - } + SI = SelCalls.begin(), SE = SelCalls.end(); SI != SE; ++SI) + if (IsACleanupSelector(*SI)) + SelsToConvert.insert(*SI); } } } @@ -394,6 +408,15 @@ // from the original selector. Args.push_back(II->getOperand(1)); // Exception object pointer. Args.push_back(II->getOperand(2)); // Personality function. + + unsigned I = 3; + unsigned E = II->getNumOperands() - + (isa(II->getOperand(II->getNumOperands() - 1)) ? 1 : 0); + + // Add in any filter IDs. + for (; I < E; ++I) + Args.push_back(II->getOperand(I)); + Args.push_back(EHCatchAllValue->getInitializer()); // Catch-all indicator. CallInst *NewSelector = From bruno.cardoso at gmail.com Fri Jun 11 21:38:32 2010 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Sat, 12 Jun 2010 02:38:32 -0000 Subject: [llvm-commits] [llvm] r105873 - /llvm/trunk/lib/Target/X86/X86InstrSSE.td Message-ID: <20100612023832.F29192A6C12C@llvm.org> Author: bruno Date: Fri Jun 11 21:38:32 2010 New Revision: 105873 URL: http://llvm.org/viewvc/llvm-project?rev=105873&view=rev Log: Add some basic fp intrinsics for AVX Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=105873&r1=105872&r2=105873&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Fri Jun 11 21:38:32 2010 @@ -785,6 +785,22 @@ } // Intrinsic operation, reg+reg. + def V#NAME#SSrr_Int : VSSI("int_x86_sse_", + !strconcat(OpcodeStr, "_ss")) VR128:$src1, + VR128:$src2))]>; + // int_x86_sse_xxx_ss + + def V#NAME#SDrr_Int : VSDI("int_x86_sse2_", + !strconcat(OpcodeStr, "_sd")) VR128:$src1, + VR128:$src2))]>; + // int_x86_sse2_xxx_sd + def SSrr_Int : SSI("int_x86_sse_", + !strconcat(OpcodeStr, "_ss")) VR128:$src1, + sse_load_f32:$src2))]>; + // int_x86_sse_xxx_ss + + def V#NAME#SDrm_Int : VSDI("int_x86_sse2_", + !strconcat(OpcodeStr, "_sd")) VR128:$src1, + sse_load_f64:$src2))]>; + // int_x86_sse2_xxx_sd + def SSrm_Int : SSI Author: sampo Date: Fri Jun 11 22:09:49 2010 New Revision: 105874 URL: http://llvm.org/viewvc/llvm-project?rev=105874&view=rev Log: Add generic vector support for bitselect & element byteswap Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp llvm/trunk/utils/TableGen/NeonEmitter.h Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105874&r1=105873&r2=105874&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Fri Jun 11 22:09:49 2010 @@ -443,20 +443,8 @@ return s; } -static std::string Duplicate(StringRef typestr, const std::string &a) { - bool dummy, quad = false; - char type = ClassifyType(typestr, quad, dummy, dummy); - unsigned nElts = 0; - switch (type) { - case 'c': nElts = 8; break; - case 's': nElts = 4; break; - case 'i': nElts = 2; break; - case 'l': nElts = 1; break; - case 'h': nElts = 4; break; - case 'f': nElts = 2; break; - } - nElts <<= quad; - +static std::string Duplicate(unsigned nElts, StringRef typestr, + const std::string &a) { std::string s; s = "(__neon_" + TypeString('d', typestr) + "){ "; @@ -475,6 +463,18 @@ // than vector types, and the call becomes "a.val + b.val" static std::string GenOpString(OpKind op, const std::string &proto, StringRef typestr, bool structTypes = true) { + bool dummy, quad = false; + char type = ClassifyType(typestr, quad, dummy, dummy); + unsigned nElts = 0; + switch (type) { + case 'c': nElts = 8; break; + case 's': nElts = 4; break; + case 'i': nElts = 2; break; + case 'l': nElts = 1; break; + case 'h': nElts = 4; break; + case 'f': nElts = 2; break; + } + std::string ts = TypeString(proto[0], typestr); std::string s = ts + " r; r"; @@ -497,17 +497,17 @@ s += a + " - " + b; break; case OpMulN: - b = Duplicate(typestr, "b"); + b = Duplicate(nElts << quad, typestr, "b"); case OpMul: s += a + " * " + b; break; case OpMlaN: - c = Duplicate(typestr, "c"); + c = Duplicate(nElts << quad, typestr, "c"); case OpMla: s += a + " + ( " + b + " * " + c + " )"; break; case OpMlsN: - c = Duplicate(typestr, "c"); + c = Duplicate(nElts << quad, typestr, "c"); case OpMls: s += a + " - ( " + b + " * " + c + " )"; break; @@ -561,7 +561,35 @@ s += "(__neon_int64x1_t)(((__neon_int64x2_t)" + a + ")[0])"; break; case OpDup: - s += Duplicate(typestr, a); + s += Duplicate(nElts << quad, typestr, a); + break; + case OpSelect: + // ((0 & 1) | (~0 & 2)) + ts = TypeString(proto[1], typestr); + s += "( " + a + " & (__neon_" + ts + ")" + b + ") | "; + s += "(~" + a + " & (__neon_" + ts + ")" + c + ")"; + break; + case OpRev16: + s += "__builtin_shufflevector(" + a + ", " + a; + for (unsigned i = 2; i <= nElts << quad; i += 2) + for (unsigned j = 0; j != 2; ++j) + s += ", " + utostr(i - j - 1); + s += ")"; + break; + case OpRev32: + nElts >>= 1; + s += "__builtin_shufflevector(" + a + ", " + a; + for (unsigned i = nElts; i <= nElts << (1 + quad); i += nElts) + for (unsigned j = 0; j != nElts; ++j) + s += ", " + utostr(i - j - 1); + s += ")"; + break; + case OpRev64: + s += "__builtin_shufflevector(" + a + ", " + a; + for (unsigned i = nElts; i <= nElts << quad; i += nElts) + for (unsigned j = 0; j != nElts; ++j) + s += ", " + utostr(i - j - 1); + s += ")"; break; default: throw "unknown OpKind!"; @@ -630,6 +658,19 @@ static std::string GenBuiltin(const std::string &name, const std::string &proto, StringRef typestr, ClassKind ck, bool structTypes = true) { + bool dummy, quad = false; + char type = ClassifyType(typestr, quad, dummy, dummy); + unsigned nElts = 0; + switch (type) { + case 'c': nElts = 8; break; + case 's': nElts = 4; break; + case 'i': nElts = 2; break; + case 'l': nElts = 1; break; + case 'h': nElts = 4; break; + case 'f': nElts = 2; break; + } + nElts <<= quad; + char arg = 'a'; std::string s; @@ -678,12 +719,15 @@ s += "("; for (unsigned i = 1, e = proto.size(); i != e; ++i, ++arg) { + std::string args = std::string(&arg, 1); + if (define) + args = "(" + args + ")"; + // Handle multiple-vector values specially, emitting each subvector as an // argument to the __builtin. if (structTypes && (proto[i] == '2' || proto[i] == '3' || proto[i] == '4')){ for (unsigned vi = 0, ve = proto[i] - '0'; vi != ve; ++vi) { - s.push_back(arg); - s += ".val[" + utostr(vi) + "]"; + s += args + ".val[" + utostr(vi) + "]"; if ((vi + 1) < ve) s += ", "; } @@ -693,18 +737,10 @@ continue; } - // Parenthesize the args from the macro. - if (define) - s.push_back('('); - if (splat && (i + 1) == e) - s += Duplicate(typestr, std::string(&arg, 1)); + s += Duplicate(nElts, typestr, args); else - s.push_back(arg); - - // Parenthesize the args from the macro. - if (define) - s.push_back(')'); + s += args; if (structTypes && proto[i] != 's' && proto[i] != 'i' && proto[i] != 'l' && proto[i] != 'p' && proto[i] != 'c' && proto[i] != 'a') { Modified: llvm/trunk/utils/TableGen/NeonEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.h?rev=105874&r1=105873&r2=105874&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.h (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.h Fri Jun 11 22:09:49 2010 @@ -47,7 +47,11 @@ OpConcat, OpDup, OpHi, - OpLo + OpLo, + OpSelect, + OpRev16, + OpRev32, + OpRev64 }; enum ClassKind { @@ -93,6 +97,10 @@ OpMap["OP_HI"] = OpHi; OpMap["OP_LO"] = OpLo; OpMap["OP_DUP"] = OpDup; + OpMap["OP_SEL"] = OpSelect; + OpMap["OP_REV16"] = OpRev16; + OpMap["OP_REV32"] = OpRev32; + OpMap["OP_REV64"] = OpRev64; Record *SI = R.getClass("SInst"); Record *II = R.getClass("IInst"); From bruno.cardoso at gmail.com Fri Jun 11 22:12:14 2010 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Sat, 12 Jun 2010 03:12:14 -0000 Subject: [llvm-commits] [llvm] r105876 - /llvm/trunk/lib/Target/X86/X86InstrSSE.td Message-ID: <20100612031214.CA96D2A6C12C@llvm.org> Author: bruno Date: Fri Jun 11 22:12:14 2010 New Revision: 105876 URL: http://llvm.org/viewvc/llvm-project?rev=105876&view=rev Log: make the avx intrinsics 3 address Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=105876&r1=105875&r2=105876&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Fri Jun 11 22:12:14 2010 @@ -790,16 +790,20 @@ !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), [(set VR128:$dst, (!nameconcat("int_x86_sse_", !strconcat(OpcodeStr, "_ss")) VR128:$src1, - VR128:$src2))]>; + VR128:$src2))]> { // int_x86_sse_xxx_ss + let Constraints = ""; + } def V#NAME#SDrr_Int : VSDI("int_x86_sse2_", !strconcat(OpcodeStr, "_sd")) VR128:$src1, - VR128:$src2))]>; + VR128:$src2))]> { // int_x86_sse2_xxx_sd + let Constraints = ""; + } def SSrr_Int : SSI("int_x86_sse_", !strconcat(OpcodeStr, "_ss")) VR128:$src1, - sse_load_f32:$src2))]>; + sse_load_f32:$src2))]> { // int_x86_sse_xxx_ss + let Constraints = ""; + } def V#NAME#SDrm_Int : VSDI("int_x86_sse2_", !strconcat(OpcodeStr, "_sd")) VR128:$src1, - sse_load_f64:$src2))]>; + sse_load_f64:$src2))]> { // int_x86_sse2_xxx_sd + let Constraints = ""; + } def SSrm_Int : SSI Author: efriedma Date: Sat Jun 12 00:54:27 2010 New Revision: 105878 URL: http://llvm.org/viewvc/llvm-project?rev=105878&view=rev Log: Add README entry; based on testcase from Bill Hart. Modified: llvm/trunk/lib/Target/README.txt Modified: llvm/trunk/lib/Target/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=105878&r1=105877&r2=105878&view=diff ============================================================================== --- llvm/trunk/lib/Target/README.txt (original) +++ llvm/trunk/lib/Target/README.txt Sat Jun 12 00:54:27 2010 @@ -1863,3 +1863,47 @@ case it choses instead to keep the max operation obvious. //===---------------------------------------------------------------------===// + +Take the following testcase on x86-64 (similar testcases exist for all targets +with addc/adde): + +define void @a(i64* nocapture %s, i64* nocapture %t, i64 %a, i64 %b, +i64 %c) nounwind { +entry: + %0 = zext i64 %a to i128 ; [#uses=1] + %1 = zext i64 %b to i128 ; [#uses=1] + %2 = add i128 %1, %0 ; [#uses=2] + %3 = zext i64 %c to i128 ; [#uses=1] + %4 = shl i128 %3, 64 ; [#uses=1] + %5 = add i128 %4, %2 ; [#uses=1] + %6 = lshr i128 %5, 64 ; [#uses=1] + %7 = trunc i128 %6 to i64 ; [#uses=1] + store i64 %7, i64* %s, align 8 + %8 = trunc i128 %2 to i64 ; [#uses=1] + store i64 %8, i64* %t, align 8 + ret void +} + +Generated code: + addq %rcx, %rdx + movl $0, %eax + adcq $0, %rax + addq %r8, %rax + movq %rax, (%rdi) + movq %rdx, (%rsi) + ret + +Expected code: + addq %rcx, %rdx + adcq $0, %r8 + movq %r8, (%rdi) + movq %rdx, (%rsi) + ret + +The generated SelectionDAG has an ADD of an ADDE, where both operands of the +ADDE are zero. Replacing one of the operands of the ADDE with the other operand +of the ADD, and replacing the ADD with the ADDE, should give the desired result. + +(That said, we are doing a lot better than gcc on this testcase. :) ) + +//===---------------------------------------------------------------------===// From baldrick at free.fr Sat Jun 12 06:20:26 2010 From: baldrick at free.fr (Duncan Sands) Date: Sat, 12 Jun 2010 13:20:26 +0200 Subject: [llvm-commits] [PATCH] Make LLVM assertions configurable In-Reply-To: <4C12B9BE.2080002@mozilla.com> References: <4C12B9BE.2080002@mozilla.com> Message-ID: <4C136D7A.3060605@free.fr> Hi Patrick, > I've created a patch against the latest svn head that makes assertions > call a user-definable LLVMDie() handler, instead of abort(3). This makes > bindings able to turn them into exceptions, which is the subject of the > next patch :) LLVM is not designed to work with exceptions: no effort is made to ensure that the internal state is sensible if an exception is raised. What I am saying is that if you catch an exception (or otherwise try to soldier on) when an assertion fires, you won't be able to continue using the LLVM libraries, at least not with the current module, because in general it will be in a corrupt state. Ciao, Duncan. From sabre at nondot.org Sat Jun 12 10:46:56 2010 From: sabre at nondot.org (Chris Lattner) Date: Sat, 12 Jun 2010 15:46:56 -0000 Subject: [llvm-commits] [llvm] r105886 - in /llvm/trunk: include/llvm/Target/TargetInstrItineraries.h utils/TableGen/NeonEmitter.cpp Message-ID: <20100612154656.6B7E72A6C12C@llvm.org> Author: lattner Date: Sat Jun 12 10:46:56 2010 New Revision: 105886 URL: http://llvm.org/viewvc/llvm-project?rev=105886&view=rev Log: declare a class with 'class' instead of struct to avoid tag mismatch warnings, and don't shift by a bool. Patch by Rizky Herucakra! Modified: llvm/trunk/include/llvm/Target/TargetInstrItineraries.h llvm/trunk/utils/TableGen/NeonEmitter.cpp Modified: llvm/trunk/include/llvm/Target/TargetInstrItineraries.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrItineraries.h?rev=105886&r1=105885&r2=105886&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrItineraries.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrItineraries.h Sat Jun 12 10:46:56 2010 @@ -106,7 +106,8 @@ /// Instruction itinerary Data - Itinerary data supplied by a subtarget to be /// used by a target. /// -struct InstrItineraryData { +class InstrItineraryData { +public: const InstrStage *Stages; ///< Array of stages selected const unsigned *OperandCycles; ///< Array of operand cycles selected const InstrItinerary *Itineratries; ///< Array of itineraries selected Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105886&r1=105885&r2=105886&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Sat Jun 12 10:46:56 2010 @@ -669,7 +669,7 @@ case 'h': nElts = 4; break; case 'f': nElts = 2; break; } - nElts <<= quad; + if (quad) nElts <<= 1; char arg = 'a'; std::string s; From sabre at nondot.org Sat Jun 12 10:50:24 2010 From: sabre at nondot.org (Chris Lattner) Date: Sat, 12 Jun 2010 15:50:24 -0000 Subject: [llvm-commits] [llvm] r105887 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <20100612155024.8A9412A6C12C@llvm.org> Author: lattner Date: Sat Jun 12 10:50:24 2010 New Revision: 105887 URL: http://llvm.org/viewvc/llvm-project?rev=105887&view=rev Log: improve verifier error about unterminated block to include function name, patch by Yuri Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=105887&r1=105886&r2=105887&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Sat Jun 12 10:50:24 2010 @@ -85,7 +85,8 @@ for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { if (I->empty() || !I->back().isTerminator()) { - dbgs() << "Basic Block does not have terminator!\n"; + dbgs() << "Basic Block in function '" << F.getName() + << "' does not have terminator!\n"; WriteAsOperand(dbgs(), I, true); dbgs() << "\n"; Broken = true; From daniel at zuster.org Sat Jun 12 11:00:10 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 12 Jun 2010 16:00:10 -0000 Subject: [llvm-commits] [llvm] r105888 - /llvm/trunk/utils/lit/lit/TestRunner.py Message-ID: <20100612160010.8044F2A6C12C@llvm.org> Author: ddunbar Date: Sat Jun 12 11:00:10 2010 New Revision: 105888 URL: http://llvm.org/viewvc/llvm-project?rev=105888&view=rev Log: lit: Replace /dev/null in scripts with temporary files on Windows. Modified: llvm/trunk/utils/lit/lit/TestRunner.py Modified: llvm/trunk/utils/lit/lit/TestRunner.py URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=105888&r1=105887&r2=105888&view=diff ============================================================================== --- llvm/trunk/utils/lit/lit/TestRunner.py (original) +++ llvm/trunk/utils/lit/lit/TestRunner.py Sat Jun 12 11:00:10 2010 @@ -66,6 +66,7 @@ input = subprocess.PIPE stderrTempFiles = [] opened_files = [] + named_temp_files = [] # To avoid deadlock, we use a single stderr stream for piped # output. This is null until we have seen some output using # stderr. @@ -148,6 +149,15 @@ if not args[0]: raise InternalShellError(j, '%r: command not found' % j.args[0]) + # Replace uses of /dev/null with temporary files. + if kAvoidDevNull: + for i,arg in enumerate(args): + if arg == "/dev/null": + f = tempfile.NamedTemporaryFile(delete=False) + f.close() + named_temp_files.append(f.name) + args[i] = f.name + procs.append(subprocess.Popen(args, cwd=cwd, stdin = stdin, stdout = stdout, @@ -209,6 +219,13 @@ for f in opened_files: f.close() + # Remove any named temporary files we created. + for f in named_temp_files: + try: + os.remove(f) + except OSError: + pass + if cmd.negate: exitCode = not exitCode From daniel at zuster.org Sat Jun 12 11:21:19 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 12 Jun 2010 16:21:19 -0000 Subject: [llvm-commits] [llvm] r105890 - in /llvm/trunk/test: CMakeLists.txt lit.cfg lit.site.cfg.in Message-ID: <20100612162119.9C6132A6C12C@llvm.org> Author: ddunbar Date: Sat Jun 12 11:21:19 2010 New Revision: 105890 URL: http://llvm.org/viewvc/llvm-project?rev=105890&view=rev Log: tests: Propogate LLVM_SRC_ROOT and PYTHON_EXECUTABLE environment variables to tests. Modified: llvm/trunk/test/CMakeLists.txt llvm/trunk/test/lit.cfg llvm/trunk/test/lit.site.cfg.in Modified: llvm/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CMakeLists.txt?rev=105890&r1=105889&r2=105890&view=diff ============================================================================== --- llvm/trunk/test/CMakeLists.txt (original) +++ llvm/trunk/test/CMakeLists.txt Sat Jun 12 11:21:19 2010 @@ -35,6 +35,7 @@ -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#" -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}#" -e "s#\@LLVMGCCDIR\@##" + -e "s#\@PYTHON_EXECUTABLE\@#${PYTHON_EXECUTABLE}#" ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in > ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#" Modified: llvm/trunk/test/lit.cfg URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.cfg?rev=105890&r1=105889&r2=105890&view=diff ============================================================================== --- llvm/trunk/test/lit.cfg (original) +++ llvm/trunk/test/lit.cfg Sat Jun 12 11:21:19 2010 @@ -48,6 +48,13 @@ # Propogate 'HOME' through the environment. config.environment['HOME'] = os.environ['HOME'] +# Propogate LLVM_SRC_ROOT into the environment. +config.environment['LLVM_SRC_ROOT'] = config.llvm_src_root + +# Propogate PYTHON_EXEUTABLE into the environment +config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable', + '') + ### import os Modified: llvm/trunk/test/lit.site.cfg.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.site.cfg.in?rev=105890&r1=105889&r2=105890&view=diff ============================================================================== --- llvm/trunk/test/lit.site.cfg.in (original) +++ llvm/trunk/test/lit.site.cfg.in Sat Jun 12 11:21:19 2010 @@ -4,6 +4,7 @@ config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" config.llvmgcc_dir = "@LLVMGCCDIR@" +config.python_executable = "@PYTHON_EXECUTABLE@" # Let the main config do the real work. lit.load_config(config, "@LLVM_SOURCE_DIR@/test/lit.cfg") From daniel at zuster.org Sat Jun 12 11:21:54 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 12 Jun 2010 16:21:54 -0000 Subject: [llvm-commits] [llvm] r105891 - /llvm/trunk/test/Scripts/macho-dump.bat Message-ID: <20100612162154.B72CE2A6C12C@llvm.org> Author: ddunbar Date: Sat Jun 12 11:21:54 2010 New Revision: 105891 URL: http://llvm.org/viewvc/llvm-project?rev=105891&view=rev Log: tests: Make macho-dump.bat actually work. Modified: llvm/trunk/test/Scripts/macho-dump.bat Modified: llvm/trunk/test/Scripts/macho-dump.bat URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Scripts/macho-dump.bat?rev=105891&r1=105890&r2=105891&view=diff ============================================================================== --- llvm/trunk/test/Scripts/macho-dump.bat (original) +++ llvm/trunk/test/Scripts/macho-dump.bat Sat Jun 12 11:21:54 2010 @@ -1,3 +1,7 @@ @echo off -macho-dump %1 %2 %3 %4 %5 %6 %7 %8 %9 + + at rem The -t here is just to avoid infinite looping if %PYTHON_EXECUTABLE% isn't set + at rem for some reason. + +%PYTHON_EXECUTABLE% -t %LLVM_SRC_ROOT%\test\Scripts\macho-dump %1 %2 %3 %4 %5 %6 %7 %8 %9 From daniel at zuster.org Sat Jun 12 12:05:28 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Sat, 12 Jun 2010 17:05:28 -0000 Subject: [llvm-commits] [llvm] r105894 - /llvm/trunk/test/Scripts/macho-dump.bat Message-ID: <20100612170528.57FEE2A6C12C@llvm.org> Author: ddunbar Date: Sat Jun 12 12:05:28 2010 New Revision: 105894 URL: http://llvm.org/viewvc/llvm-project?rev=105894&view=rev Log: tests: Run macho-dump with binary unbuffered streams on Windows, I can't find a Python 2.6 way to change stdin to binary. Modified: llvm/trunk/test/Scripts/macho-dump.bat Modified: llvm/trunk/test/Scripts/macho-dump.bat URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Scripts/macho-dump.bat?rev=105894&r1=105893&r2=105894&view=diff ============================================================================== --- llvm/trunk/test/Scripts/macho-dump.bat (original) +++ llvm/trunk/test/Scripts/macho-dump.bat Sat Jun 12 12:05:28 2010 @@ -1,7 +1,7 @@ @echo off - at rem The -t here is just to avoid infinite looping if %PYTHON_EXECUTABLE% isn't set - at rem for some reason. + at rem We need to set -u to treat stdin as binary. Python 3 has support for doing + at rem this in code, but I haven't found a way to do this in 2.6 yet. -%PYTHON_EXECUTABLE% -t %LLVM_SRC_ROOT%\test\Scripts\macho-dump %1 %2 %3 %4 %5 %6 %7 %8 %9 +%PYTHON_EXECUTABLE% -u %LLVM_SRC_ROOT%\test\Scripts\macho-dump %1 %2 %3 %4 %5 %6 %7 %8 %9 From rafael.espindola at gmail.com Sat Jun 12 15:13:29 2010 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sat, 12 Jun 2010 20:13:29 -0000 Subject: [llvm-commits] [llvm] r105900 - /llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Message-ID: <20100612201329.BE5B52A6C12D@llvm.org> Author: rafael Date: Sat Jun 12 15:13:29 2010 New Revision: 105900 URL: http://llvm.org/viewvc/llvm-project?rev=105900&view=rev Log: Merge getStoreRegOpcode and getLoadRegOpcode. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=105900&r1=105899&r2=105900&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Sat Jun 12 15:13:29 2010 @@ -2057,71 +2057,87 @@ return false; } -static unsigned getStoreRegOpcode(unsigned SrcReg, - const TargetRegisterClass *RC, - bool isStackAligned, - TargetMachine &TM) { - unsigned Opc = 0; +static unsigned getLoadStoreRegOpcode(unsigned Reg, + const TargetRegisterClass *RC, + bool isStackAligned, + const TargetMachine &TM, + bool load) { if (RC == &X86::GR64RegClass || RC == &X86::GR64_NOSPRegClass) { - Opc = X86::MOV64mr; + return load ? X86::MOV64rm : X86::MOV64mr; } else if (RC == &X86::GR32RegClass || RC == &X86::GR32_NOSPRegClass) { - Opc = X86::MOV32mr; + return load ? X86::MOV32rm : X86::MOV32mr; } else if (RC == &X86::GR16RegClass) { - Opc = X86::MOV16mr; + return load ? X86::MOV16rm : X86::MOV16mr; } else if (RC == &X86::GR8RegClass) { // Copying to or from a physical H register on x86-64 requires a NOREX // move. Otherwise use a normal move. - if (isHReg(SrcReg) && + if (isHReg(Reg) && TM.getSubtarget().is64Bit()) - Opc = X86::MOV8mr_NOREX; + return load ? X86::MOV8rm_NOREX : X86::MOV8mr_NOREX; else - Opc = X86::MOV8mr; + return load ? X86::MOV8rm : X86::MOV8mr; } else if (RC == &X86::GR64_ABCDRegClass) { - Opc = X86::MOV64mr; + return load ? X86::MOV64rm : X86::MOV64mr; } else if (RC == &X86::GR32_ABCDRegClass) { - Opc = X86::MOV32mr; + return load ? X86::MOV32rm : X86::MOV32mr; } else if (RC == &X86::GR16_ABCDRegClass) { - Opc = X86::MOV16mr; + return load ? X86::MOV16rm : X86::MOV16mr; } else if (RC == &X86::GR8_ABCD_LRegClass) { - Opc = X86::MOV8mr; + return load ? X86::MOV8rm :X86::MOV8mr; } else if (RC == &X86::GR8_ABCD_HRegClass) { if (TM.getSubtarget().is64Bit()) - Opc = X86::MOV8mr_NOREX; + return load ? X86::MOV8rm_NOREX : X86::MOV8mr_NOREX; else - Opc = X86::MOV8mr; + return load ? X86::MOV8rm : X86::MOV8mr; } else if (RC == &X86::GR64_NOREXRegClass || RC == &X86::GR64_NOREX_NOSPRegClass) { - Opc = X86::MOV64mr; + return load ? X86::MOV64rm : X86::MOV64mr; } else if (RC == &X86::GR32_NOREXRegClass) { - Opc = X86::MOV32mr; + return load ? X86::MOV32rm : X86::MOV32mr; } else if (RC == &X86::GR16_NOREXRegClass) { - Opc = X86::MOV16mr; + return load ? X86::MOV16rm : X86::MOV16mr; } else if (RC == &X86::GR8_NOREXRegClass) { - Opc = X86::MOV8mr; + return load ? X86::MOV8rm : X86::MOV8mr; } else if (RC == &X86::GR64_TCRegClass) { - Opc = X86::MOV64mr_TC; + return load ? X86::MOV64rm_TC : X86::MOV64mr_TC; } else if (RC == &X86::GR32_TCRegClass) { - Opc = X86::MOV32mr_TC; + return load ? X86::MOV32rm_TC : X86::MOV32mr_TC; } else if (RC == &X86::RFP80RegClass) { - Opc = X86::ST_FpP80m; // pops + return load ? X86::LD_Fp80m : X86::ST_FpP80m; } else if (RC == &X86::RFP64RegClass) { - Opc = X86::ST_Fp64m; + return load ? X86::LD_Fp64m : X86::ST_Fp64m; } else if (RC == &X86::RFP32RegClass) { - Opc = X86::ST_Fp32m; + return load ? X86::LD_Fp32m : X86::ST_Fp32m; } else if (RC == &X86::FR32RegClass) { - Opc = X86::MOVSSmr; + return load ? X86::MOVSSrm : X86::MOVSSmr; } else if (RC == &X86::FR64RegClass) { - Opc = X86::MOVSDmr; + return load ? X86::MOVSDrm : X86::MOVSDmr; } else if (RC == &X86::VR128RegClass) { // If stack is realigned we can use aligned stores. - Opc = isStackAligned ? X86::MOVAPSmr : X86::MOVUPSmr; + if (isStackAligned) + return load ? X86::MOVAPSrm : X86::MOVAPSmr; + else + return load ? X86::MOVUPSrm : X86::MOVUPSmr; } else if (RC == &X86::VR64RegClass) { - Opc = X86::MMX_MOVQ64mr; + return load ? X86::MMX_MOVQ64rm : X86::MMX_MOVQ64mr; } else { llvm_unreachable("Unknown regclass"); } +} + +static unsigned getStoreRegOpcode(unsigned SrcReg, + const TargetRegisterClass *RC, + bool isStackAligned, + TargetMachine &TM) { + return getLoadStoreRegOpcode(SrcReg, RC, isStackAligned, TM, false); +} + - return Opc; +static unsigned getLoadRegOpcode(unsigned DestReg, + const TargetRegisterClass *RC, + bool isStackAligned, + const TargetMachine &TM) { + return getLoadStoreRegOpcode(DestReg, RC, isStackAligned, TM, true); } void X86InstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB, @@ -2155,72 +2171,6 @@ NewMIs.push_back(MIB); } -static unsigned getLoadRegOpcode(unsigned DestReg, - const TargetRegisterClass *RC, - bool isStackAligned, - const TargetMachine &TM) { - unsigned Opc = 0; - if (RC == &X86::GR64RegClass || RC == &X86::GR64_NOSPRegClass) { - Opc = X86::MOV64rm; - } else if (RC == &X86::GR32RegClass || RC == &X86::GR32_NOSPRegClass) { - Opc = X86::MOV32rm; - } else if (RC == &X86::GR16RegClass) { - Opc = X86::MOV16rm; - } else if (RC == &X86::GR8RegClass) { - // Copying to or from a physical H register on x86-64 requires a NOREX - // move. Otherwise use a normal move. - if (isHReg(DestReg) && - TM.getSubtarget().is64Bit()) - Opc = X86::MOV8rm_NOREX; - else - Opc = X86::MOV8rm; - } else if (RC == &X86::GR64_ABCDRegClass) { - Opc = X86::MOV64rm; - } else if (RC == &X86::GR32_ABCDRegClass) { - Opc = X86::MOV32rm; - } else if (RC == &X86::GR16_ABCDRegClass) { - Opc = X86::MOV16rm; - } else if (RC == &X86::GR8_ABCD_LRegClass) { - Opc = X86::MOV8rm; - } else if (RC == &X86::GR8_ABCD_HRegClass) { - if (TM.getSubtarget().is64Bit()) - Opc = X86::MOV8rm_NOREX; - else - Opc = X86::MOV8rm; - } else if (RC == &X86::GR64_NOREXRegClass || - RC == &X86::GR64_NOREX_NOSPRegClass) { - Opc = X86::MOV64rm; - } else if (RC == &X86::GR32_NOREXRegClass) { - Opc = X86::MOV32rm; - } else if (RC == &X86::GR16_NOREXRegClass) { - Opc = X86::MOV16rm; - } else if (RC == &X86::GR8_NOREXRegClass) { - Opc = X86::MOV8rm; - } else if (RC == &X86::GR64_TCRegClass) { - Opc = X86::MOV64rm_TC; - } else if (RC == &X86::GR32_TCRegClass) { - Opc = X86::MOV32rm_TC; - } else if (RC == &X86::RFP80RegClass) { - Opc = X86::LD_Fp80m; - } else if (RC == &X86::RFP64RegClass) { - Opc = X86::LD_Fp64m; - } else if (RC == &X86::RFP32RegClass) { - Opc = X86::LD_Fp32m; - } else if (RC == &X86::FR32RegClass) { - Opc = X86::MOVSSrm; - } else if (RC == &X86::FR64RegClass) { - Opc = X86::MOVSDrm; - } else if (RC == &X86::VR128RegClass) { - // If stack is realigned we can use aligned loads. - Opc = isStackAligned ? X86::MOVAPSrm : X86::MOVUPSrm; - } else if (RC == &X86::VR64RegClass) { - Opc = X86::MMX_MOVQ64rm; - } else { - llvm_unreachable("Unknown regclass"); - } - - return Opc; -} void X86InstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, From espindola at google.com Sat Jun 12 15:46:58 2010 From: espindola at google.com (Rafael Espindola) Date: Sat, 12 Jun 2010 16:46:58 -0400 Subject: [llvm-commits] [patch] Mostly mechanical removal of getPhysicalRegisterRegClass.patch In-Reply-To: References: Message-ID: I have attached an updated patch. It is still one big change, but it is a bit cleaner now. The changes to the ??InstrInfo.cpp files I think are correct. I will try to split the others into smaller patches during the week. Cheers, -- Rafael ?vila de Esp?ndola -------------- next part -------------- A non-text attachment was scrubbed... Name: getPhysicalRegisterRegClass.patch Type: application/octet-stream Size: 20109 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100612/74cb6c6d/attachment.obj From clattner at apple.com Sat Jun 12 18:34:21 2010 From: clattner at apple.com (Chris Lattner) Date: Sat, 12 Jun 2010 16:34:21 -0700 Subject: [llvm-commits] [llvm] r105303 - /llvm/trunk/lib/Target/X86/README-X86-64.txt In-Reply-To: <20100602001036.832CB312800A@llvm.org> References: <20100602001036.832CB312800A@llvm.org> Message-ID: <4012A8C4-CE99-4592-8E65-B0C77127763D@apple.com> On Jun 1, 2010, at 5:10 PM, Eli Friedman wrote: > Author: efriedma > Date: Tue Jun 1 19:10:36 2010 > New Revision: 105303 > > URL: http://llvm.org/viewvc/llvm-project?rev=105303&view=rev > Log: > Remove outdated README entries. Hi Eli, are you sure these are outdated? These looks still relevant: > ============================================================================== > --- llvm/trunk/lib/Target/X86/README-X86-64.txt (original) > +++ llvm/trunk/lib/Target/X86/README-X86-64.txt Tue Jun 1 19:10:36 2010 > @@ -98,124 +76,6 @@ > > //===---------------------------------------------------------------------===// > > -Vararg function prologue can be further optimized. Currently all XMM registers > -are stored into register save area. Most of them can be eliminated since the > -upper bound of the number of XMM registers used are passed in %al. gcc produces > -something like the following: > - > - movzbl %al, %edx > - leaq 0(,%rdx,4), %rax > - leaq 4+L2(%rip), %rdx > - leaq 239(%rsp), %rax > - jmp *%rdx > - movaps %xmm7, -15(%rax) > - movaps %xmm6, -31(%rax) > - movaps %xmm5, -47(%rax) > - movaps %xmm4, -63(%rax) > - movaps %xmm3, -79(%rax) > - movaps %xmm2, -95(%rax) > - movaps %xmm1, -111(%rax) > - movaps %xmm0, -127(%rax) > -L2: > - > -It jumps over the movaps that do not need to be stored. Hard to see this being > -significant as it added 5 instruciton (including a indirect branch) to avoid > -executing 0 to 8 stores in the function prologue. > - > -Perhaps we can optimize for the common case where no XMM registers are used for > -parameter passing. i.e. is %al == 0 jump over all stores. Or in the case of a > -leaf function where we can determine that no XMM input parameter is need, avoid > -emitting the stores at all. > - > -//===---------------------------------------------------------------------===// > - > -AMD64 has a complex calling convention for aggregate passing by value: > - > -1. If the size of an object is larger than two eightbytes, or in C++, is a non- > - POD structure or union type, or contains unaligned fields, it has class > - MEMORY. > -2. Both eightbytes get initialized to class NO_CLASS. > -3. Each field of an object is classified recursively so that always two fields > - are considered. The resulting class is calculated according to the classes > - of the fields in the eightbyte: > - (a) If both classes are equal, this is the resulting class. > - (b) If one of the classes is NO_CLASS, the resulting class is the other > - class. > - (c) If one of the classes is MEMORY, the result is the MEMORY class. > - (d) If one of the classes is INTEGER, the result is the INTEGER. > - (e) If one of the classes is X87, X87UP, COMPLEX_X87 class, MEMORY is used as > - class. > - (f) Otherwise class SSE is used. > -4. Then a post merger cleanup is done: > - (a) If one of the classes is MEMORY, the whole argument is passed in memory. > - (b) If SSEUP is not preceeded by SSE, it is converted to SSE. > - > -Currently llvm frontend does not handle this correctly. > - > -Problem 1: > - typedef struct { int i; double d; } QuadWordS; > -It is currently passed in two i64 integer registers. However, gcc compiled > -callee expects the second element 'd' to be passed in XMM0. > - > -Problem 2: > - typedef struct { int32_t i; float j; double d; } QuadWordS; > -The size of the first two fields == i64 so they will be combined and passed in > -a integer register RDI. The third field is still passed in XMM0. > - > -Problem 3: > - typedef struct { int64_t i; int8_t j; int64_t d; } S; > - void test(S s) > -The size of this aggregate is greater than two i64 so it should be passed in > -memory. Currently llvm breaks this down and passed it in three integer > -registers. > - > -Problem 4: > -Taking problem 3 one step ahead where a function expects a aggregate value > -in memory followed by more parameter(s) passed in register(s). > - void test(S s, int b) > - > -LLVM IR does not allow parameter passing by aggregates, therefore it must break > -the aggregates value (in problem 3 and 4) into a number of scalar values: > - void %test(long %s.i, byte %s.j, long %s.d); > - > -However, if the backend were to lower this code literally it would pass the 3 > -values in integer registers. To force it be passed in memory, the frontend > -should change the function signiture to: > - void %test(long %undef1, long %undef2, long %undef3, long %undef4, > - long %undef5, long %undef6, > - long %s.i, byte %s.j, long %s.d); > -And the callee would look something like this: > - call void %test( undef, undef, undef, undef, undef, undef, > - %tmp.s.i, %tmp.s.j, %tmp.s.d ); > -The first 6 undef parameters would exhaust the 6 integer registers used for > -parameter passing. The following three integer values would then be forced into > -memory. > - > -For problem 4, the parameter 'd' would be moved to the front of the parameter > -list so it will be passed in register: > - void %test(int %d, > - long %undef1, long %undef2, long %undef3, long %undef4, > - long %undef5, long %undef6, > - long %s.i, byte %s.j, long %s.d); > - From isanbard at gmail.com Sat Jun 12 19:43:21 2010 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 13 Jun 2010 00:43:21 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r105902 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <20100613004321.3B6C42A6C12C@llvm.org> Author: void Date: Sat Jun 12 19:43:21 2010 New Revision: 105902 URL: http://llvm.org/viewvc/llvm-project?rev=105902&view=rev Log: Limit the inclusion of an implicit "catch-all" to those selectors which are clean-ups and which don't have a catch-all already. The reason for this is because it breaks code that doesn't expect a catch-all. Take this example: static void ThrowSomething() { throw "C++"; printf("coucou\n"); } static void CatchSomething() { @try { ThrowSomething(); } @catch(id e) { printf("ObjC exception\n"); } } The CatchSomething function will generate an exception table that says that it catches "id" and has a catch-all. However, the code calls _Unwind_Resume_or_Rethrow in the catch-all instance. That causes libunwind to assert, because it's not expecting that call. 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=105902&r1=105901&r2=105902&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sat Jun 12 19:43:21 2010 @@ -2098,6 +2098,7 @@ foreach_reachable_handler(i, false, AddHandler, &Handlers); bool HasCleanup = false; + bool HasCatchAll = false; static GlobalVariable *CatchAll = 0; for (std::vector::iterator I = Handlers.begin(), @@ -2137,6 +2138,7 @@ } Args.push_back(CatchAll); + HasCatchAll = true; } else { // Add the type infos. for (; TypeList; TypeList = TREE_CHAIN(TypeList)) { @@ -2151,18 +2153,17 @@ } if (can_throw_external_1(i, false)) { - if (HasCleanup && Args.size() == 2) { - Args.push_back(ConstantInt::get(Type::getInt32Ty(Context), 0)); - } else { - // Some exceptions from this region may not be caught by any handler. - // Since invokes are required to branch to the unwind label no matter - // what exception is being unwound, append a catch-all. - - // The representation of a catch-all is language specific. - if (USING_SJLJ_EXCEPTIONS || !lang_eh_catch_all) { - // Use a "cleanup" - this should be good enough for most languages. + if (HasCleanup) { + if (Args.size() == 2 || USING_SJLJ_EXCEPTIONS || !lang_eh_catch_all) { + // Insert the sentinal indicating that this is a cleanup-only + // selector. It may also be the representation of a catch-all for + // some languages. Args.push_back(ConstantInt::get(Type::getInt32Ty(Context), 0)); - } else { + } else if (!HasCatchAll) { + // Some exceptions from this region may not be caught by any handler. + // Since invokes are required to branch to the unwind label no matter + // what exception is being unwound, append a catch-all. + if (!CatchAll) { Constant *Init = 0; tree catch_all_type = lang_eh_catch_all(); From eli.friedman at gmail.com Sat Jun 12 20:46:44 2010 From: eli.friedman at gmail.com (Eli Friedman) Date: Sat, 12 Jun 2010 18:46:44 -0700 Subject: [llvm-commits] [llvm] r105303 - /llvm/trunk/lib/Target/X86/README-X86-64.txt In-Reply-To: <4012A8C4-CE99-4592-8E65-B0C77127763D@apple.com> References: <20100602001036.832CB312800A@llvm.org> <4012A8C4-CE99-4592-8E65-B0C77127763D@apple.com> Message-ID: On Sat, Jun 12, 2010 at 4:34 PM, Chris Lattner wrote: > > On Jun 1, 2010, at 5:10 PM, Eli Friedman wrote: > >> Author: efriedma >> Date: Tue Jun ?1 19:10:36 2010 >> New Revision: 105303 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=105303&view=rev >> Log: >> Remove outdated README entries. > > Hi Eli, are you sure these are outdated? > > These looks still relevant: > >> ============================================================================== >> --- llvm/trunk/lib/Target/X86/README-X86-64.txt (original) >> +++ llvm/trunk/lib/Target/X86/README-X86-64.txt Tue Jun ?1 19:10:36 2010 >> @@ -98,124 +76,6 @@ >> >> //===---------------------------------------------------------------------===// >> >> -Vararg function prologue can be further optimized. Currently all XMM registers >> -are stored into register save area. Most of them can be eliminated since the >> -upper bound of the number of XMM registers used are passed in %al. gcc produces >> -something like the following: >> - >> - ? ? movzbl ?%al, %edx >> - ? ? leaq ? ?0(,%rdx,4), %rax >> - ? ? leaq ? ?4+L2(%rip), %rdx >> - ? ? leaq ? ?239(%rsp), %rax >> - ? ? ? ? ? ? jmp ? ? *%rdx >> - ? ? movaps ?%xmm7, -15(%rax) >> - ? ? movaps ?%xmm6, -31(%rax) >> - ? ? movaps ?%xmm5, -47(%rax) >> - ? ? movaps ?%xmm4, -63(%rax) >> - ? ? movaps ?%xmm3, -79(%rax) >> - ? ? movaps ?%xmm2, -95(%rax) >> - ? ? movaps ?%xmm1, -111(%rax) >> - ? ? movaps ?%xmm0, -127(%rax) >> -L2: >> - >> -It jumps over the movaps that do not need to be stored. Hard to see this being >> -significant as it added 5 instruciton (including a indirect branch) to avoid >> -executing 0 to 8 stores in the function prologue. >> - >> -Perhaps we can optimize for the common case where no XMM registers are used for >> -parameter passing. i.e. is %al == 0 jump over all stores. Or in the case of a >> -leaf function where we can determine that no XMM input parameter is need, avoid >> -emitting the stores at all. We have a jump over the stores if %al == 0. I guess we don't try to detect the case where no floats are passed to va_arg, but that's practically impossible without large changes to the way we lower va_arg to IR. >> -//===---------------------------------------------------------------------===// >> - >> -AMD64 has a complex calling convention for aggregate passing by value: >> - >> -1. If the size of an object is larger than two eightbytes, or in C++, is a non- >> - ? POD structure or union type, or contains unaligned fields, it has class >> - ? MEMORY. >> -2. Both eightbytes get initialized to class NO_CLASS. >> -3. Each field of an object is classified recursively so that always two fields >> - ? are considered. The resulting class is calculated according to the classes >> - ? of the fields in the eightbyte: >> - ? (a) If both classes are equal, this is the resulting class. >> - ? (b) If one of the classes is NO_CLASS, the resulting class is the other >> - ? ? ? class. >> - ? (c) If one of the classes is MEMORY, the result is the MEMORY class. >> - ? (d) If one of the classes is INTEGER, the result is the INTEGER. >> - ? (e) If one of the classes is X87, X87UP, COMPLEX_X87 class, MEMORY is used as >> - ? ? ?class. >> - ? (f) Otherwise class SSE is used. >> -4. Then a post merger cleanup is done: >> - ? (a) If one of the classes is MEMORY, the whole argument is passed in memory. >> - ? (b) If SSEUP is not preceeded by SSE, it is converted to SSE. >> - >> -Currently llvm frontend does not handle this correctly. >> - >> -Problem 1: >> - ? ?typedef struct { int i; double d; } QuadWordS; >> -It is currently passed in two i64 integer registers. However, gcc compiled >> -callee expects the second element 'd' to be passed in XMM0. >> - >> -Problem 2: >> - ? ?typedef struct { int32_t i; float j; double d; } QuadWordS; >> -The size of the first two fields == i64 so they will be combined and passed in >> -a integer register RDI. The third field is still passed in XMM0. >> - >> -Problem 3: >> - ? ?typedef struct { int64_t i; int8_t j; int64_t d; } S; >> - ? ?void test(S s) >> -The size of this aggregate is greater than two i64 so it should be passed in >> -memory. Currently llvm breaks this down and passed it in three integer >> -registers. >> - >> -Problem 4: >> -Taking problem 3 one step ahead where a function expects a aggregate value >> -in memory followed by more parameter(s) passed in register(s). >> - ? ?void test(S s, int b) >> - >> -LLVM IR does not allow parameter passing by aggregates, therefore it must break >> -the aggregates value (in problem 3 and 4) into a number of scalar values: >> - ? ?void %test(long %s.i, byte %s.j, long %s.d); >> - >> -However, if the backend were to lower this code literally it would pass the 3 >> -values in integer registers. To force it be passed in memory, the frontend >> -should change the function signiture to: >> - ? ?void %test(long %undef1, long %undef2, long %undef3, long %undef4, >> - ? ? ? ? ? ? ? long %undef5, long %undef6, >> - ? ? ? ? ? ? ? long %s.i, byte %s.j, long %s.d); >> -And the callee would look something like this: >> - ? ?call void %test( undef, undef, undef, undef, undef, undef, >> - ? ? ? ? ? ? ? ? ? ? %tmp.s.i, %tmp.s.j, %tmp.s.d ); >> -The first 6 undef parameters would exhaust the 6 integer registers used for >> -parameter passing. The following three integer values would then be forced into >> -memory. >> - >> -For problem 4, the parameter 'd' would be moved to the front of the parameter >> -list so it will be passed in register: >> - ? ?void %test(int %d, >> - ? ? ? ? ? ? ? long %undef1, long %undef2, long %undef3, long %undef4, >> - ? ? ? ? ? ? ? long %undef5, long %undef6, >> - ? ? ? ? ? ? ? long %s.i, byte %s.j, long %s.d); >> - I'm pretty sure argument passing on x86-64 works. :) And we have a bug on adding an ABI-lowering library to LLVM. -Eli From espindola at google.com Sat Jun 12 23:36:29 2010 From: espindola at google.com (Rafael Espindola) Date: Sun, 13 Jun 2010 00:36:29 -0400 Subject: [llvm-commits] [patch] Mostly mechanical removal of getPhysicalRegisterRegClass.patch In-Reply-To: References: Message-ID: > The first bit is in isel, creating virtregs for copying to and from a physreg. These all use the VT argument, and you should preserve that. It makes a difference if XMM1 is spilled as FR32, FR64, or VR128. In these cases, the physreg doesn't actually need to belong to the chosen class, and an argument could be made for using TLI.getRegClassFor(VT) instead. We want a compatible regclass to allow coalescing, but if coalescing is not possible, we want the largest possible regclass. In any case, you want a regclass compatible with VT. I tested TLI.getRegClassFor a bit and found an interesting case: f80. If I understand it correctly, the RST class is used after the stackfier has run. Since getRegClassFor has no idea if that has happened or not, it return a RFP80 and the backend get surprised by the reappearance of a RFP80. This and your comment about wanting the largest available class, suggest that the current function might actually be the correct one in some places. We should be able to at least make it non virtual. > /jakob Cheers, -- Rafael ?vila de Esp?ndola From clattner at apple.com Sat Jun 12 23:43:21 2010 From: clattner at apple.com (Chris Lattner) Date: Sat, 12 Jun 2010 21:43:21 -0700 Subject: [llvm-commits] [PATCH] Transforming assertions into OCaml exceptions In-Reply-To: <4C12BA20.4020006@mozilla.com> References: <4C12BA20.4020006@mozilla.com> Message-ID: <70B6D2F3-E365-4533-8D20-2B0FEBD20F1E@apple.com> On Jun 11, 2010, at 3:35 PM, Patrick Walton wrote: > Hi, > > This patch builds on the previous one (llvm-pcwalton-configurable-assertions.diff) and transforms assertions into exceptions in the OCaml bindings. I'm not sure this is the right way to go. Assertions should *never* trigger, they are not a checked condition. Transforming them into an exception is incorrect, because in certain build modes assertions are noops (the checks are not compiled in). -Chris From natebegeman at mac.com Sat Jun 12 23:47:03 2010 From: natebegeman at mac.com (Nate Begeman) Date: Sun, 13 Jun 2010 04:47:03 -0000 Subject: [llvm-commits] [llvm] r105907 - /llvm/trunk/utils/TableGen/NeonEmitter.cpp Message-ID: <20100613044703.323422A6C12C@llvm.org> Author: sampo Date: Sat Jun 12 23:47:03 2010 New Revision: 105907 URL: http://llvm.org/viewvc/llvm-project?rev=105907&view=rev Log: Add a helping of comments Add code for generating bits of semachecking Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp Modified: llvm/trunk/utils/TableGen/NeonEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/NeonEmitter.cpp?rev=105907&r1=105906&r2=105907&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/NeonEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/NeonEmitter.cpp Sat Jun 12 23:47:03 2010 @@ -11,6 +11,15 @@ // a declaration and definition of each function specified by the ARM NEON // compiler interface. See ARM document DUI0348B. // +// Each NEON instruction is implemented in terms of 1 or more functions which +// are suffixed with the element type of the input vectors. Functions may be +// implemented in terms of generic vector operations such as +, *, -, etc. or +// by calling a __builtin_-prefixed function which will be handled by clang's +// CodeGen library. +// +// Additional validation code can be generated by this file when runHeader() is +// called, rather than the normal run() entry point. +// //===----------------------------------------------------------------------===// #include "NeonEmitter.h" @@ -21,6 +30,10 @@ using namespace llvm; +/// ParseTypes - break down a string such as "fQf" into a vector of StringRefs, +/// which each StringRef representing a single type declared in the string. +/// for "fQf" we would end up with 2 StringRefs, "f", and "Qf", representing +/// 2xfloat and 4xfloat respectively. static void ParseTypes(Record *r, std::string &s, SmallVectorImpl &TV) { const char *data = s.data(); @@ -49,6 +62,8 @@ } } +/// Widen - Convert a type code into the next wider type. char -> short, +/// short -> int, etc. static char Widen(const char t) { switch (t) { case 'c': @@ -62,6 +77,8 @@ return '\0'; } +/// Narrow - Convert a type code into the next smaller type. short -> char, +/// float -> half float, etc. static char Narrow(const char t) { switch (t) { case 's': @@ -77,6 +94,8 @@ return '\0'; } +/// For a particular StringRef, return the base type code, and whether it has +/// the quad-vector, polynomial, or unsigned modifiers set. static char ClassifyType(StringRef ty, bool &quad, bool &poly, bool &usgn) { unsigned off = 0; @@ -102,6 +121,8 @@ return ty[off]; } +/// ModType - Transform a type code and its modifiers based on a mod code. The +/// mod code definitions may be found at the top of arm_neon.td. static char ModType(const char mod, char type, bool &quad, bool &poly, bool &usgn, bool &scal, bool &cnst, bool &pntr) { switch (mod) { @@ -166,8 +187,11 @@ return type; } +/// TypeString - for a modifier and type, generate the name of the typedef for +/// that type. If generic is true, emit the generic vector type rather than +/// the public NEON type. QUc -> uint8x8t_t / __neon_uint8x8_t. static std::string TypeString(const char mod, StringRef typestr, - bool ret = false) { + bool generic = false) { bool quad = false; bool poly = false; bool usgn = false; @@ -188,7 +212,7 @@ SmallString<128> s; - if (ret) + if (generic) s += "__neon_"; if (usgn) @@ -255,6 +279,9 @@ return s.str(); } +/// TypeString - for a modifier and type, generate the clang BuiltinsARM.def +/// prototype code for the function. See the top of clang's Builtins.def for +/// a description of the type strings. static std::string BuiltinTypeString(const char mod, StringRef typestr, ClassKind ck, bool ret) { bool quad = false; @@ -343,7 +370,9 @@ return quad ? "V16c" : "V8c"; } -// Turn "vst2_lane" into "vst2q_lane_f32", etc. +/// MangleName - Append a type or width suffix to a base neon function name, +/// and insert a 'q' in the appropriate location if the operation works on +/// 128b rather than 64b. E.g. turn "vst2_lane" into "vst2q_lane_f32", etc. static std::string MangleName(const std::string &name, StringRef typestr, ClassKind ck) { if (name == "vcvt_f32_f16") @@ -623,8 +652,6 @@ ret |= 0x08; if (quad) ret |= 0x10; - if (poly) - ret |= 0x20; switch (type) { case 'c': @@ -798,6 +825,8 @@ return s; } +/// run - Read the records in arm_neon.td and output arm_neon.h. arm_neon.h +/// is comprised of type definitions and function declarations. void NeonEmitter::run(raw_ostream &OS) { EmitSourceFileHeader("ARM NEON Header", OS); @@ -813,7 +842,6 @@ OS << "#include \n\n"; // Emit NEON-specific scalar typedefs. - // FIXME: probably need to do something better for polynomial types. OS << "typedef float float32_t;\n"; OS << "typedef uint8_t poly8_t;\n"; OS << "typedef uint16_t poly16_t;\n"; @@ -918,11 +946,26 @@ OS << "#endif /* __ARM_NEON_H */\n"; } +/// runHeader - generate one of three different tables which are used by clang +/// to support ARM NEON codegen. By default, this will produce the contents of +/// BuiltinsARM.def's NEON section. You may also enable the genSemaTypes or +/// getSemaRange variables below to generate code that SemaChecking will use to +/// validate the builtin function calls. +/// +/// This is not used as part of the build system currently, but is run manually +/// and the output placed in the appropriate file. void NeonEmitter::runHeader(raw_ostream &OS) { std::vector RV = Records.getAllDerivedDefinitions("Inst"); StringMap EmittedMap; + // Set true to generate the overloaded type checking code for SemaChecking.cpp + bool genSemaTypes = false; + + // Set true to generate the intrinsic range checking code for shift/lane + // immediates for SemaChecking.cpp + bool genSemaRange = true; + for (unsigned i = 0, e = RV.size(); i != e; ++i) { Record *R = RV[i]; @@ -934,18 +977,60 @@ std::string Proto = R->getValueAsString("Prototype"); std::string Types = R->getValueAsString("Types"); + // Functions with 'a' (the splat code) in the type prototype should not get + // their own builtin as they use the non-splat variant. if (Proto.find('a') != std::string::npos) continue; - + + // Functions which have a scalar argument cannot be overloaded, no need to + // check them if we are emitting the type checking code. + if (genSemaTypes && Proto.find('s') != std::string::npos) + continue; + + // Functions which do not have an immediate do not need to have range + // checking code emitted. + if (genSemaRange && Proto.find('i') == std::string::npos) + continue; + SmallVector TypeVec; ParseTypes(R, Types, TypeVec); - + if (R->getSuperClasses().size() < 2) throw TGError(R->getLoc(), "Builtin has no class kind"); ClassKind ck = ClassMap[R->getSuperClasses()[1]]; + int si = -1, qi = -1; + unsigned mask = 0, qmask = 0; for (unsigned ti = 0, te = TypeVec.size(); ti != te; ++ti) { + + // Generate the switch case(s) for this builtin for the type validation. + if (genSemaTypes) { + bool quad = false, poly = false, usgn = false; + (void) ClassifyType(TypeVec[ti], quad, poly, usgn); + + if (quad) { + qi = ti; + qmask |= 1 << GetNeonEnum(Proto, TypeVec[ti]); + } else { + si = ti; + mask |= 1 << GetNeonEnum(Proto, TypeVec[ti]); + } + continue; + } + + if (genSemaRange) { + if (Proto.find('s') == std::string::npos) + ck = ClassB; + + OS << "case ARM::BI__builtin_neon_" + << MangleName(name, TypeVec[ti], ck) << "\n"; + continue; + } + + // Generate the BuiltinsARM.def declaration for this builtin, ensuring + // that each unique BUILTIN() macro appears only once in the output + // stream. std::string bd = GenBuiltinDef(name, Proto, TypeVec[ti], ck); if (EmittedMap.count(bd)) continue; @@ -953,5 +1038,17 @@ EmittedMap[bd] = OpNone; OS << bd << "\n"; } + + if (genSemaTypes) { + if (mask) + OS << "case ARM::BI__builtin_neon_" + << MangleName(name, TypeVec[si], ClassB) + << ": mask = " << "0x" << utohexstr(mask) << "; break;\n"; + if (qmask) + OS << "case ARM::BI__builtin_neon_" + << MangleName(name, TypeVec[qi], ClassB) + << ": mask = " << "0x" << utohexstr(qmask) << "; break;\n"; + continue; + } } } From clattner at apple.com Sat Jun 12 23:51:54 2010 From: clattner at apple.com (Chris Lattner) Date: Sat, 12 Jun 2010 21:51:54 -0700 Subject: [llvm-commits] [patch] Implement a pass to instrument function entry and exit In-Reply-To: <87zkz9q6ta.fsf@mit.edu> References: <87zkz9q6ta.fsf@mit.edu> Message-ID: <7E610534-74CD-4454-8494-3E49CC0EC7A9@apple.com> On Jun 5, 2010, at 6:38 PM, Nelson Elhage wrote: > This patch adds a pass that adds calls to instrument function exit and > entry, in a way compatible with GCC's -finstrument-functions flag. > > Options are also provided to selectively exclude certain functions from > instrumenting, analogous to those provided by GCC. > > If this patch is not totally off-base, I'm planning to also implement > and send along a function attribute to disable instrumenting on specific > functions, and frontend support in clang. Nice, adding -finstrument-functions support would be great. Meta comment: please include your patch as an attachment. If you're using Thunderbird, please follow these instructions: http://llvm.org/docs/DeveloperPolicy.html#patches This makes it easier to apply. > +//===----------------------------------------------------------------------===// > +// > +// This pass inserts instrumentation calls for entry and exit to > +// functions. After function entry and before exit, calls are inserted > +// to the following instrumentation functions: > +// > +// void __cyg_profile_func_enter (void *this_fn, > +// void *call_site); > +// void __cyg_profile_func_exit (void *this_fn, > +// void *call_site); > +// > +//===----------------------------------------------------------------------===// > + > +#define DEBUG_TYPE "instrument-functions" > +#include "llvm/CodeGen/Passes.h" This should be added to the scalar passes. > +namespace { > + class CommaSeparatedStringParser : > + public cl::basic_parser > { > + public: > + // parse - Return true on error. > + bool parse(cl::Option &O, StringRef ArgName, StringRef ArgValue, > + std::vector &Val); > + }; Instead of handling this with command line options, how about adding a function attribute? That way the frontend can slap it on functions where it makes sense and manage the no_instrument_function attribute. However, backing up a little bit, I'm not sure I understand this from the GCC man page: "This instrumentation is also done for functions expanded inline in other functions." Does that mean that *all* source-level function (that don't have the no_instrument_function attribute) get instrumented, even if they get inlined etc? If so, then I think this entire thing can be handled in the Clang IR generation routines, not needing LLVM IR attributes and not needing an LLVM IR pass. What do you think? -Chris From stoklund at 2pi.dk Sat Jun 12 23:53:01 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Sat, 12 Jun 2010 21:53:01 -0700 Subject: [llvm-commits] [patch] Mostly mechanical removal of getPhysicalRegisterRegClass.patch In-Reply-To: References: Message-ID: <7F95D362-00B1-423E-87DD-50006E2E6C71@2pi.dk> On Jun 12, 2010, at 9:36 PM, Rafael Espindola wrote: >> The first bit is in isel, creating virtregs for copying to and from a physreg. These all use the VT argument, and you should preserve that. It makes a difference if XMM1 is spilled as FR32, FR64, or VR128. In these cases, the physreg doesn't actually need to belong to the chosen class, and an argument could be made for using TLI.getRegClassFor(VT) instead. We want a compatible regclass to allow coalescing, but if coalescing is not possible, we want the largest possible regclass. In any case, you want a regclass compatible with VT. > > I tested TLI.getRegClassFor a bit and found an interesting case: f80. > If I understand it correctly, the RST class is used after the > stackfier has run. Since getRegClassFor has no idea if that has > happened or not, it return a RFP80 and the backend get surprised by > the reappearance of a RFP80. TLI gets that directly from X86TargetLowering: addRegisterClass(MVT::f80, X86::RFP80RegisterClass); This should not be called after stackification, only during isel. Who calls getRegClassFor() so late? > This and your comment about wanting the largest available class, > suggest that the current function might actually be the correct one in > some places. We should be able to at least make it non virtual. getMaximalPhysRegClass(Reg, VT) is a possibility, but I think TLI.getRegClassFor(VT) fits. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 1929 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100612/35ec7616/attachment.bin From espindola at google.com Sat Jun 12 23:57:40 2010 From: espindola at google.com (Rafael Espindola) Date: Sun, 13 Jun 2010 00:57:40 -0400 Subject: [llvm-commits] [patch] Mostly mechanical removal of getPhysicalRegisterRegClass.patch In-Reply-To: <7F95D362-00B1-423E-87DD-50006E2E6C71@2pi.dk> References: <7F95D362-00B1-423E-87DD-50006E2E6C71@2pi.dk> Message-ID: > TLI gets that directly from X86TargetLowering: > > ? ?addRegisterClass(MVT::f80, X86::RFP80RegisterClass); > > This should not be called after stackification, only during isel. Who calls getRegClassFor() so late? > >> This and your comment about wanting the largest available class, >> suggest that the current function might actually be the correct one in >> some places. We should be able to at least make it non virtual. > > > getMaximalPhysRegClass(Reg, VT) is a possibility, but I think TLI.getRegClassFor(VT) fits. Are you suggesting I should change X86TargetLowering to register RST for f80? This will brake the register allocator, no? Cheers, -- Rafael ?vila de Esp?ndola From stoklund at 2pi.dk Sun Jun 13 00:15:14 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Sat, 12 Jun 2010 22:15:14 -0700 Subject: [llvm-commits] [patch] Mostly mechanical removal of getPhysicalRegisterRegClass.patch In-Reply-To: References: <7F95D362-00B1-423E-87DD-50006E2E6C71@2pi.dk> Message-ID: <65B26E19-F2E9-4CE2-88C1-857D994133DD@2pi.dk> On Jun 12, 2010, at 9:57 PM, Rafael Espindola wrote: >> TLI gets that directly from X86TargetLowering: >> >> addRegisterClass(MVT::f80, X86::RFP80RegisterClass); >> >> This should not be called after stackification, only during isel. Who calls getRegClassFor() so late? >> >>> This and your comment about wanting the largest available class, >>> suggest that the current function might actually be the correct one in >>> some places. We should be able to at least make it non virtual. >> >> >> getMaximalPhysRegClass(Reg, VT) is a possibility, but I think TLI.getRegClassFor(VT) fits. > > Are you suggesting I should change X86TargetLowering to register RST > for f80? This will brake the register allocator, no? No, don't do that. I am talking about the places where the instruction selector is dealing with a CopyFromReg. It needs to pick a register class for the virtual register, and it currently uses TRI->getPhysicalRegisterRegClass(SrcReg, VT). I am suggesting that TLI.getRegClassFor(VT) is a better fit than getMinimalPhysRegClass() in that case. You should definitely not be calling TLI.getRegClassFor(VT) after the FP stackifier has run. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 1929 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100612/d95a50ed/attachment.bin From blunted2night at gmail.com Sun Jun 13 04:13:57 2010 From: blunted2night at gmail.com (Nathan Jeffords) Date: Sun, 13 Jun 2010 02:13:57 -0700 Subject: [llvm-commits] [PATCH] Transforming assertions into OCaml exceptions In-Reply-To: <70B6D2F3-E365-4533-8D20-2B0FEBD20F1E@apple.com> References: <4C12BA20.4020006@mozilla.com> <70B6D2F3-E365-4533-8D20-2B0FEBD20F1E@apple.com> Message-ID: Assertions often detect problems after the state of the program becomes corrupted. Exceptions are generally assumed to occur prior an operation that may cause corruption such that the state of the system is known at whatever point the exception is handled. On Sat, Jun 12, 2010 at 9:43 PM, Chris Lattner wrote: > > On Jun 11, 2010, at 3:35 PM, Patrick Walton wrote: > > > Hi, > > > > This patch builds on the previous one > (llvm-pcwalton-configurable-assertions.diff) and transforms assertions into > exceptions in the OCaml bindings. > > I'm not sure this is the right way to go. Assertions should *never* > trigger, they are not a checked condition. Transforming them into an > exception is incorrect, because in certain build modes assertions are noops > (the checks are not compiled in). > > -Chris > > > _______________________________________________ > 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/20100613/89eca7b8/attachment.html From benny.kra at googlemail.com Sun Jun 13 07:52:38 2010 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Sun, 13 Jun 2010 12:52:38 -0000 Subject: [llvm-commits] [llvm] r105913 - /llvm/trunk/include/llvm/CodeGen/LiveInterval.h Message-ID: <20100613125238.6C6AC2A6C12C@llvm.org> Author: d0k Date: Sun Jun 13 07:52:38 2010 New Revision: 105913 URL: http://llvm.org/viewvc/llvm-project?rev=105913&view=rev Log: Let SmallVector take advantage of LiveRange's podness. Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=105913&r1=105912&r2=105913&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Sun Jun 13 07:52:38 2010 @@ -258,6 +258,8 @@ LiveRange(); // DO NOT IMPLEMENT }; + template <> struct isPodLike { static const bool value = true; }; + raw_ostream& operator<<(raw_ostream& os, const LiveRange &LR); From benny.kra at googlemail.com Sun Jun 13 09:35:54 2010 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Sun, 13 Jun 2010 14:35:54 -0000 Subject: [llvm-commits] [llvm] r105914 - /llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp Message-ID: <20100613143554.4166F2A6C12C@llvm.org> Author: d0k Date: Sun Jun 13 09:35:54 2010 New Revision: 105914 URL: http://llvm.org/viewvc/llvm-project?rev=105914&view=rev Log: SimplifyCFG: don't turn volatile stores to null/undef into unreachable. Fixes PR7369. 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=105914&r1=105913&r2=105914&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyCFGPass.cpp Sun Jun 13 09:35:54 2010 @@ -137,6 +137,9 @@ // they should be changed to unreachable by passes that can't modify the // CFG. if (StoreInst *SI = dyn_cast(BBI)) { + // Don't touch volatile stores. + if (SI->isVolatile()) continue; + Value *Ptr = SI->getOperand(1); if (isa(Ptr) || From benny.kra at googlemail.com Sun Jun 13 11:16:54 2010 From: benny.kra at googlemail.com (Benjamin Kramer) Date: Sun, 13 Jun 2010 16:16:54 -0000 Subject: [llvm-commits] [llvm] r105915 - /llvm/trunk/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll Message-ID: <20100613161654.2CEEE2A6C12C@llvm.org> Author: d0k Date: Sun Jun 13 11:16:54 2010 New Revision: 105915 URL: http://llvm.org/viewvc/llvm-project?rev=105915&view=rev Log: Test case for r105914. Modified: llvm/trunk/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll Modified: llvm/trunk/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll?rev=105915&r1=105914&r2=105915&view=diff ============================================================================== --- llvm/trunk/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll (original) +++ llvm/trunk/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll Sun Jun 13 11:16:54 2010 @@ -31,3 +31,14 @@ ; CHECK: call void @llvm.trap ; CHECK: unreachable } + +; PR7369 +define void @test3() nounwind { +entry: + volatile store i32 4, i32* null + ret void + +; CHECK: @test3 +; CHECK: volatile store i32 4, i32* null +; CHECK: ret +} From daniel at zuster.org Sun Jun 13 16:01:51 2010 From: daniel at zuster.org (Daniel Dunbar) Date: Sun, 13 Jun 2010 21:01:51 -0000 Subject: [llvm-commits] [zorg] r105924 - in /zorg/trunk/buildbot/klee: ./ master/ master/config/ master/public_html/ master/templates/ slave/ slave/info/ Message-ID: <20100613210151.73D542A6C12C@llvm.org> Author: ddunbar Date: Sun Jun 13 16:01:51 2010 New Revision: 105924 URL: http://llvm.org/viewvc/llvm-project?rev=105924&view=rev Log: buildbot: Sketch KLEE buildbot configuration. Added: zorg/trunk/buildbot/klee/ zorg/trunk/buildbot/klee/Config.py zorg/trunk/buildbot/klee/__init__.py zorg/trunk/buildbot/klee/master/ zorg/trunk/buildbot/klee/master/README.txt zorg/trunk/buildbot/klee/master/buildbot.tac zorg/trunk/buildbot/klee/master/config/ zorg/trunk/buildbot/klee/master/config/__init__.py zorg/trunk/buildbot/klee/master/config/builders.py zorg/trunk/buildbot/klee/master/config/slaves.py zorg/trunk/buildbot/klee/master/config/status.py zorg/trunk/buildbot/klee/master/master.cfg zorg/trunk/buildbot/klee/master/public_html/ zorg/trunk/buildbot/klee/master/public_html/bg_gradient.jpg (with props) zorg/trunk/buildbot/klee/master/public_html/buildbot.css zorg/trunk/buildbot/klee/master/public_html/default.css zorg/trunk/buildbot/klee/master/public_html/favicon.ico (with props) zorg/trunk/buildbot/klee/master/public_html/robots.txt zorg/trunk/buildbot/klee/master/templates/ zorg/trunk/buildbot/klee/master/templates/root.html zorg/trunk/buildbot/klee/slave/ zorg/trunk/buildbot/klee/slave/Makefile zorg/trunk/buildbot/klee/slave/buildbot.tac zorg/trunk/buildbot/klee/slave/info/ zorg/trunk/buildbot/klee/slave/info/admin zorg/trunk/buildbot/klee/slave/info/host zorg/trunk/buildbot/klee/slave/org.llvm.klee.slave.plist Added: zorg/trunk/buildbot/klee/Config.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/Config.py?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/Config.py (added) +++ zorg/trunk/buildbot/klee/Config.py Sun Jun 13 16:01:51 2010 @@ -0,0 +1,23 @@ +# Common configuration parameters (used by master and slaves). + +def getBuildmasterHost(): + return 'klee.minormatter.com' + +def getBuildmasterPort(): + return 9990 + +# Slave configuration parameters. + +def getBuildslaveName(): + raise NotImplementedError,'please update Config.py with the buildslave name' + +def getBuildslavePassword(): + raise NotImplementedError,'please update Config.py with the buildslave password' + +# Master configuration parameters. + +def getBuildbotName(): + return 'kleebb' + +def getBuildmasterWebPort(): + return 8010 Added: zorg/trunk/buildbot/klee/__init__.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/__init__.py?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/__init__.py (added) +++ zorg/trunk/buildbot/klee/__init__.py Sun Jun 13 16:01:51 2010 @@ -0,0 +1,5 @@ +"""Top level module for the KLEE buildbot.""" + +import Config + +__all__ = [Config] Added: zorg/trunk/buildbot/klee/master/README.txt URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/README.txt?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/master/README.txt (added) +++ zorg/trunk/buildbot/klee/master/README.txt Sun Jun 13 16:01:51 2010 @@ -0,0 +1,9 @@ +This directory contains the configuration for the KLEE buildbot. + +Most of the configuration is here, except for a few details on the +local configuration which are kept in config/local.cfg. Any sensitive +information should be placed in the local configuration file, not in +the public repository. + +For connecting SVN author names to emails, there is also a required +config/llvmauthors.cfg file which should provide the mapping. Added: zorg/trunk/buildbot/klee/master/buildbot.tac URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/buildbot.tac?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/master/buildbot.tac (added) +++ zorg/trunk/buildbot/klee/master/buildbot.tac Sun Jun 13 16:01:51 2010 @@ -0,0 +1,10 @@ +from twisted.application import service +from buildbot.master import BuildMaster +import os + +basedir = os.path.dirname(os.path.abspath(__file__)) +configfile = r'master.cfg' + +application = service.Application('buildmaster') +BuildMaster(basedir, configfile).setServiceParent(application) + Added: zorg/trunk/buildbot/klee/master/config/__init__.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/config/__init__.py?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/master/config/__init__.py (added) +++ zorg/trunk/buildbot/klee/master/config/__init__.py Sun Jun 13 16:01:51 2010 @@ -0,0 +1,9 @@ +import builders +import slaves +import status + +# Load local options. +import os +import ConfigParser +options = ConfigParser.RawConfigParser() +options.read(os.path.join(os.path.dirname(__file__), 'local.cfg')) Added: zorg/trunk/buildbot/klee/master/config/builders.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/config/builders.py?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/master/config/builders.py (added) +++ zorg/trunk/buildbot/klee/master/config/builders.py Sun Jun 13 16:01:51 2010 @@ -0,0 +1,16 @@ +from zorg.buildbot.builders import LLVMBuilder +reload(LLVMBuilder) +from zorg.buildbot.builders import LLVMBuilder + +def _get_linux_builders(): + return [ + {'name': "klee-x86_64-linux", + 'slavenames': ["klee.minormatter.com"], + 'builddir': "build.klee-x86_64-linux", + 'factory': LLVMBuilder.getLLVMBuildFactory("x86_64-pc-linux-gnu", jobs=2)}, + ] + +def get_builders(): + for b in _get_linux_builders(): + b['category'] = 'linux' + yield b Added: zorg/trunk/buildbot/klee/master/config/slaves.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/config/slaves.py?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/master/config/slaves.py (added) +++ zorg/trunk/buildbot/klee/master/config/slaves.py Sun Jun 13 16:01:51 2010 @@ -0,0 +1,13 @@ +import buildbot +import os + +import config + +def create_slave(name, *args, **kwargs): + password = config.options.get('Slave Passwords', name) + return buildbot.buildslave.BuildSlave(name, password=password, *args, **kwargs) + +def get_build_slaves(): + return [ + create_slave("klee.minormatter.com", properties={'jobs' : 2}, max_builds=1), + ] Added: zorg/trunk/buildbot/klee/master/config/status.py URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/config/status.py?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/master/config/status.py (added) +++ zorg/trunk/buildbot/klee/master/config/status.py Sun Jun 13 16:01:51 2010 @@ -0,0 +1,38 @@ +import os +import buildbot +import buildbot.status.html +import buildbot.status.mail +import buildbot.status.words + +import config +from zorg.buildbot.util.ConfigEmailLookup import ConfigEmailLookup + +from buildbot.status.web import auth, authz +authz_cfg=authz.Authz( + gracefulShutdown = False, + forceBuild = False, + forceAllBuilds = False, + pingBuilder = False, + stopBuild = False, + stopAllBuilds = False, + cancelPendingBuild = False, +) + +def get_status_targets(standard_builders): + default_email = config.options.get('Master Options', 'default_email') + return [ + buildbot.status.html.WebStatus( + http_port = 8010, authz=authz_cfg), + buildbot.status.mail.MailNotifier( + fromaddr = "klee-buildmaster at klee.minormatter.com", + extraRecipients = [default_email], + lookup = ConfigEmailLookup(os.path.join(os.path.dirname(__file__), + "llvmauthors.cfg"), + default_email), + mode = "problem", + builders = standard_builders), + buildbot.status.words.IRC( + host = "irc.oftc.net", nick = "kleebb", channels = ["#klee"], + allowForce = True, + notify_events = ['successToFailure', 'failureToSuccess']), + ] Added: zorg/trunk/buildbot/klee/master/master.cfg URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/master.cfg?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/master/master.cfg (added) +++ zorg/trunk/buildbot/klee/master/master.cfg Sun Jun 13 16:01:51 2010 @@ -0,0 +1,120 @@ +1# -*- python -*- +# ex: set syntax=python: + +# Extend paths to allow loading zorg and config modules. +import os, sys +path = os.path.join(os.environ.get('HOME'), 'zorg', 'buildbot', 'klee', 'master') +if path not in sys.path: + sys.path.append(path) +path = os.path.join(os.environ.get('HOME'), 'zorg') +if path not in sys.path: + sys.path.append(path) + +# This is the dictionary that the buildmaster pays attention to. We also use +# a shorter alias to save typing. +c = BuildmasterConfig = {} + +import config + +# Reload stuff automatically. +# +# FIXME: Find better way. +reload(config.slaves) +reload(config.builders) +reload(config.status) +reload(config) + +import config + +####### DB URL + +# This specifies what database buildbot uses to store change and scheduler +# state. +c['db_url'] = "sqlite:///state.sqlite" + +####### BUILDSLAVES + +c['slaves'] = config.slaves.get_build_slaves() +c['slavePortnum'] = 9990 + +####### CHANGESOURCES + +from buildbot.changes.svnpoller import SVNPoller +from buildbot.changes.pb import PBChangeSource + +import buildbot.changes.svnpoller + +class LLVMPoller(buildbot.changes.svnpoller.SVNPoller): + def __init__(self, project, pollinterval=120, histmax=10): + buildbot.changes.svnpoller.SVNPoller.__init__(self, + 'http://llvm.org/svn/llvm-project/%s' % project, + pollinterval=pollinterval, + histmax=histmax, + revlinktmpl='http://llvm.org/viewvc/llvm-project/?view=rev&revision=%s') +c['change_source'] = [PBChangeSource()] +if True: + c['change_source'].append(LLVMPoller("klee/trunk")) + +####### BUILDERS + +c['builders'] = builders = list(config.builders.get_builders()) + +####### STATUS TARGETS + +# Schedule builds and email for all non-experimental builders. +standard_builders = [b['name'] for b in builders + if not b['category'].endswith('.exp')] +c['status'] = config.status.get_status_targets(standard_builders) + +####### RESOURCE USAGE + +# Number of build records to maintain per builder. +c['buildHorizon'] = 1000 + +# Number of logs to maintain per builder. +c['logHorizon'] = 100 + +# Number of events (connect, disconnect, etc.) to maintain. +c['eventHorizon'] = 100 + +# Number of builds to cache in memory. +c['buildCacheSize'] = 1000 + +####### SCHEDULERS + +from buildbot.scheduler import Scheduler +c['schedulers'] = [Scheduler(name="all",branch=None, + treeStableTimer=2*60, + builderNames=standard_builders)] + +####### PROJECT IDENTITY + +c['projectName'] = "klee" +c['projectURL'] = "http://klee.llvm.org/" +c['buildbotURL'] = "http://klee.minormatter.com:8010/" + +####### DEBUGGING OPTIONS + +# If you set 'debugPassword', then you can connect to the buildmaster +# with the diagnostic tool in contrib/debugclient.py . From this tool, +# you can manually force builds and inject changes, which may be +# useful for testing your buildmaster without actually commiting +# changes to your repository (or before you have a functioning +# 'sources' set up). The debug tool uses the same port number as the +# slaves do: 'slavePortnum'. +c['debugPassword'] = config.options.get('Master Options', 'debug_password') + +# If you set 'manhole', you can ssh into the buildmaster and get an +# interactive python shell, which may be useful for debugging buildbot +# internals. It is probably only useful for buildbot developers. You +# can also use an authorized_keys file, or plain telnet. +if config.options.getboolean('Master Options', 'enable_manhole'): + from buildbot import manhole + c['manhole'] = manhole.PasswordManhole(config.options.get('Master Options', 'manhole_port'), + config.options.get('Master Options', 'manhole_user'), + config.options.get('Master Options', 'manhole_password')) + +# from buildbot.scheduler import Try_Userpass +# s = Try_Userpass("try", ["llvm-x86_64-linux"], port=8032, +# userpass=[("llvmpatch","patchtest")] ) +# c['schedulers'].append(s) Added: zorg/trunk/buildbot/klee/master/public_html/bg_gradient.jpg URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/public_html/bg_gradient.jpg?rev=105924&view=auto ============================================================================== Binary file - no diff available. Propchange: zorg/trunk/buildbot/klee/master/public_html/bg_gradient.jpg ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: zorg/trunk/buildbot/klee/master/public_html/buildbot.css URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/public_html/buildbot.css?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/master/public_html/buildbot.css (added) +++ zorg/trunk/buildbot/klee/master/public_html/buildbot.css Sun Jun 13 16:01:51 2010 @@ -0,0 +1,398 @@ +body { + margin-bottom:50px; +} + +body, td { + font-family: Verdana, Cursor; + font-size: 10px; + font-weight: bold; +} + +a:link,a:visited,a:active { + color: #444; +} + +a:hover { + color: #000000; +} + +table { + border-spacing: 1px 1px; +} + +table td { + padding: 3px 0px 3px 0px; + text-align: center; +} + +.Project { + width: 100px; +} + +.LastBuild, .Activity { + padding: 0 0 0 4px; +} + +.LastBuild, .Activity, .Builder, .BuildStep { + width: 155px; + max-width: 155px; +} + +td.Time { + color: #000; + border-bottom: 1px solid #aaa; + background-color: #eee; +} + +td.Activity, td.Change, td.Builder { + color: #333333; + background-color: #CCCCCC; +} + +td.Change { + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; +} +td.Event { + color: #777; + background-color: #ddd; + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; +} + +td.Activity { + border-top-left-radius: 10px; + -webkit-border-top-left-radius: 10px; + -moz-border-radius-topleft: 10px; + min-height: 20px; + padding: 2px 0 2px 0; +} + +td.idle, td.waiting, td.offline, td.building { + border-top-left-radius: 0px; + -webkit-border-top-left-radius: 0px; + -moz-border-radius-topleft: 0px; +} + +.LastBuild { + border-top-left-radius: 5px; + -webkit-border-top-left-radius: 5px; + -moz-border-radius-topleft: 5px; + border-top-right-radius: 5px; + -webkit-border-top-right-radius: 5px; + -moz-border-radius-topright: 5px; +} + +/* Console view styles */ + +td.DevRev { + padding: 4px 8px 4px 8px; + color: #333333; + border-top-left-radius: 5px; + -webkit-border-top-left-radius: 5px; + -moz-border-radius-topleft: 5px; + background-color: #eee; + width: 1%; +} + +td.DevRevCollapse { + border-bottom-left-radius: 5px; + -webkit-border-bottom-left-radius: 5px; + -moz-border-radius-bottomleft: 5px; +} + +td.DevName { + padding: 4px 8px 4px 8px; + color: #333333; + background-color: #eee; + width: 1%; + text-align: left; +} + +td.DevStatus { + padding: 4px 4px 4px 4px; + color: #333333; + background-color: #eee; +} + +td.DevSlave { + padding: 4px 4px 4px 4px; + color: #333333; + background-color: #eee; +} + +td.first { + border-top-left-radius: 5px; + -webkit-border-top-left-radius: 5px; + -moz-border-radius-topleft: 5px; +} + +td.last { + border-top-right-radius: 5px; + -webkit-border-top-right-radius: 5px; + -moz-border-radius-topright: 5px; +} + +td.DevStatusCategory { + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-width:1px; + border-style:solid; +} + +td.DevStatusCollapse { + border-bottom-right-radius: 5px; + -webkit-border-bottom-right-radius: 5px; + -moz-border-radius-bottomright: 5px; +} + +td.DevDetails { + font-weight: normal; + padding: 8px 8px 8px 8px; + color: #333333; + background-color: #eee; + text-align: left; +} + +td.DevComment { + font-weight: normal; + padding: 8px 8px 8px 8px; + color: #333333; + border-bottom-right-radius: 5px; + -webkit-border-bottom-right-radius: 5px; + -moz-border-radius-bottomright: 5px; + border-bottom-left-radius: 5px; + -webkit-border-bottom-left-radius: 5px; + -moz-border-radius-bottomleft: 5px; + background-color: #eee; + text-align: left; +} +.DevCommentDate { + float: right; + font-style: italic; +} + +td.Alt { + background-color: #CCCCCC; +} + +.legend { + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + width: 100px; + max-width: 100px; + text-align:center; + padding: 2px 2px 2px 2px; + height:14px; + white-space:nowrap; +} + +.DevStatusBox { + text-align:center; + height:20px; + padding:0 2px; + line-height:0; + white-space:nowrap; +} + +.DevStatusBox a { + opacity: 0.85; + border-width:1px; + border-style:solid; + border-radius: 4px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + display:block; + width:90%; + height:20px; + line-height:20px; + margin-left: auto; + margin-right: auto; +} + +.DevSlaveBox { + text-align:center; + height:10px; + padding:0 2px; + line-height:0; + white-space:nowrap; +} + +.DevSlaveBox a { + opacity: 0.85; + border-width:1px; + border-style:solid; + border-radius: 4px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + display:block; + width:90%; + height:10px; + line-height:20px; + margin-left: auto; + margin-right: auto; +} + +a.noround { + border-radius: 0px; + -webkit-border-radius: 0px; + -moz-border-radius: 0px; + position: relative; + margin-top: -8px; + margin-bottom: -8px; + height: 36px; + border-top-width: 0; + border-bottom-width: 0; +} + +a.begin { + border-top-width:1px; + position: relative; + margin-top: 0px; + margin-bottom: -7px; + height: 27px; + border-top-left-radius: 4px; + -webkit-border-top-left-radius: 4px; + -moz-border-radius-topleft: 4px; + border-top-right-radius: 4px; + -webkit-border-top-right-radius: 4px; + -moz-border-radius-topright: 4px; +} + +a.end { + border-bottom-width:1px; + position: relative; + margin-top: -7px; + margin-bottom: 0px; + height: 27px; + border-bottom-left-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -moz-border-radius-bottomleft: 4px; + border-bottom-right-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -moz-border-radius-bottomright: 4px; +} + +.center_align { + text-align: center; +} + +.right_align { + text-align: right; +} + +.left_align { + text-align: left; +} + +div.BuildWaterfall { + border-radius: 7px; + -webkit-border-radius: 7px; + -moz-border-radius: 7px; + position: absolute; + left: 0px; + top: 0px; + background-color: #FFFFFF; + padding: 4px 4px 4px 4px; + float: left; + display: none; + border-width: 1px; + border-style: solid; +} + +/* LastBuild, BuildStep states */ +.success { + color: #FFFFFF; + background-color: #8fdf5f; + border-color: #4F8530; +} +.success.Alt { + background-color: #6fbf3f; +} + +.failure { + color: #FFFFFF; + background-color: #e98080; + border-color: #A77272; +} +.failure.Alt { + background-color: #c96060; +} + +.warnings { + color: #FFFFFF; + background-color: #ffc343; + border-color: #C29D46; +} +.warnings.Alt { + background-color: #dfa323; +} + +.exception, td.offline { + color: #FFFFFF; + background-color: #e0b0ff; + border-color: #ACA0B3; +} +.exception.Alt { + background-color: #c090df; +} + +.start,.running, td.building { + color: #666666; + background-color: #fffc6c; + border-color: #C5C56D; +} + +.start { + border-bottom-left-radius: 10px; + -webkit-border-bottom-left-radius: 10px; + -moz-border-radius-bottomleft: 10px; + border-bottom-right-radius: 10px; + -webkit-border-bottom-right-radius: 10px; + -moz-border-radius-bottomright: 10px; +} + +.notstarted { + border-width:1px; + border-style:solid; + border-color:#aaa; +} + +td.Project a:hover, td.start a:hover { + color: #000; +} + +/* grid styles */ + +table.Grid { + border-collapse: collapse; +} + +table.Grid tr td { + padding: 0.2em; + margin: 0px; + text-align: center; +} + +table.Grid tr td.title { + font-size: 90%; + border-right: 1px gray solid; + border-bottom: 1px gray solid; +} + +table.Grid tr td.sourcestamp { + font-size: 90%; +} + +table.Grid tr td.builder { + text-align: right; + font-size: 90%; +} + +table.Grid tr td.build { + border: 1px gray solid; +} Added: zorg/trunk/buildbot/klee/master/public_html/default.css URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/public_html/default.css?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/master/public_html/default.css (added) +++ zorg/trunk/buildbot/klee/master/public_html/default.css Sun Jun 13 16:01:51 2010 @@ -0,0 +1,531 @@ +body.interface { + margin-left: 30px; + margin-right: 30px; + margin-top: 20px; + margin-bottom: 50px; + padding: 0; + background: url(bg_gradient.jpg) repeat-x; + font-family: Verdana, Cursor; + font-size: 10px; + font-weight: bold; + background-color: #fff; + color: #333; +} + +a:link,a:visited,a:active { + color: #444; +} + +table { + border-spacing: 1px 1px; +} + +table td { + padding: 3px 2px 3px 2px; + text-align: center; +} + +.Project { + min-width: 6em; +} + +.LastBuild,.Activity { + padding: 0 0 0 4px; +} + +.LastBuild,.Activity,.Builder,.BuildStep { + width: 15em; + min-width: 15em; +} + +/* Chromium Specific styles */ +div.BuildResultInfo { + color: #444; +} + +div.Announcement { + margin-bottom: 1em; +} + +div.Announcement>a:hover { + color: black; +} + +div.Announcement>div.Notice { + background-color: #afdaff; + padding: 0.5em; + font-size: 16px; + text-align: center; +} + +div.Announcement>div.Open { + border: 3px solid #8fdf5f; + padding: 0.5em; + font-size: 16px; + text-align: center; +} + +div.Announcement>div.Closed { + border: 5px solid #e98080; + padding: 0.5em; + font-size: 24px; + font-weight: bold; + text-align: center; +} + +td.Time { + color: #000; + border-bottom: 1px solid #aaa; + background-color: #eee; +} + +td.Activity,td.Change,td.Builder { + color: #333333; + background-color: #CCCCCC; +} + +td.Change { + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; +} + +td.Event { + color: #777; + background-color: #ddd; + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; +} + +td.Activity { + border-top-left-radius: 10px; + -webkit-border-top-left-radius: 10px; + -moz-border-radius-topleft: 10px; + min-height: 20px; + padding: 2px 0 2px 0; +} + +td.idle,td.waiting,td.offline,td.building { + border-top-left-radius: 0px; + -webkit-border-top-left-radius: 0px; + -moz-border-radius-topleft: 0px; +} + +.LastBuild { + border-top-left-radius: 5px; + -webkit-border-top-left-radius: 5px; + -moz-border-radius-topleft: 5px; + border-top-right-radius: 5px; + -webkit-border-top-right-radius: 5px; + -moz-border-radius-topright: 5px; +} + +/* Console view styles */ +td.DevRev { + padding: 4px 8px 4px 8px; + color: #333333; + border-top-left-radius: 5px; + -webkit-border-top-left-radius: 5px; + -moz-border-radius-topleft: 5px; + background-color: #eee; + width: 1%; +} + +td.DevRevCollapse { + border-bottom-left-radius: 5px; + -webkit-border-bottom-left-radius: 5px; + -moz-border-radius-bottomleft: 5px; +} + +td.DevName { + padding: 4px 8px 4px 8px; + color: #333333; + background-color: #eee; + width: 1%; + text-align: left; +} + +td.DevStatus { + padding: 4px 4px 4px 4px; + color: #333333; + background-color: #eee; +} + +td.DevSlave { + padding: 4px 4px 4px 4px; + color: #333333; + background-color: #eee; +} + +td.first { + border-top-left-radius: 5px; + -webkit-border-top-left-radius: 5px; + -moz-border-radius-topleft: 5px; +} + +td.last { + border-top-right-radius: 5px; + -webkit-border-top-right-radius: 5px; + -moz-border-radius-topright: 5px; +} + +td.DevStatusCategory { + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-width: 1px; + border-style: solid; +} + +td.DevStatusCollapse { + border-bottom-right-radius: 5px; + -webkit-border-bottom-right-radius: 5px; + -moz-border-radius-bottomright: 5px; +} + +td.DevDetails { + font-weight: normal; + padding: 8px 8px 8px 8px; + color: #333333; + background-color: #eee; + text-align: left; +} + +td.DevComment { + font-weight: normal; + padding: 8px 8px 8px 8px; + color: #333333; + border-bottom-right-radius: 5px; + -webkit-border-bottom-right-radius: 5px; + -moz-border-radius-bottomright: 5px; + border-bottom-left-radius: 5px; + -webkit-border-bottom-left-radius: 5px; + -moz-border-radius-bottomleft: 5px; + background-color: #eee; + text-align: left; +} + +td.Alt { + background-color: #ddd; +} + +.legend { + border-radius: 5px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + width: 100px; + max-width: 100px; + text-align: center; + padding: 2px 2px 2px 2px; + height: 14px; + white-space: nowrap; +} + +.DevStatusBox { + text-align: center; + height: 20px; + padding: 0 2px; + line-height: 0; + white-space: nowrap; +} + +.DevStatusBox a { + opacity: 0.85; + border-width: 1px; + border-style: solid; + border-radius: 4px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + display: block; + width: 90%; + height: 20px; + line-height: 20px; + margin-left: auto; + margin-right: auto; +} + +.DevSlaveBox { + text-align: center; + height: 10px; + padding: 0 2px; + line-height: 0; + white-space: nowrap; +} + +.DevSlaveBox a { + opacity: 0.85; + border-width: 1px; + border-style: solid; + border-radius: 4px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + display: block; + width: 90%; + height: 10px; + line-height: 20px; + margin-left: auto; + margin-right: auto; +} + +a.noround { + border-radius: 0px; + -webkit-border-radius: 0px; + -moz-border-radius: 0px; + position: relative; + margin-top: -8px; + margin-bottom: -8px; + height: 36px; + border-top-width: 0; + border-bottom-width: 0; +} + +a.begin { + border-top-width: 1px; + position: relative; + margin-top: 0px; + margin-bottom: -7px; + height: 27px; + border-top-left-radius: 4px; + -webkit-border-top-left-radius: 4px; + -moz-border-radius-topleft: 4px; + border-top-right-radius: 4px; + -webkit-border-top-right-radius: 4px; + -moz-border-radius-topright: 4px; +} + +a.end { + border-bottom-width: 1px; + position: relative; + margin-top: -7px; + margin-bottom: 0px; + height: 27px; + border-bottom-left-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -moz-border-radius-bottomleft: 4px; + border-bottom-right-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -moz-border-radius-bottomright: 4px; +} + +.center_align { + text-align: center; +} + +.right_align { + text-align: right; +} + +.left_align { + text-align: left; +} + +div.BuildWaterfall { + border-radius: 7px; + -webkit-border-radius: 7px; + -moz-border-radius: 7px; + position: absolute; + left: 0px; + top: 0px; + background-color: #FFFFFF; + padding: 4px 4px 4px 4px; + float: left; + display: none; + border-width: 1px; + border-style: solid; +} + +/* LastBuild, BuildStep states */ +.success { + color: #FFFFFF; + background-color: #8f8; + border-color: #4F8530; +} + +.failure { + color: #FFFFFF; + background-color: #f99; + border-color: #A77272; +} + +.warnings { + color: #FFFFFF; + background-color: #ffc343; + border-color: #C29D46; +} + +.exception { + color: #FFFFFF; + background-color: #f6f; + border-color: #ACA0B3; +} + +.start,.running,td.building { + color: #666666; + background-color: #ff6; + border-color: #C5C56D; +} + +.offline,td.offline { + color: #FFFFFF; + background-color: #777777; + border-color: #dddddd; +} + + +.start { + border-bottom-left-radius: 10px; + -webkit-border-bottom-left-radius: 10px; + -moz-border-radius-bottomleft: 10px; + border-bottom-right-radius: 10px; + -webkit-border-bottom-right-radius: 10px; + -moz-border-radius-bottomright: 10px; +} + +.notstarted { + border-width: 1px; + border-style: solid; + border-color: #aaa; + background-color: #fff; +} + +.closed { + background-color: #ff0000; +} + +.closed .large { + font-size: 1.5em; + font-weight: bolder; +} + +td.Project a:hover,td.start a:hover { + color: #000; +} + +.mini-box { + text-align: center; + height: 20px; + padding: 0 2px; + line-height: 0; + white-space: nowrap; +} + +.mini-box a { + border-radius: 0; + -webkit-border-radius: 0; + -moz-border-radius: 0; + display: block; + width: 100%; + height: 20px; + line-height: 20px; + margin-top: -30px; +} + +.mini-closed { + -box-sizing: border-box; + -webkit-box-sizing: border-box; + border: 4px solid red; +} + +/* grid styles */ +table.Grid { + border-collapse: collapse; +} + +table.Grid tr td { + padding: 0.2em; + margin: 0px; + text-align: center; +} + +table.Grid tr td.title { + font-size: 90%; + border-right: 1px gray solid; + border-bottom: 1px gray solid; +} + +table.Grid tr td.sourcestamp { + font-size: 90%; +} + +table.Grid tr td.builder { + text-align: right; + font-size: 90%; +} + +table.Grid tr td.build { + border: 1px gray solid; +} + +/* column container */ +div.column { + margin: 0 2em 2em 0; + float: left; +} + +/* info tables */ +table.info { + border-spacing: 1px; +} + +table.info td { + padding: 0.1em 1em 0.1em 1em; + text-align: center; +} + +table.info th { + padding: 0.2em 1.5em 0.2em 1.5em; + text-align: center; +} + +table.info td.left { + text-align: left +} + +.alt { + background-color: #f6f6f6; +} + +li { + padding: 0.1em 1em 0.1em 1em; +} + +.result { + padding: 0.3em 1em 0.3em 1em; +} + +/* log view */ +.log * { + vlink: #800080; + font-family: "Courier New", courier, monotype; +} + +span.stdout { + color: black; +} + +span.stderr { + color: red; +} + +span.header { + color: blue; +} + +/* revision & email */ +.revision .full { + display: none; +} + +.user .email { + display: none; +} + +/* change comments (use regular colors here) */ +pre.comments>a:link,pre.comments>a:visited { + color: blue; +} + +pre.comments>a:active { + color: purple; +} Added: zorg/trunk/buildbot/klee/master/public_html/favicon.ico URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/public_html/favicon.ico?rev=105924&view=auto ============================================================================== Binary file - no diff available. Propchange: zorg/trunk/buildbot/klee/master/public_html/favicon.ico ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: zorg/trunk/buildbot/klee/master/public_html/robots.txt URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/public_html/robots.txt?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/master/public_html/robots.txt (added) +++ zorg/trunk/buildbot/klee/master/public_html/robots.txt Sun Jun 13 16:01:51 2010 @@ -0,0 +1,11 @@ +User-agent: * +Disallow: /waterfall +Disallow: /builders +Disallow: /changes +Disallow: /buildslaves +Disallow: /schedulers +Disallow: /one_line_per_build +Disallow: /builders +Disallow: /xmlrpc +Disallow: /grid +Disallow: /tgrid Added: zorg/trunk/buildbot/klee/master/templates/root.html URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/master/templates/root.html?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/master/templates/root.html (added) +++ zorg/trunk/buildbot/klee/master/templates/root.html Sun Jun 13 16:01:51 2010 @@ -0,0 +1,35 @@ + + + + +Welcome to the Buildbot + + + + +

      Welcome to the Buildbot!

      + +Recent Buildbot Activity: + + +Build Lists: + + +Buildbot Information: + + + + Added: zorg/trunk/buildbot/klee/slave/Makefile URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/slave/Makefile?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/slave/Makefile (added) +++ zorg/trunk/buildbot/klee/slave/Makefile Sun Jun 13 16:01:51 2010 @@ -0,0 +1,32 @@ +# -*- makefile -*- + +# This is a simple makefile which lives in a buildmaster/buildslave +# directory (next to the buildbot.tac file). It allows you to start/stop the +# master or slave in a launchd-friendly way by doing 'make start' or 'make stop' +# and includes some other targets for convenience. + +start: + launchctl start org.llvm.klee.slave + +start-standalone: + /usr/bin/twistd \ + --nodaemon \ + --python=buildbot.tac \ + --logfile=twistd.log \ + --prefix=klee + +# This stops the buildbot cleanly so launchd will not restart it, use +# 'make start' to restart it correctly via launchctl +stop: + buildbot stop . + +restart: stop start + +# Reloads the master.cfg and associated files. +sighup: + buildbot sighup . + +reconfig: sighup + +checkconfig: + buildbot checkconfig Added: zorg/trunk/buildbot/klee/slave/buildbot.tac URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/slave/buildbot.tac?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/slave/buildbot.tac (added) +++ zorg/trunk/buildbot/klee/slave/buildbot.tac Sun Jun 13 16:01:51 2010 @@ -0,0 +1,26 @@ +# -*- Python -*- + +from twisted.application import service +from buildbot.slave.bot import BuildSlave +import os, sys + +basedir = os.path.dirname(os.path.abspath(__file__)) + +# Allow finding klee module. +sys.path.append(os.path.join(basedir, "../..")) + +# Import klee to get configuration info. +import klee + +buildmaster_host = klee.Config.getBuildmasterHost() +port = klee.Config.getBuildmasterPort() +slavename = klee.Config.getBuildslaveName() +passwd = klee.Config.getBuildslavePassword() +keepalive = 600 +usepty = 1 +umask = None + +application = service.Application('buildslave') +s = BuildSlave(buildmaster_host, port, slavename, passwd, basedir, + keepalive, usepty, umask=umask) +s.setServiceParent(application) Added: zorg/trunk/buildbot/klee/slave/info/admin URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/slave/info/admin?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/slave/info/admin (added) +++ zorg/trunk/buildbot/klee/slave/info/admin Sun Jun 13 16:01:51 2010 @@ -0,0 +1 @@ +KLEE Buildslave Added: zorg/trunk/buildbot/klee/slave/info/host URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/slave/info/host?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/slave/info/host (added) +++ zorg/trunk/buildbot/klee/slave/info/host Sun Jun 13 16:01:51 2010 @@ -0,0 +1 @@ +INSERT YOUR HOST INFORMATION HERE Added: zorg/trunk/buildbot/klee/slave/org.llvm.klee.slave.plist URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/buildbot/klee/slave/org.llvm.klee.slave.plist?rev=105924&view=auto ============================================================================== --- zorg/trunk/buildbot/klee/slave/org.llvm.klee.slave.plist (added) +++ zorg/trunk/buildbot/klee/slave/org.llvm.klee.slave.plist Sun Jun 13 16:01:51 2010 @@ -0,0 +1,44 @@ + + + + + Label + org.llvm.klee.slave + + + UserName + buildslave + + + WorkingDirectory + /Users/buildslave/zorg/buildbot/klee/slave + + ProgramArguments + + /usr/bin/twistd + --nodaemon + --python=buildbot.tac + --logfile=twistd.log + --prefix=klee + + + KeepAlive + + SuccessfulExit + + + + RunAtLoad + + + + NumberOfFiles + 1024 + + HardResourceLimits + + NumberOfFiles + 1024 + + + From stoklund at 2pi.dk Sun Jun 13 19:31:56 2010 From: stoklund at 2pi.dk (Jakob Stoklund Olesen) Date: Sun, 13 Jun 2010 17:31:56 -0700 Subject: [llvm-commits] [patch] Mostly mechanical removal of getPhysicalRegisterRegClass.patch In-Reply-To: References: Message-ID: On Jun 12, 2010, at 9:36 PM, Rafael Espindola wrote: >> The first bit is in isel, creating virtregs for copying to and from a physreg. These all use the VT argument, and you should preserve that. It makes a difference if XMM1 is spilled as FR32, FR64, or VR128. In these cases, the physreg doesn't actually need to belong to the chosen class, and an argument could be made for using TLI.getRegClassFor(VT) instead. We want a compatible regclass to allow coalescing, but if coalescing is not possible, we want the largest possible regclass. In any case, you want a regclass compatible with VT. > > I tested TLI.getRegClassFor a bit and found an interesting case: f80. > If I understand it correctly, the RST class is used after the > stackfier has run. Since getRegClassFor has no idea if that has > happened or not, it return a RFP80 and the backend get surprised by > the reappearance of a RFP80. > > This and your comment about wanting the largest available class, > suggest that the current function might actually be the correct one in > some places. We should be able to at least make it non virtual. I think I was confused. I have taken a closer look at InstrEmitter.cpp now. In EmitCopyFromReg(), getPhysicalRegisterRegClass() is only used to provide an argument for copyRegToReg(), and TLI->getRegClassFor(VT) is already used to create the virtual register. That is fine as is. It is safe to replace getPhysicalRegisterRegClass with getMinimalPhysRegClass there. The same goes for the uses in ScheduleDAG*.cpp /jakob -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 1929 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20100613/8b46db06/attachment.bin From nelhage at nelhage.com Sun Jun 13 17:30:35 2010 From: nelhage at nelhage.com (Nelson Elhage) Date: Sun, 13 Jun 2010 18:30:35 -0400 Subject: [llvm-commits] [patch] Implement a pass to instrument function entry and exit In-Reply-To: <7E610534-74CD-4454-8494-3E49CC0EC7A9@apple.com> References: <87zkz9q6ta.fsf@mit.edu> <7E610534-74CD-4454-8494-3E49CC0EC7A9@apple.com> Message-ID: <87wru2k1kk.fsf@mit.edu> On Sat, 12 Jun 2010 21:51:54 -0700, Chris Lattner wrote: > > Nice, adding -finstrument-functions support would be great. > > Meta comment: please include your patch as an attachment. If you're using Thunderbird, please follow these instructions: > http://llvm.org/docs/DeveloperPolicy.html#patches > > This makes it easier to apply. Sorry about that, will fix in the future. > > > +//===----------------------------------------------------------------------===// > > +// > > +// This pass inserts instrumentation calls for entry and exit to > > +// functions. After function entry and before exit, calls are inserted > > +// to the following instrumentation functions: > > +// > > +// void __cyg_profile_func_enter (void *this_fn, > > +// void *call_site); > > +// void __cyg_profile_func_exit (void *this_fn, > > +// void *call_site); > > +// > > +//===----------------------------------------------------------------------===// > > + > > +#define DEBUG_TYPE "instrument-functions" > > +#include "llvm/CodeGen/Passes.h" > > This should be added to the scalar passes. Ok. I realized after sending that CodeGen was probably the wrong place, but wasn't sure where it should go. I'll move it if we decide to go foward with the LLVM pass approach. > > > +namespace { > > + class CommaSeparatedStringParser : > > + public cl::basic_parser > { > > + public: > > + // parse - Return true on error. > > + bool parse(cl::Option &O, StringRef ArgName, StringRef ArgValue, > > + std::vector &Val); > > + }; > > Instead of handling this with command line options, how about adding a > function attribute? That way the frontend can slap it on functions > where it makes sense and manage the no_instrument_function attribute. My intent was to have both the attribute and the command-line options; These options would be used to implement -finstrument-functions-exclude-{file,function}-list in the frontend. But I can push those into clang and have it turn them into attributes, if you think that's more appropriate. > > However, backing up a little bit, I'm not sure I understand this from the GCC man page: > > "This instrumentation is also done for functions expanded inline in other functions." > > Does that mean that *all* source-level function (that don't have the > no_instrument_function attribute) get instrumented, even if they get > inlined etc? That's correct. (As of GCC 4, there is a complication, which is that as of GCC 4, inlined functions call __cyg_profile_* with the address and caller of the function _they were inlined into_, instead of passing the address of the non-inlined version of the function. (See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23296). I'm not sure whether we want to duplicate the GCC behavior, which I and at least two others find confusing (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28205), or do something else. But in any case, yes, all source-level functions get instrumented). > > If so, then I think this entire thing can be handled in the Clang IR > generation routines, not needing LLVM IR attributes and not needing an > LLVM IR pass. > > What do you think? What do you see as the advantage to handling this from clang, instead of as an LLVM IR pass? My intuition would be that making this an IR pass is desirable because you might want to instrument code generated by something other than clang, but I don't yet have a strong feel for the overall architecture and where the clang/LLVM split is. - Nelson > > -Chris > >