From reid at x10sys.com Mon Jul 3 11:46:29 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 3 Jul 2006 11:46:29 -0500 Subject: [llvm-commits] CVS: llvm/tools/gccas/gccas.cpp Message-ID: <200607031646.LAA10222@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccas: gccas.cpp updated: 1.116 -> 1.117 --- Log message: Split long comment lines. --- Diffs of the changes: (+4 -6) gccas.cpp | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) Index: llvm/tools/gccas/gccas.cpp diff -u llvm/tools/gccas/gccas.cpp:1.116 llvm/tools/gccas/gccas.cpp:1.117 --- llvm/tools/gccas/gccas.cpp:1.116 Fri Jun 16 13:23:48 2006 +++ llvm/tools/gccas/gccas.cpp Mon Jul 3 11:46:03 2006 @@ -186,17 +186,15 @@ return 1; } - // In addition to just parsing the input from GCC, we also want to spiff it up - // a little bit. Do this now. - // + // In addition to just parsing the input from GCC, we also want to spiff + // it up a little bit. Do this now. PassManager Passes; // Add an appropriate TargetData instance for this module... Passes.add(new TargetData(M.get())); - // Add all of the transformation passes to the pass manager to do the cleanup - // and optimization of the GCC output. - // + // Add all of the transformation passes to the pass manager to do the + // cleanup and optimization of the GCC output. AddConfiguredTransformationPasses(Passes); // Make sure everything is still good. From alenhar2 at cs.uiuc.edu Mon Jul 3 12:57:47 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 3 Jul 2006 12:57:47 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Message-ID: <200607031757.MAA10643@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaAsmPrinter.cpp updated: 1.45 -> 1.46 --- Log message: 0 offsets for memory operands --- Diffs of the changes: (+2 -0) AlphaAsmPrinter.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.45 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.46 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.45 Wed Jun 21 10:42:36 2006 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Mon Jul 3 12:57:34 2006 @@ -288,6 +288,8 @@ const char *ExtraCode) { if (ExtraCode && ExtraCode[0]) return true; // Unknown modifier. + O << "0("; printOperand(MI, OpNo); + O << ")"; return false; } From alenhar2 at cs.uiuc.edu Mon Jul 3 13:00:54 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 3 Jul 2006 13:00:54 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelLowering.cpp Message-ID: <200607031800.NAA04869@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelLowering.cpp updated: 1.55 -> 1.56 --- Log message: These are already implemented --- Diffs of the changes: (+0 -4) AlphaISelLowering.cpp | 4 ---- 1 files changed, 4 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelLowering.cpp diff -u llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.55 llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.56 --- llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.55 Tue Jun 27 18:19:14 2006 +++ llvm/lib/Target/Alpha/AlphaISelLowering.cpp Mon Jul 3 13:00:29 2006 @@ -101,10 +101,6 @@ setOperationAction(ISD::FSQRT, MVT::f64, Expand); setOperationAction(ISD::FSQRT, MVT::f32, Expand); - // FIXME: Alpha supports fcopysign natively!? - setOperationAction(ISD::FCOPYSIGN, MVT::f64, Expand); - setOperationAction(ISD::FCOPYSIGN, MVT::f32, Expand); - setOperationAction(ISD::SETCC, MVT::f32, Promote); // We don't have line number support yet. From alenhar2 at cs.uiuc.edu Mon Jul 3 17:46:26 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 3 Jul 2006 17:46:26 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll Message-ID: <200607032246.RAA22362@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Alpha: 2006-07-03-ASMFormalLowering.ll added (r1.1) --- Log message: Legalize does not handle this correctly --- Diffs of the changes: (+21 -0) 2006-07-03-ASMFormalLowering.ll | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+) Index: llvm/test/Regression/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll diff -c /dev/null llvm/test/Regression/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll:1.1 *** /dev/null Mon Jul 3 17:46:12 2006 --- llvm/test/Regression/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll Mon Jul 3 17:46:02 2006 *************** *** 0 **** --- 1,21 ---- + ;RUN: llvm-as < %s | llc -march=alpha + + ; ModuleID = 'atomicity.cc' + target endian = little + target pointersize = 64 + target triple = "alphaev67-unknown-linux-gnu" + + implementation ; Functions: + + int %_ZN9__gnu_cxx18__exchange_and_addEPVii(int* %__mem, int %__val) { + entry: + %__tmp = alloca int, align 4 ; [#uses=1] + %tmp3 = call int asm sideeffect "\0A$$Lxadd_0:\0A\09ldl_l $0,$3\0A\09addl $0,$4,$1\0A\09stl_c $1,$2\0A\09beq $1,$$Lxadd_0\0A\09mb", "=&r,==&r,==m,m,r"( int* %__tmp, int* %__mem, int* %__mem, int %__val ) ; [#uses=1] + ret int %tmp3 + } + + void %_ZN9__gnu_cxx12__atomic_addEPVii(int* %__mem, int %__val) { + entry: + %tmp2 = call int asm sideeffect "\0A$$Ladd_1:\0A\09ldl_l $0,$2\0A\09addl $0,$3,$0\0A\09stl_c $0,$1\0A\09beq $0,$$Ladd_1\0A\09mb", "=&r,==m,m,r"( int* %__mem, int* %__mem, int %__val ) ; [#uses=0] + ret void + } From evan.cheng at apple.com Wed Jul 5 02:09:25 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 5 Jul 2006 02:09:25 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86JITInfo.cpp Message-ID: <200607050709.CAA04655@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86JITInfo.cpp updated: 1.22 -> 1.23 --- Log message: Fix JIT on non MacOS X i386 systems. --- Diffs of the changes: (+0 -4) X86JITInfo.cpp | 4 ---- 1 files changed, 4 deletions(-) Index: llvm/lib/Target/X86/X86JITInfo.cpp diff -u llvm/lib/Target/X86/X86JITInfo.cpp:1.22 llvm/lib/Target/X86/X86JITInfo.cpp:1.23 --- llvm/lib/Target/X86/X86JITInfo.cpp:1.22 Wed Jun 28 20:48:36 2006 +++ llvm/lib/Target/X86/X86JITInfo.cpp Wed Jul 5 02:09:13 2006 @@ -73,13 +73,9 @@ #else "call X86CompilationCallback2\n" #endif -#if defined(__APPLE__) "movl %ebp, %esp\n" // Restore ESP -#endif #if FASTCC_NUM_INT_ARGS_INREGS > 0 -#if defined(__APPLE__) "subl $8, %esp\n" -#endif "popl %edx\n" "popl %eax\n" #endif From pjenkins at apple.com Wed Jul 5 15:17:38 2006 From: pjenkins at apple.com (Patrick Jenkins) Date: Wed, 5 Jul 2006 15:17:38 -0500 Subject: [llvm-commits] CVS: llvm/CREDITS.TXT Message-ID: <200607052017.PAA03602@zion.cs.uiuc.edu> Changes in directory llvm: CREDITS.TXT updated: 1.56 -> 1.57 --- Log message: Adding Patrick Jenkins' information to CREDITS.TXT --- Diffs of the changes: (+4 -0) CREDITS.TXT | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/CREDITS.TXT diff -u llvm/CREDITS.TXT:1.56 llvm/CREDITS.TXT:1.57 --- llvm/CREDITS.TXT:1.56 Wed Jun 28 23:21:59 2006 +++ llvm/CREDITS.TXT Wed Jul 5 15:17:26 2006 @@ -163,3 +163,7 @@ N: Bill Wendling E: wendling at isanbard.org D: The `Lower Setjmp/Longjmp' pass, improvements to the -lowerswitch pass. + +N: Patrick Jenkins +E: patjenk at wam.umd.edu +D: Nightly Tester From evan.cheng at apple.com Wed Jul 5 15:46:39 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 5 Jul 2006 15:46:39 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/vec_zero.ll Message-ID: <200607052046.PAA03942@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: vec_zero.ll updated: 1.2 -> 1.3 --- Log message: Update test case. --- Diffs of the changes: (+1 -2) vec_zero.ll | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/test/Regression/CodeGen/X86/vec_zero.ll diff -u llvm/test/Regression/CodeGen/X86/vec_zero.ll:1.2 llvm/test/Regression/CodeGen/X86/vec_zero.ll:1.3 --- llvm/test/Regression/CodeGen/X86/vec_zero.ll:1.2 Thu Apr 20 23:58:23 2006 +++ llvm/test/Regression/CodeGen/X86/vec_zero.ll Wed Jul 5 15:46:27 2006 @@ -1,5 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep xorps && -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pxor +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep xorps | wc -l | grep 2 void %foo(<4 x float> *%P) { %T = load <4 x float> * %P From evan.cheng at apple.com Wed Jul 5 17:18:04 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 5 Jul 2006 17:18:04 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200607052218.RAA14449@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.231 -> 1.232 --- Log message: Reorg. No functionality change. --- Diffs of the changes: (+195 -183) X86ISelLowering.cpp | 378 ++++++++++++++++++++++++++-------------------------- 1 files changed, 195 insertions(+), 183 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.231 llvm/lib/Target/X86/X86ISelLowering.cpp:1.232 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.231 Sat Jun 24 03:36:10 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Jul 5 17:17:51 2006 @@ -1394,139 +1394,6 @@ } } -MachineBasicBlock * -X86TargetLowering::InsertAtEndOfBasicBlock(MachineInstr *MI, - MachineBasicBlock *BB) { - switch (MI->getOpcode()) { - default: assert(false && "Unexpected instr type to insert"); - case X86::CMOV_FR32: - case X86::CMOV_FR64: - case X86::CMOV_V4F32: - case X86::CMOV_V2F64: - case X86::CMOV_V2I64: { - // To "insert" a SELECT_CC instruction, we actually have to insert the - // diamond control-flow pattern. The incoming instruction knows the - // destination vreg to set, the condition code register to branch on, the - // true/false values to select between, and a branch opcode to use. - const BasicBlock *LLVM_BB = BB->getBasicBlock(); - ilist::iterator It = BB; - ++It; - - // thisMBB: - // ... - // TrueVal = ... - // cmpTY ccX, r1, r2 - // bCC copy1MBB - // fallthrough --> copy0MBB - MachineBasicBlock *thisMBB = BB; - MachineBasicBlock *copy0MBB = new MachineBasicBlock(LLVM_BB); - MachineBasicBlock *sinkMBB = new MachineBasicBlock(LLVM_BB); - unsigned Opc = getCondBrOpcodeForX86CC(MI->getOperand(3).getImmedValue()); - BuildMI(BB, Opc, 1).addMBB(sinkMBB); - MachineFunction *F = BB->getParent(); - F->getBasicBlockList().insert(It, copy0MBB); - F->getBasicBlockList().insert(It, sinkMBB); - // Update machine-CFG edges by first adding all successors of the current - // block to the new block which will contain the Phi node for the select. - for(MachineBasicBlock::succ_iterator i = BB->succ_begin(), - e = BB->succ_end(); i != e; ++i) - sinkMBB->addSuccessor(*i); - // Next, remove all successors of the current block, and add the true - // and fallthrough blocks as its successors. - while(!BB->succ_empty()) - BB->removeSuccessor(BB->succ_begin()); - BB->addSuccessor(copy0MBB); - BB->addSuccessor(sinkMBB); - - // copy0MBB: - // %FalseValue = ... - // # fallthrough to sinkMBB - BB = copy0MBB; - - // Update machine-CFG edges - BB->addSuccessor(sinkMBB); - - // sinkMBB: - // %Result = phi [ %FalseValue, copy0MBB ], [ %TrueValue, thisMBB ] - // ... - BB = sinkMBB; - BuildMI(BB, X86::PHI, 4, MI->getOperand(0).getReg()) - .addReg(MI->getOperand(1).getReg()).addMBB(copy0MBB) - .addReg(MI->getOperand(2).getReg()).addMBB(thisMBB); - - delete MI; // The pseudo instruction is gone now. - return BB; - } - - case X86::FP_TO_INT16_IN_MEM: - case X86::FP_TO_INT32_IN_MEM: - case X86::FP_TO_INT64_IN_MEM: { - // Change the floating point control register to use "round towards zero" - // mode when truncating to an integer value. - MachineFunction *F = BB->getParent(); - int CWFrameIdx = F->getFrameInfo()->CreateStackObject(2, 2); - addFrameReference(BuildMI(BB, X86::FNSTCW16m, 4), CWFrameIdx); - - // Load the old value of the high byte of the control word... - unsigned OldCW = - F->getSSARegMap()->createVirtualRegister(X86::GR16RegisterClass); - addFrameReference(BuildMI(BB, X86::MOV16rm, 4, OldCW), CWFrameIdx); - - // Set the high part to be round to zero... - addFrameReference(BuildMI(BB, X86::MOV16mi, 5), CWFrameIdx).addImm(0xC7F); - - // Reload the modified control word now... - addFrameReference(BuildMI(BB, X86::FLDCW16m, 4), CWFrameIdx); - - // Restore the memory image of control word to original value - addFrameReference(BuildMI(BB, X86::MOV16mr, 5), CWFrameIdx).addReg(OldCW); - - // Get the X86 opcode to use. - unsigned Opc; - switch (MI->getOpcode()) { - default: assert(0 && "illegal opcode!"); - case X86::FP_TO_INT16_IN_MEM: Opc = X86::FpIST16m; break; - case X86::FP_TO_INT32_IN_MEM: Opc = X86::FpIST32m; break; - case X86::FP_TO_INT64_IN_MEM: Opc = X86::FpIST64m; break; - } - - X86AddressMode AM; - MachineOperand &Op = MI->getOperand(0); - if (Op.isRegister()) { - AM.BaseType = X86AddressMode::RegBase; - AM.Base.Reg = Op.getReg(); - } else { - AM.BaseType = X86AddressMode::FrameIndexBase; - AM.Base.FrameIndex = Op.getFrameIndex(); - } - Op = MI->getOperand(1); - if (Op.isImmediate()) - AM.Scale = Op.getImmedValue(); - Op = MI->getOperand(2); - if (Op.isImmediate()) - AM.IndexReg = Op.getImmedValue(); - Op = MI->getOperand(3); - if (Op.isGlobalAddress()) { - AM.GV = Op.getGlobal(); - } else { - AM.Disp = Op.getImmedValue(); - } - addFullAddress(BuildMI(BB, Opc, 5), AM).addReg(MI->getOperand(4).getReg()); - - // Reload the original control word now. - addFrameReference(BuildMI(BB, X86::FLDCW16m, 4), CWFrameIdx); - - delete MI; // The pseudo instruction is gone now. - return BB; - } - } -} - - -//===----------------------------------------------------------------------===// -// X86 Custom Lowering Hooks -//===----------------------------------------------------------------------===// - /// DarwinGVRequiresExtraLoad - true if accessing the GV requires an extra /// load. For Darwin, external and weak symbols are indirect, loading the value /// at address GV rather then the value of GV itself. This means that the @@ -3892,6 +3759,197 @@ } } +/// isLegalAddressImmediate - Return true if the integer value or +/// GlobalValue can be used as the offset of the target addressing mode. +bool X86TargetLowering::isLegalAddressImmediate(int64_t V) const { + // X86 allows a sign-extended 32-bit immediate field. + return (V > -(1LL << 32) && V < (1LL << 32)-1); +} + +bool X86TargetLowering::isLegalAddressImmediate(GlobalValue *GV) const { + // GV is 64-bit but displacement field is 32-bit unless we are in small code + // model. Mac OS X happens to support only small PIC code model. + // FIXME: better support for other OS's. + if (Subtarget->is64Bit() && !Subtarget->isTargetDarwin()) + return false; + if (Subtarget->isTargetDarwin()) { + Reloc::Model RModel = getTargetMachine().getRelocationModel(); + if (RModel == Reloc::Static) + return true; + else if (RModel == Reloc::DynamicNoPIC) + return !DarwinGVRequiresExtraLoad(GV); + else + return false; + } else + return true; +} + +/// isShuffleMaskLegal - Targets can use this to indicate that they only +/// support *some* VECTOR_SHUFFLE operations, those with specific masks. +/// By default, if a target supports the VECTOR_SHUFFLE node, all mask values +/// are assumed to be legal. +bool +X86TargetLowering::isShuffleMaskLegal(SDOperand Mask, MVT::ValueType VT) const { + // Only do shuffles on 128-bit vector types for now. + if (MVT::getSizeInBits(VT) == 64) return false; + return (Mask.Val->getNumOperands() <= 4 || + isSplatMask(Mask.Val) || + isPSHUFHW_PSHUFLWMask(Mask.Val) || + X86::isUNPCKLMask(Mask.Val) || + X86::isUNPCKL_v_undef_Mask(Mask.Val) || + X86::isUNPCKHMask(Mask.Val)); +} + +bool X86TargetLowering::isVectorClearMaskLegal(std::vector &BVOps, + MVT::ValueType EVT, + SelectionDAG &DAG) const { + unsigned NumElts = BVOps.size(); + // Only do shuffles on 128-bit vector types for now. + if (MVT::getSizeInBits(EVT) * NumElts == 64) return false; + if (NumElts == 2) return true; + if (NumElts == 4) { + return (isMOVLMask(BVOps) || isCommutedMOVL(BVOps, true) || + isSHUFPMask(BVOps) || isCommutedSHUFP(BVOps)); + } + return false; +} + +//===----------------------------------------------------------------------===// +// X86 Scheduler Hooks +//===----------------------------------------------------------------------===// + +MachineBasicBlock * +X86TargetLowering::InsertAtEndOfBasicBlock(MachineInstr *MI, + MachineBasicBlock *BB) { + switch (MI->getOpcode()) { + default: assert(false && "Unexpected instr type to insert"); + case X86::CMOV_FR32: + case X86::CMOV_FR64: + case X86::CMOV_V4F32: + case X86::CMOV_V2F64: + case X86::CMOV_V2I64: { + // To "insert" a SELECT_CC instruction, we actually have to insert the + // diamond control-flow pattern. The incoming instruction knows the + // destination vreg to set, the condition code register to branch on, the + // true/false values to select between, and a branch opcode to use. + const BasicBlock *LLVM_BB = BB->getBasicBlock(); + ilist::iterator It = BB; + ++It; + + // thisMBB: + // ... + // TrueVal = ... + // cmpTY ccX, r1, r2 + // bCC copy1MBB + // fallthrough --> copy0MBB + MachineBasicBlock *thisMBB = BB; + MachineBasicBlock *copy0MBB = new MachineBasicBlock(LLVM_BB); + MachineBasicBlock *sinkMBB = new MachineBasicBlock(LLVM_BB); + unsigned Opc = getCondBrOpcodeForX86CC(MI->getOperand(3).getImmedValue()); + BuildMI(BB, Opc, 1).addMBB(sinkMBB); + MachineFunction *F = BB->getParent(); + F->getBasicBlockList().insert(It, copy0MBB); + F->getBasicBlockList().insert(It, sinkMBB); + // Update machine-CFG edges by first adding all successors of the current + // block to the new block which will contain the Phi node for the select. + for(MachineBasicBlock::succ_iterator i = BB->succ_begin(), + e = BB->succ_end(); i != e; ++i) + sinkMBB->addSuccessor(*i); + // Next, remove all successors of the current block, and add the true + // and fallthrough blocks as its successors. + while(!BB->succ_empty()) + BB->removeSuccessor(BB->succ_begin()); + BB->addSuccessor(copy0MBB); + BB->addSuccessor(sinkMBB); + + // copy0MBB: + // %FalseValue = ... + // # fallthrough to sinkMBB + BB = copy0MBB; + + // Update machine-CFG edges + BB->addSuccessor(sinkMBB); + + // sinkMBB: + // %Result = phi [ %FalseValue, copy0MBB ], [ %TrueValue, thisMBB ] + // ... + BB = sinkMBB; + BuildMI(BB, X86::PHI, 4, MI->getOperand(0).getReg()) + .addReg(MI->getOperand(1).getReg()).addMBB(copy0MBB) + .addReg(MI->getOperand(2).getReg()).addMBB(thisMBB); + + delete MI; // The pseudo instruction is gone now. + return BB; + } + + case X86::FP_TO_INT16_IN_MEM: + case X86::FP_TO_INT32_IN_MEM: + case X86::FP_TO_INT64_IN_MEM: { + // Change the floating point control register to use "round towards zero" + // mode when truncating to an integer value. + MachineFunction *F = BB->getParent(); + int CWFrameIdx = F->getFrameInfo()->CreateStackObject(2, 2); + addFrameReference(BuildMI(BB, X86::FNSTCW16m, 4), CWFrameIdx); + + // Load the old value of the high byte of the control word... + unsigned OldCW = + F->getSSARegMap()->createVirtualRegister(X86::GR16RegisterClass); + addFrameReference(BuildMI(BB, X86::MOV16rm, 4, OldCW), CWFrameIdx); + + // Set the high part to be round to zero... + addFrameReference(BuildMI(BB, X86::MOV16mi, 5), CWFrameIdx).addImm(0xC7F); + + // Reload the modified control word now... + addFrameReference(BuildMI(BB, X86::FLDCW16m, 4), CWFrameIdx); + + // Restore the memory image of control word to original value + addFrameReference(BuildMI(BB, X86::MOV16mr, 5), CWFrameIdx).addReg(OldCW); + + // Get the X86 opcode to use. + unsigned Opc; + switch (MI->getOpcode()) { + default: assert(0 && "illegal opcode!"); + case X86::FP_TO_INT16_IN_MEM: Opc = X86::FpIST16m; break; + case X86::FP_TO_INT32_IN_MEM: Opc = X86::FpIST32m; break; + case X86::FP_TO_INT64_IN_MEM: Opc = X86::FpIST64m; break; + } + + X86AddressMode AM; + MachineOperand &Op = MI->getOperand(0); + if (Op.isRegister()) { + AM.BaseType = X86AddressMode::RegBase; + AM.Base.Reg = Op.getReg(); + } else { + AM.BaseType = X86AddressMode::FrameIndexBase; + AM.Base.FrameIndex = Op.getFrameIndex(); + } + Op = MI->getOperand(1); + if (Op.isImmediate()) + AM.Scale = Op.getImmedValue(); + Op = MI->getOperand(2); + if (Op.isImmediate()) + AM.IndexReg = Op.getImmedValue(); + Op = MI->getOperand(3); + if (Op.isGlobalAddress()) { + AM.GV = Op.getGlobal(); + } else { + AM.Disp = Op.getImmedValue(); + } + addFullAddress(BuildMI(BB, Opc, 5), AM).addReg(MI->getOperand(4).getReg()); + + // Reload the original control word now. + addFrameReference(BuildMI(BB, X86::FLDCW16m, 4), CWFrameIdx); + + delete MI; // The pseudo instruction is gone now. + return BB; + } + } +} + +//===----------------------------------------------------------------------===// +// X86 Optimization Hooks +//===----------------------------------------------------------------------===// + void X86TargetLowering::computeMaskedBitsForTargetNode(const SDOperand Op, uint64_t Mask, uint64_t &KnownZero, @@ -3914,6 +3972,10 @@ } } +//===----------------------------------------------------------------------===// +// X86 Inline Assembly Support +//===----------------------------------------------------------------------===// + std::vector X86TargetLowering:: getRegClassForInlineAsmConstraint(const std::string &Constraint, MVT::ValueType VT) const { @@ -3969,53 +4031,3 @@ return std::vector(); } - -/// isLegalAddressImmediate - Return true if the integer value or -/// GlobalValue can be used as the offset of the target addressing mode. -bool X86TargetLowering::isLegalAddressImmediate(int64_t V) const { - // X86 allows a sign-extended 32-bit immediate field. - return (V > -(1LL << 32) && V < (1LL << 32)-1); -} - -bool X86TargetLowering::isLegalAddressImmediate(GlobalValue *GV) const { - if (Subtarget->isTargetDarwin()) { - Reloc::Model RModel = getTargetMachine().getRelocationModel(); - if (RModel == Reloc::Static) - return true; - else if (RModel == Reloc::DynamicNoPIC) - return !DarwinGVRequiresExtraLoad(GV); - else - return false; - } else - return true; -} - -/// isShuffleMaskLegal - Targets can use this to indicate that they only -/// support *some* VECTOR_SHUFFLE operations, those with specific masks. -/// By default, if a target supports the VECTOR_SHUFFLE node, all mask values -/// are assumed to be legal. -bool -X86TargetLowering::isShuffleMaskLegal(SDOperand Mask, MVT::ValueType VT) const { - // Only do shuffles on 128-bit vector types for now. - if (MVT::getSizeInBits(VT) == 64) return false; - return (Mask.Val->getNumOperands() <= 4 || - isSplatMask(Mask.Val) || - isPSHUFHW_PSHUFLWMask(Mask.Val) || - X86::isUNPCKLMask(Mask.Val) || - X86::isUNPCKL_v_undef_Mask(Mask.Val) || - X86::isUNPCKHMask(Mask.Val)); -} - -bool X86TargetLowering::isVectorClearMaskLegal(std::vector &BVOps, - MVT::ValueType EVT, - SelectionDAG &DAG) const { - unsigned NumElts = BVOps.size(); - // Only do shuffles on 128-bit vector types for now. - if (MVT::getSizeInBits(EVT) * NumElts == 64) return false; - if (NumElts == 2) return true; - if (NumElts == 4) { - return (isMOVLMask(BVOps) || isCommutedMOVL(BVOps, true) || - isSHUFPMask(BVOps) || isCommutedSHUFP(BVOps)); - } - return false; -} From lattner at cs.uiuc.edu Wed Jul 5 19:24:05 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jul 2006 19:24:05 -0500 Subject: [llvm-commits] CVS: CVSROOT/update-www.sh Message-ID: <200607060024.TAA15527@zion.cs.uiuc.edu> Changes in directory CVSROOT: update-www.sh updated: 1.9 -> 1.10 --- Log message: Update the nightly tester when committing. --- Diffs of the changes: (+4 -0) update-www.sh | 4 ++++ 1 files changed, 4 insertions(+) Index: CVSROOT/update-www.sh diff -u CVSROOT/update-www.sh:1.9 CVSROOT/update-www.sh:1.10 --- CVSROOT/update-www.sh:1.9 Sun Jan 16 01:38:01 2005 +++ CVSROOT/update-www.sh Wed Jul 5 19:23:52 2006 @@ -13,6 +13,10 @@ cd docs/ cvs -Q update -Pd +# Update the nightly tester. +cd ../nightlytest/ +cvs -Q update -Pd + # Make the HTML docs from POD source cd /home/vadve/shared/llvm-wwwroot/docs/CommandGuide gmake -s BUILD_FOR_WEBSITE=1 From lattner at cs.uiuc.edu Wed Jul 5 19:37:04 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jul 2006 19:37:04 -0500 Subject: [llvm-commits] CVS: llvm/docs/Makefile Message-ID: <200607060037.TAA15985@zion.cs.uiuc.edu> Changes in directory llvm/docs: Makefile updated: 1.11 -> 1.12 --- Log message: The web site uses this --- Diffs of the changes: (+9 -0) Makefile | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/docs/Makefile diff -u llvm/docs/Makefile:1.11 llvm/docs/Makefile:1.12 --- llvm/docs/Makefile:1.11 Wed Nov 30 00:31:28 2005 +++ llvm/docs/Makefile Wed Jul 5 19:36:52 2006 @@ -10,6 +10,15 @@ LEVEL := .. DIRS := CommandGuide +ifdef BUILD_FOR_WEBSITE +PROJ_OBJ_DIR = . +DOXYGEN = doxygen + +doxygen.cfg: doxygen.cfg.in + cat $< | sed 's/@abs_top_srcdir@/../g' | sed 's/@DOT@/dot/g' | \ + sed 's/@PACKAGE_VERSION@/CVS/g' | sed 's/@abs_top_builddir@/../g' > $@ +endif + include $(LEVEL)/Makefile.common HTML := $(wildcard $(PROJ_SRC_DIR)/*.html) \ From lattner at cs.uiuc.edu Wed Jul 5 19:47:08 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 5 Jul 2006 19:47:08 -0500 Subject: [llvm-commits] CVS: CVSROOT/update-www.sh Message-ID: <200607060047.TAA16573@zion.cs.uiuc.edu> Changes in directory CVSROOT: update-www.sh updated: 1.10 -> 1.11 --- Log message: Don't prune directories. This fixes the warnings when committing to (e.g.) the docs dir. --- Diffs of the changes: (+3 -3) update-www.sh | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: CVSROOT/update-www.sh diff -u CVSROOT/update-www.sh:1.10 CVSROOT/update-www.sh:1.11 --- CVSROOT/update-www.sh:1.10 Wed Jul 5 19:23:52 2006 +++ CVSROOT/update-www.sh Wed Jul 5 19:46:58 2006 @@ -7,15 +7,15 @@ cd /home/vadve/shared/llvm-wwwroot # Update any committed files -cvs -Q update -Pd +cvs -Q update -d # Update the docs explicitly cd docs/ -cvs -Q update -Pd +cvs -Q update -d # Update the nightly tester. cd ../nightlytest/ -cvs -Q update -Pd +cvs -Q update -d # Make the HTML docs from POD source cd /home/vadve/shared/llvm-wwwroot/docs/CommandGuide From evan.cheng at apple.com Wed Jul 5 20:53:49 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 5 Jul 2006 20:53:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetMachine.cpp Message-ID: <200607060153.UAA16899@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetMachine.cpp updated: 1.48 -> 1.49 --- Log message: Added option -code-model to set code model (only used in 64-bit) mode. Valid values include small, kernel, medium, large, and default. --- Diffs of the changes: (+30 -0) TargetMachine.cpp | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+) Index: llvm/lib/Target/TargetMachine.cpp diff -u llvm/lib/Target/TargetMachine.cpp:1.48 llvm/lib/Target/TargetMachine.cpp:1.49 --- llvm/lib/Target/TargetMachine.cpp:1.48 Wed May 24 14:05:21 2006 +++ llvm/lib/Target/TargetMachine.cpp Wed Jul 5 20:53:35 2006 @@ -28,6 +28,7 @@ bool UnsafeFPMath; bool FiniteOnlyFPMathOption; Reloc::Model RelocationModel; + CodeModel::Model CMModel; } namespace { cl::opt PrintCode("print-machineinstrs", @@ -70,6 +71,24 @@ clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic", "Relocatable external references, non-relocatable code"), clEnumValEnd)); + cl::opt + DefCodeModel( + "code-model", + cl::desc("Choose relocation model"), + cl::location(CMModel), + cl::init(CodeModel::Default), + cl::values( + clEnumValN(CodeModel::Default, "default", + "Target default code model"), + clEnumValN(CodeModel::Small, "small", + "Small code model"), + clEnumValN(CodeModel::Kernel, "kernel", + "Kernel code model"), + clEnumValN(CodeModel::Medium, "medium", + "Medium code model"), + clEnumValN(CodeModel::Large, "large", + "Large code model"), + clEnumValEnd)); } //--------------------------------------------------------------------------- @@ -94,6 +113,17 @@ RelocationModel = Model; } +/// getCodeModel - Returns the code model. The choices are small, kernel, +/// medium, large, and target default. +CodeModel::Model TargetMachine::getCodeModel() { + return CMModel; +} + +/// setCodeModel - Sets the code model. +void TargetMachine::setCodeModel(CodeModel::Model Model) { + CMModel = Model; +} + namespace llvm { /// FiniteOnlyFPMath - This returns true when the -enable-finite-only-fp-math /// option is specified on the command line. If this returns false (default), From evan.cheng at apple.com Wed Jul 5 20:53:49 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 5 Jul 2006 20:53:49 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetMachine.h Message-ID: <200607060153.UAA16903@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetMachine.h updated: 1.65 -> 1.66 --- Log message: Added option -code-model to set code model (only used in 64-bit) mode. Valid values include small, kernel, medium, large, and default. --- Diffs of the changes: (+18 -0) TargetMachine.h | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+) Index: llvm/include/llvm/Target/TargetMachine.h diff -u llvm/include/llvm/Target/TargetMachine.h:1.65 llvm/include/llvm/Target/TargetMachine.h:1.66 --- llvm/include/llvm/Target/TargetMachine.h:1.65 Fri May 12 01:33:48 2006 +++ llvm/include/llvm/Target/TargetMachine.h Wed Jul 5 20:53:36 2006 @@ -44,6 +44,17 @@ }; } +// Code model types. +namespace CodeModel { + enum Model { + Default, + Small, + Kernel, + Medium, + Large + }; +} + //===----------------------------------------------------------------------===// /// /// TargetMachine - Primary interface to the complete machine description for @@ -132,6 +143,13 @@ /// setRelocationModel - Sets the code generation relocation model. static void setRelocationModel(Reloc::Model Model); + /// getCodeModel - Returns the code model. The choices are small, kernel, + /// medium, large, and target default. + static CodeModel::Model getCodeModel(); + + /// setCodeModel - Sets the code model. + static void setCodeModel(CodeModel::Model Model); + /// CodeGenFileType - These enums are meant to be passed into /// addPassesToEmitFile to indicate what type of file to emit. enum CodeGenFileType { From evan.cheng at apple.com Thu Jul 6 02:46:02 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 6 Jul 2006 02:46:02 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200607060746.CAA30439@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.236 -> 1.237 --- Log message: Fixed a typo. --- Diffs of the changes: (+1 -1) configure.ac | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.236 llvm/autoconf/configure.ac:1.237 --- llvm/autoconf/configure.ac:1.236 Tue Jun 20 17:16:32 2006 +++ llvm/autoconf/configure.ac Thu Jul 6 02:45:49 2006 @@ -282,7 +282,7 @@ dnl Allow specific targets to be specified for building (or not) TARGETS_TO_BUILD="" -AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-target], +AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets], [Build specific host targets: all,host-only,{target-name} (default=all)]),, enableval=all) case "$enableval" in From evan.cheng at apple.com Thu Jul 6 02:46:45 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 6 Jul 2006 02:46:45 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200607060746.CAA30456@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.239 -> 1.240 --- Log message: Fixed a typo. --- Diffs of the changes: (+1 -1) configure | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/configure diff -u llvm/configure:1.239 llvm/configure:1.240 --- llvm/configure:1.239 Tue Jun 20 17:16:32 2006 +++ llvm/configure Thu Jul 6 02:46:33 2006 @@ -1041,7 +1041,7 @@ --enable-jit Enable Just In Time Compiling (default is YES) --enable-doxygen Build doxygen documentation (default is NO) --enable-threads Use threads if available (default is YES) - --enable-target Build specific host targets: + --enable-targets Build specific host targets: all,host-only,{target-name} (default=all) --enable-ltdl-install install libltdl --enable-shared[=PKGS] From lattner at cs.uiuc.edu Thu Jul 6 12:10:54 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 12:10:54 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Message-ID: <200607061710.MAA06988@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCTargetMachine.cpp updated: 1.95 -> 1.96 --- Log message: Undisable ppc64 jit --- Diffs of the changes: (+1 -1) PPCTargetMachine.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.95 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.96 --- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.95 Fri Jun 16 19:01:04 2006 +++ llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Thu Jul 6 12:10:42 2006 @@ -46,7 +46,7 @@ unsigned PPC64TargetMachine::getJITMatchQuality() { #if defined(__POWERPC__) || defined (__ppc__) || defined(_POWER) if (sizeof(void*) == 8) - return 10 * 0/*FIXME: not PPC64-JIT support yet! */; + return 10; #endif return 0; } From lattner at cs.uiuc.edu Thu Jul 6 13:00:28 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 13:00:28 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/Verifier.h Message-ID: <200607061800.NAA21749@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: Verifier.h updated: 1.15 -> 1.16 --- Log message: Change the verifier to never throw an exception. Instead verifyModule can optionally return the string error, which is an easier api for clients to use anyway. --- Diffs of the changes: (+4 -2) Verifier.h | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Analysis/Verifier.h diff -u llvm/include/llvm/Analysis/Verifier.h:1.15 llvm/include/llvm/Analysis/Verifier.h:1.16 --- llvm/include/llvm/Analysis/Verifier.h:1.15 Thu Apr 21 22:25:27 2005 +++ llvm/include/llvm/Analysis/Verifier.h Thu Jul 6 13:00:01 2006 @@ -21,6 +21,8 @@ #ifndef LLVM_ANALYSIS_VERIFIER_H #define LLVM_ANALYSIS_VERIFIER_H +#include + namespace llvm { class FunctionPass; @@ -35,7 +37,6 @@ /// actions are listed below. enum VerifierFailureAction { AbortProcessAction, ///< verifyModule will print to stderr and abort() - ThrowExceptionAction, ///< verifyModule will throw errors as std::string PrintMessageAction, ///< verifyModule will print to stderr and return true ReturnStatusAction ///< verifyModule will just return true }; @@ -58,7 +59,8 @@ bool verifyModule( const Module &M, ///< The module to be verified - VerifierFailureAction action = AbortProcessAction ///< Action to take + VerifierFailureAction action = AbortProcessAction, ///< Action to take + std::string *ErrorInfo = 0 ///< Information about failures. ); // verifyFunction - Check a function for errors, useful for use when debugging a From lattner at cs.uiuc.edu Thu Jul 6 13:01:15 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 13:01:15 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-as/llvm-as.cpp Message-ID: <200607061801.NAA21895@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-as: llvm-as.cpp updated: 1.45 -> 1.46 --- Log message: Change the verifier to never throw an exception. Instead verifyModule canoptionally return the string error, which is an easier api for clients touse anyway. --- Diffs of the changes: (+8 -8) llvm-as.cpp | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/tools/llvm-as/llvm-as.cpp diff -u llvm/tools/llvm-as/llvm-as.cpp:1.45 llvm/tools/llvm-as/llvm-as.cpp:1.46 --- llvm/tools/llvm-as/llvm-as.cpp:1.45 Mon May 29 13:52:52 2006 +++ llvm/tools/llvm-as/llvm-as.cpp Thu Jul 6 13:01:01 2006 @@ -63,14 +63,14 @@ return 1; } - try { - if (!DisableVerify) - verifyModule(*M.get(), ThrowExceptionAction); - } catch (const std::string &Err) { - std::cerr << argv[0] - << ": assembly parsed, but does not verify as correct!\n"; - std::cerr << Err; - return 1; + if (!DisableVerify) { + std::string Err; + if (verifyModule(*M.get(), ReturnStatusAction, &Err)) { + std::cerr << argv[0] + << ": assembly parsed, but does not verify as correct!\n"; + std::cerr << Err; + return 1; + } } if (DumpAsm) std::cerr << "Here's the assembly:\n" << *M.get(); From lattner at cs.uiuc.edu Thu Jul 6 13:01:15 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 13:01:15 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm2cpp/llvm2cpp.cpp Message-ID: <200607061801.NAA21899@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm2cpp: llvm2cpp.cpp updated: 1.3 -> 1.4 --- Log message: Change the verifier to never throw an exception. Instead verifyModule canoptionally return the string error, which is an easier api for clients touse anyway. --- Diffs of the changes: (+10 -8) llvm2cpp.cpp | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) Index: llvm/tools/llvm2cpp/llvm2cpp.cpp diff -u llvm/tools/llvm2cpp/llvm2cpp.cpp:1.3 llvm/tools/llvm2cpp/llvm2cpp.cpp:1.4 --- llvm/tools/llvm2cpp/llvm2cpp.cpp:1.3 Mon May 29 13:06:28 2006 +++ llvm/tools/llvm2cpp/llvm2cpp.cpp Thu Jul 6 13:01:01 2006 @@ -59,14 +59,16 @@ return 1; } - try { - if (!DisableVerify) - verifyModule(*M.get(), ThrowExceptionAction); - } catch (const std::string &Err) { - std::cerr << argv[0] - << ": assembly parsed, but does not verify as correct!\n"; - std::cerr << Err; - return 1; + // FIXME: llvm2cpp should read .bc files and thus not run the verifier + // explicitly! + if (!DisableVerify) { + std::string Err; + if (verifyModule(*M.get(), ReturnStatusAction, &Err)) { + std::cerr << argv[0] + << ": assembly parsed, but does not verify as correct!\n"; + std::cerr << Err; + return 1; + } } if (OutputFilename != "") { // Specified an output filename? From lattner at cs.uiuc.edu Thu Jul 6 13:01:15 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 13:01:15 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Message-ID: <200607061801.NAA21903@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-bcanalyzer: llvm-bcanalyzer.cpp updated: 1.6 -> 1.7 --- Log message: Change the verifier to never throw an exception. Instead verifyModule canoptionally return the string error, which is an easier api for clients touse anyway. --- Diffs of the changes: (+1 -14) llvm-bcanalyzer.cpp | 15 +-------------- 1 files changed, 1 insertion(+), 14 deletions(-) Index: llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp diff -u llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.6 llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.7 --- llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:1.6 Thu Apr 21 18:59:35 2005 +++ llvm/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Thu Jul 6 13:01:01 2006 @@ -73,23 +73,10 @@ if ( M && Verify ) { std::string verificationMsg; - try { - verifyModule( *M, ThrowExceptionAction ); - } catch (std::string& errmsg ) { - verificationMsg = errmsg; - } - if ( verificationMsg.length() > 0 ) + if (verifyModule(*M, ReturnStatusAction, &verificationMsg)) std::cerr << "Final Verification Message: " << verificationMsg << "\n"; } - - // If there was an error, print it and stop. - if ( ErrorMessage.size() ) { - std::cerr << argv[0] << ": " << ErrorMessage << "\n"; - return 1; - } - - if (Out != &std::cout) { ((std::ofstream*)Out)->close(); delete Out; From lattner at cs.uiuc.edu Thu Jul 6 13:01:36 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 13:01:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200607061801.NAA21969@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.157 -> 1.158 --- Log message: Change the verifier to never throw an exception. Instead verifyModule canoptionally return the string error, which is an easier api for clients touse anyway. --- Diffs of the changes: (+7 -8) Verifier.cpp | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.157 llvm/lib/VMCore/Verifier.cpp:1.158 --- llvm/lib/VMCore/Verifier.cpp:1.157 Wed Jun 28 16:38:54 2006 +++ llvm/lib/VMCore/Verifier.cpp Thu Jul 6 13:01:23 2006 @@ -152,18 +152,13 @@ /// this condition, do so. /// void abortIfBroken() { - if (Broken) - { + if (Broken) { msgs << "Broken module found, "; - switch (action) - { + switch (action) { case AbortProcessAction: msgs << "compilation aborted!\n"; std::cerr << msgs.str(); abort(); - case ThrowExceptionAction: - msgs << "verification terminated.\n"; - throw msgs.str(); case PrintMessageAction: msgs << "verification continues.\n"; std::cerr << msgs.str(); @@ -799,11 +794,15 @@ /// verifyModule - Check a module for errors, printing messages on stderr. /// Return true if the module is corrupt. /// -bool llvm::verifyModule(const Module &M, VerifierFailureAction action) { +bool llvm::verifyModule(const Module &M, VerifierFailureAction action, + std::string *ErrorInfo) { PassManager PM; Verifier *V = new Verifier(action); PM.add(V); PM.run((Module&)M); + + if (ErrorInfo && V->Broken) + *ErrorInfo = V->msgs.str(); return V->Broken; } From lattner at cs.uiuc.edu Thu Jul 6 13:02:41 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 13:02:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Analyzer.cpp Message-ID: <200607061802.NAA22018@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Analyzer.cpp updated: 1.21 -> 1.22 --- Log message: Change the verifier to never throw an exception. Instead verifyModule canoptionally return the string error, which is an easier api for clients touse anyway. --- Diffs of the changes: (+15 -25) Analyzer.cpp | 40 +++++++++++++++------------------------- 1 files changed, 15 insertions(+), 25 deletions(-) Index: llvm/lib/Bytecode/Reader/Analyzer.cpp diff -u llvm/lib/Bytecode/Reader/Analyzer.cpp:1.21 llvm/lib/Bytecode/Reader/Analyzer.cpp:1.22 --- llvm/lib/Bytecode/Reader/Analyzer.cpp:1.21 Mon Dec 26 08:23:22 2005 +++ llvm/lib/Bytecode/Reader/Analyzer.cpp Thu Jul 6 13:02:27 2006 @@ -117,12 +117,10 @@ bca.functionDensity = double(bca.BlockSizes[BytecodeFormat::FunctionBlockID]) / double(bca.numFunctions); - if ( bca.progressiveVerify ) { - try { - verifyModule(*M, ThrowExceptionAction); - } catch ( std::string& msg ) { + if (bca.progressiveVerify) { + std::string msg; + if (verifyModule(*M, ReturnStatusAction, &msg)) bca.VerifyInfo += "Verify at Finish: " + msg + "\n"; - } } } @@ -135,12 +133,10 @@ virtual void handleModuleEnd(const std::string& id) { if (os) *os << " } End Module " << id << "\n"; - if ( bca.progressiveVerify ) { - try { - verifyModule(*M, ThrowExceptionAction); - } catch ( std::string& msg ) { + if (bca.progressiveVerify) { + std::string msg; + if (verifyModule(*M, ReturnStatusAction, &msg)) bca.VerifyInfo += "Verify at EndModule: " + msg + "\n"; - } } } @@ -232,12 +228,10 @@ virtual void handleModuleGlobalsEnd() { if (os) *os << " } END BLOCK: ModuleGlobalInfo\n"; - if ( bca.progressiveVerify ) { - try { - verifyModule(*M, ThrowExceptionAction); - } catch ( std::string& msg ) { + if (bca.progressiveVerify) { + std::string msg; + if (verifyModule(*M, ReturnStatusAction, &msg)) bca.VerifyInfo += "Verify at EndModuleGlobalInfo: " + msg + "\n"; - } } } @@ -346,12 +340,10 @@ currFunc->density = double(currFunc->byteSize) / double(currFunc->numInstructions); - if ( bca.progressiveVerify ) { - try { - verifyModule(*M, ThrowExceptionAction); - } catch ( std::string& msg ) { + if (bca.progressiveVerify) { + std::string msg; + if (verifyModule(*M, ReturnStatusAction, &msg)) bca.VerifyInfo += "Verify at EndFunction: " + msg + "\n"; - } } } @@ -522,12 +514,10 @@ if (os) *os << " } END BLOCK: GlobalConstants\n"; - if ( bca.progressiveVerify ) { - try { - verifyModule(*M, ThrowExceptionAction); - } catch ( std::string& msg ) { + if (bca.progressiveVerify) { + std::string msg; + if (verifyModule(*M, ReturnStatusAction, &msg)) bca.VerifyInfo += "Verify at EndGlobalConstants: " + msg + "\n"; - } } } From lattner at cs.uiuc.edu Thu Jul 6 13:33:15 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 13:33:15 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp Message-ID: <200607061833.NAA04177@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: CommandLine.cpp updated: 1.68 -> 1.69 --- Log message: Print LLVM version info like this: Low Level Virtual Machine (http://llvm.org/): llvm version 1.8cvs DEBUG build with assertions. instead of like this: Low Level Virtual Machine (llvm) 1.8cvs (see http://llvm.org/) ASSERTIONS ENABLED Also, add a place for vendor version info. --- Diffs of the changes: (+13 -5) CommandLine.cpp | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) Index: llvm/lib/Support/CommandLine.cpp diff -u llvm/lib/Support/CommandLine.cpp:1.68 llvm/lib/Support/CommandLine.cpp:1.69 --- llvm/lib/Support/CommandLine.cpp:1.68 Mon Jun 5 11:22:56 2006 +++ llvm/lib/Support/CommandLine.cpp Thu Jul 6 13:33:03 2006 @@ -972,13 +972,21 @@ void operator=(bool OptionWasSpecified) { if (OptionWasSpecified) { if (OverrideVersionPrinter == 0) { - std::cout << "Low Level Virtual Machine (" << PACKAGE_NAME << ") " - << PACKAGE_VERSION << " (see http://llvm.org/)"; -#ifndef NDEBUG - std::cout << " ASSERTIONS ENABLED\n"; + std::cout << "Low Level Virtual Machine (http://llvm.org/):\n"; + std::cout << " " << PACKAGE_NAME << " version " << PACKAGE_VERSION; +#ifdef LLVM_VERSION_INFO + std::cout << LLVM_VERSION_INFO; +#endif + std::cout << "\n "; +#ifndef __OPTIMIZE__ + std::cout << "DEBUG build"; #else - std::cout << "\n"; + std::cout << "Optimized build"; +#endif +#ifndef NDEBUG + std::cout << " with assertions"; #endif + std::cout << ".\n"; getOpts().clear(); // Don't bother making option dtors remove from map. exit(1); } else { From pjenkins at apple.com Thu Jul 6 16:19:44 2006 From: pjenkins at apple.com (Patrick Jenkins) Date: Thu, 6 Jul 2006 16:19:44 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200607062119.QAA06875@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl added (r1.1) --- Log message: The first commit of NewNightlyTest.pl which instead of generating a webpage submits the results of the test to a central server for storage and display. --- Diffs of the changes: (+1024 -0) NewNightlyTest.pl | 1024 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 1024 insertions(+) Index: llvm/utils/NewNightlyTest.pl diff -c /dev/null llvm/utils/NewNightlyTest.pl:1.1 *** /dev/null Thu Jul 6 16:19:42 2006 --- llvm/utils/NewNightlyTest.pl Thu Jul 6 16:19:32 2006 *************** *** 0 **** --- 1,1024 ---- + #!/usr/bin/perl + + use POSIX qw(strftime); + use File::Copy; + use Socket; + + # + # Program: NewNightlyTest.pl + # + # Synopsis: Perform a series of tests which are designed to be run nightly. + # This is used to keep track of the status of the LLVM tree, tracking + # regressions and performance changes. Submits this information + # to llvm.org where it is placed into the nightlytestresults database. + # + # Modified heavily by Patrick Jenkins, July 2006 + # + # Syntax: NightlyTest.pl [OPTIONS] [CVSROOT BUILDDIR WEBDIR] + # where + # OPTIONS may include one or more of the following: + # -nocheckout Do not create, checkout, update, or configure + # the source tree. + # -noremove Do not remove the BUILDDIR after it has been built. + # -nobuild Do not build llvm. If tests are enabled perform them + # on the llvm build specified in the build directory + # -notest Do not even attempt to run the test programs. Implies + # -norunningtests. + # -norunningtests Do not run the Olden benchmark suite with + # LARGE_PROBLEM_SIZE enabled. + # -noexternals Do not run the external tests (for cases where povray + # or SPEC are not installed) + # -with-externals Specify a directory where the external tests are located. + # -nodejagnu Do not run feature or regression tests + # -parallel Run two parallel jobs with GNU Make. + # -release Build an LLVM Release version + # -enable-llcbeta Enable testing of beta features in llc. + # -disable-llc Disable LLC tests in the nightly tester. + # -disable-jit Disable JIT tests in the nightly tester. + # -disable-cbe Disable C backend tests in the nightly tester. + # -verbose Turn on some debug output + # -debug Print information useful only to maintainers of this script. + # -nice Checkout/Configure/Build with "nice" to reduce impact + # on busy servers. + # -f2c Next argument specifies path to F2C utility + # -nickname The next argument specifieds the nickname this script + # will submit to the nightlytest results repository. + # -gccpath Path to gcc/g++ used to build LLVM + # -cvstag Check out a specific CVS tag to build LLVM (useful for + # testing release branches) + # -target Specify the target triplet + # -cflags Next argument specifies that C compilation options that + # override the default. + # -cxxflags Next argument specifies that C++ compilation options that + # override the default. + # -ldflags Next argument specifies that linker options that override + # the default. + # -extraflags Next argument specifies extra options that are passed to + # compile the tests. + # + # ---------------- Options to configure llvm-test ---------------------------- + # -spec2000path Path to the benchspec directory in the SPEC 2000 distro + # -spec95path Path to the benchspec directory in the SPEC 95 distro. + # -povraypath Path to the povray sources + # -namdpath Path to the namd sources + # + # CVSROOT is the CVS repository from which the tree will be checked out, + # specified either in the full :method:user at host:/dir syntax, or + # just /dir if using a local repo. + # BUILDDIR is the directory where sources for this test run will be checked out + # AND objects for this test run will be built. This directory MUST NOT + # exist before the script is run; it will be created by the cvs checkout + # process and erased (unless -noremove is specified; see above.) + # WEBDIR is the directory into which the test results web page will be written, + # AND in which the "index.html" is assumed to be a symlink to the most recent + # copy of the results. This directory will be created if it does not exist. + # LLVMGCCDIR is the directory in which the LLVM GCC Front End is installed + # to. This is the same as you would have for a normal LLVM build. + # + ############################################################## + # + # Getting environment variables + # + ############################################################## + my $HOME = $ENV{'HOME'}; + my $CVSRootDir = $ENV{'CVSROOT'}; + $CVSRootDir = "/home/vadve/shared/PublicCVS" + unless $CVSRootDir; + my $BuildDir = $ENV{'BUILDDIR'}; + $BuildDir = "$HOME/buildtest" + unless $BuildDir; + my $WebDir = $ENV{'WEBDIR'}; + $WebDir = "$HOME/cvs/testresults-X86" + unless $WebDir; + + ############################################################## + # + # Calculate the date prefix... + # + ############################################################## + @TIME = localtime; + my $DATE = sprintf "%4d-%02d-%02d", $TIME[5]+1900, $TIME[4]+1, $TIME[3]; + my $DateString = strftime "%B %d, %Y", localtime; + my $TestStartTime = gmtime() . "GMT
" . localtime() . " (local)"; + + ############################################################## + # + # Parse arguments... + # + ############################################################## + $CONFIGUREARGS=""; + + $NOTEST=0; + $NORUNNINGTESTS=0; + + while (scalar(@ARGV) and ($_ = $ARGV[0], /^[-+]/)) { + shift; + last if /^--$/; # Stop processing arguments on -- + + # List command line options here... + if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; } + if (/^-nocvsstats$/) { $NOCVSSTATS = 1; next; } + if (/^-noremove$/) { $NOREMOVE = 1; next; } + if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; } + if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; } + if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; } + if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2"; next; } + if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } + if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; + $CONFIGUREARGS .= " --disable-llc_diffs"; next; } + if (/^-disable-jit$/) { $PROGTESTOPTS .= " DISABLE_JIT=1"; + $CONFIGUREARGS .= " --disable-jit"; next; } + if (/^-verbose$/) { $VERBOSE = 1; next; } + if (/^-debug$/) { $DEBUG = 1; next; } + if (/^-nice$/) { $NICE = "nice "; next; } + if (/^-f2c$/) { + $CONFIGUREARGS .= " --with-f2c=$ARGV[0]"; shift; next; + } + if (/^-with-externals/) { + $CONFIGUREARGS .= "--with-externals=$ARGV[0]"; shift; next; + } + if (/^-nickname$/) { $nickname = "$ARGV[0]"; shift; next; } + if (/^-gccpath/) { $CONFIGUREARGS .= " CC=$ARGV[0]/gcc CXX=$ARGV[0]/g++"; shift; next;} + if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; } else{ $CVSCOOPT="";} + if (/^-target/) { + $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next; + } + if (/^-cflags/) { + $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; shift; next; + } + if (/^-cxxflags/) { + $MAKEOPTS = "$MAKEOPTS CXX.Flags=\'$ARGV[0]\'"; shift; next; + } + if (/^-ldflags/) { + $MAKEOPTS = "$MAKEOPTS LD.Flags=\'$ARGV[0]\'"; shift; next; + } + if (/^-compileflags/) { + $MAKEOPTS = "$MAKEOPTS $ARGV[0]"; shift; next; + } + if (/^-extraflags/) { + $PROGTESTOPTS .= " EXTRA_FLAGS=\'$ARGV[0]\'"; shift; next; + } + if (/^-noexternals$/) { $NOEXTERNALS = 1; next; } + if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; } + if (/^-nobuild$/) { $NOBUILD = 1; next; } + if (/^-spec2000path$/) { + $LLVMTESTCONFIGARGS .= " --enable-spec2000=$ARGV[0]"; shift; next; + } else{ $LLVMTESTCONFIGARGS=""; } + if (/^-spec95path$/) { + $LLVMTESTCONFIGARGS .= " --enable-spec95=$ARGV[0]"; shift; next; + } + if (/^-povraypath$/) { + $LLVMTESTCONFIGARGS .= " --enable-povray=$ARGV[0]"; shift; next; + } + if (/^-namdpath$/) { + $LLVMTESTCONFIGARGS .= " --enable-namd=$ARGV[0]"; shift; next; + } + print "Unknown option: $_ : ignoring!\n"; + } + + if ($ENV{'LLVMGCCDIR'}) { + $CONFIGUREARGS .= " --with-llvmgccdir=" . $ENV{'LLVMGCCDIR'}; + } + if ($CONFIGUREARGS !~ /--disable-jit/) { + $CONFIGUREARGS .= " --enable-jit"; + } + + die "Must specify 0 or 3 options!" if (@ARGV != 0 and @ARGV != 3); + + if (@ARGV == 3) { + $CVSRootDir = $ARGV[0]; + $BuildDir = $ARGV[1]; + $WebDir = $ARGV[2]; + } + + ############################################################## + # + #define the file names we'll use + # + ############################################################## + my $Prefix = "$WebDir/$DATE"; + my $BuildLog = "$Prefix-Build-Log.txt"; + my $CVSLog = "$Prefix-CVS-Log.txt"; + my $OldenTestsLog = "$Prefix-Olden-tests.txt"; + my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz"; + my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz"; + my $ExternalLog = "$Prefix-External-ProgramTest.txt.gz"; + my $DejagnuLog = "$Prefix-Dejagnu-testrun.log"; + my $DejagnuSum = "$Prefix-Dejagnu-testrun.sum"; + my $DejagnuTestsLog = "$Prefix-DejagnuTests-Log.txt"; + if (! -d $WebDir) { + mkdir $WebDir, 0777; + warn "$WebDir did not exist; creating it.\n"; + } + + if ($VERBOSE) { + print "INITIALIZED\n"; + print "CVS Root = $CVSRootDir\n"; + print "BuildDir = $BuildDir\n"; + print "WebDir = $WebDir\n"; + print "Prefix = $Prefix\n"; + print "CVSLog = $CVSLog\n"; + print "BuildLog = $BuildLog\n"; + } + + ############################################################## + # + # Helper functions + # + ############################################################## + sub GetDir { + my $Suffix = shift; + opendir DH, $WebDir; + my @Result = reverse sort grep !/$DATE/, grep /[-0-9]+$Suffix/, readdir DH; + closedir DH; + return @Result; + } + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # + # DiffFiles - Diff the current version of the file against the last version of + # the file, reporting things added and removed. This is used to report, for + # example, added and removed warnings. This returns a pair (added, removed) + # + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + sub DiffFiles { + my $Suffix = shift; + my @Others = GetDir $Suffix; + if (@Others == 0) { # No other files? We added all entries... + return (`cat $WebDir/$DATE$Suffix`, ""); + } + # Diff the files now... + my @Diffs = split "\n", `diff $WebDir/$DATE$Suffix $WebDir/$Others[0]`; + my $Added = join "\n", grep /^/, @Diffs; + $Added =~ s/^< //gm; + $Removed =~ s/^> //gm; + return ($Added, $Removed); + } + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + sub GetRegex { # (Regex with ()'s, value) + $_[1] =~ /$_[0]/m; + if (defined($1)) { + return $1; + } + return "0"; + } + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + sub GetRegexNum { + my ($Regex, $Num, $Regex2, $File) = @_; + my @Items = split "\n", `grep '$Regex' $File`; + return GetRegex $Regex2, $Items[$Num]; + } + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + sub ChangeDir { # directory, logical name + my ($dir,$name) = @_; + chomp($dir); + if ( $VERBOSE ) { print "Changing To: $name ($dir)\n"; } + chdir($dir) || die "Cannot change directory to: $name ($dir) "; + } + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + sub ReadFile { + if (open (FILE, $_[0])) { + undef $/; + my $Ret = ; + close FILE; + $/ = '\n'; + return $Ret; + } else { + print "Could not open file '$_[0]' for reading!"; + return ""; + } + } + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + sub WriteFile { # (filename, contents) + open (FILE, ">$_[0]") or die "Could not open file '$_[0]' for writing!"; + print FILE $_[1]; + close FILE; + } + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + sub CopyFile { #filename, newfile + my ($file, $newfile) = @_; + chomp($file); + if ($VERBOSE) { print "Copying $file to $newfile\n"; } + copy($file, $newfile); + } + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + sub AddRecord { + my ($Val, $Filename,$WebDir) = @_; + my @Records; + if (open FILE, "$WebDir/$Filename") { + @Records = grep !/$DATE/, split "\n", ; + close FILE; + } + push @Records, "$DATE: $Val"; + WriteFile "$WebDir/$Filename", (join "\n", @Records) . "\n"; + } + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # + # FormatTime - Convert a time from 1m23.45 into 83.45 + # + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + sub FormatTime { + my $Time = shift; + if ($Time =~ m/([0-9]+)m([0-9.]+)/) { + $Time = sprintf("%7.4f", $1*60.0+$2); + } + return $Time; + } + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + sub GetDejagnuTestResults { # (filename, log) + my ($filename, $DejagnuLog) = @_; + my @lines; + my $firstline; + $/ = "\n"; #Make sure we're going line at a time. + + print "DEJAGNU TEST RESULTS:\n"; + + if (open SRCHFILE, $filename) { + # Process test results + my $first_list = 1; + my $should_break = 1; + my $nocopy = 0; + my $readingsum = 0; + while ( ) { + if ( length($_) > 1 ) { + chomp($_); + if ( m/^XPASS:/ || m/^FAIL:/ ) { + $nocopy = 0; + if ( $first_list ) { + push(@lines, "UNEXPECTED TEST RESULTS\n"); + $first_list = 0; + $should_break = 1; + push(@lines, "$_\n"); + print " $_\n"; + } else { + push(@lines, "$_\n"); + print " $_\n"; + } + } #elsif ( m/Summary/ ) { + # if ( $first_list ) { + # push(@lines, "PERFECT!"); + # print " PERFECT!\n"; + # } else { + # push(@lines, "\n"); + # } + # push(@lines, "STATISTICS\n"); + # print "\nDEJAGNU STATISTICS:\n"; + # $should_break = 0; + # $nocopy = 0; + # $readingsum = 1; + #} + elsif ( $readingsum ) { + push(@lines,"$_\n"); + print " $_\n"; + } + + } + } + } + close SRCHFILE; + + my $content = join("", @lines); + return $content; + } + + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # + # This function acts as a mini web browswer submitting data + # to our central server via the post method + # + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + sub SendData{ + $host = $_[0]; + $file = $_[1]; + $variables=$_[2]; + + $port=80; + $socketaddr= sockaddr_in $port, inet_aton $host or die "Bad hostname\n"; + socket SOCK, PF_INET, SOCK_STREAM, getprotobyname('tcp') or die "Bad socket\n"; + connect SOCK, $socketaddr or die "Bad connection\n"; + select((select(SOCK), $| = 1)[0]); + + #creating content here + my $content; + foreach $key (keys (%$variables)){ + $value = $variables->{$key}; + $value =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; + $content .= "$key=$value&"; + } + + $length = length($content); + + my $send= "POST $file HTTP/1.0\n"; + $send.= "Content-Type: application/x-www-form-urlencoded\n"; + $send.= "Content-length: $length\n\n"; + $send.= "$content"; + + print SOCK $send; + my $result; + while(){ + $result .= $_; + } + close(SOCK); + + my $sentdata=""; + foreach $x(keys(%hash_of_data)){ + $senddata.= "$x => $hash_of_data{$x}\n"; + } + WriteFile "$Prefix-sentdata.txt", $sentdata; + + + return $result; + } + + + ############################################################## + # + # Create the CVS repository directory + # + ############################################################## + if (!$NOCHECKOUT) { + if (-d $BuildDir) { + if (!$NOREMOVE) { + system "rm -rf $BuildDir"; + } else { + die "CVS checkout directory $BuildDir already exists!"; + } + } + mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!"; + } + ChangeDir( $BuildDir, "CVS checkout directory" ); + + + ############################################################## + # + # Check out the llvm tree, saving CVS messages to the cvs log... + # + ############################################################## + my $CVSOPT = ""; + # Use compression if going over ssh. + $CVSOPT = "-z3" if $CVSRootDir =~ /^:ext:/; + my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co $CVSCOOPT"; + if (!$NOCHECKOUT) { + if ( $VERBOSE ) + { + print "CHECKOUT STAGE:\n"; + print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) > $CVSLog 2>&1\n"; + } + system "( time -p $CVSCMD llvm; cd llvm/projects ; " . + "$CVSCMD llvm-test ) > $CVSLog 2>&1"; + ChangeDir( $BuildDir , "CVS Checkout directory") ; + } + ChangeDir( "llvm" , "llvm source directory") ; + if (!$NOCHECKOUT) { + if ( $VERBOSE ) { print "UPDATE STAGE\n"; } + system "$NICE cvs update -PdRA >> $CVSLog 2>&1" ; + } + + ############################################################## + # + # Get some static statistics about the current state of CVS + # + # This can probably be put on the server side + # + ############################################################## + my $CVSCheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`; + my $CVSCheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $CVSLog`; + my $CVSCheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $CVSLog`; + my $CVSCheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys; + + my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0; + my $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0; + my $LOC = `utils/countloc.sh`; + + ############################################################## + # + # Extract some information from the CVS history... use a hash so no duplicate + # stuff is stored. This gets the history from the previous days worth + # of cvs activit and parses it. + # + ############################################################## + + my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated); + + if(!$NOCVSSTATS){ + + if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; } + @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`; + #print join "\n", @CVSHistory; print "\n"; + + my $DateRE = '[-/:0-9 ]+\+[0-9]+'; + + # Loop over every record from the CVS history, filling in the hashes. + foreach $File (@CVSHistory) { + my ($Type, $Date, $UID, $Rev, $Filename); + if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) { + ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5"); + } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) { + ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", ""); + } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) { + ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/"); + } else { + print "UNMATCHABLE: $File\n"; + next; + } + # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n"; + + if ($Filename =~ /^llvm/) { + if ($Type eq 'M') { # Modified + $ModifiedFiles{$Filename} = 1; + $UsersCommitted{$UID} = 1; + } elsif ($Type eq 'A') { # Added + $Addediles{$Filename} = 1; + $UsersCommitted{$UID} = 1; + } elsif ($Type eq 'R') { # Removed + $RemovedFiles{$Filename} = 1; + $UsersCommitted{$UID} = 1; + } else { + $UsersUpdated{$UID} = 1; + } + } + } + + my $TestError = 1; + + }#!NOCVSSTATS + + my $CVSAddedFiles = join "\n", sort keys %AddedFiles; + my $CVSModifiedFiles = join "\n", sort keys %ModifiedFiles; + my $CVSRemovedFiles = join "\n", sort keys %RemovedFiles; + my $UserCommitList = join "\n", sort keys %UsersCommitted; + my $UserUpdateList = join "\n", sort keys %UsersUpdated; + + ############################################################## + # + # Build the entire tree, saving build messages to the build log + # + ############################################################## + if (!$NOCHECKOUT && !$NOBUILD) { + my $EXTRAFLAGS = "--enable-spec --with-objroot=.$LLVMTESTCONFIGARGS"; + if ( $VERBOSE ) + { + print "CONFIGURE STAGE:\n"; + print "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1\n"; + } + system "(time -p $NICE ./configure $CONFIGUREARGS $EXTRAFLAGS) > $BuildLog 2>&1"; + if ( $VERBOSE ) + { + print "BUILD STAGE:\n"; + print "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1\n"; + } + # Build the entire tree, capturing the output into $BuildLog + system "(time -p $NICE make $MAKEOPTS) >> $BuildLog 2>&1"; + } + + + ############################################################## + # + # Get some statistics about the build... + # + ############################################################## + #this can de done on server + #my @Linked = split '\n', `grep Linking $BuildLog`; + #my $NumExecutables = scalar(grep(/executable/, @Linked)); + #my $NumLibraries = scalar(grep(!/executable/, @Linked)); + #my $NumObjects = `grep ']\: Compiling ' $BuildLog | wc -l` + 0; + + + my $ConfigTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$BuildLog"; + my $ConfigTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$BuildLog"; + my $ConfigTime = $ConfigTimeU+$ConfigTimeS; # ConfigTime = User+System + my $ConfigWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$BuildLog"; + + $ConfigTime=-1 unless $ConfigTime; + $ConfigWallTime=-1 unless $ConfigWallTime; + + my $BuildTimeU = GetRegexNum "^user", 1, "([0-9.]+)", "$BuildLog"; + my $BuildTimeS = GetRegexNum "^sys", 1, "([0-9.]+)", "$BuildLog"; + my $BuildTime = $BuildTimeU+$BuildTimeS; # BuildTime = User+System + my $BuildWallTime = GetRegexNum "^real", 1, "([0-9.]+)","$BuildLog"; + + $BuildTime=-1 unless $BuildTime; + $BuildWallTime=-1 unless $BuildWallTime; + + my $BuildError = 0, $BuildStatus = "OK"; + if($NOBUILD){ + $BuildStatus = "Skipped by user"; + $BuildError = 1; + } + elsif (`grep '^make[^:]*: .*Error' $BuildLog | wc -l` + 0 || + `grep '^make: \*\*\*.*Stop.' $BuildLog | wc -l`+0) { + $BuildStatus = "Error: compilation aborted"; + $BuildError = 1; + print "\n***ERROR BUILDING TREE\n\n"; + } + if ($BuildError) { $NODEJAGNU=1; } + + ############################################################## + # + # Running dejagnu tests + # + ############################################################## + my $DejangnuTestResults; # String containing the results of the dejagnu + my $dejagnu_output = "$DejagnuTestsLog"; + if(!$NODEJAGNU) { + if($VERBOSE) + { + print "DEJAGNU FEATURE/REGRESSION TEST STAGE:\n"; + print "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1\n"; + } + + #Run the feature and regression tests, results are put into testrun.sum + #Full log in testrun.log + system "(time -p make $MAKEOPTS check) > $dejagnu_output 2>&1"; + + #Copy the testrun.log and testrun.sum to our webdir + CopyFile("test/testrun.log", $DejagnuLog); + CopyFile("test/testrun.sum", $DejagnuSum); + #can be done on server + $DejagnuTestResults = GetDejagnuTestResults($DejagnuSum, $DejagnuLog); + $unexpfail_tests = $DejagnuTestResults; + } + #Extract time of dejagnu tests + my $DejagnuTimeU = GetRegexNum "^user", 0, "([0-9.]+)", "$dejagnu_output"; + my $DejagnuTimeS = GetRegexNum "^sys", 0, "([0-9.]+)", "$dejagnu_output"; + $DejagnuTime = $DejagnuTimeU+$DejagnuTimeS; # DejagnuTime = User+System + $DejagnuWallTime = GetRegexNum "^real", 0,"([0-9.]+)","$dejagnu_output"; + $DejagnuTestResults = "Dejagnu skipped by user choice." unless $DejagnuTestResults; + $DejagnuTime = "0.0" unless $DejagnuTime; + $DejagnuWallTime = "0.0" unless $DejagnuWallTime; + + if ($DEBUG) { + print $DejagnuTestResults; + } + + ############################################################## + # + # Get warnings from the build + # + ############################################################## + if(!$NODEJAGNU){ + + if ( $VERBOSE ) { print "BUILD INFORMATION COLLECTION STAGE\n"; } + my @Warn = split "\n", `egrep 'warning:|Entering dir' $BuildLog`; + my @Warnings; + my $CurDir = ""; + + foreach $Warning (@Warn) { + if ($Warning =~ m/Entering directory \`([^\`]+)\'/) { + $CurDir = $1; # Keep track of directory warning is in... + if ($CurDir =~ m#$BuildDir/llvm/(.*)#) { # Remove buildir prefix if included + $CurDir = $1; + } + } else { + push @Warnings, "$CurDir/$Warning"; # Add directory to warning... + } + } + my $WarningsFile = join "\n", @Warnings; + $WarningsFile =~ s/:[0-9]+:/::/g; + + # Emit the warnings file, so we can diff... + WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n"; + my ($WarningsAdded, $WarningsRemoved) = DiffFiles "$Prefix-Warnings.txt"; + + # Output something to stdout if something has changed + #print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded); + #print "REMOVED WARNINGS:\n$WarningsRemoved\n\n" if (length $WarningsRemoved); + + #my @TmpWarningsAdded = split "\n", $WarningsAdded; ~PJ on upgrade + #my @TmpWarningsRemoved = split "\n", $WarningsRemoved; ~PJ on upgrade + + } #endif !NODEGAGNU + + ############################################################## + # + # If we built the tree successfully, run the nightly programs tests... + # + # A set of tests to run is passed in (i.e. "SingleSource" "MultiSource" "External") + # + ############################################################## + sub TestDirectory { + my $SubDir = shift; + + ChangeDir( "projects/llvm-test/$SubDir", "Programs Test Subdirectory" ); + + my $ProgramTestLog = "$Prefix-$SubDir-ProgramTest.txt"; + #my $ProgramTestLog = "$Prefix-MultiSource-ProgramTest.txt"; #CHANGE ME! + + # Run the programs tests... creating a report.nightly.csv file + if (!$NOTEST) { + print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv " + . "TEST=nightly > $ProgramTestLog 2>&1\n"; + system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv " + . "TEST=nightly > $ProgramTestLog 2>&1"; + $llcbeta_options=`make print-llcbeta-option`; + } + + my $ProgramsTable; + if (`grep '^make[^:]: .*Error' $ProgramTestLog | wc -l` + 0){ + $TestError = 1; + $ProgramsTable="Error running test $SubDir\n"; + print "ERROR TESTING\n"; + } elsif (`grep '^make[^:]: .*No rule to make target' $ProgramTestLog | wc -l` + 0) { + $TestError = 1; + $ProgramsTable="Makefile error running tests $SubDir!\n"; + print "ERROR TESTING\n"; + } else { + $TestError = 0; + + # + # Create a list of the tests which were run... + # + system "egrep 'TEST-(PASS|FAIL)' < $ProgramTestLog " + . "| sort > $Prefix-multisourceprogramstable.txt"; + } + $ProgramsTable = ReadFile "report.nightly.csv"; + + ChangeDir( "../../..", "Programs Test Parent Directory" ); + return ($ProgramsTable, $llcbeta_options); + } + + $patrickjenkins=1; + if(!$patrickjenkins){ + if ( $VERBOSE ) { + print "Modified Multisource Olden test stage\n"; + } + ($MultiSourceProgramsTable, $multisource_llcbeta_options) = TestDirectory("MultiSource/"); + ChangeDir( "../../..", "Programs Test Parent Directory" ); + + + WriteFile "$WebDir/multisourceprogramstable.txt", $MultiSourceProgramsTable; + } + if (!$BuildError && $patrickjenkins) { + if ( $VERBOSE ) { + print "SingleSource TEST STAGE\n"; + } + ($SingleSourceProgramsTable, $singlesource_llcbeta_options) = TestDirectory("SingleSource"); + WriteFile "$Prefix-singlesourceprogramstable.txt", $SingleSourceProgramsTable; + if ( $VERBOSE ) { + print "MultiSource TEST STAGE\n"; + } + ($MultiSourceProgramsTable, $multisource_llcbeta_options) = TestDirectory("MultiSource"); + WriteFile "$Prefix-multisourceprogramstable.txt", $MultiSourceProgramsTable; + if ( ! $NOEXTERNALS ) { + if ( $VERBOSE ) { + print "External TEST STAGE\n"; + } + ($ExternalProgramsTable, $externalsource_llcbeta_options) = TestDirectory("External"); + system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ". + " $Prefix-externalprogramstable.txt | sort > $Prefix-Tests.txt"; + } else { + $ExternalProgramsTable = "External TEST STAGE SKIPPED\n"; + if ( $VERBOSE ) { + print "External TEST STAGE SKIPPED\n"; + } + system "cat $Prefix-singlesourceprogramstable.txt $Prefix-multisourceprogramstable.txt ". + " | sort > $Prefix-Tests.txt"; + } + WriteFile "$Prefix-externalprogramstable.txt", $ExternalProgramsTable; + + } + + ############################################################## + # + # + # gathering tests added removed broken information here + # + # + ############################################################## + my ($TestsAdded, $TestsRemoved, $TestsFixed, $TestsBroken) = ("","","",""); + + if ($TestError) { + $TestsAdded = "error testing
"; + $TestsRemoved = "error testing
"; + $TestsFixed = "error testing
"; + $TestsBroken = "error testing
"; + } else { + my ($RTestsAdded, $RTestsRemoved) = DiffFiles "$Prefix-Tests.txt"; + + my @RawTestsAddedArray = split '\n', $RTestsAdded; + my @RawTestsRemovedArray = split '\n', $RTestsRemoved; + + my %OldTests = map {GetRegex('TEST-....: (.+)', $_)=>$_} + @RawTestsRemovedArray; + my %NewTests = map {GetRegex('TEST-....: (.+)', $_)=>$_} + @RawTestsAddedArray; + + foreach $Test (keys %NewTests) { + if (!exists $OldTests{$Test}) { # TestAdded if in New but not old + $TestsAdded = "$TestsAdded$Test\n"; + } else { + if ($OldTests{$Test} =~ /TEST-PASS/) { # Was the old one a pass? + $TestsBroken = "$TestsBroken$Test\n"; # New one must be a failure + } else { + $TestsFixed = "$TestsFixed$Test\n"; # No, new one is a pass. + } + } + } + foreach $Test (keys %OldTests) { # TestRemoved if in Old but not New + $TestsRemoved = "$TestsRemoved$Test\n" if (!exists $NewTests{$Test}); + } + + #print "\nTESTS ADDED: \n\n$TestsAdded\n\n" if (length $TestsAdded); + #print "\nTESTS REMOVED:\n\n$TestsRemoved\n\n" if (length $TestsRemoved); + #print "\nTESTS FIXED: \n\n$TestsFixed\n\n" if (length $TestsFixed); + #print "\nTESTS BROKEN: \n\n$TestsBroken\n\n" if (length $TestsBroken); + + #$TestsAdded = AddPreTag $TestsAdded; + #$TestsRemoved = AddPreTag $TestsRemoved; + #$TestsFixed = AddPreTag $TestsFixed; + #$TestsBroken = AddPreTag $TestsBroken; + } + + ############################################################## + # + # If we built the tree successfully, runs of the Olden suite with + # LARGE_PROBLEM_SIZE on so that we can get some "running" statistics. + # + ############################################################## + if (!$BuildError) { + if ( $VERBOSE ) { print "OLDEN TEST SUITE STAGE\n"; } + my ($NATTime, $CBETime, $LLCTime, $JITTime, $OptTime, $BytecodeSize, + $MachCodeSize) = ("","","","","","",""); + if (!$NORUNNINGTESTS) { + ChangeDir( "$BuildDir/llvm/projects/llvm-test/MultiSource/Benchmarks/Olden", + "Olden Test Directory"); + + # Clean out previous results... + system "$NICE make $MAKEOPTS clean > /dev/null 2>&1"; + + # Run the nightly test in this directory, with LARGE_PROBLEM_SIZE and + # GET_STABLE_NUMBERS enabled! + if( $VERBOSE ) { print "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " . + " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1\n"; } + system "make -k $MAKEOPTS $PROGTESTOPTS report.nightly.csv.out TEST=nightly " . + " LARGE_PROBLEM_SIZE=1 GET_STABLE_NUMBERS=1 > /dev/null 2>&1"; + system "cp report.nightly.csv $OldenTestsLog"; + } #else { + #system "gunzip ${OldenTestsLog}.gz"; + #} + + # Now we know we have $OldenTestsLog as the raw output file. Split + # it up into records and read the useful information. + #my @Records = split />>> ========= /, ReadFile "$OldenTestsLog"; + #shift @Records; # Delete the first (garbage) record + + # Loop over all of the records, summarizing them into rows for the running + # totals file. + #my $WallTimeRE = "Time: ([0-9.]+) seconds \\([0-9.]+ wall clock"; + #foreach $Rec (@Records) { + #my $rNATTime = GetRegex 'TEST-RESULT-nat-time: program\s*([.0-9m]+)', $Rec; + #my $rCBETime = GetRegex 'TEST-RESULT-cbe-time: program\s*([.0-9m]+)', $Rec; + #my $rLLCTime = GetRegex 'TEST-RESULT-llc-time: program\s*([.0-9m]+)', $Rec; + #my $rJITTime = GetRegex 'TEST-RESULT-jit-time: program\s*([.0-9m]+)', $Rec; + #my $rOptTime = GetRegex "TEST-RESULT-compile: .*$WallTimeRE", $Rec; + #my $rBytecodeSize = GetRegex 'TEST-RESULT-compile: *([0-9]+)', $Rec; + + #$NATTime .= " " . FormatTime($rNATTime); + #$CBETime .= " " . FormatTime($rCBETime); + #$LLCTime .= " " . FormatTime($rLLCTime); + #$JITTime .= " " . FormatTime($rJITTime); + #$OptTime .= " $rOptTime"; + #$BytecodeSize .= " $rBytecodeSize"; + #} + # + # Now that we have all of the numbers we want, add them to the running totals + # files. + #AddRecord($NATTime, "running_Olden_nat_time.txt", $WebDir); + #AddRecord($CBETime, "running_Olden_cbe_time.txt", $WebDir); + #AddRecord($LLCTime, "running_Olden_llc_time.txt", $WebDir); + #AddRecord($JITTime, "running_Olden_jit_time.txt", $WebDir); + #AddRecord($OptTime, "running_Olden_opt_time.txt", $WebDir); + #AddRecord($BytecodeSize, "running_Olden_bytecode.txt", $WebDir); + } + + + ############################################################## + # + # Place all the logs neatly into one humungous file + # + ############################################################## + + if ( $VERBOSE ) { print "PREPARING LOGS TO BE SENT TO SERVER\n"; } + + $machine_data = "uname: ".`uname -a`. + "hardware: ".`uname -m`. + "os: ".`uname -sr`. + "name: ".`uname -n`. + "date: ".`date \"+20%y-%m-%d\"`. + "time: ".`date +\"%H:%M:%S\"`; + + my @CVS_DATA; + my $cvs_data; + @CVS_DATA = ReadFile "$CVSLog"; + $cvs_data = join("\n", @CVS_DATA); + + my @BUILD_DATA; + my $build_data; + @BUILD_DATA = ReadFile "$BuildLog"; + $build_data = join("\n", @BUILD_DATA); + + my @DEJAGNU_LOG; + my @DEJAGNU_SUM; + my $dejagnutests_log; + my $dejagnutests_sum; + @DEJAGNU_LOG = ReadFile "$DejagnuLog"; + @DEJAGNU_SUM = ReadFile "$DejagnuSum"; + $dejagnutests_log = join("\n", @DEJAGNU_LOG); + $dejagnutests_sum = join("\n", @DEJAGNU_SUM); + + my @DEJAGNULOG_FULL; + my $dejagnulog_full; + @DEJAGNULOG_FULL = ReadFile "$DejagnuTestsLog"; + $dejagnulog_full = join("\n", @DEJAGNULOG_FULL); + + my $gcc_version_long = `gcc --version`; + @GCC_VERSION = split "\n", $gcc_version_long; + my $gcc_version = $GCC_VERSION[0]; + + ############################################################## + # + # Send data via a post request + # + ############################################################## + + if ( $VERBOSE ) { print "SEND THE DATA VIA THE POST REQUEST\n"; } + + + my $host = "llvm.org"; + my $file = "/nightlytest/NightlyTestAccept.cgi"; + my %hash_of_data = ('machine_data' => $machine_data, + 'build_data' => $build_data, + 'gcc_version' => $gcc_version, + 'nickname' => $nickname, + 'dejagnutime_wall' => $DejagnuWallTime, + 'dejagnutime_cpu' => $DejagnuTime, + 'cvscheckouttime_wall' => $CVSCheckoutTime_Wall, + 'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU, + 'configtime_wall' => $ConfigWallTime, + 'configtime_cpu'=> $ConfigTime, + 'buildtime_wall' => $BuildWallTime, + 'buildtime_cpu' => $BuildTime, + 'warnings' => $WarningsFile, + 'cvsusercommitlist' => $UserCommitList, + 'cvsuserupdatelist' => $UserUpdateList, + 'cvsaddedfiles' => $CVSAddedFiles, + 'cvsmodifiedfiles' => $CVSModifiedFiles, + 'cvsremovedfiles' => $CVSRemovedFiles, + 'lines_of_code' => $LOC, + 'cvs_file_count' => $NumFilesInCVS, + 'cvs_dir_count' => $NumDirsInCVS, + 'buildstatus' => $BuildStatus, + 'singlesource_programstable' => $SingleSourceProgramsTable, + 'multisource_programstable' => $MultiSourceProgramsTable, + 'externalsource_programstable' => $ExternalSourceProgramsTable, + 'llcbeta_options' => $multisource_llcbeta_options, + 'warnings_removed' => $WarningsRemoved, + 'warnings_added' => $WarningsAdded, + 'newly_passing_tests' => $TestsFixed, + 'newly_failing_tests' => $TestsBroken, + 'new_tests' => $TestsAdded, + 'removed_tests' => $TestsRemoved, + 'unexpfail_tests' => $unexpfail_tests, + 'dejagnutests_log' => $dejagnutests_log, + 'dejagnutests_sum' => $dejagnutests_sum); + + $TESTING = 0; + + if($TESTING){ + print "============================\n"; + foreach $x(keys %hash_of_data){ + print "$x => $hash_of_data{$x}\n"; + } + } + else{ + my $response = SendData $host,$file,\%hash_of_data; + print "============================\n$response"; + } + + ############################################################## + # + # Remove the cvs tree... + # + ############################################################## + system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE); + + From lattner at cs.uiuc.edu Thu Jul 6 16:35:15 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 16:35:15 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.h ReaderWrappers.cpp Message-ID: <200607062135.QAA30062@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.h updated: 1.28 -> 1.29 ReaderWrappers.cpp updated: 1.54 -> 1.55 --- Log message: Change the ModuleProvider interface to not throw exceptions. --- Diffs of the changes: (+32 -19) Reader.h | 25 ++++++++++++++++++++----- ReaderWrappers.cpp | 26 ++++++++++++-------------- 2 files changed, 32 insertions(+), 19 deletions(-) Index: llvm/lib/Bytecode/Reader/Reader.h diff -u llvm/lib/Bytecode/Reader/Reader.h:1.28 llvm/lib/Bytecode/Reader/Reader.h:1.29 --- llvm/lib/Bytecode/Reader/Reader.h:1.28 Fri Jan 27 05:49:27 2006 +++ llvm/lib/Bytecode/Reader/Reader.h Thu Jul 6 16:35:01 2006 @@ -153,18 +153,33 @@ /// implementation is identical to the ParseFunction method. /// @see ParseFunction /// @brief Make a specific function materialize. - virtual void materializeFunction(Function *F) { + virtual bool materializeFunction(Function *F, std::string *ErrInfo = 0) { LazyFunctionMap::iterator Fi = LazyFunctionLoadMap.find(F); - if (Fi == LazyFunctionLoadMap.end()) return; - ParseFunction(F); + if (Fi == LazyFunctionLoadMap.end()) return false; + try { + ParseFunction(F); + } catch (std::string &ErrStr) { + if (ErrInfo) *ErrInfo = ErrStr; + return true; + } catch (...) { + return true; + } + return false; } /// This method is abstract in the parent ModuleProvider class. Its /// implementation is identical to ParseAllFunctionBodies. /// @see ParseAllFunctionBodies /// @brief Make the whole module materialize - virtual Module* materializeModule() { - ParseAllFunctionBodies(); + virtual Module* materializeModule(std::string *ErrInfo = 0) { + try { + ParseAllFunctionBodies(); + } catch (std::string &ErrStr) { + if (ErrInfo) *ErrInfo = ErrStr; + return 0; + } catch (...) { + return 0; + } return TheModule; } Index: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp diff -u llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.54 llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.55 --- llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.54 Wed Jun 7 18:18:33 2006 +++ llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Thu Jul 6 16:35:01 2006 @@ -170,7 +170,8 @@ // If we get to this point, we know that we have an old-style module. // Materialize the whole thing to perform the rewriting. - MP->materializeModule(); + if (MP->materializeModule() == 0) + return 0; if(Function* F = M->getNamedFunction("llvm.va_start")) { assert(F->arg_size() == 0 && "Obsolete va_start takes 0 argument!"); @@ -376,22 +377,18 @@ // Get just the externally visible defined symbols from the bytecode bool llvm::GetBytecodeSymbols(const sys::Path& fName, std::vector& symbols) { - try { - std::auto_ptr AMP( - getBytecodeModuleProvider(fName.toString())); + std::auto_ptr AMP( + getBytecodeModuleProvider(fName.toString())); - // Get the module from the provider - Module* M = AMP->materializeModule(); + // Get the module from the provider + Module* M = AMP->materializeModule(); + if (M == 0) return false; - // Get the symbols - getSymbols(M, symbols); + // Get the symbols + getSymbols(M, symbols); - // Done with the module - return true; - - } catch (...) { - return false; - } + // Done with the module + return true; } ModuleProvider* @@ -406,6 +403,7 @@ // Get the module from the provider Module* M = MP->materializeModule(); + if (M == 0) return 0; // Get the symbols getSymbols(M, symbols); From lattner at cs.uiuc.edu Thu Jul 6 16:35:16 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 16:35:16 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp Message-ID: <200607062135.QAA30433@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Pass.cpp updated: 1.69 -> 1.70 --- Log message: Change the ModuleProvider interface to not throw exceptions. --- Diffs of the changes: (+2 -6) Pass.cpp | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) Index: llvm/lib/VMCore/Pass.cpp diff -u llvm/lib/VMCore/Pass.cpp:1.69 llvm/lib/VMCore/Pass.cpp:1.70 --- llvm/lib/VMCore/Pass.cpp:1.69 Wed Jun 7 15:00:19 2006 +++ llvm/lib/VMCore/Pass.cpp Thu Jul 6 16:35:01 2006 @@ -95,14 +95,10 @@ void FunctionPassManager::add(FunctionPass *P) { PM->add(P); } void FunctionPassManager::add(ImmutablePass *IP) { PM->add(IP); } bool FunctionPassManager::run(Function &F) { - try { - MP->materializeFunction(&F); - } catch (std::string& errstr) { + std::string errstr; + if (MP->materializeFunction(&F, &errstr)) { std::cerr << "Error reading bytecode file: " << errstr << "\n"; abort(); - } catch (...) { - std::cerr << "Error reading bytecode file!\n"; - abort(); } return PM->run(F); } From lattner at cs.uiuc.edu Thu Jul 6 16:35:16 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 16:35:16 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ModuleProvider.h Message-ID: <200607062135.QAA30317@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: ModuleProvider.h updated: 1.11 -> 1.12 --- Log message: Change the ModuleProvider interface to not throw exceptions. --- Diffs of the changes: (+16 -10) ModuleProvider.h | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) Index: llvm/include/llvm/ModuleProvider.h diff -u llvm/include/llvm/ModuleProvider.h:1.11 llvm/include/llvm/ModuleProvider.h:1.12 --- llvm/include/llvm/ModuleProvider.h:1.11 Thu Apr 21 15:11:51 2005 +++ llvm/include/llvm/ModuleProvider.h Thu Jul 6 16:35:01 2006 @@ -18,6 +18,8 @@ #ifndef MODULEPROVIDER_H #define MODULEPROVIDER_H +#include + namespace llvm { class Function; @@ -35,22 +37,24 @@ /// Module* getModule() { return TheModule; } - /// materializeFunction - make sure the given function is fully read. Note - /// that this can throw an exception if the module is corrupt! + /// materializeFunction - make sure the given function is fully read. If the + /// module is corrupt, this returns true and fills in the optional string + /// with information about the problem. If successful, this returns false. /// - virtual void materializeFunction(Function *F) = 0; + virtual bool materializeFunction(Function *F, std::string *ErrInfo = 0) = 0; /// materializeModule - make sure the entire Module has been completely read. - /// Note that this can throw an exception if the module is corrupt! + /// On error, return null and fill in the error string if specified. /// - virtual Module* materializeModule() = 0; + virtual Module* materializeModule(std::string *ErrInfo = 0) = 0; /// releaseModule - no longer delete the Module* when provider is destroyed. - /// Note that this can throw an exception if the module is corrupt! + /// On error, return null and fill in the error string if specified. /// - virtual Module* releaseModule() { + virtual Module* releaseModule(std::string *ErrInfo = 0) { // Since we're losing control of this Module, we must hand it back complete - materializeModule(); + if (materializeModule(ErrInfo)) + return 0; Module *tempM = TheModule; TheModule = 0; return tempM; @@ -66,8 +70,10 @@ ExistingModuleProvider(Module *M) { TheModule = M; } - void materializeFunction(Function *F) {} - Module* materializeModule() { return TheModule; } + bool materializeFunction(Function *F, std::string *ErrInfo = 0) { + return false; + } + Module* materializeModule(std::string *ErrInfo = 0) { return TheModule; } }; } // End llvm namespace From pjenkins at apple.com Thu Jul 6 17:32:28 2006 From: pjenkins at apple.com (Patrick Jenkins) Date: Thu, 6 Jul 2006 17:32:28 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200607062232.RAA07123@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.1 -> 1.2 --- Log message: Fixed a bug that looked for -Warnings.txt and -Tests.txt in ridiculous places. --- Diffs of the changes: (+2 -2) NewNightlyTest.pl | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.1 llvm/utils/NewNightlyTest.pl:1.2 --- llvm/utils/NewNightlyTest.pl:1.1 Thu Jul 6 16:19:32 2006 +++ llvm/utils/NewNightlyTest.pl Thu Jul 6 17:32:15 2006 @@ -697,7 +697,7 @@ # Emit the warnings file, so we can diff... WriteFile "$WebDir/$DATE-Warnings.txt", $WarningsFile . "\n"; -my ($WarningsAdded, $WarningsRemoved) = DiffFiles "$Prefix-Warnings.txt"; +my ($WarningsAdded, $WarningsRemoved) = DiffFiles "-Warnings.txt"; # Output something to stdout if something has changed #print "ADDED WARNINGS:\n$WarningsAdded\n\n" if (length $WarningsAdded); @@ -812,7 +812,7 @@ $TestsFixed = "error testing
"; $TestsBroken = "error testing
"; } else { - my ($RTestsAdded, $RTestsRemoved) = DiffFiles "$Prefix-Tests.txt"; + my ($RTestsAdded, $RTestsRemoved) = DiffFiles "-Tests.txt"; my @RawTestsAddedArray = split '\n', $RTestsAdded; my @RawTestsRemovedArray = split '\n', $RTestsRemoved; From lattner at cs.uiuc.edu Thu Jul 6 17:34:20 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 17:34:20 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/SlowOperationInformer.h Message-ID: <200607062234.RAA07435@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: SlowOperationInformer.h updated: 1.7 -> 1.8 --- Log message: Modify the SlowOperationInformer interface to not throw exceptions. --- Diffs of the changes: (+8 -9) SlowOperationInformer.h | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) Index: llvm/include/llvm/Support/SlowOperationInformer.h diff -u llvm/include/llvm/Support/SlowOperationInformer.h:1.7 llvm/include/llvm/Support/SlowOperationInformer.h:1.8 --- llvm/include/llvm/Support/SlowOperationInformer.h:1.7 Thu May 25 00:59:50 2006 +++ llvm/include/llvm/Support/SlowOperationInformer.h Thu Jul 6 17:34:06 2006 @@ -17,9 +17,7 @@ // appears on the screen (ie, the cursor should be at the start of the line). // // If the user presses CTRL-C during the operation, the next invocation of the -// progress method with throw an std::string object indicating that the -// operation was cancelled. As such, client code must be exception safe around -// the progress method. +// progress method return true indicating that the operation was cancelled. // // Because SlowOperationInformers fiddle around with signals, they cannot be // nested, and interact poorly with threads. The SIGALRM handler is set back to @@ -46,19 +44,20 @@ SlowOperationInformer(const std::string &Name); ~SlowOperationInformer(); - /// progress - Clients should periodically call this method when they are in - /// an exception-safe state. The Amount variable should indicate how far + /// progress - Clients should periodically call this method when they can + /// handle cancellation. The Amount variable should indicate how far /// along the operation is, given in 1/10ths of a percent (in other words, - /// Amount should range from 0 to 1000). - void progress(unsigned Amount); + /// Amount should range from 0 to 1000). If the user cancels the operation, + /// this returns true, false otherwise. + bool progress(unsigned Amount); /// progress - Same as the method above, but this performs the division for /// you, and helps you avoid overflow if you are dealing with largish /// numbers. - void progress(unsigned Current, unsigned Maximum) { + bool progress(unsigned Current, unsigned Maximum) { assert(Maximum != 0 && "Shouldn't be doing work if there is nothing to do!"); - progress(Current*uint64_t(1000UL)/Maximum); + return progress(Current*uint64_t(1000UL)/Maximum); } }; } // end namespace llvm From lattner at cs.uiuc.edu Thu Jul 6 17:34:20 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 17:34:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/Debugger/ProgramInfo.cpp Message-ID: <200607062234.RAA07427@zion.cs.uiuc.edu> Changes in directory llvm/lib/Debugger: ProgramInfo.cpp updated: 1.15 -> 1.16 --- Log message: Modify the SlowOperationInformer interface to not throw exceptions. --- Diffs of the changes: (+4 -2) ProgramInfo.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Debugger/ProgramInfo.cpp diff -u llvm/lib/Debugger/ProgramInfo.cpp:1.15 llvm/lib/Debugger/ProgramInfo.cpp:1.16 --- llvm/lib/Debugger/ProgramInfo.cpp:1.15 Thu Mar 23 12:06:46 2006 +++ llvm/lib/Debugger/ProgramInfo.cpp Thu Jul 6 17:34:06 2006 @@ -280,7 +280,8 @@ // mapping. for (unsigned i = 0, e = TranslationUnits.size(); i != e; ++i) { getSourceFile(TranslationUnits[i]); - SOI.progress(i+1, e); + if (SOI.progress(i+1, e)) + throw "While building source files index, operation cancelled."; } // Ok, if we got this far, then we indexed the whole program. @@ -361,7 +362,8 @@ // Loop over all of the functions found, building the SourceFunctions mapping. for (unsigned i = 0, e = Functions.size(); i != e; ++i) { getFunction(Functions[i]); - SOI.progress(i+1, e); + if (SOI.progress(i+1, e)) + throw "While functions index, operation cancelled."; } // Ok, if we got this far, then we indexed the whole program. From lattner at cs.uiuc.edu Thu Jul 6 17:34:20 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 17:34:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/SlowOperationInformer.cpp Message-ID: <200607062234.RAA07431@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: SlowOperationInformer.cpp updated: 1.7 -> 1.8 --- Log message: Modify the SlowOperationInformer interface to not throw exceptions. --- Diffs of the changes: (+4 -3) SlowOperationInformer.cpp | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/lib/Support/SlowOperationInformer.cpp diff -u llvm/lib/Support/SlowOperationInformer.cpp:1.7 llvm/lib/Support/SlowOperationInformer.cpp:1.8 --- llvm/lib/Support/SlowOperationInformer.cpp:1.7 Wed Dec 21 21:31:26 2005 +++ llvm/lib/Support/SlowOperationInformer.cpp Thu Jul 6 17:34:06 2006 @@ -37,18 +37,18 @@ /// an exception-safe state. The Amount variable should indicate how far /// along the operation is, given in 1/10ths of a percent (in other words, /// Amount should range from 0 to 1000). -void SlowOperationInformer::progress(unsigned Amount) { +bool SlowOperationInformer::progress(unsigned Amount) { int status = sys::AlarmStatus(); if (status == -1) { std::cout << "\n"; LastPrintAmount = 0; - throw "While " + OperationName + ", operation cancelled."; + return true; } // If we haven't spent enough time in this operation to warrant displaying the // progress bar, don't do so yet. if (status == 0) - return; + return false; // Delete whatever we printed last time. std::string ToPrint = std::string(LastPrintAmount, '\b'); @@ -62,4 +62,5 @@ LastPrintAmount = OS.str().size(); std::cout << ToPrint+OS.str() << std::flush; + return false; } From lattner at cs.uiuc.edu Thu Jul 6 18:49:09 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 18:49:09 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm2cpp/Makefile llvm2cpp.cpp Message-ID: <200607062349.SAA28763@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm2cpp: Makefile updated: 1.5 -> 1.6 llvm2cpp.cpp updated: 1.4 -> 1.5 --- Log message: Fix PR819: http://llvm.org/PR819 , llvm2cpp should read .bc files, not .ll files. --- Diffs of the changes: (+56 -83) Makefile | 5 -- llvm2cpp.cpp | 134 +++++++++++++++++++++++------------------------------------ 2 files changed, 56 insertions(+), 83 deletions(-) Index: llvm/tools/llvm2cpp/Makefile diff -u llvm/tools/llvm2cpp/Makefile:1.5 llvm/tools/llvm2cpp/Makefile:1.6 --- llvm/tools/llvm2cpp/Makefile:1.5 Thu Jun 1 19:39:08 2006 +++ llvm/tools/llvm2cpp/Makefile Thu Jul 6 18:48:57 2006 @@ -1,4 +1,4 @@ -##===- tools/llvm-as/Makefile ------------------------------*- Makefile -*-===## +##===- tools/llvm2cpp/Makefile -----------------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -8,8 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. TOOLNAME = llvm2cpp -USEDLIBS = LLVMAsmParser.a LLVMBCWriter.a LLVMCore.a \ - LLVMSupport.a LLVMbzip2.a LLVMSystem.a +USEDLIBS = LLVMBCReader.a LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a include $(LEVEL)/Makefile.common Index: llvm/tools/llvm2cpp/llvm2cpp.cpp diff -u llvm/tools/llvm2cpp/llvm2cpp.cpp:1.4 llvm/tools/llvm2cpp/llvm2cpp.cpp:1.5 --- llvm/tools/llvm2cpp/llvm2cpp.cpp:1.4 Thu Jul 6 13:01:01 2006 +++ llvm/tools/llvm2cpp/llvm2cpp.cpp Thu Jul 6 18:48:57 2006 @@ -17,8 +17,7 @@ //===------------------------------------------------------------------------=== #include "llvm/Module.h" -#include "llvm/Assembly/Parser.h" -#include "llvm/Bytecode/Writer.h" +#include "llvm/Bytecode/Reader.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/SystemUtils.h" @@ -31,7 +30,7 @@ using namespace llvm; static cl::opt -InputFilename(cl::Positional, cl::desc(""), +InputFilename(cl::Positional, cl::desc(""), cl::init("-")); static cl::opt @@ -41,100 +40,75 @@ static cl::opt Force("f", cl::desc("Overwrite output files")); -static cl::opt -DisableVerify("disable-verify", cl::Hidden, - cl::desc("Do not run verifier on input LLVM (dangerous!)")); - int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, " llvm .ll -> .cpp assembler\n"); sys::PrintStackTraceOnErrorSignal(); int exitCode = 0; std::ostream *Out = 0; - try { - // Parse the file now... - std::auto_ptr M(ParseAssemblyFile(InputFilename)); - if (M.get() == 0) { - std::cerr << argv[0] << ": assembly didn't read correctly.\n"; - return 1; - } + std::string ErrorMessage; + std::auto_ptr M(ParseBytecodeFile(InputFilename, &ErrorMessage)); + if (M.get() == 0) { + std::cerr << argv[0] << ": "; + if (ErrorMessage.size()) + std::cerr << ErrorMessage << "\n"; + else + std::cerr << "bytecode didn't read correctly.\n"; + return 1; + } - // FIXME: llvm2cpp should read .bc files and thus not run the verifier - // explicitly! - if (!DisableVerify) { - std::string Err; - if (verifyModule(*M.get(), ReturnStatusAction, &Err)) { - std::cerr << argv[0] - << ": assembly parsed, but does not verify as correct!\n"; - std::cerr << Err; + if (OutputFilename != "") { // Specified an output filename? + if (OutputFilename != "-") { // Not stdout? + if (!Force && std::ifstream(OutputFilename.c_str())) { + // If force is not specified, make sure not to overwrite a file! + std::cerr << argv[0] << ": error opening '" << OutputFilename + << "': file exists!\n" + << "Use -f command line argument to force output\n"; return 1; - } - } - - if (OutputFilename != "") { // Specified an output filename? - if (OutputFilename != "-") { // Not stdout? - if (!Force && std::ifstream(OutputFilename.c_str())) { - // If force is not specified, make sure not to overwrite a file! - std::cerr << argv[0] << ": error opening '" << OutputFilename - << "': file exists!\n" - << "Use -f command line argument to force output\n"; - return 1; - } - Out = new std::ofstream(OutputFilename.c_str(), std::ios::out | - std::ios::trunc | std::ios::binary); - } else { // Specified stdout - // FIXME: cout is not binary! - Out = &std::cout; } + Out = new std::ofstream(OutputFilename.c_str(), std::ios::out | + std::ios::trunc | std::ios::binary); + } else { // Specified stdout + Out = &std::cout; + } + } else { + if (InputFilename == "-") { + OutputFilename = "-"; + Out = &std::cout; } else { - if (InputFilename == "-") { - OutputFilename = "-"; - Out = &std::cout; + std::string IFN = InputFilename; + int Len = IFN.length(); + if (IFN[Len-3] == '.' && IFN[Len-2] == 'l' && IFN[Len-1] == 'l') { + // Source ends in .ll + OutputFilename = std::string(IFN.begin(), IFN.end()-3); } else { - std::string IFN = InputFilename; - int Len = IFN.length(); - if (IFN[Len-3] == '.' && IFN[Len-2] == 'l' && IFN[Len-1] == 'l') { - // Source ends in .ll - OutputFilename = std::string(IFN.begin(), IFN.end()-3); - } else { - OutputFilename = IFN; // Append a .cpp to it - } - OutputFilename += ".cpp"; - - if (!Force && std::ifstream(OutputFilename.c_str())) { - // If force is not specified, make sure not to overwrite a file! - std::cerr << argv[0] << ": error opening '" << OutputFilename - << "': file exists!\n" - << "Use -f command line argument to force output\n"; - return 1; - } - - Out = new std::ofstream(OutputFilename.c_str(), std::ios::out | - std::ios::trunc | std::ios::binary); - // Make sure that the Out file gets unlinked from the disk if we get a - // SIGINT - sys::RemoveFileOnSignal(sys::Path(OutputFilename)); + OutputFilename = IFN; // Append a .cpp to it } - } + OutputFilename += ".cpp"; - if (!Out->good()) { - std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; - return 1; - } + if (!Force && std::ifstream(OutputFilename.c_str())) { + // If force is not specified, make sure not to overwrite a file! + std::cerr << argv[0] << ": error opening '" << OutputFilename + << "': file exists!\n" + << "Use -f command line argument to force output\n"; + return 1; + } - WriteModuleToCppFile(M.get(), *Out); + Out = new std::ofstream(OutputFilename.c_str(), std::ios::out | + std::ios::trunc | std::ios::binary); + // Make sure that the Out file gets unlinked from the disk if we get a + // SIGINT + sys::RemoveFileOnSignal(sys::Path(OutputFilename)); + } + } - } catch (const ParseException &E) { - std::cerr << argv[0] << ": " << E.getMessage() << "\n"; - exitCode = 1; - } catch (const std::string& msg) { - std::cerr << argv[0] << ": " << msg << "\n"; - exitCode = 1; - } catch (...) { - std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; - exitCode = 1; + if (!Out->good()) { + std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; + return 1; } + WriteModuleToCppFile(M.get(), *Out); + if (Out != &std::cout) delete Out; return exitCode; } From lattner at cs.uiuc.edu Thu Jul 6 19:01:13 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:01:13 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ModuleProvider.h Message-ID: <200607070001.TAA29065@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: ModuleProvider.h updated: 1.12 -> 1.13 --- Log message: Fix an embarassing bug reid noticed --- Diffs of the changes: (+1 -1) ModuleProvider.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/ModuleProvider.h diff -u llvm/include/llvm/ModuleProvider.h:1.12 llvm/include/llvm/ModuleProvider.h:1.13 --- llvm/include/llvm/ModuleProvider.h:1.12 Thu Jul 6 16:35:01 2006 +++ llvm/include/llvm/ModuleProvider.h Thu Jul 6 19:01:01 2006 @@ -53,7 +53,7 @@ /// virtual Module* releaseModule(std::string *ErrInfo = 0) { // Since we're losing control of this Module, we must hand it back complete - if (materializeModule(ErrInfo)) + if (!materializeModule(ErrInfo)) return 0; Module *tempM = TheModule; TheModule = 0; From lattner at cs.uiuc.edu Thu Jul 6 19:20:54 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:20:54 -0500 Subject: [llvm-commits] CVS: llvm/projects/Stacker/tools/stkrc/Makefile Message-ID: <200607070020.TAA20977@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/tools/stkrc: Makefile updated: 1.11 -> 1.12 --- Log message: Stacker uses EH. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/projects/Stacker/tools/stkrc/Makefile diff -u llvm/projects/Stacker/tools/stkrc/Makefile:1.11 llvm/projects/Stacker/tools/stkrc/Makefile:1.12 --- llvm/projects/Stacker/tools/stkrc/Makefile:1.11 Wed May 31 20:30:26 2006 +++ llvm/projects/Stacker/tools/stkrc/Makefile Thu Jul 6 19:20:39 2006 @@ -15,6 +15,7 @@ CONFIG_FILES = st EXTRA_DIST = st USEDLIBS=stkr_compiler +REQUIRES_EH := 1 ifdef PARSE_DEBUG From lattner at cs.uiuc.edu Thu Jul 6 19:20:54 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:20:54 -0500 Subject: [llvm-commits] CVS: llvm/projects/Stacker/lib/compiler/Makefile Message-ID: <200607070020.TAA20976@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/lib/compiler: Makefile updated: 1.8 -> 1.9 --- Log message: Stacker uses EH. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/projects/Stacker/lib/compiler/Makefile diff -u llvm/projects/Stacker/lib/compiler/Makefile:1.8 llvm/projects/Stacker/lib/compiler/Makefile:1.9 --- llvm/projects/Stacker/lib/compiler/Makefile:1.8 Fri Jun 2 13:21:11 2006 +++ llvm/projects/Stacker/lib/compiler/Makefile Thu Jul 6 19:20:39 2006 @@ -4,6 +4,7 @@ LIBRARYNAME := stkr_compiler EXTRA_DIST := Lexer.cpp.cvs Lexer.l.cvs \ StackerParser.cpp.cvs StackerParser.h.cvs StackerParser.y.cvs +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:21:29 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:21:29 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/Makefile Message-ID: <200607070021.TAA21216@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: Makefile updated: 1.18 -> 1.19 --- Log message: tblgen uses EH --- Diffs of the changes: (+2 -0) Makefile | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/utils/TableGen/Makefile diff -u llvm/utils/TableGen/Makefile:1.18 llvm/utils/TableGen/Makefile:1.19 --- llvm/utils/TableGen/Makefile:1.18 Thu Jun 1 13:20:23 2006 +++ llvm/utils/TableGen/Makefile Thu Jul 6 19:21:17 2006 @@ -6,11 +6,13 @@ # the University of Illinois Open Source License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## + LEVEL = ../.. TOOLNAME = tblgen USEDLIBS = LLVMSupport.a LLVMSystem.a EXTRA_DIST = FileLexer.cpp.cvs FileLexer.l.cvs \ FileParser.cpp.cvs FileParser.h.cvs FileParser.y.cvs +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:46 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:46 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-ranlib/Makefile Message-ID: <200607070046.TAA29106@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ranlib: Makefile updated: 1.4 -> 1.5 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-ranlib/Makefile diff -u llvm/tools/llvm-ranlib/Makefile:1.4 llvm/tools/llvm-ranlib/Makefile:1.5 --- llvm/tools/llvm-ranlib/Makefile:1.4 Wed May 31 20:30:27 2006 +++ llvm/tools/llvm-ranlib/Makefile Thu Jul 6 19:46:19 2006 @@ -11,5 +11,6 @@ TOOLNAME = llvm-ranlib USEDLIBS = LLVMArchive.a LLVMBCReader.a \ LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:47 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:47 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-db/Makefile Message-ID: <200607070046.TAA29110@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-db: Makefile updated: 1.10 -> 1.11 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-db/Makefile diff -u llvm/tools/llvm-db/Makefile:1.10 llvm/tools/llvm-db/Makefile:1.11 --- llvm/tools/llvm-db/Makefile:1.10 Wed May 31 20:30:26 2006 +++ llvm/tools/llvm-db/Makefile Thu Jul 6 19:46:18 2006 @@ -11,5 +11,6 @@ TOOLNAME = llvm-db USEDLIBS = LLVMDebugger LLVMBCReader.a LLVMCore.a LLVMSupport.a \ LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:48 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:48 -0500 Subject: [llvm-commits] CVS: llvm/tools/gccas/Makefile Message-ID: <200607070046.TAA29118@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccas: Makefile updated: 1.25 -> 1.26 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/gccas/Makefile diff -u llvm/tools/gccas/Makefile:1.25 llvm/tools/gccas/Makefile:1.26 --- llvm/tools/gccas/Makefile:1.25 Wed May 31 20:30:26 2006 +++ llvm/tools/gccas/Makefile Thu Jul 6 19:46:18 2006 @@ -12,5 +12,6 @@ USEDLIBS = LLVMAsmParser.a LLVMBCWriter.a LLVMTransforms.a LLVMipo.a LLVMipa.a \ LLVMScalarOpts.a LLVMAnalysis.a LLVMTarget.a LLVMTransformUtils.a \ LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:48 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:48 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/Makefile Message-ID: <200607070046.TAA29114@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ld: Makefile updated: 1.8 -> 1.9 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-ld/Makefile diff -u llvm/tools/llvm-ld/Makefile:1.8 llvm/tools/llvm-ld/Makefile:1.9 --- llvm/tools/llvm-ld/Makefile:1.8 Wed May 31 20:30:27 2006 +++ llvm/tools/llvm-ld/Makefile Thu Jul 6 19:46:18 2006 @@ -14,5 +14,6 @@ LLVMipa.a LLVMTransformUtils.a LLVMTarget.a LLVMLinker.a \ LLVMArchive.a LLVMBCReader.a LLVMBCWriter.a \ LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:48 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:48 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvmc/Makefile Message-ID: <200607070046.TAA29116@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: Makefile updated: 1.19 -> 1.20 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvmc/Makefile diff -u llvm/tools/llvmc/Makefile:1.19 llvm/tools/llvmc/Makefile:1.20 --- llvm/tools/llvmc/Makefile:1.19 Wed Jun 21 12:26:13 2006 +++ llvm/tools/llvmc/Makefile Thu Jul 6 19:46:19 2006 @@ -11,6 +11,7 @@ USEDLIBS = LLVMCore.a LLVMSupport.a LLVMSystem.a CONFIG_FILES = c cpp ll EXTRA_DIST = c cpp ll ConfigLexer.cpp.cvs ConfigLexer.l.cvs +REQUIRES_EH := 1 # The CompilerDriver needs to know the locations of several configured # directories and paths. We define these as preprocessor symbols so they can From lattner at cs.uiuc.edu Thu Jul 6 19:46:48 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:48 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-extract/Makefile Message-ID: <200607070046.TAA29120@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-extract: Makefile updated: 1.4 -> 1.5 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-extract/Makefile diff -u llvm/tools/llvm-extract/Makefile:1.4 llvm/tools/llvm-extract/Makefile:1.5 --- llvm/tools/llvm-extract/Makefile:1.4 Wed May 31 20:30:27 2006 +++ llvm/tools/llvm-extract/Makefile Thu Jul 6 19:46:18 2006 @@ -12,5 +12,6 @@ USEDLIBS = LLVMBCReader.a LLVMBCWriter.a LLVMTransforms.a LLVMipo.a \ LLVMTarget.a LLVMAnalysis.a LLVMTransformUtils.a LLVMipa.a \ LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:49 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:49 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-nm/Makefile Message-ID: <200607070046.TAA29130@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-nm: Makefile updated: 1.7 -> 1.8 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+2 -0) Makefile | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/tools/llvm-nm/Makefile diff -u llvm/tools/llvm-nm/Makefile:1.7 llvm/tools/llvm-nm/Makefile:1.8 --- llvm/tools/llvm-nm/Makefile:1.7 Wed May 31 20:30:27 2006 +++ llvm/tools/llvm-nm/Makefile Thu Jul 6 19:46:18 2006 @@ -11,4 +11,6 @@ TOOLNAME = llvm-nm USEDLIBS = LLVMArchive.a LLVMBCReader.a \ LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 + include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:49 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:49 -0500 Subject: [llvm-commits] CVS: llvm/tools/analyze/Makefile Message-ID: <200607070046.TAA29134@zion.cs.uiuc.edu> Changes in directory llvm/tools/analyze: Makefile updated: 1.31 -> 1.32 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/analyze/Makefile diff -u llvm/tools/analyze/Makefile:1.31 llvm/tools/analyze/Makefile:1.32 --- llvm/tools/analyze/Makefile:1.31 Wed May 31 20:30:26 2006 +++ llvm/tools/analyze/Makefile Thu Jul 6 19:46:18 2006 @@ -12,5 +12,6 @@ LLVMDataStructure \ LLVMScalarOpts.a LLVMTransforms.a LLVMTarget.a LLVMScalarOpts.a \ LLVMTransformUtils.a LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:49 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:49 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-prof/Makefile Message-ID: <200607070046.TAA29138@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-prof: Makefile updated: 1.7 -> 1.8 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-prof/Makefile diff -u llvm/tools/llvm-prof/Makefile:1.7 llvm/tools/llvm-prof/Makefile:1.8 --- llvm/tools/llvm-prof/Makefile:1.7 Wed May 31 20:30:27 2006 +++ llvm/tools/llvm-prof/Makefile Thu Jul 6 19:46:18 2006 @@ -11,5 +11,6 @@ TOOLNAME = llvm-prof USEDLIBS = LLVMAnalysis.a LLVMBCReader.a \ LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:50 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:50 -0500 Subject: [llvm-commits] CVS: llvm/tools/gccld/Makefile Message-ID: <200607070046.TAA29146@zion.cs.uiuc.edu> Changes in directory llvm/tools/gccld: Makefile updated: 1.15 -> 1.16 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/gccld/Makefile diff -u llvm/tools/gccld/Makefile:1.15 llvm/tools/gccld/Makefile:1.16 --- llvm/tools/gccld/Makefile:1.15 Wed May 31 20:30:26 2006 +++ llvm/tools/gccld/Makefile Thu Jul 6 19:46:18 2006 @@ -14,5 +14,6 @@ LLVMipa.a LLVMTransformUtils.a LLVMTarget.a LLVMLinker.a \ LLVMArchive.a LLVMBCReader.a LLVMBCWriter.a \ LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:49 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:49 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-bcanalyzer/Makefile Message-ID: <200607070046.TAA29140@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-bcanalyzer: Makefile updated: 1.5 -> 1.6 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+2 -0) Makefile | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/tools/llvm-bcanalyzer/Makefile diff -u llvm/tools/llvm-bcanalyzer/Makefile:1.5 llvm/tools/llvm-bcanalyzer/Makefile:1.6 --- llvm/tools/llvm-bcanalyzer/Makefile:1.5 Wed May 31 20:30:26 2006 +++ llvm/tools/llvm-bcanalyzer/Makefile Thu Jul 6 19:46:18 2006 @@ -10,4 +10,6 @@ TOOLNAME = llvm-bcanalyzer USEDLIBS = LLVMBCReader.a LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 + include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:49 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:49 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-ar/Makefile Message-ID: <200607070046.TAA29142@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ar: Makefile updated: 1.9 -> 1.10 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-ar/Makefile diff -u llvm/tools/llvm-ar/Makefile:1.9 llvm/tools/llvm-ar/Makefile:1.10 --- llvm/tools/llvm-ar/Makefile:1.9 Wed May 31 20:30:26 2006 +++ llvm/tools/llvm-ar/Makefile Thu Jul 6 19:46:18 2006 @@ -11,6 +11,7 @@ TOOLNAME = llvm-ar USEDLIBS = LLVMArchive.a LLVMBCReader.a \ LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:50 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:50 -0500 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/Makefile Message-ID: <200607070046.TAA29182@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: Makefile updated: 1.17 -> 1.18 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/bugpoint/Makefile diff -u llvm/tools/bugpoint/Makefile:1.17 llvm/tools/bugpoint/Makefile:1.18 --- llvm/tools/bugpoint/Makefile:1.17 Wed May 31 20:30:26 2006 +++ llvm/tools/bugpoint/Makefile Thu Jul 6 19:46:18 2006 @@ -17,5 +17,6 @@ LLVMTransformUtils.a \ LLVMAsmParser.a LLVMLinker.a LLVMBCReader.a LLVMBCWriter.a \ LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:50 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:50 -0500 Subject: [llvm-commits] CVS: llvm/tools/opt/Makefile Message-ID: <200607070046.TAA29154@zion.cs.uiuc.edu> Changes in directory llvm/tools/opt: Makefile updated: 1.55 -> 1.56 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/opt/Makefile diff -u llvm/tools/opt/Makefile:1.55 llvm/tools/opt/Makefile:1.56 --- llvm/tools/opt/Makefile:1.55 Wed May 31 20:30:27 2006 +++ llvm/tools/opt/Makefile Thu Jul 6 19:46:19 2006 @@ -8,6 +8,7 @@ ##===----------------------------------------------------------------------===## LEVEL = ../.. TOOLNAME = opt +REQUIRES_EH := 1 USEDLIBS = LLVMBCReader.a LLVMBCWriter.a LLVMInstrumentation.a \ LLVMScalarOpts.a LLVMipo.a LLVMipa.a LLVMDataStructure LLVMTransforms.a \ From lattner at cs.uiuc.edu Thu Jul 6 19:46:50 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:50 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm2cpp/Makefile Message-ID: <200607070046.TAA29176@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm2cpp: Makefile updated: 1.6 -> 1.7 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm2cpp/Makefile diff -u llvm/tools/llvm2cpp/Makefile:1.6 llvm/tools/llvm2cpp/Makefile:1.7 --- llvm/tools/llvm2cpp/Makefile:1.6 Thu Jul 6 18:48:57 2006 +++ llvm/tools/llvm2cpp/Makefile Thu Jul 6 19:46:19 2006 @@ -9,6 +9,7 @@ LEVEL = ../.. TOOLNAME = llvm2cpp USEDLIBS = LLVMBCReader.a LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:50 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:50 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-as/Makefile Message-ID: <200607070046.TAA29175@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-as: Makefile updated: 1.17 -> 1.18 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-as/Makefile diff -u llvm/tools/llvm-as/Makefile:1.17 llvm/tools/llvm-as/Makefile:1.18 --- llvm/tools/llvm-as/Makefile:1.17 Wed May 31 20:30:26 2006 +++ llvm/tools/llvm-as/Makefile Thu Jul 6 19:46:18 2006 @@ -10,5 +10,6 @@ TOOLNAME = llvm-as USEDLIBS = LLVMAsmParser.a LLVMBCWriter.a LLVMCore.a \ LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:50 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:50 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-link/Makefile Message-ID: <200607070046.TAA29160@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-link: Makefile updated: 1.13 -> 1.14 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-link/Makefile diff -u llvm/tools/llvm-link/Makefile:1.13 llvm/tools/llvm-link/Makefile:1.14 --- llvm/tools/llvm-link/Makefile:1.13 Wed May 31 20:30:27 2006 +++ llvm/tools/llvm-link/Makefile Thu Jul 6 19:46:18 2006 @@ -11,5 +11,6 @@ TOOLNAME = llvm-link USEDLIBS = LLVMLinker.a LLVMBCReader.a LLVMBCWriter.a \ LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:50 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:50 -0500 Subject: [llvm-commits] CVS: llvm/tools/lli/Makefile Message-ID: <200607070046.TAA29186@zion.cs.uiuc.edu> Changes in directory llvm/tools/lli: Makefile updated: 1.48 -> 1.49 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/lli/Makefile diff -u llvm/tools/lli/Makefile:1.48 llvm/tools/lli/Makefile:1.49 --- llvm/tools/lli/Makefile:1.48 Mon Nov 29 01:17:19 2004 +++ llvm/tools/lli/Makefile Thu Jul 6 19:46:18 2006 @@ -9,6 +9,7 @@ LEVEL := ../.. TOOLNAME := lli LLVMLIBS := JIT +REQUIRES_EH := 1 # Enable JIT support include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:50 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:50 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-dis/Makefile Message-ID: <200607070046.TAA29158@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-dis: Makefile updated: 1.18 -> 1.19 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+2 -0) Makefile | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/tools/llvm-dis/Makefile diff -u llvm/tools/llvm-dis/Makefile:1.18 llvm/tools/llvm-dis/Makefile:1.19 --- llvm/tools/llvm-dis/Makefile:1.18 Wed May 31 20:30:27 2006 +++ llvm/tools/llvm-dis/Makefile Thu Jul 6 19:46:18 2006 @@ -10,4 +10,6 @@ TOOLNAME = llvm-dis USEDLIBS = LLVMBCReader.a LLVMCore.a LLVMSupport.a LLVMbzip2.a LLVMSystem.a +REQUIRES_EH := 1 + include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:46:50 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:50 -0500 Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200607070046.TAA29162@zion.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.83 -> 1.84 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.83 llvm/tools/llc/Makefile:1.84 --- llvm/tools/llc/Makefile:1.83 Wed May 31 20:42:33 2006 +++ llvm/tools/llc/Makefile Thu Jul 6 19:46:18 2006 @@ -9,6 +9,7 @@ LEVEL = ../.. TOOLNAME = llc +REQUIRES_EH := 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 lattner at cs.uiuc.edu Thu Jul 6 19:46:50 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:46:50 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-config/Makefile Message-ID: <200607070046.TAA29156@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-config: Makefile updated: 1.10 -> 1.11 --- Log message: Tools require EH for their top-level try blocks. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-config/Makefile diff -u llvm/tools/llvm-config/Makefile:1.10 llvm/tools/llvm-config/Makefile:1.11 --- llvm/tools/llvm-config/Makefile:1.10 Tue Jun 6 12:43:03 2006 +++ llvm/tools/llvm-config/Makefile Thu Jul 6 19:46:18 2006 @@ -10,6 +10,7 @@ LEVEL = ../.. EXTRA_DIST = LibDeps.txt FinalLibDeps.txt llvm-config.in.in find-cycles.pl +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Thu Jul 6 19:47:41 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 19:47:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Makefile Message-ID: <200607070047.TAA29225@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: Makefile updated: 1.11 -> 1.12 --- Log message: This uses EH extensively --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/System/Makefile diff -u llvm/lib/System/Makefile:1.11 llvm/lib/System/Makefile:1.12 --- llvm/lib/System/Makefile:1.11 Wed May 31 20:55:21 2006 +++ llvm/lib/System/Makefile Thu Jul 6 19:47:29 2006 @@ -10,6 +10,7 @@ LEVEL = ../.. LIBRARYNAME = LLVMSystem BUILD_ARCHIVE = 1 +REQUIRES_EH := 1 EXTRA_DIST = Unix Win32 README.txt From lattner at cs.uiuc.edu Thu Jul 6 23:43:36 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 6 Jul 2006 23:43:36 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll Message-ID: <200607070443.XAA27717@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Alpha: 2006-07-03-ASMFormalLowering.ll updated: 1.1 -> 1.2 --- Log message: Xfail this --- Diffs of the changes: (+2 -2) 2006-07-03-ASMFormalLowering.ll | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/Regression/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll diff -u llvm/test/Regression/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll:1.1 llvm/test/Regression/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll:1.2 --- llvm/test/Regression/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll:1.1 Mon Jul 3 17:46:02 2006 +++ llvm/test/Regression/CodeGen/Alpha/2006-07-03-ASMFormalLowering.ll Thu Jul 6 23:43:24 2006 @@ -1,6 +1,6 @@ -;RUN: llvm-as < %s | llc -march=alpha +; RUN: llvm-as < %s | llc -march=alpha +; XFAIL: * -; ModuleID = 'atomicity.cc' target endian = little target pointersize = 64 target triple = "alphaev67-unknown-linux-gnu" From lattner at cs.uiuc.edu Fri Jul 7 01:06:19 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 01:06:19 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.h Message-ID: <200607070606.BAA28600@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.h updated: 1.29 -> 1.30 --- Log message: Fix a bug in my previous patch which broke building llvm/runtime when using llvm-gcc3. --- Diffs of the changes: (+1 -1) Reader.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Bytecode/Reader/Reader.h diff -u llvm/lib/Bytecode/Reader/Reader.h:1.29 llvm/lib/Bytecode/Reader/Reader.h:1.30 --- llvm/lib/Bytecode/Reader/Reader.h:1.29 Thu Jul 6 16:35:01 2006 +++ llvm/lib/Bytecode/Reader/Reader.h Fri Jul 7 01:06:06 2006 @@ -187,7 +187,7 @@ /// here. It simply releases the module from its provided and frees up our /// state. /// @brief Release our hold on the generated module - Module* releaseModule() { + Module* releaseModule(std::string *ErrInfo = 0) { // Since we're losing control of this Module, we must hand it back complete Module *M = ModuleProvider::releaseModule(); freeState(); From evan.cheng at apple.com Fri Jul 7 03:34:06 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 7 Jul 2006 03:34:06 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h X86InstrSSE.td Message-ID: <200607070834.DAA15466@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.232 -> 1.233 X86ISelLowering.h updated: 1.67 -> 1.68 X86InstrSSE.td updated: 1.128 -> 1.129 --- Log message: X86 target specific DAG combine: turn build_vector (load x), (load x+4), (load x+8), (load x+12), <0, 1, 2, 3> to a single 128-bit load (aligned and unaligned). e.g. __m128 test(float a, float b, float c, float d) { return _mm_set_ps(d, c, b, a); } _test: movups 4(%esp), %xmm0 ret --- Diffs of the changes: (+164 -0) X86ISelLowering.cpp | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++ X86ISelLowering.h | 6 ++ X86InstrSSE.td | 6 ++ 3 files changed, 164 insertions(+) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.232 llvm/lib/Target/X86/X86ISelLowering.cpp:1.233 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.232 Wed Jul 5 17:17:51 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Jul 7 03:33:52 2006 @@ -349,6 +349,9 @@ // We want to custom lower some of our intrinsics. setOperationAction(ISD::INTRINSIC_WO_CHAIN, MVT::Other, Custom); + // We have target-specific dag combine patterns for the following nodes: + setTargetDAGCombine(ISD::VECTOR_SHUFFLE); + computeRegisterProperties(); // FIXME: These should be based on subtarget info. Plus, the values should @@ -3751,6 +3754,7 @@ case X86ISD::REP_STOS: return "X86ISD::REP_STOS"; case X86ISD::REP_MOVS: return "X86ISD::REP_MOVS"; case X86ISD::LOAD_PACK: return "X86ISD::LOAD_PACK"; + case X86ISD::LOAD_UA: return "X86ISD::LOAD_UA"; case X86ISD::GlobalBaseReg: return "X86ISD::GlobalBaseReg"; case X86ISD::Wrapper: return "X86ISD::Wrapper"; case X86ISD::S2VEC: return "X86ISD::S2VEC"; @@ -3972,6 +3976,154 @@ } } +/// getShuffleScalarElt - Returns the scalar element that will make up the ith +/// element of the result of the vector shuffle. +static SDOperand getShuffleScalarElt(SDNode *N, unsigned i, SelectionDAG &DAG) { + MVT::ValueType VT = N->getValueType(0); + SDOperand PermMask = N->getOperand(2); + unsigned NumElems = PermMask.getNumOperands(); + SDOperand V = (i < NumElems) ? N->getOperand(0) : N->getOperand(1); + i %= NumElems; + if (V.getOpcode() == ISD::SCALAR_TO_VECTOR) { + return (i == 0) + ? V.getOperand(0) : DAG.getNode(ISD::UNDEF, MVT::getVectorBaseType(VT)); + } else if (V.getOpcode() == ISD::VECTOR_SHUFFLE) { + SDOperand Idx = PermMask.getOperand(i); + if (Idx.getOpcode() == ISD::UNDEF) + return DAG.getNode(ISD::UNDEF, MVT::getVectorBaseType(VT)); + return getShuffleScalarElt(V.Val,cast(Idx)->getValue(),DAG); + } + return SDOperand(); +} + +/// isGAPlusOffset - Returns true (and the GlobalValue and the offset) if the +/// node is a GlobalAddress + an offset. +static bool isGAPlusOffset(SDNode *N, GlobalValue* &GA, int64_t &Offset) { + if (N->getOpcode() == X86ISD::Wrapper) { + if (dyn_cast(N->getOperand(0))) { + GA = cast(N->getOperand(0))->getGlobal(); + return true; + } + } else if (N->getOpcode() == ISD::ADD) { + SDOperand N1 = N->getOperand(0); + SDOperand N2 = N->getOperand(1); + if (isGAPlusOffset(N1.Val, GA, Offset)) { + ConstantSDNode *V = dyn_cast(N2); + if (V) { + Offset += V->getSignExtended(); + return true; + } + } else if (isGAPlusOffset(N2.Val, GA, Offset)) { + ConstantSDNode *V = dyn_cast(N1); + if (V) { + Offset += V->getSignExtended(); + return true; + } + } + } + return false; +} + +/// isConsecutiveLoad - Returns true if N is loading from an address of Base +/// + Dist * Size. +static bool isConsecutiveLoad(SDNode *N, SDNode *Base, int Dist, int Size, + MachineFrameInfo *MFI) { + if (N->getOperand(0).Val != Base->getOperand(0).Val) + return false; + + SDOperand Loc = N->getOperand(1); + SDOperand BaseLoc = Base->getOperand(1); + if (Loc.getOpcode() == ISD::FrameIndex) { + if (BaseLoc.getOpcode() != ISD::FrameIndex) + return false; + int FI = dyn_cast(Loc)->getIndex(); + int BFI = dyn_cast(BaseLoc)->getIndex(); + int FS = MFI->getObjectSize(FI); + int BFS = MFI->getObjectSize(BFI); + if (FS != BFS || FS != Size) return false; + return MFI->getObjectOffset(FI) == (MFI->getObjectOffset(BFI) + Dist*Size); + } else { + GlobalValue *GV1 = NULL; + GlobalValue *GV2 = NULL; + int64_t Offset1 = 0; + int64_t Offset2 = 0; + bool isGA1 = isGAPlusOffset(Loc.Val, GV1, Offset1); + bool isGA2 = isGAPlusOffset(BaseLoc.Val, GV2, Offset2); + if (isGA1 && isGA2 && GV1 == GV2) + return Offset1 == (Offset2 + Dist*Size); + } + + return false; +} + +bool isBaseAlignment16(SDNode *Base, MachineFrameInfo *MFI) { + GlobalValue *GV; + int64_t Offset; + if (isGAPlusOffset(Base, GV, Offset)) + return (GV->getAlignment() >= 16 && (Offset % 16) == 0); + else { + assert(Base->getOpcode() == ISD::FrameIndex && "Unexpected base node!"); + int BFI = dyn_cast(Base)->getIndex(); + return MFI->getObjectAlignment(BFI) >= 16; + } + return false; +} + + +/// PerformShuffleCombine - Combine a vector_shuffle that is equal to +/// build_vector load1, load2, load3, load4, <0, 1, 2, 3> into a 128-bit load +/// if the load addresses are consecutive, non-overlapping, and in the right +/// order. +static SDOperand PerformShuffleCombine(SDNode *N, SelectionDAG &DAG) { + MachineFunction &MF = DAG.getMachineFunction(); + MachineFrameInfo *MFI = MF.getFrameInfo(); + MVT::ValueType VT = N->getValueType(0); + MVT::ValueType EVT = MVT::getVectorBaseType(VT); + SDOperand PermMask = N->getOperand(2); + int NumElems = (int)PermMask.getNumOperands(); + SDNode *Base = NULL; + for (int i = 0; i < NumElems; ++i) { + SDOperand Idx = PermMask.getOperand(i); + if (Idx.getOpcode() == ISD::UNDEF) { + if (!Base) return SDOperand(); + } else { + SDOperand Arg = + getShuffleScalarElt(N, cast(Idx)->getValue(), DAG); + if (!Arg.Val || Arg.getOpcode() != ISD::LOAD) + return SDOperand(); + if (!Base) + Base = Arg.Val; + else if (!isConsecutiveLoad(Arg.Val, Base, + i, MVT::getSizeInBits(EVT)/8,MFI)) + return SDOperand(); + } + } + + bool isAlign16 = isBaseAlignment16(Base->getOperand(1).Val, MFI); + if (isAlign16) + return DAG.getLoad(VT, Base->getOperand(0), Base->getOperand(1), + Base->getOperand(2)); + else + // Just use movups, it's shorter. + return DAG.getNode(ISD::BIT_CONVERT, VT, + DAG.getNode(X86ISD::LOAD_UA, MVT::v4f32, + Base->getOperand(0), Base->getOperand(1), + Base->getOperand(2))); +} + +SDOperand X86TargetLowering::PerformDAGCombine(SDNode *N, + DAGCombinerInfo &DCI) const { + TargetMachine &TM = getTargetMachine(); + SelectionDAG &DAG = DCI.DAG; + switch (N->getOpcode()) { + default: break; + case ISD::VECTOR_SHUFFLE: + return PerformShuffleCombine(N, DAG); + } + + return SDOperand(); +} + //===----------------------------------------------------------------------===// // X86 Inline Assembly Support //===----------------------------------------------------------------------===// Index: llvm/lib/Target/X86/X86ISelLowering.h diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.67 llvm/lib/Target/X86/X86ISelLowering.h:1.68 --- llvm/lib/Target/X86/X86ISelLowering.h:1.67 Sat Jun 24 03:36:10 2006 +++ llvm/lib/Target/X86/X86ISelLowering.h Fri Jul 7 03:33:52 2006 @@ -138,6 +138,10 @@ /// operands as a normal load. LOAD_PACK, + /// LOAD_UA Load an unaligned 128-bit value. It has the same operands as + /// a normal load. + LOAD_UA, + /// GlobalBaseReg - On Darwin, this node represents the result of the popl /// at function entry, used for PIC code. GlobalBaseReg, @@ -286,6 +290,8 @@ LowerFrameReturnAddress(bool isFrameAddr, SDOperand Chain, unsigned Depth, SelectionDAG &DAG); + virtual SDOperand PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const; + virtual MachineBasicBlock *InsertAtEndOfBasicBlock(MachineInstr *MI, MachineBasicBlock *MBB); Index: llvm/lib/Target/X86/X86InstrSSE.td diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.128 llvm/lib/Target/X86/X86InstrSSE.td:1.129 --- llvm/lib/Target/X86/X86InstrSSE.td:1.128 Thu Jun 29 13:04:54 2006 +++ llvm/lib/Target/X86/X86InstrSSE.td Fri Jul 7 03:33:52 2006 @@ -19,6 +19,8 @@ def X86loadp : SDNode<"X86ISD::LOAD_PACK", SDTLoad, [SDNPHasChain]>; +def X86loadu : SDNode<"X86ISD::LOAD_UA", SDTLoad, + [SDNPHasChain]>; def X86fand : SDNode<"X86ISD::FAND", SDTFPBinOp, [SDNPCommutative, SDNPAssociative]>; def X86fxor : SDNode<"X86ISD::FXOR", SDTFPBinOp, @@ -2563,3 +2565,7 @@ def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v16i8 immAllOnesV))), (load addr:$src2))), (PANDNrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; + +// Unaligned load +def : Pat<(v4f32 (X86loadu addr:$src)), (MOVUPSrm addr:$src)>, + Requires<[HasSSE1]>; From lattner at cs.uiuc.edu Fri Jul 7 11:44:45 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 11:44:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/Makefile Message-ID: <200607071644.LAA19332@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Makefile updated: 1.11 -> 1.12 --- Log message: These libs use EH info --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/AsmParser/Makefile diff -u llvm/lib/AsmParser/Makefile:1.11 llvm/lib/AsmParser/Makefile:1.12 --- llvm/lib/AsmParser/Makefile:1.11 Fri Jun 2 13:20:28 2006 +++ llvm/lib/AsmParser/Makefile Fri Jul 7 11:44:31 2006 @@ -10,6 +10,7 @@ LEVEL = ../.. LIBRARYNAME := LLVMAsmParser BUILD_ARCHIVE = 1 +REQUIRES_EH := 1 EXTRA_DIST := Lexer.cpp.cvs Lexer.l.cvs \ llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y.cvs From lattner at cs.uiuc.edu Fri Jul 7 11:44:46 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 11:44:46 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/Makefile Message-ID: <200607071644.LAA19336@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: Makefile updated: 1.2 -> 1.3 --- Log message: These libs use EH info --- Diffs of the changes: (+2 -1) Makefile | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Bytecode/Archive/Makefile diff -u llvm/lib/Bytecode/Archive/Makefile:1.2 llvm/lib/Bytecode/Archive/Makefile:1.3 --- llvm/lib/Bytecode/Archive/Makefile:1.2 Sun Oct 23 21:24:54 2005 +++ llvm/lib/Bytecode/Archive/Makefile Fri Jul 7 11:44:31 2006 @@ -12,6 +12,7 @@ # We only want an archive so only those modules actually used by a tool are # included. -BUILD_ARCHIVE = 1 +BUILD_ARCHIVE := 1 +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Fri Jul 7 11:44:46 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 11:44:46 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Makefile Message-ID: <200607071644.LAA19340@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Makefile updated: 1.5 -> 1.6 --- Log message: These libs use EH info --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Bytecode/Reader/Makefile diff -u llvm/lib/Bytecode/Reader/Makefile:1.5 llvm/lib/Bytecode/Reader/Makefile:1.6 --- llvm/lib/Bytecode/Reader/Makefile:1.5 Wed May 31 20:30:26 2006 +++ llvm/lib/Bytecode/Reader/Makefile Fri Jul 7 11:44:31 2006 @@ -9,6 +9,7 @@ LEVEL = ../../.. LIBRARYNAME = LLVMBCReader BUILD_ARCHIVE = 1 +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Fri Jul 7 11:46:56 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 11:46:56 -0500 Subject: [llvm-commits] CVS: llvm/lib/Debugger/Makefile Message-ID: <200607071646.LAA19388@zion.cs.uiuc.edu> Changes in directory llvm/lib/Debugger: Makefile updated: 1.3 -> 1.4 --- Log message: This uses EH info --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Debugger/Makefile diff -u llvm/lib/Debugger/Makefile:1.3 llvm/lib/Debugger/Makefile:1.4 --- llvm/lib/Debugger/Makefile:1.3 Thu Apr 13 01:39:24 2006 +++ llvm/lib/Debugger/Makefile Fri Jul 7 11:46:43 2006 @@ -10,5 +10,6 @@ LEVEL = ../.. LIBRARYNAME = LLVMDebugger EXTRA_DIST = README.txt +REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From lattner at cs.uiuc.edu Fri Jul 7 12:00:24 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:00:24 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/Compressor.h Message-ID: <200607071700.MAA19518@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: Compressor.h updated: 1.7 -> 1.8 --- Log message: This patch (written by Reid) changes compressor to never throw an exception. --- Diffs of the changes: (+12 -12) Compressor.h | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) Index: llvm/include/llvm/Support/Compressor.h diff -u llvm/include/llvm/Support/Compressor.h:1.7 llvm/include/llvm/Support/Compressor.h:1.8 --- llvm/include/llvm/Support/Compressor.h:1.7 Sun May 14 14:07:07 2006 +++ llvm/include/llvm/Support/Compressor.h Fri Jul 7 12:00:12 2006 @@ -49,7 +49,8 @@ static size_t compressToNewBuffer( const char* in, ///< The buffer to be compressed size_t size, ///< The size of the buffer to be compressed - char*&out ///< The returned output buffer + char*&out, ///< The returned output buffer + std::string* error = 0 ///< Optional error message ); /// This method compresses a block of memory pointed to by \p in with @@ -57,38 +58,38 @@ /// writing when this method is called. The stream will not be closed by /// this method. The \p hint argument indicates which type of /// compression the caller would *prefer*. - /// @throws std::string explaining error if a compression error occurs /// @returns The amount of data written to \p out. /// @brief Compress memory to a file. static size_t compressToStream( const char*in, ///< The buffer to be compressed size_t size, ///< The size of the buffer to be compressed - std::ostream& out ///< The output stream to write data on + std::ostream& out, ///< The output stream to write data on + std::string* error = 0 ///< Optional error message buffer ); /// This method decompresses a block of memory pointed to by \p in with /// size \p size to a new block of memory, \p out, \p that was allocated /// by malloc. It is the caller's responsibility to free \p out. - /// @throws std::string explaining error if a decompression error occurs /// @returns The size of the output buffer \p out. /// @brief Decompress memory to a new memory buffer. static size_t decompressToNewBuffer( const char *in, ///< The buffer to be decompressed size_t size, ///< Size of the buffer to be decompressed - char*&out ///< The returned output buffer + char*&out, ///< The returned output buffer + std::string* error = 0 ///< Optional error message buffer ); /// This method decompresses a block of memory pointed to by \p in with /// size \p size to a stream. The stream \p out must be open and ready for /// writing when this method is called. The stream will not be closed by /// this method. - /// @throws std::string explaining error if a decompression error occurs /// @returns The amount of data written to \p out. /// @brief Decompress memory to a stream. static size_t decompressToStream( const char *in, ///< The buffer to be decompressed size_t size, ///< Size of the buffer to be decompressed - std::ostream& out ///< The stream to write write data on + std::ostream& out, ///< The stream to write write data on + std::string* error = 0 ///< Optional error message buffer ); /// @} @@ -106,7 +107,6 @@ /// It is recommended that \p size be chosen based on the some multiple or /// fraction of the object being decompressed or compressed, respetively. /// @returns 0 for success, 1 for failure - /// @throws nothing /// @brief Output callback function type typedef size_t (OutputDataCallback)(char*& buffer, size_t& size, void* context); @@ -123,14 +123,14 @@ /// the callback are made. The \p hint parameter tells the function which /// kind of compression to start with. However, if its not available on /// the platform, the algorithm "falls back" from bzip2 -> zlib -> simple. - /// @throws std::string if an error occurs /// @returns the total size of the compressed data /// @brief Compress a block of memory. static size_t compress( const char* in, ///< The buffer to be compressed size_t size, ///< The size of the buffer to be compressed OutputDataCallback* cb, ///< Call back for memory allocation - void* context = 0 ///< Context for callback + void* context = 0, ///< Context for callback + std::string* error = 0 ///< Optional error message ); /// This function does the decompression work. The block of memory @@ -143,14 +143,14 @@ /// total size will generally be greater than \p size. It is a good idea /// to provide as large a value to the callback's \p size parameter as /// possible so that fewer calls to the callback are made. - /// @throws std::string if an error occurs /// @returns the total size of the decompressed data /// @brief Decompress a block of memory. static size_t decompress( const char *in, ///< The buffer to be decompressed size_t size, ///< Size of the buffer to be decompressed OutputDataCallback* cb, ///< Call back for memory allocation - void* context = 0 ///< Context for callback + void* context = 0, ///< Context for callback + std::string* error = 0 ///< Optional error message ); /// @} From lattner at cs.uiuc.edu Fri Jul 7 12:00:25 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:00:25 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/Compressor.cpp Message-ID: <200607071700.MAA19522@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: Compressor.cpp updated: 1.20 -> 1.21 --- Log message: This patch (written by Reid) changes compressor to never throw an exception. --- Diffs of the changes: (+107 -38) Compressor.cpp | 145 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 107 insertions(+), 38 deletions(-) Index: llvm/lib/Support/Compressor.cpp diff -u llvm/lib/Support/Compressor.cpp:1.20 llvm/lib/Support/Compressor.cpp:1.21 --- llvm/lib/Support/Compressor.cpp:1.20 Wed May 24 12:04:04 2006 +++ llvm/lib/Support/Compressor.cpp Fri Jul 7 12:00:12 2006 @@ -261,7 +261,8 @@ // Compress in one of three ways size_t Compressor::compress(const char* in, size_t size, - OutputDataCallback* cb, void* context) { + OutputDataCallback* cb, void* context, + std::string* error ) { assert(in && "Can't compress null buffer"); assert(size && "Can't compress empty buffer"); assert(cb && "Can't compress without a callback function"); @@ -282,9 +283,18 @@ bzdata.next_out = 0; bzdata.avail_out = 0; switch ( BZ2_bzCompressInit(&bzdata, 5, 0, 100) ) { - case BZ_CONFIG_ERROR: throw std::string("bzip2 library mis-compiled"); - case BZ_PARAM_ERROR: throw std::string("Compressor internal error"); - case BZ_MEM_ERROR: throw std::string("Out of memory"); + case BZ_CONFIG_ERROR: + if (error) + *error = "bzip2 library mis-compiled"; + return result; + case BZ_PARAM_ERROR: + if (error) + *error = "Compressor internal error"; + return result; + case BZ_MEM_ERROR: + if (error) + *error = "Out of memory"; + return result; case BZ_OK: default: break; @@ -293,7 +303,9 @@ // Get a block of memory if (0 != getdata_uns(bzdata.next_out, bzdata.avail_out,cb,context)) { BZ2_bzCompressEnd(&bzdata); - throw std::string("Can't allocate output buffer"); + if (error) + *error = "Can't allocate output buffer"; + return result; } // Put compression code in first byte @@ -305,15 +317,23 @@ while (BZ_FINISH_OK == (bzerr = BZ2_bzCompress(&bzdata, BZ_FINISH))) { if (0 != getdata_uns(bzdata.next_out, bzdata.avail_out,cb,context)) { BZ2_bzCompressEnd(&bzdata); - throw std::string("Can't allocate output buffer"); + if (error) + *error = "Can't allocate output buffer"; + return result; } } switch (bzerr) { case BZ_SEQUENCE_ERROR: - case BZ_PARAM_ERROR: throw std::string("Param/Sequence error"); + case BZ_PARAM_ERROR: + if (error) + *error = "Param/Sequence error"; + return result; case BZ_FINISH_OK: case BZ_STREAM_END: break; - default: throw std::string("Oops: ") + utostr(unsigned(bzerr)); + default: + if (error) + *error = "BZip2 Error: " + utostr(unsigned(bzerr)); + return result; } // Finish @@ -330,7 +350,9 @@ NULLCOMP_init(&sdata); if (0 != getdata(sdata.next_out, sdata.avail_out,cb,context)) { - throw std::string("Can't allocate output buffer"); + if (error) + *error = "Can't allocate output buffer"; + return result; } *(sdata.next_out++) = COMP_TYPE_NONE; @@ -338,7 +360,9 @@ while (!NULLCOMP_compress(&sdata)) { if (0 != getdata(sdata.next_out, sdata.avail_out,cb,context)) { - throw std::string("Can't allocate output buffer"); + if (error) + *error = "Can't allocate output buffer"; + return result; } } @@ -348,24 +372,26 @@ return result; } -size_t Compressor::compressToNewBuffer(const char* in, size_t size, char*&out) { +size_t Compressor::compressToNewBuffer(const char* in, size_t size, char*&out, + std::string* error) { BufferContext bc(size); - size_t result = compress(in,size,BufferContext::callback,(void*)&bc); + size_t result = compress(in,size,BufferContext::callback,(void*)&bc,error); bc.trimTo(result); out = bc.buff; return result; } size_t -Compressor::compressToStream(const char*in, size_t size, std::ostream& out) { +Compressor::compressToStream(const char*in, size_t size, std::ostream& out, + std::string* error) { // Set up the context and writer WriterContext ctxt(&out, size / 2); // Compress everything after the magic number (which we'll alter). size_t zipSize = Compressor::compress(in,size, - WriterContext::callback, (void*)&ctxt); + WriterContext::callback, (void*)&ctxt,error); - if (ctxt.chunk) { + if (zipSize && ctxt.chunk) { ctxt.write(zipSize - ctxt.written); } return zipSize; @@ -373,7 +399,8 @@ // Decompress in one of three ways size_t Compressor::decompress(const char *in, size_t size, - OutputDataCallback* cb, void* context) { + OutputDataCallback* cb, void* context, + std::string* error) { assert(in && "Can't decompress null buffer"); assert(size > 1 && "Can't decompress empty buffer"); assert(cb && "Can't decompress without a callback function"); @@ -392,9 +419,18 @@ bzdata.next_out = 0; bzdata.avail_out = 0; switch ( BZ2_bzDecompressInit(&bzdata, 0, 0) ) { - case BZ_CONFIG_ERROR: throw std::string("bzip2 library mis-compiled"); - case BZ_PARAM_ERROR: throw std::string("Compressor internal error"); - case BZ_MEM_ERROR: throw std::string("Out of memory"); + case BZ_CONFIG_ERROR: + if (error) + *error = "bzip2 library mis-compiled"; + return result; + case BZ_PARAM_ERROR: + if (error) + *error = "Compressor internal error"; + return result; + case BZ_MEM_ERROR: + if (error) + *error = "Out of memory"; + return result; case BZ_OK: default: break; @@ -403,7 +439,9 @@ // Get a block of memory if (0 != getdata_uns(bzdata.next_out, bzdata.avail_out,cb,context)) { BZ2_bzDecompressEnd(&bzdata); - throw std::string("Can't allocate output buffer"); + if (error) + *error = "Can't allocate output buffer"; + return result; } // Decompress it @@ -412,21 +450,46 @@ bzdata.avail_in != 0 ) { if (0 != getdata_uns(bzdata.next_out, bzdata.avail_out,cb,context)) { BZ2_bzDecompressEnd(&bzdata); - throw std::string("Can't allocate output buffer"); + if (error) + *error = "Can't allocate output buffer"; + return result; } } switch (bzerr) { - case BZ_PARAM_ERROR: throw std::string("Compressor internal error"); - case BZ_MEM_ERROR: throw std::string("Out of memory"); - case BZ_DATA_ERROR: throw std::string("Data integrity error"); - case BZ_DATA_ERROR_MAGIC:throw std::string("Data is not BZIP2"); - case BZ_OK: throw std::string("Insufficient input for bzip2"); + BZ2_bzDecompressEnd(&bzdata); + case BZ_PARAM_ERROR: + if (error) + *error = "Compressor internal error"; + return result; + case BZ_MEM_ERROR: + BZ2_bzDecompressEnd(&bzdata); + if (error) + *error = "Out of memory"; + return result; + case BZ_DATA_ERROR: + BZ2_bzDecompressEnd(&bzdata); + if (error) + *error = "Data integrity error"; + return result; + case BZ_DATA_ERROR_MAGIC: + BZ2_bzDecompressEnd(&bzdata); + if (error) + *error = "Data is not BZIP2"; + return result; + case BZ_OK: + BZ2_bzDecompressEnd(&bzdata); + if (error) + *error = "Insufficient input for bzip2"; + return result; case BZ_STREAM_END: break; - default: throw("Ooops"); + default: + BZ2_bzDecompressEnd(&bzdata); + if (error) + *error = "Unknown result code from bzDecompress"; + return result; } - // Finish result = bzdata.total_out_lo32; if (sizeof(size_t) == sizeof(uint64_t)) @@ -442,12 +505,16 @@ NULLCOMP_init(&sdata); if (0 != getdata(sdata.next_out, sdata.avail_out,cb,context)) { - throw std::string("Can't allocate output buffer"); + if (error) + *error = "Can't allocate output buffer"; + return result; } while (!NULLCOMP_decompress(&sdata)) { if (0 != getdata(sdata.next_out, sdata.avail_out,cb,context)) { - throw std::string("Can't allocate output buffer"); + if (error) + *error = "Can't allocate output buffer"; + return result; } } @@ -457,33 +524,35 @@ } default: - throw std::string("Unknown type of compressed data"); + if (error) + *error = "Unknown type of compressed data"; + return result; } return result; } size_t -Compressor::decompressToNewBuffer(const char* in, size_t size, char*&out) { +Compressor::decompressToNewBuffer(const char* in, size_t size, char*&out, + std::string* error) { BufferContext bc(size); - size_t result = decompress(in,size,BufferContext::callback,(void*)&bc); + size_t result = decompress(in,size,BufferContext::callback,(void*)&bc,error); out = bc.buff; return result; } size_t -Compressor::decompressToStream(const char*in, size_t size, std::ostream& out){ +Compressor::decompressToStream(const char*in, size_t size, std::ostream& out, + std::string* error) { // Set up the context and writer WriterContext ctxt(&out,size / 2); // Decompress everything after the magic number (which we'll alter) size_t zipSize = Compressor::decompress(in,size, - WriterContext::callback, (void*)&ctxt); + WriterContext::callback, (void*)&ctxt,error); - if (ctxt.chunk) { + if (zipSize && ctxt.chunk) { ctxt.write(zipSize - ctxt.written); } return zipSize; } - -// vim: sw=2 ai From pjenkins at apple.com Fri Jul 7 12:08:14 2006 From: pjenkins at apple.com (Patrick Jenkins) Date: Fri, 7 Jul 2006 12:08:14 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200607071708.MAA19568@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.2 -> 1.3 --- Log message: Fixed variable naming issue that prevented $Prefix-senddata.txt from having any information --- Diffs of the changes: (+1 -1) NewNightlyTest.pl | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.2 llvm/utils/NewNightlyTest.pl:1.3 --- llvm/utils/NewNightlyTest.pl:1.2 Thu Jul 6 17:32:15 2006 +++ llvm/utils/NewNightlyTest.pl Fri Jul 7 12:08:02 2006 @@ -441,7 +441,7 @@ my $sentdata=""; foreach $x(keys(%hash_of_data)){ - $senddata.= "$x => $hash_of_data{$x}\n"; + $sentdata.= "$x => $hash_of_data{$x}\n"; } WriteFile "$Prefix-sentdata.txt", $sentdata; From lattner at cs.uiuc.edu Fri Jul 7 12:12:03 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:12:03 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/DynamicLibrary.h Message-ID: <200607071712.MAA19713@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: DynamicLibrary.h updated: 1.6 -> 1.7 --- Log message: Change LoadLibraryPermanently to not throw an exception. --- Diffs of the changes: (+4 -3) DynamicLibrary.h | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/include/llvm/System/DynamicLibrary.h diff -u llvm/include/llvm/System/DynamicLibrary.h:1.6 llvm/include/llvm/System/DynamicLibrary.h:1.7 --- llvm/include/llvm/System/DynamicLibrary.h:1.6 Fri May 19 14:07:54 2006 +++ llvm/include/llvm/System/DynamicLibrary.h Fri Jul 7 12:11:51 2006 @@ -65,10 +65,11 @@ public: /// This function allows a library to be loaded without instantiating a /// DynamicLibrary object. Consequently, it is marked as being permanent - /// and will only be unloaded when the program terminates. - /// @throws std::string on error. + /// and will only be unloaded when the program terminates. This returns + /// false on success or returns true and fills in *ErrMsg on failure. /// @brief Open a dynamic library permanently. - static void LoadLibraryPermanently(const char* filename); + static bool LoadLibraryPermanently(const char* filename, + std::string *ErrMsg = 0); /// This function will search through all previously loaded dynamic /// libraries for the symbol \p symbolName. If it is found, the addressof From lattner at cs.uiuc.edu Fri Jul 7 12:12:48 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:12:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/DynamicLibrary.cpp Message-ID: <200607071712.MAA19779@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: DynamicLibrary.cpp updated: 1.14 -> 1.15 --- Log message: Change LoadLibraryPermanently to not throw an exception. --- Diffs of the changes: (+13 -7) DynamicLibrary.cpp | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) Index: llvm/lib/System/DynamicLibrary.cpp diff -u llvm/lib/System/DynamicLibrary.cpp:1.14 llvm/lib/System/DynamicLibrary.cpp:1.15 --- llvm/lib/System/DynamicLibrary.cpp:1.14 Sun May 14 14:00:53 2006 +++ llvm/lib/System/DynamicLibrary.cpp Fri Jul 7 12:12:36 2006 @@ -18,7 +18,8 @@ // Collection of symbol name/value pairs to be searched prior to any libraries. static std::map g_symbols; -void llvm::sys::DynamicLibrary::AddSymbol(const char* symbolName, void *symbolValue) { +void llvm::sys::DynamicLibrary::AddSymbol(const char* symbolName, + void *symbolValue) { g_symbols[symbolName] = symbolValue; } @@ -99,20 +100,25 @@ } } -void DynamicLibrary::LoadLibraryPermanently(const char* filename) { +bool DynamicLibrary::LoadLibraryPermanently(const char *Filename, + std::string *ErrMsg) { check_ltdl_initialization(); - lt_dlhandle a_handle = lt_dlopen(filename); + lt_dlhandle a_handle = lt_dlopen(Filename); if (a_handle == 0) - a_handle = lt_dlopenext(filename); + a_handle = lt_dlopenext(Filename); - if (a_handle == 0) - throw std::string("Can't open :") + - (filename ? filename : "") + ": " + lt_dlerror(); + if (a_handle == 0) { + if (ErrMsg) + *ErrMsg = std::string("Can't open :") + + (Filename ? Filename : "") + ": " + lt_dlerror(); + return true; + } lt_dlmakeresident(a_handle); OpenedHandles.push_back(a_handle); + return false; } void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { From lattner at cs.uiuc.edu Fri Jul 7 12:12:48 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:12:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/DynamicLibrary.inc Message-ID: <200607071712.MAA19783@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: DynamicLibrary.inc updated: 1.15 -> 1.16 --- Log message: Change LoadLibraryPermanently to not throw an exception. --- Diffs of the changes: (+4 -2) DynamicLibrary.inc | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/System/Win32/DynamicLibrary.inc diff -u llvm/lib/System/Win32/DynamicLibrary.inc:1.15 llvm/lib/System/Win32/DynamicLibrary.inc:1.16 --- llvm/lib/System/Win32/DynamicLibrary.inc:1.15 Thu Jun 1 14:03:21 2006 +++ llvm/lib/System/Win32/DynamicLibrary.inc Fri Jul 7 12:12:36 2006 @@ -94,12 +94,13 @@ } } -void DynamicLibrary::LoadLibraryPermanently(const char* filename) { +bool DynamicLibrary::LoadLibraryPermanently(const char *filename, + std::string *ErrMsg) { if (filename) { HMODULE a_handle = LoadLibrary(filename); if (a_handle == 0) - ThrowError(std::string(filename) + ": Can't open : "); + return GetError(std::string(filename) + ": Can't open : ", ErrMsg); OpenedHandles.push_back(a_handle); } else { @@ -110,6 +111,7 @@ // Because we don't remember the handle, we will never free it; hence, // it is loaded permanently. + return false; } void* DynamicLibrary::SearchForAddressOfSymbol(const char* symbolName) { From lattner at cs.uiuc.edu Fri Jul 7 12:13:22 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:13:22 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Win32.h Message-ID: <200607071713.MAA19846@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Win32.h updated: 1.4 -> 1.5 --- Log message: Add a helper function --- Diffs of the changes: (+10 -0) Win32.h | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm/lib/System/Win32/Win32.h diff -u llvm/lib/System/Win32/Win32.h:1.4 llvm/lib/System/Win32/Win32.h:1.5 --- llvm/lib/System/Win32/Win32.h:1.4 Tue Jul 12 21:15:17 2005 +++ llvm/lib/System/Win32/Win32.h Fri Jul 7 12:13:10 2006 @@ -24,6 +24,16 @@ #include #include +inline bool GetError(const std::string &Prefix, std::string *Dest) { + if (Dest == 0) return; + char *buffer = NULL; + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, + NULL, GetLastError(), 0, (LPSTR)&buffer, 1, NULL); + *Dest = Prefix + buffer; + LocalFree(buffer); + return true; +} + inline void ThrowError(const std::string& msg) { char *buffer = NULL; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, From lattner at cs.uiuc.edu Fri Jul 7 12:14:16 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:14:16 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/PluginLoader.cpp Message-ID: <200607071714.MAA19909@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: PluginLoader.cpp updated: 1.17 -> 1.18 --- Log message: LoadLibraryPermanently no longer throws an exception, so this code doesn't have to catch it. Other minor cleanups. --- Diffs of the changes: (+14 -28) PluginLoader.cpp | 42 ++++++++++++++---------------------------- 1 files changed, 14 insertions(+), 28 deletions(-) Index: llvm/lib/Support/PluginLoader.cpp diff -u llvm/lib/Support/PluginLoader.cpp:1.17 llvm/lib/Support/PluginLoader.cpp:1.18 --- llvm/lib/Support/PluginLoader.cpp:1.17 Thu Jan 26 13:38:58 2006 +++ llvm/lib/Support/PluginLoader.cpp Fri Jul 7 12:14:04 2006 @@ -16,42 +16,28 @@ #include "llvm/System/DynamicLibrary.h" #include #include - using namespace llvm; -static std::vector* plugins; +static std::vector *Plugins; void PluginLoader::operator=(const std::string &Filename) { - std::string ErrorMessage; - - if (!plugins) - plugins = new std::vector(); + if (!Plugins) + Plugins = new std::vector(); - try { - sys::DynamicLibrary::LoadLibraryPermanently(Filename.c_str()); - plugins->push_back(Filename); - } catch (const std::string& errmsg) { - if (errmsg.empty()) { - ErrorMessage = "Unknown"; - } else { - ErrorMessage = errmsg; - } - } - if (!ErrorMessage.empty()) - std::cerr << "Error opening '" << Filename << "': " << ErrorMessage + std::string Error; + if (sys::DynamicLibrary::LoadLibraryPermanently(Filename.c_str(), &Error)) { + std::cerr << "Error opening '" << Filename << "': " << Error << "\n -load request ignored.\n"; + } else { + Plugins->push_back(Filename); + } } -unsigned PluginLoader::getNumPlugins() -{ - if(plugins) - return plugins->size(); - else - return 0; +unsigned PluginLoader::getNumPlugins() { + return Plugins ? Plugins->size() : 0; } -std::string& PluginLoader::getPlugin(unsigned num) -{ - assert(plugins && num < plugins->size() && "Asking for an out of bounds plugin"); - return (*plugins)[num]; +std::string &PluginLoader::getPlugin(unsigned num) { + assert(Plugins && num < Plugins->size() && "Asking for an out of bounds plugin"); + return (*Plugins)[num]; } From lattner at cs.uiuc.edu Fri Jul 7 12:18:21 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:18:21 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200607071718.MAA19966@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.67 -> 1.68 --- Log message: Adapt to new interface function materialization interface --- Diffs of the changes: (+5 -9) JIT.cpp | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.67 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.68 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.67 Thu Jun 1 12:29:22 2006 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Fri Jul 7 12:18:09 2006 @@ -256,18 +256,14 @@ return Addr; // Check if function already code gen'd // Make sure we read in the function if it exists in this Module - if (F->hasNotBeenReadFromBytecode()) - try { - MP->materializeFunction(F); - } catch ( std::string& errmsg ) { + if (F->hasNotBeenReadFromBytecode()) { + std::string ErrorMsg; + if (MP->materializeFunction(F, &ErrorMsg)) { std::cerr << "Error reading function '" << F->getName() - << "' from bytecode file: " << errmsg << "\n"; - abort(); - } catch (...) { - std::cerr << "Error reading function '" << F->getName() - << "from bytecode file!\n"; + << "' from bytecode file: " << ErrorMsg << "\n"; abort(); } + } if (F->isExternal()) { void *Addr = getPointerToNamedFunction(F->getName()); From lattner at cs.uiuc.edu Fri Jul 7 12:26:59 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:26:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Win32.h Message-ID: <200607071726.MAA20229@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Win32.h updated: 1.5 -> 1.6 --- Log message: Fix this impl --- Diffs of the changes: (+1 -1) Win32.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/System/Win32/Win32.h diff -u llvm/lib/System/Win32/Win32.h:1.5 llvm/lib/System/Win32/Win32.h:1.6 --- llvm/lib/System/Win32/Win32.h:1.5 Fri Jul 7 12:13:10 2006 +++ llvm/lib/System/Win32/Win32.h Fri Jul 7 12:26:47 2006 @@ -25,7 +25,7 @@ #include inline bool GetError(const std::string &Prefix, std::string *Dest) { - if (Dest == 0) return; + if (Dest == 0) return true; char *buffer = NULL; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, (LPSTR)&buffer, 1, NULL); From lattner at cs.uiuc.edu Fri Jul 7 12:31:29 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:31:29 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/Memory.h Message-ID: <200607071731.MAA20370@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: Memory.h updated: 1.6 -> 1.7 --- Log message: Change AllocateRWX/DeallocateRWX to not throw an exception. --- Diffs of the changes: (+15 -7) Memory.h | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) Index: llvm/include/llvm/System/Memory.h diff -u llvm/include/llvm/System/Memory.h:1.6 llvm/include/llvm/System/Memory.h:1.7 --- llvm/include/llvm/System/Memory.h:1.6 Fri Jul 29 18:38:42 2005 +++ llvm/include/llvm/System/Memory.h Fri Jul 7 12:31:17 2006 @@ -14,6 +14,8 @@ #ifndef LLVM_SYSTEM_MEMORY_H #define LLVM_SYSTEM_MEMORY_H +#include + namespace llvm { namespace sys { @@ -24,10 +26,10 @@ /// @brief Memory block abstraction. class MemoryBlock { public: - void* base() const { return Address; } + void *base() const { return Address; } unsigned size() const { return Size; } private: - void * Address; ///< Address of first byte of memory area + void *Address; ///< Address of first byte of memory area unsigned Size; ///< Size, in bytes of the memory area friend class Memory; }; @@ -45,21 +47,27 @@ /// attempt to allocate \p NumBytes bytes of virtual memory is made. /// \p NearBlock may point to an existing allocation in which case /// an attempt is made to allocate more memory near the existing block. - /// @throws std::string if an error occurred. + /// + /// On success, this returns a non-null memory block, otherwise it returns + /// a null memory block and fills in *ErrMsg. + /// /// @brief Allocate Read/Write/Execute memory. - static MemoryBlock AllocateRWX(unsigned NumBytes, const MemoryBlock* NearBlock); + static MemoryBlock AllocateRWX(unsigned NumBytes, + const MemoryBlock *NearBlock, + std::string *ErrMsg = 0); /// This method releases a block of Read/Write/Execute memory that was /// allocated with the AllocateRWX method. It should not be used to /// release any memory block allocated any other way. + /// + /// On success, this returns false, otherwise it returns true and fills + /// in *ErrMsg. /// @throws std::string if an error occurred. /// @brief Release Read/Write/Execute memory. - static void ReleaseRWX(MemoryBlock& block); - + static bool ReleaseRWX(MemoryBlock &block, std::string *ErrMsg = 0); /// @} }; } } - #endif From pjenkins at apple.com Fri Jul 7 12:31:51 2006 From: pjenkins at apple.com (Patrick Jenkins) Date: Fri, 7 Jul 2006 12:31:51 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200607071731.MAA20410@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.3 -> 1.4 --- Log message: Added the -noremoveresults option which will not remove the $WebDir from the nightly test runs. --- Diffs of the changes: (+3 -0) NewNightlyTest.pl | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.3 llvm/utils/NewNightlyTest.pl:1.4 --- llvm/utils/NewNightlyTest.pl:1.3 Fri Jul 7 12:08:02 2006 +++ llvm/utils/NewNightlyTest.pl Fri Jul 7 12:31:38 2006 @@ -20,6 +20,7 @@ # -nocheckout Do not create, checkout, update, or configure # the source tree. # -noremove Do not remove the BUILDDIR after it has been built. +# -noremoveresults Do not remove the WEBDIR after it has been built. # -nobuild Do not build llvm. If tests are enabled perform them # on the llvm build specified in the build directory # -notest Do not even attempt to run the test programs. Implies @@ -119,6 +120,7 @@ if (/^-nocheckout$/) { $NOCHECKOUT = 1; next; } if (/^-nocvsstats$/) { $NOCVSSTATS = 1; next; } if (/^-noremove$/) { $NOREMOVE = 1; next; } + if (/^-noremoveresults$/) { $NOREMOVERESULTS = 1; next; } if (/^-notest$/) { $NOTEST = 1; $NORUNNINGTESTS = 1; next; } if (/^-norunningtests$/) { $NORUNNINGTESTS = 1; next; } if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; } @@ -1020,5 +1022,6 @@ # ############################################################## system ( "$NICE rm -rf $BuildDir") if (!$NOCHECKOUT and !$NOREMOVE); +system ( "$NICE rm -rf $WebDir") if (!$NOCHECKOUT and !$NOREMOVE and !NOREMOVERESULTS); From lattner at cs.uiuc.edu Fri Jul 7 12:31:53 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:31:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Message-ID: <200607071731.MAA20414@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JITEmitter.cpp updated: 1.105 -> 1.106 --- Log message: Change AllocateRWX/DeallocateRWX do not throw an exception. --- Diffs of the changes: (+8 -8) JITEmitter.cpp | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.105 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.106 --- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.105 Thu Jun 22 20:02:37 2006 +++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Fri Jul 7 12:31:41 2006 @@ -414,17 +414,17 @@ } sys::MemoryBlock JITMemoryManager::getNewMemoryBlock(unsigned size) { - try { - // Allocate a new block close to the last one. - const sys::MemoryBlock *BOld = Blocks.empty() ? 0 : &Blocks.front(); - sys::MemoryBlock B = sys::Memory::AllocateRWX(size, BOld); - Blocks.push_back(B); - return B; - } catch (std::string &err) { + // Allocate a new block close to the last one. + const sys::MemoryBlock *BOld = Blocks.empty() ? 0 : &Blocks.front(); + std::string ErrMsg; + sys::MemoryBlock B = sys::Memory::AllocateRWX(size, BOld, &ErrMsg); + if (B.base() == 0) { std::cerr << "Allocation failed when allocating new memory in the JIT\n"; - std::cerr << err << "\n"; + std::cerr << ErrMsg << "\n"; abort(); } + Blocks.push_back(B); + return B; } //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Fri Jul 7 12:32:51 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:32:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Win32/Memory.inc Message-ID: <200607071732.MAA22727@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Win32: Memory.inc updated: 1.6 -> 1.7 --- Log message: Change AllocateRWX/DeallocateRWX to not throw an exception. --- Diffs of the changes: (+8 -6) Memory.inc | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) Index: llvm/lib/System/Win32/Memory.inc diff -u llvm/lib/System/Win32/Memory.inc:1.6 llvm/lib/System/Win32/Memory.inc:1.7 --- llvm/lib/System/Win32/Memory.inc:1.6 Fri Jul 29 18:39:25 2005 +++ llvm/lib/System/Win32/Memory.inc Fri Jul 7 12:32:37 2006 @@ -23,7 +23,9 @@ //=== and must not be UNIX code //===----------------------------------------------------------------------===// -MemoryBlock Memory::AllocateRWX(unsigned NumBytes, const MemoryBlock* NearBlock) { +MemoryBlock Memory::AllocateRWX(unsigned NumBytes, + const MemoryBlock *NearBlock, + std::string *ErrMsg) { if (NumBytes == 0) return MemoryBlock(); static const long pageSize = Process::GetPageSize(); @@ -34,7 +36,8 @@ void *pa = VirtualAlloc(NULL, NumPages*pageSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE); if (pa == NULL) { - ThrowError("Can't allocate RWX Memory: "); + GetError("Can't allocate RWX Memory: ", ErrMsg); + return MemoryBlock(); } MemoryBlock result; @@ -43,11 +46,10 @@ return result; } -void Memory::ReleaseRWX(MemoryBlock& M) { +bool Memory::ReleaseRWX(MemoryBlock &M, std::string *ErrMsg) { if (M.Address == 0 || M.Size == 0) return; - if (!VirtualFree(M.Address, 0, MEM_RELEASE)) { - ThrowError("Can't release RWX Memory: "); - } + if (!VirtualFree(M.Address, 0, MEM_RELEASE)) + return GetError("Can't release RWX Memory: ", ErrMsg); } } From lattner at cs.uiuc.edu Fri Jul 7 12:32:51 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 12:32:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/Memory.inc Unix.h Message-ID: <200607071732.MAA22733@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: Memory.inc updated: 1.4 -> 1.5 Unix.h updated: 1.14 -> 1.15 --- Log message: Change AllocateRWX/DeallocateRWX to not throw an exception. --- Diffs of the changes: (+61 -31) Memory.inc | 29 ++++++++++++++-------------- Unix.h | 63 ++++++++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 61 insertions(+), 31 deletions(-) Index: llvm/lib/System/Unix/Memory.inc diff -u llvm/lib/System/Unix/Memory.inc:1.4 llvm/lib/System/Unix/Memory.inc:1.5 --- llvm/lib/System/Unix/Memory.inc:1.4 Fri Jul 29 18:39:25 2005 +++ llvm/lib/System/Unix/Memory.inc Fri Jul 7 12:32:37 2006 @@ -18,14 +18,14 @@ #include #endif -namespace llvm { - /// AllocateRWXMemory - Allocate a slab of memory with read/write/execute /// permissions. This is typically used for JIT applications where we want /// to emit code to the memory then jump to it. Getting this type of memory /// is very OS specific. /// -MemoryBlock Memory::AllocateRWX(unsigned NumBytes, const MemoryBlock* NearBlock) { +llvm::sys::MemoryBlock +llvm::sys::Memory::AllocateRWX(unsigned NumBytes, const MemoryBlock* NearBlock, + std::string *ErrMsg) { if (NumBytes == 0) return MemoryBlock(); long pageSize = Process::GetPageSize(); @@ -35,7 +35,8 @@ #ifdef NEED_DEV_ZERO_FOR_MMAP static int zero_fd = open("/dev/zero", O_RDWR); if (zero_fd == -1) { - ThrowErrno("Can't open /dev/zero device"); + GetErrno("Can't open /dev/zero device", ErrMsg); + return MemoryBlock(); } fd = zero_fd; #endif @@ -48,15 +49,17 @@ #endif ; - void* start = NearBlock ? (unsigned char*) NearBlock->base() + NearBlock->size() : 0; + void* start = NearBlock ? (unsigned char*)NearBlock->base() + + NearBlock->size() : 0; void *pa = ::mmap(start, pageSize*NumPages, PROT_READ|PROT_WRITE|PROT_EXEC, flags, fd, 0); if (pa == MAP_FAILED) { if (NearBlock) //Try again without a near hint return AllocateRWX(NumBytes, 0); - else - ThrowErrno("Can't allocate RWX Memory"); + + GetErrno("Can't allocate RWX Memory", ErrMsg); + return MemoryBlock(); } MemoryBlock result; result.Address = pa; @@ -64,12 +67,10 @@ return result; } -void Memory::ReleaseRWX(MemoryBlock& M) { - if (M.Address == 0 || M.Size == 0) return; - if (0 != ::munmap(M.Address, M.Size)) { - ThrowErrno("Can't release RWX Memory"); - } -} - +bool llvm::sys::Memory::ReleaseRWX(MemoryBlock &M, std::string *ErrMsg) { + if (M.Address == 0 || M.Size == 0) return false; + if (0 != ::munmap(M.Address, M.Size)) + return GetErrno("Can't release RWX Memory", ErrMsg); + return false; } Index: llvm/lib/System/Unix/Unix.h diff -u llvm/lib/System/Unix/Unix.h:1.14 llvm/lib/System/Unix/Unix.h:1.15 --- llvm/lib/System/Unix/Unix.h:1.14 Thu Apr 21 17:48:37 2005 +++ llvm/lib/System/Unix/Unix.h Fri Jul 7 12:32:37 2006 @@ -66,28 +66,57 @@ # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif +inline bool GetErrno(const std::string &prefix, std::string *ErrDest, + int errnum = -1) { + char buffer[MAXPATHLEN]; + + if (ErrDest == 0) return true; + + buffer[0] = 0; + if (errnum == -1) + errnum = errno; +#ifdef HAVE_STRERROR_R + // strerror_r is thread-safe. + if (errnum) + strerror_r(errnum, buffer, MAXPATHLEN-1); +#elif HAVE_STRERROR + // Copy the thread un-safe result of strerror into + // the buffer as fast as possible to minimize impact + // of collision of strerror in multiple threads. + if (errnum) + strncpy(buffer, strerror(errnum), MAXPATHLEN-1); + buffer[MAXPATHLEN-1] = 0; +#else + // Strange that this system doesn't even have strerror + // but, oh well, just use a generic message + sprintf(buffer, "Error #%d", errnum); +#endif + *ErrDest = prefix + ": " + buffer; + return true; +} + inline void ThrowErrno(const std::string& prefix, int errnum = -1) { - char buffer[MAXPATHLEN]; - buffer[0] = 0; - if (errnum == -1) - errnum = errno; + char buffer[MAXPATHLEN]; + buffer[0] = 0; + if (errnum == -1) + errnum = errno; #ifdef HAVE_STRERROR_R - // strerror_r is thread-safe. - if (errnum) - strerror_r(errnum,buffer,MAXPATHLEN-1); + // strerror_r is thread-safe. + if (errnum) + strerror_r(errnum,buffer,MAXPATHLEN-1); #elif HAVE_STRERROR - // Copy the thread un-safe result of strerror into - // the buffer as fast as possible to minimize impact - // of collision of strerror in multiple threads. - if (errnum) - strncpy(buffer,strerror(errnum),MAXPATHLEN-1); - buffer[MAXPATHLEN-1] = 0; + // Copy the thread un-safe result of strerror into + // the buffer as fast as possible to minimize impact + // of collision of strerror in multiple threads. + if (errnum) + strncpy(buffer,strerror(errnum),MAXPATHLEN-1); + buffer[MAXPATHLEN-1] = 0; #else - // Strange that this system doesn't even have strerror - // but, oh well, just use a generic message - sprintf(buffer, "Error #%d", errnum); + // Strange that this system doesn't even have strerror + // but, oh well, just use a generic message + sprintf(buffer, "Error #%d", errnum); #endif - throw prefix + ": " + buffer; + throw prefix + ": " + buffer; } #endif From evan.cheng at apple.com Fri Jul 7 12:54:23 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 7 Jul 2006 12:54:23 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/vec_shuffle.ll Message-ID: <200607071754.MAA02085@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: vec_shuffle.ll updated: 1.7 -> 1.8 --- Log message: Update --- Diffs of the changes: (+1 -1) vec_shuffle.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/X86/vec_shuffle.ll diff -u llvm/test/Regression/CodeGen/X86/vec_shuffle.ll:1.7 llvm/test/Regression/CodeGen/X86/vec_shuffle.ll:1.8 --- llvm/test/Regression/CodeGen/X86/vec_shuffle.ll:1.7 Thu Apr 20 23:58:23 2006 +++ llvm/test/Regression/CodeGen/X86/vec_shuffle.ll Fri Jul 7 12:54:10 2006 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep shufp | wc -l | grep 1 && -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movhpd | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movups | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshufhw | wc -l | grep 1 void %test_v4sf(<4 x float>* %P, float %X, float %Y) { From evan.cheng at apple.com Fri Jul 7 12:54:37 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 7 Jul 2006 12:54:37 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/vec_shuffle-6.ll Message-ID: <200607071754.MAA02783@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: vec_shuffle-6.ll added (r1.1) --- Log message: New vector shuffle test case. --- Diffs of the changes: (+30 -0) vec_shuffle-6.ll | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+) Index: llvm/test/Regression/CodeGen/X86/vec_shuffle-6.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/vec_shuffle-6.ll:1.1 *** /dev/null Fri Jul 7 12:54:34 2006 --- llvm/test/Regression/CodeGen/X86/vec_shuffle-6.ll Fri Jul 7 12:54:24 2006 *************** *** 0 **** --- 1,30 ---- + ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movups | wc -l | grep 3 + + %x = global [4 x int] [ int 1, int 2, int 3, int 4 ] + + <2 x long> %test1() { + %tmp = load int* getelementptr ([4 x int]* %x, int 0, int 0) + %tmp3 = load int* getelementptr ([4 x int]* %x, int 0, int 1) + %tmp5 = load int* getelementptr ([4 x int]* %x, int 0, int 2) + %tmp7 = load int* getelementptr ([4 x int]* %x, int 0, int 3) + %tmp = insertelement <4 x int> undef, int %tmp, uint 0 + %tmp13 = insertelement <4 x int> %tmp, int %tmp3, uint 1 + %tmp14 = insertelement <4 x int> %tmp13, int %tmp5, uint 2 + %tmp15 = insertelement <4 x int> %tmp14, int %tmp7, uint 3 + %tmp16 = cast <4 x int> %tmp15 to <2 x long> + ret <2 x long> %tmp16 + } + + <4 x float> %test2(float %a, float %b, float %c, float %d) { + %tmp = insertelement <4 x float> undef, float %a, uint 0 + %tmp11 = insertelement <4 x float> %tmp, float %b, uint 1 + %tmp12 = insertelement <4 x float> %tmp11, float %c, uint 2 + %tmp13 = insertelement <4 x float> %tmp12, float %d, uint 3 + ret <4 x float> %tmp13 + } + + <2 x double> %test3(double %a, double %b) { + %tmp = insertelement <2 x double> undef, double %a, uint 0 + %tmp7 = insertelement <2 x double> %tmp, double %b, uint 1 + ret <2 x double> %tmp7 + } From lattner at cs.uiuc.edu Fri Jul 7 13:11:13 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 13:11:13 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/Path.h Message-ID: <200607071811.NAA28160@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: Path.h updated: 1.29 -> 1.30 --- Log message: #include not --- Diffs of the changes: (+2 -5) Path.h | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) Index: llvm/include/llvm/System/Path.h diff -u llvm/include/llvm/System/Path.h:1.29 llvm/include/llvm/System/Path.h:1.30 --- llvm/include/llvm/System/Path.h:1.29 Thu Jun 8 12:00:08 2006 +++ llvm/include/llvm/System/Path.h Fri Jul 7 13:10:59 2006 @@ -18,7 +18,7 @@ #include #include #include -#include +#include namespace llvm { namespace sys { @@ -567,10 +567,7 @@ void CopyFile(const Path& Dest, const Path& Src); } -inline std::ostream& operator<<(std::ostream& strm, const sys::Path& aPath) { - strm << aPath.toString(); - return strm; -} +std::ostream& operator<<(std::ostream& strm, const sys::Path& aPath); } From lattner at cs.uiuc.edu Fri Jul 7 13:11:45 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 13:11:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Path.cpp Message-ID: <200607071811.NAA28432@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: Path.cpp updated: 1.19 -> 1.20 --- Log message: Move << method out of line. --- Diffs of the changes: (+8 -8) Path.cpp | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/lib/System/Path.cpp diff -u llvm/lib/System/Path.cpp:1.19 llvm/lib/System/Path.cpp:1.20 --- llvm/lib/System/Path.cpp:1.19 Thu Jul 7 18:21:43 2005 +++ llvm/lib/System/Path.cpp Fri Jul 7 13:11:32 2006 @@ -14,8 +14,8 @@ #include "llvm/System/Path.h" #include "llvm/Config/config.h" #include - -namespace llvm { +#include +using namespace llvm; using namespace sys; //===----------------------------------------------------------------------===// @@ -23,6 +23,11 @@ //=== independent code. //===----------------------------------------------------------------------===// +std::ostream& llvm::operator<<(std::ostream &strm, const sys::Path &aPath) { + strm << aPath.toString(); + return strm; +} + Path Path::GetLLVMConfigDir() { Path result; @@ -91,19 +96,14 @@ return sys::Path(); } -std::string -Path::GetDLLSuffix() { +std::string Path::GetDLLSuffix() { return LTDL_SHLIB_EXT; } -} - // Include the truly platform-specific parts of this class. - #if defined(LLVM_ON_UNIX) #include "Unix/Path.inc" #endif #if defined(LLVM_ON_WIN32) #include "Win32/Path.inc" #endif - From pjenkins at apple.com Fri Jul 7 13:51:04 2006 From: pjenkins at apple.com (Patrick Jenkins) Date: Fri, 7 Jul 2006 13:51:04 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200607071851.NAA03402@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.4 -> 1.5 --- Log message: Updated comments at top of file to reflect relevant command line options. --- Diffs of the changes: (+23 -10) NewNightlyTest.pl | 33 +++++++++++++++++++++++---------- 1 files changed, 23 insertions(+), 10 deletions(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.4 llvm/utils/NewNightlyTest.pl:1.5 --- llvm/utils/NewNightlyTest.pl:1.4 Fri Jul 7 12:31:38 2006 +++ llvm/utils/NewNightlyTest.pl Fri Jul 7 13:50:51 2006 @@ -27,9 +27,6 @@ # -norunningtests. # -norunningtests Do not run the Olden benchmark suite with # LARGE_PROBLEM_SIZE enabled. -# -noexternals Do not run the external tests (for cases where povray -# or SPEC are not installed) -# -with-externals Specify a directory where the external tests are located. # -nodejagnu Do not run feature or regression tests # -parallel Run two parallel jobs with GNU Make. # -release Build an LLVM Release version @@ -54,14 +51,15 @@ # override the default. # -ldflags Next argument specifies that linker options that override # the default. -# -extraflags Next argument specifies extra options that are passed to -# compile the tests. +# -compileflags Next argument specifies extra options passed to make when +# building LLVM. # # ---------------- Options to configure llvm-test ---------------------------- -# -spec2000path Path to the benchspec directory in the SPEC 2000 distro -# -spec95path Path to the benchspec directory in the SPEC 95 distro. -# -povraypath Path to the povray sources -# -namdpath Path to the namd sources +# -extraflags Next argument specifies extra options that are passed to +# compile the tests. +# -noexternals Do not run the external tests (for cases where povray +# or SPEC are not installed) +# -with-externals Specify a directory where the external tests are located. # # CVSROOT is the CVS repository from which the tree will be checked out, # specified either in the full :method:user at host:/dir syntax, or @@ -451,6 +449,12 @@ return $result; } +############################################################## +# +# Getting Start timestamp +# +############################################################## +$starttime = `date`; ############################################################## # @@ -912,6 +916,13 @@ #AddRecord($BytecodeSize, "running_Olden_bytecode.txt", $WebDir); } +############################################################## +# +# Getting end timestamp +# +############################################################## +$endtime = `date`; + ############################################################## # @@ -1001,7 +1012,9 @@ 'removed_tests' => $TestsRemoved, 'unexpfail_tests' => $unexpfail_tests, 'dejagnutests_log' => $dejagnutests_log, - 'dejagnutests_sum' => $dejagnutests_sum); + 'dejagnutests_sum' => $dejagnutests_sum + 'starttime' => $starttime, + 'endtime' => $endtime); $TESTING = 0; From reid at x10sys.com Fri Jul 7 14:09:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jul 2006 14:09:28 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-ranlib/llvm-ranlib.cpp Message-ID: <200607071909.OAA07480@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ranlib: llvm-ranlib.cpp updated: 1.8 -> 1.9 --- Log message: Remove EH use from the Archive library and adjust its users accordingly. --- Diffs of the changes: (+2 -1) llvm-ranlib.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/tools/llvm-ranlib/llvm-ranlib.cpp diff -u llvm/tools/llvm-ranlib/llvm-ranlib.cpp:1.8 llvm/tools/llvm-ranlib/llvm-ranlib.cpp:1.9 --- llvm/tools/llvm-ranlib/llvm-ranlib.cpp:1.8 Wed Dec 28 00:58:12 2005 +++ llvm/tools/llvm-ranlib/llvm-ranlib.cpp Fri Jul 7 14:09:14 2006 @@ -74,7 +74,8 @@ if (!TheArchive) throw err_msg; - TheArchive->writeToDisk(true, false, false ); + if (!TheArchive->writeToDisk(true, false, false, &err_msg )) + throw err_msg; if (Verbose) printSymbolTable(TheArchive); From reid at x10sys.com Fri Jul 7 14:09:29 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jul 2006 14:09:29 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-ar/llvm-ar.cpp Message-ID: <200607071909.OAA07496@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ar: llvm-ar.cpp updated: 1.31 -> 1.32 --- Log message: Remove EH use from the Archive library and adjust its users accordingly. --- Diffs of the changes: (+12 -4) llvm-ar.cpp | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) Index: llvm/tools/llvm-ar/llvm-ar.cpp diff -u llvm/tools/llvm-ar/llvm-ar.cpp:1.31 llvm/tools/llvm-ar/llvm-ar.cpp:1.32 --- llvm/tools/llvm-ar/llvm-ar.cpp:1.31 Wed May 24 12:04:04 2006 +++ llvm/tools/llvm-ar/llvm-ar.cpp Fri Jul 7 14:09:14 2006 @@ -484,7 +484,9 @@ } // We're done editting, reconstruct the archive. - TheArchive->writeToDisk(SymTable,TruncateNames,Compression); + std::string errmsg; + if (!TheArchive->writeToDisk(SymTable,TruncateNames,Compression,&errmsg)) + throw errmsg; if (ReallyVerbose) printSymbolTable(); } @@ -536,7 +538,9 @@ } // We're done editting, reconstruct the archive. - TheArchive->writeToDisk(SymTable,TruncateNames,Compression); + std::string errmsg; + if (!TheArchive->writeToDisk(SymTable,TruncateNames,Compression,&errmsg)) + throw errmsg; if (ReallyVerbose) printSymbolTable(); } @@ -555,7 +559,9 @@ } // We're done editting, reconstruct the archive. - TheArchive->writeToDisk(SymTable,TruncateNames,Compression); + std::string errmsg; + if (!TheArchive->writeToDisk(SymTable,TruncateNames,Compression,&errmsg)) + throw errmsg; if (ReallyVerbose) printSymbolTable(); } @@ -642,7 +648,9 @@ } // We're done editting, reconstruct the archive. - TheArchive->writeToDisk(SymTable,TruncateNames,Compression); + std::string errmsg; + if (!TheArchive->writeToDisk(SymTable,TruncateNames,Compression,&errmsg)) + throw errmsg; if (ReallyVerbose) printSymbolTable(); } From reid at x10sys.com Fri Jul 7 14:09:29 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jul 2006 14:09:29 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Archive.h Message-ID: <200607071909.OAA07500@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Bytecode: Archive.h updated: 1.14 -> 1.15 --- Log message: Remove EH use from the Archive library and adjust its users accordingly. --- Diffs of the changes: (+18 -6) Archive.h | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-) Index: llvm/include/llvm/Bytecode/Archive.h diff -u llvm/include/llvm/Bytecode/Archive.h:1.14 llvm/include/llvm/Bytecode/Archive.h:1.15 --- llvm/include/llvm/Bytecode/Archive.h:1.14 Wed Feb 22 10:23:42 2006 +++ llvm/include/llvm/Bytecode/Archive.h Fri Jul 7 14:09:13 2006 @@ -438,12 +438,14 @@ /// name will be truncated at 15 characters. If \p Compress is specified, /// all archive members will be compressed before being written. If /// \p PrintSymTab is true, the symbol table will be printed to std::cout. - /// @throws std::string if an error occurs + /// @returns false if an error occurred, \p error set to error message + /// @returns true if the writing succeeded. /// @brief Write (possibly modified) archive contents to disk - void writeToDisk( + bool writeToDisk( bool CreateSymbolTable=false, ///< Create Symbol table bool TruncateNames=false, ///< Truncate the filename to 15 chars - bool Compress=false ///< Compress files + bool Compress=false, ///< Compress files + std::string* error = 0 ///< If non-null, where error msg is set ); /// This method adds a new file to the archive. The \p filename is examined @@ -481,9 +483,19 @@ /// @brief Write the symbol table to an ofstream. void writeSymbolTable(std::ofstream& ARFile); - /// @brief Write one ArchiveMember to an ofstream. - void writeMember(const ArchiveMember& member, std::ofstream& ARFile, - bool CreateSymbolTable, bool TruncateNames, bool ShouldCompress); + /// Writes one ArchiveMember to an ofstream. If an error occurs, returns + /// false, otherwise true. If an error occurs and error is non-null then + /// it will be set to an error message. + /// @returns true Writing member succeeded + /// @returns false Writing member failed, \p error set to error message + bool writeMember( + const ArchiveMember& member, ///< The member to be written + std::ofstream& ARFile, ///< The file to write member onto + bool CreateSymbolTable, ///< Should symbol table be created? + bool TruncateNames, ///< Should names be truncated to 11 chars? + bool ShouldCompress, ///< Should the member be compressed? + std::string* error = 0 ///< If non-null, place were error msg is set + ); /// @brief Fill in an ArchiveMemberHeader from ArchiveMember. bool fillHeader(const ArchiveMember&mbr, From reid at x10sys.com Fri Jul 7 14:09:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jul 2006 14:09:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Message-ID: <200607071909.OAA07476@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveWriter.cpp updated: 1.21 -> 1.22 --- Log message: Remove EH use from the Archive library and adjust its users accordingly. --- Diffs of the changes: (+109 -98) ArchiveWriter.cpp | 207 ++++++++++++++++++++++++++++-------------------------- 1 files changed, 109 insertions(+), 98 deletions(-) Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.21 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.22 --- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.21 Tue Nov 29 23:21:10 2005 +++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Fri Jul 7 14:09:13 2006 @@ -184,13 +184,14 @@ } // Write one member out to the file. -void +bool Archive::writeMember( const ArchiveMember& member, std::ofstream& ARFile, bool CreateSymbolTable, bool TruncateNames, - bool ShouldCompress + bool ShouldCompress, + std::string* error ) { unsigned filepos = ARFile.tellp(); @@ -235,8 +236,12 @@ // We don't need this module any more. delete MP; } else { - throw std::string("Can't parse bytecode member: ") + - member.getPath().toString(); + if (mFile != 0) { + mFile->close(); + delete mFile; + } + if (error) + *error = "Can't parse bytecode member: " + member.getPath().toString(); } } @@ -263,7 +268,9 @@ data +=4; fSize -= 4; } - fSize = Compressor::compressToNewBuffer(data,fSize,output); + fSize = Compressor::compressToNewBuffer(data,fSize,output,error); + if (fSize == 0) + return false; data = output; if (member.isBytecode()) hdrSize = -fSize-4; @@ -307,6 +314,7 @@ mFile->close(); delete mFile; } + return true; } // Write out the LLVM symbol table as an archive member to the file. @@ -364,9 +372,10 @@ // This writes to a temporary file first. Options are for creating a symbol // table, flattening the file names (no directories, 15 chars max) and // compressing each archive member. -void -Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress){ - +bool +Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress, + std::string* error) +{ // Make sure they haven't opened up the file, not loaded it, // but are now trying to write it which would wipe out the file. assert(!(members.empty() && mapfile->size() > 8) && @@ -379,104 +388,106 @@ // Make sure the temporary gets removed if we crash sys::RemoveFileOnSignal(TmpArchive); - // Ensure we can remove the temporary even in the face of an exception - try { - // Create archive file for output. - std::ios::openmode io_mode = std::ios::out | std::ios::trunc | - std::ios::binary; - std::ofstream ArchiveFile(TmpArchive.c_str(), io_mode); - - // Check for errors opening or creating archive file. - if ( !ArchiveFile.is_open() || ArchiveFile.bad() ) { - throw std::string("Error opening archive file: ") + archPath.toString(); - } + // Create archive file for output. + std::ios::openmode io_mode = std::ios::out | std::ios::trunc | + std::ios::binary; + std::ofstream ArchiveFile(TmpArchive.c_str(), io_mode); - // If we're creating a symbol table, reset it now - if (CreateSymbolTable) { - symTabSize = 0; - symTab.clear(); + // Check for errors opening or creating archive file. + if ( !ArchiveFile.is_open() || ArchiveFile.bad() ) { + if (TmpArchive.exists()) + TmpArchive.eraseFromDisk(); + if (error) + *error = "Error opening archive file: " + archPath.toString(); + return false; + } + + // If we're creating a symbol table, reset it now + if (CreateSymbolTable) { + symTabSize = 0; + symTab.clear(); + } + + // Write magic string to archive. + ArchiveFile << ARFILE_MAGIC; + + // Loop over all member files, and write them out. Note that this also + // builds the symbol table, symTab. + for ( MembersList::iterator I = begin(), E = end(); I != E; ++I) { + if (!writeMember(*I,ArchiveFile,CreateSymbolTable, + TruncateNames,Compress,error)) + { + if (TmpArchive.exists()) + TmpArchive.eraseFromDisk(); + ArchiveFile.close(); + return false; } + } - // Write magic string to archive. - ArchiveFile << ARFILE_MAGIC; + // Close archive file. + ArchiveFile.close(); - // Loop over all member files, and write them out. Note that this also - // builds the symbol table, symTab. - for ( MembersList::iterator I = begin(), E = end(); I != E; ++I) { - writeMember(*I,ArchiveFile,CreateSymbolTable,TruncateNames,Compress); + // Write the symbol table + if (CreateSymbolTable) { + // At this point we have written a file that is a legal archive but it + // doesn't have a symbol table in it. To aid in faster reading and to + // ensure compatibility with other archivers we need to put the symbol + // table first in the file. Unfortunately, this means mapping the file + // we just wrote back in and copying it to the destination file. + + // Map in the archive we just wrote. + sys::MappedFile arch(TmpArchive); + const char* base = (const char*) arch.map(); + + // Open another temporary file in order to avoid invalidating the + // mmapped data + sys::Path FinalFilePath = archPath; + FinalFilePath.createTemporaryFileOnDisk(); + sys::RemoveFileOnSignal(FinalFilePath); + + std::ofstream FinalFile(FinalFilePath.c_str(), io_mode); + if ( !FinalFile.is_open() || FinalFile.bad() ) { + if (TmpArchive.exists()) + TmpArchive.eraseFromDisk(); + if (error) + *error = "Error opening archive file: " + FinalFilePath.toString(); + return false; } - // Close archive file. - ArchiveFile.close(); + // Write the file magic number + FinalFile << ARFILE_MAGIC; - // Write the symbol table - if (CreateSymbolTable) { - // At this point we have written a file that is a legal archive but it - // doesn't have a symbol table in it. To aid in faster reading and to - // ensure compatibility with other archivers we need to put the symbol - // table first in the file. Unfortunately, this means mapping the file - // we just wrote back in and copying it to the destination file. - - // Map in the archive we just wrote. - sys::MappedFile arch(TmpArchive); - const char* base = (const char*) arch.map(); - - // Open another temporary file in order to avoid invalidating the mmapped data - sys::Path FinalFilePath = archPath; - FinalFilePath.createTemporaryFileOnDisk(); - sys::RemoveFileOnSignal(FinalFilePath); - try { - - - std::ofstream FinalFile(FinalFilePath.c_str(), io_mode); - if ( !FinalFile.is_open() || FinalFile.bad() ) { - throw std::string("Error opening archive file: ") + FinalFilePath.toString(); - } - - // Write the file magic number - FinalFile << ARFILE_MAGIC; - - // If there is a foreign symbol table, put it into the file now. Most - // ar(1) implementations require the symbol table to be first but llvm-ar - // can deal with it being after a foreign symbol table. This ensures - // compatibility with other ar(1) implementations as well as allowing the - // archive to store both native .o and LLVM .bc files, both indexed. - if (foreignST) { - writeMember(*foreignST, FinalFile, false, false, false); - } - - // Put out the LLVM symbol table now. - writeSymbolTable(FinalFile); - - // Copy the temporary file contents being sure to skip the file's magic - // number. - FinalFile.write(base + sizeof(ARFILE_MAGIC)-1, - arch.size()-sizeof(ARFILE_MAGIC)+1); - - // Close up shop - FinalFile.close(); - arch.close(); - - // Move the final file over top of TmpArchive - FinalFilePath.renamePathOnDisk(TmpArchive); - } catch (...) { - // Make sure we clean up. - if (FinalFilePath.exists()) - FinalFilePath.eraseFromDisk(); - throw; - } + // If there is a foreign symbol table, put it into the file now. Most + // ar(1) implementations require the symbol table to be first but llvm-ar + // can deal with it being after a foreign symbol table. This ensures + // compatibility with other ar(1) implementations as well as allowing the + // archive to store both native .o and LLVM .bc files, both indexed. + if (foreignST) { + writeMember(*foreignST, FinalFile, false, false, false); } + + // Put out the LLVM symbol table now. + writeSymbolTable(FinalFile); + + // Copy the temporary file contents being sure to skip the file's magic + // number. + FinalFile.write(base + sizeof(ARFILE_MAGIC)-1, + arch.size()-sizeof(ARFILE_MAGIC)+1); + + // Close up shop + FinalFile.close(); + arch.close(); - // Before we replace the actual archive, we need to forget all the - // members, since they point to data in that old archive. We need to do - // we cannot replace an open file on Windows. - cleanUpMemory(); - - TmpArchive.renamePathOnDisk(archPath); - } catch (...) { - // Make sure we clean up. - if (TmpArchive.exists()) - TmpArchive.eraseFromDisk(); - throw; + // Move the final file over top of TmpArchive + FinalFilePath.renamePathOnDisk(TmpArchive); } + + // Before we replace the actual archive, we need to forget all the + // members, since they point to data in that old archive. We need to do + // this because we cannot replace an open file on Windows. + cleanUpMemory(); + + TmpArchive.renamePathOnDisk(archPath); + + return true; } From reid at x10sys.com Fri Jul 7 15:57:05 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jul 2006 15:57:05 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-nm/llvm-nm.cpp Message-ID: <200607072057.PAA07480@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-nm: llvm-nm.cpp updated: 1.26 -> 1.27 --- Log message: Finish removal of EH usage from the Archive library. The REQUIRES_EH flag in lib/Bytecode/Archive/Makefile is now removed. One small step closer to a smaller LLVM. --- Diffs of the changes: (+2 -1) llvm-nm.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/tools/llvm-nm/llvm-nm.cpp diff -u llvm/tools/llvm-nm/llvm-nm.cpp:1.26 llvm/tools/llvm-nm/llvm-nm.cpp:1.27 --- llvm/tools/llvm-nm/llvm-nm.cpp:1.26 Wed May 24 12:04:04 2006 +++ llvm/tools/llvm-nm/llvm-nm.cpp Fri Jul 7 15:56:50 2006 @@ -134,7 +134,8 @@ return; } } else if (aPath.isArchive()) { - Archive* archive = Archive::OpenAndLoad(sys::Path(Filename)); + std::string ErrMsg; + Archive* archive = Archive::OpenAndLoad(sys::Path(Filename),&ErrorMessage); if (!archive) std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n"; std::vector Modules; From reid at x10sys.com Fri Jul 7 15:57:05 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jul 2006 15:57:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkArchives.cpp Message-ID: <200607072057.PAA07499@zion.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkArchives.cpp updated: 1.49 -> 1.50 --- Log message: Finish removal of EH usage from the Archive library. The REQUIRES_EH flag in lib/Bytecode/Archive/Makefile is now removed. One small step closer to a smaller LLVM. --- Diffs of the changes: (+3 -1) LinkArchives.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/Linker/LinkArchives.cpp diff -u llvm/lib/Linker/LinkArchives.cpp:1.49 llvm/lib/Linker/LinkArchives.cpp:1.50 --- llvm/lib/Linker/LinkArchives.cpp:1.49 Thu Apr 21 17:47:36 2005 +++ llvm/lib/Linker/LinkArchives.cpp Fri Jul 7 15:56:50 2006 @@ -137,7 +137,9 @@ // Find the modules we need to link into the target module std::set Modules; - arch->findModulesDefiningSymbols(UndefinedSymbols, Modules); + if (!arch->findModulesDefiningSymbols(UndefinedSymbols, Modules, &ErrMsg)) + return error("Cannot find symbols in '" + Filename.toString() + + "': " + ErrMsg); // If we didn't find any more modules to link this time, we are done // searching this archive. From reid at x10sys.com Fri Jul 7 15:57:05 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jul 2006 15:57:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveReader.cpp ArchiveWriter.cpp Makefile Message-ID: <200607072057.PAA07486@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveReader.cpp updated: 1.44 -> 1.45 ArchiveWriter.cpp updated: 1.22 -> 1.23 Makefile updated: 1.3 -> 1.4 --- Log message: Finish removal of EH usage from the Archive library. The REQUIRES_EH flag in lib/Bytecode/Archive/Makefile is now removed. One small step closer to a smaller LLVM. --- Diffs of the changes: (+137 -70) ArchiveReader.cpp | 199 +++++++++++++++++++++++++++++++++++------------------- ArchiveWriter.cpp | 7 + Makefile | 1 3 files changed, 137 insertions(+), 70 deletions(-) Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.44 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.45 --- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.44 Fri May 12 12:56:20 2006 +++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp Fri Jul 7 15:56:50 2006 @@ -18,13 +18,13 @@ using namespace llvm; /// Read a variable-bit-rate encoded unsigned integer -inline unsigned readInteger(const char*&At, const char*End) { +inline unsigned readInteger(const char*&At, const char*End){ unsigned Shift = 0; unsigned Result = 0; do { if (At == End) - throw std::string("Ran out of data reading vbr_uint!"); + return Result; Result |= (unsigned)((*At++) & 0x7F) << Shift; Shift += 7; } while (At[-1] & 0x80); @@ -32,36 +32,48 @@ } // Completely parse the Archive's symbol table and populate symTab member var. -void -Archive::parseSymbolTable(const void* data, unsigned size) { +bool +Archive::parseSymbolTable(const void* data, unsigned size, std::string* error) { const char* At = (const char*) data; const char* End = At + size; while (At < End) { unsigned offset = readInteger(At, End); + if (At == End) { + if (error) + *error = "Ran out of data reading vbr_uint for symtab offset!"; + return false; + } unsigned length = readInteger(At, End); - if (At + length > End) - throw std::string("malformed symbol table"); + if (At == End) { + if (error) + *error = "Ran out of data reading vbr_uint for symtab length!"; + return false; + } + if (At + length > End) { + if (error) + *error = "Malformed symbol table: length not consistent with size"; + return false; + } // we don't care if it can't be inserted (duplicate entry) symTab.insert(std::make_pair(std::string(At, length), offset)); At += length; } symTabSize = size; + return true; } // This member parses an ArchiveMemberHeader that is presumed to be pointed to // by At. The At pointer is updated to the byte just after the header, which // can be variable in size. ArchiveMember* -Archive::parseMemberHeader(const char*& At, const char* End) { +Archive::parseMemberHeader(const char*& At, const char* End, std::string* error) +{ assert(At + sizeof(ArchiveMemberHeader) < End && "Not enough data"); // Cast archive member header ArchiveMemberHeader* Hdr = (ArchiveMemberHeader*)At; At += sizeof(ArchiveMemberHeader); - // Instantiate the ArchiveMember to be filled - ArchiveMember* member = new ArchiveMember(this); - // Extract the size and determine if the file is // compressed or not (negative length). int flags = 0; @@ -72,12 +84,18 @@ } // Check the size of the member for sanity - if (At + MemberSize > End) - throw std::string("invalid member length in archive file"); + if (At + MemberSize > End) { + if (error) + *error = "invalid member length in archive file"; + return 0; + } // Check the member signature - if (!Hdr->checkSignature()) - throw std::string("invalid file member signature"); + if (!Hdr->checkSignature()) { + if (error) + *error = "invalid file member signature"; + return 0; + } // Convert and check the member name // The empty name ( '/' and 15 blanks) is for a foreign (non-LLVM) symbol @@ -100,8 +118,11 @@ At += len; MemberSize -= len; flags |= ArchiveMember::HasLongFilenameFlag; - } else - throw std::string("invalid long filename"); + } else { + if (error) + *error = "invalid long filename"; + return 0; + } } else if (Hdr->name[1] == '_' && (0 == memcmp(Hdr->name, ARFILE_LLVM_SYMTAB_NAME, 16))) { // The member is using a long file name (>15 chars) format. @@ -120,14 +141,18 @@ pathname.assign(ARFILE_STRTAB_NAME); flags |= ArchiveMember::StringTableFlag; } else { - throw std::string("invalid string table name"); + if (error) + *error = "invalid string table name"; + return 0; } } else if (Hdr->name[1] == ' ') { if (0 == memcmp(Hdr->name, ARFILE_SVR4_SYMTAB_NAME, 16)) { pathname.assign(ARFILE_SVR4_SYMTAB_NAME); flags |= ArchiveMember::SVR4SymbolTableFlag; } else { - throw std::string("invalid SVR4 symbol table name"); + if (error) + *error = "invalid SVR4 symbol table name"; + return 0; } } else if (isdigit(Hdr->name[1])) { unsigned index = atoi(&Hdr->name[1]); @@ -145,10 +170,15 @@ last_p = p; p++; } - if (p >= endp) - throw std::string("missing name termiantor in string table"); + if (p >= endp) { + if (error) + *error = "missing name termiantor in string table"; + return 0; + } } else { - throw std::string("name index beyond string table"); + if (error) + *error = "name index beyond string table"; + return 0; } } break; @@ -184,6 +214,9 @@ break; } + // Instantiate the ArchiveMember to be filled + ArchiveMember* member = new ArchiveMember(this); + // Fill in fields of the ArchiveMember member->next = 0; member->prev = 0; @@ -202,18 +235,22 @@ return member; } -void -Archive::checkSignature() { +bool +Archive::checkSignature(std::string* error) { // Check the magic string at file's header - if (mapfile->size() < 8 || memcmp(base, ARFILE_MAGIC, 8)) - throw std::string("invalid signature for an archive file"); + if (mapfile->size() < 8 || memcmp(base, ARFILE_MAGIC, 8)) { + if (error) + *error = "invalid signature for an archive file"; + return false; + } + return true; } // This function loads the entire archive and fully populates its ilist with // the members of the archive file. This is typically used in preparation for // editing the contents of the archive. -void -Archive::loadArchive() { +bool +Archive::loadArchive(std::string* error) { // Set up parsing members.clear(); @@ -221,7 +258,9 @@ const char *At = base; const char *End = base + mapfile->size(); - checkSignature(); + if (!checkSignature(error)) + return false; + At += 8; // Skip the magic string. bool seenSymbolTable = false; @@ -229,7 +268,9 @@ while (At < End) { // parse the member header const char* Save = At; - ArchiveMember* mbr = parseMemberHeader(At, End); + ArchiveMember* mbr = parseMemberHeader(At, End, error); + if (!mbr) + return false; // check if this is the foreign symbol table if (mbr->isSVR4SymbolTable() || mbr->isBSD4SymbolTable()) { @@ -257,9 +298,13 @@ } else if (mbr->isLLVMSymbolTable()) { // This is the LLVM symbol table for the archive. If we've seen it // already, its an error. Otherwise, parse the symbol table and move on. - if (seenSymbolTable) - throw std::string("invalid archive: multiple symbol tables"); - parseSymbolTable(mbr->getData(), mbr->getSize()); + if (seenSymbolTable) { + if (error) + *error = "invalid archive: multiple symbol tables"; + return false; + } + if (!parseSymbolTable(mbr->getData(), mbr->getSize(), error)) + return false; seenSymbolTable = true; At += mbr->getSize(); if ((intptr_t(At) & 1) == 1) @@ -278,21 +323,17 @@ At++; } } + return true; } // Open and completely load the archive file. Archive* -Archive::OpenAndLoad(const sys::Path& file, std::string* ErrorMessage) { - try { - std::auto_ptr result ( new Archive(file, true)); - result->loadArchive(); - return result.release(); - } catch (const std::string& msg) { - if (ErrorMessage) { - *ErrorMessage = msg; - } +Archive::OpenAndLoad(const sys::Path& file, std::string* ErrorMessage) +{ + std::auto_ptr result ( new Archive(file, true)); + if (!result->loadArchive(ErrorMessage)) return 0; - } + return result.release(); } // Get all the bytecode modules from the archive @@ -315,8 +356,8 @@ } // Load just the symbol table from the archive file -void -Archive::loadSymbolTable() { +bool +Archive::loadSymbolTable(std::string* ErrorMsg) { // Set up parsing members.clear(); @@ -325,13 +366,16 @@ const char *End = base + mapfile->size(); // Make sure we're dealing with an archive - checkSignature(); + if (!checkSignature(ErrorMsg)) + return false; At += 8; // Skip signature // Parse the first file member header const char* FirstFile = At; - ArchiveMember* mbr = parseMemberHeader(At, End); + ArchiveMember* mbr = parseMemberHeader(At, End, ErrorMsg); + if (!mbr) + return false; if (mbr->isSVR4SymbolTable() || mbr->isBSD4SymbolTable()) { // Skip the foreign symbol table, we don't do anything with it @@ -342,7 +386,11 @@ // Read the next one FirstFile = At; - mbr = parseMemberHeader(At, End); + mbr = parseMemberHeader(At, End, ErrorMsg); + if (!mbr) { + delete mbr; + return false; + } } if (mbr->isStringTable()) { @@ -354,12 +402,20 @@ delete mbr; // Get the next one FirstFile = At; - mbr = parseMemberHeader(At, End); + mbr = parseMemberHeader(At, End, ErrorMsg); + if (!mbr) { + delete mbr; + return false; + } } // See if its the symbol table if (mbr->isLLVMSymbolTable()) { - parseSymbolTable(mbr->getData(), mbr->getSize()); + if (!parseSymbolTable(mbr->getData(), mbr->getSize(), ErrorMsg)) { + delete mbr; + return false; + } + At += mbr->getSize(); if ((intptr_t(At) & 1) == 1) At++; @@ -375,27 +431,23 @@ } firstFileOffset = FirstFile - base; + return true; } // Open the archive and load just the symbol tables Archive* Archive::OpenAndLoadSymbols(const sys::Path& file, std::string* ErrorMessage) { - try { - std::auto_ptr result ( new Archive(file, true) ); - result->loadSymbolTable(); - return result.release(); - } catch (const std::string& msg) { - if (ErrorMessage) { - *ErrorMessage = msg; - } + std::auto_ptr result ( new Archive(file, true) ); + if (!result->loadSymbolTable(ErrorMessage)) return 0; - } + return result.release(); } // Look up one symbol in the symbol table and return a ModuleProvider for the // module that defines that symbol. ModuleProvider* -Archive::findModuleDefiningSymbol(const std::string& symbol) { +Archive::findModuleDefiningSymbol(const std::string& symbol, + std::string* ErrMsg) { SymTabType::iterator SI = symTab.find(symbol); if (SI == symTab.end()) return 0; @@ -417,7 +469,9 @@ // Module hasn't been loaded yet, we need to load it const char* modptr = base + fileOffset; - ArchiveMember* mbr = parseMemberHeader(modptr, base + mapfile->size()); + ArchiveMember* mbr = parseMemberHeader(modptr, base + mapfile->size(),ErrMsg); + if (!mbr) + return false; // Now, load the bytecode module to get the ModuleProvider std::string FullMemberName = archPath.toString() + "(" + @@ -433,9 +487,10 @@ // Look up multiple symbols in the symbol table and return a set of // ModuleProviders that define those symbols. -void +bool Archive::findModulesDefiningSymbols(std::set& symbols, - std::set& result) + std::set& result, + std::string* error) { assert(mapfile && base && "Can't findModulesDefiningSymbols on new archive"); if (symTab.empty()) { @@ -453,7 +508,9 @@ unsigned offset = At - base - firstFileOffset; // Parse the file's header - ArchiveMember* mbr = parseMemberHeader(At, End); + ArchiveMember* mbr = parseMemberHeader(At, End, error); + if (!mbr) + return false; // If it contains symbols if (mbr->isBytecode() || mbr->isCompressedBytecode()) { @@ -474,8 +531,11 @@ // modules. modules.insert(std::make_pair(offset, std::make_pair(MP, mbr))); } else { - throw std::string("Can't parse bytecode member: ") + - mbr->getPath().toString(); + if (error) + *error = "Can't parse bytecode member: " + + mbr->getPath().toString(); + delete mbr; + return false; } } @@ -492,7 +552,7 @@ for (std::set::iterator I=symbols.begin(), E=symbols.end(); I != E;) { // See if this symbol exists - ModuleProvider* mp = findModuleDefiningSymbol(*I); + ModuleProvider* mp = findModuleDefiningSymbol(*I,error); if (mp) { // The symbol exists, insert the ModuleProvider into our result, // duplicates wil be ignored @@ -505,20 +565,23 @@ ++I; } } + return true; } bool Archive::isBytecodeArchive() { // Make sure the symTab has been loaded. In most cases this should have been // done when the archive was constructed, but still, this is just in case. if (!symTab.size()) - loadSymbolTable(); + if (!loadSymbolTable(0)) + return false; // Now that we know it's been loaded, return true // if it has a size if (symTab.size()) return true; //We still can't be sure it isn't a bytecode archive - loadArchive(); + if (!loadArchive(0)) + return false; std::vector Modules; std::string ErrorMessage; Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.22 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.23 --- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.22 Fri Jul 7 14:09:13 2006 +++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Fri Jul 7 15:56:50 2006 @@ -463,7 +463,12 @@ // compatibility with other ar(1) implementations as well as allowing the // archive to store both native .o and LLVM .bc files, both indexed. if (foreignST) { - writeMember(*foreignST, FinalFile, false, false, false); + if (!writeMember(*foreignST, FinalFile, false, false, false, error)) { + FinalFile.close(); + if (TmpArchive.exists()) + TmpArchive.eraseFromDisk(); + return false; + } } // Put out the LLVM symbol table now. Index: llvm/lib/Bytecode/Archive/Makefile diff -u llvm/lib/Bytecode/Archive/Makefile:1.3 llvm/lib/Bytecode/Archive/Makefile:1.4 --- llvm/lib/Bytecode/Archive/Makefile:1.3 Fri Jul 7 11:44:31 2006 +++ llvm/lib/Bytecode/Archive/Makefile Fri Jul 7 15:56:50 2006 @@ -13,6 +13,5 @@ # We only want an archive so only those modules actually used by a tool are # included. BUILD_ARCHIVE := 1 -REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From reid at x10sys.com Fri Jul 7 15:57:05 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 7 Jul 2006 15:57:05 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Bytecode/Archive.h Message-ID: <200607072057.PAA07495@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Bytecode: Archive.h updated: 1.15 -> 1.16 --- Log message: Finish removal of EH usage from the Archive library. The REQUIRES_EH flag in lib/Bytecode/Archive/Makefile is now removed. One small step closer to a smaller LLVM. --- Diffs of the changes: (+27 -12) Archive.h | 39 +++++++++++++++++++++++++++------------ 1 files changed, 27 insertions(+), 12 deletions(-) Index: llvm/include/llvm/Bytecode/Archive.h diff -u llvm/include/llvm/Bytecode/Archive.h:1.15 llvm/include/llvm/Bytecode/Archive.h:1.16 --- llvm/include/llvm/Bytecode/Archive.h:1.15 Fri Jul 7 14:09:13 2006 +++ llvm/include/llvm/Bytecode/Archive.h Fri Jul 7 15:56:50 2006 @@ -307,8 +307,8 @@ /// printing). /// @brief Open and load an archive file static Archive* OpenAndLoad( - const sys::Path& filePath, ///< The file path to open and load - std::string* ErrorMessage = 0 ///< An optional error string + const sys::Path& filePath, ///< The file path to open and load + std::string* ErrorMessage ///< An optional error string ); /// This method opens an existing archive file from \p Filename and reads in @@ -398,7 +398,8 @@ /// contain a module that defines the \p symbol. /// @brief Look up a module by symbol name. ModuleProvider* findModuleDefiningSymbol( - const std::string& symbol ///< Symbol to be sought + const std::string& symbol, ///< Symbol to be sought + std::string* ErrMessage ///< Error message storage, if non-zero ); /// This method is similar to findModuleDefiningSymbol but allows lookup of @@ -410,9 +411,10 @@ /// symbols to ensure they are not re-searched on a subsequent call. If /// you need to retain the list of symbols, make a copy. /// @brief Look up multiple symbols in the archive. - void findModulesDefiningSymbols( + bool findModulesDefiningSymbols( std::set& symbols, ///< Symbols to be sought - std::set& modules ///< The modules matching \p symbols + std::set& modules, ///< The modules matching \p symbols + std::string* ErrMessage ///< Error msg storage, if non-zero ); /// This method determines whether the archive is a properly formed llvm @@ -445,7 +447,7 @@ bool CreateSymbolTable=false, ///< Create Symbol table bool TruncateNames=false, ///< Truncate the filename to 15 chars bool Compress=false, ///< Compress files - std::string* error = 0 ///< If non-null, where error msg is set + std::string* ErrMessage=0 ///< If non-null, where error msg is set ); /// This method adds a new file to the archive. The \p filename is examined @@ -465,20 +467,33 @@ /// into memory. Archive(const sys::Path& filename, bool map = false ); + /// @param error Set to address of a std::string to get error messages + /// @returns false on error /// @brief Parse the symbol table at \p data. - void parseSymbolTable(const void* data,unsigned len); + bool parseSymbolTable(const void* data,unsigned len,std::string* error); + /// @returns A fully populated ArchiveMember or 0 if an error occurred. /// @brief Parse the header of a member starting at \p At - ArchiveMember* parseMemberHeader(const char*&At,const char*End); + ArchiveMember* parseMemberHeader( + const char*&At, ///< The pointer to the location we're parsing + const char*End, ///< The pointer to the end of the archive + std::string* error ///< Optional error message catcher + ); + /// @param error Set to address of a std::string to get error messages + /// @returns false on error /// @brief Check that the archive signature is correct - void checkSignature(); + bool checkSignature(std::string* ErrMessage); + /// @param error Set to address of a std::string to get error messages + /// @returns false on error /// @brief Load the entire archive. - void loadArchive(); + bool loadArchive(std::string* ErrMessage); + /// @param error Set to address of a std::string to get error messages + /// @returns false on error /// @brief Load just the symbol table. - void loadSymbolTable(); + bool loadSymbolTable(std::string* ErrMessage); /// @brief Write the symbol table to an ofstream. void writeSymbolTable(std::ofstream& ARFile); @@ -494,7 +509,7 @@ bool CreateSymbolTable, ///< Should symbol table be created? bool TruncateNames, ///< Should names be truncated to 11 chars? bool ShouldCompress, ///< Should the member be compressed? - std::string* error = 0 ///< If non-null, place were error msg is set + std::string* ErrMessage ///< If non-null, place were error msg is set ); /// @brief Fill in an ArchiveMemberHeader from ArchiveMember. From lattner at cs.uiuc.edu Fri Jul 7 16:21:18 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 16:21:18 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Unix/Path.inc Message-ID: <200607072121.QAA10941@zion.cs.uiuc.edu> Changes in directory llvm/lib/System/Unix: Path.inc updated: 1.44 -> 1.45 --- Log message: no need to do a stat then an lstat. lstat will tell us if normal files don't exist. --- Diffs of the changes: (+4 -7) Path.inc | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-) Index: llvm/lib/System/Unix/Path.inc diff -u llvm/lib/System/Unix/Path.inc:1.44 llvm/lib/System/Unix/Path.inc:1.45 --- llvm/lib/System/Unix/Path.inc:1.44 Thu Jul 28 11:25:57 2005 +++ llvm/lib/System/Unix/Path.inc Fri Jul 7 16:21:06 2006 @@ -453,14 +453,11 @@ for ( ; de != 0; de = ::readdir(direntries)) { if (de->d_name[0] != '.') { Path aPath(dirPath + (const char*)de->d_name); - struct stat buf; - if (0 != stat(aPath.path.c_str(), &buf)) { - int stat_errno = errno; - struct stat st; - if (0 == lstat(aPath.path.c_str(), &st) && S_ISLNK(st.st_mode)) + struct stat st; + if (0 != lstat(aPath.path.c_str(), &st)) { + if (S_ISLNK(st.st_mode)) continue; // dangling symlink -- ignore - ThrowErrno(aPath.path + - ": can't determine file object type", stat_errno); + ThrowErrno(aPath.path + ": can't determine file object type"); } result.insert(aPath); } From evan.cheng at apple.com Fri Jul 7 16:36:37 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 7 Jul 2006 16:36:37 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/2006-07-07-ComputeMaskedBits.ll Message-ID: <200607072136.QAA11165@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: 2006-07-07-ComputeMaskedBits.ll added (r1.1) --- Log message: Add a 64-bit test case. --- Diffs of the changes: (+16 -0) 2006-07-07-ComputeMaskedBits.ll | 16 ++++++++++++++++ 1 files changed, 16 insertions(+) Index: llvm/test/Regression/CodeGen/PowerPC/2006-07-07-ComputeMaskedBits.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/2006-07-07-ComputeMaskedBits.ll:1.1 *** /dev/null Fri Jul 7 16:36:34 2006 --- llvm/test/Regression/CodeGen/PowerPC/2006-07-07-ComputeMaskedBits.ll Fri Jul 7 16:36:24 2006 *************** *** 0 **** --- 1,16 ---- + ; RUN: llvm-as < %s | llc -mtriple=powerpc64-apple-darwin | grep extsw | wc -l | grep 2 + + %lens = external global ubyte* + %vals = external global int* + + int %test(int %i) { + %tmp = load ubyte** %lens + %tmp1 = getelementptr ubyte* %tmp, int %i + %tmp = load ubyte* %tmp1 + %tmp2 = cast ubyte %tmp to int + %tmp3 = load int** %vals + %tmp5 = sub int 1, %tmp2 + %tmp6 = getelementptr int* %tmp3, int %tmp5 + %tmp7 = load int* %tmp6 + ret int %tmp7 + } From lattner at cs.uiuc.edu Fri Jul 7 16:36:54 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 16:36:54 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll Message-ID: <200607072136.QAA11220@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/GlobalOpt: 2006-07-07-InlineAsmCrash.ll added (r1.1) --- Log message: Testcase for PR820: http://llvm.org/PR820 --- Diffs of the changes: (+138 -0) 2006-07-07-InlineAsmCrash.ll | 138 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 138 insertions(+) Index: llvm/test/Regression/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll diff -c /dev/null llvm/test/Regression/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll:1.1 *** /dev/null Fri Jul 7 16:36:52 2006 --- llvm/test/Regression/Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll Fri Jul 7 16:36:42 2006 *************** *** 0 **** --- 1,138 ---- + ; RUN: llvm-as< %s | opt -globalopt -disable-output + ; PR820 + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + %struct..0FileDescriptor = type { int } + "struct.FlagDescription" = type { ubyte*, int*, bool, bool, int, ubyte* } + "struct.FlagRegisterer" = type { ubyte } + %struct.MutexLock = type { %struct..0FileDescriptor* } + "struct.std::DisabledRangeMap" = type { "struct.std::_Rb_tree >,std::_Select1st > >,StringCmp,std::allocator > > >" } + "struct.std::_Rb_tree >,std::_Select1st > >,StringCmp,std::allocator > > >" = type { "struct.std::_Rb_tree >,std::_Select1st > >,StringCmp,std::allocator > > >::_Rb_tree_impl" } + "struct.std::_Rb_tree >,std::_Select1st > >,StringCmp,std::allocator > > >::_Rb_tree_impl" = type { "struct.FlagRegisterer", "struct.std::_Rb_tree_node_base", uint } + "struct.std::_Rb_tree_const_iterator, std::allocator > >" = type { "struct.std::_Rb_tree_node_base"* } + "struct.std::_Rb_tree_node_base" = type { uint, "struct.std::_Rb_tree_node_base"*, "struct.std::_Rb_tree_node_base"*, "struct.std::_Rb_tree_node_base"* } + "struct.std::_Vector_base >" = type { "struct.std::_Vector_base >::_Vector_impl" } + "struct.std::_Vector_base >::_Vector_impl" = type { int*, int*, int* } + "struct.std::vector >" = type { "struct.std::_Vector_base >" } + %registry_lock = external global %struct..0FileDescriptor ; <%struct..0FileDescriptor*> [#uses=0] + %_ZN61FLAG__foo_int32_44FLAGS_E = external global "struct.FlagRegisterer" ; <"struct.FlagRegisterer"*> [#uses=0] + %llvm.global_ctors = appending global [20 x { int, void ()* }] [ { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN62FLAG__foo_string_10FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN60FLAG__foo_bool_19FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZNK5Bzh4Enum13is_contiguousEv }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN61FLAG__foo_int32_21FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN7ScannerC2Ev }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__Z11StripStringPSsPKcc }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZNK9__gnu_cxx4hashI11StringPieceEclERKS1_ }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN8Hasher325ResetEj }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__Z25ACLRv }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN61FLAG__foo_int64_25FLAGS_E }, { int, void ()* }! { int 65535, void ()* %_GLOBAL__I__ZN61FLAG__foo_int32_7FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN62FLAG__foo_string_18FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN61FLAG__foo_int32_25FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I_eventbuf }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN61FLAG__foo_int32_26FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN62FLAG__foo_string_16FLAGS_E }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__ZN17InitializerC2EPKcS1_PFvvE }, { int, void ()* } { int 65535, void ()* %_GLOBAL__I__checker_bcad_variable } ] ; <[20 x { int, void ()* }]*> [#uses=0] + + implementation ; Functions: + + declare void %_GLOBAL__I__ZN62FLAG__foo_string_10FLAGS_E() + + declare void %_GLOBAL__I__ZN60FLAG__foo_bool_19FLAGS_E() + + declare void %_GLOBAL__I__ZNK5Bzh4Enum13is_contiguousEv() + + declare void %_GLOBAL__I__ZN62FLAG__foo_string_17FLAGS_E() + + declare void %_GLOBAL__I__ZN61FLAG__foo_int32_21FLAGS_E() + + void %_ZN14FlagRegistererIiEC1EPKcRK15FlagDescriptionIiE() { + entry: + call void %_Z12RegisterFlagIiEvPKcRK15FlagDescriptionIT_E( ) + ret void + } + + void %_Z12RegisterFlagIiEvPKcRK15FlagDescriptionIT_E() { + entry: + call void %_ZN9MutexLockC1EP5Mutex( ) + ret void + } + + declare void %_GLOBAL__I__ZN7ScannerC2Ev() + + declare void %_GLOBAL__I__Z11StripStringPSsPKcc() + + void %_ZNSt6vectorIiSaIiEEC1ERKS0_() { + entry: + unreachable + } + + declare void %_GLOBAL__I__ZNK9__gnu_cxx4hashI11StringPieceEclERKS1_() + + declare void %_GLOBAL__I__ZN8Hasher325ResetEj() + + declare void %_GLOBAL__I__Z25ACLRv() + + void %_ZN9MutexLockC1EP5Mutex() { + entry: + call void %_ZN5Mutex4LockEv( ) + ret void + } + + void %_ZN5Mutex4LockEv() { + entry: + call void %_Z22Acquire_CASPViii( ) + ret void + } + + csretcc void %_ZNSt3mapIPKc15FlagDescriptionIiE9StringCmpSaISt4pairIKS1_S3_EEE3endEv("struct.std::_Rb_tree_const_iterator, std::allocator > >"* %agg.result) { + entry: + unreachable + } + + declare void %_GLOBAL__I__ZN61FLAG__foo_int64_25FLAGS_E() + + void %_Z14CASPViii() { + entry: + %tmp3 = call int asm sideeffect "lock; cmpxchg $1,$2", "={ax},q,m,0,~{dirflag},~{fpsr},~{flags},~{memory}"( int 0, int* null, int 0 ) ; [#uses=0] + unreachable + } + + declare void %_GLOBAL__I__ZN61FLAG__foo_int32_7FLAGS_E() + + declare void %_GLOBAL__I__ZN62FLAG__foo_string_18FLAGS_E() + + void %_Z22Acquire_CASPViii() { + entry: + call void %_Z14CASPViii( ) + unreachable + } + + declare void %_GLOBAL__I__ZN61FLAG__foo_int32_25FLAGS_E() + + declare void %_GLOBAL__I_eventbuf() + + void %_GLOBAL__I__ZN61FLAG__foo_int32_26FLAGS_E() { + entry: + call void %_Z41__static_initialization_and_destruction_0ii1662( int 1, int 65535 ) + ret void + } + + void %_Z41__static_initialization_and_destruction_0ii1662(int %__initialize_p, int %__priority) { + entry: + %__initialize_p_addr = alloca int ; [#uses=2] + %__priority_addr = alloca int ; [#uses=2] + store int %__initialize_p, int* %__initialize_p_addr + store int %__priority, int* %__priority_addr + %tmp = load int* %__priority_addr ; [#uses=1] + %tmp = seteq int %tmp, 65535 ; [#uses=1] + br bool %tmp, label %cond_true, label %cond_next14 + + cond_true: ; preds = %entry + %tmp8 = load int* %__initialize_p_addr ; [#uses=1] + %tmp9 = seteq int %tmp8, 1 ; [#uses=1] + br bool %tmp9, label %cond_true10, label %cond_next14 + + cond_true10: ; preds = %cond_true + call void %_ZN14FlagRegistererIiEC1EPKcRK15FlagDescriptionIiE( ) + ret void + + cond_next14: ; preds = %cond_true, %entry + ret void + } + + declare void %_GLOBAL__I__ZN62FLAG__foo_string_16FLAGS_E() + + void %_ZN9__gnu_cxx13new_allocatorIPNS_15_Hashtable_nodeIjEEEC2Ev() { + entry: + unreachable + } + + declare void %_GLOBAL__I__ZN17InitializerC2EPKcS1_PFvvE() + + declare void %_GLOBAL__I__checker_bcad_variable() From lattner at cs.uiuc.edu Fri Jul 7 16:37:13 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 7 Jul 2006 16:37:13 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200607072137.QAA11231@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: GlobalOpt.cpp updated: 1.61 -> 1.62 --- Log message: Fix PR820: http://llvm.org/PR820 and Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.ll --- Diffs of the changes: (+3 -0) GlobalOpt.cpp | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.61 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.62 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.61 Sun Jan 22 17:32:06 2006 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Fri Jul 7 16:37:01 2006 @@ -1450,6 +1450,9 @@ AI->getName())); InstResult = AllocaTmps.back(); } else if (CallInst *CI = dyn_cast(CurInst)) { + // Cannot handle inline asm. + if (isa(CI->getOperand(0))) return false; + // Resolve function pointers. Function *Callee = dyn_cast(getVal(Values, CI->getOperand(0))); if (!Callee) return false; // Cannot resolve. From evan.cheng at apple.com Fri Jul 7 16:37:33 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 7 Jul 2006 16:37:33 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetLowering.cpp Message-ID: <200607072137.QAA11243@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetLowering.cpp updated: 1.69 -> 1.70 --- Log message: Fix a typo that causes 2006-07-07-ComputeMaskedBits.ll to fail. --- Diffs of the changes: (+1 -1) TargetLowering.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/TargetLowering.cpp diff -u llvm/lib/Target/TargetLowering.cpp:1.69 llvm/lib/Target/TargetLowering.cpp:1.70 --- llvm/lib/Target/TargetLowering.cpp:1.69 Tue Jun 13 11:52:37 2006 +++ llvm/lib/Target/TargetLowering.cpp Fri Jul 7 16:37:21 2006 @@ -988,7 +988,7 @@ KnownZero = ~((1ULL << (64-NLZ2))-1) & Mask; // Top bits known zero. KnownOne = 0; // No one bits known. } else { - KnownOne = KnownOne = 0; // Otherwise, nothing known. + KnownZero = KnownOne = 0; // Otherwise, nothing known. } } return; From pjenkins at apple.com Fri Jul 7 16:40:46 2006 From: pjenkins at apple.com (Patrick Jenkins) Date: Fri, 7 Jul 2006 16:40:46 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200607072140.QAA11287@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.5 -> 1.6 --- Log message: Fixed a variable naming issue for the External Program Results table. Also fixed an issue with printing the sent data to a sentdata.txt --- Diffs of the changes: (+3 -15) NewNightlyTest.pl | 18 +++--------------- 1 files changed, 3 insertions(+), 15 deletions(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.5 llvm/utils/NewNightlyTest.pl:1.6 --- llvm/utils/NewNightlyTest.pl:1.5 Fri Jul 7 13:50:51 2006 +++ llvm/utils/NewNightlyTest.pl Fri Jul 7 16:40:34 2006 @@ -161,18 +161,6 @@ if (/^-noexternals$/) { $NOEXTERNALS = 1; next; } if (/^-nodejagnu$/) { $NODEJAGNU = 1; next; } if (/^-nobuild$/) { $NOBUILD = 1; next; } - if (/^-spec2000path$/) { - $LLVMTESTCONFIGARGS .= " --enable-spec2000=$ARGV[0]"; shift; next; - } else{ $LLVMTESTCONFIGARGS=""; } - if (/^-spec95path$/) { - $LLVMTESTCONFIGARGS .= " --enable-spec95=$ARGV[0]"; shift; next; - } - if (/^-povraypath$/) { - $LLVMTESTCONFIGARGS .= " --enable-povray=$ARGV[0]"; shift; next; - } - if (/^-namdpath$/) { - $LLVMTESTCONFIGARGS .= " --enable-namd=$ARGV[0]"; shift; next; - } print "Unknown option: $_ : ignoring!\n"; } @@ -440,11 +428,11 @@ close(SOCK); my $sentdata=""; - foreach $x(keys(%hash_of_data)){ + foreach $x (keys (%$variables)){ $sentdata.= "$x => $hash_of_data{$x}\n"; } WriteFile "$Prefix-sentdata.txt", $sentdata; - + return $result; } @@ -1002,7 +990,7 @@ 'buildstatus' => $BuildStatus, 'singlesource_programstable' => $SingleSourceProgramsTable, 'multisource_programstable' => $MultiSourceProgramsTable, - 'externalsource_programstable' => $ExternalSourceProgramsTable, + 'externalsource_programstable' => $ExternalProgramsTable, 'llcbeta_options' => $multisource_llcbeta_options, 'warnings_removed' => $WarningsRemoved, 'warnings_added' => $WarningsAdded, From pjenkins at apple.com Fri Jul 7 16:47:36 2006 From: pjenkins at apple.com (Patrick Jenkins) Date: Fri, 7 Jul 2006 16:47:36 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200607072147.QAA11412@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.6 -> 1.7 --- Log message: Syntax error in NewNightlyTest.pl --- Diffs of the changes: (+1 -1) NewNightlyTest.pl | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.6 llvm/utils/NewNightlyTest.pl:1.7 --- llvm/utils/NewNightlyTest.pl:1.6 Fri Jul 7 16:40:34 2006 +++ llvm/utils/NewNightlyTest.pl Fri Jul 7 16:47:24 2006 @@ -1000,7 +1000,7 @@ 'removed_tests' => $TestsRemoved, 'unexpfail_tests' => $unexpfail_tests, 'dejagnutests_log' => $dejagnutests_log, - 'dejagnutests_sum' => $dejagnutests_sum + 'dejagnutests_sum' => $dejagnutests_sum, 'starttime' => $starttime, 'endtime' => $endtime); From pjenkins at apple.com Fri Jul 7 19:32:45 2006 From: pjenkins at apple.com (Patrick Jenkins) Date: Fri, 7 Jul 2006 19:32:45 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/popup.js fulltest.php machine.php ProgramResults.php style.css test.php Message-ID: <200607080032.TAA08877@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: popup.js added (r1.1) fulltest.php updated: 1.2 -> 1.3 machine.php updated: 1.1.1.1 -> 1.2 ProgramResults.php updated: 1.2 -> 1.3 style.css updated: 1.1.1.1 -> 1.2 test.php updated: 1.1.1.1 -> 1.2 --- Log message: The nightly tester website now has little question marks next to quizzical features that when clicked pop up a lil window over the page that describes what that feature is. When clicked again the popup dissapears. --- Diffs of the changes: (+279 -106) ProgramResults.php | 78 ++++++++++++++++++++++++++++++++++++ fulltest.php | 79 +++++++++++-------------------------- machine.php | 25 +++++++++++ popup.js | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++ style.css | 32 +++++++++++++++ test.php | 58 +++------------------------ 6 files changed, 279 insertions(+), 106 deletions(-) Index: nightlytest-serverside/popup.js diff -c /dev/null nightlytest-serverside/popup.js:1.1 *** /dev/null Fri Jul 7 19:32:28 2006 --- nightlytest-serverside/popup.js Fri Jul 7 19:32:18 2006 *************** *** 0 **** --- 1,113 ---- + function ShowPop(id) + { + if (document.getElementById) + { + document.getElementById(id).style.visibility = " visible"; + } + else if (document.all) + { + document.all[id].style.visibility = " visible"; + } + else if (document.layers) + { + document.layers[id].style.visibility = " visible"; + } + } + + + + + + + function HidePop(id) + { + if (document.getElementById) + { + document.getElementById(id).style.visibility = " hidden"; + } + /*else if (document.all) + { + document.all[id].style.visibility = " hidden"; + } + else if (document.layers) + { + document.layers[id].style.visibility = " hidden"; + }*/ + } + + + + function TogglePop(id) + { + if (document.getElementById) + { + if(document.getElementById(id).style.visibility == "visible"){ + document.getElementById(id).style.visibility = "hidden"; + } + else{ + document.getElementById(id).style.visibility = "visible"; + } + } + else if (document.all) + { + if(document.all[id].style.visibility == "visible"){ + document.all[id].style.visibility = "hidden"; + } + else{ + document.all[id].style.visibility = "visible"; + } + } + else if (document.layers) + { + if(document.layers[id].style.visibility == "visible"){ + document.layers[id].style.visibility = "hidden"; + } + else{ + document.layers[id].style.visibility = "visible"; + } + } + } + + + function toggleLayer(whichLayer) + { + if (document.getElementById) + { + // this is the way the standards work + var style2 = document.getElementById(whichLayer).style; + style2.display = style2.display? "":"none"; + var link = document.getElementById(whichLayer+"_").innerHTML; + if(link.indexOf("(+)") >= 0){ + document.getElementById(whichLayer+"_").innerHTML="(-)"+link.substring(3,link.length); + } + else{ + document.getElementById(whichLayer+"_").innerHTML="(+)"+link.substring(3,link.length); + } + }//end if + else if (document.all) + { + // this is the way old msie versions work + var style2 = document.all[whichLayer].style; + style2.display = style2.display? "":"none"; + var link = document.all[wwhichLayer+"_"].innerHTML; + if(link.indexOf("(+)") >= 0){ + document.all[whichLayer+"_"].innerHTML="(-)"+link.substring(3,link.length); + } + else{ + document.all[whichLayer+"_"].innerHTML="(+)"+link.substring(3,link.length); + } + } + else if (document.layers) + { + // this is the way nn4 works + var style2 = document.layers[whichLayer].style; + style2.display = style2.display? "":"none"; + var link = document.layers[whichLayer+"_"].innerHTML; + if(link.indexOf("(+)") >= 0){ + document.layers[whichLayer+"_"].innerHTML="(-)"+link.substring(3,link.length); + } + else{ + document.layers[whichLayer+"_"].innerHTML="(+)"+link.substring(3,link.length); + } + } + }//end function \ No newline at end of file Index: nightlytest-serverside/fulltest.php diff -u nightlytest-serverside/fulltest.php:1.2 nightlytest-serverside/fulltest.php:1.3 --- nightlytest-serverside/fulltest.php:1.2 Wed Jul 5 17:38:30 2006 +++ nightlytest-serverside/fulltest.php Fri Jul 7 19:32:18 2006 @@ -39,54 +39,7 @@ - + @@ -545,11 +498,17 @@ $index=0; foreach ($category_print_array as $x){ if($index<10 && isset($percent_difference)){ - print "\t\t\n"; + $col_width=2; } else{ - print "\t\t\n"; + $col_width=1; } + print "\t\t\n"; + print "\n"; + print "\n"; + print "
{$category_print_array_description[$index]}
\n"; + print "
?
\n"; + print "\n"; $index++; } print "\t\n"; @@ -606,11 +565,17 @@ $index=0; foreach ($category_print_array as $x){ if($index<10 && isset($percent_difference)){ - print "\t\t\n"; + $col_width=2; } else{ - print "\t\t\n"; + $col_width=1; } + print "\t\t\n"; + print "\n"; + print "\n"; + print "
{$category_print_array_description[$index]}
\n"; + print "
?
\n"; + print "\n"; $index++; } print "\t\n"; @@ -667,11 +632,17 @@ $index=0; foreach ($category_print_array as $x){ if($index<10 && isset($percent_difference)){ - print "\t\t\n"; + $col_width=2; } else{ - print "\t\t\n"; + $col_width=1; } + print "\t\t\n"; + print "\n"; + print "\n"; + print "
{$category_print_array_description[$index]}
\n"; + print "
?
\n"; + print "\n"; $index++; } print "\t\n"; Index: nightlytest-serverside/machine.php diff -u nightlytest-serverside/machine.php:1.1.1.1 nightlytest-serverside/machine.php:1.2 --- nightlytest-serverside/machine.php:1.1.1.1 Wed Jul 5 15:56:33 2006 +++ nightlytest-serverside/machine.php Fri Jul 7 19:32:18 2006 @@ -28,7 +28,15 @@ ?> -LLVM Machine Test Results For <?php print $machine_name ?> + +LLVM Machine Test Results For <?php print $machine_name ?> + + +
LLVM Machine Test Results For

@@ -94,11 +102,22 @@ $percent_difference = CalculateChangeBetweenDays($yesterday_results, $today_results); /* note: $medium_change, $large_change, and $crazy_change are defined in ProgramResult.php */ + print "
\n"; + print "\n"; Print "\n"; Print "\n"; Print "\n"; print "
$medium_change % differences from yesterday: $medium_number
$large_change % differences from yesterday: $large_number
$crazy_change % differences from yesterday: $crazy_number
\n"; + + print "
"; + + print "\n"; + print "\n"; + print "
The number of measurements that signifigantly
changed from the previous test.
\n"; + print "
?
\n"; + + print "
\n"; } print "
\n"; @@ -411,6 +430,10 @@ print " | "; print "\n"; +print "\n"; +print "\n"; +print "
Produces a graph of the selected columns over
time.
\n"; +print "
?
\n"; print "
\n"; mysql_close($mysql_link); Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.2 nightlytest-serverside/ProgramResults.php:1.3 --- nightlytest-serverside/ProgramResults.php:1.2 Thu Jul 6 16:11:05 2006 +++ nightlytest-serverside/ProgramResults.php Fri Jul 7 19:32:18 2006 @@ -32,9 +32,87 @@ "JIT codegen","GCC","CBE","LLC", "LLC-BETA","JIT","GCC/ CBE", "GCC/ LLC", "GCC/ LLC-BETA","LLC/ LLC-BETA"); + +$category_print_array_description=array("GCCAS - Time to run LLVM optimizers on the
". + "program.", + + "Bytecode - The size of the bytecode for the
". + "program.", + + "LLC compile - The time taken to compile with LLC
". + "(the static backend).", + + "LLC-BETA compile - The time taken compile with LLC
". + "using experimental features.", + + "JIT codegen - The amount of time spent in the JIT
". + "itself, as opposed to executing the program.", + + "GCC - The time taken to execute the program when
". + "compiled with GCC -O2.", + + "CBE - The time taken to execute the program after
". + "compilation through the C backend, compiled with
". + "-O2.", + + "LLC - The length of time the program generated by
". + "the static backend LLC takes to execute.", + + "LLC-BETA - How long the program generated by the
". + "experimental static back end takes to execute.", + + "JIT codegen - The amount of time spent in the JIT
". + "itself, as opposed to executing the program.", + + "GCC/CBE - The speed-up of the CBE output vs the
". + "native GCC output: greater than 1 is a speedup,
". + "less than 1 is a slowdown.", + + "GCC/LLC - The speed-up of the LLC output vs the
". + "native GCC output: greater than 1 is a speedup,
". + "less than 1 is a slowdown.", + + "GCC/ LLC-BETA - The speed-up of the LLC output
". + "vs the native GCC output: greater than 1 is a
". + "speedup, less than 1 is a slowdown.", + + "LLC/ LLC-BETA - The speed-up of the LLC output
". + "vs the LLV-BETA output: greater than 1 is a
". + "speedup, less than 1 is a slowdown."); + $category_print_array_ordered=array("CBE","LLC","JIT","GCCAS", "Bytecode","LLC compile","LLC-BETA compile", "JIT codegen", "LLC-BETA"); + +$category_print_array_ordered_description=array("CBE - The time taken to execute the program after
". + "compilation through the C backend, compiled with
". + "-O2.", + + "LLC - The length of time the program generated by
". + "the static backend LLC takes to execute.", + + "JIT - The amount of time spent running the program
". + "with the JIT; this includes the code generation
". + "phase and actually running the program.", + + "GCCAS - Time to run LLVM optimizers on the
". + "program.", + + "Bytecode - The size of the bytecode for the
". + "program.", + + "LLC compile - The time taken to compile with LLC
". + "(the static backend).", + + "LLC-BETA compile - The time taken compile with LLC
". + "using experimental features.", + + "JIT codegen - The amount of time spent in the JIT
". + "itself, as opposed to executing the program.", + + "LLC-BETA - How long the program generated by the
". + "experimental static back end takes to execute."); + /* Index: nightlytest-serverside/style.css diff -u nightlytest-serverside/style.css:1.1.1.1 nightlytest-serverside/style.css:1.2 --- nightlytest-serverside/style.css:1.1.1.1 Wed Jul 5 15:56:34 2006 +++ nightlytest-serverside/style.css Fri Jul 7 19:32:18 2006 @@ -3,4 +3,36 @@ border-color:blackground; border-style:solid; background: #F8F8FF +} + +.popup +{ + position:absolute; left:10; bottom:10; width:400; + border-style:solid; + border-width:2; + border-color:blue; + background-color:white; + padding:5px; + color:black; + font-family:Arial; + font-weight:bold; + font-size:10pt; + z-index:2; + visibility:hidden; +} + +.popup2 +{ + position:absolute; left:10; top:10; width:400; + border-style:solid; + border-width:2; + border-color:blue; + background-color:white; + padding:5px; + color:black; + font-family:Arial; + font-weight:bold; + font-size:10pt; + z-index:2; + visibility:hidden; } \ No newline at end of file Index: nightlytest-serverside/test.php diff -u nightlytest-serverside/test.php:1.1.1.1 nightlytest-serverside/test.php:1.2 --- nightlytest-serverside/test.php:1.1.1.1 Wed Jul 5 15:56:34 2006 +++ nightlytest-serverside/test.php Fri Jul 7 19:32:18 2006 @@ -53,57 +53,8 @@ @import url(style.css); --> - - - + @@ -582,7 +533,12 @@ print "$sign $num_changes Tests Signifigantly Changed for {$category_print_array_ordered[$y]}\n"; print "
\n"; - print"Signifigant Changes for {$category_print_array_ordered[$y]}
\n"; + print "Signifigant Changes for {$category_print_array_ordered[$y]}"; + print "\n"; + print "\n"; + print "
$category_print_array_ordered_description[$y]
\n"; + print "
?
\n"; + print "
\n"; print "
\n"; #creating the black borde print "\n"; print "\t\n"; From resistor at mac.com Sun Jul 9 03:14:18 2006 From: resistor at mac.com (Owen Anderson) Date: Sun, 9 Jul 2006 03:14:18 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LCSSA.cpp Message-ID: <200607090814.DAA13367@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: LCSSA.cpp updated: 1.23 -> 1.24 --- Log message: Add a fix for an issue where LCSSA would fail to insert undef's in some corner cases. Ideally, this issue will go away in the future as LCSSA gets smarter about which Phi nodes it inserts. --- Diffs of the changes: (+21 -14) LCSSA.cpp | 35 +++++++++++++++++++++-------------- 1 files changed, 21 insertions(+), 14 deletions(-) Index: llvm/lib/Transforms/Utils/LCSSA.cpp diff -u llvm/lib/Transforms/Utils/LCSSA.cpp:1.23 llvm/lib/Transforms/Utils/LCSSA.cpp:1.24 --- llvm/lib/Transforms/Utils/LCSSA.cpp:1.23 Tue Jun 13 20:13:57 2006 +++ llvm/lib/Transforms/Utils/LCSSA.cpp Sun Jul 9 03:14:06 2006 @@ -28,6 +28,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar.h" +#include "llvm/Constants.h" #include "llvm/Pass.h" #include "llvm/Function.h" #include "llvm/Instructions.h" @@ -73,12 +74,12 @@ } private: SetVector getLoopValuesUsedOutsideLoop(Loop *L); - Instruction *getValueDominatingBlock(BasicBlock *BB, - std::map& PotDoms) { + Value *getValueDominatingBlock(BasicBlock *BB, + std::map& PotDoms) { return getValueDominatingDTNode(DT->getNode(BB), PotDoms); } - Instruction *getValueDominatingDTNode(DominatorTree::Node *Node, - std::map& PotDoms); + Value *getValueDominatingDTNode(DominatorTree::Node *Node, + std::map& PotDoms); /// inLoop - returns true if the given block is within the current loop const bool inLoop(BasicBlock* B) { @@ -149,7 +150,7 @@ { ++NumLCSSA; // We are applying the transformation - std::map Phis; + std::map Phis; // Add the base instruction to the Phis list. This makes tracking down // the dominating values easier when we're filling in Phi nodes. This will @@ -161,7 +162,7 @@ for (std::vector::const_iterator BBI = exitBlocks.begin(), BBE = exitBlocks.end(); BBI != BBE; ++BBI) { - Instruction*& phi = Phis[*BBI]; + Value*& phi = Phis[*BBI]; if (phi == 0 && DT->getNode(Instr->getParent())->dominates(DT->getNode(*BBI))) { phi = new PHINode(Instr->getType(), Instr->getName()+".lcssa", @@ -191,7 +192,7 @@ for (DominanceFrontier::DomSetType::const_iterator P = S.begin(), PE = S.end(); P != PE; ++P) { if (DT->getNode(Instr->getParent())->dominates(DT->getNode(*P))) { - Instruction *&Phi = Phis[*P]; + Value *&Phi = Phis[*P]; if (Phi == 0) { // Still doesn't have operands... Phi = new PHINode(Instr->getType(), Instr->getName()+".lcssa", @@ -206,12 +207,11 @@ // Fill in all Phis we've inserted that need their incoming values filled in. for (std::vector::iterator IVI = needIncomingValues.begin(), - IVE = needIncomingValues.end(); IVI != IVE; ++IVI) { + IVE = needIncomingValues.end(); IVI != IVE; ++IVI) for (pred_iterator PI = pred_begin((*IVI)->getParent()), E = pred_end((*IVI)->getParent()); PI != E; ++PI) (*IVI)->addIncoming(getValueDominatingBlock(*PI, Phis), *PI); - } // Find all uses of the affected value, and replace them with the // appropriate Phi. @@ -235,7 +235,7 @@ if (PHINode* phi = dyn_cast(*II)) { for (unsigned int i = 0; i < phi->getNumIncomingValues(); ++i) { if (phi->getIncomingValue(i) == Instr) { - Instruction* dominator = + Value* dominator = getValueDominatingBlock(phi->getIncomingBlock(i), Phis); phi->setIncomingValue(i, dominator); } @@ -279,10 +279,17 @@ /// getValueDominatingBlock - Return the value within the potential dominators /// map that dominates the given block. -Instruction *LCSSA::getValueDominatingDTNode(DominatorTree::Node *Node, - std::map& PotDoms) { - assert(Node != 0 && "Didn't find dom value?"); - Instruction *&CacheSlot = PotDoms[Node->getBlock()]; +Value *LCSSA::getValueDominatingDTNode(DominatorTree::Node *Node, + std::map& PotDoms) { + // FIXME: The following insertion should be in place rather than the if + // statement. Currently, this is due to the fact that LCSSA isn't smart + // enough to avoid inserting IDF Phis that don't dominate any uses. In some + // of those cases, it could ask us to provide a dominating value for a block + // that has none, so we need to return undef. + //assert(Node != 0 && "Didn't find dom value?"); + if (Node == 0) return UndefValue::get(PotDoms.begin()->second->getType()); + + Value *&CacheSlot = PotDoms[Node->getBlock()]; if (CacheSlot) return CacheSlot; // Otherwise, return the value of the idom and remember this for next time. From resistor at mac.com Sun Jul 9 03:17:42 2006 From: resistor at mac.com (Owen Anderson) Date: Sun, 9 Jul 2006 03:17:42 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LCSSA/2006-07-09-NoDominator.ll Message-ID: <200607090817.DAA16852@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LCSSA: 2006-07-09-NoDominator.ll added (r1.1) --- Log message: Add a test for the LCSSA issue I just fixed. --- Diffs of the changes: (+31 -0) 2006-07-09-NoDominator.ll | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+) Index: llvm/test/Regression/Transforms/LCSSA/2006-07-09-NoDominator.ll diff -c /dev/null llvm/test/Regression/Transforms/LCSSA/2006-07-09-NoDominator.ll:1.1 *** /dev/null Sun Jul 9 03:17:40 2006 --- llvm/test/Regression/Transforms/LCSSA/2006-07-09-NoDominator.ll Sun Jul 9 03:17:30 2006 *************** *** 0 **** --- 1,31 ---- + ; RUN: llvm-as < %s | opt -lcssa + + %struct.SetJmpMapEntry = type { sbyte*, uint, %struct.SetJmpMapEntry* } + + implementation ; Functions: + + void %__llvm_sjljeh_try_catching_longjmp_exception() { + entry: + br label %loopentry + + loopentry: ; preds = %endif, %entry + %SJE.0 = phi %struct.SetJmpMapEntry* [ null, %entry ], [ %tmp.25, %endif ] ; <%struct.SetJmpMapEntry*> [#uses=1] + br bool false, label %no_exit, label %loopexit + + no_exit: ; preds = %loopentry + br bool false, label %then, label %endif + + then: ; preds = %no_exit + %tmp.21 = getelementptr %struct.SetJmpMapEntry* %SJE.0, int 0, uint 1 ; [#uses=0] + br label %return + + endif: ; preds = %after_ret.0, %no_exit + %tmp.25 = load %struct.SetJmpMapEntry** null ; <%struct.SetJmpMapEntry*> [#uses=1] + br label %loopentry + + loopexit: ; preds = %loopentry + br label %return + + return: ; preds = %after_ret.1, %loopexit, %then + ret void + } From resistor at mac.com Sun Jul 9 16:35:53 2006 From: resistor at mac.com (Owen Anderson) Date: Sun, 9 Jul 2006 16:35:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LCSSA.cpp Message-ID: <200607092135.QAA03539@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: LCSSA.cpp updated: 1.24 -> 1.25 --- Log message: Fix typo in the comment. --- Diffs of the changes: (+1 -1) LCSSA.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Utils/LCSSA.cpp diff -u llvm/lib/Transforms/Utils/LCSSA.cpp:1.24 llvm/lib/Transforms/Utils/LCSSA.cpp:1.25 --- llvm/lib/Transforms/Utils/LCSSA.cpp:1.24 Sun Jul 9 03:14:06 2006 +++ llvm/lib/Transforms/Utils/LCSSA.cpp Sun Jul 9 16:35:40 2006 @@ -281,7 +281,7 @@ /// map that dominates the given block. Value *LCSSA::getValueDominatingDTNode(DominatorTree::Node *Node, std::map& PotDoms) { - // FIXME: The following insertion should be in place rather than the if + // FIXME: The following assertion should be in place rather than the if // statement. Currently, this is due to the fact that LCSSA isn't smart // enough to avoid inserting IDF Phis that don't dominate any uses. In some // of those cases, it could ask us to provide a dominating value for a block From rafael.espindola at gmail.com Sun Jul 9 20:41:47 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sun, 9 Jul 2006 20:41:47 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp ARMInstrInfo.cpp ARMInstrInfo.h ARMInstrInfo.td ARMRegisterInfo.cpp Message-ID: <200607100141.UAA04426@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.13 -> 1.14 ARMInstrInfo.cpp updated: 1.3 -> 1.4 ARMInstrInfo.h updated: 1.1 -> 1.2 ARMInstrInfo.td updated: 1.5 -> 1.6 ARMRegisterInfo.cpp updated: 1.5 -> 1.6 --- Log message: create the raddr addressing mode that matches any register and the frame index use raddr for the ldr instruction. This removes a dummy mov from the assembly output remove SelectFrameIndex remove isLoadFromStackSlot remove isStoreToStackSlot --- Diffs of the changes: (+14 -51) ARMISelDAGToDAG.cpp | 21 +++++++++------------ ARMInstrInfo.cpp | 22 ---------------------- ARMInstrInfo.h | 14 -------------- ARMInstrInfo.td | 6 ++++-- ARMRegisterInfo.cpp | 2 +- 5 files changed, 14 insertions(+), 51 deletions(-) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.13 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.14 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.13 Tue Jun 27 16:52:45 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Sun Jul 9 20:41:35 2006 @@ -95,8 +95,7 @@ // If the argument is actually used, emit a load from the right stack // slot. if (!Op.Val->hasNUsesOfValue(0, ArgNo)) { - //hack - unsigned ArgOffset = 0; + unsigned ArgOffset = (ArgNo - num_regs) * 4; MachineFrameInfo *MFI = MF.getFrameInfo(); unsigned ObjSize = MVT::getSizeInBits(ObjectVT)/8; @@ -165,6 +164,7 @@ void Select(SDOperand &Result, SDOperand Op); virtual void InstructionSelectBasicBlock(SelectionDAG &DAG); + bool SelectAddrReg(SDOperand N, SDOperand &Base); // Include the pieces autogenerated from the target description. #include "ARMGenDAGISel.inc" @@ -183,12 +183,13 @@ ScheduleAndEmitDAG(DAG); } -static void SelectFrameIndex(SelectionDAG *CurDAG, SDOperand &Result, SDNode *N, SDOperand Op) { - int FI = cast(N)->getIndex(); - - SDOperand TFI = CurDAG->getTargetFrameIndex(FI, Op.getValueType()); - - Result = CurDAG->SelectNodeTo(N, ARM::movri, Op.getValueType(), TFI); +bool ARMDAGToDAGISel::SelectAddrReg(SDOperand N, SDOperand &Base) { + if (FrameIndexSDNode *FI = dyn_cast(N)) { + Base = CurDAG->getTargetFrameIndex(FI->getIndex(), N.getValueType()); + } + else + Base = N; + return true; //any address fits in a register } void ARMDAGToDAGISel::Select(SDOperand &Result, SDOperand Op) { @@ -198,10 +199,6 @@ default: SelectCode(Result, Op); break; - - case ISD::FrameIndex: - SelectFrameIndex(CurDAG, Result, N, Op); - break; } } Index: llvm/lib/Target/ARM/ARMInstrInfo.cpp diff -u llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.3 llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.4 --- llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.3 Tue Jun 27 16:52:45 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.cpp Sun Jul 9 20:41:35 2006 @@ -41,25 +41,3 @@ return true; } } - -/// isLoadFromStackSlot - If the specified machine instruction is a direct -/// load from a stack slot, return the virtual or physical register number of -/// the destination along with the FrameIndex of the loaded stack slot. If -/// not, return 0. This predicate must return 0 if the instruction has -/// any side effects other than loading from the stack slot. -unsigned ARMInstrInfo::isLoadFromStackSlot(MachineInstr *MI, - int &FrameIndex) const { - assert(0 && "not implemented"); - return 0; -} - -/// isStoreToStackSlot - If the specified machine instruction is a direct -/// store to a stack slot, return the virtual or physical register number of -/// the source reg along with the FrameIndex of the loaded stack slot. If -/// not, return 0. This predicate must return 0 if the instruction has -/// any side effects other than storing to the stack slot. -unsigned ARMInstrInfo::isStoreToStackSlot(MachineInstr *MI, - int &FrameIndex) const { - assert(0 && "not implemented"); - return 0; -} Index: llvm/lib/Target/ARM/ARMInstrInfo.h diff -u llvm/lib/Target/ARM/ARMInstrInfo.h:1.1 llvm/lib/Target/ARM/ARMInstrInfo.h:1.2 --- llvm/lib/Target/ARM/ARMInstrInfo.h:1.1 Sun May 14 17:18:28 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.h Sun Jul 9 20:41:35 2006 @@ -36,20 +36,6 @@ /// virtual bool isMoveInstr(const MachineInstr &MI, unsigned &SrcReg, unsigned &DstReg) const; - - /// isLoadFromStackSlot - If the specified machine instruction is a direct - /// load from a stack slot, return the virtual or physical register number of - /// the destination along with the FrameIndex of the loaded stack slot. If - /// not, return 0. This predicate must return 0 if the instruction has - /// any side effects other than loading from the stack slot. - virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const; - - /// isStoreToStackSlot - If the specified machine instruction is a direct - /// store to a stack slot, return the virtual or physical register number of - /// the source reg along with the FrameIndex of the loaded stack slot. If - /// not, return 0. This predicate must return 0 if the instruction has - /// any side effects other than storing to the stack slot. - virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const; }; } Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.5 llvm/lib/Target/ARM/ARMInstrInfo.td:1.6 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.5 Sat Jun 17 19:08:07 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Sun Jul 9 20:41:35 2006 @@ -12,7 +12,9 @@ // //===----------------------------------------------------------------------===// - +// Define ARM specific addressing mode. + //register or frame index +def raddr : ComplexPattern; //===----------------------------------------------------------------------===// // Instructions @@ -42,7 +44,7 @@ def ldr : InstARM<(ops IntRegs:$dst, IntRegs:$addr), "ldr $dst, [$addr]", - [(set IntRegs:$dst, (load IntRegs:$addr))]>; + [(set IntRegs:$dst, (load raddr:$addr))]>; def str : InstARM<(ops IntRegs:$src, IntRegs:$addr), "str $src, [$addr]", Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.5 llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.6 --- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.5 Tue Jun 27 16:52:45 2006 +++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Sun Jul 9 20:41:35 2006 @@ -81,7 +81,7 @@ MachineBasicBlock &MBB = *MI.getParent(); MachineFunction &MF = *MBB.getParent(); - assert (MI.getOpcode() == ARM::movri); + assert (MI.getOpcode() == ARM::ldr); unsigned FrameIdx = 1;